diff --git a/.gitignore b/.gitignore index 8509816..97d3453 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ .env installed.lock database.sqlite -.htaccess \ No newline at end of file +.htaccess +.editorconfig +.idea/* \ No newline at end of file diff --git a/application/app/Http/Controllers/Auth/AuthController.php b/application/app/Http/Controllers/Auth/AuthController.php index 4ad5c58..496c0aa 100644 --- a/application/app/Http/Controllers/Auth/AuthController.php +++ b/application/app/Http/Controllers/Auth/AuthController.php @@ -1,8 +1,8 @@ auth = $auth; - $this->registrar = $registrar; - $this->middleware('guest', ['except' => 'getLogout']); } + /** + * Get a validator for an incoming registration request. + * + * @param array $data + * @return \Illuminate\Contracts\Validation\Validator + */ + public function validator(array $data) + { + return Validator::make($data, [ + 'name' => 'required|max:255', + 'email' => 'required|email|max:255|unique:users', + 'password' => 'required|confirmed|min:6', + ]); + } + + /** + * Create a new user instance after a valid registration. + * + * @param array $data + * @return User + */ + public function create(array $data) + { + return User::create([ + 'name' => $data['name'], + 'email' => $data['email'], + 'password' => bcrypt($data['password']), + ]); + } + } diff --git a/application/app/Http/Controllers/Auth/PasswordController.php b/application/app/Http/Controllers/Auth/PasswordController.php index 3106193..4e324e9 100644 --- a/application/app/Http/Controllers/Auth/PasswordController.php +++ b/application/app/Http/Controllers/Auth/PasswordController.php @@ -1,8 +1,6 @@ auth = $auth; - $this->passwords = $passwords; - $this->middleware('guest'); } diff --git a/application/app/Http/Controllers/UserController.php b/application/app/Http/Controllers/UserController.php index b446ab0..94bedd3 100644 --- a/application/app/Http/Controllers/UserController.php +++ b/application/app/Http/Controllers/UserController.php @@ -92,7 +92,7 @@ public function update($id) $rules = array( 'name' => 'required|min:3|max:255', 'role' => 'required|numeric|role', - 'email' => 'required|email|max:255|unique:users,'.$id, + 'email' => 'required|email|max:255|unique:users,email,'.$id , 'password' => 'confirmed|min:6' ); diff --git a/application/app/Services/Registrar.php b/application/app/Services/Registrar.php deleted file mode 100644 index 1035468..0000000 --- a/application/app/Services/Registrar.php +++ /dev/null @@ -1,39 +0,0 @@ - 'required|max:255', - 'email' => 'required|email|max:255|unique:users', - 'password' => 'required|confirmed|min:6', - ]); - } - - /** - * Create a new user instance after a valid registration. - * - * @param array $data - * @return User - */ - public function create(array $data) - { - return User::create([ - 'name' => $data['name'], - 'email' => $data['email'], - 'password' => bcrypt($data['password']), - ]); - } - -} diff --git a/application/bootstrap/autoload.php b/application/bootstrap/autoload.php index e0d3db1..efd0e9a 100644 --- a/application/bootstrap/autoload.php +++ b/application/bootstrap/autoload.php @@ -27,7 +27,7 @@ | */ -if (file_exists($compiledPath = __DIR__.'/../vendor/compiled.php')) +if (file_exists($compiledPath = __DIR__.'/cache/compiled.php')) { require $compiledPath; } diff --git a/application/bootstrap/cache/.gitignore b/application/bootstrap/cache/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/application/bootstrap/cache/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/application/composer.json b/application/composer.json index d6c46c0..b9b75ef 100644 --- a/application/composer.json +++ b/application/composer.json @@ -5,8 +5,8 @@ "license": "cc-by-nc-sa 4.0", "type": "project", "require": { - "laravel/framework": "5.0.*", - "illuminate/html": "~5.0" + "laravel/framework": "5.1.*", + "laravelcollective/html": "5.1.*" }, "autoload": { "classmap": [ @@ -32,5 +32,7 @@ }, "config": { "preferred-install": "dist" + }, + "require-dev": { } } diff --git a/application/composer.lock b/application/composer.lock index 2166707..2e686f2 100644 --- a/application/composer.lock +++ b/application/composer.lock @@ -1,43 +1,36 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "hash": "875a4dff84c4ce124879826990d10d0a", - "content-hash": "dc967a3dbcebc6b7f21f1f6359ffd92e", + "content-hash": "caa30f5960724cf52d625ba91d0cc332", "packages": [ { "name": "classpreloader/classpreloader", - "version": "1.4.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/ClassPreloader/ClassPreloader.git", - "reference": "b76f3f4f603ebbe7e64351a7ef973431ddaf7b27" + "reference": "4729e438e0ada350f91148e7d4bb9809342575ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ClassPreloader/ClassPreloader/zipball/b76f3f4f603ebbe7e64351a7ef973431ddaf7b27", - "reference": "b76f3f4f603ebbe7e64351a7ef973431ddaf7b27", + "url": "https://api.github.com/repos/ClassPreloader/ClassPreloader/zipball/4729e438e0ada350f91148e7d4bb9809342575ff", + "reference": "4729e438e0ada350f91148e7d4bb9809342575ff", "shasum": "" }, "require": { - "nikic/php-parser": "~1.3", - "php": ">=5.3.3", - "symfony/console": "~2.1", - "symfony/filesystem": "~2.1", - "symfony/finder": "~2.1" + "nikic/php-parser": "^1.0|^2.0|^3.0", + "php": ">=5.5.9" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.8|^5.0" }, - "bin": [ - "classpreloader.php" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -56,7 +49,7 @@ }, { "name": "Graham Campbell", - "email": "graham@cachethq.io" + "email": "graham@alt-three.com" } ], "description": "Helps class loading performance by generating a single PHP file containing all of the autoloaded files for a specific use case", @@ -65,7 +58,7 @@ "class", "preload" ], - "time": "2015-05-26 10:57:51" + "time": "2017-12-10T11:40:39+00:00" }, { "name": "danielstjules/stringy", @@ -121,7 +114,7 @@ "utility", "utils" ], - "time": "2015-07-23 00:54:12" + "time": "2015-07-23T00:54:12+00:00" }, { "name": "dnoegel/php-xdg-base-dir", @@ -154,37 +147,37 @@ "MIT" ], "description": "implementation of xdg base directory specification for php", - "time": "2014-10-24 07:27:01" + "time": "2014-10-24T07:27:01+00:00" }, { "name": "doctrine/inflector", - "version": "v1.1.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "90b2128806bfde671b6952ab8bea493942c1fdae" + "reference": "5527a48b7313d15261292c149e55e26eae771b0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae", - "reference": "90b2128806bfde671b6952ab8bea493942c1fdae", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a", + "reference": "5527a48b7313d15261292c149e55e26eae771b0a", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "^6.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { - "psr-0": { - "Doctrine\\Common\\Inflector\\": "lib/" + "psr-4": { + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" } }, "notification-url": "https://packagist.org/downloads/", @@ -221,124 +214,36 @@ "singularize", "string" ], - "time": "2015-11-06 14:35:42" - }, - { - "name": "illuminate/html", - "version": "v5.0.0", - "source": { - "type": "git", - "url": "https://github.com/illuminate/html.git", - "reference": "3d1009bb8e0f25720c914af5c1f4015dd373c9ef" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/html/zipball/3d1009bb8e0f25720c914af5c1f4015dd373c9ef", - "reference": "3d1009bb8e0f25720c914af5c1f4015dd373c9ef", - "shasum": "" - }, - "require": { - "illuminate/http": "~5.0", - "illuminate/session": "~5.0", - "illuminate/support": "~5.0", - "php": ">=5.4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Html\\": "" - }, - "files": [ - "helpers.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylorotwell@gmail.com" - } - ], - "time": "2015-01-01 16:31:18" - }, - { - "name": "ircmaxell/password-compat", - "version": "v1.0.4", - "source": { - "type": "git", - "url": "https://github.com/ircmaxell/password_compat.git", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "4.*" - }, - "type": "library", - "autoload": { - "files": [ - "lib/password.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Anthony Ferrara", - "email": "ircmaxell@php.net", - "homepage": "http://blog.ircmaxell.com" - } - ], - "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", - "homepage": "https://github.com/ircmaxell/password_compat", - "keywords": [ - "hashing", - "password" - ], - "time": "2014-11-20 16:49:30" + "time": "2018-01-09T20:05:19+00:00" }, { "name": "jakub-onderka/php-console-color", - "version": "0.1", + "version": "v0.2", "source": { "type": "git", "url": "https://github.com/JakubOnderka/PHP-Console-Color.git", - "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1" + "reference": "d5deaecff52a0d61ccb613bb3804088da0307191" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1", - "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/d5deaecff52a0d61ccb613bb3804088da0307191", + "reference": "d5deaecff52a0d61ccb613bb3804088da0307191", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.4.0" }, "require-dev": { "jakub-onderka/php-code-style": "1.0", - "jakub-onderka/php-parallel-lint": "0.*", + "jakub-onderka/php-parallel-lint": "1.0", "jakub-onderka/php-var-dump-check": "0.*", - "phpunit/phpunit": "3.7.*", + "phpunit/phpunit": "~4.3", "squizlabs/php_codesniffer": "1.*" }, "type": "library", "autoload": { - "psr-0": { - "JakubOnderka\\PhpConsoleColor": "src/" + "psr-4": { + "JakubOnderka\\PhpConsoleColor\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -348,11 +253,10 @@ "authors": [ { "name": "Jakub Onderka", - "email": "jakub.onderka@gmail.com", - "homepage": "http://www.acci.cz" + "email": "jakub.onderka@gmail.com" } ], - "time": "2014-04-08 15:00:19" + "time": "2018-09-29T17:23:10+00:00" }, { "name": "jakub-onderka/php-console-highlighter", @@ -396,24 +300,24 @@ "homepage": "http://www.acci.cz/" } ], - "time": "2015-04-20 18:58:01" + "time": "2015-04-20T18:58:01+00:00" }, { - "name": "jeremeamia/SuperClosure", - "version": "2.2.0", + "name": "jeremeamia/superclosure", + "version": "2.4.0", "source": { "type": "git", "url": "https://github.com/jeremeamia/super_closure.git", - "reference": "29a88be2a4846d27c1613aed0c9071dfad7b5938" + "reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/29a88be2a4846d27c1613aed0c9071dfad7b5938", - "reference": "29a88be2a4846d27c1613aed0c9071dfad7b5938", + "url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/5707d5821b30b9a07acfb4d76949784aaa0e9ce9", + "reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9", "shasum": "" }, "require": { - "nikic/php-parser": "^1.2|^2.0", + "nikic/php-parser": "^1.2|^2.0|^3.0|^4.0", "php": ">=5.4", "symfony/polyfill-php56": "^1.0" }, @@ -423,7 +327,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "2.4-dev" } }, "autoload": { @@ -454,52 +358,98 @@ "serialize", "tokenizer" ], - "time": "2015-12-05 17:17:57" + "time": "2018-03-21T22:21:57+00:00" + }, + { + "name": "kylekatarnls/update-helper", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/kylekatarnls/update-helper.git", + "reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kylekatarnls/update-helper/zipball/5786fa188e0361b9adf9e8199d7280d1b2db165e", + "reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1.0 || ^2.0.0", + "php": ">=5.3.0" + }, + "require-dev": { + "codeclimate/php-test-reporter": "dev-master", + "composer/composer": "2.0.x-dev || ^2.0.0-dev", + "phpunit/phpunit": ">=4.8.35 <6.0" + }, + "type": "composer-plugin", + "extra": { + "class": "UpdateHelper\\ComposerPlugin" + }, + "autoload": { + "psr-0": { + "UpdateHelper\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kyle", + "email": "kylekatarnls@gmail.com" + } + ], + "description": "Update helper", + "time": "2019-07-29T11:03:54+00:00" }, { "name": "laravel/framework", - "version": "v5.0.34", + "version": "v5.1.46", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "98dbaafe8e2781f86b1b858f8610be0d7318b153" + "reference": "7f2f892e62163138121e8210b92b21394fda8d1c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/98dbaafe8e2781f86b1b858f8610be0d7318b153", - "reference": "98dbaafe8e2781f86b1b858f8610be0d7318b153", + "url": "https://api.github.com/repos/laravel/framework/zipball/7f2f892e62163138121e8210b92b21394fda8d1c", + "reference": "7f2f892e62163138121e8210b92b21394fda8d1c", "shasum": "" }, "require": { - "classpreloader/classpreloader": "~1.2", + "classpreloader/classpreloader": "~2.0|~3.0", "danielstjules/stringy": "~1.8", "doctrine/inflector": "~1.0", "ext-mbstring": "*", - "ext-mcrypt": "*", "ext-openssl": "*", - "ircmaxell/password-compat": "~1.0", "jeremeamia/superclosure": "~2.0", "league/flysystem": "~1.0", "monolog/monolog": "~1.11", "mtdowling/cron-expression": "~1.0", - "nesbot/carbon": "~1.0", - "php": ">=5.4.0", - "psy/psysh": "0.4.*", + "nesbot/carbon": "~1.19", + "paragonie/random_compat": "~1.4", + "php": ">=5.5.9", + "psy/psysh": "0.7.*", "swiftmailer/swiftmailer": "~5.1", - "symfony/console": "2.6.*", - "symfony/debug": "2.6.*", - "symfony/finder": "2.6.*", - "symfony/http-foundation": "2.6.*", - "symfony/http-kernel": "2.6.*", - "symfony/process": "2.6.*", - "symfony/routing": "2.6.*", - "symfony/security-core": "2.6.*", - "symfony/translation": "2.6.*", - "symfony/var-dumper": "2.6.*", + "symfony/console": "2.7.*", + "symfony/css-selector": "2.7.*|2.8.*", + "symfony/debug": "2.7.*", + "symfony/dom-crawler": "2.7.*", + "symfony/finder": "2.7.*", + "symfony/http-foundation": "2.7.*", + "symfony/http-kernel": "2.7.*", + "symfony/process": "2.7.*", + "symfony/routing": "2.7.*", + "symfony/translation": "2.7.*", + "symfony/var-dumper": "2.7.*", "vlucas/phpdotenv": "~1.0" }, "replace": { "illuminate/auth": "self.version", + "illuminate/broadcasting": "self.version", "illuminate/bus": "self.version", "illuminate/cache": "self.version", "illuminate/config": "self.version", @@ -512,7 +462,6 @@ "illuminate/events": "self.version", "illuminate/exception": "self.version", "illuminate/filesystem": "self.version", - "illuminate/foundation": "self.version", "illuminate/hashing": "self.version", "illuminate/http": "self.version", "illuminate/log": "self.version", @@ -529,27 +478,30 @@ "illuminate/view": "self.version" }, "require-dev": { - "aws/aws-sdk-php": "~2.4", - "iron-io/iron_mq": "~1.5", - "mockery/mockery": "~0.9", + "aws/aws-sdk-php": "~3.0", + "iron-io/iron_mq": "~2.0", + "mockery/mockery": "~0.9.4", "pda/pheanstalk": "~3.0", "phpunit/phpunit": "~4.0", "predis/predis": "~1.0" }, "suggest": { - "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~2.4).", + "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~3.0).", "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).", - "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers (~5.0).", - "iron-io/iron_mq": "Required to use the iron queue driver (~1.5).", - "league/flysystem-aws-s3-v2": "Required to use the Flysystem S3 driver (~1.0).", + "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", + "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~5.3|~6.0).", + "iron-io/iron_mq": "Required to use the iron queue driver (~2.0).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).", "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).", "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).", - "predis/predis": "Required to use the redis cache and queue drivers (~1.0)." + "predis/predis": "Required to use the redis cache and queue drivers (~1.0).", + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0).", + "symfony/psr-http-message-bridge": "Required to psr7 bridging features (0.2.*)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -580,48 +532,98 @@ "framework", "laravel" ], - "time": "2015-12-04 23:20:49" + "time": "2017-03-24T16:31:45+00:00" + }, + { + "name": "laravelcollective/html", + "version": "v5.1.11", + "source": { + "type": "git", + "url": "https://github.com/LaravelCollective/html.git", + "reference": "99342cc22507cf8d7178bb390c215968183993bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/LaravelCollective/html/zipball/99342cc22507cf8d7178bb390c215968183993bb", + "reference": "99342cc22507cf8d7178bb390c215968183993bb", + "shasum": "" + }, + "require": { + "illuminate/http": "5.1.*", + "illuminate/routing": "5.1.*", + "illuminate/session": "5.1.*", + "illuminate/support": "5.1.*", + "php": ">=5.5.9" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Collective\\Html\\": "src/" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" + }, + { + "name": "Adam Engebretson", + "email": "adam@laravelcollective.com" + } + ], + "time": "2017-09-07T18:12:11+00:00" }, { "name": "league/flysystem", - "version": "1.0.15", + "version": "1.0.57", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "31525caf9e8772683672fefd8a1ca0c0736020f4" + "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/31525caf9e8772683672fefd8a1ca0c0736020f4", - "reference": "31525caf9e8772683672fefd8a1ca0c0736020f4", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", + "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", "shasum": "" }, "require": { - "php": ">=5.4.0" + "ext-fileinfo": "*", + "php": ">=5.5.9" }, "conflict": { "league/flysystem-sftp": "<1.0.6" }, "require-dev": { - "ext-fileinfo": "*", - "mockery/mockery": "~0.9", - "phpspec/phpspec": "^2.2", - "phpspec/prophecy-phpunit": "~1.0", - "phpunit/phpunit": "~4.1" + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7.10" }, "suggest": { "ext-fileinfo": "Required for MimeType", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-copy": "Allows you to use Copy.com storage", - "league/flysystem-dropbox": "Allows you to use Dropbox storage", "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter" + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" }, "type": "library", "extra": { @@ -664,20 +666,20 @@ "sftp", "storage" ], - "time": "2015-09-30 22:26:59" + "time": "2019-10-16T21:01:05+00:00" }, { "name": "monolog/monolog", - "version": "1.17.2", + "version": "1.25.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24" + "reference": "70e65a5470a42cfec1a7da00d30edb6e617e8dcf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bee7f0dc9c3e0b69a6039697533dca1e845c8c24", - "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/70e65a5470a42cfec1a7da00d30edb6e617e8dcf", + "reference": "70e65a5470a42cfec1a7da00d30edb6e617e8dcf", "shasum": "" }, "require": { @@ -688,17 +690,17 @@ "psr/log-implementation": "1.0.0" }, "require-dev": { - "aws/aws-sdk-php": "^2.4.9", + "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", "graylog2/gelf-php": "~1.0", "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", "php-console/php-console": "^3.1.3", "phpunit/phpunit": "~4.5", "phpunit/phpunit-mock-objects": "2.3.0", - "raven/raven": "^0.13", "ruflin/elastica": ">=0.90 <3.0", - "swiftmailer/swiftmailer": "~5.3", - "videlalvaro/php-amqplib": "~2.4" + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "^5.3|^6.0" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", @@ -706,16 +708,17 @@ "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", "ext-mongo": "Allow sending log messages to a MongoDB server", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", "php-console/php-console": "Allow sending log messages to Google Chrome", - "raven/raven": "Allow sending log messages to a Sentry server", "rollbar/rollbar": "Allow sending log messages to Rollbar", "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib" + "sentry/sentry": "Allow sending log messages to a Sentry server" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.16.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -741,32 +744,32 @@ "logging", "psr-3" ], - "time": "2015-10-14 12:51:02" + "time": "2019-09-06T13:49:17+00:00" }, { "name": "mtdowling/cron-expression", - "version": "v1.0.4", + "version": "v1.2.1", "source": { "type": "git", "url": "https://github.com/mtdowling/cron-expression.git", - "reference": "fd92e883195e5dfa77720b1868cf084b08be4412" + "reference": "9504fa9ea681b586028adaaa0877db4aecf32bad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mtdowling/cron-expression/zipball/fd92e883195e5dfa77720b1868cf084b08be4412", - "reference": "fd92e883195e5dfa77720b1868cf084b08be4412", + "url": "https://api.github.com/repos/mtdowling/cron-expression/zipball/9504fa9ea681b586028adaaa0877db4aecf32bad", + "reference": "9504fa9ea681b586028adaaa0877db4aecf32bad", "shasum": "" }, "require": { "php": ">=5.3.2" }, "require-dev": { - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "~4.0|~5.0" }, "type": "library", "autoload": { - "psr-0": { - "Cron": "src/" + "psr-4": { + "Cron\\": "src/Cron/" } }, "notification-url": "https://packagist.org/downloads/", @@ -785,33 +788,47 @@ "cron", "schedule" ], - "time": "2015-01-11 23:07:46" + "time": "2017-01-23T04:29:33+00:00" }, { "name": "nesbot/carbon", - "version": "1.21.0", + "version": "1.39.1", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "7b08ec6f75791e130012f206e3f7b0e76e18e3d7" + "reference": "4be0c005164249208ce1b5ca633cd57bdd42ff33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7b08ec6f75791e130012f206e3f7b0e76e18e3d7", - "reference": "7b08ec6f75791e130012f206e3f7b0e76e18e3d7", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4be0c005164249208ce1b5ca633cd57bdd42ff33", + "reference": "4be0c005164249208ce1b5ca633cd57bdd42ff33", "shasum": "" }, "require": { - "php": ">=5.3.0", - "symfony/translation": "~2.6|~3.0" + "kylekatarnls/update-helper": "^1.1", + "php": ">=5.3.9", + "symfony/translation": "~2.6 || ~3.0 || ~4.0" }, "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" + "composer/composer": "^1.2", + "friendsofphp/php-cs-fixer": "~2", + "phpunit/phpunit": "^4.8.35 || ^5.7" }, + "bin": [ + "bin/upgrade-carbon" + ], "type": "library", + "extra": { + "update-helper": "Carbon\\Upgrade", + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + } + }, "autoload": { "psr-4": { - "Carbon\\": "src/Carbon/" + "": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -832,36 +849,42 @@ "datetime", "time" ], - "time": "2015-11-04 20:07:17" + "time": "2019-10-14T05:51:36+00:00" }, { "name": "nikic/php-parser", - "version": "v1.4.1", + "version": "v2.1.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51" + "reference": "4dd659edadffdc2143e4753df655d866dbfeedf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51", - "reference": "f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4dd659edadffdc2143e4753df655d866dbfeedf0", + "reference": "4dd659edadffdc2143e4753df655d866dbfeedf0", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3" + "php": ">=5.4" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" }, + "bin": [ + "bin/php-parse" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.1-dev" } }, "autoload": { - "files": [ - "lib/bootstrap.php" - ] + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -877,26 +900,82 @@ "parser", "php" ], - "time": "2015-09-19 14:15:08" + "time": "2016-09-16T12:04:44+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v1.4.3", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "9b3899e3c3ddde89016f576edb8c489708ad64cd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/9b3899e3c3ddde89016f576edb8c489708ad64cd", + "reference": "9b3899e3c3ddde89016f576edb8c489708ad64cd", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ], + "time": "2018-04-04T21:48:54+00:00" }, { "name": "psr/log", - "version": "1.0.0", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", "shasum": "" }, + "require": { + "php": ">=5.3.0" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, "autoload": { - "psr-0": { - "Psr\\Log\\": "" + "psr-4": { + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -910,37 +989,39 @@ } ], "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ "log", "psr", "psr-3" ], - "time": "2012-12-21 11:40:51" + "time": "2019-11-01T11:05:21+00:00" }, { "name": "psy/psysh", - "version": "v0.4.4", + "version": "v0.7.2", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "489816db71649bd95b416e3ed9062d40528ab0ac" + "reference": "e64e10b20f8d229cac76399e1f3edddb57a0f280" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/489816db71649bd95b416e3ed9062d40528ab0ac", - "reference": "489816db71649bd95b416e3ed9062d40528ab0ac", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/e64e10b20f8d229cac76399e1f3edddb57a0f280", + "reference": "e64e10b20f8d229cac76399e1f3edddb57a0f280", "shasum": "" }, "require": { "dnoegel/php-xdg-base-dir": "0.1", "jakub-onderka/php-console-highlighter": "0.3.*", - "nikic/php-parser": "~1.0", - "php": ">=5.3.0", - "symfony/console": "~2.3.10|~2.4.2|~2.5" + "nikic/php-parser": "^1.2.1|~2.0", + "php": ">=5.3.9", + "symfony/console": "~2.3.10|^2.4.2|~3.0", + "symfony/var-dumper": "~2.7|~3.0" }, "require-dev": { "fabpot/php-cs-fixer": "~1.5", - "phpunit/phpunit": "~3.7|~4.0", + "phpunit/phpunit": "~3.7|~4.0|~5.0", "squizlabs/php_codesniffer": "~2.0", "symfony/finder": "~2.1|~3.0" }, @@ -956,15 +1037,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-develop": "0.4.x-dev" + "dev-develop": "0.8.x-dev" } }, "autoload": { "files": [ "src/Psy/functions.php" ], - "psr-0": { - "Psy\\": "src/" + "psr-4": { + "Psy\\": "src/Psy/" } }, "notification-url": "https://packagist.org/downloads/", @@ -986,27 +1067,28 @@ "interactive", "shell" ], - "time": "2015-03-26 18:43:54" + "time": "2016-03-09T05:03:14+00:00" }, { "name": "swiftmailer/swiftmailer", - "version": "v5.4.1", + "version": "v5.4.12", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421" + "reference": "181b89f18a90f8925ef805f950d47a7190e9b950" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/0697e6aa65c83edf97bb0f23d8763f94e3f11421", - "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/181b89f18a90f8925ef805f950d47a7190e9b950", + "reference": "181b89f18a90f8925ef805f950d47a7190e9b950", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "mockery/mockery": "~0.9.1,<0.9.4" + "mockery/mockery": "~0.9.1", + "symfony/phpunit-bridge": "~3.2" }, "type": "library", "extra": { @@ -1033,53 +1115,55 @@ } ], "description": "Swiftmailer, free feature-rich PHP mailer", - "homepage": "http://swiftmailer.org", + "homepage": "https://swiftmailer.symfony.com", "keywords": [ "email", "mail", "mailer" ], - "time": "2015-06-06 14:19:39" + "time": "2018-07-31T09:26:32+00:00" }, { "name": "symfony/console", - "version": "v2.6.12", - "target-dir": "Symfony/Component/Console", + "version": "v2.7.51", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359" + "reference": "574cb4cfaa01ba115fc2fc0c2355b2c5472a4804" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0e5e18ae09d3f5c06367759be940e9ed3f568359", - "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359", + "url": "https://api.github.com/repos/symfony/console/zipball/574cb4cfaa01ba115fc2fc0c2355b2c5472a4804", + "reference": "574cb4cfaa01ba115fc2fc0c2355b2c5472a4804", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9", + "symfony/debug": "^2.7.2" }, "require-dev": { "psr/log": "~1.0", "symfony/event-dispatcher": "~2.1", - "symfony/phpunit-bridge": "~2.7", "symfony/process": "~2.1" }, "suggest": { - "psr/log": "For using the console logger", + "psr/log-implementation": "For using the console logger", "symfony/event-dispatcher": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Console\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1097,25 +1181,77 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2015-07-26 09:08:40" + "time": "2018-05-13T15:44:36+00:00" + }, + { + "name": "symfony/css-selector", + "version": "v2.8.50", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "7b1692e418d7ccac24c373528453bc90e42797de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/7b1692e418d7ccac24c373528453bc90e42797de", + "reference": "7b1692e418d7ccac24c373528453bc90e42797de", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com", + "time": "2018-11-11T11:18:13+00:00" }, { "name": "symfony/debug", - "version": "v2.6.12", - "target-dir": "Symfony/Component/Debug", + "version": "v2.7.51", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "fca5696e0c9787722baa8f2ad6940dfd7a6a6941" + "reference": "4a7330f29b3d215f8bacf076689f9d1c3d568681" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/fca5696e0c9787722baa8f2ad6940dfd7a6a6941", - "reference": "fca5696e0c9787722baa8f2ad6940dfd7a6a6941", + "url": "https://api.github.com/repos/symfony/debug/zipball/4a7330f29b3d215f8bacf076689f9d1c3d568681", + "reference": "4a7330f29b3d215f8bacf076689f9d1c3d568681", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": ">=5.3.9", "psr/log": "~1.0" }, "conflict": { @@ -1123,24 +1259,21 @@ }, "require-dev": { "symfony/class-loader": "~2.2", - "symfony/http-foundation": "~2.1", - "symfony/http-kernel": "~2.3.24|~2.5.9|~2.6,>=2.6.2", - "symfony/phpunit-bridge": "~2.7" - }, - "suggest": { - "symfony/http-foundation": "", - "symfony/http-kernel": "" + "symfony/http-kernel": "~2.3.24|~2.5.9|^2.6.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Debug\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1158,45 +1291,41 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2015-07-08 05:59:48" + "time": "2018-08-03T11:24:48+00:00" }, { - "name": "symfony/event-dispatcher", - "version": "v2.8.0", + "name": "symfony/dom-crawler", + "version": "v2.7.51", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc" + "url": "https://github.com/symfony/dom-crawler.git", + "reference": "d905e1c5885735ee66af60c205429b9941f24752" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a5eb815363c0388e83247e7e9853e5dbc14999cc", - "reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/d905e1c5885735ee66af60c205429b9941f24752", + "reference": "d905e1c5885735ee66af60c205429b9941f24752", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.3.9", + "symfony/polyfill-ctype": "~1.8" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.6|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0" + "symfony/css-selector": "~2.3" }, "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" + "symfony/css-selector": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" + "Symfony\\Component\\DomCrawler\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1216,27 +1345,38 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony EventDispatcher Component", + "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2015-10-30 20:15:42" + "time": "2018-05-01T22:30:49+00:00" }, { - "name": "symfony/filesystem", - "version": "v2.8.0", + "name": "symfony/event-dispatcher", + "version": "v2.8.50", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "3e661a0d521ac67496515fa6e6704bd61bcfff60" + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "a77e974a5fecb4398833b0709210e3d5e334ffb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/3e661a0d521ac67496515fa6e6704bd61bcfff60", - "reference": "3e661a0d521ac67496515fa6e6704bd61bcfff60", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a77e974a5fecb4398833b0709210e3d5e334ffb0", + "reference": "a77e974a5fecb4398833b0709210e3d5e334ffb0", "shasum": "" }, "require": { "php": ">=5.3.9" }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^2.0.5|~3.0.0", + "symfony/dependency-injection": "~2.6|~3.0.0", + "symfony/expression-language": "~2.6|~3.0.0", + "symfony/stopwatch": "~2.3|~3.0.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, "type": "library", "extra": { "branch-alias": { @@ -1245,7 +1385,7 @@ }, "autoload": { "psr-4": { - "Symfony\\Component\\Filesystem\\": "" + "Symfony\\Component\\EventDispatcher\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1265,41 +1405,40 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2015-11-23 10:19:46" + "time": "2018-11-21T14:20:20+00:00" }, { "name": "symfony/finder", - "version": "v2.6.12", - "target-dir": "Symfony/Component/Finder", + "version": "v2.7.51", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "203a10f928ae30176deeba33512999233181dd28" + "reference": "34226a3aa279f1e356ad56181b91acfdc9a2525c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/203a10f928ae30176deeba33512999233181dd28", - "reference": "203a10f928ae30176deeba33512999233181dd28", + "url": "https://api.github.com/repos/symfony/finder/zipball/34226a3aa279f1e356ad56181b91acfdc9a2525c", + "reference": "34226a3aa279f1e356ad56181b91acfdc9a2525c", "shasum": "" }, "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Finder\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1317,42 +1456,44 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2015-07-09 16:02:48" + "time": "2018-05-14T06:36:14+00:00" }, { "name": "symfony/http-foundation", - "version": "v2.6.12", - "target-dir": "Symfony/Component/HttpFoundation", + "version": "v2.7.51", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c" + "reference": "b67e5cbd2bf837fb3681f2c4965826d6c6758532" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", - "reference": "e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/b67e5cbd2bf837fb3681f2c4965826d6c6758532", + "reference": "b67e5cbd2bf837fb3681f2c4965826d6c6758532", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9", + "symfony/polyfill-mbstring": "~1.1" }, "require-dev": { - "symfony/expression-language": "~2.4", - "symfony/phpunit-bridge": "~2.7" + "symfony/expression-language": "~2.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\HttpFoundation\\": "" }, "classmap": [ - "Symfony/Component/HttpFoundation/Resources/stubs" + "Resources/stubs" + ], + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1371,46 +1512,49 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2015-07-22 10:08:40" + "time": "2019-04-16T09:58:21+00:00" }, { "name": "symfony/http-kernel", - "version": "v2.6.12", - "target-dir": "Symfony/Component/HttpKernel", + "version": "v2.7.52", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "498866a8ca0bcbcd3f3824b1520fa568ff7ca3b6" + "reference": "435064b3b143f79469206915137c21e88b56bfb9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/498866a8ca0bcbcd3f3824b1520fa568ff7ca3b6", - "reference": "498866a8ca0bcbcd3f3824b1520fa568ff7ca3b6", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/435064b3b143f79469206915137c21e88b56bfb9", + "reference": "435064b3b143f79469206915137c21e88b56bfb9", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": ">=5.3.9", "psr/log": "~1.0", - "symfony/debug": "~2.6,>=2.6.2", - "symfony/event-dispatcher": "~2.6,>=2.6.7", - "symfony/http-foundation": "~2.5,>=2.5.4" + "symfony/debug": "^2.6.2", + "symfony/event-dispatcher": "^2.6.7", + "symfony/http-foundation": "~2.7.36|^2.8.29", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/config": "<2.7", + "twig/twig": "<1.34|<2.4,>=2" }, "require-dev": { "symfony/browser-kit": "~2.3", "symfony/class-loader": "~2.1", - "symfony/config": "~2.0,>=2.0.5", + "symfony/config": "~2.7", "symfony/console": "~2.3", - "symfony/css-selector": "~2.0,>=2.0.5", + "symfony/css-selector": "^2.0.5", "symfony/dependency-injection": "~2.2", - "symfony/dom-crawler": "~2.0,>=2.0.5", + "symfony/dom-crawler": "^2.0.5", "symfony/expression-language": "~2.4", - "symfony/finder": "~2.0,>=2.0.5", - "symfony/phpunit-bridge": "~2.7", - "symfony/process": "~2.0,>=2.0.5", + "symfony/finder": "^2.0.5", + "symfony/process": "^2.0.5", "symfony/routing": "~2.2", "symfony/stopwatch": "~2.3", "symfony/templating": "~2.2", - "symfony/translation": "~2.0,>=2.0.5", + "symfony/translation": "^2.0.5", "symfony/var-dumper": "~2.6" }, "suggest": { @@ -1425,13 +1569,16 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\HttpKernel\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1449,20 +1596,137 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2015-11-23 11:37:53" + "time": "2019-04-17T16:37:53+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.12.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-08-06T08:03:45+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.12.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2019-08-06T08:03:45+00:00" }, { "name": "symfony/polyfill-php56", - "version": "v1.0.0", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php56.git", - "reference": "a6bd4770a6967517e6610529e14afaa3111094a3" + "reference": "0e3b212e96a51338639d8ce175c046d7729c3403" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/a6bd4770a6967517e6610529e14afaa3111094a3", - "reference": "a6bd4770a6967517e6610529e14afaa3111094a3", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/0e3b212e96a51338639d8ce175c046d7729c3403", + "reference": "0e3b212e96a51338639d8ce175c046d7729c3403", "shasum": "" }, "require": { @@ -1472,7 +1736,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.12-dev" } }, "autoload": { @@ -1505,20 +1769,20 @@ "portable", "shim" ], - "time": "2015-11-04 20:28:58" + "time": "2019-08-06T08:03:45+00:00" }, { "name": "symfony/polyfill-util", - "version": "v1.0.0", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-util.git", - "reference": "4271c55cbc0a77b2641f861b978123e46b3da969" + "reference": "4317de1386717b4c22caed7725350a8887ab205c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/4271c55cbc0a77b2641f861b978123e46b3da969", - "reference": "4271c55cbc0a77b2641f861b978123e46b3da969", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/4317de1386717b4c22caed7725350a8887ab205c", + "reference": "4317de1386717b4c22caed7725350a8887ab205c", "shasum": "" }, "require": { @@ -1527,7 +1791,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.12-dev" } }, "autoload": { @@ -1557,39 +1821,38 @@ "polyfill", "shim" ], - "time": "2015-11-04 20:28:58" + "time": "2019-08-06T08:03:45+00:00" }, { "name": "symfony/process", - "version": "v2.6.12", - "target-dir": "Symfony/Component/Process", + "version": "v2.7.51", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "57f1e88bb5dafa449b83f9f265b11d52d517b3e9" + "reference": "eda637e05670e2afeec3842dcd646dce94262f6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/57f1e88bb5dafa449b83f9f265b11d52d517b3e9", - "reference": "57f1e88bb5dafa449b83f9f265b11d52d517b3e9", + "url": "https://api.github.com/repos/symfony/process/zipball/eda637e05670e2afeec3842dcd646dce94262f6b", + "reference": "eda637e05670e2afeec3842dcd646dce94262f6b", "shasum": "" }, "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Process\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1607,52 +1870,57 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2015-06-30 16:10:16" + "time": "2018-08-03T11:24:48+00:00" }, { "name": "symfony/routing", - "version": "v2.6.12", - "target-dir": "Symfony/Component/Routing", + "version": "v2.7.51", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "0a1764d41bbb54f3864808c50569ac382b44d128" + "reference": "33bd5882f201f9a3b7dd9640b95710b71304c4fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/0a1764d41bbb54f3864808c50569ac382b44d128", - "reference": "0a1764d41bbb54f3864808c50569ac382b44d128", + "url": "https://api.github.com/repos/symfony/routing/zipball/33bd5882f201f9a3b7dd9640b95710b71304c4fb", + "reference": "33bd5882f201f9a3b7dd9640b95710b71304c4fb", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "conflict": { + "symfony/config": "<2.7" }, "require-dev": { "doctrine/annotations": "~1.0", "doctrine/common": "~2.2", "psr/log": "~1.0", - "symfony/config": "~2.2", + "symfony/config": "~2.7", "symfony/expression-language": "~2.4", "symfony/http-foundation": "~2.3", - "symfony/phpunit-bridge": "~2.7", - "symfony/yaml": "~2.0,>=2.0.5" + "symfony/yaml": "^2.0.5" }, "suggest": { "doctrine/annotations": "For using the annotation loader", "symfony/config": "For using the all-in-one router or any loader", "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", "symfony/yaml": "For using the YAML loader" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Routing\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1676,112 +1944,52 @@ "uri", "url" ], - "time": "2015-07-09 16:02:48" - }, - { - "name": "symfony/security-core", - "version": "v2.6.12", - "target-dir": "Symfony/Component/Security/Core", - "source": { - "type": "git", - "url": "https://github.com/symfony/security-core.git", - "reference": "05f58bb3814e8a853332dc448e3b7addaa87679c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/05f58bb3814e8a853332dc448e3b7addaa87679c", - "reference": "05f58bb3814e8a853332dc448e3b7addaa87679c", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "ircmaxell/password-compat": "1.0.*", - "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1", - "symfony/expression-language": "~2.6", - "symfony/http-foundation": "~2.4", - "symfony/phpunit-bridge": "~2.7", - "symfony/translation": "~2.0,>=2.0.5", - "symfony/validator": "~2.5,>=2.5.5" - }, - "suggest": { - "ircmaxell/password-compat": "For using the BCrypt password encoder in PHP <5.5", - "symfony/event-dispatcher": "", - "symfony/expression-language": "For using the expression voter", - "symfony/http-foundation": "", - "symfony/validator": "For using the user password constraint" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Security\\Core\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Security Component - Core Library", - "homepage": "https://symfony.com", - "time": "2015-07-22 10:08:40" + "time": "2018-02-28T09:36:59+00:00" }, { "name": "symfony/translation", - "version": "v2.6.12", - "target-dir": "Symfony/Component/Translation", + "version": "v2.7.51", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "d84291215b5892834dd8ca8ee52f9cbdb8274904" + "reference": "1959c78c5a32539ef221b3e18a961a96d949118f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/d84291215b5892834dd8ca8ee52f9cbdb8274904", - "reference": "d84291215b5892834dd8ca8ee52f9cbdb8274904", + "url": "https://api.github.com/repos/symfony/translation/zipball/1959c78c5a32539ef221b3e18a961a96d949118f", + "reference": "1959c78c5a32539ef221b3e18a961a96d949118f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "conflict": { + "symfony/config": "<2.7" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.3,>=2.3.12", - "symfony/intl": "~2.3", - "symfony/phpunit-bridge": "~2.7", + "symfony/config": "~2.7", + "symfony/intl": "~2.7.25|^2.8.18", "symfony/yaml": "~2.2" }, "suggest": { - "psr/log": "To use logging capability in translator", + "psr/log-implementation": "To use logging capability in translator", "symfony/config": "", "symfony/yaml": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Translation\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1799,28 +2007,27 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2015-07-08 05:59:48" + "time": "2018-05-17T10:34:06+00:00" }, { "name": "symfony/var-dumper", - "version": "v2.6.12", - "target-dir": "Symfony/Component/VarDumper", + "version": "v2.7.51", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "5fba957a30161d8724aade093593cd22f815bea2" + "reference": "6f9271e94369db05807b261fcfefe4cd1aafd390" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/5fba957a30161d8724aade093593cd22f815bea2", - "reference": "5fba957a30161d8724aade093593cd22f815bea2", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/6f9271e94369db05807b261fcfefe4cd1aafd390", + "reference": "6f9271e94369db05807b261fcfefe4cd1aafd390", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" }, "suggest": { "ext-symfony_debug": "" @@ -1828,16 +2035,19 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { "files": [ "Resources/functions/dump.php" ], - "psr-0": { + "psr-4": { "Symfony\\Component\\VarDumper\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1859,7 +2069,7 @@ "debug", "dump" ], - "time": "2015-07-01 10:03:42" + "time": "2018-04-22T05:56:10+00:00" }, { "name": "vlucas/phpdotenv", @@ -1905,7 +2115,7 @@ "env", "environment" ], - "time": "2015-05-30 15:59:26" + "time": "2015-05-30T15:59:26+00:00" } ], "packages-dev": [], diff --git a/application/config/app.php b/application/config/app.php index b5f5c7c..267d1f3 100644 --- a/application/config/app.php +++ b/application/config/app.php @@ -80,7 +80,7 @@ 'key' => env('APP_KEY', 'SomeRandomStringForThisApp123456'), - 'cipher' => MCRYPT_RIJNDAEL_128, + 'cipher' => "AES-256-CBC", /* |-------------------------------------------------------------------------- @@ -135,7 +135,8 @@ 'Illuminate\Translation\TranslationServiceProvider', 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', - 'Illuminate\Html\HtmlServiceProvider', + Collective\Html\HtmlServiceProvider::class, + 'Illuminate\Broadcasting\BroadcastServiceProvider', /* * Application Service Providers... @@ -194,8 +195,8 @@ 'URL' => 'Illuminate\Support\Facades\URL', 'Validator' => 'Illuminate\Support\Facades\Validator', 'View' => 'Illuminate\Support\Facades\View', - 'Form' => 'Illuminate\Html\FormFacade', - 'HTML' => 'Illuminate\Html\HtmlFacade', + 'Form' => Collective\Html\FormFacade::class, + 'HTML' => Collective\Html\HtmlFacade::class, ], diff --git a/application/resources/lang/de/app.php b/application/resources/lang/de/app.php index fedf504..dd46d95 100644 --- a/application/resources/lang/de/app.php +++ b/application/resources/lang/de/app.php @@ -51,131 +51,128 @@ "admin" => "Admin", ], - "bonemeal" => "BoNeMEAL", - "home" => "Startseite", - "login" => "Einloggen", - "logout" => "Ausloggen", - "register" => "Anmelden", - "toggleNav" => "Navigation verstecken", - "whoops" => "Hoppla!", - "inputErrors" => "Bei deiner Eingabe traten Fehler auf.", - "username" => "Benutzername", - "email" => "E-Mail Addresse", - "password" => "Passwort", - "confirmPassword" => "Passwort bestätigen", - "forgotPassword" => "Passwort vergessen", - "resetPassword" => "Passwort zurücksetzen", - "sendPasswordResetLink" => "Passwort Zurücksetzungslink senden", - "signupForMod" => "Bist du Moderator oder Admin auf diesem Server-Netzwerk? Melde dich jetzt an, um Bans, Mutes und Kicks des Servers zu verwalten.", - "adminMustEnableAccount" => "Ein Admin muss deinen Account bestätigen, bevor du Zugang erhälst.", - "createAccount" => "Account erstellen", - "loginToAdmin" => "Melde dich an, um Strafen auf diesem Server mit BoNeMEAL zu verwalten.", - "notice" => "Notizen", - "error" => "Fehler", - "warning" => "Warnung", "about" => "Über", "aboutUs" => "Über: BoNeMEAL", "aboutUsLead" => "Einen Server zu leiten ist schwer. Spieler für Missverhalten sollte das nicht sein.", - "aboutUsText" => "Die BanManagement Web App (BoNeMEAL) lässt dich online deine Bans,Mutes und Kicks des Servers verwalten. - Es wurde als Erweiterung für das Bukkit Plugin Ban Management erstellt von confuserr gemacht. - Die beste Kombination ist BoNeMEAL und BanManagement von confuserr.", - "learnMore" => "Mehr herausfinden", - "noPermission" => "Du hast dazu keine Berechtigung.", - "causedTroubleQuestion" => "Hast du Ärger bereitet?", - "enterPlayerName" => "Gebe deinen Spieler-Namen ein...", - "check" => "Prüfen", - "playerNotFound" => "Ein Spieler mit diesem Namen existiert nicht...", - "reason" => "Grund", - "expires" => "Läuft ab", - "expired" => "Abgelaufen", - "noExpire" => "Läuft nicht ab (Permanent).", - "banned" => "Gebannt", - "unbanned" => "Entbannt", - "muted" => "Gemuted", - "unmuted" => "Entmuted", - "warned" => "Verwarnt", - "noteAdded" => "Hinweis hinzugefügt", - "unbannedBy" => "Entbannt :time von :actor.", - "unmutedBy" => "Entmuted :time von :actor.", - "onServer" => "auf :server", - "never" => "Niemals", - - "noJs" => "Javascript ist deaktiviert!", - "noJsText" => "Bitte aktiviere Javascript und aktualisiere diese Seite.", - - "dashboard" => "Status", - "configuration" => "Einstellungen", - "searchPlayer" => "Spieler suchen...", - "players" => "Spieler", - "player" => "Spieler", - "activePunishments" => "Aktive Einträge", + "aboutUsText" => "Die BanManagement Web App (BoNeMEAL) lässt dich online deine Bans,Mutes und Kicks des Servers verwalten. Es wurde als Erweiterung für das Bukkit Plugin Ban Management erstellt von confuserr gemacht. Die beste Kombination ist BoNeMEAL und BanManagement von confuserr.", "activeBans" => "Aktive Bans", "activeMutes" => "Aktive Mutes", + "activePunishments" => "Aktive Einträge", "activeWarnings" => "Aktive Warnungen", + "addNotePlayer" => "Notiz für Spieler hinzufügen", + "addServer" => "Server hinzufügen", + "adminMustEnableAccount" => "Ein Admin muss deinen Account bestätigen, bevor du Zugang erhälst.", + "adminPanel" => "Admin", "allNotes" => "Alle Notizen", "app" => "Anwendung", - "noData" => "Keine Daten vorhaned.", - "adminPanel" => "Admin", - "punish" => "Bestrafen", - "punishPlayer" => "Spieler bestrafen", + "banned" => "Gebannt", "banPlayer" => "Spieler bannen", - "mutePlayer" => "Spieler muten", - "warnPlayer" => "Spieler verwarnen", - "addNotePlayer" => "Notiz für Spieler hinzufügen", - "delete" => "Löschen", - "remove" => "Entfernen", - "servers" => "Server", - "addServer" => "Server hinzufügen", - "editServer" => "Server bearbeiten", - "saveServer" => "Server speichern", - "serverName" => "Server Name", + "bonemeal" => "BoNeMEAL", + "causedTroubleQuestion" => "Hast du Ärger bereitet?", + "check" => "Prüfen", + "clearedCache" => "Cache erfolgreich gelöscht.", + "configuration" => "Einstellungen", + "confirmPassword" => "Passwort bestätigen", + "createAccount" => "Account erstellen", "createdServer" => "Server erfolgreich erstellt.", - "updatedServer" => "Server erfolgreich geupdated.", - "removedServer" => "Server erfolgreich entfernt.", - "error404Title" => "Hoppla, Fehler 404!", - "error404Text" => "Sorry, die angeforderte Seite konnte nicht gefunden werden.", - "footerNotice" => "Diese Seite steht nicht in Verbindung mit Minecraft und Mojang.", - "users" => "Benutzer", - "rememberMe" => "Angemeldet bleiben", - "performanceNote" => "Je mehr Server hinzugefügt werden, um so mehr Perfomance Einbusen kann es geben.", - "currentlyNotPunished" => "Momentan nicht gebannt oder gemuted", "currentlyBanned" => "Momentan gebannt", "currentlyMuted" => "Momentan gemuted", - "updateCheck" => "Nach Updates suchen", + "currentlyNotPunished" => "Momentan nicht gebannt oder gemuted", + "dashboard" => "Status", + "dbNotConnect" => "Konnte nicht zur Datenbank verbinden.", + "delete" => "Löschen", "details" => "Details", - "viewDetails" => "Details anschauen", - "notifications" => "Hinweise", - "loading" => "Lade", - "recentPastBans" => "Kürzlich entbannt", - "recentPastMutes" => "Kürzlich entmuted", - "recentKicks" => "Kürzliche Kicks", - "recentWarnings" => "Kürzliche Warnungen", - "recentNotes" => "Kürzliche Notizen", - "leaveEmptyForPermanent" => "Lasse dieses Feld frei, um diese Aktion Permanent werden zu lassen.", - "expires" => "Läuft ab am", - "server" => "Server", - "save" => "Speichern", - "suggestion" => "Vorschlag", - "newBan" => "Neuer Ban", - "newMute" => "Neuer Mute", - "newWarning" => "Neuer Verwarnung", - "newNote" => "Neue Notiz", "editBan" => "Ban bearbeiten", - "editNote" => "Notiz bearbeiten", "editMute" => "Mute bearbeiten", + "editNote" => "Notiz bearbeiten", + "editServer" => "Server bearbeiten", + "editUser" => "Benutzer bearbeiten", "editWarning" => "Warnung bearbeiten", + "email" => "E-Mail Addresse", + "enterPlayerName" => "Gebe deinen Spieler-Namen ein...", + "error" => "Fehler", + "error404Text" => "Sorry, die angeforderte Seite konnte nicht gefunden werden.", + "error404Title" => "Hoppla, Fehler 404!", + "expired" => "Abgelaufen", + "expires" => "Läuft ab", "flushCache" => "Cache löschen", - "clearedCache" => "Cache erfolgreich gelöscht.", + "footerNotice" => "Diese Seite steht nicht in Verbindung mit Minecraft und Mojang.", + "forgotPassword" => "Passwort vergessen", + "home" => "Startseite", + "inputErrors" => "Bei deiner Eingabe traten Fehler auf.", + "learnMore" => "Mehr herausfinden", + "leaveEmptyForPermanent" => "Lasse dieses Feld frei, um diese Aktion Permanent werden zu lassen.", + "loading" => "Lade", + "login" => "Einloggen", + "loginToAdmin" => "Melde dich an, um Strafen auf diesem Server mit BoNeMEAL zu verwalten.", + "logout" => "Ausloggen", "message" => "Nachricht", - "dbNotConnect" => "Konnte nicht zur Datenbank verbinden.", "missingDbTables" => "Konnte keine BanManagement Tabellen in der Datenbank finden...Sind die Angaben korrekt?", + "muted" => "Gemuted", + "mutePlayer" => "Spieler muten", + "never" => "Niemals", + "newBan" => "Neuer Ban", + "newMute" => "Neuer Mute", + "newNote" => "Neue Notiz", + "newWarning" => "Neuer Verwarnung", + "noData" => "Keine Daten vorhaned.", + "noExpire" => "Läuft nicht ab (Permanent).", + "noJs" => "Javascript ist deaktiviert!", + "noJsText" => "Bitte aktiviere Javascript und aktualisiere diese Seite.", + "noPermission" => "Du hast dazu keine Berechtigung.", + "noteAdded" => "Hinweis hinzugefügt", + "notice" => "Notizen", + "notifications" => "Hinweise", + "onServer" => "auf :server", + "password" => "Passwort", + "performanceNote" => "Je mehr Server hinzugefügt werden, um so mehr Perfomance Einbusen kann es geben.", + "player" => "Spieler", + "playerAlreadyBanned" => "Dieser Spieler ist bereits gebannt", + "playerNotExist" => "Diesen Spieler gibt es nicht", + "playerNotFound" => "Ein Spieler mit diesem Namen existiert nicht...", + "players" => "Spieler", + "punish" => "Bestrafen", + "punishPlayer" => "Spieler bestrafen", + "reason" => "Grund", + "recentKicks" => "Kürzliche Kicks", + "recentNotes" => "Kürzliche Notizen", + "recentPastBans" => "Kürzlich entbannt", + "recentPastMutes" => "Kürzlich entmuted", + "recentWarnings" => "Kürzliche Warnungen", + "register" => "Anmelden", + "rememberMe" => "Angemeldet bleiben", + "remove" => "Entfernen", + "removedServer" => "Server erfolgreich entfernt.", + "resetPassword" => "Passwort zurücksetzen", + "save" => "Speichern", + "saveServer" => "Server speichern", + "saveUser" => "Benutzer speichern", + "searchPlayer" => "Spieler suchen...", + "sendPasswordResetLink" => "Passwort Zurücksetzungslink senden", + "server" => "Server", + "serverName" => "Server Name", + "servers" => "Server", + "signupForMod" => "Bist du Moderator oder Admin auf diesem Server-Netzwerk? Melde dich jetzt an, um Bans, Mutes und Kicks des Servers zu verwalten.", + "suggestion" => "Vorschlag", + "toggleNav" => "Navigation verstecken", + "unbanned" => "Entbannt", + "unbannedBy" => "Entbannt :time von :actor.", + "unmuted" => "Entmuted", + "unmutedBy" => "Entmuted :time von :actor.", + "updateCheck" => "Nach Updates suchen", + "updatedServer" => "Server erfolgreich geändert.", + "updatedUser" => "Benutzer erfolgreich geändert.", + "username" => "Benutzername", "userName" => "Benutzername", "userRole" => "Rolle des Benutzers", - "saveUser" => "Benutzer speichern", - "editUser" => "Benutzer bearbeiten", - "updatedUser" => "Benutzer erfolgreich geändert", - "playerNotExist" => "Diesen Spieler gibt es nicht", - "playerAlreadyBanned" => "Dieser Spieler ist bereits gebannt", + "users" => "Benutzer", + "viewDetails" => "Details anschauen", + "warned" => "Verwarnt", + "warning" => "Warnung", + "warningRead" => "Warnung wurde gelesen", + "warningUnread" => "Warnung ungelesen", + "warnPlayer" => "Spieler verwarnen", + "whoops" => "Hoppla!", "serverSSL" => "Server SSL Einstellungen", "helpSSL" => "Wenn für Ihren Datenbankserver SSL erforderlich ist, um eine Verbindung herzustellen, können Sie hier die erforderlichen öffentlichen Schlüssel und Zertifikate hochladen.", "helpCA" => "(Wahlweise) Eine Datei im PEM-Format, die eine Liste vertrauenswürdiger SSL-Zertifizierungsstellen enthält.", diff --git a/application/resources/lang/en/app.php b/application/resources/lang/en/app.php index 23ae22d..2cf7f32 100644 --- a/application/resources/lang/en/app.php +++ b/application/resources/lang/en/app.php @@ -54,171 +54,169 @@ "admin" => "Admin", ], - "bonemeal" => "BoNeMEAL", - "home" => "Home", - "login" => "Login", - "logout" => "Logout", - "register" => "Sign up", - "toggleNav" => "Toggle Navigation", - "whoops" => "Whoops!", - "inputErrors" => "There were some problems with your input.", - "username" => "Username", - "email" => "E-Mail Address", - "password" => "Password", - "confirmPassword" => "Confirm Password", - "newPassword" => "New Password", - "forgotPassword" => "Forgot password", - "resetPassword" => "Reset password", - "sendPasswordResetLink" => "Send password reset link", - "signupForMod" => "Are you a moderator or admin on this network? Signup to manage bans, kicks, mutes and warnings with BoNeMEAL.", - "adminMustEnableAccount" => "An admin has to enable your account before you can access it.", - "createAccount" => "Create account", - "loginToAdmin" => "Login to manage bans, kicks, mutes and warnings with BoNeMEAL.", - "notice" => "Notice", - "error" => "Error", - "warning" => "Warning", "about" => "About", "aboutUs" => "About: BoNeMEAL", "aboutUsLead" => "Managing a server is hard. Punishing players for misbehaviour shouldn't be.", - "aboutUsText" => "The ban management web app (BoNeMEAL) makes it easy to manage your server's bans, mutes, kicks and warnings. - It's designed to extend the Ban Management Bukkit plugin created by confuserr by providing a clean, easy and responsive way to manage your bans - even across different servers. - The combination of the Ban-Management plugin together with BoNeMEAL is the best way of banning, kicking, muting and warning players for server netwoks of any scale.", - "learnMore" => "Learn more", - "noPermission" => "You have no permission to access that page.", - "insufficientPermission" => "You have insufficient permissions to do that.", - "causedTroubleQuestion" => "Caused trouble?", - "enterPlayerName" => "Enter your player name...", - "check" => "Check", - "playerNotFound" => "A player with that name does not exist...", - "reason" => "Reason", - "expires" => "expires", - "expired" => "expired", - "noExpire" => "Will not expire (permanent).", - "banned" => "banned", - "unbanned" => "unbanned", - "muted" => "muted", - "unmuted" => "unmuted", - "warned" => "warned", - "kicked" => "kicked", - "noteAdded" => "note added", - "unbannedBy" => "Unbanned :time by :actor.", - "lastedFor" => "Lasted for :duration.", - "unmutedBy" => "Unmuted :time by :actor.", - "onServer" => "on :server", - - "noJs" => "Javascript is deactivated!", - "noJsText" => "Please activate Javascript in your browser and refresh this page.", - - "dashboard" => "Dashboard", - "configuration" => "Configuration", - "searchPlayer" => "Search player...", - "players" => "Players", - "player" => "Player", - "activePunishments" => "Active punishments", + "aboutUsText" => "The ban management web app (BoNeMEAL) makes it easy to manage your server's bans, mutes, kicks and warnings. It's designed to extend the Ban Management Bukkit plugin created by confuserr by providing a clean, easy and responsive way to manage your bans - even across different servers. The combination of the Ban-Management plugin together with BoNeMEAL is the best way of banning, kicking, muting and warning players for server netwoks of any scale.", "activeBans" => "Active bans", "activeMutes" => "Active mutes", + "activePunishments" => "Active punishments", "activeWarnings" => "Active warnings", + "activity" => "Activity", + "addNotePlayer" => "Add note to player", + "addServer" => "Add server", + "addServerFirst" => "Please add your first server before you start working with BoNeMEAL.", + "addUser" => "To add a new user, tell them to signup for an account at :url.", + "adminMustEnableAccount" => "An admin has to enable your account before you can access it.", + "adminPanel" => "Admin", "allNotes" => "All Notes", "app" => "Application", - "noData" => "No data.", - "adminPanel" => "Admin", - "punish" => "Punish", - "punishPlayer" => "Punish player", + "banned" => "banned", + "bannedPlayer" => "Successfully banned player.", "banPlayer" => "Ban player", - "mutePlayer" => "Mute player", - "warnPlayer" => "Warn player", - "addNotePlayer" => "Add note to player", - "delete" => "delete", - "remove" => "remove", - "servers" => "Servers", - "addServer" => "Add server", - "editServer" => "Edit server", - "saveServer" => "Save server", - "serverName" => "Server name", + "bonemeal" => "BoNeMEAL", + "canNotEditSuperuser" => "You can not edit a superuser.", + "causedTroubleQuestion" => "Caused trouble?", + "check" => "Check", + "clearedCache" => "Cache successfully cleared.", + "configuration" => "Configuration", + "confirmPassword" => "Confirm Password", + "createAccount" => "Create account", "createdServer" => "Server successfully added.", - "updatedServer" => "Server successfully updated.", - "removedServer" => "Server successfully removed.", - "error404Title" => "Oops, Error 404!", - "error404Text" => "Sorry, the requested page could not be found.", - "error401Title" => "Oops, Error 401!", - "error401Text" => "Unauthorized.", - "footerNotice" => "This site is not affiliated with Minecraft or Mojang.", - "users" => "Users", - "rememberMe" => "Remember me", - "performanceNote" => "The more servers you will add, the longer it will take to query them all - thus performance may drop.", - "currentlyNotPunished" => "Currently not banned or muted.", "currentlyBanned" => "Currently banned", "currentlyMuted" => "Currently muted", - "updateCheck" => "Update Check", + "currentlyNotPunished" => "Currently not banned or muted.", + "dangerZone" => "Danger Zone", + "dangerZoneDesc" => "Changing anything in here may lock the user out of their account.", + "dashboard" => "Dashboard", + "dbNotConnect" => "Can not connect to database.", + "delete" => "delete", "details" => "Details", - "viewDetails" => "View details", - "notifications" => "Notifications", - "loading" => "Loading", - "recentPastBans" => "Recently unbanned", - "recentPastMutes" => "Recently unmuted", - "recentKicks" => "Recent kicks", - "recentWarnings" => "Recent warnings", - "recentNotes" => "Recent notes", - "leaveEmptyForPermanent" => "Leave this field empty for a permanent punishment.", - "expires" => "Expires on", - "server" => "Server", - "save" => "Save", - "suggestion" => "Suggestion", - "newBan" => "New ban", - "newMute" => "New mute", - "newWarning" => "New warning", - "newNote" => "New note", - "newKick" => "New kick", + "edit" => "Edit", "editBan" => "Edit ban", - "editNote" => "Edit note", "editMute" => "Edit mute", + "editNote" => "Edit note", + "editServer" => "Edit server", + "editUser" => "Edit user", "editWarning" => "Edit warning", + "email" => "E-Mail Address", + "enterPlayerName" => "Enter your player name...", + "error" => "Error", + "error401Text" => "Unauthorized.", + "error401Title" => "Oops, Error 401!", + "error404Text" => "Sorry, the requested page could not be found.", + "error404Title" => "Oops, Error 404!", + "expired" => "expired", + "expires" => "expires", "flushCache" => "Flush cache", - "clearedCache" => "Cache successfully cleared.", + "followingServersOutdated" => "We have found some outdated servers. We assume you did not run the Ban-Management plugin for quite a while, since there are active temp bans which shoud have expired by now. The following servers are outdated:", + "footerNotice" => "This site is not affiliated with Minecraft or Mojang.", + "forgotPassword" => "Forgot password", + "frontText" => "With BoNeMEAL you can check your punishments, when and why you got them and when they will expire.", + "frontTitle" => "Am I being detained?!", + "generalStats" => "General stats", + "goToHome" => "Go to homepage", + "home" => "Home", + "inputErrors" => "There were some problems with your input.", + "insufficientPermission" => "You have insufficient permissions to do that.", + "kicked" => "kicked", + "lastedFor" => "Lasted for :duration.", + "learnMore" => "Learn more", + "leaveEmptyForPermanent" => "Leave this field empty for a permanent punishment.", + "loading" => "Loading", + "login" => "Login", + "loginToAdmin" => "Login to manage bans, kicks, mutes and warnings with BoNeMEAL.", + "logout" => "Logout", "message" => "Message", - "dbNotConnect" => "Can not connect to database.", "missingDbTables" => "Can not find Ban-Management tables in this database. Are you sure your database prefix is correct?", - "toggleDetails" => "Toggle details", - "toggleAllTimelineItems" => "Toggle all", - "followingServersOutdated" => "We have found some outdated servers. We assume you did not run the Ban-Management plugin for quite a while, since there are active temp bans which shoud have expired by now. The following servers are outdated:", - "edit" => "Edit", - "playerNotExist" => "A player with that name does not exist.", - "activity" => "Activity", + "muted" => "muted", + "mutedPlayer" => "Successfully muted player.", + "mutePlayer" => "Mute player", + "newBan" => "New ban", + "newKick" => "New kick", + "newMute" => "New mute", + "newNote" => "New note", + "newPassword" => "New Password", + "newWarning" => "New warning", + "noData" => "No data.", + "noExpire" => "Will not expire (permanent).", + "noJs" => "Javascript is deactivated!", + "noJsText" => "Please activate Javascript in your browser and refresh this page.", + "noPermission" => "You have no permission to access that page.", + "noteAdded" => "note added", + "notedPlayer" => "Successfully attached note to player.", + "notice" => "Notice", + "notifications" => "Notifications", + "ok" => "Okay", "onlinePlayers" => "Online players", + "onServer" => "on :server", + "password" => "Password", + "performanceNote" => "The more servers you will add, the longer it will take to query them all - thus performance may drop.", + "player" => "Player", + "playerNotExist" => "A player with that name does not exist.", + "playerNotFound" => "A player with that name does not exist...", + "players" => "Players", "playerSplit" => "Player split", + "punish" => "Punish", "punishmentSplit" => "Punishment type split", - "goToHome" => "Go to homepage", - "statistics" => "Statistics", - "generalStats" => "General stats", - "serverStats" => "Server stats", - "frontTitle" => "Am I being detained?!", - "frontText" => "With BoNeMEAL you can check your punishments, when and why you got them and when they will expire.", - "removedMuteRecord" => "Successfully removed mute record.", + "punishPlayer" => "Punish player", + "reason" => "Reason", + "recentKicks" => "Recent kicks", + "recentNotes" => "Recent notes", + "recentPastBans" => "Recently unbanned", + "recentPastMutes" => "Recently unmuted", + "recentWarnings" => "Recent warnings", + "register" => "Sign up", + "rememberMe" => "Remember me", + "remove" => "remove", + "removedBan" => "Successfully removed ban.", "removedBanRecord" => "Successfully removed ban record.", "removedKick" => "Successfully removed kick record.", - "removedBan" => "Successfully removed ban.", "removedMute" => "Successfully removed mute.", - "removedWarning" => "Successfully removed warning.", + "removedMuteRecord" => "Successfully removed mute record.", "removedNote" => "Successfully removed note.", + "removedServer" => "Server successfully removed.", "removedUser" => "Successfully deleted user.", - "canNotEditSuperuser" => "You can not edit a superuser.", - "user" => "User", - "editUser" => "Edit user", - "dangerZone" => "Danger Zone", - "dangerZoneDesc" => "Changing anything in here may lock the user out of their account.", - "addUser" => "To add a new user, tell them to signup for an account at :url.", - "ok" => "Okay", - "bannedPlayer" => "Successfully banned player.", - "mutedPlayer" => "Successfully muted player.", - "warnedPlayer" => "Successfully warned player.", - "notedPlayer" => "Successfully attached note to player.", + "removedWarning" => "Successfully removed warning.", + "resetPassword" => "Reset password", + "save" => "Save", + "savedSettings" => "Your settings have been saved.", + "saveServer" => "Save server", + "searchPlayer" => "Search player...", + "sendPasswordResetLink" => "Send password reset link", + "server" => "Server", + "serverName" => "Server name", + "servers" => "Servers", + "serverStats" => "Server stats", + "settings" => "Settings", + "signupForMod" => "Are you a moderator or admin on this network? Signup to manage bans, kicks, mutes and warnings with BoNeMEAL.", + "statistics" => "Statistics", + "suggestion" => "Suggestion", + "toggleAllTimelineItems" => "Toggle all", + "toggleDetails" => "Toggle details", + "toggleNav" => "Toggle Navigation", + "unbanned" => "unbanned", + "unbannedBy" => "Unbanned :time by :actor.", + "unmuted" => "unmuted", + "unmutedBy" => "Unmuted :time by :actor.", + "updateCheck" => "Update Check", "updatedBan" => "Updated ban successfully.", "updatedMute" => "Updated mute successfully.", "updatedNote" => "Updated note successfully.", + "updatedServer" => "Server successfully updated.", + "updatedUser" => "Updated User successfully.", "updatedWarning" => "Updated warning successfully.", - "settings" => "Settings", - "savedSettings" => "Your settings have been saved.", - "addServerFirst" => "Please add your first server before you start working with BoNeMEAL.", + "user" => "User", + "username" => "Username", + "users" => "Users", + "viewDetails" => "View details", + "warned" => "warned", + "warnedPlayer" => "Successfully warned player.", + "warning" => "Warning", + "warningRead" => "Player has seen this Warning", + "warningUnread" => "Player has NOT seen this Warning", + "warnPlayer" => "Warn player", + "whoops" => "Whoops!", "serverSSL" => "Server SSL Settings", "helpSSL" => "If your database server requires SSL to connect, you can upload the public keys and certificates required here.", "helpCA" => "A file in PEM format that contains a list of trusted SSL Certificate Authorities. (Optional)", diff --git a/application/resources/views/partials/timelineItem.blade.php b/application/resources/views/partials/timelineItem.blade.php index e5b9731..78ea1a1 100644 --- a/application/resources/views/partials/timelineItem.blade.php +++ b/application/resources/views/partials/timelineItem.blade.php @@ -211,6 +211,11 @@ {{ $item->created_at->diffForHumans() }} {{ $item->actor->name }} {{ $item->server }} + @if($item->read) + {{trans('app.warningRead')}} + @else + {{trans('app.warningUnread')}} + @endif

diff --git a/application/vendor/autoload.php b/application/vendor/autoload.php index 17999af..59fc4d5 100644 --- a/application/vendor/autoload.php +++ b/application/vendor/autoload.php @@ -2,6 +2,6 @@ // autoload.php @generated by Composer -require_once __DIR__ . '/composer' . '/autoload_real.php'; +require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInit43265f891b9f29a025a40de9ffd797c4::getLoader(); diff --git a/application/vendor/bin/classpreloader.php b/application/vendor/bin/classpreloader.php deleted file mode 100644 index 164d33b..0000000 --- a/application/vendor/bin/classpreloader.php +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env sh - -dir=$(d=${0%[/\\]*}; cd "$d"; cd "../classpreloader/classpreloader" && pwd) - -# See if we are running in Cygwin by checking for cygpath program -if command -v 'cygpath' >/dev/null 2>&1; then - # Cygwin paths start with /cygdrive/ which will break windows PHP, - # so we need to translate the dir path to windows format. However - # we could be using cygwin PHP which does not require this, so we - # test if the path to PHP starts with /cygdrive/ rather than /usr/bin - if [[ $(which php) == /cygdrive/* ]]; then - dir=$(cygpath -m $dir); - fi -fi - -dir=$(echo $dir | sed 's/ /\ /g') -"${dir}/classpreloader.php" "$@" diff --git a/application/vendor/bin/classpreloader.php.bat b/application/vendor/bin/classpreloader.php.bat deleted file mode 100644 index 3dbe836..0000000 --- a/application/vendor/bin/classpreloader.php.bat +++ /dev/null @@ -1,3 +0,0 @@ -@ECHO OFF -SET BIN_TARGET=%~dp0/../classpreloader/classpreloader/classpreloader.php -php "%BIN_TARGET%" %* diff --git a/application/vendor/bin/php-parse b/application/vendor/bin/php-parse new file mode 100644 index 0000000..76d2d68 --- /dev/null +++ b/application/vendor/bin/php-parse @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +dir=$(cd "${0%[/\\]*}" > /dev/null; cd '../nikic/php-parser/bin' && pwd) + +if [ -d /proc/cygdrive ]; then + case $(which php) in + $(readlink -n /proc/cygdrive)/*) + # We are in Cygwin using Windows php, so the path must be translated + dir=$(cygpath -m "$dir"); + ;; + esac +fi + +"${dir}/php-parse" "$@" diff --git a/application/vendor/bin/psysh b/application/vendor/bin/psysh index cad93e4..e43e1bb 100644 --- a/application/vendor/bin/psysh +++ b/application/vendor/bin/psysh @@ -1,123 +1,14 @@ -#!/usr/bin/env php - /dev/null; cd '../psy/psysh/bin' && pwd) -/* <<< */ -if (is_file(__DIR__ . '/../vendor/autoload.php')) { - require(__DIR__ . '/../vendor/autoload.php'); -} elseif (is_file(__DIR__ . '/../../../autoload.php')) { - require(__DIR__ . '/../../../autoload.php'); -} else { - die( - 'You must set up the Psy Shell dependencies, run the following commands:' . PHP_EOL . - 'curl -s http://getcomposer.org/installer | php' . PHP_EOL . - 'php composer.phar install' . PHP_EOL - ); -} -/* >>> */ +if [ -d /proc/cygdrive ]; then + case $(which php) in + $(readlink -n /proc/cygdrive)/*) + # We are in Cygwin using Windows php, so the path must be translated + dir=$(cygpath -m "$dir"); + ;; + esac +fi -use Psy\Configuration; -use Psy\Shell; -use Symfony\Component\Console\Input\ArgvInput; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputOption; - -// If the psysh binary was included directly, assume they just wanted an -// autoloader and bail early. -if (version_compare(PHP_VERSION, '5.3.6', '<')) { - $trace = debug_backtrace(); -} elseif (version_compare(PHP_VERSION, '5.4.0', '<')) { - $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); -} else { - $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); -} - -if (Shell::isIncluded($trace)) { - unset($trace); - - return; -} - -// Clean up after ourselves. -unset($trace); - -call_user_func(function() { - $usageException = null; - - $input = new ArgvInput(); - try { - $input->bind(new InputDefinition(array( - new InputOption('help', 'h', InputOption::VALUE_NONE), - new InputOption('config', 'c', InputOption::VALUE_REQUIRED), - new InputOption('version', 'v', InputOption::VALUE_NONE), - - new InputArgument('include', InputArgument::IS_ARRAY), - ))); - } catch (\RuntimeException $e) { - $usageException = $e; - } - - $config = array(); - - // Handle --config - if ($configFile = $input->getOption('config')) { - $config['configFile'] = $configFile; - } - - $shell = new Shell(new Configuration($config)); - - // Handle --help - if ($usageException !== null || $input->getOption('help')) { - if ($usageException !== null) { - echo $usageException->getMessage() . PHP_EOL . PHP_EOL; - } - - $version = $shell->getVersion(); - $name = basename(reset($_SERVER['argv'])); - echo <<getOption('version')) { - echo $shell->getVersion() . PHP_EOL; - exit(0); - } - - // Pass additional arguments to Shell as 'includes' - $shell->setIncludes($input->getArgument('include')); - - try { - // And go! - $shell->run(); - } catch (Exception $e) { - echo $e->getMessage() . PHP_EOL; - - // TODO: this triggers the "exited unexpectedly" logic in the - // ForkingLoop, so we can't exit(1) after starting the shell... - // fix this :) - - // exit(1); - } -}); +"${dir}/psysh" "$@" diff --git a/application/vendor/bin/upgrade-carbon b/application/vendor/bin/upgrade-carbon new file mode 100644 index 0000000..bbe6340 --- /dev/null +++ b/application/vendor/bin/upgrade-carbon @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +dir=$(cd "${0%[/\\]*}" > /dev/null; cd '../nesbot/carbon/bin' && pwd) + +if [ -d /proc/cygdrive ]; then + case $(which php) in + $(readlink -n /proc/cygdrive)/*) + # We are in Cygwin using Windows php, so the path must be translated + dir=$(cygpath -m "$dir"); + ;; + esac +fi + +"${dir}/upgrade-carbon" "$@" diff --git a/application/vendor/classpreloader/classpreloader/.styleci.yml b/application/vendor/classpreloader/classpreloader/.styleci.yml deleted file mode 100644 index 219abb7..0000000 --- a/application/vendor/classpreloader/classpreloader/.styleci.yml +++ /dev/null @@ -1,4 +0,0 @@ -preset: recommended - -disabled: - - short_array_syntax diff --git a/application/vendor/classpreloader/classpreloader/LICENSE b/application/vendor/classpreloader/classpreloader/LICENSE index 467a643..5e3bcbb 100644 --- a/application/vendor/classpreloader/classpreloader/LICENSE +++ b/application/vendor/classpreloader/classpreloader/LICENSE @@ -1,7 +1,7 @@ The MIT License (MIT) Copyright (c) 2013-2014 Michael Dowling -Copyright (c) 2014-2015 Graham Campbell +Copyright (c) 2014-2017 Graham Campbell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/application/vendor/classpreloader/classpreloader/classpreloader.php b/application/vendor/classpreloader/classpreloader/classpreloader.php deleted file mode 100644 index 81e654d..0000000 --- a/application/vendor/classpreloader/classpreloader/classpreloader.php +++ /dev/null @@ -1,21 +0,0 @@ -#! /usr/bin/env php - - * (c) Michael Dowling - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -if (file_exists($autoloadPath = __DIR__.'/../../autoload.php')) { - require_once $autoloadPath; -} else { - require_once __DIR__.'/vendor/autoload.php'; -} - -$application = new ClassPreloader\Application(); -$application->run(); diff --git a/application/vendor/classpreloader/classpreloader/composer.json b/application/vendor/classpreloader/classpreloader/composer.json index a9240e7..307d2f9 100644 --- a/application/vendor/classpreloader/classpreloader/composer.json +++ b/application/vendor/classpreloader/classpreloader/composer.json @@ -10,18 +10,15 @@ }, { "name": "Graham Campbell", - "email": "graham@cachethq.io" + "email": "graham@alt-three.com" } ], "require":{ - "php": ">=5.3.3", - "symfony/console": "~2.1", - "symfony/filesystem": "~2.1", - "symfony/finder": "~2.1", - "nikic/php-parser": "~1.3" + "php": ">=5.5.9", + "nikic/php-parser": "^1.0|^2.0|^3.0" }, "require-dev":{ - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.8|^5.0" }, "autoload": { "psr-4": { @@ -31,10 +28,14 @@ "autoload-dev": { "classmap": ["tests/stubs/"] }, - "bin": ["classpreloader.php"], + "config": { + "preferred-install": "dist" + }, "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.2-dev" } - } + }, + "minimum-stability": "dev", + "prefer-stable": true } diff --git a/application/vendor/classpreloader/classpreloader/src/Application.php b/application/vendor/classpreloader/classpreloader/src/Application.php deleted file mode 100644 index 62951c1..0000000 --- a/application/vendor/classpreloader/classpreloader/src/Application.php +++ /dev/null @@ -1,50 +0,0 @@ - - * (c) Michael Dowling - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace ClassPreloader; - -use Symfony\Component\Console\Application as BaseApplication; -use Symfony\Component\Finder\Finder; - -/** - * This is the application class. - * - * This is sets everything up for the CLI. - */ -class Application extends BaseApplication -{ - /** - * Create a new application. - * - * @return void - */ - public function __construct() - { - parent::__construct('Class Preloader', '1.4'); - - // Create a finder to find each non-abstract command in the filesystem - $finder = new Finder(); - $finder->files() - ->in(__DIR__.'/Command') - ->notName('Abstract*') - ->name('*.php'); - - // Add each command to the CLI - foreach ($finder as $file) { - $filename = str_replace('\\', '/', $file->getRealpath()); - $pos = strripos($filename, '/ClassPreloader/') + strlen('/ClassPreloader/src/'); - $class = __NAMESPACE__.'\\' - .substr(str_replace('/', '\\', substr($filename, $pos)), 0, -4); - $this->add(new $class()); - } - } -} diff --git a/application/vendor/classpreloader/classpreloader/src/ClassList.php b/application/vendor/classpreloader/classpreloader/src/ClassList.php index 663c01b..cff1a5a 100644 --- a/application/vendor/classpreloader/classpreloader/src/ClassList.php +++ b/application/vendor/classpreloader/classpreloader/src/ClassList.php @@ -3,7 +3,7 @@ /* * This file is part of Class Preloader. * - * (c) Graham Campbell + * (c) Graham Campbell * (c) Michael Dowling * * For the full copyright and license information, please view the LICENSE @@ -34,7 +34,7 @@ class ClassList protected $current; /** - * Create a new class list. + * Create a new class list instance. * * @return void */ @@ -103,7 +103,7 @@ public function push($value) */ public function getClasses() { - $classes = array(); + $classes = []; $current = $this->head; while ($current && $current->value) { $classes[] = $current->value; diff --git a/application/vendor/classpreloader/classpreloader/src/ClassLoader.php b/application/vendor/classpreloader/classpreloader/src/ClassLoader.php index 677f2dd..7016f3b 100644 --- a/application/vendor/classpreloader/classpreloader/src/ClassLoader.php +++ b/application/vendor/classpreloader/classpreloader/src/ClassLoader.php @@ -3,7 +3,7 @@ /* * This file is part of Class Preloader. * - * (c) Graham Campbell + * (c) Graham Campbell * (c) Michael Dowling * * For the full copyright and license information, please view the LICENSE @@ -12,9 +12,6 @@ namespace ClassPreloader; -require_once __DIR__.'/ClassNode.php'; -require_once __DIR__.'/ClassList.php'; - /** * This is the class loader class. * @@ -32,7 +29,7 @@ class ClassLoader public $classList; /** - * Create a new class loader. + * Create a new class loader instance. * * @return void */ @@ -81,7 +78,7 @@ public static function getIncludes($func) */ public function register() { - spl_autoload_register(array($this, 'loadClass'), true, true); + spl_autoload_register([$this, 'loadClass'], true, true); } /** @@ -91,7 +88,7 @@ public function register() */ public function unregister() { - spl_autoload_unregister(array($this, 'loadClass')); + spl_autoload_unregister([$this, 'loadClass']); } /** @@ -101,7 +98,7 @@ public function unregister() * * @param string $class * - * @return bool|null + * @return bool */ public function loadClass($class) { @@ -127,7 +124,7 @@ public function loadClass($class) */ public function getFilenames() { - $files = array(); + $files = []; foreach ($this->classList->getClasses() as $class) { // Push interfaces before classes if not already loaded try { @@ -142,17 +139,9 @@ public function getFilenames() $files[] = $r->getFileName(); } } catch (\ReflectionException $e) { - // We ignore all exceptions related to reflection, - // because in some cases class can't exists. This - // can be if you use in your code constructions like - // - // if (class_exists('SomeClass')) { // <-- here will trigger autoload - // class SomeSuperClass extends SomeClass { - // } - // } - // - // We ignore all problems with classes, interfaces and - // traits. + // We ignore all exceptions related to reflection because in + // some cases class doesn't need to exist. We're ignoring all + // problems with classes, interfaces and traits. } } diff --git a/application/vendor/classpreloader/classpreloader/src/ClassNode.php b/application/vendor/classpreloader/classpreloader/src/ClassNode.php index 7f2602b..b227a05 100644 --- a/application/vendor/classpreloader/classpreloader/src/ClassNode.php +++ b/application/vendor/classpreloader/classpreloader/src/ClassNode.php @@ -3,7 +3,7 @@ /* * This file is part of Class Preloader. * - * (c) Graham Campbell + * (c) Graham Campbell * (c) Michael Dowling * * For the full copyright and license information, please view the LICENSE @@ -41,7 +41,7 @@ class ClassNode public $value; /** - * Create a new class node. + * Create a new class node instance. * * @param mixed $value * @param \ClassPreloader\ClassNode|null $prev diff --git a/application/vendor/classpreloader/classpreloader/src/ClassPreloader.php b/application/vendor/classpreloader/classpreloader/src/ClassPreloader.php new file mode 100644 index 0000000..48c8102 --- /dev/null +++ b/application/vendor/classpreloader/classpreloader/src/ClassPreloader.php @@ -0,0 +1,179 @@ + + * (c) Michael Dowling + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ClassPreloader; + +use ClassPreloader\Parser\NodeTraverser; +use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; +use PhpParser\Parser; +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use RuntimeException; + +/** + * This is the class preloader class. + * + * This is the main point of entry for interacting with this package. + */ +class ClassPreloader +{ + /** + * The printer. + * + * @var \PhpParser\PrettyPrinter\Standard + */ + protected $printer; + + /** + * The parser. + * + * @var \PhpParser\Parser + */ + protected $parser; + + /** + * The traverser. + * + * @var \ClassPreloader\Parser\NodeTraverser + */ + protected $traverser; + + /** + * Create a new class preloader instance. + * + * @param \PhpParser\PrettyPrinter\Standard $printer + * @param \PhpParser\Parser $parser + * @param \ClassPreloader\Parser\NodeTraverser $traverser + * + * @return void + */ + public function __construct(PrettyPrinter $printer, Parser $parser, NodeTraverser $traverser) + { + $this->printer = $printer; + $this->parser = $parser; + $this->traverser = $traverser; + } + + /** + * Prepare the output file and directory. + * + * @param string $output + * @param bool $strict + * + * @throws \RuntimeException + * + * @return resource + */ + public function prepareOutput($output, $strict = false) + { + if ($strict && version_compare(PHP_VERSION, '7') < 1) { + throw new RuntimeException('Strict mode requires PHP 7 or greater.'); + } + + $dir = dirname($output); + + if (!is_dir($dir) && !mkdir($dir, 0777, true)) { + throw new RuntimeException("Unable to create directory $dir."); + } + + $handle = fopen($output, 'w'); + + if (!$handle) { + throw new RuntimeException("Unable to open $output for writing."); + } + + if ($strict) { + fwrite($handle, "parser->parse($content); + $stmts = $this->traverser->traverseFile($parsed, $file); + $pretty = $this->printer->prettyPrint($stmts); + + $pretty = preg_replace( + '#^(<\?php)?[\s]*(/\*\*?.*?\*/)?[\s]*(declare[\s]*\([\s]*strict_types[\s]*=[\s]*1[\s]*\);)?#s', + '', + $pretty + ); + + return $this->getCodeWrappedIntoNamespace($parsed, $pretty); + } + + /** + * Wrap the code into a namespace. + * + * @param array $parsed + * @param string $pretty + * + * @return string + */ + protected function getCodeWrappedIntoNamespace(array $parsed, $pretty) + { + if ($this->parsedCodeHasNamespaces($parsed)) { + $pretty = preg_replace('/^\s*(namespace.*);/im', '${1} {', $pretty, 1)."\n}\n"; + } else { + $pretty = sprintf("namespace {\n%s\n}\n", $pretty); + } + + return preg_replace('/(? - * (c) Michael Dowling - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace ClassPreloader\Command; - -use ClassPreloader\Config; -use ClassPreloader\Exception\SkipFileException; -use ClassPreloader\Parser\DirVisitor; -use ClassPreloader\Parser\FileVisitor; -use ClassPreloader\Parser\NodeTraverser; -use PhpParser\Lexer; -use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; -use PhpParser\Parser; -use PhpParser\PrettyPrinter\Standard as PrettyPrinter; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Filesystem\Filesystem; - -/** - * This is the pre-compile command class. - * - * This allows the user to communicate with class preloader. - */ -class PreCompileCommand extends Command -{ - /** - * The printer. - * - * @var \PhpParser\PrettyPrinter\Standard - */ - protected $printer; - - /** - * The parser. - * - * @var \PhpParser\Parser - */ - protected $parser; - - /** - * The input. - * - * @var \Symfony\Component\Console\Input\InputInterface|null - */ - protected $input; - - /** - * The output. - * - * @var \Symfony\Component\Console\Output\OutputInterface|null - */ - protected $output; - - /** - * The traverser. - * - * @var \ClassPreloader\Parser\NodeTraverser|null - */ - protected $traverser; - - /** - * Create a new pre-compile command. - * - * @return void - */ - public function __construct() - { - parent::__construct(); - $this->printer = new PrettyPrinter(); - $this->parser = new Parser(new Lexer()); - } - - /** - * Configure the current command. - * - * @return void - */ - protected function configure() - { - parent::configure(); - - $this->setName('compile') - ->setDescription('Compiles classes into a single file') - ->addOption('config', null, InputOption::VALUE_REQUIRED, 'CSV of filenames to load, or the path to a PHP script that returns an array of file names') - ->addOption('output', null, InputOption::VALUE_REQUIRED) - ->addOption('skip_dir_file', null, InputOption::VALUE_NONE, 'Skip files with __DIR__ or __FILE__ to make the cache portable') - ->addOption('fix_dir', null, InputOption::VALUE_REQUIRED, 'Convert __DIR__ constants to the original directory of a file', 1) - ->addOption('fix_file', null, InputOption::VALUE_REQUIRED, 'Convert __FILE__ constants to the original path of a file', 1) - ->addOption('strip_comments', null, InputOption::VALUE_REQUIRED, 'Set to 1 to strip comments from each source file', 0) - ->setHelp(<<%command.name% command iterates over each script, normalizes -the file to be wrapped in namespaces, and combines each file into a single PHP -file. -EOF - ); - } - - /** - * Get the node traverser used by the command. - * - * @return \ClassPreloader\Parser\NodeTraverser - */ - protected function getTraverser() - { - if (!$this->traverser) { - $this->traverser = new NodeTraverser(); - if ($this->input->getOption('fix_dir')) { - $this->traverser->addVisitor(new DirVisitor($this->input->getOption('skip_dir_file'))); - } - if ($this->input->getOption('fix_file')) { - $this->traverser->addVisitor(new FileVisitor($this->input->getOption('skip_dir_file'))); - } - } - - return $this->traverser; - } - - /** - * Get a pretty printed string of code from a file while applying visitors. - * - * @param string $file - * - * @throws \RuntimeException - * - * @return string - */ - protected function getCode($file) - { - if (!is_readable($file)) { - throw new \RuntimeException("Cannot open {$file} for reading"); - } - - if ($this->input->getOption('strip_comments')) { - $content = php_strip_whitespace($file); - } else { - $content = file_get_contents($file); - } - - $parsed = $this->parser->parse($content); - $stmts = $this->getTraverser()->traverseFile($parsed, $file); - $pretty = $this->printer->prettyPrint($stmts); - - // Remove the open PHP tag - if (substr($pretty, 5) === 'getCodeWrappedIntoNamespace($parsed, $pretty); - } - - /** - * Wrap the code into a namespace. - * - * @param array $parsed - * @param string $pretty - * - * @return string - */ - protected function getCodeWrappedIntoNamespace(array $parsed, $pretty) - { - if ($this->parsedCodeHasNamespaces($parsed)) { - $pretty = preg_replace('/^\s*(namespace.*);/i', '${1} {', $pretty, 1)."\n}\n"; - } else { - $pretty = sprintf("namespace {\n%s\n}\n", $pretty); - } - - return preg_replace('/(?input->getOption('output')) { - throw new \InvalidArgumentException('An output option is required'); - } - - if (!$this->input->getOption('config')) { - throw new \InvalidArgumentException('A config option is required'); - } - } - - /** - * Get a list of files in order. - * - * @param mixed $config Configuration option - * - * @throws \InvalidArgumentException - * - * @return array - */ - protected function getFileList($config) - { - $this->output->writeln('> Loading configuration file'); - $filesystem = new Filesystem(); - - if (strpos($config, ',')) { - return array_filter(explode(',', $config)); - } - - // Ensure absolute paths are resolved - if (!$filesystem->isAbsolutePath($config)) { - $config = getcwd().'/'.$config; - } - - // Ensure that the config file exists - if (!file_exists($config)) { - throw new \InvalidArgumentException(sprintf('Configuration file "%s" does not exist.', $config)); - } - - $result = require $config; - - if ($result instanceof Config) { - foreach ($result->getVisitors() as $visitor) { - $this->getTraverser()->addVisitor($visitor); - } - - return $result; - } elseif (is_array($result)) { - return $result; - } - - throw new \InvalidArgumentException('Config must return an array of filenames or a Config object'); - } - - /** - * Prepare the output file and directory. - * - * @param string $outputFile - * - * @throws \RuntimeException - * - * @return void - */ - protected function prepareOutput($outputFile) - { - $dir = dirname($outputFile); - if (!is_dir($dir) && !mkdir($dir, 0777, true)) { - throw new \RuntimeException('Unable to create directory '.$dir); - } - } - - /** - * Executes the pre-compile command. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * - * @throws \RuntimeException - * - * @return null|int - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $this->input = $input; - $this->output = $output; - $this->validateCommand(); - $outputFile = $this->input->getOption('output'); - $config = $this->input->getOption('config'); - $files = $this->getFileList($config); - $output->writeLn('- Found '.count($files).' files'); - - // Make sure that the output dir can be used or create it - $this->prepareOutput($outputFile); - - if (!$handle = fopen($input->getOption('output'), 'w')) { - throw new \RuntimeException("Unable to open {$outputFile} for writing"); - } - - // Write the first line of the output - fwrite($handle, "writeln('> Compiling classes'); - - $count = 0; - $countSkipped = 0; - foreach ($files as $file) { - $count++; - try { - $code = $this->getCode($file); - $this->output->writeln('- Writing '.$file); - fwrite($handle, $code."\n"); - } catch (SkipFileException $ex) { - $countSkipped++; - $this->output->writeln('- Skipping '.$file); - } - } - fclose($handle); - - $output->writeln("> Compiled loader written to {$outputFile}"); - $output->writeln('- Files: '.($count - $countSkipped).'/'.$count.' (skipped: '.$countSkipped.')'); - $output->writeln('- Filesize: '.(round(filesize($outputFile) / 1024)).' kb'); - } -} diff --git a/application/vendor/classpreloader/classpreloader/src/Config.php b/application/vendor/classpreloader/classpreloader/src/Config.php index 94a3b04..78e17c9 100644 --- a/application/vendor/classpreloader/classpreloader/src/Config.php +++ b/application/vendor/classpreloader/classpreloader/src/Config.php @@ -3,7 +3,7 @@ /* * This file is part of Class Preloader. * - * (c) Graham Campbell + * (c) Graham Campbell * (c) Michael Dowling * * For the full copyright and license information, please view the LICENSE @@ -12,43 +12,31 @@ namespace ClassPreloader; -use ClassPreloader\Parser\AbstractNodeVisitor; -use IteratorAggregate; - /** * This is the config class. - * - * This contains all the class preloader configuration. */ -class Config implements IteratorAggregate +class Config { - /** - * The array of AbstractNodeVisitor objects that visit nodes. - * - * @var array - */ - protected $visitors = array(); - /** * The array of file names. * * @var array */ - protected $filenames = array(); + protected $filenames = []; /** * The array of exclusive filters. * * @var array */ - protected $exclusiveFilters = array(); + protected $exclusiveFilters = []; /** * The array of inclusive filters. * * @var array */ - protected $inclusiveFilters = array(); + protected $inclusiveFilters = []; /** * Add the filename owned by the config. @@ -71,7 +59,7 @@ public function addFile($filename) */ public function getFilenames() { - $filenames = array(); + $filenames = []; foreach ($this->filenames as $f) { foreach ($this->inclusiveFilters as $filter) { if (!preg_match($filter, $f)) { @@ -89,16 +77,6 @@ public function getFilenames() return $filenames; } - /** - * Get an iterator for the filenames. - * - * @return \ArrayIterator - */ - public function getIterator() - { - return new \ArrayIterator($this->getFilenames()); - } - /** * Add a filter used to filter out file names matching the pattern. * @@ -130,30 +108,4 @@ public function addInclusiveFilter($pattern) return $this; } - - /** - * Add a visitor. - * - * It will visit each node when traversing the node list of each file. - * - * @param \ClassPreloader\Parser\AbstractNodeVisitor $visitor - * - * @return \ClassPreloader\Config - */ - public function addVisitor(AbstractNodeVisitor $visitor) - { - $this->visitors[] = $visitor; - - return $this; - } - - /** - * Get an array of node visitors. - * - * @return array - */ - public function getVisitors() - { - return $this->visitors; - } } diff --git a/application/vendor/classpreloader/classpreloader/src/Exception/SkipFileException.php b/application/vendor/classpreloader/classpreloader/src/Exception/SkipFileException.php deleted file mode 100644 index cfa9aab..0000000 --- a/application/vendor/classpreloader/classpreloader/src/Exception/SkipFileException.php +++ /dev/null @@ -1,23 +0,0 @@ - - * (c) Michael Dowling - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace ClassPreloader\Exception; - -use Exception; - -/** - * This is the skip file exception class. - */ -class SkipFileException extends Exception -{ - // -} diff --git a/application/vendor/classpreloader/classpreloader/src/Exceptions/DirConstantException.php b/application/vendor/classpreloader/classpreloader/src/Exceptions/DirConstantException.php new file mode 100644 index 0000000..f7f03d4 --- /dev/null +++ b/application/vendor/classpreloader/classpreloader/src/Exceptions/DirConstantException.php @@ -0,0 +1,23 @@ + + * (c) Michael Dowling + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ClassPreloader\Exceptions; + +use Exception; + +/** + * This is the dir constant exception class. + */ +class DirConstantException extends Exception implements VisitorExceptionInterface +{ + // +} diff --git a/application/vendor/classpreloader/classpreloader/src/Exceptions/FileConstantException.php b/application/vendor/classpreloader/classpreloader/src/Exceptions/FileConstantException.php new file mode 100644 index 0000000..c773a0f --- /dev/null +++ b/application/vendor/classpreloader/classpreloader/src/Exceptions/FileConstantException.php @@ -0,0 +1,23 @@ + + * (c) Michael Dowling + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ClassPreloader\Exceptions; + +use Exception; + +/** + * This is the file constant exception class. + */ +class FileConstantException extends Exception implements VisitorExceptionInterface +{ + // +} diff --git a/application/vendor/classpreloader/classpreloader/src/Exceptions/StrictTypesException.php b/application/vendor/classpreloader/classpreloader/src/Exceptions/StrictTypesException.php new file mode 100644 index 0000000..b830be5 --- /dev/null +++ b/application/vendor/classpreloader/classpreloader/src/Exceptions/StrictTypesException.php @@ -0,0 +1,23 @@ + + * (c) Michael Dowling + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ClassPreloader\Exceptions; + +use Exception; + +/** + * This is the strict types exception class. + */ +class StrictTypesException extends Exception implements VisitorExceptionInterface +{ + // +} diff --git a/application/vendor/classpreloader/classpreloader/src/Exceptions/VisitorExceptionInterface.php b/application/vendor/classpreloader/classpreloader/src/Exceptions/VisitorExceptionInterface.php new file mode 100644 index 0000000..d3236a7 --- /dev/null +++ b/application/vendor/classpreloader/classpreloader/src/Exceptions/VisitorExceptionInterface.php @@ -0,0 +1,21 @@ + + * (c) Michael Dowling + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ClassPreloader\Exceptions; + +/** + * This is the visitor exception interface. + */ +interface VisitorExceptionInterface +{ + // +} diff --git a/application/vendor/classpreloader/classpreloader/src/Factory.php b/application/vendor/classpreloader/classpreloader/src/Factory.php new file mode 100644 index 0000000..ea9d070 --- /dev/null +++ b/application/vendor/classpreloader/classpreloader/src/Factory.php @@ -0,0 +1,95 @@ + + * (c) Michael Dowling + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ClassPreloader; + +use ClassPreloader\Parser\DirVisitor; +use ClassPreloader\Parser\FileVisitor; +use ClassPreloader\Parser\NodeTraverser; +use ClassPreloader\Parser\StrictTypesVisitor; +use PhpParser\Lexer; +use PhpParser\Parser; +use PhpParser\ParserFactory; +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; + +/** + * This is the class preloader factory class. + * + * This class is a simple way to create a class preloader instance. + */ +class Factory +{ + /** + * Create a new class preloader instance. + * + * Any options provided determine how the node traverser is setup. + * + * @param bool[] $options + * + * @return \ClassPreloader\ClassPreloader + */ + public function create(array $options = []) + { + $printer = new PrettyPrinter(); + + $parser = $this->getParser(); + + $options = array_merge(['dir' => true, 'file' => true, 'skip' => false, 'strict' => false], $options); + + $traverser = $this->getTraverser($options['dir'], $options['file'], $options['skip'], $options['strict']); + + return new ClassPreloader($printer, $parser, $traverser); + } + + /** + * Get the parser to use. + * + * @return \PhpParser\Parser + */ + protected function getParser() + { + if (class_exists(ParserFactory::class)) { + return (new ParserFactory())->create(ParserFactory::PREFER_PHP7); + } + + return new Parser(new Lexer()); + } + + /** + * Get the node traverser to use. + * + * @param bool $dir + * @param bool $file + * @param bool $skip + * @param bool $strict + * + * @return \ClassPreloader\Parser\NodeTraverser + */ + protected function getTraverser($dir, $file, $skip, $strict) + { + $traverser = new NodeTraverser(); + + if ($dir) { + $traverser->addVisitor(new DirVisitor($skip)); + } + + if ($file) { + $traverser->addVisitor(new FileVisitor($skip)); + } + + if (!$strict) { + $traverser->addVisitor(new StrictTypesVisitor()); + } + + return $traverser; + } +} diff --git a/application/vendor/classpreloader/classpreloader/src/Parser/AbstractNodeVisitor.php b/application/vendor/classpreloader/classpreloader/src/Parser/AbstractNodeVisitor.php index c614f7d..4e9dc3b 100644 --- a/application/vendor/classpreloader/classpreloader/src/Parser/AbstractNodeVisitor.php +++ b/application/vendor/classpreloader/classpreloader/src/Parser/AbstractNodeVisitor.php @@ -3,7 +3,7 @@ /* * This file is part of Class Preloader. * - * (c) Graham Campbell + * (c) Graham Campbell * (c) Michael Dowling * * For the full copyright and license information, please view the LICENSE diff --git a/application/vendor/classpreloader/classpreloader/src/Parser/DirVisitor.php b/application/vendor/classpreloader/classpreloader/src/Parser/DirVisitor.php index 767d5e8..6a5953f 100644 --- a/application/vendor/classpreloader/classpreloader/src/Parser/DirVisitor.php +++ b/application/vendor/classpreloader/classpreloader/src/Parser/DirVisitor.php @@ -3,7 +3,7 @@ /* * This file is part of Class Preloader. * - * (c) Graham Campbell + * (c) Graham Campbell * (c) Michael Dowling * * For the full copyright and license information, please view the LICENSE @@ -12,7 +12,7 @@ namespace ClassPreloader\Parser; -use ClassPreloader\Exception\SkipFileException; +use ClassPreloader\Exceptions\DirConstantException; use PhpParser\Node; use PhpParser\Node\Scalar\MagicConst\Dir as DirNode; use PhpParser\Node\Scalar\String_ as StringNode; @@ -32,7 +32,7 @@ class DirVisitor extends AbstractNodeVisitor protected $skip = false; /** - * Create a new directory visitor. + * Create a new directory visitor instance. * * @param bool $skip * @@ -48,13 +48,15 @@ public function __construct($skip = false) * * @param \PhpParser\Node $node * - * @return void + * @throws \ClassPreloader\Exceptions\DirConstantException + * + * @return \PhpParser\Node\Scalar\String_|null */ public function enterNode(Node $node) { if ($node instanceof DirNode) { if ($this->skip) { - throw new SkipFileException('__DIR__ constant found, skipping...'); + throw new DirConstantException(); } return new StringNode($this->getDir()); diff --git a/application/vendor/classpreloader/classpreloader/src/Parser/FileVisitor.php b/application/vendor/classpreloader/classpreloader/src/Parser/FileVisitor.php index 59c20c6..5130564 100644 --- a/application/vendor/classpreloader/classpreloader/src/Parser/FileVisitor.php +++ b/application/vendor/classpreloader/classpreloader/src/Parser/FileVisitor.php @@ -3,7 +3,7 @@ /* * This file is part of Class Preloader. * - * (c) Graham Campbell + * (c) Graham Campbell * (c) Michael Dowling * * For the full copyright and license information, please view the LICENSE @@ -12,7 +12,7 @@ namespace ClassPreloader\Parser; -use ClassPreloader\Exception\SkipFileException; +use ClassPreloader\Exceptions\FileConstantException; use PhpParser\Node; use PhpParser\Node\Scalar\MagicConst\File as FileNode; use PhpParser\Node\Scalar\String_ as StringNode; @@ -32,7 +32,7 @@ class FileVisitor extends AbstractNodeVisitor protected $skip = false; /** - * Create a new file visitor. + * Create a new file visitor instance. * * @param bool $skip * @@ -48,13 +48,15 @@ public function __construct($skip = false) * * @param \PhpParser\Node $node * - * @return void + * @throws \ClassPreloader\Exceptions\FileConstantException + * + * @return \PhpParser\Node\Scalar\String_|null */ public function enterNode(Node $node) { if ($node instanceof FileNode) { if ($this->skip) { - throw new SkipFileException('__FILE__ constant found, skipping...'); + throw new FileConstantException(); } return new StringNode($this->getFilename()); diff --git a/application/vendor/classpreloader/classpreloader/src/Parser/NodeTraverser.php b/application/vendor/classpreloader/classpreloader/src/Parser/NodeTraverser.php index e645aeb..fec6de4 100644 --- a/application/vendor/classpreloader/classpreloader/src/Parser/NodeTraverser.php +++ b/application/vendor/classpreloader/classpreloader/src/Parser/NodeTraverser.php @@ -3,7 +3,7 @@ /* * This file is part of Class Preloader. * - * (c) Graham Campbell + * (c) Graham Campbell * (c) Michael Dowling * * For the full copyright and license information, please view the LICENSE @@ -27,7 +27,7 @@ class NodeTraverser extends BaseTraverser * @param array $nodes * @param string $filename * - * @return void + * @return \PhpParser\Node[] */ public function traverseFile(array $nodes, $filename) { diff --git a/application/vendor/classpreloader/classpreloader/src/Parser/StrictTypesVisitor.php b/application/vendor/classpreloader/classpreloader/src/Parser/StrictTypesVisitor.php new file mode 100644 index 0000000..f72133d --- /dev/null +++ b/application/vendor/classpreloader/classpreloader/src/Parser/StrictTypesVisitor.php @@ -0,0 +1,41 @@ + + * (c) Michael Dowling + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ClassPreloader\Parser; + +use ClassPreloader\Exceptions\StrictTypesException; +use PhpParser\Node; +use PhpParser\Node\Stmt\DeclareDeclare; + +/** + * This is the strict types visitor class. + * + * This allows us to identify files containing stict types declorations. + */ +class StrictTypesVisitor extends AbstractNodeVisitor +{ + /** + * Enter and modify the node. + * + * @param \PhpParser\Node $node + * + * @throws \ClassPreloader\Exceptions\StrictTypesException + * + * @return null + */ + public function enterNode(Node $node) + { + if ($node instanceof DeclareDeclare && ($node->getLine() === 1 || $node->getLine() === 2)) { + throw new StrictTypesException(); + } + } +} diff --git a/application/vendor/composer/ClassLoader.php b/application/vendor/composer/ClassLoader.php index 5e1469e..fce8549 100644 --- a/application/vendor/composer/ClassLoader.php +++ b/application/vendor/composer/ClassLoader.php @@ -13,9 +13,7 @@ namespace Composer\Autoload; /** - * ClassLoader implements a PSR-0 class loader - * - * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. * * $loader = new \Composer\Autoload\ClassLoader(); * @@ -39,6 +37,8 @@ * * @author Fabien Potencier * @author Jordi Boggiano + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ */ class ClassLoader { @@ -53,8 +53,9 @@ class ClassLoader private $useIncludePath = false; private $classMap = array(); - private $classMapAuthoritative = false; + private $missingClasses = array(); + private $apcuPrefix; public function getPrefixes() { @@ -147,7 +148,7 @@ public function add($prefix, $paths, $prepend = false) * appending or prepending to the ones previously set for this namespace. * * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-0 base directories + * @param array|string $paths The PSR-4 base directories * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException @@ -271,6 +272,26 @@ public function isClassMapAuthoritative() return $this->classMapAuthoritative; } + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + /** * Registers this instance as an autoloader. * @@ -313,29 +334,34 @@ public function loadClass($class) */ public function findFile($class) { - // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 - if ('\\' == $class[0]) { - $class = substr($class, 1); - } - // class map lookup if (isset($this->classMap[$class])) { return $this->classMap[$class]; } - if ($this->classMapAuthoritative) { + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { return false; } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } $file = $this->findFileWithExtension($class, '.php'); // Search for Hack files if we are running on HHVM - if ($file === null && defined('HHVM_VERSION')) { + if (false === $file && defined('HHVM_VERSION')) { $file = $this->findFileWithExtension($class, '.hh'); } - if ($file === null) { + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { // Remember that this class does not exist. - return $this->classMap[$class] = false; + $this->missingClasses[$class] = true; } return $file; @@ -348,10 +374,14 @@ private function findFileWithExtension($class, $ext) $first = $class[0]; if (isset($this->prefixLengthsPsr4[$first])) { - foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { - if (0 === strpos($class, $prefix)) { - foreach ($this->prefixDirsPsr4[$prefix] as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { return $file; } } @@ -399,6 +429,8 @@ private function findFileWithExtension($class, $ext) if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { return $file; } + + return false; } } diff --git a/application/vendor/composer/LICENSE b/application/vendor/composer/LICENSE index c8d57af..f27399a 100644 --- a/application/vendor/composer/LICENSE +++ b/application/vendor/composer/LICENSE @@ -1,5 +1,5 @@ -Copyright (c) 2015 Nils Adermann, Jordi Boggiano +Copyright (c) Nils Adermann, Jordi Boggiano Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/application/vendor/composer/autoload_classmap.php b/application/vendor/composer/autoload_classmap.php index a5badcf..731bce8 100644 --- a/application/vendor/composer/autoload_classmap.php +++ b/application/vendor/composer/autoload_classmap.php @@ -65,17 +65,31 @@ 'App\\User' => $baseDir . '/app/User.php', 'Carbon\\Carbon' => $vendorDir . '/nesbot/carbon/src/Carbon/Carbon.php', 'Carbon\\CarbonInterval' => $vendorDir . '/nesbot/carbon/src/Carbon/CarbonInterval.php', - 'ClassPreloader\\Application' => $vendorDir . '/classpreloader/classpreloader/src/Application.php', + 'Carbon\\CarbonPeriod' => $vendorDir . '/nesbot/carbon/src/Carbon/CarbonPeriod.php', + 'Carbon\\Exceptions\\InvalidDateException' => $vendorDir . '/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php', + 'Carbon\\Laravel\\ServiceProvider' => $vendorDir . '/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php', + 'Carbon\\Translator' => $vendorDir . '/nesbot/carbon/src/Carbon/Translator.php', + 'Carbon\\Upgrade' => $vendorDir . '/nesbot/carbon/src/Carbon/Upgrade.php', 'ClassPreloader\\ClassList' => $vendorDir . '/classpreloader/classpreloader/src/ClassList.php', 'ClassPreloader\\ClassLoader' => $vendorDir . '/classpreloader/classpreloader/src/ClassLoader.php', 'ClassPreloader\\ClassNode' => $vendorDir . '/classpreloader/classpreloader/src/ClassNode.php', - 'ClassPreloader\\Command\\PreCompileCommand' => $vendorDir . '/classpreloader/classpreloader/src/Command/PreCompileCommand.php', + 'ClassPreloader\\ClassPreloader' => $vendorDir . '/classpreloader/classpreloader/src/ClassPreloader.php', 'ClassPreloader\\Config' => $vendorDir . '/classpreloader/classpreloader/src/Config.php', - 'ClassPreloader\\Exception\\SkipFileException' => $vendorDir . '/classpreloader/classpreloader/src/Exception/SkipFileException.php', + 'ClassPreloader\\Exceptions\\DirConstantException' => $vendorDir . '/classpreloader/classpreloader/src/Exceptions/DirConstantException.php', + 'ClassPreloader\\Exceptions\\FileConstantException' => $vendorDir . '/classpreloader/classpreloader/src/Exceptions/FileConstantException.php', + 'ClassPreloader\\Exceptions\\StrictTypesException' => $vendorDir . '/classpreloader/classpreloader/src/Exceptions/StrictTypesException.php', + 'ClassPreloader\\Exceptions\\VisitorExceptionInterface' => $vendorDir . '/classpreloader/classpreloader/src/Exceptions/VisitorExceptionInterface.php', + 'ClassPreloader\\Factory' => $vendorDir . '/classpreloader/classpreloader/src/Factory.php', 'ClassPreloader\\Parser\\AbstractNodeVisitor' => $vendorDir . '/classpreloader/classpreloader/src/Parser/AbstractNodeVisitor.php', 'ClassPreloader\\Parser\\DirVisitor' => $vendorDir . '/classpreloader/classpreloader/src/Parser/DirVisitor.php', 'ClassPreloader\\Parser\\FileVisitor' => $vendorDir . '/classpreloader/classpreloader/src/Parser/FileVisitor.php', 'ClassPreloader\\Parser\\NodeTraverser' => $vendorDir . '/classpreloader/classpreloader/src/Parser/NodeTraverser.php', + 'ClassPreloader\\Parser\\StrictTypesVisitor' => $vendorDir . '/classpreloader/classpreloader/src/Parser/StrictTypesVisitor.php', + 'Collective\\Html\\FormBuilder' => $vendorDir . '/laravelcollective/html/src/FormBuilder.php', + 'Collective\\Html\\FormFacade' => $vendorDir . '/laravelcollective/html/src/FormFacade.php', + 'Collective\\Html\\HtmlBuilder' => $vendorDir . '/laravelcollective/html/src/HtmlBuilder.php', + 'Collective\\Html\\HtmlFacade' => $vendorDir . '/laravelcollective/html/src/HtmlFacade.php', + 'Collective\\Html\\HtmlServiceProvider' => $vendorDir . '/laravelcollective/html/src/HtmlServiceProvider.php', 'CreatePasswordResetsTable' => $baseDir . '/database/migrations/2014_10_12_100000_create_password_resets_table.php', 'CreateServersTable' => $baseDir . '/database/migrations/2015_04_26_154117_create_servers_table.php', 'CreateUsersTable' => $baseDir . '/database/migrations/2014_10_12_000000_create_users_table.php', @@ -93,6 +107,10 @@ 'Doctrine\\Common\\Inflector\\Inflector' => $vendorDir . '/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php', 'Dotenv' => $vendorDir . '/vlucas/phpdotenv/src/Dotenv.php', 'IlluminateQueueClosure' => $vendorDir . '/laravel/framework/src/Illuminate/Queue/IlluminateQueueClosure.php', + 'Illuminate\\Auth\\Access\\Gate' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Access/Gate.php', + 'Illuminate\\Auth\\Access\\HandlesAuthorization' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php', + 'Illuminate\\Auth\\Access\\Response' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Access/Response.php', + 'Illuminate\\Auth\\Access\\UnauthorizedException' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Access/UnauthorizedException.php', 'Illuminate\\Auth\\AuthManager' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/AuthManager.php', 'Illuminate\\Auth\\AuthServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php', 'Illuminate\\Auth\\Authenticatable' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Authenticatable.php', @@ -108,9 +126,16 @@ 'Illuminate\\Auth\\Passwords\\PasswordBroker' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBroker.php', 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php', 'Illuminate\\Auth\\Passwords\\TokenRepositoryInterface' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php', + 'Illuminate\\Broadcasting\\BroadcastEvent' => $vendorDir . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php', + 'Illuminate\\Broadcasting\\BroadcastManager' => $vendorDir . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php', + 'Illuminate\\Broadcasting\\BroadcastServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastServiceProvider.php', + 'Illuminate\\Broadcasting\\Broadcasters\\LogBroadcaster' => $vendorDir . '/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php', + 'Illuminate\\Broadcasting\\Broadcasters\\PusherBroadcaster' => $vendorDir . '/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php', + 'Illuminate\\Broadcasting\\Broadcasters\\RedisBroadcaster' => $vendorDir . '/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php', 'Illuminate\\Bus\\BusServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Bus/BusServiceProvider.php', 'Illuminate\\Bus\\Dispatcher' => $vendorDir . '/laravel/framework/src/Illuminate/Bus/Dispatcher.php', 'Illuminate\\Bus\\MarshalException' => $vendorDir . '/laravel/framework/src/Illuminate/Bus/MarshalException.php', + 'Illuminate\\Bus\\Queueable' => $vendorDir . '/laravel/framework/src/Illuminate/Bus/Queueable.php', 'Illuminate\\Cache\\ApcStore' => $vendorDir . '/laravel/framework/src/Illuminate/Cache/ApcStore.php', 'Illuminate\\Cache\\ApcWrapper' => $vendorDir . '/laravel/framework/src/Illuminate/Cache/ApcWrapper.php', 'Illuminate\\Cache\\ArrayStore' => $vendorDir . '/laravel/framework/src/Illuminate/Cache/ArrayStore.php', @@ -123,6 +148,7 @@ 'Illuminate\\Cache\\MemcachedConnector' => $vendorDir . '/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php', 'Illuminate\\Cache\\MemcachedStore' => $vendorDir . '/laravel/framework/src/Illuminate/Cache/MemcachedStore.php', 'Illuminate\\Cache\\NullStore' => $vendorDir . '/laravel/framework/src/Illuminate/Cache/NullStore.php', + 'Illuminate\\Cache\\RateLimiter' => $vendorDir . '/laravel/framework/src/Illuminate/Cache/RateLimiter.php', 'Illuminate\\Cache\\RedisStore' => $vendorDir . '/laravel/framework/src/Illuminate/Cache/RedisStore.php', 'Illuminate\\Cache\\RedisTaggedCache' => $vendorDir . '/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php', 'Illuminate\\Cache\\Repository' => $vendorDir . '/laravel/framework/src/Illuminate/Cache/Repository.php', @@ -137,6 +163,8 @@ 'Illuminate\\Console\\Command' => $vendorDir . '/laravel/framework/src/Illuminate/Console/Command.php', 'Illuminate\\Console\\ConfirmableTrait' => $vendorDir . '/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php', 'Illuminate\\Console\\GeneratorCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Console/GeneratorCommand.php', + 'Illuminate\\Console\\OutputStyle' => $vendorDir . '/laravel/framework/src/Illuminate/Console/OutputStyle.php', + 'Illuminate\\Console\\Parser' => $vendorDir . '/laravel/framework/src/Illuminate/Console/Parser.php', 'Illuminate\\Console\\ScheduleServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Console/ScheduleServiceProvider.php', 'Illuminate\\Console\\Scheduling\\CallbackEvent' => $vendorDir . '/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php', 'Illuminate\\Console\\Scheduling\\Event' => $vendorDir . '/laravel/framework/src/Illuminate/Console/Scheduling/Event.php', @@ -145,12 +173,18 @@ 'Illuminate\\Container\\BindingResolutionException' => $vendorDir . '/laravel/framework/src/Illuminate/Container/BindingResolutionException.php', 'Illuminate\\Container\\Container' => $vendorDir . '/laravel/framework/src/Illuminate/Container/Container.php', 'Illuminate\\Container\\ContextualBindingBuilder' => $vendorDir . '/laravel/framework/src/Illuminate/Container/ContextualBindingBuilder.php', + 'Illuminate\\Contracts\\Auth\\Access\\Authorizable' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Auth/Access/Authorizable.php', + 'Illuminate\\Contracts\\Auth\\Access\\Gate' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Auth/Access/Gate.php', 'Illuminate\\Contracts\\Auth\\Authenticatable' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Auth/Authenticatable.php', 'Illuminate\\Contracts\\Auth\\CanResetPassword' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Auth/CanResetPassword.php', 'Illuminate\\Contracts\\Auth\\Guard' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Auth/Guard.php', 'Illuminate\\Contracts\\Auth\\PasswordBroker' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Auth/PasswordBroker.php', 'Illuminate\\Contracts\\Auth\\Registrar' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Auth/Registrar.php', 'Illuminate\\Contracts\\Auth\\UserProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Auth/UserProvider.php', + 'Illuminate\\Contracts\\Broadcasting\\Broadcaster' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Broadcasting/Broadcaster.php', + 'Illuminate\\Contracts\\Broadcasting\\Factory' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Broadcasting/Factory.php', + 'Illuminate\\Contracts\\Broadcasting\\ShouldBroadcast' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Broadcasting/ShouldBroadcast.php', + 'Illuminate\\Contracts\\Broadcasting\\ShouldBroadcastNow' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Broadcasting/ShouldBroadcastNow.php', 'Illuminate\\Contracts\\Bus\\Dispatcher' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Bus/Dispatcher.php', 'Illuminate\\Contracts\\Bus\\HandlerResolver' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Bus/HandlerResolver.php', 'Illuminate\\Contracts\\Bus\\QueueingDispatcher' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Bus/QueueingDispatcher.php', @@ -161,6 +195,7 @@ 'Illuminate\\Contracts\\Config\\Repository' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Config/Repository.php', 'Illuminate\\Contracts\\Console\\Application' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Console/Application.php', 'Illuminate\\Contracts\\Console\\Kernel' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Console/Kernel.php', + 'Illuminate\\Contracts\\Container\\BindingResolutionException' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Container/BindingResolutionException.php', 'Illuminate\\Contracts\\Container\\Container' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Container/Container.php', 'Illuminate\\Contracts\\Container\\ContextualBindingBuilder' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Container/ContextualBindingBuilder.php', 'Illuminate\\Contracts\\Cookie\\Factory' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Cookie/Factory.php', @@ -168,6 +203,7 @@ 'Illuminate\\Contracts\\Database\\ModelIdentifier' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Database/ModelIdentifier.php', 'Illuminate\\Contracts\\Debug\\ExceptionHandler' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php', 'Illuminate\\Contracts\\Encryption\\DecryptException' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Encryption/DecryptException.php', + 'Illuminate\\Contracts\\Encryption\\EncryptException' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Encryption/EncryptException.php', 'Illuminate\\Contracts\\Encryption\\Encrypter' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Encryption/Encrypter.php', 'Illuminate\\Contracts\\Events\\Dispatcher' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Events/Dispatcher.php', 'Illuminate\\Contracts\\Filesystem\\Cloud' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Filesystem/Cloud.php', @@ -193,6 +229,7 @@ 'Illuminate\\Contracts\\Queue\\Queue' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Queue/Queue.php', 'Illuminate\\Contracts\\Queue\\QueueableEntity' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Queue/QueueableEntity.php', 'Illuminate\\Contracts\\Queue\\ShouldBeQueued' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Queue/ShouldBeQueued.php', + 'Illuminate\\Contracts\\Queue\\ShouldQueue' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Queue/ShouldQueue.php', 'Illuminate\\Contracts\\Redis\\Database' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Redis/Database.php', 'Illuminate\\Contracts\\Routing\\Middleware' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Routing/Middleware.php', 'Illuminate\\Contracts\\Routing\\Registrar' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Routing/Registrar.php', @@ -201,6 +238,7 @@ 'Illuminate\\Contracts\\Routing\\UrlGenerator' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Routing/UrlGenerator.php', 'Illuminate\\Contracts\\Routing\\UrlRoutable' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Routing/UrlRoutable.php', 'Illuminate\\Contracts\\Support\\Arrayable' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Support/Arrayable.php', + 'Illuminate\\Contracts\\Support\\Htmlable' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Support/Htmlable.php', 'Illuminate\\Contracts\\Support\\Jsonable' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Support/Jsonable.php', 'Illuminate\\Contracts\\Support\\MessageBag' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Support/MessageBag.php', 'Illuminate\\Contracts\\Support\\MessageProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Contracts/Support/MessageProvider.php', @@ -236,11 +274,15 @@ 'Illuminate\\Database\\Console\\Migrations\\ResetCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php', 'Illuminate\\Database\\Console\\Migrations\\RollbackCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Console/Migrations/RollbackCommand.php', 'Illuminate\\Database\\Console\\Migrations\\StatusCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Console/Migrations/StatusCommand.php', - 'Illuminate\\Database\\Console\\SeedCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Console/SeedCommand.php', + 'Illuminate\\Database\\Console\\Seeds\\SeedCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php', + 'Illuminate\\Database\\Console\\Seeds\\SeederMakeCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php', 'Illuminate\\Database\\DatabaseManager' => $vendorDir . '/laravel/framework/src/Illuminate/Database/DatabaseManager.php', 'Illuminate\\Database\\DatabaseServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php', + 'Illuminate\\Database\\DetectsLostConnections' => $vendorDir . '/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php', 'Illuminate\\Database\\Eloquent\\Builder' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php', 'Illuminate\\Database\\Eloquent\\Collection' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php', + 'Illuminate\\Database\\Eloquent\\Factory' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php', + 'Illuminate\\Database\\Eloquent\\FactoryBuilder' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php', 'Illuminate\\Database\\Eloquent\\MassAssignmentException' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/MassAssignmentException.php', 'Illuminate\\Database\\Eloquent\\Model' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Model.php', 'Illuminate\\Database\\Eloquent\\ModelNotFoundException' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/ModelNotFoundException.php', @@ -294,12 +336,14 @@ 'Illuminate\\Database\\Schema\\Grammars\\SQLiteGrammar' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php', 'Illuminate\\Database\\Schema\\Grammars\\SqlServerGrammar' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php', 'Illuminate\\Database\\Schema\\MySqlBuilder' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php', + 'Illuminate\\Database\\Schema\\PostgresBuilder' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Schema/PostgresBuilder.php', 'Illuminate\\Database\\SeedServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Database/SeedServiceProvider.php', 'Illuminate\\Database\\Seeder' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Seeder.php', 'Illuminate\\Database\\SqlServerConnection' => $vendorDir . '/laravel/framework/src/Illuminate/Database/SqlServerConnection.php', + 'Illuminate\\Encryption\\BaseEncrypter' => $vendorDir . '/laravel/framework/src/Illuminate/Encryption/BaseEncrypter.php', 'Illuminate\\Encryption\\Encrypter' => $vendorDir . '/laravel/framework/src/Illuminate/Encryption/Encrypter.php', 'Illuminate\\Encryption\\EncryptionServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php', - 'Illuminate\\Encryption\\InvalidKeyException' => $vendorDir . '/laravel/framework/src/Illuminate/Encryption/InvalidKeyException.php', + 'Illuminate\\Encryption\\McryptEncrypter' => $vendorDir . '/laravel/framework/src/Illuminate/Encryption/McryptEncrypter.php', 'Illuminate\\Events\\CallQueuedHandler' => $vendorDir . '/laravel/framework/src/Illuminate/Events/CallQueuedHandler.php', 'Illuminate\\Events\\Dispatcher' => $vendorDir . '/laravel/framework/src/Illuminate/Events/Dispatcher.php', 'Illuminate\\Events\\EventServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Events/EventServiceProvider.php', @@ -310,8 +354,14 @@ 'Illuminate\\Filesystem\\FilesystemServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php', 'Illuminate\\Foundation\\AliasLoader' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/AliasLoader.php', 'Illuminate\\Foundation\\Application' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Application.php', + 'Illuminate\\Foundation\\Auth\\Access\\Authorizable' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Auth/Access/Authorizable.php', + 'Illuminate\\Foundation\\Auth\\Access\\AuthorizesRequests' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php', 'Illuminate\\Foundation\\Auth\\AuthenticatesAndRegistersUsers' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php', + 'Illuminate\\Foundation\\Auth\\AuthenticatesUsers' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php', + 'Illuminate\\Foundation\\Auth\\RedirectsUsers' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php', + 'Illuminate\\Foundation\\Auth\\RegistersUsers' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php', 'Illuminate\\Foundation\\Auth\\ResetsPasswords' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php', + 'Illuminate\\Foundation\\Auth\\ThrottlesLogins' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php', 'Illuminate\\Foundation\\Bootstrap\\BootProviders' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php', 'Illuminate\\Foundation\\Bootstrap\\ConfigureLogging' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php', 'Illuminate\\Foundation\\Bootstrap\\DetectEnvironment' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php', @@ -321,7 +371,9 @@ 'Illuminate\\Foundation\\Bootstrap\\RegisterProviders' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php', 'Illuminate\\Foundation\\Bootstrap\\SetRequestForConsole' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php', 'Illuminate\\Foundation\\Bus\\DispatchesCommands' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesCommands.php', + 'Illuminate\\Foundation\\Bus\\DispatchesJobs' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php', 'Illuminate\\Foundation\\Composer' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Composer.php', + 'Illuminate\\Foundation\\ComposerScripts' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php', 'Illuminate\\Foundation\\Console\\AppNameCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/AppNameCommand.php', 'Illuminate\\Foundation\\Console\\ClearCompiledCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php', 'Illuminate\\Foundation\\Console\\CommandMakeCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/CommandMakeCommand.php', @@ -332,13 +384,16 @@ 'Illuminate\\Foundation\\Console\\EnvironmentCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php', 'Illuminate\\Foundation\\Console\\EventGenerateCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php', 'Illuminate\\Foundation\\Console\\EventMakeCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php', - 'Illuminate\\Foundation\\Console\\FreshCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/FreshCommand.php', 'Illuminate\\Foundation\\Console\\HandlerCommandCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/HandlerCommandCommand.php', 'Illuminate\\Foundation\\Console\\HandlerEventCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/HandlerEventCommand.php', + 'Illuminate\\Foundation\\Console\\IlluminateCaster' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/IlluminateCaster.php', + 'Illuminate\\Foundation\\Console\\JobMakeCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/JobMakeCommand.php', 'Illuminate\\Foundation\\Console\\Kernel' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php', 'Illuminate\\Foundation\\Console\\KeyGenerateCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php', + 'Illuminate\\Foundation\\Console\\ListenerMakeCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/ListenerMakeCommand.php', 'Illuminate\\Foundation\\Console\\ModelMakeCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php', 'Illuminate\\Foundation\\Console\\OptimizeCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php', + 'Illuminate\\Foundation\\Console\\PolicyMakeCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/PolicyMakeCommand.php', 'Illuminate\\Foundation\\Console\\ProviderMakeCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/ProviderMakeCommand.php', 'Illuminate\\Foundation\\Console\\QueuedJob' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/QueuedJob.php', 'Illuminate\\Foundation\\Console\\RequestMakeCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php', @@ -346,12 +401,11 @@ 'Illuminate\\Foundation\\Console\\RouteClearCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php', 'Illuminate\\Foundation\\Console\\RouteListCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php', 'Illuminate\\Foundation\\Console\\ServeCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php', + 'Illuminate\\Foundation\\Console\\TestMakeCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/TestMakeCommand.php', 'Illuminate\\Foundation\\Console\\TinkerCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/TinkerCommand.php', - 'Illuminate\\Foundation\\Console\\Tinker\\Presenters\\EloquentModelPresenter' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/Tinker/Presenters/EloquentModelPresenter.php', - 'Illuminate\\Foundation\\Console\\Tinker\\Presenters\\IlluminateApplicationPresenter' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/Tinker/Presenters/IlluminateApplicationPresenter.php', - 'Illuminate\\Foundation\\Console\\Tinker\\Presenters\\IlluminateCollectionPresenter' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/Tinker/Presenters/IlluminateCollectionPresenter.php', 'Illuminate\\Foundation\\Console\\UpCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php', 'Illuminate\\Foundation\\Console\\VendorPublishCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php', + 'Illuminate\\Foundation\\Console\\ViewClearCommand' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Console/ViewClearCommand.php', 'Illuminate\\Foundation\\EnvironmentDetector' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php', 'Illuminate\\Foundation\\Exceptions\\Handler' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php', 'Illuminate\\Foundation\\Http\\FormRequest' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php', @@ -366,22 +420,26 @@ 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php', 'Illuminate\\Foundation\\Providers\\FormRequestServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php', 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php', + 'Illuminate\\Foundation\\Support\\Providers\\AuthServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php', 'Illuminate\\Foundation\\Support\\Providers\\EventServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php', 'Illuminate\\Foundation\\Support\\Providers\\RouteServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php', 'Illuminate\\Foundation\\Testing\\ApplicationTrait' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Testing/ApplicationTrait.php', 'Illuminate\\Foundation\\Testing\\AssertionsTrait' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Testing/AssertionsTrait.php', + 'Illuminate\\Foundation\\Testing\\CrawlerTrait' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Testing/CrawlerTrait.php', + 'Illuminate\\Foundation\\Testing\\DatabaseMigrations' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseMigrations.php', + 'Illuminate\\Foundation\\Testing\\DatabaseTransactions' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseTransactions.php', + 'Illuminate\\Foundation\\Testing\\HttpException' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Testing/HttpException.php', + 'Illuminate\\Foundation\\Testing\\InteractsWithPages' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Testing/InteractsWithPages.php', 'Illuminate\\Foundation\\Testing\\TestCase' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php', + 'Illuminate\\Foundation\\Testing\\WithoutEvents' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Testing/WithoutEvents.php', + 'Illuminate\\Foundation\\Testing\\WithoutMiddleware' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Testing/WithoutMiddleware.php', 'Illuminate\\Foundation\\Validation\\ValidatesRequests' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php', 'Illuminate\\Hashing\\BcryptHasher' => $vendorDir . '/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php', 'Illuminate\\Hashing\\HashServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php', - 'Illuminate\\Html\\FormBuilder' => $vendorDir . '/illuminate/html/FormBuilder.php', - 'Illuminate\\Html\\FormFacade' => $vendorDir . '/illuminate/html/FormFacade.php', - 'Illuminate\\Html\\HtmlBuilder' => $vendorDir . '/illuminate/html/HtmlBuilder.php', - 'Illuminate\\Html\\HtmlFacade' => $vendorDir . '/illuminate/html/HtmlFacade.php', - 'Illuminate\\Html\\HtmlServiceProvider' => $vendorDir . '/illuminate/html/HtmlServiceProvider.php', 'Illuminate\\Http\\Exception\\HttpResponseException' => $vendorDir . '/laravel/framework/src/Illuminate/Http/Exception/HttpResponseException.php', 'Illuminate\\Http\\Exception\\PostTooLargeException' => $vendorDir . '/laravel/framework/src/Illuminate/Http/Exception/PostTooLargeException.php', 'Illuminate\\Http\\JsonResponse' => $vendorDir . '/laravel/framework/src/Illuminate/Http/JsonResponse.php', + 'Illuminate\\Http\\Middleware\\CheckResponseForModifications' => $vendorDir . '/laravel/framework/src/Illuminate/Http/Middleware/CheckResponseForModifications.php', 'Illuminate\\Http\\Middleware\\FrameGuard' => $vendorDir . '/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php', 'Illuminate\\Http\\RedirectResponse' => $vendorDir . '/laravel/framework/src/Illuminate/Http/RedirectResponse.php', 'Illuminate\\Http\\Request' => $vendorDir . '/laravel/framework/src/Illuminate/Http/Request.php', @@ -396,6 +454,7 @@ 'Illuminate\\Mail\\Transport\\MailgunTransport' => $vendorDir . '/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php', 'Illuminate\\Mail\\Transport\\MandrillTransport' => $vendorDir . '/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php', 'Illuminate\\Mail\\Transport\\SesTransport' => $vendorDir . '/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php', + 'Illuminate\\Mail\\Transport\\Transport' => $vendorDir . '/laravel/framework/src/Illuminate/Mail/Transport/Transport.php', 'Illuminate\\Pagination\\AbstractPaginator' => $vendorDir . '/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php', 'Illuminate\\Pagination\\BootstrapThreeNextPreviousButtonRendererTrait' => $vendorDir . '/laravel/framework/src/Illuminate/Pagination/BootstrapThreeNextPreviousButtonRendererTrait.php', 'Illuminate\\Pagination\\BootstrapThreePresenter' => $vendorDir . '/laravel/framework/src/Illuminate/Pagination/BootstrapThreePresenter.php', @@ -433,6 +492,7 @@ 'Illuminate\\Queue\\DatabaseQueue' => $vendorDir . '/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php', 'Illuminate\\Queue\\Failed\\DatabaseFailedJobProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php', 'Illuminate\\Queue\\Failed\\FailedJobProviderInterface' => $vendorDir . '/laravel/framework/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php', + 'Illuminate\\Queue\\Failed\\NullFailedJobProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Queue/Failed/NullFailedJobProvider.php', 'Illuminate\\Queue\\InteractsWithQueue' => $vendorDir . '/laravel/framework/src/Illuminate/Queue/InteractsWithQueue.php', 'Illuminate\\Queue\\IronQueue' => $vendorDir . '/laravel/framework/src/Illuminate/Queue/IronQueue.php', 'Illuminate\\Queue\\Jobs\\BeanstalkdJob' => $vendorDir . '/laravel/framework/src/Illuminate/Queue/Jobs/BeanstalkdJob.php', @@ -508,6 +568,7 @@ 'Illuminate\\Support\\Facades\\Event' => $vendorDir . '/laravel/framework/src/Illuminate/Support/Facades/Event.php', 'Illuminate\\Support\\Facades\\Facade' => $vendorDir . '/laravel/framework/src/Illuminate/Support/Facades/Facade.php', 'Illuminate\\Support\\Facades\\File' => $vendorDir . '/laravel/framework/src/Illuminate/Support/Facades/File.php', + 'Illuminate\\Support\\Facades\\Gate' => $vendorDir . '/laravel/framework/src/Illuminate/Support/Facades/Gate.php', 'Illuminate\\Support\\Facades\\Hash' => $vendorDir . '/laravel/framework/src/Illuminate/Support/Facades/Hash.php', 'Illuminate\\Support\\Facades\\Input' => $vendorDir . '/laravel/framework/src/Illuminate/Support/Facades/Input.php', 'Illuminate\\Support\\Facades\\Lang' => $vendorDir . '/laravel/framework/src/Illuminate/Support/Facades/Lang.php', @@ -527,6 +588,7 @@ 'Illuminate\\Support\\Facades\\Validator' => $vendorDir . '/laravel/framework/src/Illuminate/Support/Facades/Validator.php', 'Illuminate\\Support\\Facades\\View' => $vendorDir . '/laravel/framework/src/Illuminate/Support/Facades/View.php', 'Illuminate\\Support\\Fluent' => $vendorDir . '/laravel/framework/src/Illuminate/Support/Fluent.php', + 'Illuminate\\Support\\HtmlString' => $vendorDir . '/laravel/framework/src/Illuminate/Support/HtmlString.php', 'Illuminate\\Support\\Manager' => $vendorDir . '/laravel/framework/src/Illuminate/Support/Manager.php', 'Illuminate\\Support\\MessageBag' => $vendorDir . '/laravel/framework/src/Illuminate/Support/MessageBag.php', 'Illuminate\\Support\\NamespacedItemResolver' => $vendorDir . '/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php', @@ -554,18 +616,21 @@ 'Illuminate\\View\\Engines\\EngineInterface' => $vendorDir . '/laravel/framework/src/Illuminate/View/Engines/EngineInterface.php', 'Illuminate\\View\\Engines\\EngineResolver' => $vendorDir . '/laravel/framework/src/Illuminate/View/Engines/EngineResolver.php', 'Illuminate\\View\\Engines\\PhpEngine' => $vendorDir . '/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php', + 'Illuminate\\View\\Expression' => $vendorDir . '/laravel/framework/src/Illuminate/View/Expression.php', 'Illuminate\\View\\Factory' => $vendorDir . '/laravel/framework/src/Illuminate/View/Factory.php', 'Illuminate\\View\\FileViewFinder' => $vendorDir . '/laravel/framework/src/Illuminate/View/FileViewFinder.php', 'Illuminate\\View\\Middleware\\ShareErrorsFromSession' => $vendorDir . '/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php', 'Illuminate\\View\\View' => $vendorDir . '/laravel/framework/src/Illuminate/View/View.php', 'Illuminate\\View\\ViewFinderInterface' => $vendorDir . '/laravel/framework/src/Illuminate/View/ViewFinderInterface.php', 'Illuminate\\View\\ViewServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/View/ViewServiceProvider.php', - 'JakubOnderka\\PhpConsoleColor\\ConsoleColor' => $vendorDir . '/jakub-onderka/php-console-color/src/JakubOnderka/PhpConsoleColor/ConsoleColor.php', - 'JakubOnderka\\PhpConsoleColor\\InvalidStyleException' => $vendorDir . '/jakub-onderka/php-console-color/src/JakubOnderka/PhpConsoleColor/InvalidStyleException.php', + 'JakubOnderka\\PhpConsoleColor\\ConsoleColor' => $vendorDir . '/jakub-onderka/php-console-color/src/ConsoleColor.php', + 'JakubOnderka\\PhpConsoleColor\\InvalidStyleException' => $vendorDir . '/jakub-onderka/php-console-color/src/InvalidStyleException.php', 'JakubOnderka\\PhpConsoleHighlighter\\Highlighter' => $vendorDir . '/jakub-onderka/php-console-highlighter/src/JakubOnderka/PhpConsoleHighlighter/Highlighter.php', + 'JsonSerializable' => $vendorDir . '/nesbot/carbon/src/JsonSerializable.php', 'League\\Flysystem\\AdapterInterface' => $vendorDir . '/league/flysystem/src/AdapterInterface.php', 'League\\Flysystem\\Adapter\\AbstractAdapter' => $vendorDir . '/league/flysystem/src/Adapter/AbstractAdapter.php', 'League\\Flysystem\\Adapter\\AbstractFtpAdapter' => $vendorDir . '/league/flysystem/src/Adapter/AbstractFtpAdapter.php', + 'League\\Flysystem\\Adapter\\CanOverwriteFiles' => $vendorDir . '/league/flysystem/src/Adapter/CanOverwriteFiles.php', 'League\\Flysystem\\Adapter\\Ftp' => $vendorDir . '/league/flysystem/src/Adapter/Ftp.php', 'League\\Flysystem\\Adapter\\Ftpd' => $vendorDir . '/league/flysystem/src/Adapter/Ftpd.php', 'League\\Flysystem\\Adapter\\Local' => $vendorDir . '/league/flysystem/src/Adapter/Local.php', @@ -585,12 +650,15 @@ 'League\\Flysystem\\FileNotFoundException' => $vendorDir . '/league/flysystem/src/FileNotFoundException.php', 'League\\Flysystem\\Filesystem' => $vendorDir . '/league/flysystem/src/Filesystem.php', 'League\\Flysystem\\FilesystemInterface' => $vendorDir . '/league/flysystem/src/FilesystemInterface.php', + 'League\\Flysystem\\FilesystemNotFoundException' => $vendorDir . '/league/flysystem/src/FilesystemNotFoundException.php', 'League\\Flysystem\\Handler' => $vendorDir . '/league/flysystem/src/Handler.php', 'League\\Flysystem\\MountManager' => $vendorDir . '/league/flysystem/src/MountManager.php', 'League\\Flysystem\\NotSupportedException' => $vendorDir . '/league/flysystem/src/NotSupportedException.php', 'League\\Flysystem\\PluginInterface' => $vendorDir . '/league/flysystem/src/PluginInterface.php', 'League\\Flysystem\\Plugin\\AbstractPlugin' => $vendorDir . '/league/flysystem/src/Plugin/AbstractPlugin.php', 'League\\Flysystem\\Plugin\\EmptyDir' => $vendorDir . '/league/flysystem/src/Plugin/EmptyDir.php', + 'League\\Flysystem\\Plugin\\ForcedCopy' => $vendorDir . '/league/flysystem/src/Plugin/ForcedCopy.php', + 'League\\Flysystem\\Plugin\\ForcedRename' => $vendorDir . '/league/flysystem/src/Plugin/ForcedRename.php', 'League\\Flysystem\\Plugin\\GetWithMetadata' => $vendorDir . '/league/flysystem/src/Plugin/GetWithMetadata.php', 'League\\Flysystem\\Plugin\\ListFiles' => $vendorDir . '/league/flysystem/src/Plugin/ListFiles.php', 'League\\Flysystem\\Plugin\\ListPaths' => $vendorDir . '/league/flysystem/src/Plugin/ListPaths.php', @@ -599,13 +667,17 @@ 'League\\Flysystem\\Plugin\\PluginNotFoundException' => $vendorDir . '/league/flysystem/src/Plugin/PluginNotFoundException.php', 'League\\Flysystem\\ReadInterface' => $vendorDir . '/league/flysystem/src/ReadInterface.php', 'League\\Flysystem\\RootViolationException' => $vendorDir . '/league/flysystem/src/RootViolationException.php', + 'League\\Flysystem\\SafeStorage' => $vendorDir . '/league/flysystem/src/SafeStorage.php', + 'League\\Flysystem\\UnreadableFileException' => $vendorDir . '/league/flysystem/src/UnreadableFileException.php', 'League\\Flysystem\\Util' => $vendorDir . '/league/flysystem/src/Util.php', 'League\\Flysystem\\Util\\ContentListingFormatter' => $vendorDir . '/league/flysystem/src/Util/ContentListingFormatter.php', 'League\\Flysystem\\Util\\MimeType' => $vendorDir . '/league/flysystem/src/Util/MimeType.php', + 'League\\Flysystem\\Util\\StreamHasher' => $vendorDir . '/league/flysystem/src/Util/StreamHasher.php', 'Monolog\\ErrorHandler' => $vendorDir . '/monolog/monolog/src/Monolog/ErrorHandler.php', 'Monolog\\Formatter\\ChromePHPFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php', 'Monolog\\Formatter\\ElasticaFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php', 'Monolog\\Formatter\\FlowdockFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php', + 'Monolog\\Formatter\\FluentdFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php', 'Monolog\\Formatter\\FormatterInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php', 'Monolog\\Formatter\\GelfMessageFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php', 'Monolog\\Formatter\\HtmlFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php', @@ -627,6 +699,7 @@ 'Monolog\\Handler\\CouchDBHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php', 'Monolog\\Handler\\CubeHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/CubeHandler.php', 'Monolog\\Handler\\Curl\\Util' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/Curl/Util.php', + 'Monolog\\Handler\\DeduplicationHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php', 'Monolog\\Handler\\DoctrineCouchDBHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php', 'Monolog\\Handler\\DynamoDbHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php', 'Monolog\\Handler\\ElasticSearchHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php', @@ -639,11 +712,15 @@ 'Monolog\\Handler\\FirePHPHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php', 'Monolog\\Handler\\FleepHookHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php', 'Monolog\\Handler\\FlowdockHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php', + 'Monolog\\Handler\\FormattableHandlerInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php', + 'Monolog\\Handler\\FormattableHandlerTrait' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php', 'Monolog\\Handler\\GelfHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/GelfHandler.php', 'Monolog\\Handler\\GroupHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/GroupHandler.php', 'Monolog\\Handler\\HandlerInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/HandlerInterface.php', + 'Monolog\\Handler\\HandlerWrapper' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php', 'Monolog\\Handler\\HipChatHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/HipChatHandler.php', 'Monolog\\Handler\\IFTTTHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php', + 'Monolog\\Handler\\InsightOpsHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php', 'Monolog\\Handler\\LogEntriesHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php', 'Monolog\\Handler\\LogglyHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/LogglyHandler.php', 'Monolog\\Handler\\MailHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/MailHandler.php', @@ -654,6 +731,8 @@ 'Monolog\\Handler\\NewRelicHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php', 'Monolog\\Handler\\NullHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/NullHandler.php', 'Monolog\\Handler\\PHPConsoleHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php', + 'Monolog\\Handler\\ProcessableHandlerInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php', + 'Monolog\\Handler\\ProcessableHandlerTrait' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php', 'Monolog\\Handler\\PsrHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/PsrHandler.php', 'Monolog\\Handler\\PushoverHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/PushoverHandler.php', 'Monolog\\Handler\\RavenHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/RavenHandler.php', @@ -662,6 +741,9 @@ 'Monolog\\Handler\\RotatingFileHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php', 'Monolog\\Handler\\SamplingHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SamplingHandler.php', 'Monolog\\Handler\\SlackHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SlackHandler.php', + 'Monolog\\Handler\\SlackWebhookHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php', + 'Monolog\\Handler\\Slack\\SlackRecord' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php', + 'Monolog\\Handler\\SlackbotHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php', 'Monolog\\Handler\\SocketHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SocketHandler.php', 'Monolog\\Handler\\StreamHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/StreamHandler.php', 'Monolog\\Handler\\SwiftMailerHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php', @@ -677,12 +759,214 @@ 'Monolog\\Processor\\MemoryPeakUsageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php', 'Monolog\\Processor\\MemoryProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php', 'Monolog\\Processor\\MemoryUsageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php', + 'Monolog\\Processor\\MercurialProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php', 'Monolog\\Processor\\ProcessIdProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php', + 'Monolog\\Processor\\ProcessorInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php', 'Monolog\\Processor\\PsrLogMessageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php', 'Monolog\\Processor\\TagProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/TagProcessor.php', 'Monolog\\Processor\\UidProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/UidProcessor.php', 'Monolog\\Processor\\WebProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/WebProcessor.php', 'Monolog\\Registry' => $vendorDir . '/monolog/monolog/src/Monolog/Registry.php', + 'Monolog\\ResettableInterface' => $vendorDir . '/monolog/monolog/src/Monolog/ResettableInterface.php', + 'Monolog\\SignalHandler' => $vendorDir . '/monolog/monolog/src/Monolog/SignalHandler.php', + 'Monolog\\Utils' => $vendorDir . '/monolog/monolog/src/Monolog/Utils.php', + 'PhpParser\\Autoloader' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Autoloader.php', + 'PhpParser\\Builder' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder.php', + 'PhpParser\\BuilderAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/BuilderAbstract.php', + 'PhpParser\\BuilderFactory' => $vendorDir . '/nikic/php-parser/lib/PhpParser/BuilderFactory.php', + 'PhpParser\\Builder\\Class_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Class_.php', + 'PhpParser\\Builder\\Declaration' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Declaration.php', + 'PhpParser\\Builder\\FunctionLike' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php', + 'PhpParser\\Builder\\Function_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Function_.php', + 'PhpParser\\Builder\\Interface_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Interface_.php', + 'PhpParser\\Builder\\Method' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Method.php', + 'PhpParser\\Builder\\Namespace_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php', + 'PhpParser\\Builder\\Param' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Param.php', + 'PhpParser\\Builder\\Property' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Property.php', + 'PhpParser\\Builder\\Trait_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Trait_.php', + 'PhpParser\\Builder\\Use_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Use_.php', + 'PhpParser\\Comment' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Comment.php', + 'PhpParser\\Comment\\Doc' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Comment/Doc.php', + 'PhpParser\\Error' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Error.php', + 'PhpParser\\Lexer' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer.php', + 'PhpParser\\Lexer\\Emulative' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php', + 'PhpParser\\Node' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node.php', + 'PhpParser\\NodeAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeAbstract.php', + 'PhpParser\\NodeDumper' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeDumper.php', + 'PhpParser\\NodeTraverser' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeTraverser.php', + 'PhpParser\\NodeTraverserInterface' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php', + 'PhpParser\\NodeVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor.php', + 'PhpParser\\NodeVisitorAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php', + 'PhpParser\\NodeVisitor\\NameResolver' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php', + 'PhpParser\\Node\\Arg' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Arg.php', + 'PhpParser\\Node\\Const_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Const_.php', + 'PhpParser\\Node\\Expr' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr.php', + 'PhpParser\\Node\\Expr\\ArrayDimFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php', + 'PhpParser\\Node\\Expr\\ArrayItem' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php', + 'PhpParser\\Node\\Expr\\Array_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php', + 'PhpParser\\Node\\Expr\\Assign' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php', + 'PhpParser\\Node\\Expr\\AssignOp' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php', + 'PhpParser\\Node\\Expr\\AssignOp\\BitwiseAnd' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php', + 'PhpParser\\Node\\Expr\\AssignOp\\BitwiseOr' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php', + 'PhpParser\\Node\\Expr\\AssignOp\\BitwiseXor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Concat' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Div' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Minus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Mod' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Mul' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Plus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Pow' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.php', + 'PhpParser\\Node\\Expr\\AssignOp\\ShiftLeft' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php', + 'PhpParser\\Node\\Expr\\AssignOp\\ShiftRight' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php', + 'PhpParser\\Node\\Expr\\AssignRef' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php', + 'PhpParser\\Node\\Expr\\BinaryOp' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\BitwiseAnd' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\BitwiseOr' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\BitwiseXor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\BooleanAnd' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\BooleanOr' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Coalesce' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Concat' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Div' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Equal' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Greater' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\GreaterOrEqual' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Identical' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\LogicalAnd' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\LogicalOr' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\LogicalXor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Minus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Mod' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Mul' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\NotEqual' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\NotIdentical' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Plus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Pow' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\ShiftLeft' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\ShiftRight' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Smaller' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\SmallerOrEqual' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Spaceship' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php', + 'PhpParser\\Node\\Expr\\BitwiseNot' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php', + 'PhpParser\\Node\\Expr\\BooleanNot' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php', + 'PhpParser\\Node\\Expr\\Cast' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php', + 'PhpParser\\Node\\Expr\\Cast\\Array_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php', + 'PhpParser\\Node\\Expr\\Cast\\Bool_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php', + 'PhpParser\\Node\\Expr\\Cast\\Double' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php', + 'PhpParser\\Node\\Expr\\Cast\\Int_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.php', + 'PhpParser\\Node\\Expr\\Cast\\Object_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.php', + 'PhpParser\\Node\\Expr\\Cast\\String_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.php', + 'PhpParser\\Node\\Expr\\Cast\\Unset_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.php', + 'PhpParser\\Node\\Expr\\ClassConstFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php', + 'PhpParser\\Node\\Expr\\Clone_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php', + 'PhpParser\\Node\\Expr\\Closure' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php', + 'PhpParser\\Node\\Expr\\ClosureUse' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php', + 'PhpParser\\Node\\Expr\\ConstFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php', + 'PhpParser\\Node\\Expr\\Empty_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php', + 'PhpParser\\Node\\Expr\\ErrorSuppress' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php', + 'PhpParser\\Node\\Expr\\Eval_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php', + 'PhpParser\\Node\\Expr\\Exit_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php', + 'PhpParser\\Node\\Expr\\FuncCall' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php', + 'PhpParser\\Node\\Expr\\Include_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php', + 'PhpParser\\Node\\Expr\\Instanceof_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php', + 'PhpParser\\Node\\Expr\\Isset_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php', + 'PhpParser\\Node\\Expr\\List_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php', + 'PhpParser\\Node\\Expr\\MethodCall' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php', + 'PhpParser\\Node\\Expr\\New_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php', + 'PhpParser\\Node\\Expr\\PostDec' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php', + 'PhpParser\\Node\\Expr\\PostInc' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php', + 'PhpParser\\Node\\Expr\\PreDec' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php', + 'PhpParser\\Node\\Expr\\PreInc' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php', + 'PhpParser\\Node\\Expr\\Print_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php', + 'PhpParser\\Node\\Expr\\PropertyFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php', + 'PhpParser\\Node\\Expr\\ShellExec' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php', + 'PhpParser\\Node\\Expr\\StaticCall' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php', + 'PhpParser\\Node\\Expr\\StaticPropertyFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php', + 'PhpParser\\Node\\Expr\\Ternary' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php', + 'PhpParser\\Node\\Expr\\UnaryMinus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php', + 'PhpParser\\Node\\Expr\\UnaryPlus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php', + 'PhpParser\\Node\\Expr\\Variable' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php', + 'PhpParser\\Node\\Expr\\YieldFrom' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php', + 'PhpParser\\Node\\Expr\\Yield_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php', + 'PhpParser\\Node\\FunctionLike' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php', + 'PhpParser\\Node\\Name' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Name.php', + 'PhpParser\\Node\\Name\\FullyQualified' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php', + 'PhpParser\\Node\\Name\\Relative' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php', + 'PhpParser\\Node\\Param' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Param.php', + 'PhpParser\\Node\\Scalar' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar.php', + 'PhpParser\\Node\\Scalar\\DNumber' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php', + 'PhpParser\\Node\\Scalar\\Encapsed' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php', + 'PhpParser\\Node\\Scalar\\EncapsedStringPart' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php', + 'PhpParser\\Node\\Scalar\\LNumber' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php', + 'PhpParser\\Node\\Scalar\\MagicConst' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Class_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Dir' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\File' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Function_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Line' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Method' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Namespace_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Trait_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php', + 'PhpParser\\Node\\Scalar\\String_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php', + 'PhpParser\\Node\\Stmt' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt.php', + 'PhpParser\\Node\\Stmt\\Break_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php', + 'PhpParser\\Node\\Stmt\\Case_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php', + 'PhpParser\\Node\\Stmt\\Catch_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php', + 'PhpParser\\Node\\Stmt\\ClassConst' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php', + 'PhpParser\\Node\\Stmt\\ClassLike' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php', + 'PhpParser\\Node\\Stmt\\ClassMethod' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php', + 'PhpParser\\Node\\Stmt\\Class_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php', + 'PhpParser\\Node\\Stmt\\Const_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php', + 'PhpParser\\Node\\Stmt\\Continue_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php', + 'PhpParser\\Node\\Stmt\\DeclareDeclare' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php', + 'PhpParser\\Node\\Stmt\\Declare_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php', + 'PhpParser\\Node\\Stmt\\Do_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php', + 'PhpParser\\Node\\Stmt\\Echo_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php', + 'PhpParser\\Node\\Stmt\\ElseIf_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php', + 'PhpParser\\Node\\Stmt\\Else_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php', + 'PhpParser\\Node\\Stmt\\For_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php', + 'PhpParser\\Node\\Stmt\\Foreach_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php', + 'PhpParser\\Node\\Stmt\\Function_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php', + 'PhpParser\\Node\\Stmt\\Global_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php', + 'PhpParser\\Node\\Stmt\\Goto_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php', + 'PhpParser\\Node\\Stmt\\GroupUse' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php', + 'PhpParser\\Node\\Stmt\\HaltCompiler' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php', + 'PhpParser\\Node\\Stmt\\If_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php', + 'PhpParser\\Node\\Stmt\\InlineHTML' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php', + 'PhpParser\\Node\\Stmt\\Interface_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php', + 'PhpParser\\Node\\Stmt\\Label' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php', + 'PhpParser\\Node\\Stmt\\Namespace_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php', + 'PhpParser\\Node\\Stmt\\Nop' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php', + 'PhpParser\\Node\\Stmt\\Property' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php', + 'PhpParser\\Node\\Stmt\\PropertyProperty' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php', + 'PhpParser\\Node\\Stmt\\Return_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php', + 'PhpParser\\Node\\Stmt\\StaticVar' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php', + 'PhpParser\\Node\\Stmt\\Static_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php', + 'PhpParser\\Node\\Stmt\\Switch_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php', + 'PhpParser\\Node\\Stmt\\Throw_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php', + 'PhpParser\\Node\\Stmt\\TraitUse' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php', + 'PhpParser\\Node\\Stmt\\TraitUseAdaptation' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php', + 'PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Alias' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php', + 'PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Precedence' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php', + 'PhpParser\\Node\\Stmt\\Trait_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php', + 'PhpParser\\Node\\Stmt\\TryCatch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php', + 'PhpParser\\Node\\Stmt\\Unset_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php', + 'PhpParser\\Node\\Stmt\\UseUse' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php', + 'PhpParser\\Node\\Stmt\\Use_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php', + 'PhpParser\\Node\\Stmt\\While_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php', + 'PhpParser\\Parser' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser.php', + 'PhpParser\\ParserAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ParserAbstract.php', + 'PhpParser\\ParserFactory' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ParserFactory.php', + 'PhpParser\\Parser\\Multiple' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser/Multiple.php', + 'PhpParser\\Parser\\Php5' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser/Php5.php', + 'PhpParser\\Parser\\Php7' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser/Php7.php', + 'PhpParser\\Parser\\Tokens' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser/Tokens.php', + 'PhpParser\\PrettyPrinterAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php', + 'PhpParser\\PrettyPrinter\\Standard' => $vendorDir . '/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php', + 'PhpParser\\Serializer' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Serializer.php', + 'PhpParser\\Serializer\\XML' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Serializer/XML.php', + 'PhpParser\\Unserializer' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Unserializer.php', + 'PhpParser\\Unserializer\\XML' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Unserializer/XML.php', 'Psr\\Log\\AbstractLogger' => $vendorDir . '/psr/log/Psr/Log/AbstractLogger.php', 'Psr\\Log\\InvalidArgumentException' => $vendorDir . '/psr/log/Psr/Log/InvalidArgumentException.php', 'Psr\\Log\\LogLevel' => $vendorDir . '/psr/log/Psr/Log/LogLevel.php', @@ -693,6 +977,7 @@ 'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/Psr/Log/NullLogger.php', 'Psr\\Log\\Test\\DummyTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', 'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', + 'Psr\\Log\\Test\\TestLogger' => $vendorDir . '/psr/log/Psr/Log/Test/TestLogger.php', 'Psy\\Autoloader' => $vendorDir . '/psy/psysh/src/Psy/Autoloader.php', 'Psy\\CodeCleaner' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner.php', 'Psy\\CodeCleaner\\AbstractClassPass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/AbstractClassPass.php', @@ -700,6 +985,7 @@ 'Psy\\CodeCleaner\\CallTimePassByReferencePass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/CallTimePassByReferencePass.php', 'Psy\\CodeCleaner\\CalledClassPass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/CalledClassPass.php', 'Psy\\CodeCleaner\\CodeCleanerPass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/CodeCleanerPass.php', + 'Psy\\CodeCleaner\\ExitPass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/ExitPass.php', 'Psy\\CodeCleaner\\FunctionReturnInWriteContextPass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/FunctionReturnInWriteContextPass.php', 'Psy\\CodeCleaner\\ImplicitReturnPass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/ImplicitReturnPass.php', 'Psy\\CodeCleaner\\InstanceOfPass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/InstanceOfPass.php', @@ -709,6 +995,7 @@ 'Psy\\CodeCleaner\\NamespaceAwarePass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/NamespaceAwarePass.php', 'Psy\\CodeCleaner\\NamespacePass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/NamespacePass.php', 'Psy\\CodeCleaner\\StaticConstructorPass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/StaticConstructorPass.php', + 'Psy\\CodeCleaner\\StrictTypesPass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/StrictTypesPass.php', 'Psy\\CodeCleaner\\UseStatementPass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/UseStatementPass.php', 'Psy\\CodeCleaner\\ValidClassNamePass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/ValidClassNamePass.php', 'Psy\\CodeCleaner\\ValidConstantPass' => $vendorDir . '/psy/psysh/src/Psy/CodeCleaner/ValidConstantPass.php', @@ -742,16 +1029,20 @@ 'Psy\\Command\\WhereamiCommand' => $vendorDir . '/psy/psysh/src/Psy/Command/WhereamiCommand.php', 'Psy\\Command\\WtfCommand' => $vendorDir . '/psy/psysh/src/Psy/Command/WtfCommand.php', 'Psy\\Compiler' => $vendorDir . '/psy/psysh/src/Psy/Compiler.php', + 'Psy\\ConfigPaths' => $vendorDir . '/psy/psysh/src/Psy/ConfigPaths.php', 'Psy\\Configuration' => $vendorDir . '/psy/psysh/src/Psy/Configuration.php', + 'Psy\\ConsoleColorFactory' => $vendorDir . '/psy/psysh/src/Psy/ConsoleColorFactory.php', 'Psy\\Context' => $vendorDir . '/psy/psysh/src/Psy/Context.php', 'Psy\\ContextAware' => $vendorDir . '/psy/psysh/src/Psy/ContextAware.php', 'Psy\\Exception\\BreakException' => $vendorDir . '/psy/psysh/src/Psy/Exception/BreakException.php', + 'Psy\\Exception\\DeprecatedException' => $vendorDir . '/psy/psysh/src/Psy/Exception/DeprecatedException.php', 'Psy\\Exception\\ErrorException' => $vendorDir . '/psy/psysh/src/Psy/Exception/ErrorException.php', 'Psy\\Exception\\Exception' => $vendorDir . '/psy/psysh/src/Psy/Exception/Exception.php', 'Psy\\Exception\\FatalErrorException' => $vendorDir . '/psy/psysh/src/Psy/Exception/FatalErrorException.php', 'Psy\\Exception\\ParseErrorException' => $vendorDir . '/psy/psysh/src/Psy/Exception/ParseErrorException.php', 'Psy\\Exception\\RuntimeException' => $vendorDir . '/psy/psysh/src/Psy/Exception/RuntimeException.php', 'Psy\\Exception\\ThrowUpException' => $vendorDir . '/psy/psysh/src/Psy/Exception/ThrowUpException.php', + 'Psy\\Exception\\TypeErrorException' => $vendorDir . '/psy/psysh/src/Psy/Exception/TypeErrorException.php', 'Psy\\ExecutionLoop\\ForkingLoop' => $vendorDir . '/psy/psysh/src/Psy/ExecutionLoop/ForkingLoop.php', 'Psy\\ExecutionLoop\\Loop' => $vendorDir . '/psy/psysh/src/Psy/ExecutionLoop/Loop.php', 'Psy\\Formatter\\CodeFormatter' => $vendorDir . '/psy/psysh/src/Psy/Formatter/CodeFormatter.php', @@ -762,18 +1053,7 @@ 'Psy\\Output\\PassthruPager' => $vendorDir . '/psy/psysh/src/Psy/Output/PassthruPager.php', 'Psy\\Output\\ProcOutputPager' => $vendorDir . '/psy/psysh/src/Psy/Output/ProcOutputPager.php', 'Psy\\Output\\ShellOutput' => $vendorDir . '/psy/psysh/src/Psy/Output/ShellOutput.php', - 'Psy\\Presenter\\ArrayPresenter' => $vendorDir . '/psy/psysh/src/Psy/Presenter/ArrayPresenter.php', - 'Psy\\Presenter\\ClosurePresenter' => $vendorDir . '/psy/psysh/src/Psy/Presenter/ClosurePresenter.php', - 'Psy\\Presenter\\ExceptionPresenter' => $vendorDir . '/psy/psysh/src/Psy/Presenter/ExceptionPresenter.php', - 'Psy\\Presenter\\MongoCursorPresenter' => $vendorDir . '/psy/psysh/src/Psy/Presenter/MongoCursorPresenter.php', - 'Psy\\Presenter\\ObjectPresenter' => $vendorDir . '/psy/psysh/src/Psy/Presenter/ObjectPresenter.php', - 'Psy\\Presenter\\PHPParserPresenter' => $vendorDir . '/psy/psysh/src/Psy/Presenter/PHPParserPresenter.php', - 'Psy\\Presenter\\Presenter' => $vendorDir . '/psy/psysh/src/Psy/Presenter/Presenter.php', - 'Psy\\Presenter\\PresenterManager' => $vendorDir . '/psy/psysh/src/Psy/Presenter/PresenterManager.php', - 'Psy\\Presenter\\PresenterManagerAware' => $vendorDir . '/psy/psysh/src/Psy/Presenter/PresenterManagerAware.php', - 'Psy\\Presenter\\RecursivePresenter' => $vendorDir . '/psy/psysh/src/Psy/Presenter/RecursivePresenter.php', - 'Psy\\Presenter\\ResourcePresenter' => $vendorDir . '/psy/psysh/src/Psy/Presenter/ResourcePresenter.php', - 'Psy\\Presenter\\ScalarPresenter' => $vendorDir . '/psy/psysh/src/Psy/Presenter/ScalarPresenter.php', + 'Psy\\ParserFactory' => $vendorDir . '/psy/psysh/src/Psy/ParserFactory.php', 'Psy\\Readline\\GNUReadline' => $vendorDir . '/psy/psysh/src/Psy/Readline/GNUReadline.php', 'Psy\\Readline\\Libedit' => $vendorDir . '/psy/psysh/src/Psy/Readline/Libedit.php', 'Psy\\Readline\\Readline' => $vendorDir . '/psy/psysh/src/Psy/Readline/Readline.php', @@ -798,160 +1078,170 @@ 'Psy\\Util\\Docblock' => $vendorDir . '/psy/psysh/src/Psy/Util/Docblock.php', 'Psy\\Util\\Json' => $vendorDir . '/psy/psysh/src/Psy/Util/Json.php', 'Psy\\Util\\Mirror' => $vendorDir . '/psy/psysh/src/Psy/Util/Mirror.php', - 'Psy\\Util\\String' => $vendorDir . '/psy/psysh/src/Psy/Util/String.php', - 'SessionHandlerInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php', + 'Psy\\Util\\Str' => $vendorDir . '/psy/psysh/src/Psy/Util/Str.php', + 'Psy\\VarDumper\\Cloner' => $vendorDir . '/psy/psysh/src/Psy/VarDumper/Cloner.php', + 'Psy\\VarDumper\\Dumper' => $vendorDir . '/psy/psysh/src/Psy/VarDumper/Dumper.php', + 'Psy\\VarDumper\\Presenter' => $vendorDir . '/psy/psysh/src/Psy/VarDumper/Presenter.php', + 'Psy\\VarDumper\\PresenterAware' => $vendorDir . '/psy/psysh/src/Psy/VarDumper/PresenterAware.php', + 'SessionHandlerInterface' => $vendorDir . '/symfony/http-foundation/Resources/stubs/SessionHandlerInterface.php', 'Stringy\\StaticStringy' => $vendorDir . '/danielstjules/stringy/src/StaticStringy.php', 'Stringy\\Stringy' => $vendorDir . '/danielstjules/stringy/src/Stringy.php', - 'SuperClosure\\Analyzer\\AstAnalyzer' => $vendorDir . '/jeremeamia/SuperClosure/src/Analyzer/AstAnalyzer.php', - 'SuperClosure\\Analyzer\\ClosureAnalyzer' => $vendorDir . '/jeremeamia/SuperClosure/src/Analyzer/ClosureAnalyzer.php', - 'SuperClosure\\Analyzer\\Token' => $vendorDir . '/jeremeamia/SuperClosure/src/Analyzer/Token.php', - 'SuperClosure\\Analyzer\\TokenAnalyzer' => $vendorDir . '/jeremeamia/SuperClosure/src/Analyzer/TokenAnalyzer.php', - 'SuperClosure\\Analyzer\\Visitor\\ClosureLocatorVisitor' => $vendorDir . '/jeremeamia/SuperClosure/src/Analyzer/Visitor/ClosureLocatorVisitor.php', - 'SuperClosure\\Analyzer\\Visitor\\MagicConstantVisitor' => $vendorDir . '/jeremeamia/SuperClosure/src/Analyzer/Visitor/MagicConstantVisitor.php', - 'SuperClosure\\Analyzer\\Visitor\\ThisDetectorVisitor' => $vendorDir . '/jeremeamia/SuperClosure/src/Analyzer/Visitor/ThisDetectorVisitor.php', - 'SuperClosure\\Exception\\ClosureAnalysisException' => $vendorDir . '/jeremeamia/SuperClosure/src/Exception/ClosureAnalysisException.php', - 'SuperClosure\\Exception\\ClosureUnserializationException' => $vendorDir . '/jeremeamia/SuperClosure/src/Exception/ClosureUnserializationException.php', - 'SuperClosure\\Exception\\SuperClosureException' => $vendorDir . '/jeremeamia/SuperClosure/src/Exception/SuperClosureException.php', - 'SuperClosure\\SerializableClosure' => $vendorDir . '/jeremeamia/SuperClosure/src/SerializableClosure.php', - 'SuperClosure\\Serializer' => $vendorDir . '/jeremeamia/SuperClosure/src/Serializer.php', - 'SuperClosure\\SerializerInterface' => $vendorDir . '/jeremeamia/SuperClosure/src/SerializerInterface.php', - 'Symfony\\Component\\Console\\Application' => $vendorDir . '/symfony/console/Symfony/Component/Console/Application.php', - 'Symfony\\Component\\Console\\Command\\Command' => $vendorDir . '/symfony/console/Symfony/Component/Console/Command/Command.php', - 'Symfony\\Component\\Console\\Command\\HelpCommand' => $vendorDir . '/symfony/console/Symfony/Component/Console/Command/HelpCommand.php', - 'Symfony\\Component\\Console\\Command\\ListCommand' => $vendorDir . '/symfony/console/Symfony/Component/Console/Command/ListCommand.php', - 'Symfony\\Component\\Console\\ConsoleEvents' => $vendorDir . '/symfony/console/Symfony/Component/Console/ConsoleEvents.php', - 'Symfony\\Component\\Console\\Descriptor\\ApplicationDescription' => $vendorDir . '/symfony/console/Symfony/Component/Console/Descriptor/ApplicationDescription.php', - 'Symfony\\Component\\Console\\Descriptor\\Descriptor' => $vendorDir . '/symfony/console/Symfony/Component/Console/Descriptor/Descriptor.php', - 'Symfony\\Component\\Console\\Descriptor\\DescriptorInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Descriptor/DescriptorInterface.php', - 'Symfony\\Component\\Console\\Descriptor\\JsonDescriptor' => $vendorDir . '/symfony/console/Symfony/Component/Console/Descriptor/JsonDescriptor.php', - 'Symfony\\Component\\Console\\Descriptor\\MarkdownDescriptor' => $vendorDir . '/symfony/console/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php', - 'Symfony\\Component\\Console\\Descriptor\\TextDescriptor' => $vendorDir . '/symfony/console/Symfony/Component/Console/Descriptor/TextDescriptor.php', - 'Symfony\\Component\\Console\\Descriptor\\XmlDescriptor' => $vendorDir . '/symfony/console/Symfony/Component/Console/Descriptor/XmlDescriptor.php', - 'Symfony\\Component\\Console\\Event\\ConsoleCommandEvent' => $vendorDir . '/symfony/console/Symfony/Component/Console/Event/ConsoleCommandEvent.php', - 'Symfony\\Component\\Console\\Event\\ConsoleEvent' => $vendorDir . '/symfony/console/Symfony/Component/Console/Event/ConsoleEvent.php', - 'Symfony\\Component\\Console\\Event\\ConsoleExceptionEvent' => $vendorDir . '/symfony/console/Symfony/Component/Console/Event/ConsoleExceptionEvent.php', - 'Symfony\\Component\\Console\\Event\\ConsoleTerminateEvent' => $vendorDir . '/symfony/console/Symfony/Component/Console/Event/ConsoleTerminateEvent.php', - 'Symfony\\Component\\Console\\Formatter\\OutputFormatter' => $vendorDir . '/symfony/console/Symfony/Component/Console/Formatter/OutputFormatter.php', - 'Symfony\\Component\\Console\\Formatter\\OutputFormatterInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterInterface.php', - 'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyle' => $vendorDir . '/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyle.php', - 'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php', - 'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleStack' => $vendorDir . '/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php', - 'Symfony\\Component\\Console\\Helper\\DebugFormatterHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/DebugFormatterHelper.php', - 'Symfony\\Component\\Console\\Helper\\DescriptorHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/DescriptorHelper.php', - 'Symfony\\Component\\Console\\Helper\\DialogHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/DialogHelper.php', - 'Symfony\\Component\\Console\\Helper\\FormatterHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/FormatterHelper.php', - 'Symfony\\Component\\Console\\Helper\\Helper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/Helper.php', - 'Symfony\\Component\\Console\\Helper\\HelperInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/HelperInterface.php', - 'Symfony\\Component\\Console\\Helper\\HelperSet' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/HelperSet.php', - 'Symfony\\Component\\Console\\Helper\\InputAwareHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/InputAwareHelper.php', - 'Symfony\\Component\\Console\\Helper\\ProcessHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/ProcessHelper.php', - 'Symfony\\Component\\Console\\Helper\\ProgressBar' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/ProgressBar.php', - 'Symfony\\Component\\Console\\Helper\\ProgressHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/ProgressHelper.php', - 'Symfony\\Component\\Console\\Helper\\QuestionHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/QuestionHelper.php', - 'Symfony\\Component\\Console\\Helper\\Table' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/Table.php', - 'Symfony\\Component\\Console\\Helper\\TableHelper' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/TableHelper.php', - 'Symfony\\Component\\Console\\Helper\\TableSeparator' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/TableSeparator.php', - 'Symfony\\Component\\Console\\Helper\\TableStyle' => $vendorDir . '/symfony/console/Symfony/Component/Console/Helper/TableStyle.php', - 'Symfony\\Component\\Console\\Input\\ArgvInput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/ArgvInput.php', - 'Symfony\\Component\\Console\\Input\\ArrayInput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/ArrayInput.php', - 'Symfony\\Component\\Console\\Input\\Input' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/Input.php', - 'Symfony\\Component\\Console\\Input\\InputArgument' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/InputArgument.php', - 'Symfony\\Component\\Console\\Input\\InputAwareInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/InputAwareInterface.php', - 'Symfony\\Component\\Console\\Input\\InputDefinition' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/InputDefinition.php', - 'Symfony\\Component\\Console\\Input\\InputInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/InputInterface.php', - 'Symfony\\Component\\Console\\Input\\InputOption' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/InputOption.php', - 'Symfony\\Component\\Console\\Input\\StringInput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Input/StringInput.php', - 'Symfony\\Component\\Console\\Logger\\ConsoleLogger' => $vendorDir . '/symfony/console/Symfony/Component/Console/Logger/ConsoleLogger.php', - 'Symfony\\Component\\Console\\Output\\BufferedOutput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Output/BufferedOutput.php', - 'Symfony\\Component\\Console\\Output\\ConsoleOutput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Output/ConsoleOutput.php', - 'Symfony\\Component\\Console\\Output\\ConsoleOutputInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Output/ConsoleOutputInterface.php', - 'Symfony\\Component\\Console\\Output\\NullOutput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Output/NullOutput.php', - 'Symfony\\Component\\Console\\Output\\Output' => $vendorDir . '/symfony/console/Symfony/Component/Console/Output/Output.php', - 'Symfony\\Component\\Console\\Output\\OutputInterface' => $vendorDir . '/symfony/console/Symfony/Component/Console/Output/OutputInterface.php', - 'Symfony\\Component\\Console\\Output\\StreamOutput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Output/StreamOutput.php', - 'Symfony\\Component\\Console\\Question\\ChoiceQuestion' => $vendorDir . '/symfony/console/Symfony/Component/Console/Question/ChoiceQuestion.php', - 'Symfony\\Component\\Console\\Question\\ConfirmationQuestion' => $vendorDir . '/symfony/console/Symfony/Component/Console/Question/ConfirmationQuestion.php', - 'Symfony\\Component\\Console\\Question\\Question' => $vendorDir . '/symfony/console/Symfony/Component/Console/Question/Question.php', - 'Symfony\\Component\\Console\\Shell' => $vendorDir . '/symfony/console/Symfony/Component/Console/Shell.php', - 'Symfony\\Component\\Console\\Tester\\ApplicationTester' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tester/ApplicationTester.php', - 'Symfony\\Component\\Console\\Tester\\CommandTester' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tester/CommandTester.php', - 'Symfony\\Component\\Console\\Tests\\ApplicationTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/ApplicationTest.php', - 'Symfony\\Component\\Console\\Tests\\Command\\CommandTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Command/CommandTest.php', - 'Symfony\\Component\\Console\\Tests\\Command\\HelpCommandTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Command/HelpCommandTest.php', - 'Symfony\\Component\\Console\\Tests\\Command\\ListCommandTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Command/ListCommandTest.php', - 'Symfony\\Component\\Console\\Tests\\CustomApplication' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/ApplicationTest.php', - 'Symfony\\Component\\Console\\Tests\\CustomDefaultCommandApplication' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/ApplicationTest.php', - 'Symfony\\Component\\Console\\Tests\\Descriptor\\AbstractDescriptorTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Descriptor/AbstractDescriptorTest.php', - 'Symfony\\Component\\Console\\Tests\\Descriptor\\JsonDescriptorTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php', - 'Symfony\\Component\\Console\\Tests\\Descriptor\\MarkdownDescriptorTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Descriptor/MarkdownDescriptorTest.php', - 'Symfony\\Component\\Console\\Tests\\Descriptor\\ObjectsProvider' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.php', - 'Symfony\\Component\\Console\\Tests\\Descriptor\\TextDescriptorTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Descriptor/TextDescriptorTest.php', - 'Symfony\\Component\\Console\\Tests\\Descriptor\\XmlDescriptorTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Descriptor/XmlDescriptorTest.php', - 'Symfony\\Component\\Console\\Tests\\Fixtures\\DescriptorApplication1' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorApplication1.php', - 'Symfony\\Component\\Console\\Tests\\Fixtures\\DescriptorApplication2' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorApplication2.php', - 'Symfony\\Component\\Console\\Tests\\Fixtures\\DescriptorCommand1' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorCommand1.php', - 'Symfony\\Component\\Console\\Tests\\Fixtures\\DescriptorCommand2' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorCommand2.php', - 'Symfony\\Component\\Console\\Tests\\Fixtures\\DummyOutput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Fixtures/DummyOutput.php', - 'Symfony\\Component\\Console\\Tests\\Formatter\\OutputFormatterStyleStackTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.php', - 'Symfony\\Component\\Console\\Tests\\Formatter\\OutputFormatterStyleTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php', - 'Symfony\\Component\\Console\\Tests\\Formatter\\OutputFormatterTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php', - 'Symfony\\Component\\Console\\Tests\\Formatter\\TableCell' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php', - 'Symfony\\Component\\Console\\Tests\\Helper\\FormatterHelperTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Helper/FormatterHelperTest.php', - 'Symfony\\Component\\Console\\Tests\\Helper\\HelperSetTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Helper/HelperSetTest.php', - 'Symfony\\Component\\Console\\Tests\\Helper\\LegacyDialogHelperTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Helper/LegacyDialogHelperTest.php', - 'Symfony\\Component\\Console\\Tests\\Helper\\LegacyProgressHelperTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Helper/LegacyProgressHelperTest.php', - 'Symfony\\Component\\Console\\Tests\\Helper\\LegacyTableHelperTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Helper/LegacyTableHelperTest.php', - 'Symfony\\Component\\Console\\Tests\\Helper\\ProcessHelperTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php', - 'Symfony\\Component\\Console\\Tests\\Helper\\ProgressBarTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php', - 'Symfony\\Component\\Console\\Tests\\Helper\\QuestionHelperTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php', - 'Symfony\\Component\\Console\\Tests\\Helper\\TableTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Helper/TableTest.php', - 'Symfony\\Component\\Console\\Tests\\Input\\ArgvInputTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Input/ArgvInputTest.php', - 'Symfony\\Component\\Console\\Tests\\Input\\ArrayInputTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Input/ArrayInputTest.php', - 'Symfony\\Component\\Console\\Tests\\Input\\InputArgumentTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Input/InputArgumentTest.php', - 'Symfony\\Component\\Console\\Tests\\Input\\InputDefinitionTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php', - 'Symfony\\Component\\Console\\Tests\\Input\\InputOptionTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Input/InputOptionTest.php', - 'Symfony\\Component\\Console\\Tests\\Input\\InputTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Input/InputTest.php', - 'Symfony\\Component\\Console\\Tests\\Input\\StringInputTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Input/StringInputTest.php', - 'Symfony\\Component\\Console\\Tests\\Logger\\ConsoleLoggerTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php', - 'Symfony\\Component\\Console\\Tests\\Output\\ConsoleOutputTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Output/ConsoleOutputTest.php', - 'Symfony\\Component\\Console\\Tests\\Output\\NullOutputTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Output/NullOutputTest.php', - 'Symfony\\Component\\Console\\Tests\\Output\\OutputTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Output/OutputTest.php', - 'Symfony\\Component\\Console\\Tests\\Output\\StreamOutputTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Output/StreamOutputTest.php', - 'Symfony\\Component\\Console\\Tests\\Output\\TestOutput' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Output/OutputTest.php', - 'Symfony\\Component\\Console\\Tests\\Tester\\ApplicationTesterTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php', - 'Symfony\\Component\\Console\\Tests\\Tester\\CommandTesterTest' => $vendorDir . '/symfony/console/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php', - 'Symfony\\Component\\Debug\\Debug' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Debug.php', - 'Symfony\\Component\\Debug\\DebugClassLoader' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/DebugClassLoader.php', - 'Symfony\\Component\\Debug\\ErrorHandler' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/ErrorHandler.php', - 'Symfony\\Component\\Debug\\ErrorHandlerCanary' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/ErrorHandler.php', - 'Symfony\\Component\\Debug\\ExceptionHandler' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/ExceptionHandler.php', - 'Symfony\\Component\\Debug\\Exception\\ClassNotFoundException' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Exception/ClassNotFoundException.php', - 'Symfony\\Component\\Debug\\Exception\\ContextErrorException' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Exception/ContextErrorException.php', - 'Symfony\\Component\\Debug\\Exception\\DummyException' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Exception/DummyException.php', - 'Symfony\\Component\\Debug\\Exception\\FatalErrorException' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Exception/FatalErrorException.php', - 'Symfony\\Component\\Debug\\Exception\\FatalThrowableError' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Exception/FatalThrowableError.php', - 'Symfony\\Component\\Debug\\Exception\\FlattenException' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Exception/FlattenException.php', - 'Symfony\\Component\\Debug\\Exception\\OutOfMemoryException' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Exception/OutOfMemoryException.php', - 'Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Exception/UndefinedFunctionException.php', - 'Symfony\\Component\\Debug\\Exception\\UndefinedMethodException' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Exception/UndefinedMethodException.php', - 'Symfony\\Component\\Debug\\FatalErrorHandler\\ClassNotFoundFatalErrorHandler' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php', - 'Symfony\\Component\\Debug\\FatalErrorHandler\\FatalErrorHandlerInterface' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/FatalErrorHandler/FatalErrorHandlerInterface.php', - 'Symfony\\Component\\Debug\\FatalErrorHandler\\UndefinedFunctionFatalErrorHandler' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php', - 'Symfony\\Component\\Debug\\FatalErrorHandler\\UndefinedMethodFatalErrorHandler' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php', - 'Symfony\\Component\\Debug\\Tests\\ClassLoader' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php', - 'Symfony\\Component\\Debug\\Tests\\DebugClassLoaderTest' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php', - 'Symfony\\Component\\Debug\\Tests\\ErrorHandlerTest' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Tests/ErrorHandlerTest.php', - 'Symfony\\Component\\Debug\\Tests\\ExceptionHandlerTest' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php', - 'Symfony\\Component\\Debug\\Tests\\Exception\\FlattenExceptionTest' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php', - 'Symfony\\Component\\Debug\\Tests\\FatalErrorHandler\\ClassNotFoundFatalErrorHandlerTest' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php', - 'Symfony\\Component\\Debug\\Tests\\FatalErrorHandler\\UndefinedFunctionFatalErrorHandlerTest' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php', - 'Symfony\\Component\\Debug\\Tests\\FatalErrorHandler\\UndefinedMethodFatalErrorHandlerTest' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php', - 'Symfony\\Component\\Debug\\Tests\\Fixtures2\\RequiredTwice' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Tests/Fixtures2/RequiredTwice.php', - 'Symfony\\Component\\Debug\\Tests\\Fixtures\\CaseMismatch' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Tests/Fixtures/casemismatch.php', - 'Symfony\\Component\\Debug\\Tests\\Fixtures\\NotPSR0' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Tests/Fixtures/reallyNotPsr0.php', - 'Symfony\\Component\\Debug\\Tests\\Fixtures\\NotPSR0bis' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Tests/Fixtures/notPsr0Bis.php', - 'Symfony\\Component\\Debug\\Tests\\Fixtures\\PSR4CaseMismatch' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Tests/Fixtures/psr4/Psr4CaseMismatch.php', - 'Symfony\\Component\\Debug\\Tests\\MockExceptionHandler' => $vendorDir . '/symfony/debug/Symfony/Component/Debug/Tests/MockExceptionHandler.php', + 'SuperClosure\\Analyzer\\AstAnalyzer' => $vendorDir . '/jeremeamia/superclosure/src/Analyzer/AstAnalyzer.php', + 'SuperClosure\\Analyzer\\ClosureAnalyzer' => $vendorDir . '/jeremeamia/superclosure/src/Analyzer/ClosureAnalyzer.php', + 'SuperClosure\\Analyzer\\Token' => $vendorDir . '/jeremeamia/superclosure/src/Analyzer/Token.php', + 'SuperClosure\\Analyzer\\TokenAnalyzer' => $vendorDir . '/jeremeamia/superclosure/src/Analyzer/TokenAnalyzer.php', + 'SuperClosure\\Analyzer\\Visitor\\ClosureLocatorVisitor' => $vendorDir . '/jeremeamia/superclosure/src/Analyzer/Visitor/ClosureLocatorVisitor.php', + 'SuperClosure\\Analyzer\\Visitor\\MagicConstantVisitor' => $vendorDir . '/jeremeamia/superclosure/src/Analyzer/Visitor/MagicConstantVisitor.php', + 'SuperClosure\\Analyzer\\Visitor\\ThisDetectorVisitor' => $vendorDir . '/jeremeamia/superclosure/src/Analyzer/Visitor/ThisDetectorVisitor.php', + 'SuperClosure\\Exception\\ClosureAnalysisException' => $vendorDir . '/jeremeamia/superclosure/src/Exception/ClosureAnalysisException.php', + 'SuperClosure\\Exception\\ClosureSerializationException' => $vendorDir . '/jeremeamia/superclosure/src/Exception/ClosureSerializationException.php', + 'SuperClosure\\Exception\\ClosureUnserializationException' => $vendorDir . '/jeremeamia/superclosure/src/Exception/ClosureUnserializationException.php', + 'SuperClosure\\Exception\\SuperClosureException' => $vendorDir . '/jeremeamia/superclosure/src/Exception/SuperClosureException.php', + 'SuperClosure\\SerializableClosure' => $vendorDir . '/jeremeamia/superclosure/src/SerializableClosure.php', + 'SuperClosure\\Serializer' => $vendorDir . '/jeremeamia/superclosure/src/Serializer.php', + 'SuperClosure\\SerializerInterface' => $vendorDir . '/jeremeamia/superclosure/src/SerializerInterface.php', + 'Symfony\\Component\\Console\\Application' => $vendorDir . '/symfony/console/Application.php', + 'Symfony\\Component\\Console\\Command\\Command' => $vendorDir . '/symfony/console/Command/Command.php', + 'Symfony\\Component\\Console\\Command\\HelpCommand' => $vendorDir . '/symfony/console/Command/HelpCommand.php', + 'Symfony\\Component\\Console\\Command\\ListCommand' => $vendorDir . '/symfony/console/Command/ListCommand.php', + 'Symfony\\Component\\Console\\ConsoleEvents' => $vendorDir . '/symfony/console/ConsoleEvents.php', + 'Symfony\\Component\\Console\\Descriptor\\ApplicationDescription' => $vendorDir . '/symfony/console/Descriptor/ApplicationDescription.php', + 'Symfony\\Component\\Console\\Descriptor\\Descriptor' => $vendorDir . '/symfony/console/Descriptor/Descriptor.php', + 'Symfony\\Component\\Console\\Descriptor\\DescriptorInterface' => $vendorDir . '/symfony/console/Descriptor/DescriptorInterface.php', + 'Symfony\\Component\\Console\\Descriptor\\JsonDescriptor' => $vendorDir . '/symfony/console/Descriptor/JsonDescriptor.php', + 'Symfony\\Component\\Console\\Descriptor\\MarkdownDescriptor' => $vendorDir . '/symfony/console/Descriptor/MarkdownDescriptor.php', + 'Symfony\\Component\\Console\\Descriptor\\TextDescriptor' => $vendorDir . '/symfony/console/Descriptor/TextDescriptor.php', + 'Symfony\\Component\\Console\\Descriptor\\XmlDescriptor' => $vendorDir . '/symfony/console/Descriptor/XmlDescriptor.php', + 'Symfony\\Component\\Console\\Event\\ConsoleCommandEvent' => $vendorDir . '/symfony/console/Event/ConsoleCommandEvent.php', + 'Symfony\\Component\\Console\\Event\\ConsoleEvent' => $vendorDir . '/symfony/console/Event/ConsoleEvent.php', + 'Symfony\\Component\\Console\\Event\\ConsoleExceptionEvent' => $vendorDir . '/symfony/console/Event/ConsoleExceptionEvent.php', + 'Symfony\\Component\\Console\\Event\\ConsoleTerminateEvent' => $vendorDir . '/symfony/console/Event/ConsoleTerminateEvent.php', + 'Symfony\\Component\\Console\\Exception\\RuntimeException' => $vendorDir . '/symfony/console/Exception/RuntimeException.php', + 'Symfony\\Component\\Console\\Formatter\\OutputFormatter' => $vendorDir . '/symfony/console/Formatter/OutputFormatter.php', + 'Symfony\\Component\\Console\\Formatter\\OutputFormatterInterface' => $vendorDir . '/symfony/console/Formatter/OutputFormatterInterface.php', + 'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyle' => $vendorDir . '/symfony/console/Formatter/OutputFormatterStyle.php', + 'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleInterface' => $vendorDir . '/symfony/console/Formatter/OutputFormatterStyleInterface.php', + 'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleStack' => $vendorDir . '/symfony/console/Formatter/OutputFormatterStyleStack.php', + 'Symfony\\Component\\Console\\Helper\\DebugFormatterHelper' => $vendorDir . '/symfony/console/Helper/DebugFormatterHelper.php', + 'Symfony\\Component\\Console\\Helper\\DescriptorHelper' => $vendorDir . '/symfony/console/Helper/DescriptorHelper.php', + 'Symfony\\Component\\Console\\Helper\\DialogHelper' => $vendorDir . '/symfony/console/Helper/DialogHelper.php', + 'Symfony\\Component\\Console\\Helper\\FormatterHelper' => $vendorDir . '/symfony/console/Helper/FormatterHelper.php', + 'Symfony\\Component\\Console\\Helper\\Helper' => $vendorDir . '/symfony/console/Helper/Helper.php', + 'Symfony\\Component\\Console\\Helper\\HelperInterface' => $vendorDir . '/symfony/console/Helper/HelperInterface.php', + 'Symfony\\Component\\Console\\Helper\\HelperSet' => $vendorDir . '/symfony/console/Helper/HelperSet.php', + 'Symfony\\Component\\Console\\Helper\\InputAwareHelper' => $vendorDir . '/symfony/console/Helper/InputAwareHelper.php', + 'Symfony\\Component\\Console\\Helper\\ProcessHelper' => $vendorDir . '/symfony/console/Helper/ProcessHelper.php', + 'Symfony\\Component\\Console\\Helper\\ProgressBar' => $vendorDir . '/symfony/console/Helper/ProgressBar.php', + 'Symfony\\Component\\Console\\Helper\\ProgressHelper' => $vendorDir . '/symfony/console/Helper/ProgressHelper.php', + 'Symfony\\Component\\Console\\Helper\\QuestionHelper' => $vendorDir . '/symfony/console/Helper/QuestionHelper.php', + 'Symfony\\Component\\Console\\Helper\\SymfonyQuestionHelper' => $vendorDir . '/symfony/console/Helper/SymfonyQuestionHelper.php', + 'Symfony\\Component\\Console\\Helper\\Table' => $vendorDir . '/symfony/console/Helper/Table.php', + 'Symfony\\Component\\Console\\Helper\\TableCell' => $vendorDir . '/symfony/console/Helper/TableCell.php', + 'Symfony\\Component\\Console\\Helper\\TableHelper' => $vendorDir . '/symfony/console/Helper/TableHelper.php', + 'Symfony\\Component\\Console\\Helper\\TableSeparator' => $vendorDir . '/symfony/console/Helper/TableSeparator.php', + 'Symfony\\Component\\Console\\Helper\\TableStyle' => $vendorDir . '/symfony/console/Helper/TableStyle.php', + 'Symfony\\Component\\Console\\Input\\ArgvInput' => $vendorDir . '/symfony/console/Input/ArgvInput.php', + 'Symfony\\Component\\Console\\Input\\ArrayInput' => $vendorDir . '/symfony/console/Input/ArrayInput.php', + 'Symfony\\Component\\Console\\Input\\Input' => $vendorDir . '/symfony/console/Input/Input.php', + 'Symfony\\Component\\Console\\Input\\InputArgument' => $vendorDir . '/symfony/console/Input/InputArgument.php', + 'Symfony\\Component\\Console\\Input\\InputAwareInterface' => $vendorDir . '/symfony/console/Input/InputAwareInterface.php', + 'Symfony\\Component\\Console\\Input\\InputDefinition' => $vendorDir . '/symfony/console/Input/InputDefinition.php', + 'Symfony\\Component\\Console\\Input\\InputInterface' => $vendorDir . '/symfony/console/Input/InputInterface.php', + 'Symfony\\Component\\Console\\Input\\InputOption' => $vendorDir . '/symfony/console/Input/InputOption.php', + 'Symfony\\Component\\Console\\Input\\StringInput' => $vendorDir . '/symfony/console/Input/StringInput.php', + 'Symfony\\Component\\Console\\Logger\\ConsoleLogger' => $vendorDir . '/symfony/console/Logger/ConsoleLogger.php', + 'Symfony\\Component\\Console\\Output\\BufferedOutput' => $vendorDir . '/symfony/console/Output/BufferedOutput.php', + 'Symfony\\Component\\Console\\Output\\ConsoleOutput' => $vendorDir . '/symfony/console/Output/ConsoleOutput.php', + 'Symfony\\Component\\Console\\Output\\ConsoleOutputInterface' => $vendorDir . '/symfony/console/Output/ConsoleOutputInterface.php', + 'Symfony\\Component\\Console\\Output\\NullOutput' => $vendorDir . '/symfony/console/Output/NullOutput.php', + 'Symfony\\Component\\Console\\Output\\Output' => $vendorDir . '/symfony/console/Output/Output.php', + 'Symfony\\Component\\Console\\Output\\OutputInterface' => $vendorDir . '/symfony/console/Output/OutputInterface.php', + 'Symfony\\Component\\Console\\Output\\StreamOutput' => $vendorDir . '/symfony/console/Output/StreamOutput.php', + 'Symfony\\Component\\Console\\Question\\ChoiceQuestion' => $vendorDir . '/symfony/console/Question/ChoiceQuestion.php', + 'Symfony\\Component\\Console\\Question\\ConfirmationQuestion' => $vendorDir . '/symfony/console/Question/ConfirmationQuestion.php', + 'Symfony\\Component\\Console\\Question\\Question' => $vendorDir . '/symfony/console/Question/Question.php', + 'Symfony\\Component\\Console\\Shell' => $vendorDir . '/symfony/console/Shell.php', + 'Symfony\\Component\\Console\\Style\\OutputStyle' => $vendorDir . '/symfony/console/Style/OutputStyle.php', + 'Symfony\\Component\\Console\\Style\\StyleInterface' => $vendorDir . '/symfony/console/Style/StyleInterface.php', + 'Symfony\\Component\\Console\\Style\\SymfonyStyle' => $vendorDir . '/symfony/console/Style/SymfonyStyle.php', + 'Symfony\\Component\\Console\\Tester\\ApplicationTester' => $vendorDir . '/symfony/console/Tester/ApplicationTester.php', + 'Symfony\\Component\\Console\\Tester\\CommandTester' => $vendorDir . '/symfony/console/Tester/CommandTester.php', + 'Symfony\\Component\\CssSelector\\CssSelector' => $vendorDir . '/symfony/css-selector/CssSelector.php', + 'Symfony\\Component\\CssSelector\\CssSelectorConverter' => $vendorDir . '/symfony/css-selector/CssSelectorConverter.php', + 'Symfony\\Component\\CssSelector\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/css-selector/Exception/ExceptionInterface.php', + 'Symfony\\Component\\CssSelector\\Exception\\ExpressionErrorException' => $vendorDir . '/symfony/css-selector/Exception/ExpressionErrorException.php', + 'Symfony\\Component\\CssSelector\\Exception\\InternalErrorException' => $vendorDir . '/symfony/css-selector/Exception/InternalErrorException.php', + 'Symfony\\Component\\CssSelector\\Exception\\ParseException' => $vendorDir . '/symfony/css-selector/Exception/ParseException.php', + 'Symfony\\Component\\CssSelector\\Exception\\SyntaxErrorException' => $vendorDir . '/symfony/css-selector/Exception/SyntaxErrorException.php', + 'Symfony\\Component\\CssSelector\\Node\\AbstractNode' => $vendorDir . '/symfony/css-selector/Node/AbstractNode.php', + 'Symfony\\Component\\CssSelector\\Node\\AttributeNode' => $vendorDir . '/symfony/css-selector/Node/AttributeNode.php', + 'Symfony\\Component\\CssSelector\\Node\\ClassNode' => $vendorDir . '/symfony/css-selector/Node/ClassNode.php', + 'Symfony\\Component\\CssSelector\\Node\\CombinedSelectorNode' => $vendorDir . '/symfony/css-selector/Node/CombinedSelectorNode.php', + 'Symfony\\Component\\CssSelector\\Node\\ElementNode' => $vendorDir . '/symfony/css-selector/Node/ElementNode.php', + 'Symfony\\Component\\CssSelector\\Node\\FunctionNode' => $vendorDir . '/symfony/css-selector/Node/FunctionNode.php', + 'Symfony\\Component\\CssSelector\\Node\\HashNode' => $vendorDir . '/symfony/css-selector/Node/HashNode.php', + 'Symfony\\Component\\CssSelector\\Node\\NegationNode' => $vendorDir . '/symfony/css-selector/Node/NegationNode.php', + 'Symfony\\Component\\CssSelector\\Node\\NodeInterface' => $vendorDir . '/symfony/css-selector/Node/NodeInterface.php', + 'Symfony\\Component\\CssSelector\\Node\\PseudoNode' => $vendorDir . '/symfony/css-selector/Node/PseudoNode.php', + 'Symfony\\Component\\CssSelector\\Node\\SelectorNode' => $vendorDir . '/symfony/css-selector/Node/SelectorNode.php', + 'Symfony\\Component\\CssSelector\\Node\\Specificity' => $vendorDir . '/symfony/css-selector/Node/Specificity.php', + 'Symfony\\Component\\CssSelector\\Parser\\Handler\\CommentHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/CommentHandler.php', + 'Symfony\\Component\\CssSelector\\Parser\\Handler\\HandlerInterface' => $vendorDir . '/symfony/css-selector/Parser/Handler/HandlerInterface.php', + 'Symfony\\Component\\CssSelector\\Parser\\Handler\\HashHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/HashHandler.php', + 'Symfony\\Component\\CssSelector\\Parser\\Handler\\IdentifierHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/IdentifierHandler.php', + 'Symfony\\Component\\CssSelector\\Parser\\Handler\\NumberHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/NumberHandler.php', + 'Symfony\\Component\\CssSelector\\Parser\\Handler\\StringHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/StringHandler.php', + 'Symfony\\Component\\CssSelector\\Parser\\Handler\\WhitespaceHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/WhitespaceHandler.php', + 'Symfony\\Component\\CssSelector\\Parser\\Parser' => $vendorDir . '/symfony/css-selector/Parser/Parser.php', + 'Symfony\\Component\\CssSelector\\Parser\\ParserInterface' => $vendorDir . '/symfony/css-selector/Parser/ParserInterface.php', + 'Symfony\\Component\\CssSelector\\Parser\\Reader' => $vendorDir . '/symfony/css-selector/Parser/Reader.php', + 'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\ClassParser' => $vendorDir . '/symfony/css-selector/Parser/Shortcut/ClassParser.php', + 'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\ElementParser' => $vendorDir . '/symfony/css-selector/Parser/Shortcut/ElementParser.php', + 'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\EmptyStringParser' => $vendorDir . '/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php', + 'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\HashParser' => $vendorDir . '/symfony/css-selector/Parser/Shortcut/HashParser.php', + 'Symfony\\Component\\CssSelector\\Parser\\Token' => $vendorDir . '/symfony/css-selector/Parser/Token.php', + 'Symfony\\Component\\CssSelector\\Parser\\TokenStream' => $vendorDir . '/symfony/css-selector/Parser/TokenStream.php', + 'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\Tokenizer' => $vendorDir . '/symfony/css-selector/Parser/Tokenizer/Tokenizer.php', + 'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\TokenizerEscaping' => $vendorDir . '/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php', + 'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\TokenizerPatterns' => $vendorDir . '/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\AbstractExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/AbstractExtension.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\AttributeMatchingExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\CombinationExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/CombinationExtension.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\ExtensionInterface' => $vendorDir . '/symfony/css-selector/XPath/Extension/ExtensionInterface.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\FunctionExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/FunctionExtension.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\HtmlExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/HtmlExtension.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\NodeExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/NodeExtension.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\PseudoClassExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/PseudoClassExtension.php', + 'Symfony\\Component\\CssSelector\\XPath\\Translator' => $vendorDir . '/symfony/css-selector/XPath/Translator.php', + 'Symfony\\Component\\CssSelector\\XPath\\TranslatorInterface' => $vendorDir . '/symfony/css-selector/XPath/TranslatorInterface.php', + 'Symfony\\Component\\CssSelector\\XPath\\XPathExpr' => $vendorDir . '/symfony/css-selector/XPath/XPathExpr.php', + 'Symfony\\Component\\Debug\\Debug' => $vendorDir . '/symfony/debug/Debug.php', + 'Symfony\\Component\\Debug\\DebugClassLoader' => $vendorDir . '/symfony/debug/DebugClassLoader.php', + 'Symfony\\Component\\Debug\\ErrorHandler' => $vendorDir . '/symfony/debug/ErrorHandler.php', + 'Symfony\\Component\\Debug\\ErrorHandlerCanary' => $vendorDir . '/symfony/debug/ErrorHandler.php', + 'Symfony\\Component\\Debug\\ExceptionHandler' => $vendorDir . '/symfony/debug/ExceptionHandler.php', + 'Symfony\\Component\\Debug\\Exception\\ClassNotFoundException' => $vendorDir . '/symfony/debug/Exception/ClassNotFoundException.php', + 'Symfony\\Component\\Debug\\Exception\\ContextErrorException' => $vendorDir . '/symfony/debug/Exception/ContextErrorException.php', + 'Symfony\\Component\\Debug\\Exception\\DummyException' => $vendorDir . '/symfony/debug/Exception/DummyException.php', + 'Symfony\\Component\\Debug\\Exception\\FatalErrorException' => $vendorDir . '/symfony/debug/Exception/FatalErrorException.php', + 'Symfony\\Component\\Debug\\Exception\\FatalThrowableError' => $vendorDir . '/symfony/debug/Exception/FatalThrowableError.php', + 'Symfony\\Component\\Debug\\Exception\\FlattenException' => $vendorDir . '/symfony/debug/Exception/FlattenException.php', + 'Symfony\\Component\\Debug\\Exception\\OutOfMemoryException' => $vendorDir . '/symfony/debug/Exception/OutOfMemoryException.php', + 'Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException' => $vendorDir . '/symfony/debug/Exception/UndefinedFunctionException.php', + 'Symfony\\Component\\Debug\\Exception\\UndefinedMethodException' => $vendorDir . '/symfony/debug/Exception/UndefinedMethodException.php', + 'Symfony\\Component\\Debug\\FatalErrorHandler\\ClassNotFoundFatalErrorHandler' => $vendorDir . '/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php', + 'Symfony\\Component\\Debug\\FatalErrorHandler\\FatalErrorHandlerInterface' => $vendorDir . '/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php', + 'Symfony\\Component\\Debug\\FatalErrorHandler\\UndefinedFunctionFatalErrorHandler' => $vendorDir . '/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php', + 'Symfony\\Component\\Debug\\FatalErrorHandler\\UndefinedMethodFatalErrorHandler' => $vendorDir . '/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php', + 'Symfony\\Component\\DomCrawler\\Crawler' => $vendorDir . '/symfony/dom-crawler/Crawler.php', + 'Symfony\\Component\\DomCrawler\\Field\\ChoiceFormField' => $vendorDir . '/symfony/dom-crawler/Field/ChoiceFormField.php', + 'Symfony\\Component\\DomCrawler\\Field\\FileFormField' => $vendorDir . '/symfony/dom-crawler/Field/FileFormField.php', + 'Symfony\\Component\\DomCrawler\\Field\\FormField' => $vendorDir . '/symfony/dom-crawler/Field/FormField.php', + 'Symfony\\Component\\DomCrawler\\Field\\InputFormField' => $vendorDir . '/symfony/dom-crawler/Field/InputFormField.php', + 'Symfony\\Component\\DomCrawler\\Field\\TextareaFormField' => $vendorDir . '/symfony/dom-crawler/Field/TextareaFormField.php', + 'Symfony\\Component\\DomCrawler\\Form' => $vendorDir . '/symfony/dom-crawler/Form.php', + 'Symfony\\Component\\DomCrawler\\FormFieldRegistry' => $vendorDir . '/symfony/dom-crawler/FormFieldRegistry.php', + 'Symfony\\Component\\DomCrawler\\Link' => $vendorDir . '/symfony/dom-crawler/Link.php', 'Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/ContainerAwareEventDispatcher.php', 'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php', 'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcherInterface' => $vendorDir . '/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php', @@ -963,768 +1253,380 @@ 'Symfony\\Component\\EventDispatcher\\EventSubscriberInterface' => $vendorDir . '/symfony/event-dispatcher/EventSubscriberInterface.php', 'Symfony\\Component\\EventDispatcher\\GenericEvent' => $vendorDir . '/symfony/event-dispatcher/GenericEvent.php', 'Symfony\\Component\\EventDispatcher\\ImmutableEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/ImmutableEventDispatcher.php', - 'Symfony\\Component\\Filesystem\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/filesystem/Exception/ExceptionInterface.php', - 'Symfony\\Component\\Filesystem\\Exception\\FileNotFoundException' => $vendorDir . '/symfony/filesystem/Exception/FileNotFoundException.php', - 'Symfony\\Component\\Filesystem\\Exception\\IOException' => $vendorDir . '/symfony/filesystem/Exception/IOException.php', - 'Symfony\\Component\\Filesystem\\Exception\\IOExceptionInterface' => $vendorDir . '/symfony/filesystem/Exception/IOExceptionInterface.php', - 'Symfony\\Component\\Filesystem\\Filesystem' => $vendorDir . '/symfony/filesystem/Filesystem.php', - 'Symfony\\Component\\Filesystem\\LockHandler' => $vendorDir . '/symfony/filesystem/LockHandler.php', - 'Symfony\\Component\\Finder\\Adapter\\AbstractAdapter' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Adapter/AbstractAdapter.php', - 'Symfony\\Component\\Finder\\Adapter\\AbstractFindAdapter' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php', - 'Symfony\\Component\\Finder\\Adapter\\AdapterInterface' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Adapter/AdapterInterface.php', - 'Symfony\\Component\\Finder\\Adapter\\BsdFindAdapter' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Adapter/BsdFindAdapter.php', - 'Symfony\\Component\\Finder\\Adapter\\GnuFindAdapter' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Adapter/GnuFindAdapter.php', - 'Symfony\\Component\\Finder\\Adapter\\PhpAdapter' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Adapter/PhpAdapter.php', - 'Symfony\\Component\\Finder\\Comparator\\Comparator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Comparator/Comparator.php', - 'Symfony\\Component\\Finder\\Comparator\\DateComparator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Comparator/DateComparator.php', - 'Symfony\\Component\\Finder\\Comparator\\NumberComparator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Comparator/NumberComparator.php', - 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Exception/AccessDeniedException.php', - 'Symfony\\Component\\Finder\\Exception\\AdapterFailureException' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Exception/AdapterFailureException.php', - 'Symfony\\Component\\Finder\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Exception/ExceptionInterface.php', - 'Symfony\\Component\\Finder\\Exception\\OperationNotPermitedException' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Exception/OperationNotPermitedException.php', - 'Symfony\\Component\\Finder\\Exception\\ShellCommandFailureException' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Exception/ShellCommandFailureException.php', - 'Symfony\\Component\\Finder\\Expression\\Expression' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Expression/Expression.php', - 'Symfony\\Component\\Finder\\Expression\\Glob' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Expression/Glob.php', - 'Symfony\\Component\\Finder\\Expression\\Regex' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Expression/Regex.php', - 'Symfony\\Component\\Finder\\Expression\\ValueInterface' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Expression/ValueInterface.php', - 'Symfony\\Component\\Finder\\Finder' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Finder.php', - 'Symfony\\Component\\Finder\\Glob' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Glob.php', - 'Symfony\\Component\\Finder\\Iterator\\CustomFilterIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Iterator/CustomFilterIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\DateRangeFilterIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\DepthRangeFilterIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\ExcludeDirectoryFilterIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\FilePathsIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Iterator/FilePathsIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\FileTypeFilterIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\FilecontentFilterIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Iterator/FilecontentFilterIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\FilenameFilterIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Iterator/FilenameFilterIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\FilterIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Iterator/FilterIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\MultiplePcreFilterIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\PathFilterIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Iterator/PathFilterIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\RecursiveDirectoryIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\SizeRangeFilterIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Iterator/SizeRangeFilterIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\SortableIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Iterator/SortableIterator.php', - 'Symfony\\Component\\Finder\\Shell\\Command' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Shell/Command.php', - 'Symfony\\Component\\Finder\\Shell\\Shell' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Shell/Shell.php', - 'Symfony\\Component\\Finder\\SplFileInfo' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/SplFileInfo.php', - 'Symfony\\Component\\Finder\\Tests\\Comparator\\ComparatorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Comparator/ComparatorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Comparator\\DateComparatorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Comparator/DateComparatorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Comparator\\NumberComparatorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Comparator/NumberComparatorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Expression\\ExpressionTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Expression/ExpressionTest.php', - 'Symfony\\Component\\Finder\\Tests\\Expression\\GlobTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Expression/GlobTest.php', - 'Symfony\\Component\\Finder\\Tests\\Expression\\RegexTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Expression/RegexTest.php', - 'Symfony\\Component\\Finder\\Tests\\FakeAdapter\\DummyAdapter' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/DummyAdapter.php', - 'Symfony\\Component\\Finder\\Tests\\FakeAdapter\\FailingAdapter' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/FailingAdapter.php', - 'Symfony\\Component\\Finder\\Tests\\FakeAdapter\\NamedAdapter' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/NamedAdapter.php', - 'Symfony\\Component\\Finder\\Tests\\FakeAdapter\\UnsupportedAdapter' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/UnsupportedAdapter.php', - 'Symfony\\Component\\Finder\\Tests\\FinderTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/FinderTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\CustomFilterIteratorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\DateRangeFilterIteratorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/DateRangeFilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\DepthRangeFilterIteratorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\ExcludeDirectoryFilterIteratorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\FilePathsIteratorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\FileTypeFilterIteratorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FileTypeFilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\FilecontentFilterIteratorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\FilenameFilterIteratorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilenameFilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\FilterIteratorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\InnerNameIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilenameFilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\InnerSizeIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SizeRangeFilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\InnerTypeIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FileTypeFilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\Iterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/Iterator.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\IteratorTestCase' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\MockFileListIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockFileListIterator.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\MockSplFileInfo' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\MultiplePcreFilterIteratorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\PathFilterIteratorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/PathFilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\RealIteratorTestCase' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\RecursiveDirectoryIteratorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\SizeRangeFilterIteratorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SizeRangeFilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\SortableIteratorTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Iterator\\TestMultiplePcreFilterIterator' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php', - 'Symfony\\Component\\Finder\\Tests\\Shell\\CommandTest' => $vendorDir . '/symfony/finder/Symfony/Component/Finder/Tests/Shell/CommandTest.php', - 'Symfony\\Component\\HttpFoundation\\AcceptHeader' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/AcceptHeader.php', - 'Symfony\\Component\\HttpFoundation\\AcceptHeaderItem' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/AcceptHeaderItem.php', - 'Symfony\\Component\\HttpFoundation\\ApacheRequest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/ApacheRequest.php', - 'Symfony\\Component\\HttpFoundation\\BinaryFileResponse' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/BinaryFileResponse.php', - 'Symfony\\Component\\HttpFoundation\\Cookie' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php', - 'Symfony\\Component\\HttpFoundation\\ExpressionRequestMatcher' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/ExpressionRequestMatcher.php', - 'Symfony\\Component\\HttpFoundation\\FileBag' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php', - 'Symfony\\Component\\HttpFoundation\\File\\Exception\\AccessDeniedException' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php', - 'Symfony\\Component\\HttpFoundation\\File\\Exception\\FileException' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/FileException.php', - 'Symfony\\Component\\HttpFoundation\\File\\Exception\\FileNotFoundException' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php', - 'Symfony\\Component\\HttpFoundation\\File\\Exception\\UnexpectedTypeException' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/UnexpectedTypeException.php', - 'Symfony\\Component\\HttpFoundation\\File\\Exception\\UploadException' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/UploadException.php', - 'Symfony\\Component\\HttpFoundation\\File\\File' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/File/File.php', - 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\ExtensionGuesser' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php', - 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\ExtensionGuesserInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php', - 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\FileBinaryMimeTypeGuesser' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php', - 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\FileinfoMimeTypeGuesser' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php', - 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeExtensionGuesser' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php', - 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesser' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php', - 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesserInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php', - 'Symfony\\Component\\HttpFoundation\\File\\UploadedFile' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php', - 'Symfony\\Component\\HttpFoundation\\HeaderBag' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php', - 'Symfony\\Component\\HttpFoundation\\IpUtils' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/IpUtils.php', - 'Symfony\\Component\\HttpFoundation\\JsonResponse' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php', - 'Symfony\\Component\\HttpFoundation\\ParameterBag' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php', - 'Symfony\\Component\\HttpFoundation\\RedirectResponse' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php', - 'Symfony\\Component\\HttpFoundation\\Request' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php', - 'Symfony\\Component\\HttpFoundation\\RequestMatcher' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php', - 'Symfony\\Component\\HttpFoundation\\RequestMatcherInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcherInterface.php', - 'Symfony\\Component\\HttpFoundation\\RequestStack' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestStack.php', - 'Symfony\\Component\\HttpFoundation\\Response' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php', - 'Symfony\\Component\\HttpFoundation\\ResponseHeaderBag' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php', - 'Symfony\\Component\\HttpFoundation\\ServerBag' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/ServerBag.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Attribute\\AttributeBag' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Attribute\\AttributeBagInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Attribute\\NamespacedAttributeBag' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Flash\\AutoExpireFlashBag' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBag' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Session' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Session.php', - 'Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php', - 'Symfony\\Component\\HttpFoundation\\Session\\SessionInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionInterface.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\LegacyPdoSessionHandler' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcacheSessionHandler' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcachedSessionHandler' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MongoDbSessionHandler' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeSessionHandler' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NullSessionHandler' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\PdoSessionHandler' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\WriteCheckSessionHandler' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/WriteCheckSessionHandler.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\MetadataBag' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockArraySessionStorage' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockFileSessionStorage' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\PhpBridgeSessionStorage' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\AbstractProxy' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\NativeProxy' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\SessionHandlerProxy' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php', - 'Symfony\\Component\\HttpFoundation\\StreamedResponse' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/StreamedResponse.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\AcceptHeaderItemTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/AcceptHeaderItemTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\AcceptHeaderTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/AcceptHeaderTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\ApacheRequestTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ApacheRequestTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\BinaryFileResponseTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\CookieTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/CookieTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\ExpressionRequestMatcherTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ExpressionRequestMatcherTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\FileBagTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/FileBagTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\File\\FakeFile' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/FakeFile.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\File\\FileTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/FileTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\File\\MimeType\\MimeTypeTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\File\\UploadedFileTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\HeaderBagTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\IpUtilsTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/IpUtilsTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\JsonResponseTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\JsonSerializableObject' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\NewRequest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\ParameterBagTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\RedirectResponseTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\RequestContentProxy' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\RequestMatcherTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\RequestStackTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestStackTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\RequestTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\ResponseHeaderBagTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\ResponseTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\ResponseTestCase' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTestCase.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\ServerBagTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Attribute\\AttributeBagTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Attribute\\NamespacedAttributeBagTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Flash\\AutoExpireFlashBagTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Flash\\FlashBagTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\SessionTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Handler\\LegacyPdoSessionHandlerTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Handler\\MemcacheSessionHandlerTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Handler\\MemcachedSessionHandlerTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Handler\\MockPdo' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Handler\\MongoDbSessionHandlerTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Handler\\NativeFileSessionHandlerTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Handler\\NativeSessionHandlerTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Handler\\NullSessionHandlerTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Handler\\PdoSessionHandlerTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Handler\\WriteCheckSessionHandlerTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\MetadataBagTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\MockArraySessionStorageTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\MockFileSessionStorageTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\NativeSessionStorageTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\PhpBridgeSessionStorageTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Proxy\\AbstractProxyTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Proxy\\ConcreteProxy' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Proxy\\ConcreteSessionHandlerInterfaceProxy' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Proxy\\NativeProxyTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/NativeProxyTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\Proxy\\SessionHandlerProxyTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\StreamedResponseTest' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php', - 'Symfony\\Component\\HttpFoundation\\Tests\\StringableObject' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php', - 'Symfony\\Component\\HttpKernel\\Bundle\\Bundle' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/Bundle.php', - 'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/BundleInterface.php', - 'Symfony\\Component\\HttpKernel\\CacheClearer\\CacheClearerInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php', - 'Symfony\\Component\\HttpKernel\\CacheClearer\\ChainCacheClearer' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php', - 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmer' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php', - 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerAggregate' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php', - 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php', - 'Symfony\\Component\\HttpKernel\\CacheWarmer\\WarmableInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php', - 'Symfony\\Component\\HttpKernel\\Client' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Client.php', - 'Symfony\\Component\\HttpKernel\\Config\\EnvParametersResource' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Config/EnvParametersResource.php', - 'Symfony\\Component\\HttpKernel\\Config\\FileLocator' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Config/FileLocator.php', - 'Symfony\\Component\\HttpKernel\\Controller\\ControllerReference' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerReference.php', - 'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolver.php', - 'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php', - 'Symfony\\Component\\HttpKernel\\Controller\\TraceableControllerResolver' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php', - 'Symfony\\Component\\HttpKernel\\DataCollector\\ConfigDataCollector' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php', - 'Symfony\\Component\\HttpKernel\\DataCollector\\DataCollector' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollector.php', - 'Symfony\\Component\\HttpKernel\\DataCollector\\DataCollectorInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php', - 'Symfony\\Component\\HttpKernel\\DataCollector\\DumpDataCollector' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php', - 'Symfony\\Component\\HttpKernel\\DataCollector\\EventDataCollector' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php', - 'Symfony\\Component\\HttpKernel\\DataCollector\\ExceptionDataCollector' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php', - 'Symfony\\Component\\HttpKernel\\DataCollector\\LateDataCollectorInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/LateDataCollectorInterface.php', - 'Symfony\\Component\\HttpKernel\\DataCollector\\LoggerDataCollector' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php', - 'Symfony\\Component\\HttpKernel\\DataCollector\\MemoryDataCollector' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/MemoryDataCollector.php', - 'Symfony\\Component\\HttpKernel\\DataCollector\\RequestDataCollector' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php', - 'Symfony\\Component\\HttpKernel\\DataCollector\\RouterDataCollector' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php', - 'Symfony\\Component\\HttpKernel\\DataCollector\\TimeDataCollector' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php', - 'Symfony\\Component\\HttpKernel\\DataCollector\\Util\\ValueExporter' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php', - 'Symfony\\Component\\HttpKernel\\Debug\\ErrorHandler' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php', - 'Symfony\\Component\\HttpKernel\\Debug\\ExceptionHandler' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php', - 'Symfony\\Component\\HttpKernel\\Debug\\TraceableEventDispatcher' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php', - 'Symfony\\Component\\HttpKernel\\DependencyInjection\\AddClassesToCachePass' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/AddClassesToCachePass.php', - 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ConfigurableExtension' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php', - 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php', - 'Symfony\\Component\\HttpKernel\\DependencyInjection\\Extension' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/Extension.php', - 'Symfony\\Component\\HttpKernel\\DependencyInjection\\MergeExtensionConfigurationPass' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php', - 'Symfony\\Component\\HttpKernel\\DependencyInjection\\RegisterListenersPass' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/RegisterListenersPass.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\AddRequestFormatsListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\DebugHandlersListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\DumpListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/DumpListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\ErrorsLoggerListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ErrorsLoggerListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\EsiListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/EsiListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\FragmentListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/FragmentListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\LocaleListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/LocaleListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\ProfilerListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\ResponseListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ResponseListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\RouterListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/RouterListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\SaveSessionListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/SaveSessionListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\SessionListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/SessionListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\StreamedResponseListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\SurrogateListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/SurrogateListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\TestSessionListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/TestSessionListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\TranslatorListener' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/TranslatorListener.php', - 'Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php', - 'Symfony\\Component\\HttpKernel\\Event\\FilterResponseEvent' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php', - 'Symfony\\Component\\HttpKernel\\Event\\FinishRequestEvent' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Event/FinishRequestEvent.php', - 'Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Event/GetResponseEvent.php', - 'Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Event/GetResponseForControllerResultEvent.php', - 'Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Event/GetResponseForExceptionEvent.php', - 'Symfony\\Component\\HttpKernel\\Event\\KernelEvent' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Event/KernelEvent.php', - 'Symfony\\Component\\HttpKernel\\Event\\PostResponseEvent' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Event/PostResponseEvent.php', - 'Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/AccessDeniedHttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/BadRequestHttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\ConflictHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/ConflictHttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\GoneHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/GoneHttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\HttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/HttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\HttpExceptionInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php', - 'Symfony\\Component\\HttpKernel\\Exception\\LengthRequiredHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/LengthRequiredHttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\NotAcceptableHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/NotAcceptableHttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/NotFoundHttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\PreconditionFailedHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/PreconditionFailedHttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\PreconditionRequiredHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/PreconditionRequiredHttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\ServiceUnavailableHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/ServiceUnavailableHttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\TooManyRequestsHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/TooManyRequestsHttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\UnauthorizedHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/UnauthorizedHttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\UnprocessableEntityHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/UnprocessableEntityHttpException.php', - 'Symfony\\Component\\HttpKernel\\Exception\\UnsupportedMediaTypeHttpException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/UnsupportedMediaTypeHttpException.php', - 'Symfony\\Component\\HttpKernel\\Fragment\\AbstractSurrogateFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Fragment/AbstractSurrogateFragmentRenderer.php', - 'Symfony\\Component\\HttpKernel\\Fragment\\EsiFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Fragment/EsiFragmentRenderer.php', - 'Symfony\\Component\\HttpKernel\\Fragment\\FragmentHandler' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php', - 'Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Fragment/FragmentRendererInterface.php', - 'Symfony\\Component\\HttpKernel\\Fragment\\HIncludeFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php', - 'Symfony\\Component\\HttpKernel\\Fragment\\InlineFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php', - 'Symfony\\Component\\HttpKernel\\Fragment\\RoutableFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Fragment/RoutableFragmentRenderer.php', - 'Symfony\\Component\\HttpKernel\\Fragment\\SsiFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Fragment/SsiFragmentRenderer.php', - 'Symfony\\Component\\HttpKernel\\HttpCache\\Esi' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Esi.php', - 'Symfony\\Component\\HttpKernel\\HttpCache\\EsiResponseCacheStrategy' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php', - 'Symfony\\Component\\HttpKernel\\HttpCache\\EsiResponseCacheStrategyInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php', - 'Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/HttpCache.php', - 'Symfony\\Component\\HttpKernel\\HttpCache\\ResponseCacheStrategy' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php', - 'Symfony\\Component\\HttpKernel\\HttpCache\\ResponseCacheStrategyInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategyInterface.php', - 'Symfony\\Component\\HttpKernel\\HttpCache\\Ssi' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Ssi.php', - 'Symfony\\Component\\HttpKernel\\HttpCache\\Store' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Store.php', - 'Symfony\\Component\\HttpKernel\\HttpCache\\StoreInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php', - 'Symfony\\Component\\HttpKernel\\HttpCache\\SurrogateInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/SurrogateInterface.php', - 'Symfony\\Component\\HttpKernel\\HttpKernel' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php', - 'Symfony\\Component\\HttpKernel\\HttpKernelInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php', - 'Symfony\\Component\\HttpKernel\\Kernel' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php', - 'Symfony\\Component\\HttpKernel\\KernelEvents' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/KernelEvents.php', - 'Symfony\\Component\\HttpKernel\\KernelInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/KernelInterface.php', - 'Symfony\\Component\\HttpKernel\\Log\\DebugLoggerInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php', - 'Symfony\\Component\\HttpKernel\\Log\\LoggerInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Log/LoggerInterface.php', - 'Symfony\\Component\\HttpKernel\\Log\\NullLogger' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Log/NullLogger.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\BaseMemcacheProfilerStorage' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\FileProfilerStorage' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\MemcacheProfilerStorage' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\MemcachedProfilerStorage' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\MongoDbProfilerStorage' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\MysqlProfilerStorage' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MysqlProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\PdoProfilerStorage' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\Profile' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/Profile.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\Profiler' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/Profiler.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\ProfilerStorageInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\RedisProfilerStorage' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\SqliteProfilerStorage' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\TerminableInterface' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Bundle\\BundleTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\CacheClearer\\ChainCacheClearerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\CacheWarmer\\CacheWarmerAggregateTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\CacheWarmer\\CacheWarmerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\CacheWarmer\\TestCacheWarmer' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\ClientTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/ClientTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Config\\EnvParametersResourceTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Config/EnvParametersResourceTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Config\\FileLocatorTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Controller' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Controller\\ControllerResolverTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\DataCollector\\ConfigDataCollectorTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\DataCollector\\DumpDataCollectorTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\DataCollector\\ExceptionDataCollectorTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ExceptionDataCollectorTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\DataCollector\\KernelForTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\DataCollector\\LoggerDataCollectorTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\DataCollector\\MemoryDataCollectorTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\DataCollector\\RequestDataCollectorTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\DataCollector\\TimeDataCollectorTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\DataCollector\\Util\\ValueExporterTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Debug\\TraceableEventDispatcherTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\DependencyInjection\\ContainerAwareHttpKernelTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DependencyInjection/ContainerAwareHttpKernelTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\DependencyInjection\\MergeExtensionConfigurationPassTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\AddRequestFormatsListenerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\DebugHandlersListenerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\DumpListenerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\ExceptionListenerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\FragmentListenerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\LocaleListenerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\MockCloner' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\MockDumper' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\ProfilerListenerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ProfilerListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\ResponseListenerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\RouterListenerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\SurrogateListenerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/SurrogateListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\TestKernel' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\TestKernelThatThrowsException' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\TestLogger' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\TestSessionListenerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\EventListener\\TranslatorListenerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\ExtensionAbsentBundle\\ExtensionAbsentBundle' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionAbsentBundle/ExtensionAbsentBundle.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\ExtensionLoadedBundle\\DependencyInjection\\ExtensionLoadedExtension' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/DependencyInjection/ExtensionLoadedExtension.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\ExtensionLoadedBundle\\ExtensionLoadedBundle' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\ExtensionNotValidBundle\\DependencyInjection\\ExtensionNotValidExtension' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionNotValidBundle/DependencyInjection/ExtensionNotValidExtension.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\ExtensionNotValidBundle\\ExtensionNotValidBundle' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionNotValidBundle/ExtensionNotValidBundle.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\ExtensionPresentBundle\\Command\\BarCommand' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\ExtensionPresentBundle\\Command\\FooCommand' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/FooCommand.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\ExtensionPresentBundle\\DependencyInjection\\ExtensionPresentExtension' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/DependencyInjection/ExtensionPresentExtension.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\ExtensionPresentBundle\\ExtensionPresentBundle' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/ExtensionPresentBundle.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\FooBarBundle' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/FooBarBundle.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\KernelForOverrideName' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\KernelForTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\TestClient' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestClient.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fixtures\\TestEventDispatcher' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fragment\\Bar' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fragment\\EsiFragmentRendererTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fragment\\Foo' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fragment\\FragmentHandlerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fragment\\HIncludeFragmentRendererTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fragment/HIncludeFragmentRendererTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fragment\\InlineFragmentRendererTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Fragment\\RoutableFragmentRendererTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\HttpCache\\EsiTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\HttpCache\\HttpCacheTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\HttpCache\\HttpCacheTestCase' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php', - 'Symfony\\Component\\HttpKernel\\Tests\\HttpCache\\SsiTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\HttpCache\\StoreTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\HttpCache\\TestHttpKernel' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php', - 'Symfony\\Component\\HttpKernel\\Tests\\HttpCache\\TestMultipleHttpKernel' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php', - 'Symfony\\Component\\HttpKernel\\Tests\\HttpKernelTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\KernelTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/KernelTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Logger' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Logger.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Profiler\\AbstractProfilerStorageTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Profiler\\DummyMongoDbProfilerStorage' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Profiler\\FileProfilerStorageTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Profiler\\MemcacheProfilerStorageTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MemcacheProfilerStorageTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Profiler\\MemcachedProfilerStorageTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MemcachedProfilerStorageTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Profiler\\Mock\\MemcacheMock' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcacheMock.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Profiler\\Mock\\MemcachedMock' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcachedMock.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Profiler\\Mock\\RedisMock' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/Mock/RedisMock.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Profiler\\MongoDbProfilerStorageTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Profiler\\MongoDbProfilerStorageTestDataCollector' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Profiler\\ProfilerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Profiler\\RedisProfilerStorageTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/RedisProfilerStorageTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\Profiler\\SqliteProfilerStorageTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/SqliteProfilerStorageTest.php', - 'Symfony\\Component\\HttpKernel\\Tests\\TestHttpKernel' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php', - 'Symfony\\Component\\HttpKernel\\Tests\\UriSignerTest' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/UriSignerTest.php', - 'Symfony\\Component\\HttpKernel\\UriSigner' => $vendorDir . '/symfony/http-kernel/Symfony/Component/HttpKernel/UriSigner.php', - 'Symfony\\Component\\Process\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/process/Symfony/Component/Process/Exception/ExceptionInterface.php', - 'Symfony\\Component\\Process\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/process/Symfony/Component/Process/Exception/InvalidArgumentException.php', - 'Symfony\\Component\\Process\\Exception\\LogicException' => $vendorDir . '/symfony/process/Symfony/Component/Process/Exception/LogicException.php', - 'Symfony\\Component\\Process\\Exception\\ProcessFailedException' => $vendorDir . '/symfony/process/Symfony/Component/Process/Exception/ProcessFailedException.php', - 'Symfony\\Component\\Process\\Exception\\ProcessTimedOutException' => $vendorDir . '/symfony/process/Symfony/Component/Process/Exception/ProcessTimedOutException.php', - 'Symfony\\Component\\Process\\Exception\\RuntimeException' => $vendorDir . '/symfony/process/Symfony/Component/Process/Exception/RuntimeException.php', - 'Symfony\\Component\\Process\\ExecutableFinder' => $vendorDir . '/symfony/process/Symfony/Component/Process/ExecutableFinder.php', - 'Symfony\\Component\\Process\\PhpExecutableFinder' => $vendorDir . '/symfony/process/Symfony/Component/Process/PhpExecutableFinder.php', - 'Symfony\\Component\\Process\\PhpProcess' => $vendorDir . '/symfony/process/Symfony/Component/Process/PhpProcess.php', - 'Symfony\\Component\\Process\\Pipes\\AbstractPipes' => $vendorDir . '/symfony/process/Symfony/Component/Process/Pipes/AbstractPipes.php', - 'Symfony\\Component\\Process\\Pipes\\PipesInterface' => $vendorDir . '/symfony/process/Symfony/Component/Process/Pipes/PipesInterface.php', - 'Symfony\\Component\\Process\\Pipes\\UnixPipes' => $vendorDir . '/symfony/process/Symfony/Component/Process/Pipes/UnixPipes.php', - 'Symfony\\Component\\Process\\Pipes\\WindowsPipes' => $vendorDir . '/symfony/process/Symfony/Component/Process/Pipes/WindowsPipes.php', - 'Symfony\\Component\\Process\\Process' => $vendorDir . '/symfony/process/Symfony/Component/Process/Process.php', - 'Symfony\\Component\\Process\\ProcessBuilder' => $vendorDir . '/symfony/process/Symfony/Component/Process/ProcessBuilder.php', - 'Symfony\\Component\\Process\\ProcessUtils' => $vendorDir . '/symfony/process/Symfony/Component/Process/ProcessUtils.php', - 'Symfony\\Component\\Process\\Tests\\AbstractProcessTest' => $vendorDir . '/symfony/process/Symfony/Component/Process/Tests/AbstractProcessTest.php', - 'Symfony\\Component\\Process\\Tests\\ExecutableFinderTest' => $vendorDir . '/symfony/process/Symfony/Component/Process/Tests/ExecutableFinderTest.php', - 'Symfony\\Component\\Process\\Tests\\NonStringifiable' => $vendorDir . '/symfony/process/Symfony/Component/Process/Tests/AbstractProcessTest.php', - 'Symfony\\Component\\Process\\Tests\\PhpExecutableFinderTest' => $vendorDir . '/symfony/process/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php', - 'Symfony\\Component\\Process\\Tests\\PhpProcessTest' => $vendorDir . '/symfony/process/Symfony/Component/Process/Tests/PhpProcessTest.php', - 'Symfony\\Component\\Process\\Tests\\ProcessBuilderTest' => $vendorDir . '/symfony/process/Symfony/Component/Process/Tests/ProcessBuilderTest.php', - 'Symfony\\Component\\Process\\Tests\\ProcessFailedExceptionTest' => $vendorDir . '/symfony/process/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php', - 'Symfony\\Component\\Process\\Tests\\ProcessInSigchildEnvironment' => $vendorDir . '/symfony/process/Symfony/Component/Process/Tests/ProcessInSigchildEnvironment.php', - 'Symfony\\Component\\Process\\Tests\\ProcessUtilsTest' => $vendorDir . '/symfony/process/Symfony/Component/Process/Tests/ProcessUtilsTest.php', - 'Symfony\\Component\\Process\\Tests\\SigchildDisabledProcessTest' => $vendorDir . '/symfony/process/Symfony/Component/Process/Tests/SigchildDisabledProcessTest.php', - 'Symfony\\Component\\Process\\Tests\\SigchildEnabledProcessTest' => $vendorDir . '/symfony/process/Symfony/Component/Process/Tests/SigchildEnabledProcessTest.php', - 'Symfony\\Component\\Process\\Tests\\SimpleProcessTest' => $vendorDir . '/symfony/process/Symfony/Component/Process/Tests/SimpleProcessTest.php', - 'Symfony\\Component\\Process\\Tests\\Stringifiable' => $vendorDir . '/symfony/process/Symfony/Component/Process/Tests/AbstractProcessTest.php', - 'Symfony\\Component\\Routing\\Annotation\\Route' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Annotation/Route.php', - 'Symfony\\Component\\Routing\\CompiledRoute' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/CompiledRoute.php', - 'Symfony\\Component\\Routing\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Exception/ExceptionInterface.php', - 'Symfony\\Component\\Routing\\Exception\\InvalidParameterException' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Exception/InvalidParameterException.php', - 'Symfony\\Component\\Routing\\Exception\\MethodNotAllowedException' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Exception/MethodNotAllowedException.php', - 'Symfony\\Component\\Routing\\Exception\\MissingMandatoryParametersException' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Exception/MissingMandatoryParametersException.php', - 'Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Exception/ResourceNotFoundException.php', - 'Symfony\\Component\\Routing\\Exception\\RouteNotFoundException' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Exception/RouteNotFoundException.php', - 'Symfony\\Component\\Routing\\Generator\\ConfigurableRequirementsInterface' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Generator/ConfigurableRequirementsInterface.php', - 'Symfony\\Component\\Routing\\Generator\\Dumper\\GeneratorDumper' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php', - 'Symfony\\Component\\Routing\\Generator\\Dumper\\GeneratorDumperInterface' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php', - 'Symfony\\Component\\Routing\\Generator\\Dumper\\PhpGeneratorDumper' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php', - 'Symfony\\Component\\Routing\\Generator\\UrlGenerator' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php', - 'Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php', - 'Symfony\\Component\\Routing\\Loader\\AnnotationClassLoader' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Loader/AnnotationClassLoader.php', - 'Symfony\\Component\\Routing\\Loader\\AnnotationDirectoryLoader' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php', - 'Symfony\\Component\\Routing\\Loader\\AnnotationFileLoader' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Loader/AnnotationFileLoader.php', - 'Symfony\\Component\\Routing\\Loader\\ClosureLoader' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Loader/ClosureLoader.php', - 'Symfony\\Component\\Routing\\Loader\\PhpFileLoader' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Loader/PhpFileLoader.php', - 'Symfony\\Component\\Routing\\Loader\\XmlFileLoader' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Loader/XmlFileLoader.php', - 'Symfony\\Component\\Routing\\Loader\\YamlFileLoader' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Loader/YamlFileLoader.php', - 'Symfony\\Component\\Routing\\Matcher\\ApacheUrlMatcher' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php', - 'Symfony\\Component\\Routing\\Matcher\\Dumper\\ApacheMatcherDumper' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php', - 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperCollection' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php', - 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperPrefixCollection' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.php', - 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperRoute' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/DumperRoute.php', - 'Symfony\\Component\\Routing\\Matcher\\Dumper\\MatcherDumper' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php', - 'Symfony\\Component\\Routing\\Matcher\\Dumper\\MatcherDumperInterface' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php', - 'Symfony\\Component\\Routing\\Matcher\\Dumper\\PhpMatcherDumper' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php', - 'Symfony\\Component\\Routing\\Matcher\\RedirectableUrlMatcher' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php', - 'Symfony\\Component\\Routing\\Matcher\\RedirectableUrlMatcherInterface' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php', - 'Symfony\\Component\\Routing\\Matcher\\RequestMatcherInterface' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php', - 'Symfony\\Component\\Routing\\Matcher\\TraceableUrlMatcher' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php', - 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php', - 'Symfony\\Component\\Routing\\Matcher\\UrlMatcherInterface' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php', - 'Symfony\\Component\\Routing\\RequestContext' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/RequestContext.php', - 'Symfony\\Component\\Routing\\RequestContextAwareInterface' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php', - 'Symfony\\Component\\Routing\\Route' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Route.php', - 'Symfony\\Component\\Routing\\RouteCollection' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/RouteCollection.php', - 'Symfony\\Component\\Routing\\RouteCompiler' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/RouteCompiler.php', - 'Symfony\\Component\\Routing\\RouteCompilerInterface' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php', - 'Symfony\\Component\\Routing\\Router' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Router.php', - 'Symfony\\Component\\Routing\\RouterInterface' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/RouterInterface.php', - 'Symfony\\Component\\Routing\\Tests\\Annotation\\RouteTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php', - 'Symfony\\Component\\Routing\\Tests\\CompiledRouteTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/CompiledRouteTest.php', - 'Symfony\\Component\\Routing\\Tests\\Fixtures\\AnnotatedClasses\\AbstractClass' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/AbstractClass.php', - 'Symfony\\Component\\Routing\\Tests\\Fixtures\\AnnotatedClasses\\BarClass' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/BarClass.php', - 'Symfony\\Component\\Routing\\Tests\\Fixtures\\AnnotatedClasses\\FooClass' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooClass.php', - 'Symfony\\Component\\Routing\\Tests\\Fixtures\\CustomXmlFileLoader' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/CustomXmlFileLoader.php', - 'Symfony\\Component\\Routing\\Tests\\Fixtures\\RedirectableUrlMatcher' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/RedirectableUrlMatcher.php', - 'Symfony\\Component\\Routing\\Tests\\Generator\\Dumper\\PhpGeneratorDumperTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php', - 'Symfony\\Component\\Routing\\Tests\\Generator\\UrlGeneratorTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php', - 'Symfony\\Component\\Routing\\Tests\\Loader\\AbstractAnnotationLoaderTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php', - 'Symfony\\Component\\Routing\\Tests\\Loader\\AnnotationClassLoaderTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php', - 'Symfony\\Component\\Routing\\Tests\\Loader\\AnnotationDirectoryLoaderTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php', - 'Symfony\\Component\\Routing\\Tests\\Loader\\AnnotationFileLoaderTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php', - 'Symfony\\Component\\Routing\\Tests\\Loader\\ClosureLoaderTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Loader/ClosureLoaderTest.php', - 'Symfony\\Component\\Routing\\Tests\\Loader\\PhpFileLoaderTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php', - 'Symfony\\Component\\Routing\\Tests\\Loader\\XmlFileLoaderTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php', - 'Symfony\\Component\\Routing\\Tests\\Loader\\YamlFileLoaderTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php', - 'Symfony\\Component\\Routing\\Tests\\Matcher\\Dumper\\DumperCollectionTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/DumperCollectionTest.php', - 'Symfony\\Component\\Routing\\Tests\\Matcher\\Dumper\\DumperPrefixCollectionTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/DumperPrefixCollectionTest.php', - 'Symfony\\Component\\Routing\\Tests\\Matcher\\Dumper\\LegacyApacheMatcherDumperTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/LegacyApacheMatcherDumperTest.php', - 'Symfony\\Component\\Routing\\Tests\\Matcher\\Dumper\\PhpMatcherDumperTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php', - 'Symfony\\Component\\Routing\\Tests\\Matcher\\LegacyApacheUrlMatcherTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Matcher/LegacyApacheUrlMatcherTest.php', - 'Symfony\\Component\\Routing\\Tests\\Matcher\\RedirectableUrlMatcherTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php', - 'Symfony\\Component\\Routing\\Tests\\Matcher\\TraceableUrlMatcherTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Matcher/TraceableUrlMatcherTest.php', - 'Symfony\\Component\\Routing\\Tests\\Matcher\\UrlMatcherTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php', - 'Symfony\\Component\\Routing\\Tests\\RequestContextTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/RequestContextTest.php', - 'Symfony\\Component\\Routing\\Tests\\RouteCollectionTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/RouteCollectionTest.php', - 'Symfony\\Component\\Routing\\Tests\\RouteCompilerTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/RouteCompilerTest.php', - 'Symfony\\Component\\Routing\\Tests\\RouteTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/RouteTest.php', - 'Symfony\\Component\\Routing\\Tests\\RouterTest' => $vendorDir . '/symfony/routing/Symfony/Component/Routing/Tests/RouterTest.php', - 'Symfony\\Component\\Security\\Core\\AuthenticationEvents' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/AuthenticationEvents.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationManagerInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/AuthenticationManagerInterface.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationProviderManager' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/AuthenticationProviderManager.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationTrustResolver' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolver.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationTrustResolverInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolverInterface.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\AnonymousAuthenticationProvider' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Provider/AnonymousAuthenticationProvider.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\AuthenticationProviderInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Provider/AuthenticationProviderInterface.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\DaoAuthenticationProvider' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Provider/DaoAuthenticationProvider.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\PreAuthenticatedAuthenticationProvider' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\RememberMeAuthenticationProvider' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Provider/RememberMeAuthenticationProvider.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\SimpleAuthenticationProvider' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Provider/SimpleAuthenticationProvider.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\UserAuthenticationProvider' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\InMemoryTokenProvider' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/RememberMe/InMemoryTokenProvider.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\PersistentToken' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\PersistentTokenInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentTokenInterface.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\TokenProviderInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\SimpleAuthenticatorInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/SimpleAuthenticatorInterface.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\SimpleFormAuthenticatorInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/SimpleFormAuthenticatorInterface.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\SimplePreAuthenticatorInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/SimplePreAuthenticatorInterface.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\AbstractToken' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\AnonymousToken' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Token/AnonymousToken.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\PreAuthenticatedToken' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Token/PreAuthenticatedToken.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\RememberMeToken' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Token/RememberMeToken.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorage' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Token/Storage/TokenStorage.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Token/Storage/TokenStorageInterface.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php', - 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\UsernamePasswordToken' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authentication/Token/UsernamePasswordToken.php', - 'Symfony\\Component\\Security\\Core\\Authorization\\AccessDecisionManager' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php', - 'Symfony\\Component\\Security\\Core\\Authorization\\AccessDecisionManagerInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authorization/AccessDecisionManagerInterface.php', - 'Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationChecker' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authorization/AuthorizationChecker.php', - 'Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationCheckerInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authorization/AuthorizationCheckerInterface.php', - 'Symfony\\Component\\Security\\Core\\Authorization\\ExpressionLanguage' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authorization/ExpressionLanguage.php', - 'Symfony\\Component\\Security\\Core\\Authorization\\ExpressionLanguageProvider' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authorization/ExpressionLanguageProvider.php', - 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\AbstractVoter' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authorization/Voter/AbstractVoter.php', - 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\AuthenticatedVoter' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authorization/Voter/AuthenticatedVoter.php', - 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\ExpressionVoter' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php', - 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\RoleHierarchyVoter' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authorization/Voter/RoleHierarchyVoter.php', - 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\RoleVoter' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authorization/Voter/RoleVoter.php', - 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php', - 'Symfony\\Component\\Security\\Core\\Encoder\\BCryptPasswordEncoder' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php', - 'Symfony\\Component\\Security\\Core\\Encoder\\BasePasswordEncoder' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Encoder/BasePasswordEncoder.php', - 'Symfony\\Component\\Security\\Core\\Encoder\\EncoderAwareInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Encoder/EncoderAwareInterface.php', - 'Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactory' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Encoder/EncoderFactory.php', - 'Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Encoder/EncoderFactoryInterface.php', - 'Symfony\\Component\\Security\\Core\\Encoder\\MessageDigestPasswordEncoder' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php', - 'Symfony\\Component\\Security\\Core\\Encoder\\PasswordEncoderInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Encoder/PasswordEncoderInterface.php', - 'Symfony\\Component\\Security\\Core\\Encoder\\Pbkdf2PasswordEncoder' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php', - 'Symfony\\Component\\Security\\Core\\Encoder\\PlaintextPasswordEncoder' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Encoder/PlaintextPasswordEncoder.php', - 'Symfony\\Component\\Security\\Core\\Encoder\\UserPasswordEncoder' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Encoder/UserPasswordEncoder.php', - 'Symfony\\Component\\Security\\Core\\Encoder\\UserPasswordEncoderInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Encoder/UserPasswordEncoderInterface.php', - 'Symfony\\Component\\Security\\Core\\Event\\AuthenticationEvent' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Event/AuthenticationEvent.php', - 'Symfony\\Component\\Security\\Core\\Event\\AuthenticationFailureEvent' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Event/AuthenticationFailureEvent.php', - 'Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/AccessDeniedException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\AccountExpiredException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/AccountExpiredException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\AccountStatusException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/AccountStatusException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/AuthenticationCredentialsNotFoundException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\AuthenticationException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/AuthenticationException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\AuthenticationServiceException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/AuthenticationServiceException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\BadCredentialsException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/BadCredentialsException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\CookieTheftException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/CookieTheftException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\CredentialsExpiredException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/CredentialsExpiredException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\DisabledException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/DisabledException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/ExceptionInterface.php', - 'Symfony\\Component\\Security\\Core\\Exception\\InsufficientAuthenticationException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/InsufficientAuthenticationException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/InvalidArgumentException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\InvalidCsrfTokenException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/InvalidCsrfTokenException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\LockedException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/LockedException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\LogoutException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/LogoutException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\NonceExpiredException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/NonceExpiredException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\ProviderNotFoundException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/ProviderNotFoundException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\RuntimeException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/RuntimeException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\SessionUnavailableException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/SessionUnavailableException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\TokenNotFoundException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/TokenNotFoundException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\UnsupportedUserException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/UnsupportedUserException.php', - 'Symfony\\Component\\Security\\Core\\Exception\\UsernameNotFoundException' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Exception/UsernameNotFoundException.php', - 'Symfony\\Component\\Security\\Core\\Role\\Role' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Role/Role.php', - 'Symfony\\Component\\Security\\Core\\Role\\RoleHierarchy' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Role/RoleHierarchy.php', - 'Symfony\\Component\\Security\\Core\\Role\\RoleHierarchyInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Role/RoleHierarchyInterface.php', - 'Symfony\\Component\\Security\\Core\\Role\\RoleInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Role/RoleInterface.php', - 'Symfony\\Component\\Security\\Core\\Role\\SwitchUserRole' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Role/SwitchUserRole.php', - 'Symfony\\Component\\Security\\Core\\Security' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Security.php', - 'Symfony\\Component\\Security\\Core\\SecurityContext' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/SecurityContext.php', - 'Symfony\\Component\\Security\\Core\\SecurityContextInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/SecurityContextInterface.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\AuthenticationProviderManagerTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\AuthenticationTrustResolverTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\Provider\\AnonymousAuthenticationProviderTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\Provider\\DaoAuthenticationProviderTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\Provider\\PreAuthenticatedAuthenticationProviderTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\Provider\\RememberMeAuthenticationProviderTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\Provider\\UserAuthenticationProviderTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\RememberMe\\InMemoryTokenProviderTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/RememberMe/InMemoryTokenProviderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\RememberMe\\PersistentTokenTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/RememberMe/PersistentTokenTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\Token\\AbstractTokenTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\Token\\AnonymousTokenTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/Token/AnonymousTokenTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\Token\\ConcreteToken' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\Token\\PreAuthenticatedTokenTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/Token/PreAuthenticatedTokenTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\Token\\RememberMeTokenTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\Token\\Storage\\TokenStorageTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/Token/Storage/TokenStorageTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\Token\\TestUser' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authentication\\Token\\UsernamePasswordTokenTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authentication/Token/UsernamePasswordTokenTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authorization\\AccessDecisionManagerTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authorization\\AuthorizationCheckerTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authorization\\ExpressionLanguageTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authorization/ExpressionLanguageTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authorization\\Voter\\AuthenticatedVoterTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authorization/Voter/AuthenticatedVoterTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authorization\\Voter\\ExpressionVoterTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authorization/Voter/ExpressionVoterTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authorization\\Voter\\RoleHierarchyVoterTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authorization/Voter/RoleHierarchyVoterTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Authorization\\Voter\\RoleVoterTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Authorization/Voter/RoleVoterTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Encoder\\BCryptPasswordEncoderTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Encoder\\BasePasswordEncoderTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Encoder/BasePasswordEncoderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Encoder\\EncAwareUser' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Encoder\\EncoderFactoryTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Encoder\\MessageDigestPasswordEncoderTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Encoder/MessageDigestPasswordEncoderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Encoder\\PasswordEncoder' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Encoder/BasePasswordEncoderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Encoder\\Pbkdf2PasswordEncoderTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Encoder\\PlaintextPasswordEncoderTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Encoder/PlaintextPasswordEncoderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Encoder\\SomeChildUser' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Encoder\\SomeUser' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Encoder\\UserPasswordEncoderTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Encoder/UserPasswordEncoderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Exception\\UsernameNotFoundExceptionTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Exception/UsernameNotFoundExceptionTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Role\\RoleHierarchyTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Role/RoleHierarchyTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Role\\RoleTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Role/RoleTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Role\\SwitchUserRoleTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Role/SwitchUserRoleTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\SecurityContextTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/SecurityContextTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\User\\ChainUserProviderTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\User\\InMemoryUserProviderTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\User\\UserCheckerTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/User/UserCheckerTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\User\\UserTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/User/UserTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Util\\ClassUtilsTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Util/ClassUtilsTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Util\\SecureRandomTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Util/SecureRandomTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Util\\StringUtilsTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Util/StringUtilsTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Util\\TestObject' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Util/ClassUtilsTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Validator\\Constraints\\LegacyUserPasswordValidator2Dot4ApiTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Validator/Constraints/LegacyUserPasswordValidator2Dot4ApiTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Validator\\Constraints\\LegacyUserPasswordValidatorTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Validator/Constraints/LegacyUserPasswordValidatorTest.php', - 'Symfony\\Component\\Security\\Core\\Tests\\Validator\\Constraints\\UserPasswordValidatorTest' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php', - 'Symfony\\Component\\Security\\Core\\User\\AdvancedUserInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/User/AdvancedUserInterface.php', - 'Symfony\\Component\\Security\\Core\\User\\ChainUserProvider' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/User/ChainUserProvider.php', - 'Symfony\\Component\\Security\\Core\\User\\EquatableInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/User/EquatableInterface.php', - 'Symfony\\Component\\Security\\Core\\User\\InMemoryUserProvider' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/User/InMemoryUserProvider.php', - 'Symfony\\Component\\Security\\Core\\User\\User' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/User/User.php', - 'Symfony\\Component\\Security\\Core\\User\\UserChecker' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/User/UserChecker.php', - 'Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/User/UserCheckerInterface.php', - 'Symfony\\Component\\Security\\Core\\User\\UserInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/User/UserInterface.php', - 'Symfony\\Component\\Security\\Core\\User\\UserProviderInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/User/UserProviderInterface.php', - 'Symfony\\Component\\Security\\Core\\Util\\ClassUtils' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Util/ClassUtils.php', - 'Symfony\\Component\\Security\\Core\\Util\\SecureRandom' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Util/SecureRandom.php', - 'Symfony\\Component\\Security\\Core\\Util\\SecureRandomInterface' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Util/SecureRandomInterface.php', - 'Symfony\\Component\\Security\\Core\\Util\\StringUtils' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Util/StringUtils.php', - 'Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPassword' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Validator/Constraints/UserPassword.php', - 'Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPasswordValidator' => $vendorDir . '/symfony/security-core/Symfony/Component/Security/Core/Validator/Constraints/UserPasswordValidator.php', - 'Symfony\\Component\\Translation\\Catalogue\\AbstractOperation' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Catalogue/AbstractOperation.php', - 'Symfony\\Component\\Translation\\Catalogue\\DiffOperation' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Catalogue/DiffOperation.php', - 'Symfony\\Component\\Translation\\Catalogue\\MergeOperation' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Catalogue/MergeOperation.php', - 'Symfony\\Component\\Translation\\Catalogue\\OperationInterface' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Catalogue/OperationInterface.php', - 'Symfony\\Component\\Translation\\Dumper\\CsvFileDumper' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Dumper/CsvFileDumper.php', - 'Symfony\\Component\\Translation\\Dumper\\DumperInterface' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Dumper/DumperInterface.php', - 'Symfony\\Component\\Translation\\Dumper\\FileDumper' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Dumper/FileDumper.php', - 'Symfony\\Component\\Translation\\Dumper\\IcuResFileDumper' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Dumper/IcuResFileDumper.php', - 'Symfony\\Component\\Translation\\Dumper\\IniFileDumper' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Dumper/IniFileDumper.php', - 'Symfony\\Component\\Translation\\Dumper\\JsonFileDumper' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Dumper/JsonFileDumper.php', - 'Symfony\\Component\\Translation\\Dumper\\MoFileDumper' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Dumper/MoFileDumper.php', - 'Symfony\\Component\\Translation\\Dumper\\PhpFileDumper' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Dumper/PhpFileDumper.php', - 'Symfony\\Component\\Translation\\Dumper\\PoFileDumper' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Dumper/PoFileDumper.php', - 'Symfony\\Component\\Translation\\Dumper\\QtFileDumper' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Dumper/QtFileDumper.php', - 'Symfony\\Component\\Translation\\Dumper\\XliffFileDumper' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Dumper/XliffFileDumper.php', - 'Symfony\\Component\\Translation\\Dumper\\YamlFileDumper' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Dumper/YamlFileDumper.php', - 'Symfony\\Component\\Translation\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Exception/ExceptionInterface.php', - 'Symfony\\Component\\Translation\\Exception\\InvalidResourceException' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Exception/InvalidResourceException.php', - 'Symfony\\Component\\Translation\\Exception\\NotFoundResourceException' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Exception/NotFoundResourceException.php', - 'Symfony\\Component\\Translation\\Extractor\\ChainExtractor' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Extractor/ChainExtractor.php', - 'Symfony\\Component\\Translation\\Extractor\\ExtractorInterface' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Extractor/ExtractorInterface.php', - 'Symfony\\Component\\Translation\\IdentityTranslator' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/IdentityTranslator.php', - 'Symfony\\Component\\Translation\\Interval' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Interval.php', - 'Symfony\\Component\\Translation\\Loader\\ArrayLoader' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Loader/ArrayLoader.php', - 'Symfony\\Component\\Translation\\Loader\\CsvFileLoader' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Loader/CsvFileLoader.php', - 'Symfony\\Component\\Translation\\Loader\\IcuDatFileLoader' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Loader/IcuDatFileLoader.php', - 'Symfony\\Component\\Translation\\Loader\\IcuResFileLoader' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Loader/IcuResFileLoader.php', - 'Symfony\\Component\\Translation\\Loader\\IniFileLoader' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Loader/IniFileLoader.php', - 'Symfony\\Component\\Translation\\Loader\\JsonFileLoader' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Loader/JsonFileLoader.php', - 'Symfony\\Component\\Translation\\Loader\\LoaderInterface' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Loader/LoaderInterface.php', - 'Symfony\\Component\\Translation\\Loader\\MoFileLoader' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Loader/MoFileLoader.php', - 'Symfony\\Component\\Translation\\Loader\\PhpFileLoader' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Loader/PhpFileLoader.php', - 'Symfony\\Component\\Translation\\Loader\\PoFileLoader' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Loader/PoFileLoader.php', - 'Symfony\\Component\\Translation\\Loader\\QtFileLoader' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Loader/QtFileLoader.php', - 'Symfony\\Component\\Translation\\Loader\\XliffFileLoader' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Loader/XliffFileLoader.php', - 'Symfony\\Component\\Translation\\Loader\\YamlFileLoader' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Loader/YamlFileLoader.php', - 'Symfony\\Component\\Translation\\LoggingTranslator' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/LoggingTranslator.php', - 'Symfony\\Component\\Translation\\MessageCatalogue' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/MessageCatalogue.php', - 'Symfony\\Component\\Translation\\MessageCatalogueInterface' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/MessageCatalogueInterface.php', - 'Symfony\\Component\\Translation\\MessageSelector' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/MessageSelector.php', - 'Symfony\\Component\\Translation\\MetadataAwareInterface' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/MetadataAwareInterface.php', - 'Symfony\\Component\\Translation\\PluralizationRules' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/PluralizationRules.php', - 'Symfony\\Component\\Translation\\Tests\\Catalogue\\AbstractOperationTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php', - 'Symfony\\Component\\Translation\\Tests\\Catalogue\\DiffOperationTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/DiffOperationTest.php', - 'Symfony\\Component\\Translation\\Tests\\Catalogue\\MergeOperationTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/MergeOperationTest.php', - 'Symfony\\Component\\Translation\\Tests\\Dumper\\ConcreteFileDumper' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php', - 'Symfony\\Component\\Translation\\Tests\\Dumper\\CsvFileDumperTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php', - 'Symfony\\Component\\Translation\\Tests\\Dumper\\FileDumperTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php', - 'Symfony\\Component\\Translation\\Tests\\Dumper\\IcuResFileDumperTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php', - 'Symfony\\Component\\Translation\\Tests\\Dumper\\IniFileDumperTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php', - 'Symfony\\Component\\Translation\\Tests\\Dumper\\JsonFileDumperTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php', - 'Symfony\\Component\\Translation\\Tests\\Dumper\\MoFileDumperTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php', - 'Symfony\\Component\\Translation\\Tests\\Dumper\\PhpFileDumperTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php', - 'Symfony\\Component\\Translation\\Tests\\Dumper\\PoFileDumperTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php', - 'Symfony\\Component\\Translation\\Tests\\Dumper\\QtFileDumperTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php', - 'Symfony\\Component\\Translation\\Tests\\Dumper\\XliffFileDumperTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php', - 'Symfony\\Component\\Translation\\Tests\\Dumper\\YamlFileDumperTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php', - 'Symfony\\Component\\Translation\\Tests\\IdentityTranslatorTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php', - 'Symfony\\Component\\Translation\\Tests\\IntervalTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/IntervalTest.php', - 'Symfony\\Component\\Translation\\Tests\\Loader\\CsvFileLoaderTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php', - 'Symfony\\Component\\Translation\\Tests\\Loader\\IcuDatFileLoaderTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php', - 'Symfony\\Component\\Translation\\Tests\\Loader\\IcuResFileLoaderTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php', - 'Symfony\\Component\\Translation\\Tests\\Loader\\IniFileLoaderTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php', - 'Symfony\\Component\\Translation\\Tests\\Loader\\JsonFileLoaderTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php', - 'Symfony\\Component\\Translation\\Tests\\Loader\\LocalizedTestCase' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php', - 'Symfony\\Component\\Translation\\Tests\\Loader\\MoFileLoaderTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php', - 'Symfony\\Component\\Translation\\Tests\\Loader\\PhpFileLoaderTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php', - 'Symfony\\Component\\Translation\\Tests\\Loader\\PoFileLoaderTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php', - 'Symfony\\Component\\Translation\\Tests\\Loader\\QtFileLoaderTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php', - 'Symfony\\Component\\Translation\\Tests\\Loader\\XliffFileLoaderTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php', - 'Symfony\\Component\\Translation\\Tests\\Loader\\YamlFileLoaderTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php', - 'Symfony\\Component\\Translation\\Tests\\LoggingTranslatorTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/LoggingTranslatorTest.php', - 'Symfony\\Component\\Translation\\Tests\\MessageCatalogueTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/MessageCatalogueTest.php', - 'Symfony\\Component\\Translation\\Tests\\MessageSelectorTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/MessageSelectorTest.php', - 'Symfony\\Component\\Translation\\Tests\\PluralizationRulesTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/PluralizationRulesTest.php', - 'Symfony\\Component\\Translation\\Tests\\StaleResource' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/TranslatorCacheTest.php', - 'Symfony\\Component\\Translation\\Tests\\StringClass' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/TranslatorTest.php', - 'Symfony\\Component\\Translation\\Tests\\TranslatorCacheTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/TranslatorCacheTest.php', - 'Symfony\\Component\\Translation\\Tests\\TranslatorTest' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Tests/TranslatorTest.php', - 'Symfony\\Component\\Translation\\Translator' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Translator.php', - 'Symfony\\Component\\Translation\\TranslatorBagInterface' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/TranslatorBagInterface.php', - 'Symfony\\Component\\Translation\\TranslatorInterface' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/TranslatorInterface.php', - 'Symfony\\Component\\Translation\\Writer\\TranslationWriter' => $vendorDir . '/symfony/translation/Symfony/Component/Translation/Writer/TranslationWriter.php', - 'Symfony\\Component\\VarDumper\\Caster\\ConstStub' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Caster/ConstStub.php', - 'Symfony\\Component\\VarDumper\\Caster\\CutStub' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Caster/CutStub.php', - 'Symfony\\Component\\VarDumper\\Caster\\DOMCaster' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Caster/DOMCaster.php', - 'Symfony\\Component\\VarDumper\\Caster\\DoctrineCaster' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Caster/DoctrineCaster.php', - 'Symfony\\Component\\VarDumper\\Caster\\ExceptionCaster' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Caster/ExceptionCaster.php', - 'Symfony\\Component\\VarDumper\\Caster\\PdoCaster' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Caster/PdoCaster.php', - 'Symfony\\Component\\VarDumper\\Caster\\ReflectionCaster' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Caster/ReflectionCaster.php', - 'Symfony\\Component\\VarDumper\\Caster\\ResourceCaster' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Caster/ResourceCaster.php', - 'Symfony\\Component\\VarDumper\\Caster\\SplCaster' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Caster/SplCaster.php', - 'Symfony\\Component\\VarDumper\\Caster\\StubCaster' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Caster/StubCaster.php', - 'Symfony\\Component\\VarDumper\\Cloner\\AbstractCloner' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Cloner/AbstractCloner.php', - 'Symfony\\Component\\VarDumper\\Cloner\\ClonerInterface' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Cloner/ClonerInterface.php', - 'Symfony\\Component\\VarDumper\\Cloner\\Cursor' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Cloner/Cursor.php', - 'Symfony\\Component\\VarDumper\\Cloner\\Data' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Cloner/Data.php', - 'Symfony\\Component\\VarDumper\\Cloner\\DumperInterface' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Cloner/DumperInterface.php', - 'Symfony\\Component\\VarDumper\\Cloner\\Stub' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Cloner/Stub.php', - 'Symfony\\Component\\VarDumper\\Cloner\\VarCloner' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Cloner/VarCloner.php', - 'Symfony\\Component\\VarDumper\\Dumper\\AbstractDumper' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Dumper/AbstractDumper.php', - 'Symfony\\Component\\VarDumper\\Dumper\\CliDumper' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Dumper/CliDumper.php', - 'Symfony\\Component\\VarDumper\\Dumper\\DataDumperInterface' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Dumper/DataDumperInterface.php', - 'Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Dumper/HtmlDumper.php', - 'Symfony\\Component\\VarDumper\\Exception\\ThrowingCasterException' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Exception/ThrowingCasterException.php', - 'Symfony\\Component\\VarDumper\\Tests\\Caster\\PdoCasterTest' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Tests/Caster/PdoCasterTest.php', - 'Symfony\\Component\\VarDumper\\Tests\\CliDumperTest' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Tests/CliDumperTest.php', - 'Symfony\\Component\\VarDumper\\Tests\\Fixture\\DumbFoo' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Tests/Fixtures/dumb-var.php', - 'Symfony\\Component\\VarDumper\\Tests\\HtmlDumperTest' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php', - 'Symfony\\Component\\VarDumper\\Tests\\VarClonerTest' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Tests/VarClonerTest.php', - 'Symfony\\Component\\VarDumper\\VarDumper' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/VarDumper.php', + 'Symfony\\Component\\Finder\\Adapter\\AbstractAdapter' => $vendorDir . '/symfony/finder/Adapter/AbstractAdapter.php', + 'Symfony\\Component\\Finder\\Adapter\\AbstractFindAdapter' => $vendorDir . '/symfony/finder/Adapter/AbstractFindAdapter.php', + 'Symfony\\Component\\Finder\\Adapter\\AdapterInterface' => $vendorDir . '/symfony/finder/Adapter/AdapterInterface.php', + 'Symfony\\Component\\Finder\\Adapter\\BsdFindAdapter' => $vendorDir . '/symfony/finder/Adapter/BsdFindAdapter.php', + 'Symfony\\Component\\Finder\\Adapter\\GnuFindAdapter' => $vendorDir . '/symfony/finder/Adapter/GnuFindAdapter.php', + 'Symfony\\Component\\Finder\\Adapter\\PhpAdapter' => $vendorDir . '/symfony/finder/Adapter/PhpAdapter.php', + 'Symfony\\Component\\Finder\\Comparator\\Comparator' => $vendorDir . '/symfony/finder/Comparator/Comparator.php', + 'Symfony\\Component\\Finder\\Comparator\\DateComparator' => $vendorDir . '/symfony/finder/Comparator/DateComparator.php', + 'Symfony\\Component\\Finder\\Comparator\\NumberComparator' => $vendorDir . '/symfony/finder/Comparator/NumberComparator.php', + 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException' => $vendorDir . '/symfony/finder/Exception/AccessDeniedException.php', + 'Symfony\\Component\\Finder\\Exception\\AdapterFailureException' => $vendorDir . '/symfony/finder/Exception/AdapterFailureException.php', + 'Symfony\\Component\\Finder\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/finder/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Finder\\Exception\\OperationNotPermitedException' => $vendorDir . '/symfony/finder/Exception/OperationNotPermitedException.php', + 'Symfony\\Component\\Finder\\Exception\\ShellCommandFailureException' => $vendorDir . '/symfony/finder/Exception/ShellCommandFailureException.php', + 'Symfony\\Component\\Finder\\Expression\\Expression' => $vendorDir . '/symfony/finder/Expression/Expression.php', + 'Symfony\\Component\\Finder\\Expression\\Glob' => $vendorDir . '/symfony/finder/Expression/Glob.php', + 'Symfony\\Component\\Finder\\Expression\\Regex' => $vendorDir . '/symfony/finder/Expression/Regex.php', + 'Symfony\\Component\\Finder\\Expression\\ValueInterface' => $vendorDir . '/symfony/finder/Expression/ValueInterface.php', + 'Symfony\\Component\\Finder\\Finder' => $vendorDir . '/symfony/finder/Finder.php', + 'Symfony\\Component\\Finder\\Glob' => $vendorDir . '/symfony/finder/Glob.php', + 'Symfony\\Component\\Finder\\Iterator\\CustomFilterIterator' => $vendorDir . '/symfony/finder/Iterator/CustomFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\DateRangeFilterIterator' => $vendorDir . '/symfony/finder/Iterator/DateRangeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\DepthRangeFilterIterator' => $vendorDir . '/symfony/finder/Iterator/DepthRangeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\ExcludeDirectoryFilterIterator' => $vendorDir . '/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FilePathsIterator' => $vendorDir . '/symfony/finder/Iterator/FilePathsIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FileTypeFilterIterator' => $vendorDir . '/symfony/finder/Iterator/FileTypeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FilecontentFilterIterator' => $vendorDir . '/symfony/finder/Iterator/FilecontentFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FilenameFilterIterator' => $vendorDir . '/symfony/finder/Iterator/FilenameFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FilterIterator' => $vendorDir . '/symfony/finder/Iterator/FilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\MultiplePcreFilterIterator' => $vendorDir . '/symfony/finder/Iterator/MultiplePcreFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\PathFilterIterator' => $vendorDir . '/symfony/finder/Iterator/PathFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\RecursiveDirectoryIterator' => $vendorDir . '/symfony/finder/Iterator/RecursiveDirectoryIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\SizeRangeFilterIterator' => $vendorDir . '/symfony/finder/Iterator/SizeRangeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\SortableIterator' => $vendorDir . '/symfony/finder/Iterator/SortableIterator.php', + 'Symfony\\Component\\Finder\\Shell\\Command' => $vendorDir . '/symfony/finder/Shell/Command.php', + 'Symfony\\Component\\Finder\\Shell\\Shell' => $vendorDir . '/symfony/finder/Shell/Shell.php', + 'Symfony\\Component\\Finder\\SplFileInfo' => $vendorDir . '/symfony/finder/SplFileInfo.php', + 'Symfony\\Component\\HttpFoundation\\AcceptHeader' => $vendorDir . '/symfony/http-foundation/AcceptHeader.php', + 'Symfony\\Component\\HttpFoundation\\AcceptHeaderItem' => $vendorDir . '/symfony/http-foundation/AcceptHeaderItem.php', + 'Symfony\\Component\\HttpFoundation\\ApacheRequest' => $vendorDir . '/symfony/http-foundation/ApacheRequest.php', + 'Symfony\\Component\\HttpFoundation\\BinaryFileResponse' => $vendorDir . '/symfony/http-foundation/BinaryFileResponse.php', + 'Symfony\\Component\\HttpFoundation\\Cookie' => $vendorDir . '/symfony/http-foundation/Cookie.php', + 'Symfony\\Component\\HttpFoundation\\Exception\\ConflictingHeadersException' => $vendorDir . '/symfony/http-foundation/Exception/ConflictingHeadersException.php', + 'Symfony\\Component\\HttpFoundation\\ExpressionRequestMatcher' => $vendorDir . '/symfony/http-foundation/ExpressionRequestMatcher.php', + 'Symfony\\Component\\HttpFoundation\\FileBag' => $vendorDir . '/symfony/http-foundation/FileBag.php', + 'Symfony\\Component\\HttpFoundation\\File\\Exception\\AccessDeniedException' => $vendorDir . '/symfony/http-foundation/File/Exception/AccessDeniedException.php', + 'Symfony\\Component\\HttpFoundation\\File\\Exception\\FileException' => $vendorDir . '/symfony/http-foundation/File/Exception/FileException.php', + 'Symfony\\Component\\HttpFoundation\\File\\Exception\\FileNotFoundException' => $vendorDir . '/symfony/http-foundation/File/Exception/FileNotFoundException.php', + 'Symfony\\Component\\HttpFoundation\\File\\Exception\\UnexpectedTypeException' => $vendorDir . '/symfony/http-foundation/File/Exception/UnexpectedTypeException.php', + 'Symfony\\Component\\HttpFoundation\\File\\Exception\\UploadException' => $vendorDir . '/symfony/http-foundation/File/Exception/UploadException.php', + 'Symfony\\Component\\HttpFoundation\\File\\File' => $vendorDir . '/symfony/http-foundation/File/File.php', + 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\ExtensionGuesser' => $vendorDir . '/symfony/http-foundation/File/MimeType/ExtensionGuesser.php', + 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\ExtensionGuesserInterface' => $vendorDir . '/symfony/http-foundation/File/MimeType/ExtensionGuesserInterface.php', + 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\FileBinaryMimeTypeGuesser' => $vendorDir . '/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php', + 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\FileinfoMimeTypeGuesser' => $vendorDir . '/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php', + 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeExtensionGuesser' => $vendorDir . '/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php', + 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesser' => $vendorDir . '/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php', + 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesserInterface' => $vendorDir . '/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php', + 'Symfony\\Component\\HttpFoundation\\File\\UploadedFile' => $vendorDir . '/symfony/http-foundation/File/UploadedFile.php', + 'Symfony\\Component\\HttpFoundation\\HeaderBag' => $vendorDir . '/symfony/http-foundation/HeaderBag.php', + 'Symfony\\Component\\HttpFoundation\\IpUtils' => $vendorDir . '/symfony/http-foundation/IpUtils.php', + 'Symfony\\Component\\HttpFoundation\\JsonResponse' => $vendorDir . '/symfony/http-foundation/JsonResponse.php', + 'Symfony\\Component\\HttpFoundation\\ParameterBag' => $vendorDir . '/symfony/http-foundation/ParameterBag.php', + 'Symfony\\Component\\HttpFoundation\\RedirectResponse' => $vendorDir . '/symfony/http-foundation/RedirectResponse.php', + 'Symfony\\Component\\HttpFoundation\\Request' => $vendorDir . '/symfony/http-foundation/Request.php', + 'Symfony\\Component\\HttpFoundation\\RequestMatcher' => $vendorDir . '/symfony/http-foundation/RequestMatcher.php', + 'Symfony\\Component\\HttpFoundation\\RequestMatcherInterface' => $vendorDir . '/symfony/http-foundation/RequestMatcherInterface.php', + 'Symfony\\Component\\HttpFoundation\\RequestStack' => $vendorDir . '/symfony/http-foundation/RequestStack.php', + 'Symfony\\Component\\HttpFoundation\\Response' => $vendorDir . '/symfony/http-foundation/Response.php', + 'Symfony\\Component\\HttpFoundation\\ResponseHeaderBag' => $vendorDir . '/symfony/http-foundation/ResponseHeaderBag.php', + 'Symfony\\Component\\HttpFoundation\\ServerBag' => $vendorDir . '/symfony/http-foundation/ServerBag.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Attribute\\AttributeBag' => $vendorDir . '/symfony/http-foundation/Session/Attribute/AttributeBag.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Attribute\\AttributeBagInterface' => $vendorDir . '/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Attribute\\NamespacedAttributeBag' => $vendorDir . '/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Flash\\AutoExpireFlashBag' => $vendorDir . '/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBag' => $vendorDir . '/symfony/http-foundation/Session/Flash/FlashBag.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface' => $vendorDir . '/symfony/http-foundation/Session/Flash/FlashBagInterface.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Session' => $vendorDir . '/symfony/http-foundation/Session/Session.php', + 'Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface' => $vendorDir . '/symfony/http-foundation/Session/SessionBagInterface.php', + 'Symfony\\Component\\HttpFoundation\\Session\\SessionInterface' => $vendorDir . '/symfony/http-foundation/Session/SessionInterface.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\LegacyPdoSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/LegacyPdoSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcacheSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcachedSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MongoDbSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NullSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\PdoSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\WriteCheckSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\MetadataBag' => $vendorDir . '/symfony/http-foundation/Session/Storage/MetadataBag.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockArraySessionStorage' => $vendorDir . '/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockFileSessionStorage' => $vendorDir . '/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage' => $vendorDir . '/symfony/http-foundation/Session/Storage/NativeSessionStorage.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\PhpBridgeSessionStorage' => $vendorDir . '/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\AbstractProxy' => $vendorDir . '/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\NativeProxy' => $vendorDir . '/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\SessionHandlerProxy' => $vendorDir . '/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface' => $vendorDir . '/symfony/http-foundation/Session/Storage/SessionStorageInterface.php', + 'Symfony\\Component\\HttpFoundation\\StreamedResponse' => $vendorDir . '/symfony/http-foundation/StreamedResponse.php', + 'Symfony\\Component\\HttpKernel\\Bundle\\Bundle' => $vendorDir . '/symfony/http-kernel/Bundle/Bundle.php', + 'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface' => $vendorDir . '/symfony/http-kernel/Bundle/BundleInterface.php', + 'Symfony\\Component\\HttpKernel\\CacheClearer\\CacheClearerInterface' => $vendorDir . '/symfony/http-kernel/CacheClearer/CacheClearerInterface.php', + 'Symfony\\Component\\HttpKernel\\CacheClearer\\ChainCacheClearer' => $vendorDir . '/symfony/http-kernel/CacheClearer/ChainCacheClearer.php', + 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmer' => $vendorDir . '/symfony/http-kernel/CacheWarmer/CacheWarmer.php', + 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerAggregate' => $vendorDir . '/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php', + 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerInterface' => $vendorDir . '/symfony/http-kernel/CacheWarmer/CacheWarmerInterface.php', + 'Symfony\\Component\\HttpKernel\\CacheWarmer\\WarmableInterface' => $vendorDir . '/symfony/http-kernel/CacheWarmer/WarmableInterface.php', + 'Symfony\\Component\\HttpKernel\\Client' => $vendorDir . '/symfony/http-kernel/Client.php', + 'Symfony\\Component\\HttpKernel\\Config\\EnvParametersResource' => $vendorDir . '/symfony/http-kernel/Config/EnvParametersResource.php', + 'Symfony\\Component\\HttpKernel\\Config\\FileLocator' => $vendorDir . '/symfony/http-kernel/Config/FileLocator.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ControllerReference' => $vendorDir . '/symfony/http-kernel/Controller/ControllerReference.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver' => $vendorDir . '/symfony/http-kernel/Controller/ControllerResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface' => $vendorDir . '/symfony/http-kernel/Controller/ControllerResolverInterface.php', + 'Symfony\\Component\\HttpKernel\\Controller\\TraceableControllerResolver' => $vendorDir . '/symfony/http-kernel/Controller/TraceableControllerResolver.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\ConfigDataCollector' => $vendorDir . '/symfony/http-kernel/DataCollector/ConfigDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\DataCollector' => $vendorDir . '/symfony/http-kernel/DataCollector/DataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\DataCollectorInterface' => $vendorDir . '/symfony/http-kernel/DataCollector/DataCollectorInterface.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\DumpDataCollector' => $vendorDir . '/symfony/http-kernel/DataCollector/DumpDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\EventDataCollector' => $vendorDir . '/symfony/http-kernel/DataCollector/EventDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\ExceptionDataCollector' => $vendorDir . '/symfony/http-kernel/DataCollector/ExceptionDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\LateDataCollectorInterface' => $vendorDir . '/symfony/http-kernel/DataCollector/LateDataCollectorInterface.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\LoggerDataCollector' => $vendorDir . '/symfony/http-kernel/DataCollector/LoggerDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\MemoryDataCollector' => $vendorDir . '/symfony/http-kernel/DataCollector/MemoryDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\RequestDataCollector' => $vendorDir . '/symfony/http-kernel/DataCollector/RequestDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\RouterDataCollector' => $vendorDir . '/symfony/http-kernel/DataCollector/RouterDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\TimeDataCollector' => $vendorDir . '/symfony/http-kernel/DataCollector/TimeDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\Util\\ValueExporter' => $vendorDir . '/symfony/http-kernel/DataCollector/Util/ValueExporter.php', + 'Symfony\\Component\\HttpKernel\\Debug\\ErrorHandler' => $vendorDir . '/symfony/http-kernel/Debug/ErrorHandler.php', + 'Symfony\\Component\\HttpKernel\\Debug\\ExceptionHandler' => $vendorDir . '/symfony/http-kernel/Debug/ExceptionHandler.php', + 'Symfony\\Component\\HttpKernel\\Debug\\TraceableEventDispatcher' => $vendorDir . '/symfony/http-kernel/Debug/TraceableEventDispatcher.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\AddClassesToCachePass' => $vendorDir . '/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ConfigurableExtension' => $vendorDir . '/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel' => $vendorDir . '/symfony/http-kernel/DependencyInjection/ContainerAwareHttpKernel.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\Extension' => $vendorDir . '/symfony/http-kernel/DependencyInjection/Extension.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\FragmentRendererPass' => $vendorDir . '/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\LazyLoadingFragmentHandler' => $vendorDir . '/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\MergeExtensionConfigurationPass' => $vendorDir . '/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\RegisterListenersPass' => $vendorDir . '/symfony/http-kernel/DependencyInjection/RegisterListenersPass.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\AddRequestFormatsListener' => $vendorDir . '/symfony/http-kernel/EventListener/AddRequestFormatsListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\DebugHandlersListener' => $vendorDir . '/symfony/http-kernel/EventListener/DebugHandlersListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\DumpListener' => $vendorDir . '/symfony/http-kernel/EventListener/DumpListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\ErrorsLoggerListener' => $vendorDir . '/symfony/http-kernel/EventListener/ErrorsLoggerListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\EsiListener' => $vendorDir . '/symfony/http-kernel/EventListener/EsiListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener' => $vendorDir . '/symfony/http-kernel/EventListener/ExceptionListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\FragmentListener' => $vendorDir . '/symfony/http-kernel/EventListener/FragmentListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\LocaleListener' => $vendorDir . '/symfony/http-kernel/EventListener/LocaleListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\ProfilerListener' => $vendorDir . '/symfony/http-kernel/EventListener/ProfilerListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\ResponseListener' => $vendorDir . '/symfony/http-kernel/EventListener/ResponseListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\RouterListener' => $vendorDir . '/symfony/http-kernel/EventListener/RouterListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\SaveSessionListener' => $vendorDir . '/symfony/http-kernel/EventListener/SaveSessionListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\SessionListener' => $vendorDir . '/symfony/http-kernel/EventListener/SessionListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\StreamedResponseListener' => $vendorDir . '/symfony/http-kernel/EventListener/StreamedResponseListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\SurrogateListener' => $vendorDir . '/symfony/http-kernel/EventListener/SurrogateListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\TestSessionListener' => $vendorDir . '/symfony/http-kernel/EventListener/TestSessionListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\TranslatorListener' => $vendorDir . '/symfony/http-kernel/EventListener/TranslatorListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\ValidateRequestListener' => $vendorDir . '/symfony/http-kernel/EventListener/ValidateRequestListener.php', + 'Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent' => $vendorDir . '/symfony/http-kernel/Event/FilterControllerEvent.php', + 'Symfony\\Component\\HttpKernel\\Event\\FilterResponseEvent' => $vendorDir . '/symfony/http-kernel/Event/FilterResponseEvent.php', + 'Symfony\\Component\\HttpKernel\\Event\\FinishRequestEvent' => $vendorDir . '/symfony/http-kernel/Event/FinishRequestEvent.php', + 'Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent' => $vendorDir . '/symfony/http-kernel/Event/GetResponseEvent.php', + 'Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent' => $vendorDir . '/symfony/http-kernel/Event/GetResponseForControllerResultEvent.php', + 'Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent' => $vendorDir . '/symfony/http-kernel/Event/GetResponseForExceptionEvent.php', + 'Symfony\\Component\\HttpKernel\\Event\\KernelEvent' => $vendorDir . '/symfony/http-kernel/Event/KernelEvent.php', + 'Symfony\\Component\\HttpKernel\\Event\\PostResponseEvent' => $vendorDir . '/symfony/http-kernel/Event/PostResponseEvent.php', + 'Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException' => $vendorDir . '/symfony/http-kernel/Exception/AccessDeniedHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException' => $vendorDir . '/symfony/http-kernel/Exception/BadRequestHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\ConflictHttpException' => $vendorDir . '/symfony/http-kernel/Exception/ConflictHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\GoneHttpException' => $vendorDir . '/symfony/http-kernel/Exception/GoneHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\HttpException' => $vendorDir . '/symfony/http-kernel/Exception/HttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\HttpExceptionInterface' => $vendorDir . '/symfony/http-kernel/Exception/HttpExceptionInterface.php', + 'Symfony\\Component\\HttpKernel\\Exception\\LengthRequiredHttpException' => $vendorDir . '/symfony/http-kernel/Exception/LengthRequiredHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException' => $vendorDir . '/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\NotAcceptableHttpException' => $vendorDir . '/symfony/http-kernel/Exception/NotAcceptableHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException' => $vendorDir . '/symfony/http-kernel/Exception/NotFoundHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\PreconditionFailedHttpException' => $vendorDir . '/symfony/http-kernel/Exception/PreconditionFailedHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\PreconditionRequiredHttpException' => $vendorDir . '/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\ServiceUnavailableHttpException' => $vendorDir . '/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\TooManyRequestsHttpException' => $vendorDir . '/symfony/http-kernel/Exception/TooManyRequestsHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\UnauthorizedHttpException' => $vendorDir . '/symfony/http-kernel/Exception/UnauthorizedHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\UnprocessableEntityHttpException' => $vendorDir . '/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\UnsupportedMediaTypeHttpException' => $vendorDir . '/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\AbstractSurrogateFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\EsiFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Fragment/EsiFragmentRenderer.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\FragmentHandler' => $vendorDir . '/symfony/http-kernel/Fragment/FragmentHandler.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface' => $vendorDir . '/symfony/http-kernel/Fragment/FragmentRendererInterface.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\HIncludeFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\InlineFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Fragment/InlineFragmentRenderer.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\RoutableFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\SsiFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Fragment/SsiFragmentRenderer.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\Esi' => $vendorDir . '/symfony/http-kernel/HttpCache/Esi.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\EsiResponseCacheStrategy' => $vendorDir . '/symfony/http-kernel/HttpCache/EsiResponseCacheStrategy.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\EsiResponseCacheStrategyInterface' => $vendorDir . '/symfony/http-kernel/HttpCache/EsiResponseCacheStrategyInterface.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache' => $vendorDir . '/symfony/http-kernel/HttpCache/HttpCache.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\ResponseCacheStrategy' => $vendorDir . '/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\ResponseCacheStrategyInterface' => $vendorDir . '/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\Ssi' => $vendorDir . '/symfony/http-kernel/HttpCache/Ssi.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\Store' => $vendorDir . '/symfony/http-kernel/HttpCache/Store.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\StoreInterface' => $vendorDir . '/symfony/http-kernel/HttpCache/StoreInterface.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\SubRequestHandler' => $vendorDir . '/symfony/http-kernel/HttpCache/SubRequestHandler.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\SurrogateInterface' => $vendorDir . '/symfony/http-kernel/HttpCache/SurrogateInterface.php', + 'Symfony\\Component\\HttpKernel\\HttpKernel' => $vendorDir . '/symfony/http-kernel/HttpKernel.php', + 'Symfony\\Component\\HttpKernel\\HttpKernelInterface' => $vendorDir . '/symfony/http-kernel/HttpKernelInterface.php', + 'Symfony\\Component\\HttpKernel\\Kernel' => $vendorDir . '/symfony/http-kernel/Kernel.php', + 'Symfony\\Component\\HttpKernel\\KernelEvents' => $vendorDir . '/symfony/http-kernel/KernelEvents.php', + 'Symfony\\Component\\HttpKernel\\KernelInterface' => $vendorDir . '/symfony/http-kernel/KernelInterface.php', + 'Symfony\\Component\\HttpKernel\\Log\\DebugLoggerInterface' => $vendorDir . '/symfony/http-kernel/Log/DebugLoggerInterface.php', + 'Symfony\\Component\\HttpKernel\\Log\\LoggerInterface' => $vendorDir . '/symfony/http-kernel/Log/LoggerInterface.php', + 'Symfony\\Component\\HttpKernel\\Log\\NullLogger' => $vendorDir . '/symfony/http-kernel/Log/NullLogger.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\BaseMemcacheProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/BaseMemcacheProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\FileProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/FileProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\MemcacheProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/MemcacheProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\MemcachedProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/MemcachedProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\MongoDbProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/MongoDbProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\MysqlProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/MysqlProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\PdoProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/PdoProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\Profile' => $vendorDir . '/symfony/http-kernel/Profiler/Profile.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\Profiler' => $vendorDir . '/symfony/http-kernel/Profiler/Profiler.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\ProfilerStorageInterface' => $vendorDir . '/symfony/http-kernel/Profiler/ProfilerStorageInterface.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\RedisProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/RedisProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\SqliteProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/SqliteProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\TerminableInterface' => $vendorDir . '/symfony/http-kernel/TerminableInterface.php', + 'Symfony\\Component\\HttpKernel\\UriSigner' => $vendorDir . '/symfony/http-kernel/UriSigner.php', + 'Symfony\\Component\\Process\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/process/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Process\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/process/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\Process\\Exception\\LogicException' => $vendorDir . '/symfony/process/Exception/LogicException.php', + 'Symfony\\Component\\Process\\Exception\\ProcessFailedException' => $vendorDir . '/symfony/process/Exception/ProcessFailedException.php', + 'Symfony\\Component\\Process\\Exception\\ProcessTimedOutException' => $vendorDir . '/symfony/process/Exception/ProcessTimedOutException.php', + 'Symfony\\Component\\Process\\Exception\\RuntimeException' => $vendorDir . '/symfony/process/Exception/RuntimeException.php', + 'Symfony\\Component\\Process\\ExecutableFinder' => $vendorDir . '/symfony/process/ExecutableFinder.php', + 'Symfony\\Component\\Process\\PhpExecutableFinder' => $vendorDir . '/symfony/process/PhpExecutableFinder.php', + 'Symfony\\Component\\Process\\PhpProcess' => $vendorDir . '/symfony/process/PhpProcess.php', + 'Symfony\\Component\\Process\\Pipes\\AbstractPipes' => $vendorDir . '/symfony/process/Pipes/AbstractPipes.php', + 'Symfony\\Component\\Process\\Pipes\\PipesInterface' => $vendorDir . '/symfony/process/Pipes/PipesInterface.php', + 'Symfony\\Component\\Process\\Pipes\\UnixPipes' => $vendorDir . '/symfony/process/Pipes/UnixPipes.php', + 'Symfony\\Component\\Process\\Pipes\\WindowsPipes' => $vendorDir . '/symfony/process/Pipes/WindowsPipes.php', + 'Symfony\\Component\\Process\\Process' => $vendorDir . '/symfony/process/Process.php', + 'Symfony\\Component\\Process\\ProcessBuilder' => $vendorDir . '/symfony/process/ProcessBuilder.php', + 'Symfony\\Component\\Process\\ProcessUtils' => $vendorDir . '/symfony/process/ProcessUtils.php', + 'Symfony\\Component\\Routing\\Annotation\\Route' => $vendorDir . '/symfony/routing/Annotation/Route.php', + 'Symfony\\Component\\Routing\\CompiledRoute' => $vendorDir . '/symfony/routing/CompiledRoute.php', + 'Symfony\\Component\\Routing\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/routing/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Routing\\Exception\\InvalidParameterException' => $vendorDir . '/symfony/routing/Exception/InvalidParameterException.php', + 'Symfony\\Component\\Routing\\Exception\\MethodNotAllowedException' => $vendorDir . '/symfony/routing/Exception/MethodNotAllowedException.php', + 'Symfony\\Component\\Routing\\Exception\\MissingMandatoryParametersException' => $vendorDir . '/symfony/routing/Exception/MissingMandatoryParametersException.php', + 'Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException' => $vendorDir . '/symfony/routing/Exception/ResourceNotFoundException.php', + 'Symfony\\Component\\Routing\\Exception\\RouteNotFoundException' => $vendorDir . '/symfony/routing/Exception/RouteNotFoundException.php', + 'Symfony\\Component\\Routing\\Generator\\ConfigurableRequirementsInterface' => $vendorDir . '/symfony/routing/Generator/ConfigurableRequirementsInterface.php', + 'Symfony\\Component\\Routing\\Generator\\Dumper\\GeneratorDumper' => $vendorDir . '/symfony/routing/Generator/Dumper/GeneratorDumper.php', + 'Symfony\\Component\\Routing\\Generator\\Dumper\\GeneratorDumperInterface' => $vendorDir . '/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php', + 'Symfony\\Component\\Routing\\Generator\\Dumper\\PhpGeneratorDumper' => $vendorDir . '/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php', + 'Symfony\\Component\\Routing\\Generator\\UrlGenerator' => $vendorDir . '/symfony/routing/Generator/UrlGenerator.php', + 'Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface' => $vendorDir . '/symfony/routing/Generator/UrlGeneratorInterface.php', + 'Symfony\\Component\\Routing\\Loader\\AnnotationClassLoader' => $vendorDir . '/symfony/routing/Loader/AnnotationClassLoader.php', + 'Symfony\\Component\\Routing\\Loader\\AnnotationDirectoryLoader' => $vendorDir . '/symfony/routing/Loader/AnnotationDirectoryLoader.php', + 'Symfony\\Component\\Routing\\Loader\\AnnotationFileLoader' => $vendorDir . '/symfony/routing/Loader/AnnotationFileLoader.php', + 'Symfony\\Component\\Routing\\Loader\\ClosureLoader' => $vendorDir . '/symfony/routing/Loader/ClosureLoader.php', + 'Symfony\\Component\\Routing\\Loader\\PhpFileLoader' => $vendorDir . '/symfony/routing/Loader/PhpFileLoader.php', + 'Symfony\\Component\\Routing\\Loader\\RecursiveCallbackFilterIterator' => $vendorDir . '/symfony/routing/Loader/AnnotationDirectoryLoader.php', + 'Symfony\\Component\\Routing\\Loader\\XmlFileLoader' => $vendorDir . '/symfony/routing/Loader/XmlFileLoader.php', + 'Symfony\\Component\\Routing\\Loader\\YamlFileLoader' => $vendorDir . '/symfony/routing/Loader/YamlFileLoader.php', + 'Symfony\\Component\\Routing\\Matcher\\ApacheUrlMatcher' => $vendorDir . '/symfony/routing/Matcher/ApacheUrlMatcher.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\ApacheMatcherDumper' => $vendorDir . '/symfony/routing/Matcher/Dumper/ApacheMatcherDumper.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperCollection' => $vendorDir . '/symfony/routing/Matcher/Dumper/DumperCollection.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperPrefixCollection' => $vendorDir . '/symfony/routing/Matcher/Dumper/DumperPrefixCollection.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperRoute' => $vendorDir . '/symfony/routing/Matcher/Dumper/DumperRoute.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\MatcherDumper' => $vendorDir . '/symfony/routing/Matcher/Dumper/MatcherDumper.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\MatcherDumperInterface' => $vendorDir . '/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\PhpMatcherDumper' => $vendorDir . '/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php', + 'Symfony\\Component\\Routing\\Matcher\\RedirectableUrlMatcher' => $vendorDir . '/symfony/routing/Matcher/RedirectableUrlMatcher.php', + 'Symfony\\Component\\Routing\\Matcher\\RedirectableUrlMatcherInterface' => $vendorDir . '/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php', + 'Symfony\\Component\\Routing\\Matcher\\RequestMatcherInterface' => $vendorDir . '/symfony/routing/Matcher/RequestMatcherInterface.php', + 'Symfony\\Component\\Routing\\Matcher\\TraceableUrlMatcher' => $vendorDir . '/symfony/routing/Matcher/TraceableUrlMatcher.php', + 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher' => $vendorDir . '/symfony/routing/Matcher/UrlMatcher.php', + 'Symfony\\Component\\Routing\\Matcher\\UrlMatcherInterface' => $vendorDir . '/symfony/routing/Matcher/UrlMatcherInterface.php', + 'Symfony\\Component\\Routing\\RequestContext' => $vendorDir . '/symfony/routing/RequestContext.php', + 'Symfony\\Component\\Routing\\RequestContextAwareInterface' => $vendorDir . '/symfony/routing/RequestContextAwareInterface.php', + 'Symfony\\Component\\Routing\\Route' => $vendorDir . '/symfony/routing/Route.php', + 'Symfony\\Component\\Routing\\RouteCollection' => $vendorDir . '/symfony/routing/RouteCollection.php', + 'Symfony\\Component\\Routing\\RouteCompiler' => $vendorDir . '/symfony/routing/RouteCompiler.php', + 'Symfony\\Component\\Routing\\RouteCompilerInterface' => $vendorDir . '/symfony/routing/RouteCompilerInterface.php', + 'Symfony\\Component\\Routing\\Router' => $vendorDir . '/symfony/routing/Router.php', + 'Symfony\\Component\\Routing\\RouterInterface' => $vendorDir . '/symfony/routing/RouterInterface.php', + 'Symfony\\Component\\Translation\\Catalogue\\AbstractOperation' => $vendorDir . '/symfony/translation/Catalogue/AbstractOperation.php', + 'Symfony\\Component\\Translation\\Catalogue\\DiffOperation' => $vendorDir . '/symfony/translation/Catalogue/DiffOperation.php', + 'Symfony\\Component\\Translation\\Catalogue\\MergeOperation' => $vendorDir . '/symfony/translation/Catalogue/MergeOperation.php', + 'Symfony\\Component\\Translation\\Catalogue\\OperationInterface' => $vendorDir . '/symfony/translation/Catalogue/OperationInterface.php', + 'Symfony\\Component\\Translation\\DataCollectorTranslator' => $vendorDir . '/symfony/translation/DataCollectorTranslator.php', + 'Symfony\\Component\\Translation\\DataCollector\\TranslationDataCollector' => $vendorDir . '/symfony/translation/DataCollector/TranslationDataCollector.php', + 'Symfony\\Component\\Translation\\Dumper\\CsvFileDumper' => $vendorDir . '/symfony/translation/Dumper/CsvFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\DumperInterface' => $vendorDir . '/symfony/translation/Dumper/DumperInterface.php', + 'Symfony\\Component\\Translation\\Dumper\\FileDumper' => $vendorDir . '/symfony/translation/Dumper/FileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\IcuResFileDumper' => $vendorDir . '/symfony/translation/Dumper/IcuResFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\IniFileDumper' => $vendorDir . '/symfony/translation/Dumper/IniFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\JsonFileDumper' => $vendorDir . '/symfony/translation/Dumper/JsonFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\MoFileDumper' => $vendorDir . '/symfony/translation/Dumper/MoFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\PhpFileDumper' => $vendorDir . '/symfony/translation/Dumper/PhpFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\PoFileDumper' => $vendorDir . '/symfony/translation/Dumper/PoFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\QtFileDumper' => $vendorDir . '/symfony/translation/Dumper/QtFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\XliffFileDumper' => $vendorDir . '/symfony/translation/Dumper/XliffFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\YamlFileDumper' => $vendorDir . '/symfony/translation/Dumper/YamlFileDumper.php', + 'Symfony\\Component\\Translation\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/translation/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Translation\\Exception\\InvalidResourceException' => $vendorDir . '/symfony/translation/Exception/InvalidResourceException.php', + 'Symfony\\Component\\Translation\\Exception\\NotFoundResourceException' => $vendorDir . '/symfony/translation/Exception/NotFoundResourceException.php', + 'Symfony\\Component\\Translation\\Extractor\\AbstractFileExtractor' => $vendorDir . '/symfony/translation/Extractor/AbstractFileExtractor.php', + 'Symfony\\Component\\Translation\\Extractor\\ChainExtractor' => $vendorDir . '/symfony/translation/Extractor/ChainExtractor.php', + 'Symfony\\Component\\Translation\\Extractor\\ExtractorInterface' => $vendorDir . '/symfony/translation/Extractor/ExtractorInterface.php', + 'Symfony\\Component\\Translation\\IdentityTranslator' => $vendorDir . '/symfony/translation/IdentityTranslator.php', + 'Symfony\\Component\\Translation\\Interval' => $vendorDir . '/symfony/translation/Interval.php', + 'Symfony\\Component\\Translation\\Loader\\ArrayLoader' => $vendorDir . '/symfony/translation/Loader/ArrayLoader.php', + 'Symfony\\Component\\Translation\\Loader\\CsvFileLoader' => $vendorDir . '/symfony/translation/Loader/CsvFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\IcuDatFileLoader' => $vendorDir . '/symfony/translation/Loader/IcuDatFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\IcuResFileLoader' => $vendorDir . '/symfony/translation/Loader/IcuResFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\IniFileLoader' => $vendorDir . '/symfony/translation/Loader/IniFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\JsonFileLoader' => $vendorDir . '/symfony/translation/Loader/JsonFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\LoaderInterface' => $vendorDir . '/symfony/translation/Loader/LoaderInterface.php', + 'Symfony\\Component\\Translation\\Loader\\MoFileLoader' => $vendorDir . '/symfony/translation/Loader/MoFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\PhpFileLoader' => $vendorDir . '/symfony/translation/Loader/PhpFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\PoFileLoader' => $vendorDir . '/symfony/translation/Loader/PoFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\QtFileLoader' => $vendorDir . '/symfony/translation/Loader/QtFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\XliffFileLoader' => $vendorDir . '/symfony/translation/Loader/XliffFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\YamlFileLoader' => $vendorDir . '/symfony/translation/Loader/YamlFileLoader.php', + 'Symfony\\Component\\Translation\\LoggingTranslator' => $vendorDir . '/symfony/translation/LoggingTranslator.php', + 'Symfony\\Component\\Translation\\MessageCatalogue' => $vendorDir . '/symfony/translation/MessageCatalogue.php', + 'Symfony\\Component\\Translation\\MessageCatalogueInterface' => $vendorDir . '/symfony/translation/MessageCatalogueInterface.php', + 'Symfony\\Component\\Translation\\MessageSelector' => $vendorDir . '/symfony/translation/MessageSelector.php', + 'Symfony\\Component\\Translation\\MetadataAwareInterface' => $vendorDir . '/symfony/translation/MetadataAwareInterface.php', + 'Symfony\\Component\\Translation\\PluralizationRules' => $vendorDir . '/symfony/translation/PluralizationRules.php', + 'Symfony\\Component\\Translation\\Translator' => $vendorDir . '/symfony/translation/Translator.php', + 'Symfony\\Component\\Translation\\TranslatorBagInterface' => $vendorDir . '/symfony/translation/TranslatorBagInterface.php', + 'Symfony\\Component\\Translation\\TranslatorInterface' => $vendorDir . '/symfony/translation/TranslatorInterface.php', + 'Symfony\\Component\\Translation\\Writer\\TranslationWriter' => $vendorDir . '/symfony/translation/Writer/TranslationWriter.php', + 'Symfony\\Component\\VarDumper\\Caster\\AmqpCaster' => $vendorDir . '/symfony/var-dumper/Caster/AmqpCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\Caster' => $vendorDir . '/symfony/var-dumper/Caster/Caster.php', + 'Symfony\\Component\\VarDumper\\Caster\\ConstStub' => $vendorDir . '/symfony/var-dumper/Caster/ConstStub.php', + 'Symfony\\Component\\VarDumper\\Caster\\CutStub' => $vendorDir . '/symfony/var-dumper/Caster/CutStub.php', + 'Symfony\\Component\\VarDumper\\Caster\\DOMCaster' => $vendorDir . '/symfony/var-dumper/Caster/DOMCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\DoctrineCaster' => $vendorDir . '/symfony/var-dumper/Caster/DoctrineCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\ExceptionCaster' => $vendorDir . '/symfony/var-dumper/Caster/ExceptionCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\MongoCaster' => $vendorDir . '/symfony/var-dumper/Caster/MongoCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\PdoCaster' => $vendorDir . '/symfony/var-dumper/Caster/PdoCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\ReflectionCaster' => $vendorDir . '/symfony/var-dumper/Caster/ReflectionCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\ResourceCaster' => $vendorDir . '/symfony/var-dumper/Caster/ResourceCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\SplCaster' => $vendorDir . '/symfony/var-dumper/Caster/SplCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\StubCaster' => $vendorDir . '/symfony/var-dumper/Caster/StubCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\XmlResourceCaster' => $vendorDir . '/symfony/var-dumper/Caster/XmlResourceCaster.php', + 'Symfony\\Component\\VarDumper\\Cloner\\AbstractCloner' => $vendorDir . '/symfony/var-dumper/Cloner/AbstractCloner.php', + 'Symfony\\Component\\VarDumper\\Cloner\\ClonerInterface' => $vendorDir . '/symfony/var-dumper/Cloner/ClonerInterface.php', + 'Symfony\\Component\\VarDumper\\Cloner\\Cursor' => $vendorDir . '/symfony/var-dumper/Cloner/Cursor.php', + 'Symfony\\Component\\VarDumper\\Cloner\\Data' => $vendorDir . '/symfony/var-dumper/Cloner/Data.php', + 'Symfony\\Component\\VarDumper\\Cloner\\DumperInterface' => $vendorDir . '/symfony/var-dumper/Cloner/DumperInterface.php', + 'Symfony\\Component\\VarDumper\\Cloner\\Stub' => $vendorDir . '/symfony/var-dumper/Cloner/Stub.php', + 'Symfony\\Component\\VarDumper\\Cloner\\VarCloner' => $vendorDir . '/symfony/var-dumper/Cloner/VarCloner.php', + 'Symfony\\Component\\VarDumper\\Dumper\\AbstractDumper' => $vendorDir . '/symfony/var-dumper/Dumper/AbstractDumper.php', + 'Symfony\\Component\\VarDumper\\Dumper\\CliDumper' => $vendorDir . '/symfony/var-dumper/Dumper/CliDumper.php', + 'Symfony\\Component\\VarDumper\\Dumper\\DataDumperInterface' => $vendorDir . '/symfony/var-dumper/Dumper/DataDumperInterface.php', + 'Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper' => $vendorDir . '/symfony/var-dumper/Dumper/HtmlDumper.php', + 'Symfony\\Component\\VarDumper\\Exception\\ThrowingCasterException' => $vendorDir . '/symfony/var-dumper/Exception/ThrowingCasterException.php', + 'Symfony\\Component\\VarDumper\\Test\\VarDumperTestCase' => $vendorDir . '/symfony/var-dumper/Test/VarDumperTestCase.php', + 'Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait' => $vendorDir . '/symfony/var-dumper/Test/VarDumperTestTrait.php', + 'Symfony\\Component\\VarDumper\\VarDumper' => $vendorDir . '/symfony/var-dumper/VarDumper.php', + 'Symfony\\Polyfill\\Ctype\\Ctype' => $vendorDir . '/symfony/polyfill-ctype/Ctype.php', + 'Symfony\\Polyfill\\Mbstring\\Mbstring' => $vendorDir . '/symfony/polyfill-mbstring/Mbstring.php', 'Symfony\\Polyfill\\Php56\\Php56' => $vendorDir . '/symfony/polyfill-php56/Php56.php', 'Symfony\\Polyfill\\Util\\Binary' => $vendorDir . '/symfony/polyfill-util/Binary.php', 'Symfony\\Polyfill\\Util\\BinaryNoFuncOverload' => $vendorDir . '/symfony/polyfill-util/BinaryNoFuncOverload.php', 'Symfony\\Polyfill\\Util\\BinaryOnFuncOverload' => $vendorDir . '/symfony/polyfill-util/BinaryOnFuncOverload.php', 'Symfony\\Polyfill\\Util\\TestListener' => $vendorDir . '/symfony/polyfill-util/TestListener.php', + 'Symfony\\Polyfill\\Util\\TestListenerForV5' => $vendorDir . '/symfony/polyfill-util/TestListenerForV5.php', + 'Symfony\\Polyfill\\Util\\TestListenerForV6' => $vendorDir . '/symfony/polyfill-util/TestListenerForV6.php', + 'Symfony\\Polyfill\\Util\\TestListenerForV7' => $vendorDir . '/symfony/polyfill-util/TestListenerForV7.php', + 'Symfony\\Polyfill\\Util\\TestListenerTrait' => $vendorDir . '/symfony/polyfill-util/TestListenerTrait.php', + 'UpdateHelper\\ComposerPlugin' => $vendorDir . '/kylekatarnls/update-helper/src/UpdateHelper/ComposerPlugin.php', + 'UpdateHelper\\NotUpdateInterfaceInstanceException' => $vendorDir . '/kylekatarnls/update-helper/src/UpdateHelper/NotUpdateInterfaceInstanceException.php', + 'UpdateHelper\\UpdateHelper' => $vendorDir . '/kylekatarnls/update-helper/src/UpdateHelper/UpdateHelper.php', + 'UpdateHelper\\UpdateHelperInterface' => $vendorDir . '/kylekatarnls/update-helper/src/UpdateHelper/UpdateHelperInterface.php', 'XdgBaseDir\\Xdg' => $vendorDir . '/dnoegel/php-xdg-base-dir/src/Xdg.php', ); diff --git a/application/vendor/composer/autoload_files.php b/application/vendor/composer/autoload_files.php index d472715..e382886 100644 --- a/application/vendor/composer/autoload_files.php +++ b/application/vendor/composer/autoload_files.php @@ -6,14 +6,15 @@ $baseDir = dirname($vendorDir); return array( - '6fac04860a2cf4b03e356f4caca377d6' => $vendorDir . '/symfony/var-dumper/Symfony/Component/VarDumper/Resources/functions/dump.php', - '742cc5b936ec765a3455c0a976796f29' => $vendorDir . '/nikic/php-parser/lib/bootstrap.php', - '05669301f06448944ce5eb260126f84e' => $vendorDir . '/ircmaxell/password-compat/lib/password.php', - '01b872096dad055849387e42d41a176d' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php', - 'e87a3015738447d44bc0516cb3cdcd72' => $vendorDir . '/symfony/polyfill-php56/bootstrap.php', - 'da0e56e38d387da6d4174d0dd783cafd' => $vendorDir . '/psy/psysh/src/Psy/functions.php', - '9b24cdf6705c981dc519077514baadf4' => $vendorDir . '/danielstjules/stringy/src/Create.php', - '8c9698b305e308ed34201edf1f3c1e48' => $vendorDir . '/illuminate/html/helpers.php', - '1078299014c0119b5037eeb7efc1d1de' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/helpers.php', - '183ed00ee3916a78840c7d11bba9bb86' => $vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', + '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', + '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', + '2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php', + 'bd9634f2d41831496de0d3dfe4c94881' => $vendorDir . '/symfony/polyfill-php56/bootstrap.php', + '65fec9ebcfbb3cbb4fd0d519687aea01' => $vendorDir . '/danielstjules/stringy/src/Create.php', + '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php', + 'e7223560d890eab89cda23685e711e2c' => $vendorDir . '/psy/psysh/src/Psy/functions.php', + 'f0906e6318348a765ffb6eb24e0d0938' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/helpers.php', + '58571171fd5812e6e447dce228f52f4d' => $vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php', + 'f18cc91337d49233e5754e93f3ed9ec3' => $vendorDir . '/laravelcollective/html/src/helpers.php', ); diff --git a/application/vendor/composer/autoload_namespaces.php b/application/vendor/composer/autoload_namespaces.php index ab29a44..de88cac 100644 --- a/application/vendor/composer/autoload_namespaces.php +++ b/application/vendor/composer/autoload_namespaces.php @@ -6,21 +6,7 @@ $baseDir = dirname($vendorDir); return array( - 'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'), - 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), - 'Symfony\\Component\\Security\\Core\\' => array($vendorDir . '/symfony/security-core'), - 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), - 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'), - 'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'), - 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), - 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'), - 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'), - 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'), - 'Psy\\' => array($vendorDir . '/psy/psysh/src'), - 'Psr\\Log\\' => array($vendorDir . '/psr/log'), + 'UpdateHelper\\' => array($vendorDir . '/kylekatarnls/update-helper/src'), 'JakubOnderka\\PhpConsoleHighlighter' => array($vendorDir . '/jakub-onderka/php-console-highlighter/src'), - 'JakubOnderka\\PhpConsoleColor' => array($vendorDir . '/jakub-onderka/php-console-color/src'), 'Dotenv' => array($vendorDir . '/vlucas/phpdotenv/src'), - 'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib'), - 'Cron' => array($vendorDir . '/mtdowling/cron-expression/src'), ); diff --git a/application/vendor/composer/autoload_psr4.php b/application/vendor/composer/autoload_psr4.php index 4015cfb..b546906 100644 --- a/application/vendor/composer/autoload_psr4.php +++ b/application/vendor/composer/autoload_psr4.php @@ -9,15 +9,33 @@ 'XdgBaseDir\\' => array($vendorDir . '/dnoegel/php-xdg-base-dir/src'), 'Symfony\\Polyfill\\Util\\' => array($vendorDir . '/symfony/polyfill-util'), 'Symfony\\Polyfill\\Php56\\' => array($vendorDir . '/symfony/polyfill-php56'), - 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'), + 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), + 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), + 'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'), + 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), + 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), + 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'), + 'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'), + 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), + 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'), 'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'), - 'SuperClosure\\' => array($vendorDir . '/jeremeamia/SuperClosure/src'), + 'Symfony\\Component\\DomCrawler\\' => array($vendorDir . '/symfony/dom-crawler'), + 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'), + 'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'), + 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'), + 'SuperClosure\\' => array($vendorDir . '/jeremeamia/superclosure/src'), 'Stringy\\' => array($vendorDir . '/danielstjules/stringy/src'), + 'Psy\\' => array($vendorDir . '/psy/psysh/src/Psy'), + 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), + 'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'), 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), 'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'), - 'Illuminate\\Html\\' => array($vendorDir . '/illuminate/html'), + 'JakubOnderka\\PhpConsoleColor\\' => array($vendorDir . '/jakub-onderka/php-console-color/src'), 'Illuminate\\' => array($vendorDir . '/laravel/framework/src/Illuminate'), + 'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Common/Inflector'), + 'Cron\\' => array($vendorDir . '/mtdowling/cron-expression/src/Cron'), + 'Collective\\Html\\' => array($vendorDir . '/laravelcollective/html/src'), 'ClassPreloader\\' => array($vendorDir . '/classpreloader/classpreloader/src'), - 'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'), 'App\\' => array($baseDir . '/app'), + '' => array($vendorDir . '/nesbot/carbon/src'), ); diff --git a/application/vendor/composer/autoload_real.php b/application/vendor/composer/autoload_real.php index 8825de4..4b0dd32 100644 --- a/application/vendor/composer/autoload_real.php +++ b/application/vendor/composer/autoload_real.php @@ -23,24 +23,35 @@ public static function getLoader() self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit43265f891b9f29a025a40de9ffd797c4', 'loadClassLoader')); - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } + $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } + call_user_func(\Composer\Autoload\ComposerStaticInit43265f891b9f29a025a40de9ffd797c4::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } } $loader->register(true); - $includeFiles = require __DIR__ . '/autoload_files.php'; + if ($useStaticLoader) { + $includeFiles = Composer\Autoload\ComposerStaticInit43265f891b9f29a025a40de9ffd797c4::$files; + } else { + $includeFiles = require __DIR__ . '/autoload_files.php'; + } foreach ($includeFiles as $fileIdentifier => $file) { composerRequire43265f891b9f29a025a40de9ffd797c4($fileIdentifier, $file); } diff --git a/application/vendor/composer/autoload_static.php b/application/vendor/composer/autoload_static.php new file mode 100644 index 0000000..0b4aad4 --- /dev/null +++ b/application/vendor/composer/autoload_static.php @@ -0,0 +1,1879 @@ + __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', + '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', + '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', + '2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php', + 'bd9634f2d41831496de0d3dfe4c94881' => __DIR__ . '/..' . '/symfony/polyfill-php56/bootstrap.php', + '65fec9ebcfbb3cbb4fd0d519687aea01' => __DIR__ . '/..' . '/danielstjules/stringy/src/Create.php', + '5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php', + 'e7223560d890eab89cda23685e711e2c' => __DIR__ . '/..' . '/psy/psysh/src/Psy/functions.php', + 'f0906e6318348a765ffb6eb24e0d0938' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/helpers.php', + '58571171fd5812e6e447dce228f52f4d' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/helpers.php', + 'f18cc91337d49233e5754e93f3ed9ec3' => __DIR__ . '/..' . '/laravelcollective/html/src/helpers.php', + ); + + public static $prefixLengthsPsr4 = array ( + 'X' => + array ( + 'XdgBaseDir\\' => 11, + ), + 'S' => + array ( + 'Symfony\\Polyfill\\Util\\' => 22, + 'Symfony\\Polyfill\\Php56\\' => 23, + 'Symfony\\Polyfill\\Mbstring\\' => 26, + 'Symfony\\Polyfill\\Ctype\\' => 23, + 'Symfony\\Component\\VarDumper\\' => 28, + 'Symfony\\Component\\Translation\\' => 30, + 'Symfony\\Component\\Routing\\' => 26, + 'Symfony\\Component\\Process\\' => 26, + 'Symfony\\Component\\HttpKernel\\' => 29, + 'Symfony\\Component\\HttpFoundation\\' => 33, + 'Symfony\\Component\\Finder\\' => 25, + 'Symfony\\Component\\EventDispatcher\\' => 34, + 'Symfony\\Component\\DomCrawler\\' => 29, + 'Symfony\\Component\\Debug\\' => 24, + 'Symfony\\Component\\CssSelector\\' => 30, + 'Symfony\\Component\\Console\\' => 26, + 'SuperClosure\\' => 13, + 'Stringy\\' => 8, + ), + 'P' => + array ( + 'Psy\\' => 4, + 'Psr\\Log\\' => 8, + 'PhpParser\\' => 10, + ), + 'M' => + array ( + 'Monolog\\' => 8, + ), + 'L' => + array ( + 'League\\Flysystem\\' => 17, + ), + 'J' => + array ( + 'JakubOnderka\\PhpConsoleColor\\' => 29, + ), + 'I' => + array ( + 'Illuminate\\' => 11, + ), + 'D' => + array ( + 'Doctrine\\Common\\Inflector\\' => 26, + ), + 'C' => + array ( + 'Cron\\' => 5, + 'Collective\\Html\\' => 16, + 'ClassPreloader\\' => 15, + ), + 'A' => + array ( + 'App\\' => 4, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'XdgBaseDir\\' => + array ( + 0 => __DIR__ . '/..' . '/dnoegel/php-xdg-base-dir/src', + ), + 'Symfony\\Polyfill\\Util\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-util', + ), + 'Symfony\\Polyfill\\Php56\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php56', + ), + 'Symfony\\Polyfill\\Mbstring\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', + ), + 'Symfony\\Polyfill\\Ctype\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', + ), + 'Symfony\\Component\\VarDumper\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/var-dumper', + ), + 'Symfony\\Component\\Translation\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/translation', + ), + 'Symfony\\Component\\Routing\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/routing', + ), + 'Symfony\\Component\\Process\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/process', + ), + 'Symfony\\Component\\HttpKernel\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/http-kernel', + ), + 'Symfony\\Component\\HttpFoundation\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/http-foundation', + ), + 'Symfony\\Component\\Finder\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/finder', + ), + 'Symfony\\Component\\EventDispatcher\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/event-dispatcher', + ), + 'Symfony\\Component\\DomCrawler\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/dom-crawler', + ), + 'Symfony\\Component\\Debug\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/debug', + ), + 'Symfony\\Component\\CssSelector\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/css-selector', + ), + 'Symfony\\Component\\Console\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/console', + ), + 'SuperClosure\\' => + array ( + 0 => __DIR__ . '/..' . '/jeremeamia/superclosure/src', + ), + 'Stringy\\' => + array ( + 0 => __DIR__ . '/..' . '/danielstjules/stringy/src', + ), + 'Psy\\' => + array ( + 0 => __DIR__ . '/..' . '/psy/psysh/src/Psy', + ), + 'Psr\\Log\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', + ), + 'PhpParser\\' => + array ( + 0 => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser', + ), + 'Monolog\\' => + array ( + 0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog', + ), + 'League\\Flysystem\\' => + array ( + 0 => __DIR__ . '/..' . '/league/flysystem/src', + ), + 'JakubOnderka\\PhpConsoleColor\\' => + array ( + 0 => __DIR__ . '/..' . '/jakub-onderka/php-console-color/src', + ), + 'Illuminate\\' => + array ( + 0 => __DIR__ . '/..' . '/laravel/framework/src/Illuminate', + ), + 'Doctrine\\Common\\Inflector\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/inflector/lib/Doctrine/Common/Inflector', + ), + 'Cron\\' => + array ( + 0 => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron', + ), + 'Collective\\Html\\' => + array ( + 0 => __DIR__ . '/..' . '/laravelcollective/html/src', + ), + 'ClassPreloader\\' => + array ( + 0 => __DIR__ . '/..' . '/classpreloader/classpreloader/src', + ), + 'App\\' => + array ( + 0 => __DIR__ . '/../..' . '/app', + ), + ); + + public static $fallbackDirsPsr4 = array ( + 0 => __DIR__ . '/..' . '/nesbot/carbon/src', + ); + + public static $prefixesPsr0 = array ( + 'U' => + array ( + 'UpdateHelper\\' => + array ( + 0 => __DIR__ . '/..' . '/kylekatarnls/update-helper/src', + ), + ), + 'J' => + array ( + 'JakubOnderka\\PhpConsoleHighlighter' => + array ( + 0 => __DIR__ . '/..' . '/jakub-onderka/php-console-highlighter/src', + ), + ), + 'D' => + array ( + 'Dotenv' => + array ( + 0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src', + ), + ), + ); + + public static $classMap = array ( + 'App\\Commands\\Command' => __DIR__ . '/../..' . '/app/Commands/Command.php', + 'App\\Console\\Commands\\Inspire' => __DIR__ . '/../..' . '/app/Console/Commands/Inspire.php', + 'App\\Console\\Kernel' => __DIR__ . '/../..' . '/app/Console/Kernel.php', + 'App\\Events\\Event' => __DIR__ . '/../..' . '/app/Events/Event.php', + 'App\\Exceptions\\Handler' => __DIR__ . '/../..' . '/app/Exceptions/Handler.php', + 'App\\Http\\Controllers\\AdminController' => __DIR__ . '/../..' . '/app/Http/Controllers/AdminController.php', + 'App\\Http\\Controllers\\ApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/ApiController.php', + 'App\\Http\\Controllers\\Auth\\AuthController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/AuthController.php', + 'App\\Http\\Controllers\\Auth\\PasswordController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/PasswordController.php', + 'App\\Http\\Controllers\\ConfigurationController' => __DIR__ . '/../..' . '/app/Http/Controllers/ConfigurationController.php', + 'App\\Http\\Controllers\\Controller' => __DIR__ . '/../..' . '/app/Http/Controllers/Controller.php', + 'App\\Http\\Controllers\\InstallController' => __DIR__ . '/../..' . '/app/Http/Controllers/InstallController.php', + 'App\\Http\\Controllers\\PlayerAdminController' => __DIR__ . '/../..' . '/app/Http/Controllers/PlayerAdminController.php', + 'App\\Http\\Controllers\\PlayerBanController' => __DIR__ . '/../..' . '/app/Http/Controllers/PlayerBanController.php', + 'App\\Http\\Controllers\\PlayerBanRecordController' => __DIR__ . '/../..' . '/app/Http/Controllers/PlayerBanRecordController.php', + 'App\\Http\\Controllers\\PlayerController' => __DIR__ . '/../..' . '/app/Http/Controllers/PlayerController.php', + 'App\\Http\\Controllers\\PlayerKickController' => __DIR__ . '/../..' . '/app/Http/Controllers/PlayerKickController.php', + 'App\\Http\\Controllers\\PlayerMuteController' => __DIR__ . '/../..' . '/app/Http/Controllers/PlayerMuteController.php', + 'App\\Http\\Controllers\\PlayerMuteRecordController' => __DIR__ . '/../..' . '/app/Http/Controllers/PlayerMuteRecordController.php', + 'App\\Http\\Controllers\\PlayerNoteController' => __DIR__ . '/../..' . '/app/Http/Controllers/PlayerNoteController.php', + 'App\\Http\\Controllers\\PlayerWarningController' => __DIR__ . '/../..' . '/app/Http/Controllers/PlayerWarningController.php', + 'App\\Http\\Controllers\\ServerController' => __DIR__ . '/../..' . '/app/Http/Controllers/ServerController.php', + 'App\\Http\\Controllers\\StaticPageController' => __DIR__ . '/../..' . '/app/Http/Controllers/StaticPageController.php', + 'App\\Http\\Controllers\\StatsController' => __DIR__ . '/../..' . '/app/Http/Controllers/StatsController.php', + 'App\\Http\\Controllers\\UserController' => __DIR__ . '/../..' . '/app/Http/Controllers/UserController.php', + 'App\\Http\\Kernel' => __DIR__ . '/../..' . '/app/Http/Kernel.php', + 'App\\Http\\Middleware\\AdminAuthenticate' => __DIR__ . '/../..' . '/app/Http/Middleware/AdminAuthenticate.php', + 'App\\Http\\Middleware\\Authenticate' => __DIR__ . '/../..' . '/app/Http/Middleware/Authenticate.php', + 'App\\Http\\Middleware\\ModeratorAuthenticate' => __DIR__ . '/../..' . '/app/Http/Middleware/ModeratorAuthenticate.php', + 'App\\Http\\Middleware\\RedirectIfAuthenticated' => __DIR__ . '/../..' . '/app/Http/Middleware/RedirectIfAuthenticated.php', + 'App\\Http\\Middleware\\SuperuserAuthenticate' => __DIR__ . '/../..' . '/app/Http/Middleware/SuperuserAuthenticate.php', + 'App\\Http\\Middleware\\VerifyCsrfToken' => __DIR__ . '/../..' . '/app/Http/Middleware/VerifyCsrfToken.php', + 'App\\Http\\Middleware\\VerifyInstalled' => __DIR__ . '/../..' . '/app/Http/Middleware/VerifyInstalled.php', + 'App\\Http\\Middleware\\VerifyNotInstalled' => __DIR__ . '/../..' . '/app/Http/Middleware/VerifyNotInstalled.php', + 'App\\Http\\Middleware\\VerifyServers' => __DIR__ . '/../..' . '/app/Http/Middleware/VerifyServers.php', + 'App\\Http\\Requests\\Request' => __DIR__ . '/../..' . '/app/Http/Requests/Request.php', + 'App\\IpBan' => __DIR__ . '/../..' . '/app/IpBan.php', + 'App\\IpBanRecord' => __DIR__ . '/../..' . '/app/IpBanRecord.php', + 'App\\PastRecordBaseModel' => __DIR__ . '/../..' . '/app/PastRecordBaseModel.php', + 'App\\Player' => __DIR__ . '/../..' . '/app/Player.php', + 'App\\PlayerBan' => __DIR__ . '/../..' . '/app/PlayerBan.php', + 'App\\PlayerBanRecord' => __DIR__ . '/../..' . '/app/PlayerBanRecord.php', + 'App\\PlayerKick' => __DIR__ . '/../..' . '/app/PlayerKick.php', + 'App\\PlayerMute' => __DIR__ . '/../..' . '/app/PlayerMute.php', + 'App\\PlayerMuteRecord' => __DIR__ . '/../..' . '/app/PlayerMuteRecord.php', + 'App\\PlayerNote' => __DIR__ . '/../..' . '/app/PlayerNote.php', + 'App\\PlayerWarning' => __DIR__ . '/../..' . '/app/PlayerWarning.php', + 'App\\Providers\\AppServiceProvider' => __DIR__ . '/../..' . '/app/Providers/AppServiceProvider.php', + 'App\\Providers\\BusServiceProvider' => __DIR__ . '/../..' . '/app/Providers/BusServiceProvider.php', + 'App\\Providers\\ConfigServiceProvider' => __DIR__ . '/../..' . '/app/Providers/ConfigServiceProvider.php', + 'App\\Providers\\EventServiceProvider' => __DIR__ . '/../..' . '/app/Providers/EventServiceProvider.php', + 'App\\Providers\\HelperServiceProvider' => __DIR__ . '/../..' . '/app/Providers/HelperServiceProvider.php', + 'App\\Providers\\RouteServiceProvider' => __DIR__ . '/../..' . '/app/Providers/RouteServiceProvider.php', + 'App\\RecordBaseModel' => __DIR__ . '/../..' . '/app/RecordBaseModel.php', + 'App\\Server' => __DIR__ . '/../..' . '/app/Server.php', + 'App\\Services\\Registrar' => __DIR__ . '/../..' . '/app/Services/Registrar.php', + 'App\\User' => __DIR__ . '/../..' . '/app/User.php', + 'Carbon\\Carbon' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Carbon.php', + 'Carbon\\CarbonInterval' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/CarbonInterval.php', + 'Carbon\\CarbonPeriod' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/CarbonPeriod.php', + 'Carbon\\Exceptions\\InvalidDateException' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php', + 'Carbon\\Laravel\\ServiceProvider' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php', + 'Carbon\\Translator' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Translator.php', + 'Carbon\\Upgrade' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Upgrade.php', + 'ClassPreloader\\ClassList' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/ClassList.php', + 'ClassPreloader\\ClassLoader' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/ClassLoader.php', + 'ClassPreloader\\ClassNode' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/ClassNode.php', + 'ClassPreloader\\ClassPreloader' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/ClassPreloader.php', + 'ClassPreloader\\Config' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/Config.php', + 'ClassPreloader\\Exceptions\\DirConstantException' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/Exceptions/DirConstantException.php', + 'ClassPreloader\\Exceptions\\FileConstantException' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/Exceptions/FileConstantException.php', + 'ClassPreloader\\Exceptions\\StrictTypesException' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/Exceptions/StrictTypesException.php', + 'ClassPreloader\\Exceptions\\VisitorExceptionInterface' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/Exceptions/VisitorExceptionInterface.php', + 'ClassPreloader\\Factory' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/Factory.php', + 'ClassPreloader\\Parser\\AbstractNodeVisitor' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/Parser/AbstractNodeVisitor.php', + 'ClassPreloader\\Parser\\DirVisitor' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/Parser/DirVisitor.php', + 'ClassPreloader\\Parser\\FileVisitor' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/Parser/FileVisitor.php', + 'ClassPreloader\\Parser\\NodeTraverser' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/Parser/NodeTraverser.php', + 'ClassPreloader\\Parser\\StrictTypesVisitor' => __DIR__ . '/..' . '/classpreloader/classpreloader/src/Parser/StrictTypesVisitor.php', + 'Collective\\Html\\FormBuilder' => __DIR__ . '/..' . '/laravelcollective/html/src/FormBuilder.php', + 'Collective\\Html\\FormFacade' => __DIR__ . '/..' . '/laravelcollective/html/src/FormFacade.php', + 'Collective\\Html\\HtmlBuilder' => __DIR__ . '/..' . '/laravelcollective/html/src/HtmlBuilder.php', + 'Collective\\Html\\HtmlFacade' => __DIR__ . '/..' . '/laravelcollective/html/src/HtmlFacade.php', + 'Collective\\Html\\HtmlServiceProvider' => __DIR__ . '/..' . '/laravelcollective/html/src/HtmlServiceProvider.php', + 'CreatePasswordResetsTable' => __DIR__ . '/../..' . '/database/migrations/2014_10_12_100000_create_password_resets_table.php', + 'CreateServersTable' => __DIR__ . '/../..' . '/database/migrations/2015_04_26_154117_create_servers_table.php', + 'CreateUsersTable' => __DIR__ . '/../..' . '/database/migrations/2014_10_12_000000_create_users_table.php', + 'Cron\\AbstractField' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/AbstractField.php', + 'Cron\\CronExpression' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/CronExpression.php', + 'Cron\\DayOfMonthField' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/DayOfMonthField.php', + 'Cron\\DayOfWeekField' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/DayOfWeekField.php', + 'Cron\\FieldFactory' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/FieldFactory.php', + 'Cron\\FieldInterface' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/FieldInterface.php', + 'Cron\\HoursField' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/HoursField.php', + 'Cron\\MinutesField' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/MinutesField.php', + 'Cron\\MonthField' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/MonthField.php', + 'Cron\\YearField' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/YearField.php', + 'DatabaseSeeder' => __DIR__ . '/../..' . '/database/seeds/DatabaseSeeder.php', + 'Doctrine\\Common\\Inflector\\Inflector' => __DIR__ . '/..' . '/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php', + 'Dotenv' => __DIR__ . '/..' . '/vlucas/phpdotenv/src/Dotenv.php', + 'IlluminateQueueClosure' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/IlluminateQueueClosure.php', + 'Illuminate\\Auth\\Access\\Gate' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Access/Gate.php', + 'Illuminate\\Auth\\Access\\HandlesAuthorization' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php', + 'Illuminate\\Auth\\Access\\Response' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Access/Response.php', + 'Illuminate\\Auth\\Access\\UnauthorizedException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Access/UnauthorizedException.php', + 'Illuminate\\Auth\\AuthManager' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/AuthManager.php', + 'Illuminate\\Auth\\AuthServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php', + 'Illuminate\\Auth\\Authenticatable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Authenticatable.php', + 'Illuminate\\Auth\\Console\\ClearResetsCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Console/ClearResetsCommand.php', + 'Illuminate\\Auth\\DatabaseUserProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/DatabaseUserProvider.php', + 'Illuminate\\Auth\\EloquentUserProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php', + 'Illuminate\\Auth\\GeneratorServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/GeneratorServiceProvider.php', + 'Illuminate\\Auth\\GenericUser' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/GenericUser.php', + 'Illuminate\\Auth\\Guard' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Guard.php', + 'Illuminate\\Auth\\Middleware\\AuthenticateWithBasicAuth' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php', + 'Illuminate\\Auth\\Passwords\\CanResetPassword' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Passwords/CanResetPassword.php', + 'Illuminate\\Auth\\Passwords\\DatabaseTokenRepository' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php', + 'Illuminate\\Auth\\Passwords\\PasswordBroker' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBroker.php', + 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php', + 'Illuminate\\Auth\\Passwords\\TokenRepositoryInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php', + 'Illuminate\\Broadcasting\\BroadcastEvent' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php', + 'Illuminate\\Broadcasting\\BroadcastManager' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php', + 'Illuminate\\Broadcasting\\BroadcastServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastServiceProvider.php', + 'Illuminate\\Broadcasting\\Broadcasters\\LogBroadcaster' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php', + 'Illuminate\\Broadcasting\\Broadcasters\\PusherBroadcaster' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php', + 'Illuminate\\Broadcasting\\Broadcasters\\RedisBroadcaster' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php', + 'Illuminate\\Bus\\BusServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Bus/BusServiceProvider.php', + 'Illuminate\\Bus\\Dispatcher' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Bus/Dispatcher.php', + 'Illuminate\\Bus\\MarshalException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Bus/MarshalException.php', + 'Illuminate\\Bus\\Queueable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Bus/Queueable.php', + 'Illuminate\\Cache\\ApcStore' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/ApcStore.php', + 'Illuminate\\Cache\\ApcWrapper' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/ApcWrapper.php', + 'Illuminate\\Cache\\ArrayStore' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/ArrayStore.php', + 'Illuminate\\Cache\\CacheManager' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/CacheManager.php', + 'Illuminate\\Cache\\CacheServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php', + 'Illuminate\\Cache\\Console\\CacheTableCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/Console/CacheTableCommand.php', + 'Illuminate\\Cache\\Console\\ClearCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/Console/ClearCommand.php', + 'Illuminate\\Cache\\DatabaseStore' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/DatabaseStore.php', + 'Illuminate\\Cache\\FileStore' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/FileStore.php', + 'Illuminate\\Cache\\MemcachedConnector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php', + 'Illuminate\\Cache\\MemcachedStore' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/MemcachedStore.php', + 'Illuminate\\Cache\\NullStore' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/NullStore.php', + 'Illuminate\\Cache\\RateLimiter' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/RateLimiter.php', + 'Illuminate\\Cache\\RedisStore' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/RedisStore.php', + 'Illuminate\\Cache\\RedisTaggedCache' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php', + 'Illuminate\\Cache\\Repository' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/Repository.php', + 'Illuminate\\Cache\\TagSet' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/TagSet.php', + 'Illuminate\\Cache\\TaggableStore' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/TaggableStore.php', + 'Illuminate\\Cache\\TaggedCache' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/TaggedCache.php', + 'Illuminate\\Cache\\WinCacheStore' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/WinCacheStore.php', + 'Illuminate\\Cache\\XCacheStore' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/XCacheStore.php', + 'Illuminate\\Config\\Repository' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Config/Repository.php', + 'Illuminate\\Console\\AppNamespaceDetectorTrait' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/AppNamespaceDetectorTrait.php', + 'Illuminate\\Console\\Application' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/Application.php', + 'Illuminate\\Console\\Command' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/Command.php', + 'Illuminate\\Console\\ConfirmableTrait' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php', + 'Illuminate\\Console\\GeneratorCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/GeneratorCommand.php', + 'Illuminate\\Console\\OutputStyle' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/OutputStyle.php', + 'Illuminate\\Console\\Parser' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/Parser.php', + 'Illuminate\\Console\\ScheduleServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/ScheduleServiceProvider.php', + 'Illuminate\\Console\\Scheduling\\CallbackEvent' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php', + 'Illuminate\\Console\\Scheduling\\Event' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/Scheduling/Event.php', + 'Illuminate\\Console\\Scheduling\\Schedule' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/Scheduling/Schedule.php', + 'Illuminate\\Console\\Scheduling\\ScheduleRunCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php', + 'Illuminate\\Container\\BindingResolutionException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Container/BindingResolutionException.php', + 'Illuminate\\Container\\Container' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Container/Container.php', + 'Illuminate\\Container\\ContextualBindingBuilder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Container/ContextualBindingBuilder.php', + 'Illuminate\\Contracts\\Auth\\Access\\Authorizable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Auth/Access/Authorizable.php', + 'Illuminate\\Contracts\\Auth\\Access\\Gate' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Auth/Access/Gate.php', + 'Illuminate\\Contracts\\Auth\\Authenticatable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Auth/Authenticatable.php', + 'Illuminate\\Contracts\\Auth\\CanResetPassword' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Auth/CanResetPassword.php', + 'Illuminate\\Contracts\\Auth\\Guard' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Auth/Guard.php', + 'Illuminate\\Contracts\\Auth\\PasswordBroker' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Auth/PasswordBroker.php', + 'Illuminate\\Contracts\\Auth\\Registrar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Auth/Registrar.php', + 'Illuminate\\Contracts\\Auth\\UserProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Auth/UserProvider.php', + 'Illuminate\\Contracts\\Broadcasting\\Broadcaster' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Broadcasting/Broadcaster.php', + 'Illuminate\\Contracts\\Broadcasting\\Factory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Broadcasting/Factory.php', + 'Illuminate\\Contracts\\Broadcasting\\ShouldBroadcast' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Broadcasting/ShouldBroadcast.php', + 'Illuminate\\Contracts\\Broadcasting\\ShouldBroadcastNow' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Broadcasting/ShouldBroadcastNow.php', + 'Illuminate\\Contracts\\Bus\\Dispatcher' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Bus/Dispatcher.php', + 'Illuminate\\Contracts\\Bus\\HandlerResolver' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Bus/HandlerResolver.php', + 'Illuminate\\Contracts\\Bus\\QueueingDispatcher' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Bus/QueueingDispatcher.php', + 'Illuminate\\Contracts\\Bus\\SelfHandling' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Bus/SelfHandling.php', + 'Illuminate\\Contracts\\Cache\\Factory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Cache/Factory.php', + 'Illuminate\\Contracts\\Cache\\Repository' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Cache/Repository.php', + 'Illuminate\\Contracts\\Cache\\Store' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Cache/Store.php', + 'Illuminate\\Contracts\\Config\\Repository' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Config/Repository.php', + 'Illuminate\\Contracts\\Console\\Application' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Console/Application.php', + 'Illuminate\\Contracts\\Console\\Kernel' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Console/Kernel.php', + 'Illuminate\\Contracts\\Container\\BindingResolutionException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Container/BindingResolutionException.php', + 'Illuminate\\Contracts\\Container\\Container' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Container/Container.php', + 'Illuminate\\Contracts\\Container\\ContextualBindingBuilder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Container/ContextualBindingBuilder.php', + 'Illuminate\\Contracts\\Cookie\\Factory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Cookie/Factory.php', + 'Illuminate\\Contracts\\Cookie\\QueueingFactory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Cookie/QueueingFactory.php', + 'Illuminate\\Contracts\\Database\\ModelIdentifier' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Database/ModelIdentifier.php', + 'Illuminate\\Contracts\\Debug\\ExceptionHandler' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php', + 'Illuminate\\Contracts\\Encryption\\DecryptException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Encryption/DecryptException.php', + 'Illuminate\\Contracts\\Encryption\\EncryptException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Encryption/EncryptException.php', + 'Illuminate\\Contracts\\Encryption\\Encrypter' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Encryption/Encrypter.php', + 'Illuminate\\Contracts\\Events\\Dispatcher' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Events/Dispatcher.php', + 'Illuminate\\Contracts\\Filesystem\\Cloud' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Filesystem/Cloud.php', + 'Illuminate\\Contracts\\Filesystem\\Factory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Filesystem/Factory.php', + 'Illuminate\\Contracts\\Filesystem\\FileNotFoundException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Filesystem/FileNotFoundException.php', + 'Illuminate\\Contracts\\Filesystem\\Filesystem' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Filesystem/Filesystem.php', + 'Illuminate\\Contracts\\Foundation\\Application' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Foundation/Application.php', + 'Illuminate\\Contracts\\Hashing\\Hasher' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Hashing/Hasher.php', + 'Illuminate\\Contracts\\Http\\Kernel' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Http/Kernel.php', + 'Illuminate\\Contracts\\Logging\\Log' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Logging/Log.php', + 'Illuminate\\Contracts\\Mail\\MailQueue' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Mail/MailQueue.php', + 'Illuminate\\Contracts\\Mail\\Mailer' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Mail/Mailer.php', + 'Illuminate\\Contracts\\Pagination\\LengthAwarePaginator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Pagination/LengthAwarePaginator.php', + 'Illuminate\\Contracts\\Pagination\\Paginator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Pagination/Paginator.php', + 'Illuminate\\Contracts\\Pagination\\Presenter' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Pagination/Presenter.php', + 'Illuminate\\Contracts\\Pipeline\\Hub' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Pipeline/Hub.php', + 'Illuminate\\Contracts\\Pipeline\\Pipeline' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Pipeline/Pipeline.php', + 'Illuminate\\Contracts\\Queue\\EntityNotFoundException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Queue/EntityNotFoundException.php', + 'Illuminate\\Contracts\\Queue\\EntityResolver' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Queue/EntityResolver.php', + 'Illuminate\\Contracts\\Queue\\Factory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Queue/Factory.php', + 'Illuminate\\Contracts\\Queue\\Job' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Queue/Job.php', + 'Illuminate\\Contracts\\Queue\\Monitor' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Queue/Monitor.php', + 'Illuminate\\Contracts\\Queue\\Queue' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Queue/Queue.php', + 'Illuminate\\Contracts\\Queue\\QueueableEntity' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Queue/QueueableEntity.php', + 'Illuminate\\Contracts\\Queue\\ShouldBeQueued' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Queue/ShouldBeQueued.php', + 'Illuminate\\Contracts\\Queue\\ShouldQueue' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Queue/ShouldQueue.php', + 'Illuminate\\Contracts\\Redis\\Database' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Redis/Database.php', + 'Illuminate\\Contracts\\Routing\\Middleware' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Routing/Middleware.php', + 'Illuminate\\Contracts\\Routing\\Registrar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Routing/Registrar.php', + 'Illuminate\\Contracts\\Routing\\ResponseFactory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Routing/ResponseFactory.php', + 'Illuminate\\Contracts\\Routing\\TerminableMiddleware' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Routing/TerminableMiddleware.php', + 'Illuminate\\Contracts\\Routing\\UrlGenerator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Routing/UrlGenerator.php', + 'Illuminate\\Contracts\\Routing\\UrlRoutable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Routing/UrlRoutable.php', + 'Illuminate\\Contracts\\Support\\Arrayable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Support/Arrayable.php', + 'Illuminate\\Contracts\\Support\\Htmlable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Support/Htmlable.php', + 'Illuminate\\Contracts\\Support\\Jsonable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Support/Jsonable.php', + 'Illuminate\\Contracts\\Support\\MessageBag' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Support/MessageBag.php', + 'Illuminate\\Contracts\\Support\\MessageProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Support/MessageProvider.php', + 'Illuminate\\Contracts\\Support\\Renderable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Support/Renderable.php', + 'Illuminate\\Contracts\\Validation\\Factory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Validation/Factory.php', + 'Illuminate\\Contracts\\Validation\\UnauthorizedException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Validation/UnauthorizedException.php', + 'Illuminate\\Contracts\\Validation\\ValidatesWhenResolved' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Validation/ValidatesWhenResolved.php', + 'Illuminate\\Contracts\\Validation\\ValidationException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Validation/ValidationException.php', + 'Illuminate\\Contracts\\Validation\\Validator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/Validation/Validator.php', + 'Illuminate\\Contracts\\View\\Factory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/View/Factory.php', + 'Illuminate\\Contracts\\View\\View' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Contracts/View/View.php', + 'Illuminate\\Cookie\\CookieJar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cookie/CookieJar.php', + 'Illuminate\\Cookie\\CookieServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cookie/CookieServiceProvider.php', + 'Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php', + 'Illuminate\\Cookie\\Middleware\\EncryptCookies' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php', + 'Illuminate\\Database\\Capsule\\Manager' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Capsule/Manager.php', + 'Illuminate\\Database\\Connection' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Connection.php', + 'Illuminate\\Database\\ConnectionInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/ConnectionInterface.php', + 'Illuminate\\Database\\ConnectionResolver' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/ConnectionResolver.php', + 'Illuminate\\Database\\ConnectionResolverInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/ConnectionResolverInterface.php', + 'Illuminate\\Database\\Connectors\\ConnectionFactory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php', + 'Illuminate\\Database\\Connectors\\Connector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Connectors/Connector.php', + 'Illuminate\\Database\\Connectors\\ConnectorInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Connectors/ConnectorInterface.php', + 'Illuminate\\Database\\Connectors\\MySqlConnector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php', + 'Illuminate\\Database\\Connectors\\PostgresConnector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Connectors/PostgresConnector.php', + 'Illuminate\\Database\\Connectors\\SQLiteConnector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Connectors/SQLiteConnector.php', + 'Illuminate\\Database\\Connectors\\SqlServerConnector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Connectors/SqlServerConnector.php', + 'Illuminate\\Database\\Console\\Migrations\\BaseCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Console/Migrations/BaseCommand.php', + 'Illuminate\\Database\\Console\\Migrations\\InstallCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Console/Migrations/InstallCommand.php', + 'Illuminate\\Database\\Console\\Migrations\\MigrateCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php', + 'Illuminate\\Database\\Console\\Migrations\\MigrateMakeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php', + 'Illuminate\\Database\\Console\\Migrations\\RefreshCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Console/Migrations/RefreshCommand.php', + 'Illuminate\\Database\\Console\\Migrations\\ResetCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php', + 'Illuminate\\Database\\Console\\Migrations\\RollbackCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Console/Migrations/RollbackCommand.php', + 'Illuminate\\Database\\Console\\Migrations\\StatusCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Console/Migrations/StatusCommand.php', + 'Illuminate\\Database\\Console\\Seeds\\SeedCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php', + 'Illuminate\\Database\\Console\\Seeds\\SeederMakeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php', + 'Illuminate\\Database\\DatabaseManager' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/DatabaseManager.php', + 'Illuminate\\Database\\DatabaseServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php', + 'Illuminate\\Database\\DetectsLostConnections' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php', + 'Illuminate\\Database\\Eloquent\\Builder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php', + 'Illuminate\\Database\\Eloquent\\Collection' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php', + 'Illuminate\\Database\\Eloquent\\Factory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php', + 'Illuminate\\Database\\Eloquent\\FactoryBuilder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php', + 'Illuminate\\Database\\Eloquent\\MassAssignmentException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/MassAssignmentException.php', + 'Illuminate\\Database\\Eloquent\\Model' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Model.php', + 'Illuminate\\Database\\Eloquent\\ModelNotFoundException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/ModelNotFoundException.php', + 'Illuminate\\Database\\Eloquent\\QueueEntityResolver' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/QueueEntityResolver.php', + 'Illuminate\\Database\\Eloquent\\Relations\\BelongsTo' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php', + 'Illuminate\\Database\\Eloquent\\Relations\\BelongsToMany' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php', + 'Illuminate\\Database\\Eloquent\\Relations\\HasMany' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasMany.php', + 'Illuminate\\Database\\Eloquent\\Relations\\HasManyThrough' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php', + 'Illuminate\\Database\\Eloquent\\Relations\\HasOne' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOne.php', + 'Illuminate\\Database\\Eloquent\\Relations\\HasOneOrMany' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php', + 'Illuminate\\Database\\Eloquent\\Relations\\MorphMany' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphMany.php', + 'Illuminate\\Database\\Eloquent\\Relations\\MorphOne' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOne.php', + 'Illuminate\\Database\\Eloquent\\Relations\\MorphOneOrMany' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php', + 'Illuminate\\Database\\Eloquent\\Relations\\MorphPivot' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php', + 'Illuminate\\Database\\Eloquent\\Relations\\MorphTo' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphTo.php', + 'Illuminate\\Database\\Eloquent\\Relations\\MorphToMany' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php', + 'Illuminate\\Database\\Eloquent\\Relations\\Pivot' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Pivot.php', + 'Illuminate\\Database\\Eloquent\\Relations\\Relation' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php', + 'Illuminate\\Database\\Eloquent\\ScopeInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/ScopeInterface.php', + 'Illuminate\\Database\\Eloquent\\SoftDeletes' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletes.php', + 'Illuminate\\Database\\Eloquent\\SoftDeletingScope' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php', + 'Illuminate\\Database\\Grammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Grammar.php', + 'Illuminate\\Database\\MigrationServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php', + 'Illuminate\\Database\\Migrations\\DatabaseMigrationRepository' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php', + 'Illuminate\\Database\\Migrations\\Migration' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Migrations/Migration.php', + 'Illuminate\\Database\\Migrations\\MigrationCreator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Migrations/MigrationCreator.php', + 'Illuminate\\Database\\Migrations\\MigrationRepositoryInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php', + 'Illuminate\\Database\\Migrations\\Migrator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php', + 'Illuminate\\Database\\MySqlConnection' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/MySqlConnection.php', + 'Illuminate\\Database\\PostgresConnection' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/PostgresConnection.php', + 'Illuminate\\Database\\QueryException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/QueryException.php', + 'Illuminate\\Database\\Query\\Builder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Builder.php', + 'Illuminate\\Database\\Query\\Expression' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Expression.php', + 'Illuminate\\Database\\Query\\Grammars\\Grammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php', + 'Illuminate\\Database\\Query\\Grammars\\MySqlGrammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php', + 'Illuminate\\Database\\Query\\Grammars\\PostgresGrammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php', + 'Illuminate\\Database\\Query\\Grammars\\SQLiteGrammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php', + 'Illuminate\\Database\\Query\\Grammars\\SqlServerGrammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php', + 'Illuminate\\Database\\Query\\JoinClause' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/JoinClause.php', + 'Illuminate\\Database\\Query\\Processors\\MySqlProcessor' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Processors/MySqlProcessor.php', + 'Illuminate\\Database\\Query\\Processors\\PostgresProcessor' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Processors/PostgresProcessor.php', + 'Illuminate\\Database\\Query\\Processors\\Processor' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php', + 'Illuminate\\Database\\Query\\Processors\\SQLiteProcessor' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php', + 'Illuminate\\Database\\Query\\Processors\\SqlServerProcessor' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php', + 'Illuminate\\Database\\SQLiteConnection' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/SQLiteConnection.php', + 'Illuminate\\Database\\Schema\\Blueprint' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php', + 'Illuminate\\Database\\Schema\\Builder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Schema/Builder.php', + 'Illuminate\\Database\\Schema\\Grammars\\Grammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php', + 'Illuminate\\Database\\Schema\\Grammars\\MySqlGrammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php', + 'Illuminate\\Database\\Schema\\Grammars\\PostgresGrammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php', + 'Illuminate\\Database\\Schema\\Grammars\\SQLiteGrammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php', + 'Illuminate\\Database\\Schema\\Grammars\\SqlServerGrammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php', + 'Illuminate\\Database\\Schema\\MySqlBuilder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php', + 'Illuminate\\Database\\Schema\\PostgresBuilder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Schema/PostgresBuilder.php', + 'Illuminate\\Database\\SeedServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/SeedServiceProvider.php', + 'Illuminate\\Database\\Seeder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Seeder.php', + 'Illuminate\\Database\\SqlServerConnection' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/SqlServerConnection.php', + 'Illuminate\\Encryption\\BaseEncrypter' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Encryption/BaseEncrypter.php', + 'Illuminate\\Encryption\\Encrypter' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Encryption/Encrypter.php', + 'Illuminate\\Encryption\\EncryptionServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php', + 'Illuminate\\Encryption\\McryptEncrypter' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Encryption/McryptEncrypter.php', + 'Illuminate\\Events\\CallQueuedHandler' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Events/CallQueuedHandler.php', + 'Illuminate\\Events\\Dispatcher' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Events/Dispatcher.php', + 'Illuminate\\Events\\EventServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Events/EventServiceProvider.php', + 'Illuminate\\Filesystem\\ClassFinder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Filesystem/ClassFinder.php', + 'Illuminate\\Filesystem\\Filesystem' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Filesystem/Filesystem.php', + 'Illuminate\\Filesystem\\FilesystemAdapter' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php', + 'Illuminate\\Filesystem\\FilesystemManager' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php', + 'Illuminate\\Filesystem\\FilesystemServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php', + 'Illuminate\\Foundation\\AliasLoader' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/AliasLoader.php', + 'Illuminate\\Foundation\\Application' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Application.php', + 'Illuminate\\Foundation\\Auth\\Access\\Authorizable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Auth/Access/Authorizable.php', + 'Illuminate\\Foundation\\Auth\\Access\\AuthorizesRequests' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php', + 'Illuminate\\Foundation\\Auth\\AuthenticatesAndRegistersUsers' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php', + 'Illuminate\\Foundation\\Auth\\AuthenticatesUsers' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php', + 'Illuminate\\Foundation\\Auth\\RedirectsUsers' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php', + 'Illuminate\\Foundation\\Auth\\RegistersUsers' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php', + 'Illuminate\\Foundation\\Auth\\ResetsPasswords' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php', + 'Illuminate\\Foundation\\Auth\\ThrottlesLogins' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php', + 'Illuminate\\Foundation\\Bootstrap\\BootProviders' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php', + 'Illuminate\\Foundation\\Bootstrap\\ConfigureLogging' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php', + 'Illuminate\\Foundation\\Bootstrap\\DetectEnvironment' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php', + 'Illuminate\\Foundation\\Bootstrap\\HandleExceptions' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php', + 'Illuminate\\Foundation\\Bootstrap\\LoadConfiguration' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php', + 'Illuminate\\Foundation\\Bootstrap\\RegisterFacades' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php', + 'Illuminate\\Foundation\\Bootstrap\\RegisterProviders' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php', + 'Illuminate\\Foundation\\Bootstrap\\SetRequestForConsole' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php', + 'Illuminate\\Foundation\\Bus\\DispatchesCommands' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesCommands.php', + 'Illuminate\\Foundation\\Bus\\DispatchesJobs' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php', + 'Illuminate\\Foundation\\Composer' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Composer.php', + 'Illuminate\\Foundation\\ComposerScripts' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php', + 'Illuminate\\Foundation\\Console\\AppNameCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/AppNameCommand.php', + 'Illuminate\\Foundation\\Console\\ClearCompiledCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php', + 'Illuminate\\Foundation\\Console\\CommandMakeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/CommandMakeCommand.php', + 'Illuminate\\Foundation\\Console\\ConfigCacheCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php', + 'Illuminate\\Foundation\\Console\\ConfigClearCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/ConfigClearCommand.php', + 'Illuminate\\Foundation\\Console\\ConsoleMakeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php', + 'Illuminate\\Foundation\\Console\\DownCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/DownCommand.php', + 'Illuminate\\Foundation\\Console\\EnvironmentCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php', + 'Illuminate\\Foundation\\Console\\EventGenerateCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php', + 'Illuminate\\Foundation\\Console\\EventMakeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php', + 'Illuminate\\Foundation\\Console\\HandlerCommandCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/HandlerCommandCommand.php', + 'Illuminate\\Foundation\\Console\\HandlerEventCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/HandlerEventCommand.php', + 'Illuminate\\Foundation\\Console\\IlluminateCaster' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/IlluminateCaster.php', + 'Illuminate\\Foundation\\Console\\JobMakeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/JobMakeCommand.php', + 'Illuminate\\Foundation\\Console\\Kernel' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php', + 'Illuminate\\Foundation\\Console\\KeyGenerateCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php', + 'Illuminate\\Foundation\\Console\\ListenerMakeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/ListenerMakeCommand.php', + 'Illuminate\\Foundation\\Console\\ModelMakeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php', + 'Illuminate\\Foundation\\Console\\OptimizeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php', + 'Illuminate\\Foundation\\Console\\PolicyMakeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/PolicyMakeCommand.php', + 'Illuminate\\Foundation\\Console\\ProviderMakeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/ProviderMakeCommand.php', + 'Illuminate\\Foundation\\Console\\QueuedJob' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/QueuedJob.php', + 'Illuminate\\Foundation\\Console\\RequestMakeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php', + 'Illuminate\\Foundation\\Console\\RouteCacheCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php', + 'Illuminate\\Foundation\\Console\\RouteClearCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php', + 'Illuminate\\Foundation\\Console\\RouteListCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php', + 'Illuminate\\Foundation\\Console\\ServeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php', + 'Illuminate\\Foundation\\Console\\TestMakeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/TestMakeCommand.php', + 'Illuminate\\Foundation\\Console\\TinkerCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/TinkerCommand.php', + 'Illuminate\\Foundation\\Console\\UpCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php', + 'Illuminate\\Foundation\\Console\\VendorPublishCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php', + 'Illuminate\\Foundation\\Console\\ViewClearCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Console/ViewClearCommand.php', + 'Illuminate\\Foundation\\EnvironmentDetector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php', + 'Illuminate\\Foundation\\Exceptions\\Handler' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php', + 'Illuminate\\Foundation\\Http\\FormRequest' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php', + 'Illuminate\\Foundation\\Http\\Kernel' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php', + 'Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php', + 'Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php', + 'Illuminate\\Foundation\\Http\\Middleware\\VerifyPostSize' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyPostSize.php', + 'Illuminate\\Foundation\\Inspiring' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Inspiring.php', + 'Illuminate\\Foundation\\ProviderRepository' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php', + 'Illuminate\\Foundation\\Providers\\ArtisanServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php', + 'Illuminate\\Foundation\\Providers\\ComposerServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php', + 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php', + 'Illuminate\\Foundation\\Providers\\FormRequestServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php', + 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php', + 'Illuminate\\Foundation\\Support\\Providers\\AuthServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php', + 'Illuminate\\Foundation\\Support\\Providers\\EventServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php', + 'Illuminate\\Foundation\\Support\\Providers\\RouteServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php', + 'Illuminate\\Foundation\\Testing\\ApplicationTrait' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Testing/ApplicationTrait.php', + 'Illuminate\\Foundation\\Testing\\AssertionsTrait' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Testing/AssertionsTrait.php', + 'Illuminate\\Foundation\\Testing\\CrawlerTrait' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Testing/CrawlerTrait.php', + 'Illuminate\\Foundation\\Testing\\DatabaseMigrations' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseMigrations.php', + 'Illuminate\\Foundation\\Testing\\DatabaseTransactions' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseTransactions.php', + 'Illuminate\\Foundation\\Testing\\HttpException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Testing/HttpException.php', + 'Illuminate\\Foundation\\Testing\\InteractsWithPages' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Testing/InteractsWithPages.php', + 'Illuminate\\Foundation\\Testing\\TestCase' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php', + 'Illuminate\\Foundation\\Testing\\WithoutEvents' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Testing/WithoutEvents.php', + 'Illuminate\\Foundation\\Testing\\WithoutMiddleware' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Testing/WithoutMiddleware.php', + 'Illuminate\\Foundation\\Validation\\ValidatesRequests' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php', + 'Illuminate\\Hashing\\BcryptHasher' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php', + 'Illuminate\\Hashing\\HashServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php', + 'Illuminate\\Http\\Exception\\HttpResponseException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/Exception/HttpResponseException.php', + 'Illuminate\\Http\\Exception\\PostTooLargeException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/Exception/PostTooLargeException.php', + 'Illuminate\\Http\\JsonResponse' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/JsonResponse.php', + 'Illuminate\\Http\\Middleware\\CheckResponseForModifications' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/Middleware/CheckResponseForModifications.php', + 'Illuminate\\Http\\Middleware\\FrameGuard' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php', + 'Illuminate\\Http\\RedirectResponse' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/RedirectResponse.php', + 'Illuminate\\Http\\Request' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/Request.php', + 'Illuminate\\Http\\Response' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/Response.php', + 'Illuminate\\Http\\ResponseTrait' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/ResponseTrait.php', + 'Illuminate\\Log\\Writer' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Log/Writer.php', + 'Illuminate\\Mail\\MailServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php', + 'Illuminate\\Mail\\Mailer' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/Mailer.php', + 'Illuminate\\Mail\\Message' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/Message.php', + 'Illuminate\\Mail\\TransportManager' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/TransportManager.php', + 'Illuminate\\Mail\\Transport\\LogTransport' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php', + 'Illuminate\\Mail\\Transport\\MailgunTransport' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php', + 'Illuminate\\Mail\\Transport\\MandrillTransport' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php', + 'Illuminate\\Mail\\Transport\\SesTransport' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php', + 'Illuminate\\Mail\\Transport\\Transport' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/Transport/Transport.php', + 'Illuminate\\Pagination\\AbstractPaginator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php', + 'Illuminate\\Pagination\\BootstrapThreeNextPreviousButtonRendererTrait' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pagination/BootstrapThreeNextPreviousButtonRendererTrait.php', + 'Illuminate\\Pagination\\BootstrapThreePresenter' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pagination/BootstrapThreePresenter.php', + 'Illuminate\\Pagination\\LengthAwarePaginator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php', + 'Illuminate\\Pagination\\PaginationServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php', + 'Illuminate\\Pagination\\Paginator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pagination/Paginator.php', + 'Illuminate\\Pagination\\SimpleBootstrapThreePresenter' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pagination/SimpleBootstrapThreePresenter.php', + 'Illuminate\\Pagination\\UrlWindow' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pagination/UrlWindow.php', + 'Illuminate\\Pagination\\UrlWindowPresenterTrait' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pagination/UrlWindowPresenterTrait.php', + 'Illuminate\\Pipeline\\Hub' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pipeline/Hub.php', + 'Illuminate\\Pipeline\\Pipeline' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', + 'Illuminate\\Pipeline\\PipelineServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pipeline/PipelineServiceProvider.php', + 'Illuminate\\Queue\\BeanstalkdQueue' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php', + 'Illuminate\\Queue\\CallQueuedHandler' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php', + 'Illuminate\\Queue\\Capsule\\Manager' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Capsule/Manager.php', + 'Illuminate\\Queue\\Connectors\\BeanstalkdConnector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php', + 'Illuminate\\Queue\\Connectors\\ConnectorInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Connectors/ConnectorInterface.php', + 'Illuminate\\Queue\\Connectors\\DatabaseConnector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Connectors/DatabaseConnector.php', + 'Illuminate\\Queue\\Connectors\\IronConnector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Connectors/IronConnector.php', + 'Illuminate\\Queue\\Connectors\\NullConnector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Connectors/NullConnector.php', + 'Illuminate\\Queue\\Connectors\\RedisConnector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Connectors/RedisConnector.php', + 'Illuminate\\Queue\\Connectors\\SqsConnector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php', + 'Illuminate\\Queue\\Connectors\\SyncConnector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Connectors/SyncConnector.php', + 'Illuminate\\Queue\\ConsoleServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/ConsoleServiceProvider.php', + 'Illuminate\\Queue\\Console\\FailedTableCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Console/FailedTableCommand.php', + 'Illuminate\\Queue\\Console\\FlushFailedCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Console/FlushFailedCommand.php', + 'Illuminate\\Queue\\Console\\ForgetFailedCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Console/ForgetFailedCommand.php', + 'Illuminate\\Queue\\Console\\ListFailedCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Console/ListFailedCommand.php', + 'Illuminate\\Queue\\Console\\ListenCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Console/ListenCommand.php', + 'Illuminate\\Queue\\Console\\RestartCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Console/RestartCommand.php', + 'Illuminate\\Queue\\Console\\RetryCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Console/RetryCommand.php', + 'Illuminate\\Queue\\Console\\SubscribeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Console/SubscribeCommand.php', + 'Illuminate\\Queue\\Console\\TableCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Console/TableCommand.php', + 'Illuminate\\Queue\\Console\\WorkCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php', + 'Illuminate\\Queue\\DatabaseQueue' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php', + 'Illuminate\\Queue\\Failed\\DatabaseFailedJobProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php', + 'Illuminate\\Queue\\Failed\\FailedJobProviderInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php', + 'Illuminate\\Queue\\Failed\\NullFailedJobProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Failed/NullFailedJobProvider.php', + 'Illuminate\\Queue\\InteractsWithQueue' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/InteractsWithQueue.php', + 'Illuminate\\Queue\\IronQueue' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/IronQueue.php', + 'Illuminate\\Queue\\Jobs\\BeanstalkdJob' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Jobs/BeanstalkdJob.php', + 'Illuminate\\Queue\\Jobs\\DatabaseJob' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJob.php', + 'Illuminate\\Queue\\Jobs\\IronJob' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Jobs/IronJob.php', + 'Illuminate\\Queue\\Jobs\\Job' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Jobs/Job.php', + 'Illuminate\\Queue\\Jobs\\RedisJob' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Jobs/RedisJob.php', + 'Illuminate\\Queue\\Jobs\\SqsJob' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Jobs/SqsJob.php', + 'Illuminate\\Queue\\Jobs\\SyncJob' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Jobs/SyncJob.php', + 'Illuminate\\Queue\\Listener' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Listener.php', + 'Illuminate\\Queue\\NullQueue' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/NullQueue.php', + 'Illuminate\\Queue\\Queue' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Queue.php', + 'Illuminate\\Queue\\QueueManager' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/QueueManager.php', + 'Illuminate\\Queue\\QueueServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/QueueServiceProvider.php', + 'Illuminate\\Queue\\RedisQueue' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/RedisQueue.php', + 'Illuminate\\Queue\\SerializesModels' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/SerializesModels.php', + 'Illuminate\\Queue\\SqsQueue' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/SqsQueue.php', + 'Illuminate\\Queue\\SyncQueue' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/SyncQueue.php', + 'Illuminate\\Queue\\Worker' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/Worker.php', + 'Illuminate\\Redis\\Database' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Redis/Database.php', + 'Illuminate\\Redis\\RedisServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Redis/RedisServiceProvider.php', + 'Illuminate\\Routing\\Console\\ControllerMakeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/Console/ControllerMakeCommand.php', + 'Illuminate\\Routing\\Console\\MiddlewareMakeCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php', + 'Illuminate\\Routing\\Controller' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/Controller.php', + 'Illuminate\\Routing\\ControllerDispatcher' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php', + 'Illuminate\\Routing\\ControllerInspector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/ControllerInspector.php', + 'Illuminate\\Routing\\ControllerServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/ControllerServiceProvider.php', + 'Illuminate\\Routing\\GeneratorServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/GeneratorServiceProvider.php', + 'Illuminate\\Routing\\Matching\\HostValidator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php', + 'Illuminate\\Routing\\Matching\\MethodValidator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php', + 'Illuminate\\Routing\\Matching\\SchemeValidator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php', + 'Illuminate\\Routing\\Matching\\UriValidator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php', + 'Illuminate\\Routing\\Matching\\ValidatorInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php', + 'Illuminate\\Routing\\Redirector' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/Redirector.php', + 'Illuminate\\Routing\\ResourceRegistrar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/ResourceRegistrar.php', + 'Illuminate\\Routing\\ResponseFactory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/ResponseFactory.php', + 'Illuminate\\Routing\\Route' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/Route.php', + 'Illuminate\\Routing\\RouteCollection' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/RouteCollection.php', + 'Illuminate\\Routing\\RouteDependencyResolverTrait' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php', + 'Illuminate\\Routing\\Router' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/Router.php', + 'Illuminate\\Routing\\RoutingServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php', + 'Illuminate\\Routing\\UrlGenerator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Routing/UrlGenerator.php', + 'Illuminate\\Session\\CacheBasedSessionHandler' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php', + 'Illuminate\\Session\\CommandsServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Session/CommandsServiceProvider.php', + 'Illuminate\\Session\\Console\\SessionTableCommand' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Session/Console/SessionTableCommand.php', + 'Illuminate\\Session\\CookieSessionHandler' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Session/CookieSessionHandler.php', + 'Illuminate\\Session\\DatabaseSessionHandler' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Session/DatabaseSessionHandler.php', + 'Illuminate\\Session\\EncryptedStore' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Session/EncryptedStore.php', + 'Illuminate\\Session\\ExistenceAwareInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Session/ExistenceAwareInterface.php', + 'Illuminate\\Session\\FileSessionHandler' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Session/FileSessionHandler.php', + 'Illuminate\\Session\\Middleware\\StartSession' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php', + 'Illuminate\\Session\\SessionInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Session/SessionInterface.php', + 'Illuminate\\Session\\SessionManager' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Session/SessionManager.php', + 'Illuminate\\Session\\SessionServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php', + 'Illuminate\\Session\\Store' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Session/Store.php', + 'Illuminate\\Session\\TokenMismatchException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Session/TokenMismatchException.php', + 'Illuminate\\Support\\AggregateServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/AggregateServiceProvider.php', + 'Illuminate\\Support\\Arr' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Arr.php', + 'Illuminate\\Support\\ClassLoader' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/ClassLoader.php', + 'Illuminate\\Support\\Collection' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Collection.php', + 'Illuminate\\Support\\Debug\\Dumper' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Debug/Dumper.php', + 'Illuminate\\Support\\Debug\\HtmlDumper' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Debug/HtmlDumper.php', + 'Illuminate\\Support\\Facades\\App' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/App.php', + 'Illuminate\\Support\\Facades\\Artisan' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Artisan.php', + 'Illuminate\\Support\\Facades\\Auth' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Auth.php', + 'Illuminate\\Support\\Facades\\Blade' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Blade.php', + 'Illuminate\\Support\\Facades\\Bus' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Bus.php', + 'Illuminate\\Support\\Facades\\Cache' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Cache.php', + 'Illuminate\\Support\\Facades\\Config' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Config.php', + 'Illuminate\\Support\\Facades\\Cookie' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Cookie.php', + 'Illuminate\\Support\\Facades\\Crypt' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Crypt.php', + 'Illuminate\\Support\\Facades\\DB' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/DB.php', + 'Illuminate\\Support\\Facades\\Event' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Event.php', + 'Illuminate\\Support\\Facades\\Facade' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Facade.php', + 'Illuminate\\Support\\Facades\\File' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/File.php', + 'Illuminate\\Support\\Facades\\Gate' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Gate.php', + 'Illuminate\\Support\\Facades\\Hash' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Hash.php', + 'Illuminate\\Support\\Facades\\Input' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Input.php', + 'Illuminate\\Support\\Facades\\Lang' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Lang.php', + 'Illuminate\\Support\\Facades\\Log' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Log.php', + 'Illuminate\\Support\\Facades\\Mail' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Mail.php', + 'Illuminate\\Support\\Facades\\Password' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Password.php', + 'Illuminate\\Support\\Facades\\Queue' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Queue.php', + 'Illuminate\\Support\\Facades\\Redirect' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Redirect.php', + 'Illuminate\\Support\\Facades\\Redis' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Redis.php', + 'Illuminate\\Support\\Facades\\Request' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Request.php', + 'Illuminate\\Support\\Facades\\Response' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Response.php', + 'Illuminate\\Support\\Facades\\Route' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Route.php', + 'Illuminate\\Support\\Facades\\Schema' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Schema.php', + 'Illuminate\\Support\\Facades\\Session' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Session.php', + 'Illuminate\\Support\\Facades\\Storage' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Storage.php', + 'Illuminate\\Support\\Facades\\URL' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/URL.php', + 'Illuminate\\Support\\Facades\\Validator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/Validator.php', + 'Illuminate\\Support\\Facades\\View' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Facades/View.php', + 'Illuminate\\Support\\Fluent' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Fluent.php', + 'Illuminate\\Support\\HtmlString' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/HtmlString.php', + 'Illuminate\\Support\\Manager' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Manager.php', + 'Illuminate\\Support\\MessageBag' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/MessageBag.php', + 'Illuminate\\Support\\NamespacedItemResolver' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php', + 'Illuminate\\Support\\Pluralizer' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Pluralizer.php', + 'Illuminate\\Support\\ServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/ServiceProvider.php', + 'Illuminate\\Support\\Str' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Str.php', + 'Illuminate\\Support\\Traits\\CapsuleManagerTrait' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Traits/CapsuleManagerTrait.php', + 'Illuminate\\Support\\Traits\\Macroable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/Traits/Macroable.php', + 'Illuminate\\Support\\ViewErrorBag' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/ViewErrorBag.php', + 'Illuminate\\Translation\\FileLoader' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Translation/FileLoader.php', + 'Illuminate\\Translation\\LoaderInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Translation/LoaderInterface.php', + 'Illuminate\\Translation\\TranslationServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Translation/TranslationServiceProvider.php', + 'Illuminate\\Translation\\Translator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Translation/Translator.php', + 'Illuminate\\Validation\\DatabasePresenceVerifier' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/DatabasePresenceVerifier.php', + 'Illuminate\\Validation\\Factory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/Factory.php', + 'Illuminate\\Validation\\PresenceVerifierInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/PresenceVerifierInterface.php', + 'Illuminate\\Validation\\ValidatesWhenResolvedTrait' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php', + 'Illuminate\\Validation\\ValidationServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php', + 'Illuminate\\Validation\\Validator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/Validator.php', + 'Illuminate\\View\\Compilers\\BladeCompiler' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php', + 'Illuminate\\View\\Compilers\\Compiler' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Compilers/Compiler.php', + 'Illuminate\\View\\Compilers\\CompilerInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Compilers/CompilerInterface.php', + 'Illuminate\\View\\Engines\\CompilerEngine' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php', + 'Illuminate\\View\\Engines\\Engine' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Engines/Engine.php', + 'Illuminate\\View\\Engines\\EngineInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Engines/EngineInterface.php', + 'Illuminate\\View\\Engines\\EngineResolver' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Engines/EngineResolver.php', + 'Illuminate\\View\\Engines\\PhpEngine' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php', + 'Illuminate\\View\\Expression' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Expression.php', + 'Illuminate\\View\\Factory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Factory.php', + 'Illuminate\\View\\FileViewFinder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/FileViewFinder.php', + 'Illuminate\\View\\Middleware\\ShareErrorsFromSession' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php', + 'Illuminate\\View\\View' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/View.php', + 'Illuminate\\View\\ViewFinderInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/ViewFinderInterface.php', + 'Illuminate\\View\\ViewServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/ViewServiceProvider.php', + 'JakubOnderka\\PhpConsoleColor\\ConsoleColor' => __DIR__ . '/..' . '/jakub-onderka/php-console-color/src/ConsoleColor.php', + 'JakubOnderka\\PhpConsoleColor\\InvalidStyleException' => __DIR__ . '/..' . '/jakub-onderka/php-console-color/src/InvalidStyleException.php', + 'JakubOnderka\\PhpConsoleHighlighter\\Highlighter' => __DIR__ . '/..' . '/jakub-onderka/php-console-highlighter/src/JakubOnderka/PhpConsoleHighlighter/Highlighter.php', + 'JsonSerializable' => __DIR__ . '/..' . '/nesbot/carbon/src/JsonSerializable.php', + 'League\\Flysystem\\AdapterInterface' => __DIR__ . '/..' . '/league/flysystem/src/AdapterInterface.php', + 'League\\Flysystem\\Adapter\\AbstractAdapter' => __DIR__ . '/..' . '/league/flysystem/src/Adapter/AbstractAdapter.php', + 'League\\Flysystem\\Adapter\\AbstractFtpAdapter' => __DIR__ . '/..' . '/league/flysystem/src/Adapter/AbstractFtpAdapter.php', + 'League\\Flysystem\\Adapter\\CanOverwriteFiles' => __DIR__ . '/..' . '/league/flysystem/src/Adapter/CanOverwriteFiles.php', + 'League\\Flysystem\\Adapter\\Ftp' => __DIR__ . '/..' . '/league/flysystem/src/Adapter/Ftp.php', + 'League\\Flysystem\\Adapter\\Ftpd' => __DIR__ . '/..' . '/league/flysystem/src/Adapter/Ftpd.php', + 'League\\Flysystem\\Adapter\\Local' => __DIR__ . '/..' . '/league/flysystem/src/Adapter/Local.php', + 'League\\Flysystem\\Adapter\\NullAdapter' => __DIR__ . '/..' . '/league/flysystem/src/Adapter/NullAdapter.php', + 'League\\Flysystem\\Adapter\\Polyfill\\NotSupportingVisibilityTrait' => __DIR__ . '/..' . '/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php', + 'League\\Flysystem\\Adapter\\Polyfill\\StreamedCopyTrait' => __DIR__ . '/..' . '/league/flysystem/src/Adapter/Polyfill/StreamedCopyTrait.php', + 'League\\Flysystem\\Adapter\\Polyfill\\StreamedReadingTrait' => __DIR__ . '/..' . '/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php', + 'League\\Flysystem\\Adapter\\Polyfill\\StreamedTrait' => __DIR__ . '/..' . '/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php', + 'League\\Flysystem\\Adapter\\Polyfill\\StreamedWritingTrait' => __DIR__ . '/..' . '/league/flysystem/src/Adapter/Polyfill/StreamedWritingTrait.php', + 'League\\Flysystem\\Adapter\\SynologyFtp' => __DIR__ . '/..' . '/league/flysystem/src/Adapter/SynologyFtp.php', + 'League\\Flysystem\\Config' => __DIR__ . '/..' . '/league/flysystem/src/Config.php', + 'League\\Flysystem\\ConfigAwareTrait' => __DIR__ . '/..' . '/league/flysystem/src/ConfigAwareTrait.php', + 'League\\Flysystem\\Directory' => __DIR__ . '/..' . '/league/flysystem/src/Directory.php', + 'League\\Flysystem\\Exception' => __DIR__ . '/..' . '/league/flysystem/src/Exception.php', + 'League\\Flysystem\\File' => __DIR__ . '/..' . '/league/flysystem/src/File.php', + 'League\\Flysystem\\FileExistsException' => __DIR__ . '/..' . '/league/flysystem/src/FileExistsException.php', + 'League\\Flysystem\\FileNotFoundException' => __DIR__ . '/..' . '/league/flysystem/src/FileNotFoundException.php', + 'League\\Flysystem\\Filesystem' => __DIR__ . '/..' . '/league/flysystem/src/Filesystem.php', + 'League\\Flysystem\\FilesystemInterface' => __DIR__ . '/..' . '/league/flysystem/src/FilesystemInterface.php', + 'League\\Flysystem\\FilesystemNotFoundException' => __DIR__ . '/..' . '/league/flysystem/src/FilesystemNotFoundException.php', + 'League\\Flysystem\\Handler' => __DIR__ . '/..' . '/league/flysystem/src/Handler.php', + 'League\\Flysystem\\MountManager' => __DIR__ . '/..' . '/league/flysystem/src/MountManager.php', + 'League\\Flysystem\\NotSupportedException' => __DIR__ . '/..' . '/league/flysystem/src/NotSupportedException.php', + 'League\\Flysystem\\PluginInterface' => __DIR__ . '/..' . '/league/flysystem/src/PluginInterface.php', + 'League\\Flysystem\\Plugin\\AbstractPlugin' => __DIR__ . '/..' . '/league/flysystem/src/Plugin/AbstractPlugin.php', + 'League\\Flysystem\\Plugin\\EmptyDir' => __DIR__ . '/..' . '/league/flysystem/src/Plugin/EmptyDir.php', + 'League\\Flysystem\\Plugin\\ForcedCopy' => __DIR__ . '/..' . '/league/flysystem/src/Plugin/ForcedCopy.php', + 'League\\Flysystem\\Plugin\\ForcedRename' => __DIR__ . '/..' . '/league/flysystem/src/Plugin/ForcedRename.php', + 'League\\Flysystem\\Plugin\\GetWithMetadata' => __DIR__ . '/..' . '/league/flysystem/src/Plugin/GetWithMetadata.php', + 'League\\Flysystem\\Plugin\\ListFiles' => __DIR__ . '/..' . '/league/flysystem/src/Plugin/ListFiles.php', + 'League\\Flysystem\\Plugin\\ListPaths' => __DIR__ . '/..' . '/league/flysystem/src/Plugin/ListPaths.php', + 'League\\Flysystem\\Plugin\\ListWith' => __DIR__ . '/..' . '/league/flysystem/src/Plugin/ListWith.php', + 'League\\Flysystem\\Plugin\\PluggableTrait' => __DIR__ . '/..' . '/league/flysystem/src/Plugin/PluggableTrait.php', + 'League\\Flysystem\\Plugin\\PluginNotFoundException' => __DIR__ . '/..' . '/league/flysystem/src/Plugin/PluginNotFoundException.php', + 'League\\Flysystem\\ReadInterface' => __DIR__ . '/..' . '/league/flysystem/src/ReadInterface.php', + 'League\\Flysystem\\RootViolationException' => __DIR__ . '/..' . '/league/flysystem/src/RootViolationException.php', + 'League\\Flysystem\\SafeStorage' => __DIR__ . '/..' . '/league/flysystem/src/SafeStorage.php', + 'League\\Flysystem\\UnreadableFileException' => __DIR__ . '/..' . '/league/flysystem/src/UnreadableFileException.php', + 'League\\Flysystem\\Util' => __DIR__ . '/..' . '/league/flysystem/src/Util.php', + 'League\\Flysystem\\Util\\ContentListingFormatter' => __DIR__ . '/..' . '/league/flysystem/src/Util/ContentListingFormatter.php', + 'League\\Flysystem\\Util\\MimeType' => __DIR__ . '/..' . '/league/flysystem/src/Util/MimeType.php', + 'League\\Flysystem\\Util\\StreamHasher' => __DIR__ . '/..' . '/league/flysystem/src/Util/StreamHasher.php', + 'Monolog\\ErrorHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/ErrorHandler.php', + 'Monolog\\Formatter\\ChromePHPFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php', + 'Monolog\\Formatter\\ElasticaFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php', + 'Monolog\\Formatter\\FlowdockFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php', + 'Monolog\\Formatter\\FluentdFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php', + 'Monolog\\Formatter\\FormatterInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php', + 'Monolog\\Formatter\\GelfMessageFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php', + 'Monolog\\Formatter\\HtmlFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php', + 'Monolog\\Formatter\\JsonFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php', + 'Monolog\\Formatter\\LineFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/LineFormatter.php', + 'Monolog\\Formatter\\LogglyFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php', + 'Monolog\\Formatter\\LogstashFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php', + 'Monolog\\Formatter\\MongoDBFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php', + 'Monolog\\Formatter\\NormalizerFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php', + 'Monolog\\Formatter\\ScalarFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php', + 'Monolog\\Formatter\\WildfireFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php', + 'Monolog\\Handler\\AbstractHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AbstractHandler.php', + 'Monolog\\Handler\\AbstractProcessingHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php', + 'Monolog\\Handler\\AbstractSyslogHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php', + 'Monolog\\Handler\\AmqpHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AmqpHandler.php', + 'Monolog\\Handler\\BrowserConsoleHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php', + 'Monolog\\Handler\\BufferHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/BufferHandler.php', + 'Monolog\\Handler\\ChromePHPHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php', + 'Monolog\\Handler\\CouchDBHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php', + 'Monolog\\Handler\\CubeHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/CubeHandler.php', + 'Monolog\\Handler\\Curl\\Util' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/Curl/Util.php', + 'Monolog\\Handler\\DeduplicationHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php', + 'Monolog\\Handler\\DoctrineCouchDBHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php', + 'Monolog\\Handler\\DynamoDbHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php', + 'Monolog\\Handler\\ElasticSearchHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php', + 'Monolog\\Handler\\ErrorLogHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php', + 'Monolog\\Handler\\FilterHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FilterHandler.php', + 'Monolog\\Handler\\FingersCrossedHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php', + 'Monolog\\Handler\\FingersCrossed\\ActivationStrategyInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php', + 'Monolog\\Handler\\FingersCrossed\\ChannelLevelActivationStrategy' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php', + 'Monolog\\Handler\\FingersCrossed\\ErrorLevelActivationStrategy' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php', + 'Monolog\\Handler\\FirePHPHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php', + 'Monolog\\Handler\\FleepHookHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php', + 'Monolog\\Handler\\FlowdockHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php', + 'Monolog\\Handler\\FormattableHandlerInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php', + 'Monolog\\Handler\\FormattableHandlerTrait' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php', + 'Monolog\\Handler\\GelfHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/GelfHandler.php', + 'Monolog\\Handler\\GroupHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/GroupHandler.php', + 'Monolog\\Handler\\HandlerInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/HandlerInterface.php', + 'Monolog\\Handler\\HandlerWrapper' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php', + 'Monolog\\Handler\\HipChatHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/HipChatHandler.php', + 'Monolog\\Handler\\IFTTTHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php', + 'Monolog\\Handler\\InsightOpsHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php', + 'Monolog\\Handler\\LogEntriesHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php', + 'Monolog\\Handler\\LogglyHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/LogglyHandler.php', + 'Monolog\\Handler\\MailHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/MailHandler.php', + 'Monolog\\Handler\\MandrillHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/MandrillHandler.php', + 'Monolog\\Handler\\MissingExtensionException' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php', + 'Monolog\\Handler\\MongoDBHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php', + 'Monolog\\Handler\\NativeMailerHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php', + 'Monolog\\Handler\\NewRelicHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php', + 'Monolog\\Handler\\NullHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/NullHandler.php', + 'Monolog\\Handler\\PHPConsoleHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php', + 'Monolog\\Handler\\ProcessableHandlerInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php', + 'Monolog\\Handler\\ProcessableHandlerTrait' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php', + 'Monolog\\Handler\\PsrHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/PsrHandler.php', + 'Monolog\\Handler\\PushoverHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/PushoverHandler.php', + 'Monolog\\Handler\\RavenHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/RavenHandler.php', + 'Monolog\\Handler\\RedisHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/RedisHandler.php', + 'Monolog\\Handler\\RollbarHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/RollbarHandler.php', + 'Monolog\\Handler\\RotatingFileHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php', + 'Monolog\\Handler\\SamplingHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SamplingHandler.php', + 'Monolog\\Handler\\SlackHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SlackHandler.php', + 'Monolog\\Handler\\SlackWebhookHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php', + 'Monolog\\Handler\\Slack\\SlackRecord' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php', + 'Monolog\\Handler\\SlackbotHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php', + 'Monolog\\Handler\\SocketHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SocketHandler.php', + 'Monolog\\Handler\\StreamHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/StreamHandler.php', + 'Monolog\\Handler\\SwiftMailerHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php', + 'Monolog\\Handler\\SyslogHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SyslogHandler.php', + 'Monolog\\Handler\\SyslogUdpHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php', + 'Monolog\\Handler\\SyslogUdp\\UdpSocket' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php', + 'Monolog\\Handler\\TestHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/TestHandler.php', + 'Monolog\\Handler\\WhatFailureGroupHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php', + 'Monolog\\Handler\\ZendMonitorHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php', + 'Monolog\\Logger' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Logger.php', + 'Monolog\\Processor\\GitProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/GitProcessor.php', + 'Monolog\\Processor\\IntrospectionProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php', + 'Monolog\\Processor\\MemoryPeakUsageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php', + 'Monolog\\Processor\\MemoryProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php', + 'Monolog\\Processor\\MemoryUsageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php', + 'Monolog\\Processor\\MercurialProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php', + 'Monolog\\Processor\\ProcessIdProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php', + 'Monolog\\Processor\\ProcessorInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php', + 'Monolog\\Processor\\PsrLogMessageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php', + 'Monolog\\Processor\\TagProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/TagProcessor.php', + 'Monolog\\Processor\\UidProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/UidProcessor.php', + 'Monolog\\Processor\\WebProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/WebProcessor.php', + 'Monolog\\Registry' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Registry.php', + 'Monolog\\ResettableInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/ResettableInterface.php', + 'Monolog\\SignalHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/SignalHandler.php', + 'Monolog\\Utils' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Utils.php', + 'PhpParser\\Autoloader' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Autoloader.php', + 'PhpParser\\Builder' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder.php', + 'PhpParser\\BuilderAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/BuilderAbstract.php', + 'PhpParser\\BuilderFactory' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/BuilderFactory.php', + 'PhpParser\\Builder\\Class_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Class_.php', + 'PhpParser\\Builder\\Declaration' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Declaration.php', + 'PhpParser\\Builder\\FunctionLike' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php', + 'PhpParser\\Builder\\Function_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Function_.php', + 'PhpParser\\Builder\\Interface_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Interface_.php', + 'PhpParser\\Builder\\Method' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Method.php', + 'PhpParser\\Builder\\Namespace_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php', + 'PhpParser\\Builder\\Param' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Param.php', + 'PhpParser\\Builder\\Property' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Property.php', + 'PhpParser\\Builder\\Trait_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Trait_.php', + 'PhpParser\\Builder\\Use_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Use_.php', + 'PhpParser\\Comment' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Comment.php', + 'PhpParser\\Comment\\Doc' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Comment/Doc.php', + 'PhpParser\\Error' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Error.php', + 'PhpParser\\Lexer' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer.php', + 'PhpParser\\Lexer\\Emulative' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php', + 'PhpParser\\Node' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node.php', + 'PhpParser\\NodeAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeAbstract.php', + 'PhpParser\\NodeDumper' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeDumper.php', + 'PhpParser\\NodeTraverser' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeTraverser.php', + 'PhpParser\\NodeTraverserInterface' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php', + 'PhpParser\\NodeVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor.php', + 'PhpParser\\NodeVisitorAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php', + 'PhpParser\\NodeVisitor\\NameResolver' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php', + 'PhpParser\\Node\\Arg' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Arg.php', + 'PhpParser\\Node\\Const_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Const_.php', + 'PhpParser\\Node\\Expr' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr.php', + 'PhpParser\\Node\\Expr\\ArrayDimFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php', + 'PhpParser\\Node\\Expr\\ArrayItem' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php', + 'PhpParser\\Node\\Expr\\Array_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php', + 'PhpParser\\Node\\Expr\\Assign' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php', + 'PhpParser\\Node\\Expr\\AssignOp' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php', + 'PhpParser\\Node\\Expr\\AssignOp\\BitwiseAnd' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php', + 'PhpParser\\Node\\Expr\\AssignOp\\BitwiseOr' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php', + 'PhpParser\\Node\\Expr\\AssignOp\\BitwiseXor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Concat' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Div' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Minus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Mod' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Mul' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Plus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Pow' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.php', + 'PhpParser\\Node\\Expr\\AssignOp\\ShiftLeft' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php', + 'PhpParser\\Node\\Expr\\AssignOp\\ShiftRight' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php', + 'PhpParser\\Node\\Expr\\AssignRef' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php', + 'PhpParser\\Node\\Expr\\BinaryOp' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\BitwiseAnd' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\BitwiseOr' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\BitwiseXor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\BooleanAnd' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\BooleanOr' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Coalesce' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Concat' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Div' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Equal' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Greater' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\GreaterOrEqual' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Identical' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\LogicalAnd' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\LogicalOr' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\LogicalXor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Minus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Mod' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Mul' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\NotEqual' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\NotIdentical' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Plus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Pow' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\ShiftLeft' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\ShiftRight' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Smaller' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\SmallerOrEqual' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php', + 'PhpParser\\Node\\Expr\\BinaryOp\\Spaceship' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php', + 'PhpParser\\Node\\Expr\\BitwiseNot' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php', + 'PhpParser\\Node\\Expr\\BooleanNot' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php', + 'PhpParser\\Node\\Expr\\Cast' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php', + 'PhpParser\\Node\\Expr\\Cast\\Array_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php', + 'PhpParser\\Node\\Expr\\Cast\\Bool_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php', + 'PhpParser\\Node\\Expr\\Cast\\Double' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php', + 'PhpParser\\Node\\Expr\\Cast\\Int_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.php', + 'PhpParser\\Node\\Expr\\Cast\\Object_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.php', + 'PhpParser\\Node\\Expr\\Cast\\String_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.php', + 'PhpParser\\Node\\Expr\\Cast\\Unset_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.php', + 'PhpParser\\Node\\Expr\\ClassConstFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php', + 'PhpParser\\Node\\Expr\\Clone_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php', + 'PhpParser\\Node\\Expr\\Closure' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php', + 'PhpParser\\Node\\Expr\\ClosureUse' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php', + 'PhpParser\\Node\\Expr\\ConstFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php', + 'PhpParser\\Node\\Expr\\Empty_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php', + 'PhpParser\\Node\\Expr\\ErrorSuppress' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php', + 'PhpParser\\Node\\Expr\\Eval_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php', + 'PhpParser\\Node\\Expr\\Exit_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php', + 'PhpParser\\Node\\Expr\\FuncCall' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php', + 'PhpParser\\Node\\Expr\\Include_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php', + 'PhpParser\\Node\\Expr\\Instanceof_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php', + 'PhpParser\\Node\\Expr\\Isset_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php', + 'PhpParser\\Node\\Expr\\List_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php', + 'PhpParser\\Node\\Expr\\MethodCall' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php', + 'PhpParser\\Node\\Expr\\New_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php', + 'PhpParser\\Node\\Expr\\PostDec' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php', + 'PhpParser\\Node\\Expr\\PostInc' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php', + 'PhpParser\\Node\\Expr\\PreDec' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php', + 'PhpParser\\Node\\Expr\\PreInc' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php', + 'PhpParser\\Node\\Expr\\Print_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php', + 'PhpParser\\Node\\Expr\\PropertyFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php', + 'PhpParser\\Node\\Expr\\ShellExec' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php', + 'PhpParser\\Node\\Expr\\StaticCall' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php', + 'PhpParser\\Node\\Expr\\StaticPropertyFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php', + 'PhpParser\\Node\\Expr\\Ternary' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php', + 'PhpParser\\Node\\Expr\\UnaryMinus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php', + 'PhpParser\\Node\\Expr\\UnaryPlus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php', + 'PhpParser\\Node\\Expr\\Variable' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php', + 'PhpParser\\Node\\Expr\\YieldFrom' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php', + 'PhpParser\\Node\\Expr\\Yield_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php', + 'PhpParser\\Node\\FunctionLike' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php', + 'PhpParser\\Node\\Name' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Name.php', + 'PhpParser\\Node\\Name\\FullyQualified' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php', + 'PhpParser\\Node\\Name\\Relative' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php', + 'PhpParser\\Node\\Param' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Param.php', + 'PhpParser\\Node\\Scalar' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar.php', + 'PhpParser\\Node\\Scalar\\DNumber' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php', + 'PhpParser\\Node\\Scalar\\Encapsed' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php', + 'PhpParser\\Node\\Scalar\\EncapsedStringPart' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php', + 'PhpParser\\Node\\Scalar\\LNumber' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php', + 'PhpParser\\Node\\Scalar\\MagicConst' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Class_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Dir' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\File' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Function_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Line' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Method' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Namespace_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Trait_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php', + 'PhpParser\\Node\\Scalar\\String_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php', + 'PhpParser\\Node\\Stmt' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt.php', + 'PhpParser\\Node\\Stmt\\Break_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php', + 'PhpParser\\Node\\Stmt\\Case_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php', + 'PhpParser\\Node\\Stmt\\Catch_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php', + 'PhpParser\\Node\\Stmt\\ClassConst' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php', + 'PhpParser\\Node\\Stmt\\ClassLike' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php', + 'PhpParser\\Node\\Stmt\\ClassMethod' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php', + 'PhpParser\\Node\\Stmt\\Class_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php', + 'PhpParser\\Node\\Stmt\\Const_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php', + 'PhpParser\\Node\\Stmt\\Continue_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php', + 'PhpParser\\Node\\Stmt\\DeclareDeclare' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php', + 'PhpParser\\Node\\Stmt\\Declare_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php', + 'PhpParser\\Node\\Stmt\\Do_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php', + 'PhpParser\\Node\\Stmt\\Echo_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php', + 'PhpParser\\Node\\Stmt\\ElseIf_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php', + 'PhpParser\\Node\\Stmt\\Else_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php', + 'PhpParser\\Node\\Stmt\\For_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php', + 'PhpParser\\Node\\Stmt\\Foreach_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php', + 'PhpParser\\Node\\Stmt\\Function_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php', + 'PhpParser\\Node\\Stmt\\Global_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php', + 'PhpParser\\Node\\Stmt\\Goto_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php', + 'PhpParser\\Node\\Stmt\\GroupUse' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php', + 'PhpParser\\Node\\Stmt\\HaltCompiler' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php', + 'PhpParser\\Node\\Stmt\\If_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php', + 'PhpParser\\Node\\Stmt\\InlineHTML' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php', + 'PhpParser\\Node\\Stmt\\Interface_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php', + 'PhpParser\\Node\\Stmt\\Label' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php', + 'PhpParser\\Node\\Stmt\\Namespace_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php', + 'PhpParser\\Node\\Stmt\\Nop' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php', + 'PhpParser\\Node\\Stmt\\Property' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php', + 'PhpParser\\Node\\Stmt\\PropertyProperty' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php', + 'PhpParser\\Node\\Stmt\\Return_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php', + 'PhpParser\\Node\\Stmt\\StaticVar' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php', + 'PhpParser\\Node\\Stmt\\Static_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php', + 'PhpParser\\Node\\Stmt\\Switch_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php', + 'PhpParser\\Node\\Stmt\\Throw_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php', + 'PhpParser\\Node\\Stmt\\TraitUse' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php', + 'PhpParser\\Node\\Stmt\\TraitUseAdaptation' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php', + 'PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Alias' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php', + 'PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Precedence' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php', + 'PhpParser\\Node\\Stmt\\Trait_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php', + 'PhpParser\\Node\\Stmt\\TryCatch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php', + 'PhpParser\\Node\\Stmt\\Unset_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php', + 'PhpParser\\Node\\Stmt\\UseUse' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php', + 'PhpParser\\Node\\Stmt\\Use_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php', + 'PhpParser\\Node\\Stmt\\While_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php', + 'PhpParser\\Parser' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser.php', + 'PhpParser\\ParserAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ParserAbstract.php', + 'PhpParser\\ParserFactory' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ParserFactory.php', + 'PhpParser\\Parser\\Multiple' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser/Multiple.php', + 'PhpParser\\Parser\\Php5' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser/Php5.php', + 'PhpParser\\Parser\\Php7' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser/Php7.php', + 'PhpParser\\Parser\\Tokens' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser/Tokens.php', + 'PhpParser\\PrettyPrinterAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php', + 'PhpParser\\PrettyPrinter\\Standard' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php', + 'PhpParser\\Serializer' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Serializer.php', + 'PhpParser\\Serializer\\XML' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Serializer/XML.php', + 'PhpParser\\Unserializer' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Unserializer.php', + 'PhpParser\\Unserializer\\XML' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Unserializer/XML.php', + 'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php', + 'Psr\\Log\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/log/Psr/Log/InvalidArgumentException.php', + 'Psr\\Log\\LogLevel' => __DIR__ . '/..' . '/psr/log/Psr/Log/LogLevel.php', + 'Psr\\Log\\LoggerAwareInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareInterface.php', + 'Psr\\Log\\LoggerAwareTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareTrait.php', + 'Psr\\Log\\LoggerInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerInterface.php', + 'Psr\\Log\\LoggerTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerTrait.php', + 'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/NullLogger.php', + 'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', + 'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', + 'Psr\\Log\\Test\\TestLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/TestLogger.php', + 'Psy\\Autoloader' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Autoloader.php', + 'Psy\\CodeCleaner' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner.php', + 'Psy\\CodeCleaner\\AbstractClassPass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/AbstractClassPass.php', + 'Psy\\CodeCleaner\\AssignThisVariablePass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/AssignThisVariablePass.php', + 'Psy\\CodeCleaner\\CallTimePassByReferencePass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/CallTimePassByReferencePass.php', + 'Psy\\CodeCleaner\\CalledClassPass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/CalledClassPass.php', + 'Psy\\CodeCleaner\\CodeCleanerPass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/CodeCleanerPass.php', + 'Psy\\CodeCleaner\\ExitPass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/ExitPass.php', + 'Psy\\CodeCleaner\\FunctionReturnInWriteContextPass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/FunctionReturnInWriteContextPass.php', + 'Psy\\CodeCleaner\\ImplicitReturnPass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/ImplicitReturnPass.php', + 'Psy\\CodeCleaner\\InstanceOfPass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/InstanceOfPass.php', + 'Psy\\CodeCleaner\\LeavePsyshAlonePass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/LeavePsyshAlonePass.php', + 'Psy\\CodeCleaner\\LegacyEmptyPass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/LegacyEmptyPass.php', + 'Psy\\CodeCleaner\\MagicConstantsPass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/MagicConstantsPass.php', + 'Psy\\CodeCleaner\\NamespaceAwarePass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/NamespaceAwarePass.php', + 'Psy\\CodeCleaner\\NamespacePass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/NamespacePass.php', + 'Psy\\CodeCleaner\\StaticConstructorPass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/StaticConstructorPass.php', + 'Psy\\CodeCleaner\\StrictTypesPass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/StrictTypesPass.php', + 'Psy\\CodeCleaner\\UseStatementPass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/UseStatementPass.php', + 'Psy\\CodeCleaner\\ValidClassNamePass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/ValidClassNamePass.php', + 'Psy\\CodeCleaner\\ValidConstantPass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/ValidConstantPass.php', + 'Psy\\CodeCleaner\\ValidFunctionNamePass' => __DIR__ . '/..' . '/psy/psysh/src/Psy/CodeCleaner/ValidFunctionNamePass.php', + 'Psy\\Command\\BufferCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/BufferCommand.php', + 'Psy\\Command\\ClearCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ClearCommand.php', + 'Psy\\Command\\Command' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/Command.php', + 'Psy\\Command\\DocCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/DocCommand.php', + 'Psy\\Command\\DumpCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/DumpCommand.php', + 'Psy\\Command\\ExitCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ExitCommand.php', + 'Psy\\Command\\HelpCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/HelpCommand.php', + 'Psy\\Command\\HistoryCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/HistoryCommand.php', + 'Psy\\Command\\ListCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ListCommand.php', + 'Psy\\Command\\ListCommand\\ClassConstantEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ListCommand/ClassConstantEnumerator.php', + 'Psy\\Command\\ListCommand\\ClassEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ListCommand/ClassEnumerator.php', + 'Psy\\Command\\ListCommand\\ConstantEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ListCommand/ConstantEnumerator.php', + 'Psy\\Command\\ListCommand\\Enumerator' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ListCommand/Enumerator.php', + 'Psy\\Command\\ListCommand\\FunctionEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ListCommand/FunctionEnumerator.php', + 'Psy\\Command\\ListCommand\\GlobalVariableEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ListCommand/GlobalVariableEnumerator.php', + 'Psy\\Command\\ListCommand\\InterfaceEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ListCommand/InterfaceEnumerator.php', + 'Psy\\Command\\ListCommand\\MethodEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ListCommand/MethodEnumerator.php', + 'Psy\\Command\\ListCommand\\PropertyEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ListCommand/PropertyEnumerator.php', + 'Psy\\Command\\ListCommand\\TraitEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ListCommand/TraitEnumerator.php', + 'Psy\\Command\\ListCommand\\VariableEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ListCommand/VariableEnumerator.php', + 'Psy\\Command\\ParseCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ParseCommand.php', + 'Psy\\Command\\PsyVersionCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/PsyVersionCommand.php', + 'Psy\\Command\\ReflectingCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ReflectingCommand.php', + 'Psy\\Command\\ShowCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ShowCommand.php', + 'Psy\\Command\\ThrowUpCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/ThrowUpCommand.php', + 'Psy\\Command\\TraceCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/TraceCommand.php', + 'Psy\\Command\\WhereamiCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/WhereamiCommand.php', + 'Psy\\Command\\WtfCommand' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Command/WtfCommand.php', + 'Psy\\Compiler' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Compiler.php', + 'Psy\\ConfigPaths' => __DIR__ . '/..' . '/psy/psysh/src/Psy/ConfigPaths.php', + 'Psy\\Configuration' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Configuration.php', + 'Psy\\ConsoleColorFactory' => __DIR__ . '/..' . '/psy/psysh/src/Psy/ConsoleColorFactory.php', + 'Psy\\Context' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Context.php', + 'Psy\\ContextAware' => __DIR__ . '/..' . '/psy/psysh/src/Psy/ContextAware.php', + 'Psy\\Exception\\BreakException' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Exception/BreakException.php', + 'Psy\\Exception\\DeprecatedException' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Exception/DeprecatedException.php', + 'Psy\\Exception\\ErrorException' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Exception/ErrorException.php', + 'Psy\\Exception\\Exception' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Exception/Exception.php', + 'Psy\\Exception\\FatalErrorException' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Exception/FatalErrorException.php', + 'Psy\\Exception\\ParseErrorException' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Exception/ParseErrorException.php', + 'Psy\\Exception\\RuntimeException' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Exception/RuntimeException.php', + 'Psy\\Exception\\ThrowUpException' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Exception/ThrowUpException.php', + 'Psy\\Exception\\TypeErrorException' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Exception/TypeErrorException.php', + 'Psy\\ExecutionLoop\\ForkingLoop' => __DIR__ . '/..' . '/psy/psysh/src/Psy/ExecutionLoop/ForkingLoop.php', + 'Psy\\ExecutionLoop\\Loop' => __DIR__ . '/..' . '/psy/psysh/src/Psy/ExecutionLoop/Loop.php', + 'Psy\\Formatter\\CodeFormatter' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Formatter/CodeFormatter.php', + 'Psy\\Formatter\\DocblockFormatter' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Formatter/DocblockFormatter.php', + 'Psy\\Formatter\\Formatter' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Formatter/Formatter.php', + 'Psy\\Formatter\\SignatureFormatter' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Formatter/SignatureFormatter.php', + 'Psy\\Output\\OutputPager' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Output/OutputPager.php', + 'Psy\\Output\\PassthruPager' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Output/PassthruPager.php', + 'Psy\\Output\\ProcOutputPager' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Output/ProcOutputPager.php', + 'Psy\\Output\\ShellOutput' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Output/ShellOutput.php', + 'Psy\\ParserFactory' => __DIR__ . '/..' . '/psy/psysh/src/Psy/ParserFactory.php', + 'Psy\\Readline\\GNUReadline' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Readline/GNUReadline.php', + 'Psy\\Readline\\Libedit' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Readline/Libedit.php', + 'Psy\\Readline\\Readline' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Readline/Readline.php', + 'Psy\\Readline\\Transient' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Readline/Transient.php', + 'Psy\\Reflection\\ReflectionConstant' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Reflection/ReflectionConstant.php', + 'Psy\\Shell' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Shell.php', + 'Psy\\TabCompletion\\AutoCompleter' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/AutoCompleter.php', + 'Psy\\TabCompletion\\Matcher\\AbstractContextAwareMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractContextAwareMatcher.php', + 'Psy\\TabCompletion\\Matcher\\AbstractMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractMatcher.php', + 'Psy\\TabCompletion\\Matcher\\ClassAttributesMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/ClassAttributesMatcher.php', + 'Psy\\TabCompletion\\Matcher\\ClassMethodsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodsMatcher.php', + 'Psy\\TabCompletion\\Matcher\\ClassNamesMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/ClassNamesMatcher.php', + 'Psy\\TabCompletion\\Matcher\\CommandsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/CommandsMatcher.php', + 'Psy\\TabCompletion\\Matcher\\ConstantsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/ConstantsMatcher.php', + 'Psy\\TabCompletion\\Matcher\\FunctionsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/FunctionsMatcher.php', + 'Psy\\TabCompletion\\Matcher\\KeywordsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/KeywordsMatcher.php', + 'Psy\\TabCompletion\\Matcher\\MongoClientMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/MongoClientMatcher.php', + 'Psy\\TabCompletion\\Matcher\\MongoDatabaseMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/MongoDatabaseMatcher.php', + 'Psy\\TabCompletion\\Matcher\\ObjectAttributesMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectAttributesMatcher.php', + 'Psy\\TabCompletion\\Matcher\\ObjectMethodsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php', + 'Psy\\TabCompletion\\Matcher\\VariablesMatcher' => __DIR__ . '/..' . '/psy/psysh/src/Psy/TabCompletion/Matcher/VariablesMatcher.php', + 'Psy\\Util\\Docblock' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Util/Docblock.php', + 'Psy\\Util\\Json' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Util/Json.php', + 'Psy\\Util\\Mirror' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Util/Mirror.php', + 'Psy\\Util\\Str' => __DIR__ . '/..' . '/psy/psysh/src/Psy/Util/Str.php', + 'Psy\\VarDumper\\Cloner' => __DIR__ . '/..' . '/psy/psysh/src/Psy/VarDumper/Cloner.php', + 'Psy\\VarDumper\\Dumper' => __DIR__ . '/..' . '/psy/psysh/src/Psy/VarDumper/Dumper.php', + 'Psy\\VarDumper\\Presenter' => __DIR__ . '/..' . '/psy/psysh/src/Psy/VarDumper/Presenter.php', + 'Psy\\VarDumper\\PresenterAware' => __DIR__ . '/..' . '/psy/psysh/src/Psy/VarDumper/PresenterAware.php', + 'SessionHandlerInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Resources/stubs/SessionHandlerInterface.php', + 'Stringy\\StaticStringy' => __DIR__ . '/..' . '/danielstjules/stringy/src/StaticStringy.php', + 'Stringy\\Stringy' => __DIR__ . '/..' . '/danielstjules/stringy/src/Stringy.php', + 'SuperClosure\\Analyzer\\AstAnalyzer' => __DIR__ . '/..' . '/jeremeamia/superclosure/src/Analyzer/AstAnalyzer.php', + 'SuperClosure\\Analyzer\\ClosureAnalyzer' => __DIR__ . '/..' . '/jeremeamia/superclosure/src/Analyzer/ClosureAnalyzer.php', + 'SuperClosure\\Analyzer\\Token' => __DIR__ . '/..' . '/jeremeamia/superclosure/src/Analyzer/Token.php', + 'SuperClosure\\Analyzer\\TokenAnalyzer' => __DIR__ . '/..' . '/jeremeamia/superclosure/src/Analyzer/TokenAnalyzer.php', + 'SuperClosure\\Analyzer\\Visitor\\ClosureLocatorVisitor' => __DIR__ . '/..' . '/jeremeamia/superclosure/src/Analyzer/Visitor/ClosureLocatorVisitor.php', + 'SuperClosure\\Analyzer\\Visitor\\MagicConstantVisitor' => __DIR__ . '/..' . '/jeremeamia/superclosure/src/Analyzer/Visitor/MagicConstantVisitor.php', + 'SuperClosure\\Analyzer\\Visitor\\ThisDetectorVisitor' => __DIR__ . '/..' . '/jeremeamia/superclosure/src/Analyzer/Visitor/ThisDetectorVisitor.php', + 'SuperClosure\\Exception\\ClosureAnalysisException' => __DIR__ . '/..' . '/jeremeamia/superclosure/src/Exception/ClosureAnalysisException.php', + 'SuperClosure\\Exception\\ClosureSerializationException' => __DIR__ . '/..' . '/jeremeamia/superclosure/src/Exception/ClosureSerializationException.php', + 'SuperClosure\\Exception\\ClosureUnserializationException' => __DIR__ . '/..' . '/jeremeamia/superclosure/src/Exception/ClosureUnserializationException.php', + 'SuperClosure\\Exception\\SuperClosureException' => __DIR__ . '/..' . '/jeremeamia/superclosure/src/Exception/SuperClosureException.php', + 'SuperClosure\\SerializableClosure' => __DIR__ . '/..' . '/jeremeamia/superclosure/src/SerializableClosure.php', + 'SuperClosure\\Serializer' => __DIR__ . '/..' . '/jeremeamia/superclosure/src/Serializer.php', + 'SuperClosure\\SerializerInterface' => __DIR__ . '/..' . '/jeremeamia/superclosure/src/SerializerInterface.php', + 'Symfony\\Component\\Console\\Application' => __DIR__ . '/..' . '/symfony/console/Application.php', + 'Symfony\\Component\\Console\\Command\\Command' => __DIR__ . '/..' . '/symfony/console/Command/Command.php', + 'Symfony\\Component\\Console\\Command\\HelpCommand' => __DIR__ . '/..' . '/symfony/console/Command/HelpCommand.php', + 'Symfony\\Component\\Console\\Command\\ListCommand' => __DIR__ . '/..' . '/symfony/console/Command/ListCommand.php', + 'Symfony\\Component\\Console\\ConsoleEvents' => __DIR__ . '/..' . '/symfony/console/ConsoleEvents.php', + 'Symfony\\Component\\Console\\Descriptor\\ApplicationDescription' => __DIR__ . '/..' . '/symfony/console/Descriptor/ApplicationDescription.php', + 'Symfony\\Component\\Console\\Descriptor\\Descriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/Descriptor.php', + 'Symfony\\Component\\Console\\Descriptor\\DescriptorInterface' => __DIR__ . '/..' . '/symfony/console/Descriptor/DescriptorInterface.php', + 'Symfony\\Component\\Console\\Descriptor\\JsonDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/JsonDescriptor.php', + 'Symfony\\Component\\Console\\Descriptor\\MarkdownDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/MarkdownDescriptor.php', + 'Symfony\\Component\\Console\\Descriptor\\TextDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/TextDescriptor.php', + 'Symfony\\Component\\Console\\Descriptor\\XmlDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/XmlDescriptor.php', + 'Symfony\\Component\\Console\\Event\\ConsoleCommandEvent' => __DIR__ . '/..' . '/symfony/console/Event/ConsoleCommandEvent.php', + 'Symfony\\Component\\Console\\Event\\ConsoleEvent' => __DIR__ . '/..' . '/symfony/console/Event/ConsoleEvent.php', + 'Symfony\\Component\\Console\\Event\\ConsoleExceptionEvent' => __DIR__ . '/..' . '/symfony/console/Event/ConsoleExceptionEvent.php', + 'Symfony\\Component\\Console\\Event\\ConsoleTerminateEvent' => __DIR__ . '/..' . '/symfony/console/Event/ConsoleTerminateEvent.php', + 'Symfony\\Component\\Console\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/console/Exception/RuntimeException.php', + 'Symfony\\Component\\Console\\Formatter\\OutputFormatter' => __DIR__ . '/..' . '/symfony/console/Formatter/OutputFormatter.php', + 'Symfony\\Component\\Console\\Formatter\\OutputFormatterInterface' => __DIR__ . '/..' . '/symfony/console/Formatter/OutputFormatterInterface.php', + 'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyle' => __DIR__ . '/..' . '/symfony/console/Formatter/OutputFormatterStyle.php', + 'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleInterface' => __DIR__ . '/..' . '/symfony/console/Formatter/OutputFormatterStyleInterface.php', + 'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleStack' => __DIR__ . '/..' . '/symfony/console/Formatter/OutputFormatterStyleStack.php', + 'Symfony\\Component\\Console\\Helper\\DebugFormatterHelper' => __DIR__ . '/..' . '/symfony/console/Helper/DebugFormatterHelper.php', + 'Symfony\\Component\\Console\\Helper\\DescriptorHelper' => __DIR__ . '/..' . '/symfony/console/Helper/DescriptorHelper.php', + 'Symfony\\Component\\Console\\Helper\\DialogHelper' => __DIR__ . '/..' . '/symfony/console/Helper/DialogHelper.php', + 'Symfony\\Component\\Console\\Helper\\FormatterHelper' => __DIR__ . '/..' . '/symfony/console/Helper/FormatterHelper.php', + 'Symfony\\Component\\Console\\Helper\\Helper' => __DIR__ . '/..' . '/symfony/console/Helper/Helper.php', + 'Symfony\\Component\\Console\\Helper\\HelperInterface' => __DIR__ . '/..' . '/symfony/console/Helper/HelperInterface.php', + 'Symfony\\Component\\Console\\Helper\\HelperSet' => __DIR__ . '/..' . '/symfony/console/Helper/HelperSet.php', + 'Symfony\\Component\\Console\\Helper\\InputAwareHelper' => __DIR__ . '/..' . '/symfony/console/Helper/InputAwareHelper.php', + 'Symfony\\Component\\Console\\Helper\\ProcessHelper' => __DIR__ . '/..' . '/symfony/console/Helper/ProcessHelper.php', + 'Symfony\\Component\\Console\\Helper\\ProgressBar' => __DIR__ . '/..' . '/symfony/console/Helper/ProgressBar.php', + 'Symfony\\Component\\Console\\Helper\\ProgressHelper' => __DIR__ . '/..' . '/symfony/console/Helper/ProgressHelper.php', + 'Symfony\\Component\\Console\\Helper\\QuestionHelper' => __DIR__ . '/..' . '/symfony/console/Helper/QuestionHelper.php', + 'Symfony\\Component\\Console\\Helper\\SymfonyQuestionHelper' => __DIR__ . '/..' . '/symfony/console/Helper/SymfonyQuestionHelper.php', + 'Symfony\\Component\\Console\\Helper\\Table' => __DIR__ . '/..' . '/symfony/console/Helper/Table.php', + 'Symfony\\Component\\Console\\Helper\\TableCell' => __DIR__ . '/..' . '/symfony/console/Helper/TableCell.php', + 'Symfony\\Component\\Console\\Helper\\TableHelper' => __DIR__ . '/..' . '/symfony/console/Helper/TableHelper.php', + 'Symfony\\Component\\Console\\Helper\\TableSeparator' => __DIR__ . '/..' . '/symfony/console/Helper/TableSeparator.php', + 'Symfony\\Component\\Console\\Helper\\TableStyle' => __DIR__ . '/..' . '/symfony/console/Helper/TableStyle.php', + 'Symfony\\Component\\Console\\Input\\ArgvInput' => __DIR__ . '/..' . '/symfony/console/Input/ArgvInput.php', + 'Symfony\\Component\\Console\\Input\\ArrayInput' => __DIR__ . '/..' . '/symfony/console/Input/ArrayInput.php', + 'Symfony\\Component\\Console\\Input\\Input' => __DIR__ . '/..' . '/symfony/console/Input/Input.php', + 'Symfony\\Component\\Console\\Input\\InputArgument' => __DIR__ . '/..' . '/symfony/console/Input/InputArgument.php', + 'Symfony\\Component\\Console\\Input\\InputAwareInterface' => __DIR__ . '/..' . '/symfony/console/Input/InputAwareInterface.php', + 'Symfony\\Component\\Console\\Input\\InputDefinition' => __DIR__ . '/..' . '/symfony/console/Input/InputDefinition.php', + 'Symfony\\Component\\Console\\Input\\InputInterface' => __DIR__ . '/..' . '/symfony/console/Input/InputInterface.php', + 'Symfony\\Component\\Console\\Input\\InputOption' => __DIR__ . '/..' . '/symfony/console/Input/InputOption.php', + 'Symfony\\Component\\Console\\Input\\StringInput' => __DIR__ . '/..' . '/symfony/console/Input/StringInput.php', + 'Symfony\\Component\\Console\\Logger\\ConsoleLogger' => __DIR__ . '/..' . '/symfony/console/Logger/ConsoleLogger.php', + 'Symfony\\Component\\Console\\Output\\BufferedOutput' => __DIR__ . '/..' . '/symfony/console/Output/BufferedOutput.php', + 'Symfony\\Component\\Console\\Output\\ConsoleOutput' => __DIR__ . '/..' . '/symfony/console/Output/ConsoleOutput.php', + 'Symfony\\Component\\Console\\Output\\ConsoleOutputInterface' => __DIR__ . '/..' . '/symfony/console/Output/ConsoleOutputInterface.php', + 'Symfony\\Component\\Console\\Output\\NullOutput' => __DIR__ . '/..' . '/symfony/console/Output/NullOutput.php', + 'Symfony\\Component\\Console\\Output\\Output' => __DIR__ . '/..' . '/symfony/console/Output/Output.php', + 'Symfony\\Component\\Console\\Output\\OutputInterface' => __DIR__ . '/..' . '/symfony/console/Output/OutputInterface.php', + 'Symfony\\Component\\Console\\Output\\StreamOutput' => __DIR__ . '/..' . '/symfony/console/Output/StreamOutput.php', + 'Symfony\\Component\\Console\\Question\\ChoiceQuestion' => __DIR__ . '/..' . '/symfony/console/Question/ChoiceQuestion.php', + 'Symfony\\Component\\Console\\Question\\ConfirmationQuestion' => __DIR__ . '/..' . '/symfony/console/Question/ConfirmationQuestion.php', + 'Symfony\\Component\\Console\\Question\\Question' => __DIR__ . '/..' . '/symfony/console/Question/Question.php', + 'Symfony\\Component\\Console\\Shell' => __DIR__ . '/..' . '/symfony/console/Shell.php', + 'Symfony\\Component\\Console\\Style\\OutputStyle' => __DIR__ . '/..' . '/symfony/console/Style/OutputStyle.php', + 'Symfony\\Component\\Console\\Style\\StyleInterface' => __DIR__ . '/..' . '/symfony/console/Style/StyleInterface.php', + 'Symfony\\Component\\Console\\Style\\SymfonyStyle' => __DIR__ . '/..' . '/symfony/console/Style/SymfonyStyle.php', + 'Symfony\\Component\\Console\\Tester\\ApplicationTester' => __DIR__ . '/..' . '/symfony/console/Tester/ApplicationTester.php', + 'Symfony\\Component\\Console\\Tester\\CommandTester' => __DIR__ . '/..' . '/symfony/console/Tester/CommandTester.php', + 'Symfony\\Component\\CssSelector\\CssSelector' => __DIR__ . '/..' . '/symfony/css-selector/CssSelector.php', + 'Symfony\\Component\\CssSelector\\CssSelectorConverter' => __DIR__ . '/..' . '/symfony/css-selector/CssSelectorConverter.php', + 'Symfony\\Component\\CssSelector\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/css-selector/Exception/ExceptionInterface.php', + 'Symfony\\Component\\CssSelector\\Exception\\ExpressionErrorException' => __DIR__ . '/..' . '/symfony/css-selector/Exception/ExpressionErrorException.php', + 'Symfony\\Component\\CssSelector\\Exception\\InternalErrorException' => __DIR__ . '/..' . '/symfony/css-selector/Exception/InternalErrorException.php', + 'Symfony\\Component\\CssSelector\\Exception\\ParseException' => __DIR__ . '/..' . '/symfony/css-selector/Exception/ParseException.php', + 'Symfony\\Component\\CssSelector\\Exception\\SyntaxErrorException' => __DIR__ . '/..' . '/symfony/css-selector/Exception/SyntaxErrorException.php', + 'Symfony\\Component\\CssSelector\\Node\\AbstractNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/AbstractNode.php', + 'Symfony\\Component\\CssSelector\\Node\\AttributeNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/AttributeNode.php', + 'Symfony\\Component\\CssSelector\\Node\\ClassNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/ClassNode.php', + 'Symfony\\Component\\CssSelector\\Node\\CombinedSelectorNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/CombinedSelectorNode.php', + 'Symfony\\Component\\CssSelector\\Node\\ElementNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/ElementNode.php', + 'Symfony\\Component\\CssSelector\\Node\\FunctionNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/FunctionNode.php', + 'Symfony\\Component\\CssSelector\\Node\\HashNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/HashNode.php', + 'Symfony\\Component\\CssSelector\\Node\\NegationNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/NegationNode.php', + 'Symfony\\Component\\CssSelector\\Node\\NodeInterface' => __DIR__ . '/..' . '/symfony/css-selector/Node/NodeInterface.php', + 'Symfony\\Component\\CssSelector\\Node\\PseudoNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/PseudoNode.php', + 'Symfony\\Component\\CssSelector\\Node\\SelectorNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/SelectorNode.php', + 'Symfony\\Component\\CssSelector\\Node\\Specificity' => __DIR__ . '/..' . '/symfony/css-selector/Node/Specificity.php', + 'Symfony\\Component\\CssSelector\\Parser\\Handler\\CommentHandler' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Handler/CommentHandler.php', + 'Symfony\\Component\\CssSelector\\Parser\\Handler\\HandlerInterface' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Handler/HandlerInterface.php', + 'Symfony\\Component\\CssSelector\\Parser\\Handler\\HashHandler' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Handler/HashHandler.php', + 'Symfony\\Component\\CssSelector\\Parser\\Handler\\IdentifierHandler' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Handler/IdentifierHandler.php', + 'Symfony\\Component\\CssSelector\\Parser\\Handler\\NumberHandler' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Handler/NumberHandler.php', + 'Symfony\\Component\\CssSelector\\Parser\\Handler\\StringHandler' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Handler/StringHandler.php', + 'Symfony\\Component\\CssSelector\\Parser\\Handler\\WhitespaceHandler' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Handler/WhitespaceHandler.php', + 'Symfony\\Component\\CssSelector\\Parser\\Parser' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Parser.php', + 'Symfony\\Component\\CssSelector\\Parser\\ParserInterface' => __DIR__ . '/..' . '/symfony/css-selector/Parser/ParserInterface.php', + 'Symfony\\Component\\CssSelector\\Parser\\Reader' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Reader.php', + 'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\ClassParser' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Shortcut/ClassParser.php', + 'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\ElementParser' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Shortcut/ElementParser.php', + 'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\EmptyStringParser' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php', + 'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\HashParser' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Shortcut/HashParser.php', + 'Symfony\\Component\\CssSelector\\Parser\\Token' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Token.php', + 'Symfony\\Component\\CssSelector\\Parser\\TokenStream' => __DIR__ . '/..' . '/symfony/css-selector/Parser/TokenStream.php', + 'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\Tokenizer' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Tokenizer/Tokenizer.php', + 'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\TokenizerEscaping' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php', + 'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\TokenizerPatterns' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\AbstractExtension' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/AbstractExtension.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\AttributeMatchingExtension' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\CombinationExtension' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/CombinationExtension.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\ExtensionInterface' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/ExtensionInterface.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\FunctionExtension' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/FunctionExtension.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\HtmlExtension' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/HtmlExtension.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\NodeExtension' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/NodeExtension.php', + 'Symfony\\Component\\CssSelector\\XPath\\Extension\\PseudoClassExtension' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/PseudoClassExtension.php', + 'Symfony\\Component\\CssSelector\\XPath\\Translator' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Translator.php', + 'Symfony\\Component\\CssSelector\\XPath\\TranslatorInterface' => __DIR__ . '/..' . '/symfony/css-selector/XPath/TranslatorInterface.php', + 'Symfony\\Component\\CssSelector\\XPath\\XPathExpr' => __DIR__ . '/..' . '/symfony/css-selector/XPath/XPathExpr.php', + 'Symfony\\Component\\Debug\\Debug' => __DIR__ . '/..' . '/symfony/debug/Debug.php', + 'Symfony\\Component\\Debug\\DebugClassLoader' => __DIR__ . '/..' . '/symfony/debug/DebugClassLoader.php', + 'Symfony\\Component\\Debug\\ErrorHandler' => __DIR__ . '/..' . '/symfony/debug/ErrorHandler.php', + 'Symfony\\Component\\Debug\\ErrorHandlerCanary' => __DIR__ . '/..' . '/symfony/debug/ErrorHandler.php', + 'Symfony\\Component\\Debug\\ExceptionHandler' => __DIR__ . '/..' . '/symfony/debug/ExceptionHandler.php', + 'Symfony\\Component\\Debug\\Exception\\ClassNotFoundException' => __DIR__ . '/..' . '/symfony/debug/Exception/ClassNotFoundException.php', + 'Symfony\\Component\\Debug\\Exception\\ContextErrorException' => __DIR__ . '/..' . '/symfony/debug/Exception/ContextErrorException.php', + 'Symfony\\Component\\Debug\\Exception\\DummyException' => __DIR__ . '/..' . '/symfony/debug/Exception/DummyException.php', + 'Symfony\\Component\\Debug\\Exception\\FatalErrorException' => __DIR__ . '/..' . '/symfony/debug/Exception/FatalErrorException.php', + 'Symfony\\Component\\Debug\\Exception\\FatalThrowableError' => __DIR__ . '/..' . '/symfony/debug/Exception/FatalThrowableError.php', + 'Symfony\\Component\\Debug\\Exception\\FlattenException' => __DIR__ . '/..' . '/symfony/debug/Exception/FlattenException.php', + 'Symfony\\Component\\Debug\\Exception\\OutOfMemoryException' => __DIR__ . '/..' . '/symfony/debug/Exception/OutOfMemoryException.php', + 'Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException' => __DIR__ . '/..' . '/symfony/debug/Exception/UndefinedFunctionException.php', + 'Symfony\\Component\\Debug\\Exception\\UndefinedMethodException' => __DIR__ . '/..' . '/symfony/debug/Exception/UndefinedMethodException.php', + 'Symfony\\Component\\Debug\\FatalErrorHandler\\ClassNotFoundFatalErrorHandler' => __DIR__ . '/..' . '/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php', + 'Symfony\\Component\\Debug\\FatalErrorHandler\\FatalErrorHandlerInterface' => __DIR__ . '/..' . '/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php', + 'Symfony\\Component\\Debug\\FatalErrorHandler\\UndefinedFunctionFatalErrorHandler' => __DIR__ . '/..' . '/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php', + 'Symfony\\Component\\Debug\\FatalErrorHandler\\UndefinedMethodFatalErrorHandler' => __DIR__ . '/..' . '/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php', + 'Symfony\\Component\\DomCrawler\\Crawler' => __DIR__ . '/..' . '/symfony/dom-crawler/Crawler.php', + 'Symfony\\Component\\DomCrawler\\Field\\ChoiceFormField' => __DIR__ . '/..' . '/symfony/dom-crawler/Field/ChoiceFormField.php', + 'Symfony\\Component\\DomCrawler\\Field\\FileFormField' => __DIR__ . '/..' . '/symfony/dom-crawler/Field/FileFormField.php', + 'Symfony\\Component\\DomCrawler\\Field\\FormField' => __DIR__ . '/..' . '/symfony/dom-crawler/Field/FormField.php', + 'Symfony\\Component\\DomCrawler\\Field\\InputFormField' => __DIR__ . '/..' . '/symfony/dom-crawler/Field/InputFormField.php', + 'Symfony\\Component\\DomCrawler\\Field\\TextareaFormField' => __DIR__ . '/..' . '/symfony/dom-crawler/Field/TextareaFormField.php', + 'Symfony\\Component\\DomCrawler\\Form' => __DIR__ . '/..' . '/symfony/dom-crawler/Form.php', + 'Symfony\\Component\\DomCrawler\\FormFieldRegistry' => __DIR__ . '/..' . '/symfony/dom-crawler/FormFieldRegistry.php', + 'Symfony\\Component\\DomCrawler\\Link' => __DIR__ . '/..' . '/symfony/dom-crawler/Link.php', + 'Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/ContainerAwareEventDispatcher.php', + 'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php', + 'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcherInterface' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php', + 'Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/WrappedListener.php', + 'Symfony\\Component\\EventDispatcher\\DependencyInjection\\RegisterListenersPass' => __DIR__ . '/..' . '/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php', + 'Symfony\\Component\\EventDispatcher\\Event' => __DIR__ . '/..' . '/symfony/event-dispatcher/Event.php', + 'Symfony\\Component\\EventDispatcher\\EventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/EventDispatcher.php', + 'Symfony\\Component\\EventDispatcher\\EventDispatcherInterface' => __DIR__ . '/..' . '/symfony/event-dispatcher/EventDispatcherInterface.php', + 'Symfony\\Component\\EventDispatcher\\EventSubscriberInterface' => __DIR__ . '/..' . '/symfony/event-dispatcher/EventSubscriberInterface.php', + 'Symfony\\Component\\EventDispatcher\\GenericEvent' => __DIR__ . '/..' . '/symfony/event-dispatcher/GenericEvent.php', + 'Symfony\\Component\\EventDispatcher\\ImmutableEventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/ImmutableEventDispatcher.php', + 'Symfony\\Component\\Finder\\Adapter\\AbstractAdapter' => __DIR__ . '/..' . '/symfony/finder/Adapter/AbstractAdapter.php', + 'Symfony\\Component\\Finder\\Adapter\\AbstractFindAdapter' => __DIR__ . '/..' . '/symfony/finder/Adapter/AbstractFindAdapter.php', + 'Symfony\\Component\\Finder\\Adapter\\AdapterInterface' => __DIR__ . '/..' . '/symfony/finder/Adapter/AdapterInterface.php', + 'Symfony\\Component\\Finder\\Adapter\\BsdFindAdapter' => __DIR__ . '/..' . '/symfony/finder/Adapter/BsdFindAdapter.php', + 'Symfony\\Component\\Finder\\Adapter\\GnuFindAdapter' => __DIR__ . '/..' . '/symfony/finder/Adapter/GnuFindAdapter.php', + 'Symfony\\Component\\Finder\\Adapter\\PhpAdapter' => __DIR__ . '/..' . '/symfony/finder/Adapter/PhpAdapter.php', + 'Symfony\\Component\\Finder\\Comparator\\Comparator' => __DIR__ . '/..' . '/symfony/finder/Comparator/Comparator.php', + 'Symfony\\Component\\Finder\\Comparator\\DateComparator' => __DIR__ . '/..' . '/symfony/finder/Comparator/DateComparator.php', + 'Symfony\\Component\\Finder\\Comparator\\NumberComparator' => __DIR__ . '/..' . '/symfony/finder/Comparator/NumberComparator.php', + 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException' => __DIR__ . '/..' . '/symfony/finder/Exception/AccessDeniedException.php', + 'Symfony\\Component\\Finder\\Exception\\AdapterFailureException' => __DIR__ . '/..' . '/symfony/finder/Exception/AdapterFailureException.php', + 'Symfony\\Component\\Finder\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/finder/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Finder\\Exception\\OperationNotPermitedException' => __DIR__ . '/..' . '/symfony/finder/Exception/OperationNotPermitedException.php', + 'Symfony\\Component\\Finder\\Exception\\ShellCommandFailureException' => __DIR__ . '/..' . '/symfony/finder/Exception/ShellCommandFailureException.php', + 'Symfony\\Component\\Finder\\Expression\\Expression' => __DIR__ . '/..' . '/symfony/finder/Expression/Expression.php', + 'Symfony\\Component\\Finder\\Expression\\Glob' => __DIR__ . '/..' . '/symfony/finder/Expression/Glob.php', + 'Symfony\\Component\\Finder\\Expression\\Regex' => __DIR__ . '/..' . '/symfony/finder/Expression/Regex.php', + 'Symfony\\Component\\Finder\\Expression\\ValueInterface' => __DIR__ . '/..' . '/symfony/finder/Expression/ValueInterface.php', + 'Symfony\\Component\\Finder\\Finder' => __DIR__ . '/..' . '/symfony/finder/Finder.php', + 'Symfony\\Component\\Finder\\Glob' => __DIR__ . '/..' . '/symfony/finder/Glob.php', + 'Symfony\\Component\\Finder\\Iterator\\CustomFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/CustomFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\DateRangeFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/DateRangeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\DepthRangeFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/DepthRangeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\ExcludeDirectoryFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FilePathsIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FilePathsIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FileTypeFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FileTypeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FilecontentFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FilecontentFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FilenameFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FilenameFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\MultiplePcreFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/MultiplePcreFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\PathFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/PathFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\RecursiveDirectoryIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/RecursiveDirectoryIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\SizeRangeFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/SizeRangeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\SortableIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/SortableIterator.php', + 'Symfony\\Component\\Finder\\Shell\\Command' => __DIR__ . '/..' . '/symfony/finder/Shell/Command.php', + 'Symfony\\Component\\Finder\\Shell\\Shell' => __DIR__ . '/..' . '/symfony/finder/Shell/Shell.php', + 'Symfony\\Component\\Finder\\SplFileInfo' => __DIR__ . '/..' . '/symfony/finder/SplFileInfo.php', + 'Symfony\\Component\\HttpFoundation\\AcceptHeader' => __DIR__ . '/..' . '/symfony/http-foundation/AcceptHeader.php', + 'Symfony\\Component\\HttpFoundation\\AcceptHeaderItem' => __DIR__ . '/..' . '/symfony/http-foundation/AcceptHeaderItem.php', + 'Symfony\\Component\\HttpFoundation\\ApacheRequest' => __DIR__ . '/..' . '/symfony/http-foundation/ApacheRequest.php', + 'Symfony\\Component\\HttpFoundation\\BinaryFileResponse' => __DIR__ . '/..' . '/symfony/http-foundation/BinaryFileResponse.php', + 'Symfony\\Component\\HttpFoundation\\Cookie' => __DIR__ . '/..' . '/symfony/http-foundation/Cookie.php', + 'Symfony\\Component\\HttpFoundation\\Exception\\ConflictingHeadersException' => __DIR__ . '/..' . '/symfony/http-foundation/Exception/ConflictingHeadersException.php', + 'Symfony\\Component\\HttpFoundation\\ExpressionRequestMatcher' => __DIR__ . '/..' . '/symfony/http-foundation/ExpressionRequestMatcher.php', + 'Symfony\\Component\\HttpFoundation\\FileBag' => __DIR__ . '/..' . '/symfony/http-foundation/FileBag.php', + 'Symfony\\Component\\HttpFoundation\\File\\Exception\\AccessDeniedException' => __DIR__ . '/..' . '/symfony/http-foundation/File/Exception/AccessDeniedException.php', + 'Symfony\\Component\\HttpFoundation\\File\\Exception\\FileException' => __DIR__ . '/..' . '/symfony/http-foundation/File/Exception/FileException.php', + 'Symfony\\Component\\HttpFoundation\\File\\Exception\\FileNotFoundException' => __DIR__ . '/..' . '/symfony/http-foundation/File/Exception/FileNotFoundException.php', + 'Symfony\\Component\\HttpFoundation\\File\\Exception\\UnexpectedTypeException' => __DIR__ . '/..' . '/symfony/http-foundation/File/Exception/UnexpectedTypeException.php', + 'Symfony\\Component\\HttpFoundation\\File\\Exception\\UploadException' => __DIR__ . '/..' . '/symfony/http-foundation/File/Exception/UploadException.php', + 'Symfony\\Component\\HttpFoundation\\File\\File' => __DIR__ . '/..' . '/symfony/http-foundation/File/File.php', + 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\ExtensionGuesser' => __DIR__ . '/..' . '/symfony/http-foundation/File/MimeType/ExtensionGuesser.php', + 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\ExtensionGuesserInterface' => __DIR__ . '/..' . '/symfony/http-foundation/File/MimeType/ExtensionGuesserInterface.php', + 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\FileBinaryMimeTypeGuesser' => __DIR__ . '/..' . '/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php', + 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\FileinfoMimeTypeGuesser' => __DIR__ . '/..' . '/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php', + 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeExtensionGuesser' => __DIR__ . '/..' . '/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php', + 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesser' => __DIR__ . '/..' . '/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php', + 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesserInterface' => __DIR__ . '/..' . '/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php', + 'Symfony\\Component\\HttpFoundation\\File\\UploadedFile' => __DIR__ . '/..' . '/symfony/http-foundation/File/UploadedFile.php', + 'Symfony\\Component\\HttpFoundation\\HeaderBag' => __DIR__ . '/..' . '/symfony/http-foundation/HeaderBag.php', + 'Symfony\\Component\\HttpFoundation\\IpUtils' => __DIR__ . '/..' . '/symfony/http-foundation/IpUtils.php', + 'Symfony\\Component\\HttpFoundation\\JsonResponse' => __DIR__ . '/..' . '/symfony/http-foundation/JsonResponse.php', + 'Symfony\\Component\\HttpFoundation\\ParameterBag' => __DIR__ . '/..' . '/symfony/http-foundation/ParameterBag.php', + 'Symfony\\Component\\HttpFoundation\\RedirectResponse' => __DIR__ . '/..' . '/symfony/http-foundation/RedirectResponse.php', + 'Symfony\\Component\\HttpFoundation\\Request' => __DIR__ . '/..' . '/symfony/http-foundation/Request.php', + 'Symfony\\Component\\HttpFoundation\\RequestMatcher' => __DIR__ . '/..' . '/symfony/http-foundation/RequestMatcher.php', + 'Symfony\\Component\\HttpFoundation\\RequestMatcherInterface' => __DIR__ . '/..' . '/symfony/http-foundation/RequestMatcherInterface.php', + 'Symfony\\Component\\HttpFoundation\\RequestStack' => __DIR__ . '/..' . '/symfony/http-foundation/RequestStack.php', + 'Symfony\\Component\\HttpFoundation\\Response' => __DIR__ . '/..' . '/symfony/http-foundation/Response.php', + 'Symfony\\Component\\HttpFoundation\\ResponseHeaderBag' => __DIR__ . '/..' . '/symfony/http-foundation/ResponseHeaderBag.php', + 'Symfony\\Component\\HttpFoundation\\ServerBag' => __DIR__ . '/..' . '/symfony/http-foundation/ServerBag.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Attribute\\AttributeBag' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Attribute/AttributeBag.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Attribute\\AttributeBagInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Attribute\\NamespacedAttributeBag' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Flash\\AutoExpireFlashBag' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBag' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Flash/FlashBag.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Flash/FlashBagInterface.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Session' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Session.php', + 'Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/SessionBagInterface.php', + 'Symfony\\Component\\HttpFoundation\\Session\\SessionInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/SessionInterface.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\LegacyPdoSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/LegacyPdoSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcacheSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcachedSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MongoDbSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NullSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\PdoSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\WriteCheckSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\MetadataBag' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/MetadataBag.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockArraySessionStorage' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockFileSessionStorage' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/NativeSessionStorage.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\PhpBridgeSessionStorage' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\AbstractProxy' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\NativeProxy' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\SessionHandlerProxy' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/SessionStorageInterface.php', + 'Symfony\\Component\\HttpFoundation\\StreamedResponse' => __DIR__ . '/..' . '/symfony/http-foundation/StreamedResponse.php', + 'Symfony\\Component\\HttpKernel\\Bundle\\Bundle' => __DIR__ . '/..' . '/symfony/http-kernel/Bundle/Bundle.php', + 'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Bundle/BundleInterface.php', + 'Symfony\\Component\\HttpKernel\\CacheClearer\\CacheClearerInterface' => __DIR__ . '/..' . '/symfony/http-kernel/CacheClearer/CacheClearerInterface.php', + 'Symfony\\Component\\HttpKernel\\CacheClearer\\ChainCacheClearer' => __DIR__ . '/..' . '/symfony/http-kernel/CacheClearer/ChainCacheClearer.php', + 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmer' => __DIR__ . '/..' . '/symfony/http-kernel/CacheWarmer/CacheWarmer.php', + 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerAggregate' => __DIR__ . '/..' . '/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php', + 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerInterface' => __DIR__ . '/..' . '/symfony/http-kernel/CacheWarmer/CacheWarmerInterface.php', + 'Symfony\\Component\\HttpKernel\\CacheWarmer\\WarmableInterface' => __DIR__ . '/..' . '/symfony/http-kernel/CacheWarmer/WarmableInterface.php', + 'Symfony\\Component\\HttpKernel\\Client' => __DIR__ . '/..' . '/symfony/http-kernel/Client.php', + 'Symfony\\Component\\HttpKernel\\Config\\EnvParametersResource' => __DIR__ . '/..' . '/symfony/http-kernel/Config/EnvParametersResource.php', + 'Symfony\\Component\\HttpKernel\\Config\\FileLocator' => __DIR__ . '/..' . '/symfony/http-kernel/Config/FileLocator.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ControllerReference' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ControllerReference.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ControllerResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ControllerResolverInterface.php', + 'Symfony\\Component\\HttpKernel\\Controller\\TraceableControllerResolver' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/TraceableControllerResolver.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\ConfigDataCollector' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/ConfigDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\DataCollector' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/DataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\DataCollectorInterface' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/DataCollectorInterface.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\DumpDataCollector' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/DumpDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\EventDataCollector' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/EventDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\ExceptionDataCollector' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/ExceptionDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\LateDataCollectorInterface' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/LateDataCollectorInterface.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\LoggerDataCollector' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/LoggerDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\MemoryDataCollector' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/MemoryDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\RequestDataCollector' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/RequestDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\RouterDataCollector' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/RouterDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\TimeDataCollector' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/TimeDataCollector.php', + 'Symfony\\Component\\HttpKernel\\DataCollector\\Util\\ValueExporter' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/Util/ValueExporter.php', + 'Symfony\\Component\\HttpKernel\\Debug\\ErrorHandler' => __DIR__ . '/..' . '/symfony/http-kernel/Debug/ErrorHandler.php', + 'Symfony\\Component\\HttpKernel\\Debug\\ExceptionHandler' => __DIR__ . '/..' . '/symfony/http-kernel/Debug/ExceptionHandler.php', + 'Symfony\\Component\\HttpKernel\\Debug\\TraceableEventDispatcher' => __DIR__ . '/..' . '/symfony/http-kernel/Debug/TraceableEventDispatcher.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\AddClassesToCachePass' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ConfigurableExtension' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/ContainerAwareHttpKernel.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\Extension' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/Extension.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\FragmentRendererPass' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\LazyLoadingFragmentHandler' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\MergeExtensionConfigurationPass' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\RegisterListenersPass' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/RegisterListenersPass.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\AddRequestFormatsListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/AddRequestFormatsListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\DebugHandlersListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/DebugHandlersListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\DumpListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/DumpListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\ErrorsLoggerListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/ErrorsLoggerListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\EsiListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/EsiListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/ExceptionListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\FragmentListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/FragmentListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\LocaleListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/LocaleListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\ProfilerListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/ProfilerListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\ResponseListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/ResponseListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\RouterListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/RouterListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\SaveSessionListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/SaveSessionListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\SessionListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/SessionListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\StreamedResponseListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/StreamedResponseListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\SurrogateListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/SurrogateListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\TestSessionListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/TestSessionListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\TranslatorListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/TranslatorListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\ValidateRequestListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/ValidateRequestListener.php', + 'Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/FilterControllerEvent.php', + 'Symfony\\Component\\HttpKernel\\Event\\FilterResponseEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/FilterResponseEvent.php', + 'Symfony\\Component\\HttpKernel\\Event\\FinishRequestEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/FinishRequestEvent.php', + 'Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/GetResponseEvent.php', + 'Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/GetResponseForControllerResultEvent.php', + 'Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/GetResponseForExceptionEvent.php', + 'Symfony\\Component\\HttpKernel\\Event\\KernelEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/KernelEvent.php', + 'Symfony\\Component\\HttpKernel\\Event\\PostResponseEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/PostResponseEvent.php', + 'Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/AccessDeniedHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/BadRequestHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\ConflictHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/ConflictHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\GoneHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/GoneHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\HttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/HttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\HttpExceptionInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/HttpExceptionInterface.php', + 'Symfony\\Component\\HttpKernel\\Exception\\LengthRequiredHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/LengthRequiredHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\NotAcceptableHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/NotAcceptableHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/NotFoundHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\PreconditionFailedHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/PreconditionFailedHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\PreconditionRequiredHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\ServiceUnavailableHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\TooManyRequestsHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/TooManyRequestsHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\UnauthorizedHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/UnauthorizedHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\UnprocessableEntityHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php', + 'Symfony\\Component\\HttpKernel\\Exception\\UnsupportedMediaTypeHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\AbstractSurrogateFragmentRenderer' => __DIR__ . '/..' . '/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\EsiFragmentRenderer' => __DIR__ . '/..' . '/symfony/http-kernel/Fragment/EsiFragmentRenderer.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\FragmentHandler' => __DIR__ . '/..' . '/symfony/http-kernel/Fragment/FragmentHandler.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Fragment/FragmentRendererInterface.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\HIncludeFragmentRenderer' => __DIR__ . '/..' . '/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\InlineFragmentRenderer' => __DIR__ . '/..' . '/symfony/http-kernel/Fragment/InlineFragmentRenderer.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\RoutableFragmentRenderer' => __DIR__ . '/..' . '/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php', + 'Symfony\\Component\\HttpKernel\\Fragment\\SsiFragmentRenderer' => __DIR__ . '/..' . '/symfony/http-kernel/Fragment/SsiFragmentRenderer.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\Esi' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/Esi.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\EsiResponseCacheStrategy' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/EsiResponseCacheStrategy.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\EsiResponseCacheStrategyInterface' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/EsiResponseCacheStrategyInterface.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/HttpCache.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\ResponseCacheStrategy' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\ResponseCacheStrategyInterface' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\Ssi' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/Ssi.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\Store' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/Store.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\StoreInterface' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/StoreInterface.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\SubRequestHandler' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/SubRequestHandler.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\SurrogateInterface' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/SurrogateInterface.php', + 'Symfony\\Component\\HttpKernel\\HttpKernel' => __DIR__ . '/..' . '/symfony/http-kernel/HttpKernel.php', + 'Symfony\\Component\\HttpKernel\\HttpKernelInterface' => __DIR__ . '/..' . '/symfony/http-kernel/HttpKernelInterface.php', + 'Symfony\\Component\\HttpKernel\\Kernel' => __DIR__ . '/..' . '/symfony/http-kernel/Kernel.php', + 'Symfony\\Component\\HttpKernel\\KernelEvents' => __DIR__ . '/..' . '/symfony/http-kernel/KernelEvents.php', + 'Symfony\\Component\\HttpKernel\\KernelInterface' => __DIR__ . '/..' . '/symfony/http-kernel/KernelInterface.php', + 'Symfony\\Component\\HttpKernel\\Log\\DebugLoggerInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Log/DebugLoggerInterface.php', + 'Symfony\\Component\\HttpKernel\\Log\\LoggerInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Log/LoggerInterface.php', + 'Symfony\\Component\\HttpKernel\\Log\\NullLogger' => __DIR__ . '/..' . '/symfony/http-kernel/Log/NullLogger.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\BaseMemcacheProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/BaseMemcacheProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\FileProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/FileProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\MemcacheProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/MemcacheProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\MemcachedProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/MemcachedProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\MongoDbProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/MongoDbProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\MysqlProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/MysqlProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\PdoProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/PdoProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\Profile' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/Profile.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\Profiler' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/Profiler.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\ProfilerStorageInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/ProfilerStorageInterface.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\RedisProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/RedisProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Profiler\\SqliteProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/SqliteProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\TerminableInterface' => __DIR__ . '/..' . '/symfony/http-kernel/TerminableInterface.php', + 'Symfony\\Component\\HttpKernel\\UriSigner' => __DIR__ . '/..' . '/symfony/http-kernel/UriSigner.php', + 'Symfony\\Component\\Process\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/process/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Process\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/process/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\Process\\Exception\\LogicException' => __DIR__ . '/..' . '/symfony/process/Exception/LogicException.php', + 'Symfony\\Component\\Process\\Exception\\ProcessFailedException' => __DIR__ . '/..' . '/symfony/process/Exception/ProcessFailedException.php', + 'Symfony\\Component\\Process\\Exception\\ProcessTimedOutException' => __DIR__ . '/..' . '/symfony/process/Exception/ProcessTimedOutException.php', + 'Symfony\\Component\\Process\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/process/Exception/RuntimeException.php', + 'Symfony\\Component\\Process\\ExecutableFinder' => __DIR__ . '/..' . '/symfony/process/ExecutableFinder.php', + 'Symfony\\Component\\Process\\PhpExecutableFinder' => __DIR__ . '/..' . '/symfony/process/PhpExecutableFinder.php', + 'Symfony\\Component\\Process\\PhpProcess' => __DIR__ . '/..' . '/symfony/process/PhpProcess.php', + 'Symfony\\Component\\Process\\Pipes\\AbstractPipes' => __DIR__ . '/..' . '/symfony/process/Pipes/AbstractPipes.php', + 'Symfony\\Component\\Process\\Pipes\\PipesInterface' => __DIR__ . '/..' . '/symfony/process/Pipes/PipesInterface.php', + 'Symfony\\Component\\Process\\Pipes\\UnixPipes' => __DIR__ . '/..' . '/symfony/process/Pipes/UnixPipes.php', + 'Symfony\\Component\\Process\\Pipes\\WindowsPipes' => __DIR__ . '/..' . '/symfony/process/Pipes/WindowsPipes.php', + 'Symfony\\Component\\Process\\Process' => __DIR__ . '/..' . '/symfony/process/Process.php', + 'Symfony\\Component\\Process\\ProcessBuilder' => __DIR__ . '/..' . '/symfony/process/ProcessBuilder.php', + 'Symfony\\Component\\Process\\ProcessUtils' => __DIR__ . '/..' . '/symfony/process/ProcessUtils.php', + 'Symfony\\Component\\Routing\\Annotation\\Route' => __DIR__ . '/..' . '/symfony/routing/Annotation/Route.php', + 'Symfony\\Component\\Routing\\CompiledRoute' => __DIR__ . '/..' . '/symfony/routing/CompiledRoute.php', + 'Symfony\\Component\\Routing\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/routing/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Routing\\Exception\\InvalidParameterException' => __DIR__ . '/..' . '/symfony/routing/Exception/InvalidParameterException.php', + 'Symfony\\Component\\Routing\\Exception\\MethodNotAllowedException' => __DIR__ . '/..' . '/symfony/routing/Exception/MethodNotAllowedException.php', + 'Symfony\\Component\\Routing\\Exception\\MissingMandatoryParametersException' => __DIR__ . '/..' . '/symfony/routing/Exception/MissingMandatoryParametersException.php', + 'Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException' => __DIR__ . '/..' . '/symfony/routing/Exception/ResourceNotFoundException.php', + 'Symfony\\Component\\Routing\\Exception\\RouteNotFoundException' => __DIR__ . '/..' . '/symfony/routing/Exception/RouteNotFoundException.php', + 'Symfony\\Component\\Routing\\Generator\\ConfigurableRequirementsInterface' => __DIR__ . '/..' . '/symfony/routing/Generator/ConfigurableRequirementsInterface.php', + 'Symfony\\Component\\Routing\\Generator\\Dumper\\GeneratorDumper' => __DIR__ . '/..' . '/symfony/routing/Generator/Dumper/GeneratorDumper.php', + 'Symfony\\Component\\Routing\\Generator\\Dumper\\GeneratorDumperInterface' => __DIR__ . '/..' . '/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php', + 'Symfony\\Component\\Routing\\Generator\\Dumper\\PhpGeneratorDumper' => __DIR__ . '/..' . '/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php', + 'Symfony\\Component\\Routing\\Generator\\UrlGenerator' => __DIR__ . '/..' . '/symfony/routing/Generator/UrlGenerator.php', + 'Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface' => __DIR__ . '/..' . '/symfony/routing/Generator/UrlGeneratorInterface.php', + 'Symfony\\Component\\Routing\\Loader\\AnnotationClassLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/AnnotationClassLoader.php', + 'Symfony\\Component\\Routing\\Loader\\AnnotationDirectoryLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/AnnotationDirectoryLoader.php', + 'Symfony\\Component\\Routing\\Loader\\AnnotationFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/AnnotationFileLoader.php', + 'Symfony\\Component\\Routing\\Loader\\ClosureLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/ClosureLoader.php', + 'Symfony\\Component\\Routing\\Loader\\PhpFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/PhpFileLoader.php', + 'Symfony\\Component\\Routing\\Loader\\RecursiveCallbackFilterIterator' => __DIR__ . '/..' . '/symfony/routing/Loader/AnnotationDirectoryLoader.php', + 'Symfony\\Component\\Routing\\Loader\\XmlFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/XmlFileLoader.php', + 'Symfony\\Component\\Routing\\Loader\\YamlFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/YamlFileLoader.php', + 'Symfony\\Component\\Routing\\Matcher\\ApacheUrlMatcher' => __DIR__ . '/..' . '/symfony/routing/Matcher/ApacheUrlMatcher.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\ApacheMatcherDumper' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/ApacheMatcherDumper.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperCollection' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/DumperCollection.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperPrefixCollection' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/DumperPrefixCollection.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperRoute' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/DumperRoute.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\MatcherDumper' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/MatcherDumper.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\MatcherDumperInterface' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\PhpMatcherDumper' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php', + 'Symfony\\Component\\Routing\\Matcher\\RedirectableUrlMatcher' => __DIR__ . '/..' . '/symfony/routing/Matcher/RedirectableUrlMatcher.php', + 'Symfony\\Component\\Routing\\Matcher\\RedirectableUrlMatcherInterface' => __DIR__ . '/..' . '/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php', + 'Symfony\\Component\\Routing\\Matcher\\RequestMatcherInterface' => __DIR__ . '/..' . '/symfony/routing/Matcher/RequestMatcherInterface.php', + 'Symfony\\Component\\Routing\\Matcher\\TraceableUrlMatcher' => __DIR__ . '/..' . '/symfony/routing/Matcher/TraceableUrlMatcher.php', + 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher' => __DIR__ . '/..' . '/symfony/routing/Matcher/UrlMatcher.php', + 'Symfony\\Component\\Routing\\Matcher\\UrlMatcherInterface' => __DIR__ . '/..' . '/symfony/routing/Matcher/UrlMatcherInterface.php', + 'Symfony\\Component\\Routing\\RequestContext' => __DIR__ . '/..' . '/symfony/routing/RequestContext.php', + 'Symfony\\Component\\Routing\\RequestContextAwareInterface' => __DIR__ . '/..' . '/symfony/routing/RequestContextAwareInterface.php', + 'Symfony\\Component\\Routing\\Route' => __DIR__ . '/..' . '/symfony/routing/Route.php', + 'Symfony\\Component\\Routing\\RouteCollection' => __DIR__ . '/..' . '/symfony/routing/RouteCollection.php', + 'Symfony\\Component\\Routing\\RouteCompiler' => __DIR__ . '/..' . '/symfony/routing/RouteCompiler.php', + 'Symfony\\Component\\Routing\\RouteCompilerInterface' => __DIR__ . '/..' . '/symfony/routing/RouteCompilerInterface.php', + 'Symfony\\Component\\Routing\\Router' => __DIR__ . '/..' . '/symfony/routing/Router.php', + 'Symfony\\Component\\Routing\\RouterInterface' => __DIR__ . '/..' . '/symfony/routing/RouterInterface.php', + 'Symfony\\Component\\Translation\\Catalogue\\AbstractOperation' => __DIR__ . '/..' . '/symfony/translation/Catalogue/AbstractOperation.php', + 'Symfony\\Component\\Translation\\Catalogue\\DiffOperation' => __DIR__ . '/..' . '/symfony/translation/Catalogue/DiffOperation.php', + 'Symfony\\Component\\Translation\\Catalogue\\MergeOperation' => __DIR__ . '/..' . '/symfony/translation/Catalogue/MergeOperation.php', + 'Symfony\\Component\\Translation\\Catalogue\\OperationInterface' => __DIR__ . '/..' . '/symfony/translation/Catalogue/OperationInterface.php', + 'Symfony\\Component\\Translation\\DataCollectorTranslator' => __DIR__ . '/..' . '/symfony/translation/DataCollectorTranslator.php', + 'Symfony\\Component\\Translation\\DataCollector\\TranslationDataCollector' => __DIR__ . '/..' . '/symfony/translation/DataCollector/TranslationDataCollector.php', + 'Symfony\\Component\\Translation\\Dumper\\CsvFileDumper' => __DIR__ . '/..' . '/symfony/translation/Dumper/CsvFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\DumperInterface' => __DIR__ . '/..' . '/symfony/translation/Dumper/DumperInterface.php', + 'Symfony\\Component\\Translation\\Dumper\\FileDumper' => __DIR__ . '/..' . '/symfony/translation/Dumper/FileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\IcuResFileDumper' => __DIR__ . '/..' . '/symfony/translation/Dumper/IcuResFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\IniFileDumper' => __DIR__ . '/..' . '/symfony/translation/Dumper/IniFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\JsonFileDumper' => __DIR__ . '/..' . '/symfony/translation/Dumper/JsonFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\MoFileDumper' => __DIR__ . '/..' . '/symfony/translation/Dumper/MoFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\PhpFileDumper' => __DIR__ . '/..' . '/symfony/translation/Dumper/PhpFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\PoFileDumper' => __DIR__ . '/..' . '/symfony/translation/Dumper/PoFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\QtFileDumper' => __DIR__ . '/..' . '/symfony/translation/Dumper/QtFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\XliffFileDumper' => __DIR__ . '/..' . '/symfony/translation/Dumper/XliffFileDumper.php', + 'Symfony\\Component\\Translation\\Dumper\\YamlFileDumper' => __DIR__ . '/..' . '/symfony/translation/Dumper/YamlFileDumper.php', + 'Symfony\\Component\\Translation\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/translation/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Translation\\Exception\\InvalidResourceException' => __DIR__ . '/..' . '/symfony/translation/Exception/InvalidResourceException.php', + 'Symfony\\Component\\Translation\\Exception\\NotFoundResourceException' => __DIR__ . '/..' . '/symfony/translation/Exception/NotFoundResourceException.php', + 'Symfony\\Component\\Translation\\Extractor\\AbstractFileExtractor' => __DIR__ . '/..' . '/symfony/translation/Extractor/AbstractFileExtractor.php', + 'Symfony\\Component\\Translation\\Extractor\\ChainExtractor' => __DIR__ . '/..' . '/symfony/translation/Extractor/ChainExtractor.php', + 'Symfony\\Component\\Translation\\Extractor\\ExtractorInterface' => __DIR__ . '/..' . '/symfony/translation/Extractor/ExtractorInterface.php', + 'Symfony\\Component\\Translation\\IdentityTranslator' => __DIR__ . '/..' . '/symfony/translation/IdentityTranslator.php', + 'Symfony\\Component\\Translation\\Interval' => __DIR__ . '/..' . '/symfony/translation/Interval.php', + 'Symfony\\Component\\Translation\\Loader\\ArrayLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/ArrayLoader.php', + 'Symfony\\Component\\Translation\\Loader\\CsvFileLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/CsvFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\IcuDatFileLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/IcuDatFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\IcuResFileLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/IcuResFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\IniFileLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/IniFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\JsonFileLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/JsonFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\LoaderInterface' => __DIR__ . '/..' . '/symfony/translation/Loader/LoaderInterface.php', + 'Symfony\\Component\\Translation\\Loader\\MoFileLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/MoFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\PhpFileLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/PhpFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\PoFileLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/PoFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\QtFileLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/QtFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\XliffFileLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/XliffFileLoader.php', + 'Symfony\\Component\\Translation\\Loader\\YamlFileLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/YamlFileLoader.php', + 'Symfony\\Component\\Translation\\LoggingTranslator' => __DIR__ . '/..' . '/symfony/translation/LoggingTranslator.php', + 'Symfony\\Component\\Translation\\MessageCatalogue' => __DIR__ . '/..' . '/symfony/translation/MessageCatalogue.php', + 'Symfony\\Component\\Translation\\MessageCatalogueInterface' => __DIR__ . '/..' . '/symfony/translation/MessageCatalogueInterface.php', + 'Symfony\\Component\\Translation\\MessageSelector' => __DIR__ . '/..' . '/symfony/translation/MessageSelector.php', + 'Symfony\\Component\\Translation\\MetadataAwareInterface' => __DIR__ . '/..' . '/symfony/translation/MetadataAwareInterface.php', + 'Symfony\\Component\\Translation\\PluralizationRules' => __DIR__ . '/..' . '/symfony/translation/PluralizationRules.php', + 'Symfony\\Component\\Translation\\Translator' => __DIR__ . '/..' . '/symfony/translation/Translator.php', + 'Symfony\\Component\\Translation\\TranslatorBagInterface' => __DIR__ . '/..' . '/symfony/translation/TranslatorBagInterface.php', + 'Symfony\\Component\\Translation\\TranslatorInterface' => __DIR__ . '/..' . '/symfony/translation/TranslatorInterface.php', + 'Symfony\\Component\\Translation\\Writer\\TranslationWriter' => __DIR__ . '/..' . '/symfony/translation/Writer/TranslationWriter.php', + 'Symfony\\Component\\VarDumper\\Caster\\AmqpCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/AmqpCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\Caster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/Caster.php', + 'Symfony\\Component\\VarDumper\\Caster\\ConstStub' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/ConstStub.php', + 'Symfony\\Component\\VarDumper\\Caster\\CutStub' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/CutStub.php', + 'Symfony\\Component\\VarDumper\\Caster\\DOMCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/DOMCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\DoctrineCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/DoctrineCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\ExceptionCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/ExceptionCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\MongoCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/MongoCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\PdoCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/PdoCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\ReflectionCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/ReflectionCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\ResourceCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/ResourceCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\SplCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/SplCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\StubCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/StubCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\XmlResourceCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/XmlResourceCaster.php', + 'Symfony\\Component\\VarDumper\\Cloner\\AbstractCloner' => __DIR__ . '/..' . '/symfony/var-dumper/Cloner/AbstractCloner.php', + 'Symfony\\Component\\VarDumper\\Cloner\\ClonerInterface' => __DIR__ . '/..' . '/symfony/var-dumper/Cloner/ClonerInterface.php', + 'Symfony\\Component\\VarDumper\\Cloner\\Cursor' => __DIR__ . '/..' . '/symfony/var-dumper/Cloner/Cursor.php', + 'Symfony\\Component\\VarDumper\\Cloner\\Data' => __DIR__ . '/..' . '/symfony/var-dumper/Cloner/Data.php', + 'Symfony\\Component\\VarDumper\\Cloner\\DumperInterface' => __DIR__ . '/..' . '/symfony/var-dumper/Cloner/DumperInterface.php', + 'Symfony\\Component\\VarDumper\\Cloner\\Stub' => __DIR__ . '/..' . '/symfony/var-dumper/Cloner/Stub.php', + 'Symfony\\Component\\VarDumper\\Cloner\\VarCloner' => __DIR__ . '/..' . '/symfony/var-dumper/Cloner/VarCloner.php', + 'Symfony\\Component\\VarDumper\\Dumper\\AbstractDumper' => __DIR__ . '/..' . '/symfony/var-dumper/Dumper/AbstractDumper.php', + 'Symfony\\Component\\VarDumper\\Dumper\\CliDumper' => __DIR__ . '/..' . '/symfony/var-dumper/Dumper/CliDumper.php', + 'Symfony\\Component\\VarDumper\\Dumper\\DataDumperInterface' => __DIR__ . '/..' . '/symfony/var-dumper/Dumper/DataDumperInterface.php', + 'Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper' => __DIR__ . '/..' . '/symfony/var-dumper/Dumper/HtmlDumper.php', + 'Symfony\\Component\\VarDumper\\Exception\\ThrowingCasterException' => __DIR__ . '/..' . '/symfony/var-dumper/Exception/ThrowingCasterException.php', + 'Symfony\\Component\\VarDumper\\Test\\VarDumperTestCase' => __DIR__ . '/..' . '/symfony/var-dumper/Test/VarDumperTestCase.php', + 'Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait' => __DIR__ . '/..' . '/symfony/var-dumper/Test/VarDumperTestTrait.php', + 'Symfony\\Component\\VarDumper\\VarDumper' => __DIR__ . '/..' . '/symfony/var-dumper/VarDumper.php', + 'Symfony\\Polyfill\\Ctype\\Ctype' => __DIR__ . '/..' . '/symfony/polyfill-ctype/Ctype.php', + 'Symfony\\Polyfill\\Mbstring\\Mbstring' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/Mbstring.php', + 'Symfony\\Polyfill\\Php56\\Php56' => __DIR__ . '/..' . '/symfony/polyfill-php56/Php56.php', + 'Symfony\\Polyfill\\Util\\Binary' => __DIR__ . '/..' . '/symfony/polyfill-util/Binary.php', + 'Symfony\\Polyfill\\Util\\BinaryNoFuncOverload' => __DIR__ . '/..' . '/symfony/polyfill-util/BinaryNoFuncOverload.php', + 'Symfony\\Polyfill\\Util\\BinaryOnFuncOverload' => __DIR__ . '/..' . '/symfony/polyfill-util/BinaryOnFuncOverload.php', + 'Symfony\\Polyfill\\Util\\TestListener' => __DIR__ . '/..' . '/symfony/polyfill-util/TestListener.php', + 'Symfony\\Polyfill\\Util\\TestListenerForV5' => __DIR__ . '/..' . '/symfony/polyfill-util/TestListenerForV5.php', + 'Symfony\\Polyfill\\Util\\TestListenerForV6' => __DIR__ . '/..' . '/symfony/polyfill-util/TestListenerForV6.php', + 'Symfony\\Polyfill\\Util\\TestListenerForV7' => __DIR__ . '/..' . '/symfony/polyfill-util/TestListenerForV7.php', + 'Symfony\\Polyfill\\Util\\TestListenerTrait' => __DIR__ . '/..' . '/symfony/polyfill-util/TestListenerTrait.php', + 'UpdateHelper\\ComposerPlugin' => __DIR__ . '/..' . '/kylekatarnls/update-helper/src/UpdateHelper/ComposerPlugin.php', + 'UpdateHelper\\NotUpdateInterfaceInstanceException' => __DIR__ . '/..' . '/kylekatarnls/update-helper/src/UpdateHelper/NotUpdateInterfaceInstanceException.php', + 'UpdateHelper\\UpdateHelper' => __DIR__ . '/..' . '/kylekatarnls/update-helper/src/UpdateHelper/UpdateHelper.php', + 'UpdateHelper\\UpdateHelperInterface' => __DIR__ . '/..' . '/kylekatarnls/update-helper/src/UpdateHelper/UpdateHelperInterface.php', + 'XdgBaseDir\\Xdg' => __DIR__ . '/..' . '/dnoegel/php-xdg-base-dir/src/Xdg.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit43265f891b9f29a025a40de9ffd797c4::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit43265f891b9f29a025a40de9ffd797c4::$prefixDirsPsr4; + $loader->fallbackDirsPsr4 = ComposerStaticInit43265f891b9f29a025a40de9ffd797c4::$fallbackDirsPsr4; + $loader->prefixesPsr0 = ComposerStaticInit43265f891b9f29a025a40de9ffd797c4::$prefixesPsr0; + $loader->classMap = ComposerStaticInit43265f891b9f29a025a40de9ffd797c4::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/application/vendor/composer/installed.json b/application/vendor/composer/installed.json index 1196fee..f863936 100644 --- a/application/vendor/composer/installed.json +++ b/application/vendor/composer/installed.json @@ -1,25 +1,37 @@ [ { - "name": "psr/log", - "version": "1.0.0", - "version_normalized": "1.0.0.0", + "name": "classpreloader/classpreloader", + "version": "3.2.0", + "version_normalized": "3.2.0.0", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + "url": "https://github.com/ClassPreloader/ClassPreloader.git", + "reference": "4729e438e0ada350f91148e7d4bb9809342575ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "url": "https://api.github.com/repos/ClassPreloader/ClassPreloader/zipball/4729e438e0ada350f91148e7d4bb9809342575ff", + "reference": "4729e438e0ada350f91148e7d4bb9809342575ff", "shasum": "" }, - "time": "2012-12-21 11:40:51", + "require": { + "nikic/php-parser": "^1.0|^2.0|^3.0", + "php": ">=5.5.9" + }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.0" + }, + "time": "2017-12-10T11:40:39+00:00", "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, "installation-source": "dist", "autoload": { - "psr-0": { - "Psr\\Log\\": "" + "psr-4": { + "ClassPreloader\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -28,60 +40,77 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "Michael Dowling", + "email": "mtdowling@gmail.com" + }, + { + "name": "Graham Campbell", + "email": "graham@alt-three.com" } ], - "description": "Common interface for logging libraries", + "description": "Helps class loading performance by generating a single PHP file containing all of the autoloaded files for a specific use case", "keywords": [ - "log", - "psr", - "psr-3" + "autoload", + "class", + "preload" ] }, { - "name": "jakub-onderka/php-console-color", - "version": "0.1", - "version_normalized": "0.1.0.0", + "name": "danielstjules/stringy", + "version": "1.10.0", + "version_normalized": "1.10.0.0", "source": { "type": "git", - "url": "https://github.com/JakubOnderka/PHP-Console-Color.git", - "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1" + "url": "https://github.com/danielstjules/Stringy.git", + "reference": "4749c205db47ee5b32e8d1adf6d9aff8db6caf3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1", - "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1", + "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/4749c205db47ee5b32e8d1adf6d9aff8db6caf3b", + "reference": "4749c205db47ee5b32e8d1adf6d9aff8db6caf3b", "shasum": "" }, "require": { - "php": ">=5.3.2" + "ext-mbstring": "*", + "php": ">=5.3.0" }, "require-dev": { - "jakub-onderka/php-code-style": "1.0", - "jakub-onderka/php-parallel-lint": "0.*", - "jakub-onderka/php-var-dump-check": "0.*", - "phpunit/phpunit": "3.7.*", - "squizlabs/php_codesniffer": "1.*" + "phpunit/phpunit": "~4.0" }, - "time": "2014-04-08 15:00:19", + "time": "2015-07-23T00:54:12+00:00", "type": "library", "installation-source": "dist", "autoload": { - "psr-0": { - "JakubOnderka\\PhpConsoleColor": "src/" - } + "psr-4": { + "Stringy\\": "src/" + }, + "files": [ + "src/Create.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-2-Clause" + "MIT" ], "authors": [ { - "name": "Jakub Onderka", - "email": "jakub.onderka@gmail.com", - "homepage": "http://www.acci.cz" + "name": "Daniel St. Jules", + "email": "danielst.jules@gmail.com", + "homepage": "http://www.danielstjules.com" } + ], + "description": "A string manipulation library with multibyte support", + "homepage": "https://github.com/danielstjules/Stringy", + "keywords": [ + "UTF", + "helpers", + "manipulation", + "methods", + "multibyte", + "string", + "utf-8", + "utility", + "utils" ] }, { @@ -105,7 +134,7 @@ "require-dev": { "phpunit/phpunit": "@stable" }, - "time": "2014-10-24 07:27:01", + "time": "2014-10-24T07:27:01+00:00", "type": "project", "installation-source": "dist", "autoload": { @@ -120,56 +149,37 @@ "description": "implementation of xdg base directory specification for php" }, { - "name": "psy/psysh", - "version": "v0.4.4", - "version_normalized": "0.4.4.0", + "name": "doctrine/inflector", + "version": "v1.3.0", + "version_normalized": "1.3.0.0", "source": { "type": "git", - "url": "https://github.com/bobthecow/psysh.git", - "reference": "489816db71649bd95b416e3ed9062d40528ab0ac" + "url": "https://github.com/doctrine/inflector.git", + "reference": "5527a48b7313d15261292c149e55e26eae771b0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/489816db71649bd95b416e3ed9062d40528ab0ac", - "reference": "489816db71649bd95b416e3ed9062d40528ab0ac", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a", + "reference": "5527a48b7313d15261292c149e55e26eae771b0a", "shasum": "" }, "require": { - "dnoegel/php-xdg-base-dir": "0.1", - "jakub-onderka/php-console-highlighter": "0.3.*", - "nikic/php-parser": "~1.0", - "php": ">=5.3.0", - "symfony/console": "~2.3.10|~2.4.2|~2.5" + "php": "^7.1" }, "require-dev": { - "fabpot/php-cs-fixer": "~1.5", - "phpunit/phpunit": "~3.7|~4.0", - "squizlabs/php_codesniffer": "~2.0", - "symfony/finder": "~2.1|~3.0" - }, - "suggest": { - "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", - "ext-pdo-sqlite": "The doc command requires SQLite to work.", - "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", - "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history." + "phpunit/phpunit": "^6.2" }, - "time": "2015-03-26 18:43:54", - "bin": [ - "bin/psysh" - ], + "time": "2018-01-09T20:05:19+00:00", "type": "library", "extra": { "branch-alias": { - "dev-develop": "0.4.x-dev" + "dev-master": "1.3.x-dev" } }, "installation-source": "dist", "autoload": { - "files": [ - "src/Psy/functions.php" - ], - "psr-0": { - "Psy\\": "src/" + "psr-4": { + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" } }, "notification-url": "https://packagist.org/downloads/", @@ -178,91 +188,112 @@ ], "authors": [ { - "name": "Justin Hileman", - "email": "justin@justinhileman.info", - "homepage": "http://justinhileman.com" + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" } ], - "description": "An interactive shell for modern PHP.", - "homepage": "http://psysh.org", + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", "keywords": [ - "REPL", - "console", - "interactive", - "shell" + "inflection", + "pluralize", + "singularize", + "string" ] }, { - "name": "mtdowling/cron-expression", - "version": "v1.0.4", - "version_normalized": "1.0.4.0", + "name": "jakub-onderka/php-console-color", + "version": "v0.2", + "version_normalized": "0.2.0.0", "source": { "type": "git", - "url": "https://github.com/mtdowling/cron-expression.git", - "reference": "fd92e883195e5dfa77720b1868cf084b08be4412" + "url": "https://github.com/JakubOnderka/PHP-Console-Color.git", + "reference": "d5deaecff52a0d61ccb613bb3804088da0307191" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mtdowling/cron-expression/zipball/fd92e883195e5dfa77720b1868cf084b08be4412", - "reference": "fd92e883195e5dfa77720b1868cf084b08be4412", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/d5deaecff52a0d61ccb613bb3804088da0307191", + "reference": "d5deaecff52a0d61ccb613bb3804088da0307191", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "4.*" + "jakub-onderka/php-code-style": "1.0", + "jakub-onderka/php-parallel-lint": "1.0", + "jakub-onderka/php-var-dump-check": "0.*", + "phpunit/phpunit": "~4.3", + "squizlabs/php_codesniffer": "1.*" }, - "time": "2015-01-11 23:07:46", + "time": "2018-09-29T17:23:10+00:00", "type": "library", "installation-source": "dist", "autoload": { - "psr-0": { - "Cron": "src/" + "psr-4": { + "JakubOnderka\\PhpConsoleColor\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-2-Clause" ], "authors": [ { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" + "name": "Jakub Onderka", + "email": "jakub.onderka@gmail.com" } - ], - "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", - "keywords": [ - "cron", - "schedule" ] }, { - "name": "ircmaxell/password-compat", - "version": "v1.0.4", - "version_normalized": "1.0.4.0", + "name": "jakub-onderka/php-console-highlighter", + "version": "v0.3.2", + "version_normalized": "0.3.2.0", "source": { "type": "git", - "url": "https://github.com/ircmaxell/password_compat.git", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" + "url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git", + "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/7daa75df45242c8d5b75a22c00a201e7954e4fb5", + "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5", "shasum": "" }, + "require": { + "jakub-onderka/php-console-color": "~0.1", + "php": ">=5.3.0" + }, "require-dev": { - "phpunit/phpunit": "4.*" + "jakub-onderka/php-code-style": "~1.0", + "jakub-onderka/php-parallel-lint": "~0.5", + "jakub-onderka/php-var-dump-check": "~0.1", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~1.5" }, - "time": "2014-11-20 16:49:30", + "time": "2015-04-20T18:58:01+00:00", "type": "library", "installation-source": "dist", "autoload": { - "files": [ - "lib/password.php" - ] + "psr-0": { + "JakubOnderka\\PhpConsoleHighlighter": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -270,54 +301,47 @@ ], "authors": [ { - "name": "Anthony Ferrara", - "email": "ircmaxell@php.net", - "homepage": "http://blog.ircmaxell.com" + "name": "Jakub Onderka", + "email": "acci@acci.cz", + "homepage": "http://www.acci.cz/" } - ], - "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", - "homepage": "https://github.com/ircmaxell/password_compat", - "keywords": [ - "hashing", - "password" ] }, { - "name": "illuminate/html", - "version": "v5.0.0", - "version_normalized": "5.0.0.0", + "name": "jeremeamia/superclosure", + "version": "2.4.0", + "version_normalized": "2.4.0.0", "source": { "type": "git", - "url": "https://github.com/illuminate/html.git", - "reference": "3d1009bb8e0f25720c914af5c1f4015dd373c9ef" + "url": "https://github.com/jeremeamia/super_closure.git", + "reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/html/zipball/3d1009bb8e0f25720c914af5c1f4015dd373c9ef", - "reference": "3d1009bb8e0f25720c914af5c1f4015dd373c9ef", + "url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/5707d5821b30b9a07acfb4d76949784aaa0e9ce9", + "reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9", "shasum": "" }, "require": { - "illuminate/http": "~5.0", - "illuminate/session": "~5.0", - "illuminate/support": "~5.0", - "php": ">=5.4.0" + "nikic/php-parser": "^1.2|^2.0|^3.0|^4.0", + "php": ">=5.4", + "symfony/polyfill-php56": "^1.0" }, - "time": "2015-01-01 16:31:18", + "require-dev": { + "phpunit/phpunit": "^4.0|^5.0" + }, + "time": "2018-03-21T22:21:57+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "2.4-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Illuminate\\Html\\": "" - }, - "files": [ - "helpers.php" - ] + "SuperClosure\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -325,98 +349,183 @@ ], "authors": [ { - "name": "Taylor Otwell", - "email": "taylorotwell@gmail.com" + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia", + "role": "Developer" } + ], + "description": "Serialize Closure objects, including their context and binding", + "homepage": "https://github.com/jeremeamia/super_closure", + "keywords": [ + "closure", + "function", + "lambda", + "parser", + "serializable", + "serialize", + "tokenizer" ] }, { - "name": "vlucas/phpdotenv", - "version": "v1.1.1", - "version_normalized": "1.1.1.0", + "name": "kylekatarnls/update-helper", + "version": "1.2.0", + "version_normalized": "1.2.0.0", "source": { "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "0cac554ce06277e33ddf9f0b7ade4b8bbf2af3fa" + "url": "https://github.com/kylekatarnls/update-helper.git", + "reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/0cac554ce06277e33ddf9f0b7ade4b8bbf2af3fa", - "reference": "0cac554ce06277e33ddf9f0b7ade4b8bbf2af3fa", + "url": "https://api.github.com/repos/kylekatarnls/update-helper/zipball/5786fa188e0361b9adf9e8199d7280d1b2db165e", + "reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e", "shasum": "" }, "require": { - "php": ">=5.3.2" + "composer-plugin-api": "^1.1.0 || ^2.0.0", + "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "codeclimate/php-test-reporter": "dev-master", + "composer/composer": "2.0.x-dev || ^2.0.0-dev", + "phpunit/phpunit": ">=4.8.35 <6.0" + }, + "time": "2019-07-29T11:03:54+00:00", + "type": "composer-plugin", + "extra": { + "class": "UpdateHelper\\ComposerPlugin" }, - "time": "2015-05-30 15:59:26", - "type": "library", "installation-source": "dist", "autoload": { "psr-0": { - "Dotenv": "src/" + "UpdateHelper\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD" + "MIT" ], "authors": [ { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "http://www.vancelucas.com" + "name": "Kyle", + "email": "kylekatarnls@gmail.com" } ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", - "homepage": "http://github.com/vlucas/phpdotenv", - "keywords": [ - "dotenv", - "env", - "environment" - ] + "description": "Update helper" }, { - "name": "symfony/var-dumper", - "version": "v2.6.12", - "version_normalized": "2.6.12.0", - "target-dir": "Symfony/Component/VarDumper", + "name": "laravel/framework", + "version": "v5.1.46", + "version_normalized": "5.1.46.0", "source": { "type": "git", - "url": "https://github.com/symfony/var-dumper.git", - "reference": "5fba957a30161d8724aade093593cd22f815bea2" + "url": "https://github.com/laravel/framework.git", + "reference": "7f2f892e62163138121e8210b92b21394fda8d1c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/5fba957a30161d8724aade093593cd22f815bea2", - "reference": "5fba957a30161d8724aade093593cd22f815bea2", + "url": "https://api.github.com/repos/laravel/framework/zipball/7f2f892e62163138121e8210b92b21394fda8d1c", + "reference": "7f2f892e62163138121e8210b92b21394fda8d1c", "shasum": "" }, "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "suggest": { - "ext-symfony_debug": "" + "classpreloader/classpreloader": "~2.0|~3.0", + "danielstjules/stringy": "~1.8", + "doctrine/inflector": "~1.0", + "ext-mbstring": "*", + "ext-openssl": "*", + "jeremeamia/superclosure": "~2.0", + "league/flysystem": "~1.0", + "monolog/monolog": "~1.11", + "mtdowling/cron-expression": "~1.0", + "nesbot/carbon": "~1.19", + "paragonie/random_compat": "~1.4", + "php": ">=5.5.9", + "psy/psysh": "0.7.*", + "swiftmailer/swiftmailer": "~5.1", + "symfony/console": "2.7.*", + "symfony/css-selector": "2.7.*|2.8.*", + "symfony/debug": "2.7.*", + "symfony/dom-crawler": "2.7.*", + "symfony/finder": "2.7.*", + "symfony/http-foundation": "2.7.*", + "symfony/http-kernel": "2.7.*", + "symfony/process": "2.7.*", + "symfony/routing": "2.7.*", + "symfony/translation": "2.7.*", + "symfony/var-dumper": "2.7.*", + "vlucas/phpdotenv": "~1.0" }, - "time": "2015-07-01 10:03:42", - "type": "library", + "replace": { + "illuminate/auth": "self.version", + "illuminate/broadcasting": "self.version", + "illuminate/bus": "self.version", + "illuminate/cache": "self.version", + "illuminate/config": "self.version", + "illuminate/console": "self.version", + "illuminate/container": "self.version", + "illuminate/contracts": "self.version", + "illuminate/cookie": "self.version", + "illuminate/database": "self.version", + "illuminate/encryption": "self.version", + "illuminate/events": "self.version", + "illuminate/exception": "self.version", + "illuminate/filesystem": "self.version", + "illuminate/hashing": "self.version", + "illuminate/http": "self.version", + "illuminate/log": "self.version", + "illuminate/mail": "self.version", + "illuminate/pagination": "self.version", + "illuminate/pipeline": "self.version", + "illuminate/queue": "self.version", + "illuminate/redis": "self.version", + "illuminate/routing": "self.version", + "illuminate/session": "self.version", + "illuminate/support": "self.version", + "illuminate/translation": "self.version", + "illuminate/validation": "self.version", + "illuminate/view": "self.version" + }, + "require-dev": { + "aws/aws-sdk-php": "~3.0", + "iron-io/iron_mq": "~2.0", + "mockery/mockery": "~0.9.4", + "pda/pheanstalk": "~3.0", + "phpunit/phpunit": "~4.0", + "predis/predis": "~1.0" + }, + "suggest": { + "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~3.0).", + "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).", + "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", + "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~5.3|~6.0).", + "iron-io/iron_mq": "Required to use the iron queue driver (~2.0).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).", + "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).", + "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).", + "predis/predis": "Required to use the redis cache and queue drivers (~1.0).", + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0).", + "symfony/psr-http-message-bridge": "Required to psr7 bridging features (0.2.*)." + }, + "time": "2017-03-24T16:31:45+00:00", + "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "5.1-dev" } }, "installation-source": "dist", "autoload": { + "classmap": [ + "src/Illuminate/Queue/IlluminateQueueClosure.php" + ], "files": [ - "Resources/functions/dump.php" + "src/Illuminate/Foundation/helpers.php", + "src/Illuminate/Support/helpers.php" ], - "psr-0": { - "Symfony\\Component\\VarDumper\\": "" + "psr-4": { + "Illuminate\\": "src/Illuminate/" } }, "notification-url": "https://packagist.org/downloads/", @@ -425,64 +534,53 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" } ], - "description": "Symfony mechanism for exploring and dumping PHP variables", - "homepage": "https://symfony.com", + "description": "The Laravel Framework.", + "homepage": "http://laravel.com", "keywords": [ - "debug", - "dump" + "framework", + "laravel" ] }, { - "name": "symfony/translation", - "version": "v2.6.12", - "version_normalized": "2.6.12.0", - "target-dir": "Symfony/Component/Translation", + "name": "laravelcollective/html", + "version": "v5.1.11", + "version_normalized": "5.1.11.0", "source": { "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "d84291215b5892834dd8ca8ee52f9cbdb8274904" + "url": "https://github.com/LaravelCollective/html.git", + "reference": "99342cc22507cf8d7178bb390c215968183993bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/d84291215b5892834dd8ca8ee52f9cbdb8274904", - "reference": "d84291215b5892834dd8ca8ee52f9cbdb8274904", + "url": "https://api.github.com/repos/LaravelCollective/html/zipball/99342cc22507cf8d7178bb390c215968183993bb", + "reference": "99342cc22507cf8d7178bb390c215968183993bb", "shasum": "" }, "require": { - "php": ">=5.3.3" + "illuminate/http": "5.1.*", + "illuminate/routing": "5.1.*", + "illuminate/session": "5.1.*", + "illuminate/support": "5.1.*", + "php": ">=5.5.9" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.3,>=2.3.12", - "symfony/intl": "~2.3", - "symfony/phpunit-bridge": "~2.7", - "symfony/yaml": "~2.2" - }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" + "mockery/mockery": "~0.9", + "phpunit/phpunit": "~4.0" }, - "time": "2015-07-08 05:59:48", + "time": "2017-09-07T18:12:11+00:00", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, "installation-source": "dist", "autoload": { - "psr-0": { - "Symfony\\Component\\Translation\\": "" - } + "psr-4": { + "Collective\\Html\\": "src/" + }, + "files": [ + "src/helpers.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -490,64 +588,68 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Adam Engebretson", + "email": "adam@laravelcollective.com" } - ], - "description": "Symfony Translation Component", - "homepage": "https://symfony.com" + ] }, { - "name": "symfony/security-core", - "version": "v2.6.12", - "version_normalized": "2.6.12.0", - "target-dir": "Symfony/Component/Security/Core", + "name": "league/flysystem", + "version": "1.0.57", + "version_normalized": "1.0.57.0", "source": { "type": "git", - "url": "https://github.com/symfony/security-core.git", - "reference": "05f58bb3814e8a853332dc448e3b7addaa87679c" + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/05f58bb3814e8a853332dc448e3b7addaa87679c", - "reference": "05f58bb3814e8a853332dc448e3b7addaa87679c", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", + "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", "shasum": "" }, "require": { - "php": ">=5.3.3" + "ext-fileinfo": "*", + "php": ">=5.5.9" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" }, "require-dev": { - "ircmaxell/password-compat": "1.0.*", - "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1", - "symfony/expression-language": "~2.6", - "symfony/http-foundation": "~2.4", - "symfony/phpunit-bridge": "~2.7", - "symfony/translation": "~2.0,>=2.0.5", - "symfony/validator": "~2.5,>=2.5.5" + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7.10" }, "suggest": { - "ircmaxell/password-compat": "For using the BCrypt password encoder in PHP <5.5", - "symfony/event-dispatcher": "", - "symfony/expression-language": "For using the expression voter", - "symfony/http-foundation": "", - "symfony/validator": "For using the user password constraint" + "ext-fileinfo": "Required for MimeType", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" }, - "time": "2015-07-22 10:08:40", + "time": "2019-10-16T21:01:05+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "1.1-dev" } }, "installation-source": "dist", "autoload": { - "psr-0": { - "Symfony\\Component\\Security\\Core\\": "" + "psr-4": { + "League\\Flysystem\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -556,63 +658,90 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Frank de Jonge", + "email": "info@frenky.net" } ], - "description": "Symfony Security Component - Core Library", - "homepage": "https://symfony.com" + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "Cloud Files", + "WebDAV", + "abstraction", + "aws", + "cloud", + "copy.com", + "dropbox", + "file systems", + "files", + "filesystem", + "filesystems", + "ftp", + "rackspace", + "remote", + "s3", + "sftp", + "storage" + ] }, { - "name": "symfony/routing", - "version": "v2.6.12", - "version_normalized": "2.6.12.0", - "target-dir": "Symfony/Component/Routing", + "name": "monolog/monolog", + "version": "1.25.1", + "version_normalized": "1.25.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/routing.git", - "reference": "0a1764d41bbb54f3864808c50569ac382b44d128" + "url": "https://github.com/Seldaek/monolog.git", + "reference": "70e65a5470a42cfec1a7da00d30edb6e617e8dcf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/0a1764d41bbb54f3864808c50569ac382b44d128", - "reference": "0a1764d41bbb54f3864808c50569ac382b44d128", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/70e65a5470a42cfec1a7da00d30edb6e617e8dcf", + "reference": "70e65a5470a42cfec1a7da00d30edb6e617e8dcf", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" }, "require-dev": { - "doctrine/annotations": "~1.0", - "doctrine/common": "~2.2", - "psr/log": "~1.0", - "symfony/config": "~2.2", - "symfony/expression-language": "~2.4", - "symfony/http-foundation": "~2.3", - "symfony/phpunit-bridge": "~2.7", - "symfony/yaml": "~2.0,>=2.0.5" + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "^5.3|^6.0" }, "suggest": { - "doctrine/annotations": "For using the annotation loader", - "symfony/config": "For using the all-in-one router or any loader", - "symfony/expression-language": "For using expression matching", - "symfony/yaml": "For using the YAML loader" + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" }, - "time": "2015-07-09 16:02:48", + "time": "2019-09-06T13:49:17+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.0.x-dev" } }, "installation-source": "dist", "autoload": { - "psr-0": { - "Symfony\\Component\\Routing\\": "" + "psr-4": { + "Monolog\\": "src/Monolog" } }, "notification-url": "https://packagist.org/downloads/", @@ -621,56 +750,46 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" } ], - "description": "Symfony Routing Component", - "homepage": "https://symfony.com", + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", "keywords": [ - "router", - "routing", - "uri", - "url" + "log", + "logging", + "psr-3" ] }, { - "name": "symfony/process", - "version": "v2.6.12", - "version_normalized": "2.6.12.0", - "target-dir": "Symfony/Component/Process", + "name": "mtdowling/cron-expression", + "version": "v1.2.1", + "version_normalized": "1.2.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "57f1e88bb5dafa449b83f9f265b11d52d517b3e9" + "url": "https://github.com/mtdowling/cron-expression.git", + "reference": "9504fa9ea681b586028adaaa0877db4aecf32bad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/57f1e88bb5dafa449b83f9f265b11d52d517b3e9", - "reference": "57f1e88bb5dafa449b83f9f265b11d52d517b3e9", + "url": "https://api.github.com/repos/mtdowling/cron-expression/zipball/9504fa9ea681b586028adaaa0877db4aecf32bad", + "reference": "9504fa9ea681b586028adaaa0877db4aecf32bad", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.2" }, "require-dev": { - "symfony/phpunit-bridge": "~2.7" + "phpunit/phpunit": "~4.0|~5.0" }, - "time": "2015-06-30 16:10:16", + "time": "2017-01-23T04:29:33+00:00", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, "installation-source": "dist", "autoload": { - "psr-0": { - "Symfony\\Component\\Process\\": "" + "psr-4": { + "Cron\\": "src/Cron/" } }, "notification-url": "https://packagist.org/downloads/", @@ -679,55 +798,60 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" } ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com" + "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", + "keywords": [ + "cron", + "schedule" + ] }, { - "name": "symfony/http-foundation", - "version": "v2.6.12", - "version_normalized": "2.6.12.0", - "target-dir": "Symfony/Component/HttpFoundation", + "name": "nesbot/carbon", + "version": "1.39.1", + "version_normalized": "1.39.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/http-foundation.git", - "reference": "e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c" + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "4be0c005164249208ce1b5ca633cd57bdd42ff33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", - "reference": "e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4be0c005164249208ce1b5ca633cd57bdd42ff33", + "reference": "4be0c005164249208ce1b5ca633cd57bdd42ff33", "shasum": "" }, "require": { - "php": ">=5.3.3" + "kylekatarnls/update-helper": "^1.1", + "php": ">=5.3.9", + "symfony/translation": "~2.6 || ~3.0 || ~4.0" }, "require-dev": { - "symfony/expression-language": "~2.4", - "symfony/phpunit-bridge": "~2.7" + "composer/composer": "^1.2", + "friendsofphp/php-cs-fixer": "~2", + "phpunit/phpunit": "^4.8.35 || ^5.7" }, - "time": "2015-07-22 10:08:40", + "time": "2019-10-14T05:51:36+00:00", + "bin": [ + "bin/upgrade-carbon" + ], "type": "library", "extra": { - "branch-alias": { - "dev-master": "2.6-dev" + "update-helper": "Carbon\\Upgrade", + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] } }, "installation-source": "dist", "autoload": { - "psr-0": { - "Symfony\\Component\\HttpFoundation\\": "" - }, - "classmap": [ - "Symfony/Component/HttpFoundation/Resources/stubs" - ] + "psr-4": { + "": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -735,123 +859,151 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "http://nesbot.com" } ], - "description": "Symfony HttpFoundation Component", - "homepage": "https://symfony.com" + "description": "A simple API extension for DateTime.", + "homepage": "http://carbon.nesbot.com", + "keywords": [ + "date", + "datetime", + "time" + ] }, { - "name": "symfony/event-dispatcher", - "version": "v2.8.0", - "version_normalized": "2.8.0.0", + "name": "nikic/php-parser", + "version": "v2.1.1", + "version_normalized": "2.1.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc" + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "4dd659edadffdc2143e4753df655d866dbfeedf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a5eb815363c0388e83247e7e9853e5dbc14999cc", - "reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4dd659edadffdc2143e4753df655d866dbfeedf0", + "reference": "4dd659edadffdc2143e4753df655d866dbfeedf0", "shasum": "" }, "require": { - "php": ">=5.3.9" + "ext-tokenizer": "*", + "php": ">=5.4" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.6|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" + "phpunit/phpunit": "~4.0" }, - "time": "2015-10-30 20:15:42", + "time": "2016-09-16T12:04:44+00:00", + "bin": [ + "bin/php-parse" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.1-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "PhpParser\\": "lib/PhpParser" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Nikita Popov" } ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com" + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ] }, { - "name": "symfony/debug", - "version": "v2.6.12", - "version_normalized": "2.6.12.0", - "target-dir": "Symfony/Component/Debug", + "name": "paragonie/random_compat", + "version": "v1.4.3", + "version_normalized": "1.4.3.0", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "fca5696e0c9787722baa8f2ad6940dfd7a6a6941" + "url": "https://github.com/paragonie/random_compat.git", + "reference": "9b3899e3c3ddde89016f576edb8c489708ad64cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/fca5696e0c9787722baa8f2ad6940dfd7a6a6941", - "reference": "fca5696e0c9787722baa8f2ad6940dfd7a6a6941", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/9b3899e3c3ddde89016f576edb8c489708ad64cd", + "reference": "9b3899e3c3ddde89016f576edb8c489708ad64cd", "shasum": "" }, "require": { - "php": ">=5.3.3", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + "php": ">=5.2.0" }, "require-dev": { - "symfony/class-loader": "~2.2", - "symfony/http-foundation": "~2.1", - "symfony/http-kernel": "~2.3.24|~2.5.9|~2.6,>=2.6.2", - "symfony/phpunit-bridge": "~2.7" + "phpunit/phpunit": "4.*|5.*" }, "suggest": { - "symfony/http-foundation": "", - "symfony/http-kernel": "" + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "time": "2018-04-04T21:48:54+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ] + }, + { + "name": "psr/log", + "version": "1.1.2", + "version_normalized": "1.1.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" }, - "time": "2015-07-08 05:59:48", + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2019-11-01T11:05:21+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "1.1.x-dev" } }, "installation-source": "dist", "autoload": { - "psr-0": { - "Symfony\\Component\\Debug\\": "" + "psr-4": { + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -860,78 +1012,70 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com" + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ] }, { - "name": "symfony/http-kernel", - "version": "v2.6.12", - "version_normalized": "2.6.12.0", - "target-dir": "Symfony/Component/HttpKernel", + "name": "psy/psysh", + "version": "v0.7.2", + "version_normalized": "0.7.2.0", "source": { "type": "git", - "url": "https://github.com/symfony/http-kernel.git", - "reference": "498866a8ca0bcbcd3f3824b1520fa568ff7ca3b6" + "url": "https://github.com/bobthecow/psysh.git", + "reference": "e64e10b20f8d229cac76399e1f3edddb57a0f280" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/498866a8ca0bcbcd3f3824b1520fa568ff7ca3b6", - "reference": "498866a8ca0bcbcd3f3824b1520fa568ff7ca3b6", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/e64e10b20f8d229cac76399e1f3edddb57a0f280", + "reference": "e64e10b20f8d229cac76399e1f3edddb57a0f280", "shasum": "" }, "require": { - "php": ">=5.3.3", - "psr/log": "~1.0", - "symfony/debug": "~2.6,>=2.6.2", - "symfony/event-dispatcher": "~2.6,>=2.6.7", - "symfony/http-foundation": "~2.5,>=2.5.4" + "dnoegel/php-xdg-base-dir": "0.1", + "jakub-onderka/php-console-highlighter": "0.3.*", + "nikic/php-parser": "^1.2.1|~2.0", + "php": ">=5.3.9", + "symfony/console": "~2.3.10|^2.4.2|~3.0", + "symfony/var-dumper": "~2.7|~3.0" }, "require-dev": { - "symfony/browser-kit": "~2.3", - "symfony/class-loader": "~2.1", - "symfony/config": "~2.0,>=2.0.5", - "symfony/console": "~2.3", - "symfony/css-selector": "~2.0,>=2.0.5", - "symfony/dependency-injection": "~2.2", - "symfony/dom-crawler": "~2.0,>=2.0.5", - "symfony/expression-language": "~2.4", - "symfony/finder": "~2.0,>=2.0.5", - "symfony/phpunit-bridge": "~2.7", - "symfony/process": "~2.0,>=2.0.5", - "symfony/routing": "~2.2", - "symfony/stopwatch": "~2.3", - "symfony/templating": "~2.2", - "symfony/translation": "~2.0,>=2.0.5", - "symfony/var-dumper": "~2.6" + "fabpot/php-cs-fixer": "~1.5", + "phpunit/phpunit": "~3.7|~4.0|~5.0", + "squizlabs/php_codesniffer": "~2.0", + "symfony/finder": "~2.1|~3.0" }, "suggest": { - "symfony/browser-kit": "", - "symfony/class-loader": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "", - "symfony/finder": "", - "symfony/var-dumper": "" + "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", + "ext-pdo-sqlite": "The doc command requires SQLite to work.", + "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", + "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history." }, - "time": "2015-11-23 11:37:53", + "time": "2016-03-09T05:03:14+00:00", + "bin": [ + "bin/psysh" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-develop": "0.8.x-dev" } }, "installation-source": "dist", "autoload": { - "psr-0": { - "Symfony\\Component\\HttpKernel\\": "" + "files": [ + "src/Psy/functions.php" + ], + "psr-4": { + "Psy\\": "src/Psy/" } }, "notification-url": "https://packagist.org/downloads/", @@ -940,51 +1084,54 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Justin Hileman", + "email": "justin@justinhileman.info", + "homepage": "http://justinhileman.com" } ], - "description": "Symfony HttpKernel Component", - "homepage": "https://symfony.com" + "description": "An interactive shell for modern PHP.", + "homepage": "http://psysh.org", + "keywords": [ + "REPL", + "console", + "interactive", + "shell" + ] }, { - "name": "symfony/finder", - "version": "v2.6.12", - "version_normalized": "2.6.12.0", - "target-dir": "Symfony/Component/Finder", + "name": "swiftmailer/swiftmailer", + "version": "v5.4.12", + "version_normalized": "5.4.12.0", "source": { "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "203a10f928ae30176deeba33512999233181dd28" + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "181b89f18a90f8925ef805f950d47a7190e9b950" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/203a10f928ae30176deeba33512999233181dd28", - "reference": "203a10f928ae30176deeba33512999233181dd28", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/181b89f18a90f8925ef805f950d47a7190e9b950", + "reference": "181b89f18a90f8925ef805f950d47a7190e9b950", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "symfony/phpunit-bridge": "~2.7" + "mockery/mockery": "~0.9.1", + "symfony/phpunit-bridge": "~3.2" }, - "time": "2015-07-09 16:02:48", + "time": "2018-07-31T09:26:32+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "5.4-dev" } }, "installation-source": "dist", "autoload": { - "psr-0": { - "Symfony\\Component\\Finder\\": "" - } + "files": [ + "lib/swift_required.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -992,59 +1139,65 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Chris Corbyn" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com" + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "https://swiftmailer.symfony.com", + "keywords": [ + "email", + "mail", + "mailer" + ] }, { "name": "symfony/console", - "version": "v2.6.12", - "version_normalized": "2.6.12.0", - "target-dir": "Symfony/Component/Console", + "version": "v2.7.51", + "version_normalized": "2.7.51.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359" + "reference": "574cb4cfaa01ba115fc2fc0c2355b2c5472a4804" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0e5e18ae09d3f5c06367759be940e9ed3f568359", - "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359", + "url": "https://api.github.com/repos/symfony/console/zipball/574cb4cfaa01ba115fc2fc0c2355b2c5472a4804", + "reference": "574cb4cfaa01ba115fc2fc0c2355b2c5472a4804", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9", + "symfony/debug": "^2.7.2" }, "require-dev": { "psr/log": "~1.0", "symfony/event-dispatcher": "~2.1", - "symfony/phpunit-bridge": "~2.7", "symfony/process": "~2.1" }, "suggest": { - "psr/log": "For using the console logger", + "psr/log-implementation": "For using the console logger", "symfony/event-dispatcher": "", "symfony/process": "" }, - "time": "2015-07-26 09:08:40", + "time": "2018-05-13T15:44:36+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "installation-source": "dist", "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Console\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1064,37 +1217,37 @@ "homepage": "https://symfony.com" }, { - "name": "swiftmailer/swiftmailer", - "version": "v5.4.1", - "version_normalized": "5.4.1.0", + "name": "symfony/css-selector", + "version": "v2.8.50", + "version_normalized": "2.8.50.0", "source": { "type": "git", - "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421" + "url": "https://github.com/symfony/css-selector.git", + "reference": "7b1692e418d7ccac24c373528453bc90e42797de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/0697e6aa65c83edf97bb0f23d8763f94e3f11421", - "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/7b1692e418d7ccac24c373528453bc90e42797de", + "reference": "7b1692e418d7ccac24c373528453bc90e42797de", "shasum": "" }, "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "mockery/mockery": "~0.9.1,<0.9.4" + "php": ">=5.3.9" }, - "time": "2015-06-06 14:19:39", + "time": "2018-11-11T11:18:13+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "5.4-dev" + "dev-master": "2.8-dev" } }, "installation-source": "dist", "autoload": { - "files": [ - "lib/swift_required.php" + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1103,101 +1256,120 @@ ], "authors": [ { - "name": "Chris Corbyn" + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Swiftmailer, free feature-rich PHP mailer", - "homepage": "http://swiftmailer.org", - "keywords": [ - "email", - "mail", - "mailer" - ] + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com" }, { - "name": "nikic/php-parser", - "version": "v1.4.1", - "version_normalized": "1.4.1.0", + "name": "symfony/debug", + "version": "v2.7.51", + "version_normalized": "2.7.51.0", "source": { "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51" + "url": "https://github.com/symfony/debug.git", + "reference": "4a7330f29b3d215f8bacf076689f9d1c3d568681" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51", - "reference": "f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51", + "url": "https://api.github.com/repos/symfony/debug/zipball/4a7330f29b3d215f8bacf076689f9d1c3d568681", + "reference": "4a7330f29b3d215f8bacf076689f9d1c3d568681", "shasum": "" }, "require": { - "ext-tokenizer": "*", - "php": ">=5.3" + "php": ">=5.3.9", + "psr/log": "~1.0" }, - "time": "2015-09-19 14:15:08", + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.2", + "symfony/http-kernel": "~2.3.24|~2.5.9|^2.6.2" + }, + "time": "2018-08-03T11:24:48+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.7-dev" } }, "installation-source": "dist", "autoload": { - "files": [ - "lib/bootstrap.php" + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Nikita Popov" - } + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ] + "description": "Symfony Debug Component", + "homepage": "https://symfony.com" }, { - "name": "jakub-onderka/php-console-highlighter", - "version": "v0.3.2", - "version_normalized": "0.3.2.0", + "name": "symfony/dom-crawler", + "version": "v2.7.51", + "version_normalized": "2.7.51.0", "source": { "type": "git", - "url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git", - "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5" + "url": "https://github.com/symfony/dom-crawler.git", + "reference": "d905e1c5885735ee66af60c205429b9941f24752" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/7daa75df45242c8d5b75a22c00a201e7954e4fb5", - "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/d905e1c5885735ee66af60c205429b9941f24752", + "reference": "d905e1c5885735ee66af60c205429b9941f24752", "shasum": "" }, "require": { - "jakub-onderka/php-console-color": "~0.1", - "php": ">=5.3.0" + "php": ">=5.3.9", + "symfony/polyfill-ctype": "~1.8" }, "require-dev": { - "jakub-onderka/php-code-style": "~1.0", - "jakub-onderka/php-parallel-lint": "~0.5", - "jakub-onderka/php-var-dump-check": "~0.1", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~1.5" + "symfony/css-selector": "~2.3" }, - "time": "2015-04-20 18:58:01", + "suggest": { + "symfony/css-selector": "" + }, + "time": "2018-05-01T22:30:49+00:00", "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, "installation-source": "dist", "autoload": { - "psr-0": { - "JakubOnderka\\PhpConsoleHighlighter": "src/" - } + "psr-4": { + "Symfony\\Component\\DomCrawler\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1205,41 +1377,61 @@ ], "authors": [ { - "name": "Jakub Onderka", - "email": "acci@acci.cz", - "homepage": "http://www.acci.cz/" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } - ] + ], + "description": "Symfony DomCrawler Component", + "homepage": "https://symfony.com" }, { - "name": "nesbot/carbon", - "version": "1.21.0", - "version_normalized": "1.21.0.0", + "name": "symfony/event-dispatcher", + "version": "v2.8.50", + "version_normalized": "2.8.50.0", "source": { "type": "git", - "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "7b08ec6f75791e130012f206e3f7b0e76e18e3d7" + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "a77e974a5fecb4398833b0709210e3d5e334ffb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7b08ec6f75791e130012f206e3f7b0e76e18e3d7", - "reference": "7b08ec6f75791e130012f206e3f7b0e76e18e3d7", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a77e974a5fecb4398833b0709210e3d5e334ffb0", + "reference": "a77e974a5fecb4398833b0709210e3d5e334ffb0", "shasum": "" }, "require": { - "php": ">=5.3.0", - "symfony/translation": "~2.6|~3.0" + "php": ">=5.3.9" }, "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" + "psr/log": "~1.0", + "symfony/config": "^2.0.5|~3.0.0", + "symfony/dependency-injection": "~2.6|~3.0.0", + "symfony/expression-language": "~2.6|~3.0.0", + "symfony/stopwatch": "~2.3|~3.0.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" }, - "time": "2015-11-04 20:07:17", + "time": "2018-11-21T14:20:20+00:00", "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, "installation-source": "dist", "autoload": { "psr-4": { - "Carbon\\": "src/Carbon/" - } + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1247,78 +1439,108 @@ ], "authors": [ { - "name": "Brian Nesbitt", - "email": "brian@nesbot.com", - "homepage": "http://nesbot.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "A simple API extension for DateTime.", - "homepage": "http://carbon.nesbot.com", - "keywords": [ - "date", - "datetime", - "time" - ] + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com" }, { - "name": "monolog/monolog", - "version": "1.17.2", - "version_normalized": "1.17.2.0", + "name": "symfony/finder", + "version": "v2.7.51", + "version_normalized": "2.7.51.0", "source": { "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24" + "url": "https://github.com/symfony/finder.git", + "reference": "34226a3aa279f1e356ad56181b91acfdc9a2525c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bee7f0dc9c3e0b69a6039697533dca1e845c8c24", - "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24", + "url": "https://api.github.com/repos/symfony/finder/zipball/34226a3aa279f1e356ad56181b91acfdc9a2525c", + "reference": "34226a3aa279f1e356ad56181b91acfdc9a2525c", "shasum": "" }, "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" + "php": ">=5.3.9" }, - "provide": { - "psr/log-implementation": "1.0.0" + "time": "2018-05-14T06:36:14+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } }, - "require-dev": { - "aws/aws-sdk-php": "^2.4.9", - "doctrine/couchdb": "~1.0@dev", - "graylog2/gelf-php": "~1.0", - "jakub-onderka/php-parallel-lint": "0.9", - "php-console/php-console": "^3.1.3", - "phpunit/phpunit": "~4.5", - "phpunit/phpunit-mock-objects": "2.3.0", - "raven/raven": "^0.13", - "ruflin/elastica": ">=0.90 <3.0", - "swiftmailer/swiftmailer": "~5.3", - "videlalvaro/php-amqplib": "~2.4" + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, - "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", - "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "php-console/php-console": "Allow sending log messages to Google Chrome", - "raven/raven": "Allow sending log messages to a Sentry server", - "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib" + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com" + }, + { + "name": "symfony/http-foundation", + "version": "v2.7.51", + "version_normalized": "2.7.51.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "b67e5cbd2bf837fb3681f2c4965826d6c6758532" }, - "time": "2015-10-14 12:51:02", + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/b67e5cbd2bf837fb3681f2c4965826d6c6758532", + "reference": "b67e5cbd2bf837fb3681f2c4965826d6c6758532", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "symfony/expression-language": "~2.4" + }, + "time": "2019-04-16T09:58:21+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.16.x-dev" + "dev-master": "2.7-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Monolog\\": "src/Monolog" - } + "Symfony\\Component\\HttpFoundation\\": "" + }, + "classmap": [ + "Resources/stubs" + ], + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1326,135 +1548,199 @@ ], "authors": [ { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", - "keywords": [ - "log", - "logging", - "psr-3" - ] + "description": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com" }, { - "name": "league/flysystem", - "version": "1.0.15", - "version_normalized": "1.0.15.0", + "name": "symfony/http-kernel", + "version": "v2.7.52", + "version_normalized": "2.7.52.0", "source": { "type": "git", - "url": "https://github.com/thephpleague/flysystem.git", - "reference": "31525caf9e8772683672fefd8a1ca0c0736020f4" + "url": "https://github.com/symfony/http-kernel.git", + "reference": "435064b3b143f79469206915137c21e88b56bfb9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/31525caf9e8772683672fefd8a1ca0c0736020f4", - "reference": "31525caf9e8772683672fefd8a1ca0c0736020f4", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/435064b3b143f79469206915137c21e88b56bfb9", + "reference": "435064b3b143f79469206915137c21e88b56bfb9", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=5.3.9", + "psr/log": "~1.0", + "symfony/debug": "^2.6.2", + "symfony/event-dispatcher": "^2.6.7", + "symfony/http-foundation": "~2.7.36|^2.8.29", + "symfony/polyfill-ctype": "~1.8" }, "conflict": { - "league/flysystem-sftp": "<1.0.6" + "symfony/config": "<2.7", + "twig/twig": "<1.34|<2.4,>=2" }, "require-dev": { - "ext-fileinfo": "*", - "mockery/mockery": "~0.9", - "phpspec/phpspec": "^2.2", - "phpspec/prophecy-phpunit": "~1.0", - "phpunit/phpunit": "~4.1" + "symfony/browser-kit": "~2.3", + "symfony/class-loader": "~2.1", + "symfony/config": "~2.7", + "symfony/console": "~2.3", + "symfony/css-selector": "^2.0.5", + "symfony/dependency-injection": "~2.2", + "symfony/dom-crawler": "^2.0.5", + "symfony/expression-language": "~2.4", + "symfony/finder": "^2.0.5", + "symfony/process": "^2.0.5", + "symfony/routing": "~2.2", + "symfony/stopwatch": "~2.3", + "symfony/templating": "~2.2", + "symfony/translation": "^2.0.5", + "symfony/var-dumper": "~2.6" }, "suggest": { - "ext-fileinfo": "Required for MimeType", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-copy": "Allows you to use Copy.com storage", - "league/flysystem-dropbox": "Allows you to use Dropbox storage", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter" + "symfony/browser-kit": "", + "symfony/class-loader": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "", + "symfony/finder": "", + "symfony/var-dumper": "" }, - "time": "2015-09-30 22:26:59", + "time": "2019-04-17T16:37:53+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.7-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "League\\Flysystem\\": "src/" + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpKernel Component", + "homepage": "https://symfony.com" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.12.0", + "version_normalized": "1.12.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "time": "2019-08-06T08:03:45+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" } }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { - "name": "Frank de Jonge", - "email": "info@frenky.net" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Filesystem abstraction: Many filesystems, one API.", + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", "keywords": [ - "Cloud Files", - "WebDAV", - "abstraction", - "aws", - "cloud", - "copy.com", - "dropbox", - "file systems", - "files", - "filesystem", - "filesystems", - "ftp", - "rackspace", - "remote", - "s3", - "sftp", - "storage" + "compatibility", + "ctype", + "polyfill", + "portable" ] }, { - "name": "symfony/polyfill-util", - "version": "v1.0.0", - "version_normalized": "1.0.0.0", + "name": "symfony/polyfill-mbstring", + "version": "v1.12.0", + "version_normalized": "1.12.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-util.git", - "reference": "4271c55cbc0a77b2641f861b978123e46b3da969" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/4271c55cbc0a77b2641f861b978123e46b3da969", - "reference": "4271c55cbc0a77b2641f861b978123e46b3da969", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2015-11-04 20:28:58", + "suggest": { + "ext-mbstring": "For best performance" + }, + "time": "2019-08-06T08:03:45+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.12-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Symfony\\Polyfill\\Util\\": "" - } + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1470,39 +1756,40 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony utilities for portability of PHP codes", + "description": "Symfony polyfill for the Mbstring extension", "homepage": "https://symfony.com", "keywords": [ - "compat", "compatibility", + "mbstring", "polyfill", + "portable", "shim" ] }, { "name": "symfony/polyfill-php56", - "version": "v1.0.0", - "version_normalized": "1.0.0.0", + "version": "v1.12.0", + "version_normalized": "1.12.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php56.git", - "reference": "a6bd4770a6967517e6610529e14afaa3111094a3" + "reference": "0e3b212e96a51338639d8ce175c046d7729c3403" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/a6bd4770a6967517e6610529e14afaa3111094a3", - "reference": "a6bd4770a6967517e6610529e14afaa3111094a3", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/0e3b212e96a51338639d8ce175c046d7729c3403", + "reference": "0e3b212e96a51338639d8ce175c046d7729c3403", "shasum": "" }, "require": { "php": ">=5.3.3", "symfony/polyfill-util": "~1.0" }, - "time": "2015-11-04 20:28:58", + "time": "2019-08-06T08:03:45+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.12-dev" } }, "installation-source": "dist", @@ -1538,39 +1825,34 @@ ] }, { - "name": "jeremeamia/SuperClosure", - "version": "2.2.0", - "version_normalized": "2.2.0.0", + "name": "symfony/polyfill-util", + "version": "v1.12.0", + "version_normalized": "1.12.0.0", "source": { "type": "git", - "url": "https://github.com/jeremeamia/super_closure.git", - "reference": "29a88be2a4846d27c1613aed0c9071dfad7b5938" + "url": "https://github.com/symfony/polyfill-util.git", + "reference": "4317de1386717b4c22caed7725350a8887ab205c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/29a88be2a4846d27c1613aed0c9071dfad7b5938", - "reference": "29a88be2a4846d27c1613aed0c9071dfad7b5938", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/4317de1386717b4c22caed7725350a8887ab205c", + "reference": "4317de1386717b4c22caed7725350a8887ab205c", "shasum": "" }, "require": { - "nikic/php-parser": "^1.2|^2.0", - "php": ">=5.4", - "symfony/polyfill-php56": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0|^5.0" + "php": ">=5.3.3" }, - "time": "2015-12-05 17:17:57", + "time": "2019-08-06T08:03:45+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "1.12-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "SuperClosure\\": "src/" + "Symfony\\Polyfill\\Util\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -1579,57 +1861,56 @@ ], "authors": [ { - "name": "Jeremy Lindblom", - "email": "jeremeamia@gmail.com", - "homepage": "https://github.com/jeremeamia", - "role": "Developer" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Serialize Closure objects, including their context and binding", - "homepage": "https://github.com/jeremeamia/super_closure", + "description": "Symfony utilities for portability of PHP codes", + "homepage": "https://symfony.com", "keywords": [ - "closure", - "function", - "lambda", - "parser", - "serializable", - "serialize", - "tokenizer" + "compat", + "compatibility", + "polyfill", + "shim" ] }, { - "name": "doctrine/inflector", - "version": "v1.1.0", - "version_normalized": "1.1.0.0", + "name": "symfony/process", + "version": "v2.7.51", + "version_normalized": "2.7.51.0", "source": { "type": "git", - "url": "https://github.com/doctrine/inflector.git", - "reference": "90b2128806bfde671b6952ab8bea493942c1fdae" + "url": "https://github.com/symfony/process.git", + "reference": "eda637e05670e2afeec3842dcd646dce94262f6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae", - "reference": "90b2128806bfde671b6952ab8bea493942c1fdae", + "url": "https://api.github.com/repos/symfony/process/zipball/eda637e05670e2afeec3842dcd646dce94262f6b", + "reference": "eda637e05670e2afeec3842dcd646dce94262f6b", "shasum": "" }, "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "4.*" + "php": ">=5.3.9" }, - "time": "2015-11-06 14:35:42", + "time": "2018-08-03T11:24:48+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.7-dev" } }, "installation-source": "dist", "autoload": { - "psr-0": { - "Doctrine\\Common\\Inflector\\": "lib/" - } + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1637,66 +1918,68 @@ ], "authors": [ { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Common String Manipulations with regard to casing and singular/plural rules.", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "inflection", - "pluralize", - "singularize", - "string" - ] + "description": "Symfony Process Component", + "homepage": "https://symfony.com" }, { - "name": "danielstjules/stringy", - "version": "1.10.0", - "version_normalized": "1.10.0.0", + "name": "symfony/routing", + "version": "v2.7.51", + "version_normalized": "2.7.51.0", "source": { "type": "git", - "url": "https://github.com/danielstjules/Stringy.git", - "reference": "4749c205db47ee5b32e8d1adf6d9aff8db6caf3b" + "url": "https://github.com/symfony/routing.git", + "reference": "33bd5882f201f9a3b7dd9640b95710b71304c4fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/4749c205db47ee5b32e8d1adf6d9aff8db6caf3b", - "reference": "4749c205db47ee5b32e8d1adf6d9aff8db6caf3b", + "url": "https://api.github.com/repos/symfony/routing/zipball/33bd5882f201f9a3b7dd9640b95710b71304c4fb", + "reference": "33bd5882f201f9a3b7dd9640b95710b71304c4fb", "shasum": "" }, "require": { - "ext-mbstring": "*", - "php": ">=5.3.0" + "php": ">=5.3.9" + }, + "conflict": { + "symfony/config": "<2.7" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "doctrine/annotations": "~1.0", + "doctrine/common": "~2.2", + "psr/log": "~1.0", + "symfony/config": "~2.7", + "symfony/expression-language": "~2.4", + "symfony/http-foundation": "~2.3", + "symfony/yaml": "^2.0.5" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" }, - "time": "2015-07-23 00:54:12", + "time": "2018-02-28T09:36:59+00:00", "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, "installation-source": "dist", "autoload": { "psr-4": { - "Stringy\\": "src/" + "Symfony\\Component\\Routing\\": "" }, - "files": [ - "src/Create.php" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1705,54 +1988,66 @@ ], "authors": [ { - "name": "Daniel St. Jules", - "email": "danielst.jules@gmail.com", - "homepage": "http://www.danielstjules.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "A string manipulation library with multibyte support", - "homepage": "https://github.com/danielstjules/Stringy", + "description": "Symfony Routing Component", + "homepage": "https://symfony.com", "keywords": [ - "UTF", - "helpers", - "manipulation", - "methods", - "multibyte", - "string", - "utf-8", - "utility", - "utils" + "router", + "routing", + "uri", + "url" ] }, { - "name": "symfony/filesystem", - "version": "v2.8.0", - "version_normalized": "2.8.0.0", + "name": "symfony/translation", + "version": "v2.7.51", + "version_normalized": "2.7.51.0", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "3e661a0d521ac67496515fa6e6704bd61bcfff60" + "url": "https://github.com/symfony/translation.git", + "reference": "1959c78c5a32539ef221b3e18a961a96d949118f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/3e661a0d521ac67496515fa6e6704bd61bcfff60", - "reference": "3e661a0d521ac67496515fa6e6704bd61bcfff60", + "url": "https://api.github.com/repos/symfony/translation/zipball/1959c78c5a32539ef221b3e18a961a96d949118f", + "reference": "1959c78c5a32539ef221b3e18a961a96d949118f", "shasum": "" }, "require": { "php": ">=5.3.9" }, - "time": "2015-11-23 10:19:46", + "conflict": { + "symfony/config": "<2.7" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.7", + "symfony/intl": "~2.7.25|^2.8.18", + "symfony/yaml": "~2.2" + }, + "suggest": { + "psr/log-implementation": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "time": "2018-05-17T10:34:06+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Symfony\\Component\\Filesystem\\": "" + "Symfony\\Component\\Translation\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1772,49 +2067,51 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Symfony Translation Component", "homepage": "https://symfony.com" }, { - "name": "classpreloader/classpreloader", - "version": "1.4.0", - "version_normalized": "1.4.0.0", + "name": "symfony/var-dumper", + "version": "v2.7.51", + "version_normalized": "2.7.51.0", "source": { "type": "git", - "url": "https://github.com/ClassPreloader/ClassPreloader.git", - "reference": "b76f3f4f603ebbe7e64351a7ef973431ddaf7b27" + "url": "https://github.com/symfony/var-dumper.git", + "reference": "6f9271e94369db05807b261fcfefe4cd1aafd390" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ClassPreloader/ClassPreloader/zipball/b76f3f4f603ebbe7e64351a7ef973431ddaf7b27", - "reference": "b76f3f4f603ebbe7e64351a7ef973431ddaf7b27", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/6f9271e94369db05807b261fcfefe4cd1aafd390", + "reference": "6f9271e94369db05807b261fcfefe4cd1aafd390", "shasum": "" }, "require": { - "nikic/php-parser": "~1.3", - "php": ">=5.3.3", - "symfony/console": "~2.1", - "symfony/filesystem": "~2.1", - "symfony/finder": "~2.1" + "php": ">=5.3.9" }, - "require-dev": { - "phpunit/phpunit": "~4.0" + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" }, - "time": "2015-05-26 10:57:51", - "bin": [ - "classpreloader.php" - ], + "suggest": { + "ext-symfony_debug": "" + }, + "time": "2018-04-22T05:56:10+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.7-dev" } }, "installation-source": "dist", "autoload": { + "files": [ + "Resources/functions/dump.php" + ], "psr-4": { - "ClassPreloader\\": "src/" - } + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1822,147 +2119,67 @@ ], "authors": [ { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { - "name": "Graham Campbell", - "email": "graham@cachethq.io" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Helps class loading performance by generating a single PHP file containing all of the autoloaded files for a specific use case", + "description": "Symfony mechanism for exploring and dumping PHP variables", + "homepage": "https://symfony.com", "keywords": [ - "autoload", - "class", - "preload" + "debug", + "dump" ] }, { - "name": "laravel/framework", - "version": "v5.0.34", - "version_normalized": "5.0.34.0", + "name": "vlucas/phpdotenv", + "version": "v1.1.1", + "version_normalized": "1.1.1.0", "source": { "type": "git", - "url": "https://github.com/laravel/framework.git", - "reference": "98dbaafe8e2781f86b1b858f8610be0d7318b153" + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "0cac554ce06277e33ddf9f0b7ade4b8bbf2af3fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/98dbaafe8e2781f86b1b858f8610be0d7318b153", - "reference": "98dbaafe8e2781f86b1b858f8610be0d7318b153", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/0cac554ce06277e33ddf9f0b7ade4b8bbf2af3fa", + "reference": "0cac554ce06277e33ddf9f0b7ade4b8bbf2af3fa", "shasum": "" }, "require": { - "classpreloader/classpreloader": "~1.2", - "danielstjules/stringy": "~1.8", - "doctrine/inflector": "~1.0", - "ext-mbstring": "*", - "ext-mcrypt": "*", - "ext-openssl": "*", - "ircmaxell/password-compat": "~1.0", - "jeremeamia/superclosure": "~2.0", - "league/flysystem": "~1.0", - "monolog/monolog": "~1.11", - "mtdowling/cron-expression": "~1.0", - "nesbot/carbon": "~1.0", - "php": ">=5.4.0", - "psy/psysh": "0.4.*", - "swiftmailer/swiftmailer": "~5.1", - "symfony/console": "2.6.*", - "symfony/debug": "2.6.*", - "symfony/finder": "2.6.*", - "symfony/http-foundation": "2.6.*", - "symfony/http-kernel": "2.6.*", - "symfony/process": "2.6.*", - "symfony/routing": "2.6.*", - "symfony/security-core": "2.6.*", - "symfony/translation": "2.6.*", - "symfony/var-dumper": "2.6.*", - "vlucas/phpdotenv": "~1.0" - }, - "replace": { - "illuminate/auth": "self.version", - "illuminate/bus": "self.version", - "illuminate/cache": "self.version", - "illuminate/config": "self.version", - "illuminate/console": "self.version", - "illuminate/container": "self.version", - "illuminate/contracts": "self.version", - "illuminate/cookie": "self.version", - "illuminate/database": "self.version", - "illuminate/encryption": "self.version", - "illuminate/events": "self.version", - "illuminate/exception": "self.version", - "illuminate/filesystem": "self.version", - "illuminate/foundation": "self.version", - "illuminate/hashing": "self.version", - "illuminate/http": "self.version", - "illuminate/log": "self.version", - "illuminate/mail": "self.version", - "illuminate/pagination": "self.version", - "illuminate/pipeline": "self.version", - "illuminate/queue": "self.version", - "illuminate/redis": "self.version", - "illuminate/routing": "self.version", - "illuminate/session": "self.version", - "illuminate/support": "self.version", - "illuminate/translation": "self.version", - "illuminate/validation": "self.version", - "illuminate/view": "self.version" + "php": ">=5.3.2" }, "require-dev": { - "aws/aws-sdk-php": "~2.4", - "iron-io/iron_mq": "~1.5", - "mockery/mockery": "~0.9", - "pda/pheanstalk": "~3.0", - "phpunit/phpunit": "~4.0", - "predis/predis": "~1.0" - }, - "suggest": { - "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~2.4).", - "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).", - "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers (~5.0).", - "iron-io/iron_mq": "Required to use the iron queue driver (~1.5).", - "league/flysystem-aws-s3-v2": "Required to use the Flysystem S3 driver (~1.0).", - "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).", - "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).", - "predis/predis": "Required to use the redis cache and queue drivers (~1.0)." + "phpunit/phpunit": "~4.0" }, - "time": "2015-12-04 23:20:49", + "time": "2015-05-30T15:59:26+00:00", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "installation-source": "dist", "autoload": { - "classmap": [ - "src/Illuminate/Queue/IlluminateQueueClosure.php" - ], - "files": [ - "src/Illuminate/Foundation/helpers.php", - "src/Illuminate/Support/helpers.php" - ], - "psr-4": { - "Illuminate\\": "src/Illuminate/" + "psr-0": { + "Dotenv": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD" ], "authors": [ { - "name": "Taylor Otwell", - "email": "taylorotwell@gmail.com" + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "http://www.vancelucas.com" } ], - "description": "The Laravel Framework.", - "homepage": "http://laravel.com", + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "homepage": "http://github.com/vlucas/phpdotenv", "keywords": [ - "framework", - "laravel" + "dotenv", + "env", + "environment" ] } ] diff --git a/application/vendor/doctrine/inflector/.gitignore b/application/vendor/doctrine/inflector/.gitignore deleted file mode 100644 index f2cb7f8..0000000 --- a/application/vendor/doctrine/inflector/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -vendor/ -composer.lock -composer.phar -phpunit.xml diff --git a/application/vendor/doctrine/inflector/.travis.yml b/application/vendor/doctrine/inflector/.travis.yml deleted file mode 100644 index 9ec68f7..0000000 --- a/application/vendor/doctrine/inflector/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: php - -sudo: false - -cache: - directory: - - $HOME/.composer/cache - -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - hhvm - -install: - - composer install -n - -script: - - phpunit diff --git a/application/vendor/doctrine/inflector/composer.json b/application/vendor/doctrine/inflector/composer.json index 7e5b2ef..2189ff1 100644 --- a/application/vendor/doctrine/inflector/composer.json +++ b/application/vendor/doctrine/inflector/composer.json @@ -13,17 +13,20 @@ {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} ], "require": { - "php": ">=5.3.2" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "^6.2" }, "autoload": { - "psr-0": { "Doctrine\\Common\\Inflector\\": "lib/" } + "psr-4": { "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" } + }, + "autoload-dev": { + "psr-4": { "Doctrine\\Tests\\Common\\Inflector\\": "tests/Doctrine/Tests/Common/Inflector" } }, "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.3.x-dev" } } } diff --git a/application/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php b/application/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php index a53828a..f9067a0 100644 --- a/application/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php +++ b/application/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php @@ -38,7 +38,7 @@ class Inflector /** * Plural inflector rules. * - * @var array + * @var string[][] */ private static $plural = array( 'rules' => array( @@ -49,10 +49,11 @@ class Inflector '/(matr|vert|ind)(ix|ex)$/i' => '\1ices', '/(x|ch|ss|sh)$/i' => '\1es', '/([^aeiouy]|qu)y$/i' => '\1ies', - '/(hive)$/i' => '\1s', + '/(hive|gulf)$/i' => '\1s', '/(?:([^f])fe|([lr])f)$/i' => '\1\2ves', '/sis$/i' => 'ses', '/([ti])um$/i' => '\1a', + '/(c)riterion$/i' => '\1riteria', '/(p)erson$/i' => '\1eople', '/(m)an$/i' => '\1en', '/(c)hild$/i' => '\1hildren', @@ -67,7 +68,16 @@ class Inflector '/$/' => 's', ), 'uninflected' => array( - '.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', 'people', 'cookie' + '.*[nrlm]ese', + '.*deer', + '.*fish', + '.*measles', + '.*ois', + '.*pox', + '.*sheep', + 'people', + 'cookie', + 'police', ), 'irregular' => array( 'atlas' => 'atlases', @@ -76,6 +86,7 @@ class Inflector 'brother' => 'brothers', 'cafe' => 'cafes', 'chateau' => 'chateaux', + 'niveau' => 'niveaux', 'child' => 'children', 'cookie' => 'cookies', 'corpus' => 'corpuses', @@ -90,11 +101,13 @@ class Inflector 'ganglion' => 'ganglions', 'genie' => 'genies', 'genus' => 'genera', + 'goose' => 'geese', 'graffito' => 'graffiti', 'hippopotamus' => 'hippopotami', 'hoof' => 'hoofs', 'human' => 'humans', 'iris' => 'irises', + 'larva' => 'larvae', 'leaf' => 'leaves', 'loaf' => 'loaves', 'man' => 'men', @@ -112,6 +125,7 @@ class Inflector 'octopus' => 'octopuses', 'opus' => 'opuses', 'ox' => 'oxen', + 'passerby' => 'passersby', 'penis' => 'penises', 'person' => 'people', 'plateau' => 'plateaux', @@ -126,6 +140,7 @@ class Inflector 'tornado' => 'tornadoes', 'trilby' => 'trilbys', 'turf' => 'turfs', + 'valve' => 'valves', 'volcano' => 'volcanoes', ) ); @@ -133,7 +148,7 @@ class Inflector /** * Singular inflector rules. * - * @var array + * @var string[][] */ private static $singular = array( 'rules' => array( @@ -161,9 +176,12 @@ class Inflector '/(tive)s$/i' => '\1', '/(hive)s$/i' => '\1', '/(drive)s$/i' => '\1', + '/(dive)s$/i' => '\1', + '/(olive)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', + '/(c)riteria$/i' => '\1riterion', '/([ti])a$/i' => '\1um', '/(p)eople$/i' => '\1\2erson', '/(m)en$/i' => '\1an', @@ -183,17 +201,27 @@ class Inflector '.*pox', '.*sheep', '.*ss', + 'data', + 'police', + 'pants', + 'clothes', ), 'irregular' => array( - 'criteria' => 'criterion', - 'curves' => 'curve', - 'emphases' => 'emphasis', - 'foes' => 'foe', - 'hoaxes' => 'hoax', - 'media' => 'medium', - 'neuroses' => 'neurosis', - 'waves' => 'wave', - 'oases' => 'oasis', + 'abuses' => 'abuse', + 'avalanches' => 'avalanche', + 'caches' => 'cache', + 'criteria' => 'criterion', + 'curves' => 'curve', + 'emphases' => 'emphasis', + 'foes' => 'foe', + 'geese' => 'goose', + 'graves' => 'grave', + 'hoaxes' => 'hoax', + 'media' => 'medium', + 'neuroses' => 'neurosis', + 'waves' => 'wave', + 'oases' => 'oasis', + 'valves' => 'valve', ) ); @@ -203,18 +231,18 @@ class Inflector * @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', 'staff', 'swine', - 'testes', 'trousers', 'trout', 'tuna', 'Vermontese', 'Wenchowese', 'whiting', - 'wildebeest', 'Yengeese' + '.*?media', 'Amoyese', 'audio', 'bison', 'Borghese', 'bream', 'breeches', + 'britches', 'buffalo', 'cantus', 'carp', 'chassis', 'clippers', 'cod', 'coitus', 'compensation', 'Congoese', + 'contretemps', 'coreopsis', 'corps', 'data', 'debris', 'deer', 'diabetes', 'djinn', 'education', 'eland', + 'elk', 'emoji', 'equipment', 'evidence', 'Faroese', 'feedback', 'fish', 'flounder', 'Foochowese', + 'Furniture', 'furniture', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'gold', + 'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings', 'jackanapes', 'jedi', + 'Kiplingese', 'knowledge', 'Kongoese', 'love', 'Lucchese', 'Luggage', 'mackerel', 'Maltese', 'metadata', + 'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese', 'nutrition', 'offspring', + 'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'plankton', 'pliers', 'pokemon', 'police', 'Portuguese', + 'proceedings', 'rabies', 'rain', 'rhinoceros', 'rice', 'salmon', 'Sarawakese', 'scissors', 'sea[- ]bass', + 'series', 'Shavese', 'shears', 'sheep', 'siemens', 'species', 'staff', 'swine', 'traffic', + 'trousers', 'trout', 'tuna', 'us', 'Vermontese', 'Wenchowese', 'wheat', 'whiting', 'wildebeest', 'Yengeese' ); /** @@ -233,36 +261,24 @@ class Inflector /** * Converts a word into the format for a Doctrine table name. Converts 'ModelName' to 'model_name'. - * - * @param string $word The word to tableize. - * - * @return string The tableized word. */ - public static function tableize($word) + public static function tableize(string $word) : string { return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $word)); } /** * Converts a word into the format for a Doctrine class name. Converts 'table_name' to 'TableName'. - * - * @param string $word The word to classify. - * - * @return string The classified word. */ - public static function classify($word) + public static function classify(string $word) : string { - return str_replace(" ", "", ucwords(strtr($word, "_-", " "))); + return str_replace([' ', '_', '-'], '', ucwords($word, ' _-')); } /** * Camelizes a word. This uses the classify() method and turns the first character to lowercase. - * - * @param string $word The word to camelize. - * - * @return string The camelized word. */ - public static function camelize($word) + public static function camelize(string $word) : string { return lcfirst(self::classify($word)); } @@ -271,7 +287,7 @@ public static function camelize($word) * Uppercases words with configurable delimeters between words. * * Takes a string and capitalizes all of the words, like PHP's built-in - * ucwords function. This extends that behavior, however, by allowing the + * ucwords function. This extends that behavior, however, by allowing the * word delimeters to be configured, rather than only separating on * whitespace. * @@ -292,24 +308,16 @@ public static function camelize($word) * * @return string The string with all delimeter-separated words capitalized. */ - public static function ucwords($string, $delimiters = " \n\t\r\0\x0B-") + public static function ucwords(string $string, string $delimiters = " \n\t\r\0\x0B-") : string { - return preg_replace_callback( - '/[^' . preg_quote($delimiters, '/') . ']+/', - function($matches) { - return ucfirst($matches[0]); - }, - $string - ); + return ucwords($string, $delimiters); } /** * Clears Inflectors inflected value caches, and resets the inflection * rules to the initial values. - * - * @return void */ - public static function reset() + public static function reset() : void { if (empty(self::$initialState)) { self::$initialState = get_class_vars('Inflector'); @@ -318,7 +326,7 @@ public static function reset() } foreach (self::$initialState as $key => $val) { - if ($key != 'initialState') { + if ($key !== 'initialState') { self::${$key} = $val; } } @@ -338,14 +346,14 @@ public static function reset() * )); * }}} * - * @param string $type The type of inflection, either 'plural' or 'singular' - * @param array $rules An 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. + * @param string $type The type of inflection, either 'plural' or 'singular' + * @param array|iterable $rules An 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) + public static function rules(string $type, iterable $rules, bool $reset = false) : void { foreach ($rules as $rule => $pattern) { if ( ! is_array($pattern)) { @@ -383,7 +391,7 @@ public static function rules($type, $rules, $reset = false) * * @return string The word in plural form. */ - public static function pluralize($word) + public static function pluralize(string $word) : string { if (isset(self::$cache['pluralize'][$word])) { return self::$cache['pluralize'][$word]; @@ -403,8 +411,8 @@ public static function pluralize($word) } 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); - + self::$cache['pluralize'][$word] = $regs[1] . $word[0] . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1); + return self::$cache['pluralize'][$word]; } @@ -430,7 +438,7 @@ public static function pluralize($word) * * @return string The word in singular form. */ - public static function singularize($word) + public static function singularize(string $word) : string { if (isset(self::$cache['singularize'][$word])) { return self::$cache['singularize'][$word]; @@ -451,13 +459,13 @@ public static function singularize($word) } 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'])) . ')'; + self::$singular['cacheUninflected'] = '(?:' . implode('|', self::$singular['merged']['uninflected']) . ')'; + self::$singular['cacheIrregular'] = '(?:' . implode('|', 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); - + self::$cache['singularize'][$word] = $regs[1] . $word[0] . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1); + return self::$cache['singularize'][$word]; } diff --git a/application/vendor/doctrine/inflector/phpunit.xml.dist b/application/vendor/doctrine/inflector/phpunit.xml.dist deleted file mode 100644 index ef07faa..0000000 --- a/application/vendor/doctrine/inflector/phpunit.xml.dist +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - ./tests/Doctrine/ - - - - - - ./lib/Doctrine/ - - - - - - performance - - - diff --git a/application/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php b/application/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php deleted file mode 100644 index 4198d22..0000000 --- a/application/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php +++ /dev/null @@ -1,309 +0,0 @@ -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'); - } - - /** - * Test basic ucwords functionality. - * - * @return void - */ - public function testUcwords() - { - $this->assertSame('Top-O-The-Morning To All_of_you!', Inflector::ucwords( 'top-o-the-morning to all_of_you!')); - } - - /** - * Test ucwords functionality with custom delimeters. - * - * @return void - */ - public function testUcwordsWithCustomDelimeters() - { - $this->assertSame('Top-O-The-Morning To All_Of_You!', Inflector::ucwords( 'top-o-the-morning to all_of_you!', '-_ ')); - } -} - diff --git a/application/vendor/doctrine/inflector/tests/Doctrine/Tests/DoctrineTestCase.php b/application/vendor/doctrine/inflector/tests/Doctrine/Tests/DoctrineTestCase.php deleted file mode 100644 index e8323d2..0000000 --- a/application/vendor/doctrine/inflector/tests/Doctrine/Tests/DoctrineTestCase.php +++ /dev/null @@ -1,10 +0,0 @@ -url = $url; - $this->html = $html; - $this->csrfToken = $csrfToken; - } - - /** - * Open up a new HTML form. - * - * @param array $options - * @return string - */ - public function open(array $options = array()) - { - $method = array_get($options, 'method', 'post'); - - // We need to extract the proper method from the attributes. If the method is - // something other than GET or POST we'll use POST since we will spoof the - // actual method since forms don't support the reserved methods in HTML. - $attributes['method'] = $this->getMethod($method); - - $attributes['action'] = $this->getAction($options); - - $attributes['accept-charset'] = 'UTF-8'; - - // If the method is PUT, PATCH or DELETE we will need to add a spoofer hidden - // field that will instruct the Symfony request to pretend the method is a - // different method than it actually is, for convenience from the forms. - $append = $this->getAppendage($method); - - if (isset($options['files']) && $options['files']) - { - $options['enctype'] = 'multipart/form-data'; - } - - // Finally we're ready to create the final form HTML field. We will attribute - // format the array of attributes. We will also add on the appendage which - // is used to spoof requests for this PUT, PATCH, etc. methods on forms. - $attributes = array_merge( - - $attributes, array_except($options, $this->reserved) - - ); - - // Finally, we will concatenate all of the attributes into a single string so - // we can build out the final form open statement. We'll also append on an - // extra value for the hidden _method field if it's needed for the form. - $attributes = $this->html->attributes($attributes); - - return ''.$append; - } - - /** - * Create a new model based form builder. - * - * @param mixed $model - * @param array $options - * @return string - */ - public function model($model, array $options = array()) - { - $this->model = $model; - - return $this->open($options); - } - - /** - * Set the model instance on the form builder. - * - * @param mixed $model - * @return void - */ - public function setModel($model) - { - $this->model = $model; - } - - /** - * Close the current form. - * - * @return string - */ - public function close() - { - $this->labels = array(); - - $this->model = null; - - return ''; - } - - /** - * Generate a hidden field with the current CSRF token. - * - * @return string - */ - public function token() - { - $token = ! empty($this->csrfToken) ? $this->csrfToken : $this->session->getToken(); - - return $this->hidden('_token', $token); - } - - /** - * Create a form label element. - * - * @param string $name - * @param string $value - * @param array $options - * @return string - */ - public function label($name, $value = null, $options = array()) - { - $this->labels[] = $name; - - $options = $this->html->attributes($options); - - $value = e($this->formatLabel($name, $value)); - - return ''; - } - - /** - * Format the label value. - * - * @param string $name - * @param string|null $value - * @return string - */ - protected function formatLabel($name, $value) - { - return $value ?: ucwords(str_replace('_', ' ', $name)); - } - - /** - * Create a form input field. - * - * @param string $type - * @param string $name - * @param string $value - * @param array $options - * @return string - */ - public function input($type, $name, $value = null, $options = array()) - { - if ( ! isset($options['name'])) $options['name'] = $name; - - // We will get the appropriate value for the given field. We will look for the - // value in the session for the value in the old input data then we'll look - // in the model instance if one is set. Otherwise we will just use empty. - $id = $this->getIdAttribute($name, $options); - - if ( ! in_array($type, $this->skipValueTypes)) - { - $value = $this->getValueAttribute($name, $value); - } - - // Once we have the type, value, and ID we can merge them into the rest of the - // attributes array so we can convert them into their HTML attribute format - // when creating the HTML element. Then, we will return the entire input. - $merge = compact('type', 'value', 'id'); - - $options = array_merge($options, $merge); - - return 'html->attributes($options).'>'; - } - - /** - * Create a text input field. - * - * @param string $name - * @param string $value - * @param array $options - * @return string - */ - public function text($name, $value = null, $options = array()) - { - return $this->input('text', $name, $value, $options); - } - - /** - * Create a password input field. - * - * @param string $name - * @param array $options - * @return string - */ - public function password($name, $options = array()) - { - return $this->input('password', $name, '', $options); - } - - /** - * Create a hidden input field. - * - * @param string $name - * @param string $value - * @param array $options - * @return string - */ - public function hidden($name, $value = null, $options = array()) - { - return $this->input('hidden', $name, $value, $options); - } - - /** - * Create an e-mail input field. - * - * @param string $name - * @param string $value - * @param array $options - * @return string - */ - public function email($name, $value = null, $options = array()) - { - return $this->input('email', $name, $value, $options); - } - - /** - * Create a url input field. - * - * @param string $name - * @param string $value - * @param array $options - * @return string - */ - public function url($name, $value = null, $options = array()) - { - return $this->input('url', $name, $value, $options); - } - - /** - * Create a file input field. - * - * @param string $name - * @param array $options - * @return string - */ - public function file($name, $options = array()) - { - return $this->input('file', $name, null, $options); - } - - /** - * Create a textarea input field. - * - * @param string $name - * @param string $value - * @param array $options - * @return string - */ - public function textarea($name, $value = null, $options = array()) - { - if ( ! isset($options['name'])) $options['name'] = $name; - - // Next we will look for the rows and cols attributes, as each of these are put - // on the textarea element definition. If they are not present, we will just - // assume some sane default values for these attributes for the developer. - $options = $this->setTextAreaSize($options); - - $options['id'] = $this->getIdAttribute($name, $options); - - $value = (string) $this->getValueAttribute($name, $value); - - unset($options['size']); - - // Next we will convert the attributes into a string form. Also we have removed - // the size attribute, as it was merely a short-cut for the rows and cols on - // the element. Then we'll create the final textarea elements HTML for us. - $options = $this->html->attributes($options); - - return ''.e($value).''; - } - - /** - * Set the text area size on the attributes. - * - * @param array $options - * @return array - */ - protected function setTextAreaSize($options) - { - if (isset($options['size'])) - { - return $this->setQuickTextAreaSize($options); - } - - // If the "size" attribute was not specified, we will just look for the regular - // columns and rows attributes, using sane defaults if these do not exist on - // the attributes array. We'll then return this entire options array back. - $cols = array_get($options, 'cols', 50); - - $rows = array_get($options, 'rows', 10); - - return array_merge($options, compact('cols', 'rows')); - } - - /** - * Set the text area size using the quick "size" attribute. - * - * @param array $options - * @return array - */ - protected function setQuickTextAreaSize($options) - { - $segments = explode('x', $options['size']); - - return array_merge($options, array('cols' => $segments[0], 'rows' => $segments[1])); - } - - /** - * Create a select box field. - * - * @param string $name - * @param array $list - * @param string $selected - * @param array $options - * @return string - */ - public function select($name, $list = array(), $selected = null, $options = array()) - { - // When building a select box the "value" attribute is really the selected one - // so we will use that when checking the model or session for a value which - // should provide a convenient method of re-populating the forms on post. - $selected = $this->getValueAttribute($name, $selected); - - $options['id'] = $this->getIdAttribute($name, $options); - - if ( ! isset($options['name'])) $options['name'] = $name; - - // We will simply loop through the options and build an HTML value for each of - // them until we have an array of HTML declarations. Then we will join them - // all together into one single HTML element that can be put on the form. - $html = array(); - - foreach ($list as $value => $display) - { - $html[] = $this->getSelectOption($display, $value, $selected); - } - - // Once we have all of this HTML, we can join this into a single element after - // formatting the attributes into an HTML "attributes" string, then we will - // build out a final select statement, which will contain all the values. - $options = $this->html->attributes($options); - - $list = implode('', $html); - - return "{$list}"; - } - - /** - * Create a select range field. - * - * @param string $name - * @param string $begin - * @param string $end - * @param string $selected - * @param array $options - * @return string - */ - public function selectRange($name, $begin, $end, $selected = null, $options = array()) - { - $range = array_combine($range = range($begin, $end), $range); - - return $this->select($name, $range, $selected, $options); - } - - /** - * Create a select year field. - * - * @param string $name - * @param string $begin - * @param string $end - * @param string $selected - * @param array $options - * @return string - */ - public function selectYear() - { - return call_user_func_array(array($this, 'selectRange'), func_get_args()); - } - - /** - * Create a select month field. - * - * @param string $name - * @param string $selected - * @param array $options - * @param string $format - * @return string - */ - public function selectMonth($name, $selected = null, $options = array(), $format = '%B') - { - $months = array(); - - foreach (range(1, 12) as $month) - { - $months[$month] = strftime($format, mktime(0, 0, 0, $month, 1)); - } - - return $this->select($name, $months, $selected, $options); - } - - /** - * Get the select option for the given value. - * - * @param string $display - * @param string $value - * @param string $selected - * @return string - */ - public function getSelectOption($display, $value, $selected) - { - if (is_array($display)) - { - return $this->optionGroup($display, $value, $selected); - } - - return $this->option($display, $value, $selected); - } - - /** - * Create an option group form element. - * - * @param array $list - * @param string $label - * @param string $selected - * @return string - */ - protected function optionGroup($list, $label, $selected) - { - $html = array(); - - foreach ($list as $value => $display) - { - $html[] = $this->option($display, $value, $selected); - } - - return ''.implode('', $html).''; - } - - /** - * Create a select element option. - * - * @param string $display - * @param string $value - * @param string $selected - * @return string - */ - protected function option($display, $value, $selected) - { - $selected = $this->getSelectedValue($value, $selected); - - $options = array('value' => e($value), 'selected' => $selected); - - return 'html->attributes($options).'>'.e($display).''; - } - - /** - * Determine if the value is selected. - * - * @param string $value - * @param string $selected - * @return string - */ - protected function getSelectedValue($value, $selected) - { - if (is_array($selected)) - { - return in_array($value, $selected) ? 'selected' : null; - } - - return ((string) $value == (string) $selected) ? 'selected' : null; - } - - /** - * Create a checkbox input field. - * - * @param string $name - * @param mixed $value - * @param bool $checked - * @param array $options - * @return string - */ - public function checkbox($name, $value = 1, $checked = null, $options = array()) - { - return $this->checkable('checkbox', $name, $value, $checked, $options); - } - - /** - * Create a radio button input field. - * - * @param string $name - * @param mixed $value - * @param bool $checked - * @param array $options - * @return string - */ - public function radio($name, $value = null, $checked = null, $options = array()) - { - if (is_null($value)) $value = $name; - - return $this->checkable('radio', $name, $value, $checked, $options); - } - - /** - * Create a checkable input field. - * - * @param string $type - * @param string $name - * @param mixed $value - * @param bool $checked - * @param array $options - * @return string - */ - protected function checkable($type, $name, $value, $checked, $options) - { - $checked = $this->getCheckedState($type, $name, $value, $checked); - - if ($checked) $options['checked'] = 'checked'; - - return $this->input($type, $name, $value, $options); - } - - /** - * Get the check state for a checkable input. - * - * @param string $type - * @param string $name - * @param mixed $value - * @param bool $checked - * @return bool - */ - protected function getCheckedState($type, $name, $value, $checked) - { - switch ($type) - { - case 'checkbox': - return $this->getCheckboxCheckedState($name, $value, $checked); - - case 'radio': - return $this->getRadioCheckedState($name, $value, $checked); - - default: - return $this->getValueAttribute($name) == $value; - } - } - - /** - * Get the check state for a checkbox input. - * - * @param string $name - * @param mixed $value - * @param bool $checked - * @return bool - */ - protected function getCheckboxCheckedState($name, $value, $checked) - { - if (isset($this->session) && ! $this->oldInputIsEmpty() && is_null($this->old($name))) return false; - - if ($this->missingOldAndModel($name)) return $checked; - - $posted = $this->getValueAttribute($name); - - return is_array($posted) ? in_array($value, $posted) : (bool) $posted; - } - - /** - * Get the check state for a radio input. - * - * @param string $name - * @param mixed $value - * @param bool $checked - * @return bool - */ - protected function getRadioCheckedState($name, $value, $checked) - { - if ($this->missingOldAndModel($name)) return $checked; - - return $this->getValueAttribute($name) == $value; - } - - /** - * Determine if old input or model input exists for a key. - * - * @param string $name - * @return bool - */ - protected function missingOldAndModel($name) - { - return (is_null($this->old($name)) && is_null($this->getModelValueAttribute($name))); - } - - /** - * Create a HTML reset input element. - * - * @param string $value - * @param array $attributes - * @return string - */ - public function reset($value, $attributes = array()) - { - return $this->input('reset', null, $value, $attributes); - } - - /** - * Create a HTML image input element. - * - * @param string $url - * @param string $name - * @param array $attributes - * @return string - */ - public function image($url, $name = null, $attributes = array()) - { - $attributes['src'] = $this->url->asset($url); - - return $this->input('image', $name, null, $attributes); - } - - /** - * Create a submit button element. - * - * @param string $value - * @param array $options - * @return string - */ - public function submit($value = null, $options = array()) - { - return $this->input('submit', null, $value, $options); - } - - /** - * Create a button element. - * - * @param string $value - * @param array $options - * @return string - */ - public function button($value = null, $options = array()) - { - if ( ! array_key_exists('type', $options)) - { - $options['type'] = 'button'; - } - - return 'html->attributes($options).'>'.$value.''; - } - - /** - * Parse the form action method. - * - * @param string $method - * @return string - */ - protected function getMethod($method) - { - $method = strtoupper($method); - - return $method != 'GET' ? 'POST' : $method; - } - - /** - * Get the form action from the options. - * - * @param array $options - * @return string - */ - protected function getAction(array $options) - { - // We will also check for a "route" or "action" parameter on the array so that - // developers can easily specify a route or controller action when creating - // a form providing a convenient interface for creating the form actions. - if (isset($options['url'])) - { - return $this->getUrlAction($options['url']); - } - - if (isset($options['route'])) - { - return $this->getRouteAction($options['route']); - } - - // If an action is available, we are attempting to open a form to a controller - // action route. So, we will use the URL generator to get the path to these - // actions and return them from the method. Otherwise, we'll use current. - elseif (isset($options['action'])) - { - return $this->getControllerAction($options['action']); - } - - return $this->url->current(); - } - - /** - * Get the action for a "url" option. - * - * @param array|string $options - * @return string - */ - protected function getUrlAction($options) - { - if (is_array($options)) - { - return $this->url->to($options[0], array_slice($options, 1)); - } - - return $this->url->to($options); - } - - /** - * Get the action for a "route" option. - * - * @param array|string $options - * @return string - */ - protected function getRouteAction($options) - { - if (is_array($options)) - { - return $this->url->route($options[0], array_slice($options, 1)); - } - - return $this->url->route($options); - } - - /** - * Get the action for an "action" option. - * - * @param array|string $options - * @return string - */ - protected function getControllerAction($options) - { - if (is_array($options)) - { - return $this->url->action($options[0], array_slice($options, 1)); - } - - return $this->url->action($options); - } - - /** - * Get the form appendage for the given method. - * - * @param string $method - * @return string - */ - protected function getAppendage($method) - { - list($method, $appendage) = array(strtoupper($method), ''); - - // If the HTTP method is in this list of spoofed methods, we will attach the - // method spoofer hidden input to the form. This allows us to use regular - // form to initiate PUT and DELETE requests in addition to the typical. - if (in_array($method, $this->spoofedMethods)) - { - $appendage .= $this->hidden('_method', $method); - } - - // If the method is something other than GET we will go ahead and attach the - // CSRF token to the form, as this can't hurt and is convenient to simply - // always have available on every form the developers creates for them. - if ($method != 'GET') - { - $appendage .= $this->token(); - } - - return $appendage; - } - - /** - * Get the ID attribute for a field name. - * - * @param string $name - * @param array $attributes - * @return string - */ - public function getIdAttribute($name, $attributes) - { - if (array_key_exists('id', $attributes)) - { - return $attributes['id']; - } - - if (in_array($name, $this->labels)) - { - return $name; - } - } - - /** - * Get the value that should be assigned to the field. - * - * @param string $name - * @param string $value - * @return string - */ - public function getValueAttribute($name, $value = null) - { - if (is_null($name)) return $value; - - if ( ! is_null($this->old($name))) - { - return $this->old($name); - } - - if ( ! is_null($value)) return $value; - - if (isset($this->model)) - { - return $this->getModelValueAttribute($name); - } - } - - /** - * Get the model value that should be assigned to the field. - * - * @param string $name - * @return string - */ - protected function getModelValueAttribute($name) - { - if (is_object($this->model)) - { - return object_get($this->model, $this->transformKey($name)); - } - elseif (is_array($this->model)) - { - return array_get($this->model, $this->transformKey($name)); - } - } - - /** - * Get a value from the session's old input. - * - * @param string $name - * @return string - */ - public function old($name) - { - if (isset($this->session)) - { - return $this->session->getOldInput($this->transformKey($name)); - } - } - - /** - * Determine if the old input is empty. - * - * @return bool - */ - public function oldInputIsEmpty() - { - return (isset($this->session) && count($this->session->getOldInput()) == 0); - } - - /** - * Transform key from array to dot syntax. - * - * @param string $key - * @return string - */ - protected function transformKey($key) - { - return str_replace(array('.', '[]', '[', ']'), array('_', '', '.', ''), $key); - } - - /** - * Get the session store implementation. - * - * @return \Illuminate\Session\Store $session - */ - public function getSessionStore() - { - return $this->session; - } - - /** - * Set the session store implementation. - * - * @param \Illuminate\Session\Store $session - * @return $this - */ - public function setSessionStore(Session $session) - { - $this->session = $session; - - return $this; - } - -} diff --git a/application/vendor/illuminate/html/FormFacade.php b/application/vendor/illuminate/html/FormFacade.php deleted file mode 100644 index 4ddc0d7..0000000 --- a/application/vendor/illuminate/html/FormFacade.php +++ /dev/null @@ -1,17 +0,0 @@ -url = $url; - } - - /** - * Convert an HTML string to entities. - * - * @param string $value - * @return string - */ - public function entities($value) - { - return htmlentities($value, ENT_QUOTES, 'UTF-8', false); - } - - /** - * Convert entities to HTML characters. - * - * @param string $value - * @return string - */ - public function decode($value) - { - return html_entity_decode($value, ENT_QUOTES, 'UTF-8'); - } - - /** - * Generate a link to a JavaScript file. - * - * @param string $url - * @param array $attributes - * @param bool $secure - * @return string - */ - public function script($url, $attributes = array(), $secure = null) - { - $attributes['src'] = $this->url->asset($url, $secure); - - return 'attributes($attributes).'>'.PHP_EOL; - } - - /** - * Generate a link to a CSS file. - * - * @param string $url - * @param array $attributes - * @param bool $secure - * @return string - */ - public function style($url, $attributes = array(), $secure = null) - { - $defaults = array('media' => 'all', 'type' => 'text/css', 'rel' => 'stylesheet'); - - $attributes = $attributes + $defaults; - - $attributes['href'] = $this->url->asset($url, $secure); - - return 'attributes($attributes).'>'.PHP_EOL; - } - - /** - * Generate an HTML image element. - * - * @param string $url - * @param string $alt - * @param array $attributes - * @param bool $secure - * @return string - */ - public function image($url, $alt = null, $attributes = array(), $secure = null) - { - $attributes['alt'] = $alt; - - return 'attributes($attributes).'>'; - } - - /** - * Generate a HTML link. - * - * @param string $url - * @param string $title - * @param array $attributes - * @param bool $secure - * @return string - */ - public function link($url, $title = null, $attributes = array(), $secure = null) - { - $url = $this->url->to($url, array(), $secure); - - if (is_null($title) || $title === false) $title = $url; - - return 'attributes($attributes).'>'.$this->entities($title).''; - } - - /** - * Generate a HTTPS HTML link. - * - * @param string $url - * @param string $title - * @param array $attributes - * @return string - */ - public function secureLink($url, $title = null, $attributes = array()) - { - return $this->link($url, $title, $attributes, true); - } - - /** - * Generate a HTML link to an asset. - * - * @param string $url - * @param string $title - * @param array $attributes - * @param bool $secure - * @return string - */ - public function linkAsset($url, $title = null, $attributes = array(), $secure = null) - { - $url = $this->url->asset($url, $secure); - - return $this->link($url, $title ?: $url, $attributes, $secure); - } - - /** - * Generate a HTTPS HTML link to an asset. - * - * @param string $url - * @param string $title - * @param array $attributes - * @return string - */ - public function linkSecureAsset($url, $title = null, $attributes = array()) - { - return $this->linkAsset($url, $title, $attributes, true); - } - - /** - * Generate a HTML link to a named route. - * - * @param string $name - * @param string $title - * @param array $parameters - * @param array $attributes - * @return string - */ - public function linkRoute($name, $title = null, $parameters = array(), $attributes = array()) - { - return $this->link($this->url->route($name, $parameters), $title, $attributes); - } - - /** - * Generate a HTML link to a controller action. - * - * @param string $action - * @param string $title - * @param array $parameters - * @param array $attributes - * @return string - */ - public function linkAction($action, $title = null, $parameters = array(), $attributes = array()) - { - return $this->link($this->url->action($action, $parameters), $title, $attributes); - } - - /** - * Generate a HTML link to an email address. - * - * @param string $email - * @param string $title - * @param array $attributes - * @return string - */ - public function mailto($email, $title = null, $attributes = array()) - { - $email = $this->email($email); - - $title = $title ?: $email; - - $email = $this->obfuscate('mailto:') . $email; - - return 'attributes($attributes).'>'.$this->entities($title).''; - } - - /** - * Obfuscate an e-mail address to prevent spam-bots from sniffing it. - * - * @param string $email - * @return string - */ - public function email($email) - { - return str_replace('@', '@', $this->obfuscate($email)); - } - - /** - * Generate an ordered list of items. - * - * @param array $list - * @param array $attributes - * @return string - */ - public function ol($list, $attributes = array()) - { - return $this->listing('ol', $list, $attributes); - } - - /** - * Generate an un-ordered list of items. - * - * @param array $list - * @param array $attributes - * @return string - */ - public function ul($list, $attributes = array()) - { - return $this->listing('ul', $list, $attributes); - } - - /** - * Create a listing HTML element. - * - * @param string $type - * @param array $list - * @param array $attributes - * @return string - */ - protected function listing($type, $list, $attributes = array()) - { - $html = ''; - - if (count($list) == 0) return $html; - - // Essentially we will just spin through the list and build the list of the HTML - // elements from the array. We will also handled nested lists in case that is - // present in the array. Then we will build out the final listing elements. - foreach ($list as $key => $value) - { - $html .= $this->listingElement($key, $type, $value); - } - - $attributes = $this->attributes($attributes); - - return "<{$type}{$attributes}>{$html}"; - } - - /** - * Create the HTML for a listing element. - * - * @param mixed $key - * @param string $type - * @param string $value - * @return string - */ - protected function listingElement($key, $type, $value) - { - if (is_array($value)) - { - return $this->nestedListing($key, $type, $value); - } - else - { - return '
  • '.e($value).'
  • '; - } - } - - /** - * Create the HTML for a nested listing attribute. - * - * @param mixed $key - * @param string $type - * @param string $value - * @return string - */ - protected function nestedListing($key, $type, $value) - { - if (is_int($key)) - { - return $this->listing($type, $value); - } - else - { - return '
  • '.$key.$this->listing($type, $value).'
  • '; - } - } - - /** - * Build an HTML attribute string from an array. - * - * @param array $attributes - * @return string - */ - public function attributes($attributes) - { - $html = array(); - - // For numeric keys we will assume that the key and the value are the same - // as this will convert HTML attributes such as "required" to a correct - // form like required="required" instead of using incorrect numerics. - foreach ((array) $attributes as $key => $value) - { - $element = $this->attributeElement($key, $value); - - if ( ! is_null($element)) $html[] = $element; - } - - return count($html) > 0 ? ' '.implode(' ', $html) : ''; - } - - /** - * Build a single attribute element. - * - * @param string $key - * @param string $value - * @return string - */ - protected function attributeElement($key, $value) - { - if (is_numeric($key)) $key = $value; - - if ( ! is_null($value)) return $key.'="'.e($value).'"'; - } - - /** - * Obfuscate a string to prevent spam-bots from sniffing it. - * - * @param string $value - * @return string - */ - public function obfuscate($value) - { - $safe = ''; - - foreach (str_split($value) as $letter) - { - if (ord($letter) > 128) return $letter; - - // To properly obfuscate the value, we will randomly convert each letter to - // its entity or hexadecimal representation, keeping a bot from sniffing - // the randomly obfuscated letters out of the string on the responses. - switch (rand(1, 3)) - { - case 1: - $safe .= '&#'.ord($letter).';'; break; - - case 2: - $safe .= '&#x'.dechex(ord($letter)).';'; break; - - case 3: - $safe .= $letter; - } - } - - return $safe; - } - -} diff --git a/application/vendor/illuminate/html/HtmlFacade.php b/application/vendor/illuminate/html/HtmlFacade.php deleted file mode 100644 index a2dc8e1..0000000 --- a/application/vendor/illuminate/html/HtmlFacade.php +++ /dev/null @@ -1,17 +0,0 @@ -registerHtmlBuilder(); - - $this->registerFormBuilder(); - - $this->app->alias('html', 'Illuminate\Html\HtmlBuilder'); - $this->app->alias('form', 'Illuminate\Html\FormBuilder'); - } - - /** - * Register the HTML builder instance. - * - * @return void - */ - protected function registerHtmlBuilder() - { - $this->app->bindShared('html', function($app) - { - return new HtmlBuilder($app['url']); - }); - } - - /** - * Register the form builder instance. - * - * @return void - */ - protected function registerFormBuilder() - { - $this->app->bindShared('form', function($app) - { - $form = new FormBuilder($app['html'], $app['url'], $app['session.store']->getToken()); - - return $form->setSessionStore($app['session.store']); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array('html', 'form'); - } - -} diff --git a/application/vendor/illuminate/html/composer.json b/application/vendor/illuminate/html/composer.json deleted file mode 100644 index d26646b..0000000 --- a/application/vendor/illuminate/html/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "illuminate/html", - "license": "MIT", - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylorotwell@gmail.com" - } - ], - "require": { - "php": ">=5.4.0", - "illuminate/http": "~5.0", - "illuminate/session": "~5.0", - "illuminate/support": "~5.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Html\\": "" - }, - "files": [ - "helpers.php" - ] - }, - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "minimum-stability": "dev" -} diff --git a/application/vendor/illuminate/html/helpers.php b/application/vendor/illuminate/html/helpers.php deleted file mode 100644 index fa5bef6..0000000 --- a/application/vendor/illuminate/html/helpers.php +++ /dev/null @@ -1,69 +0,0 @@ -link($url, $title, $attributes, $secure); - } -} - -if ( ! function_exists('link_to_asset')) -{ - /** - * Generate a HTML link to an asset. - * - * @param string $url - * @param string $title - * @param array $attributes - * @param bool $secure - * @return string - */ - function link_to_asset($url, $title = null, $attributes = array(), $secure = null) - { - return app('html')->linkAsset($url, $title, $attributes, $secure); - } -} - -if ( ! function_exists('link_to_route')) -{ - /** - * Generate a HTML link to a named route. - * - * @param string $name - * @param string $title - * @param array $parameters - * @param array $attributes - * @return string - */ - function link_to_route($name, $title = null, $parameters = array(), $attributes = array()) - { - return app('html')->linkRoute($name, $title, $parameters, $attributes); - } -} - -if ( ! function_exists('link_to_action')) -{ - /** - * Generate a HTML link to a controller action. - * - * @param string $action - * @param string $title - * @param array $parameters - * @param array $attributes - * @return string - */ - function link_to_action($action, $title = null, $parameters = array(), $attributes = array()) - { - return app('html')->linkAction($action, $title, $parameters, $attributes); - } -} diff --git a/application/vendor/ircmaxell/password-compat/LICENSE.md b/application/vendor/ircmaxell/password-compat/LICENSE.md deleted file mode 100644 index 1efc565..0000000 --- a/application/vendor/ircmaxell/password-compat/LICENSE.md +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2012 Anthony Ferrara - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/application/vendor/ircmaxell/password-compat/composer.json b/application/vendor/ircmaxell/password-compat/composer.json deleted file mode 100644 index 822fd1f..0000000 --- a/application/vendor/ircmaxell/password-compat/composer.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "ircmaxell/password-compat", - "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", - "keywords": ["password", "hashing"], - "homepage": "https://github.com/ircmaxell/password_compat", - "license": "MIT", - "authors": [ - { - "name": "Anthony Ferrara", - "email": "ircmaxell@php.net", - "homepage": "http://blog.ircmaxell.com" - } - ], - "require-dev": { - "phpunit/phpunit": "4.*" - }, - "autoload": { - "files": ["lib/password.php"] - } -} diff --git a/application/vendor/ircmaxell/password-compat/lib/password.php b/application/vendor/ircmaxell/password-compat/lib/password.php deleted file mode 100644 index cc6896c..0000000 --- a/application/vendor/ircmaxell/password-compat/lib/password.php +++ /dev/null @@ -1,314 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2012 The Authors - */ - -namespace { - - if (!defined('PASSWORD_BCRYPT')) { - /** - * PHPUnit Process isolation caches constants, but not function declarations. - * So we need to check if the constants are defined separately from - * the functions to enable supporting process isolation in userland - * code. - */ - define('PASSWORD_BCRYPT', 1); - define('PASSWORD_DEFAULT', PASSWORD_BCRYPT); - define('PASSWORD_BCRYPT_DEFAULT_COST', 10); - } - - if (!function_exists('password_hash')) { - - /** - * Hash the password using the specified algorithm - * - * @param string $password The password to hash - * @param int $algo The algorithm to use (Defined by PASSWORD_* constants) - * @param array $options The options for the algorithm to use - * - * @return string|false The hashed password, or false on error. - */ - function password_hash($password, $algo, array $options = array()) { - if (!function_exists('crypt')) { - trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING); - return null; - } - if (is_null($password) || is_int($password)) { - $password = (string) $password; - } - if (!is_string($password)) { - trigger_error("password_hash(): Password must be a string", E_USER_WARNING); - return null; - } - if (!is_int($algo)) { - trigger_error("password_hash() expects parameter 2 to be long, " . gettype($algo) . " given", E_USER_WARNING); - return null; - } - $resultLength = 0; - switch ($algo) { - case PASSWORD_BCRYPT: - $cost = PASSWORD_BCRYPT_DEFAULT_COST; - if (isset($options['cost'])) { - $cost = $options['cost']; - if ($cost < 4 || $cost > 31) { - trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING); - return null; - } - } - // The length of salt to generate - $raw_salt_len = 16; - // The length required in the final serialization - $required_salt_len = 22; - $hash_format = sprintf("$2y$%02d$", $cost); - // The expected length of the final crypt() output - $resultLength = 60; - break; - default: - trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING); - return null; - } - $salt_requires_encoding = false; - if (isset($options['salt'])) { - switch (gettype($options['salt'])) { - case 'NULL': - case 'boolean': - case 'integer': - case 'double': - case 'string': - $salt = (string) $options['salt']; - break; - case 'object': - if (method_exists($options['salt'], '__tostring')) { - $salt = (string) $options['salt']; - break; - } - case 'array': - case 'resource': - default: - trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING); - return null; - } - if (PasswordCompat\binary\_strlen($salt) < $required_salt_len) { - trigger_error(sprintf("password_hash(): Provided salt is too short: %d expecting %d", PasswordCompat\binary\_strlen($salt), $required_salt_len), E_USER_WARNING); - return null; - } elseif (0 == preg_match('#^[a-zA-Z0-9./]+$#D', $salt)) { - $salt_requires_encoding = true; - } - } else { - $buffer = ''; - $buffer_valid = false; - if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) { - $buffer = mcrypt_create_iv($raw_salt_len, MCRYPT_DEV_URANDOM); - if ($buffer) { - $buffer_valid = true; - } - } - if (!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) { - $buffer = openssl_random_pseudo_bytes($raw_salt_len); - if ($buffer) { - $buffer_valid = true; - } - } - if (!$buffer_valid && @is_readable('/dev/urandom')) { - $f = fopen('/dev/urandom', 'r'); - $read = PasswordCompat\binary\_strlen($buffer); - while ($read < $raw_salt_len) { - $buffer .= fread($f, $raw_salt_len - $read); - $read = PasswordCompat\binary\_strlen($buffer); - } - fclose($f); - if ($read >= $raw_salt_len) { - $buffer_valid = true; - } - } - if (!$buffer_valid || PasswordCompat\binary\_strlen($buffer) < $raw_salt_len) { - $bl = PasswordCompat\binary\_strlen($buffer); - for ($i = 0; $i < $raw_salt_len; $i++) { - if ($i < $bl) { - $buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255)); - } else { - $buffer .= chr(mt_rand(0, 255)); - } - } - } - $salt = $buffer; - $salt_requires_encoding = true; - } - if ($salt_requires_encoding) { - // encode string with the Base64 variant used by crypt - $base64_digits = - 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - $bcrypt64_digits = - './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; - - $base64_string = base64_encode($salt); - $salt = strtr(rtrim($base64_string, '='), $base64_digits, $bcrypt64_digits); - } - $salt = PasswordCompat\binary\_substr($salt, 0, $required_salt_len); - - $hash = $hash_format . $salt; - - $ret = crypt($password, $hash); - - if (!is_string($ret) || PasswordCompat\binary\_strlen($ret) != $resultLength) { - return false; - } - - return $ret; - } - - /** - * Get information about the password hash. Returns an array of the information - * that was used to generate the password hash. - * - * array( - * 'algo' => 1, - * 'algoName' => 'bcrypt', - * 'options' => array( - * 'cost' => PASSWORD_BCRYPT_DEFAULT_COST, - * ), - * ) - * - * @param string $hash The password hash to extract info from - * - * @return array The array of information about the hash. - */ - function password_get_info($hash) { - $return = array( - 'algo' => 0, - 'algoName' => 'unknown', - 'options' => array(), - ); - if (PasswordCompat\binary\_substr($hash, 0, 4) == '$2y$' && PasswordCompat\binary\_strlen($hash) == 60) { - $return['algo'] = PASSWORD_BCRYPT; - $return['algoName'] = 'bcrypt'; - list($cost) = sscanf($hash, "$2y$%d$"); - $return['options']['cost'] = $cost; - } - return $return; - } - - /** - * Determine if the password hash needs to be rehashed according to the options provided - * - * If the answer is true, after validating the password using password_verify, rehash it. - * - * @param string $hash The hash to test - * @param int $algo The algorithm used for new password hashes - * @param array $options The options array passed to password_hash - * - * @return boolean True if the password needs to be rehashed. - */ - function password_needs_rehash($hash, $algo, array $options = array()) { - $info = password_get_info($hash); - if ($info['algo'] != $algo) { - return true; - } - switch ($algo) { - case PASSWORD_BCRYPT: - $cost = isset($options['cost']) ? $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST; - if ($cost != $info['options']['cost']) { - return true; - } - break; - } - return false; - } - - /** - * Verify a password against a hash using a timing attack resistant approach - * - * @param string $password The password to verify - * @param string $hash The hash to verify against - * - * @return boolean If the password matches the hash - */ - function password_verify($password, $hash) { - if (!function_exists('crypt')) { - trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING); - return false; - } - $ret = crypt($password, $hash); - if (!is_string($ret) || PasswordCompat\binary\_strlen($ret) != PasswordCompat\binary\_strlen($hash) || PasswordCompat\binary\_strlen($ret) <= 13) { - return false; - } - - $status = 0; - for ($i = 0; $i < PasswordCompat\binary\_strlen($ret); $i++) { - $status |= (ord($ret[$i]) ^ ord($hash[$i])); - } - - return $status === 0; - } - } - -} - -namespace PasswordCompat\binary { - - if (!function_exists('PasswordCompat\\binary\\_strlen')) { - - /** - * Count the number of bytes in a string - * - * We cannot simply use strlen() for this, because it might be overwritten by the mbstring extension. - * In this case, strlen() will count the number of *characters* based on the internal encoding. A - * sequence of bytes might be regarded as a single multibyte character. - * - * @param string $binary_string The input string - * - * @internal - * @return int The number of bytes - */ - function _strlen($binary_string) { - if (function_exists('mb_strlen')) { - return mb_strlen($binary_string, '8bit'); - } - return strlen($binary_string); - } - - /** - * Get a substring based on byte limits - * - * @see _strlen() - * - * @param string $binary_string The input string - * @param int $start - * @param int $length - * - * @internal - * @return string The substring - */ - function _substr($binary_string, $start, $length) { - if (function_exists('mb_substr')) { - return mb_substr($binary_string, $start, $length, '8bit'); - } - return substr($binary_string, $start, $length); - } - - /** - * Check if current PHP version is compatible with the library - * - * @return boolean the check result - */ - function check() { - static $pass = NULL; - - if (is_null($pass)) { - if (function_exists('crypt')) { - $hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG'; - $test = crypt("password", $hash); - $pass = $test == $hash; - } else { - $pass = false; - } - } - return $pass; - } - - } -} \ No newline at end of file diff --git a/application/vendor/ircmaxell/password-compat/version-test.php b/application/vendor/ircmaxell/password-compat/version-test.php deleted file mode 100644 index 96f60ca..0000000 --- a/application/vendor/ircmaxell/password-compat/version-test.php +++ /dev/null @@ -1,6 +0,0 @@ -=5.3.2" + "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "3.7.*", - "jakub-onderka/php-parallel-lint": "0.*", + "phpunit/phpunit": "~4.3", + "jakub-onderka/php-parallel-lint": "1.0", "jakub-onderka/php-var-dump-check": "0.*", "squizlabs/php_codesniffer": "1.*", "jakub-onderka/php-code-style": "1.0" } -} \ No newline at end of file +} diff --git a/application/vendor/jakub-onderka/php-console-color/phpunit.xml b/application/vendor/jakub-onderka/php-console-color/phpunit.xml index 74011d9..f1105cc 100644 --- a/application/vendor/jakub-onderka/php-console-color/phpunit.xml +++ b/application/vendor/jakub-onderka/php-console-color/phpunit.xml @@ -1,8 +1,9 @@ - + - tests/* + tests @@ -12,4 +13,4 @@ vendor - \ No newline at end of file + diff --git a/application/vendor/jakub-onderka/php-console-color/src/JakubOnderka/PhpConsoleColor/ConsoleColor.php b/application/vendor/jakub-onderka/php-console-color/src/ConsoleColor.php similarity index 90% rename from application/vendor/jakub-onderka/php-console-color/src/JakubOnderka/PhpConsoleColor/ConsoleColor.php rename to application/vendor/jakub-onderka/php-console-color/src/ConsoleColor.php index c367a76..90fd125 100644 --- a/application/vendor/jakub-onderka/php-console-color/src/JakubOnderka/PhpConsoleColor/ConsoleColor.php +++ b/application/vendor/jakub-onderka/php-console-color/src/ConsoleColor.php @@ -201,10 +201,15 @@ public function removeTheme($name) public function isSupported() { if (DIRECTORY_SEPARATOR === '\\') { - return getenv('ANSICON') !== false || getenv('ConEmuANSI') === 'ON'; + if (function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(STDOUT)) { + return true; + } elseif (getenv('ANSICON') !== false || getenv('ConEmuANSI') === 'ON') { + return true; + } + return false; + } else { + return function_exists('posix_isatty') && @posix_isatty(STDOUT); } - - return function_exists('posix_isatty') && @posix_isatty(STDOUT); } /** @@ -212,7 +217,11 @@ public function isSupported() */ public function are256ColorsSupported() { - return DIRECTORY_SEPARATOR === '/' && strpos(getenv('TERM'), '256color') !== false; + if (DIRECTORY_SEPARATOR === '\\') { + return function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(STDOUT); + } else { + return strpos(getenv('TERM'), '256color') !== false; + } } /** @@ -225,8 +234,7 @@ public function getPossibleStyles() /** * @param string $name - * @return string - * @throws InvalidStyleException + * @return string[] */ private function themeSequence($name) { @@ -240,7 +248,6 @@ private function themeSequence($name) /** * @param string $style * @return string - * @throws InvalidStyleException */ private function styleSequence($style) { @@ -277,4 +284,4 @@ private function escSequence($value) { return "\033[{$value}m"; } -} \ No newline at end of file +} diff --git a/application/vendor/jakub-onderka/php-console-color/src/JakubOnderka/PhpConsoleColor/InvalidStyleException.php b/application/vendor/jakub-onderka/php-console-color/src/InvalidStyleException.php similarity index 100% rename from application/vendor/jakub-onderka/php-console-color/src/JakubOnderka/PhpConsoleColor/InvalidStyleException.php rename to application/vendor/jakub-onderka/php-console-color/src/InvalidStyleException.php diff --git a/application/vendor/jakub-onderka/php-console-color/tests/JakubOnderka/PhpConsoleColor/ConsoleColorTest.php b/application/vendor/jakub-onderka/php-console-color/tests/ConsoleColorTest.php similarity index 100% rename from application/vendor/jakub-onderka/php-console-color/tests/JakubOnderka/PhpConsoleColor/ConsoleColorTest.php rename to application/vendor/jakub-onderka/php-console-color/tests/ConsoleColorTest.php diff --git a/application/vendor/jakub-onderka/php-console-color/tests/bootstrap.php b/application/vendor/jakub-onderka/php-console-color/tests/bootstrap.php deleted file mode 100644 index 7500417..0000000 --- a/application/vendor/jakub-onderka/php-console-color/tests/bootstrap.php +++ /dev/null @@ -1,2 +0,0 @@ -=5.4", - "nikic/php-parser": "^1.2|^2.0", + "nikic/php-parser": "^1.2|^2.0|^3.0|^4.0", "symfony/polyfill-php56": "^1.0" }, "require-dev": { @@ -33,7 +33,7 @@ }, "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "2.4-dev" } } } diff --git a/application/vendor/jeremeamia/SuperClosure/src/Analyzer/AstAnalyzer.php b/application/vendor/jeremeamia/SuperClosure/src/Analyzer/AstAnalyzer.php index 37e54c0..c15f83c 100644 --- a/application/vendor/jeremeamia/SuperClosure/src/Analyzer/AstAnalyzer.php +++ b/application/vendor/jeremeamia/SuperClosure/src/Analyzer/AstAnalyzer.php @@ -7,6 +7,7 @@ use PhpParser\NodeTraverser; use PhpParser\PrettyPrinter\Standard as NodePrinter; use PhpParser\Error as ParserError; +use PhpParser\Node\Expr\Variable as VariableNode; use PhpParser\NodeVisitor\NameResolver; use PhpParser\Parser as CodeParser; use PhpParser\ParserFactory; @@ -92,7 +93,13 @@ protected function determineContext(array &$data) if ($node->byRef) { $refs++; } - return $node->var; + if ($node->var instanceof VariableNode) { + // For PHP-Parser >=4.0 + return $node->var->name; + } else { + // For PHP-Parser <4.0 + return $node->var; + } }, $data['ast']->uses); $data['hasRefs'] = ($refs > 0); diff --git a/application/vendor/jeremeamia/SuperClosure/src/Analyzer/Visitor/ClosureLocatorVisitor.php b/application/vendor/jeremeamia/SuperClosure/src/Analyzer/Visitor/ClosureLocatorVisitor.php index 758ce6a..69f92ed 100644 --- a/application/vendor/jeremeamia/SuperClosure/src/Analyzer/Visitor/ClosureLocatorVisitor.php +++ b/application/vendor/jeremeamia/SuperClosure/src/Analyzer/Visitor/ClosureLocatorVisitor.php @@ -54,16 +54,16 @@ public function enterNode(AstNode $node) // Determine information about the closure's location if (!$this->closureNode) { if ($node instanceof NamespaceNode) { - $namespace = ($node->name && is_array($node->name->parts)) - ? implode('\\', $node->name->parts) + $namespace = $node->name !== null + ? $node->name->toString() : null; $this->location['namespace'] = $namespace; } if ($node instanceof TraitNode) { - $this->location['trait'] = $node->name; + $this->location['trait'] = (string) $node->name; $this->location['class'] = null; } elseif ($node instanceof ClassNode) { - $this->location['class'] = $node->name; + $this->location['class'] = (string) $node->name; $this->location['trait'] = null; } } diff --git a/application/vendor/jeremeamia/SuperClosure/src/Analyzer/Visitor/MagicConstantVisitor.php b/application/vendor/jeremeamia/SuperClosure/src/Analyzer/Visitor/MagicConstantVisitor.php index d9d227d..219654f 100644 --- a/application/vendor/jeremeamia/SuperClosure/src/Analyzer/Visitor/MagicConstantVisitor.php +++ b/application/vendor/jeremeamia/SuperClosure/src/Analyzer/Visitor/MagicConstantVisitor.php @@ -30,21 +30,21 @@ public function leaveNode(AstNode $node) { switch ($node->getType()) { case 'Scalar_MagicConst_Class' : - return new StringNode($this->location['class']); + return new StringNode($this->location['class'] ?: ''); case 'Scalar_MagicConst_Dir' : - return new StringNode($this->location['directory']); + return new StringNode($this->location['directory'] ?: ''); case 'Scalar_MagicConst_File' : - return new StringNode($this->location['file']); + return new StringNode($this->location['file'] ?: ''); case 'Scalar_MagicConst_Function' : - return new StringNode($this->location['function']); + return new StringNode($this->location['function'] ?: ''); case 'Scalar_MagicConst_Line' : - return new NumberNode($node->getAttribute('startLine')); + return new NumberNode($node->getAttribute('startLine') ?: 0); case 'Scalar_MagicConst_Method' : - return new StringNode($this->location['method']); + return new StringNode($this->location['method'] ?: ''); case 'Scalar_MagicConst_Namespace' : - return new StringNode($this->location['namespace']); + return new StringNode($this->location['namespace'] ?: ''); case 'Scalar_MagicConst_Trait' : - return new StringNode($this->location['trait']); + return new StringNode($this->location['trait'] ?: ''); } } } diff --git a/application/vendor/jeremeamia/SuperClosure/src/Exception/ClosureSerializationException.php b/application/vendor/jeremeamia/SuperClosure/src/Exception/ClosureSerializationException.php new file mode 100644 index 0000000..942dbd1 --- /dev/null +++ b/application/vendor/jeremeamia/SuperClosure/src/Exception/ClosureSerializationException.php @@ -0,0 +1,9 @@ +signingKey) { $signature = $this->calculateSignature($serialized); diff --git a/application/vendor/kylekatarnls/update-helper/LICENSE b/application/vendor/kylekatarnls/update-helper/LICENSE new file mode 100644 index 0000000..d55dee5 --- /dev/null +++ b/application/vendor/kylekatarnls/update-helper/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2017 https://github.com/pug-php +Copyright (c) 2017 https://github.com/kylekatarnls + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/application/vendor/kylekatarnls/update-helper/composer.json b/application/vendor/kylekatarnls/update-helper/composer.json new file mode 100644 index 0000000..ced8527 --- /dev/null +++ b/application/vendor/kylekatarnls/update-helper/composer.json @@ -0,0 +1,50 @@ +{ + "name": "kylekatarnls/update-helper", + "description": "Update helper", + "type": "composer-plugin", + "license": "MIT", + "minimum-stability": "dev", + "prefer-stable": true, + "authors": [ + { + "name": "Kyle", + "email": "kylekatarnls@gmail.com" + } + ], + "require": { + "php": ">=5.3.0", + "composer-plugin-api": "^1.1.0 || ^2.0.0" + }, + "require-dev": { + "composer/composer": "2.0.x-dev || ^2.0.0-dev", + "phpunit/phpunit": ">=4.8.35 <6.0", + "codeclimate/php-test-reporter": "dev-master" + }, + "autoload": { + "psr-0": { + "UpdateHelper\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "UpdateHelper\\Tests\\": "tests/UpdateHelper/" + } + }, + "scripts": { + "post-install-cmd": [ + "UpdateHelper\\UpdateHelper::check" + ], + "post-update-cmd": [ + "UpdateHelper\\UpdateHelper::check" + ], + "post-package-install": [ + "UpdateHelper\\UpdateHelper::check" + ], + "post-package-update": [ + "UpdateHelper\\UpdateHelper::check" + ] + }, + "extra": { + "class": "UpdateHelper\\ComposerPlugin" + } +} diff --git a/application/vendor/kylekatarnls/update-helper/src/UpdateHelper/ComposerPlugin.php b/application/vendor/kylekatarnls/update-helper/src/UpdateHelper/ComposerPlugin.php new file mode 100644 index 0000000..f0e2313 --- /dev/null +++ b/application/vendor/kylekatarnls/update-helper/src/UpdateHelper/ComposerPlugin.php @@ -0,0 +1,37 @@ +io = $io; + } + + public static function getSubscribedEvents() + { + return array( + 'post-autoload-dump' => array( + array('onAutoloadDump', 0), + ), + ); + } + + public function onAutoloadDump(Event $event) + { + if (!class_exists('UpdateHelper\\UpdateHelper')) { + return; + } + + UpdateHelper::check($event); + } +} diff --git a/application/vendor/kylekatarnls/update-helper/src/UpdateHelper/NotUpdateInterfaceInstanceException.php b/application/vendor/kylekatarnls/update-helper/src/UpdateHelper/NotUpdateInterfaceInstanceException.php new file mode 100644 index 0000000..8213b5e --- /dev/null +++ b/application/vendor/kylekatarnls/update-helper/src/UpdateHelper/NotUpdateInterfaceInstanceException.php @@ -0,0 +1,9 @@ +read(); + } catch (Exception $e) { + $dependencyConfig = null; + } + + if (is_array($dependencyConfig) && isset($dependencyConfig['extra'], $dependencyConfig['extra'][$key])) { + $classes[$file] = $dependencyConfig['extra'][$key]; + } + } + + protected static function getUpdateHelperConfig(Composer $composer, $key = null) + { + $vendorDir = $composer->getConfig()->get('vendor-dir'); + + $npm = array(); + + foreach (scandir($vendorDir) as $namespace) { + if ($namespace === '.' || $namespace === '..' || !is_dir($directory = $vendorDir.DIRECTORY_SEPARATOR.$namespace)) { + continue; + } + + foreach (scandir($directory) as $dependency) { + if ($dependency === '.' || $dependency === '..' || !is_dir($subDirectory = $directory.DIRECTORY_SEPARATOR.$dependency)) { + continue; + } + + static::appendConfig($npm, $subDirectory, $key); + } + } + + static::appendConfig($npm, dirname($vendorDir), $key); + + return $npm; + } + + /** + * @param Event $event + * @param IOInterface $io + * @param Composer $composer + * @param string[] $subClasses + */ + protected static function checkHelper($event, IOInterface $io, $composer, $class) + { + if (!is_string($class) || !class_exists($class)) { + throw new NotUpdateInterfaceInstanceException(); + } + + try { + $helper = new $class(); + } catch (Exception $e) { + throw new InvalidArgumentException($e->getMessage(), 1000, $e); + } catch (Throwable $e) { + throw new InvalidArgumentException($e->getMessage(), 1000, $e); + } + + if (!($helper instanceof UpdateHelperInterface)) { + throw new NotUpdateInterfaceInstanceException(); + } + + $helper->check(new static($event, $io, $composer)); + } + + /** + * @param string $file + * @param Event $event + * @param IOInterface $io + * @param Composer $composer + * @param string[] $subClasses + */ + protected static function checkFileHelpers($file, $event, IOInterface $io, $composer, array $subClasses) + { + foreach ($subClasses as $class) { + try { + static::checkHelper($event, $io, $composer, $class); + } catch (InvalidArgumentException $e) { + $io->writeError($e instanceof NotUpdateInterfaceInstanceException + ? 'UpdateHelper error in '.$file.":\n".JsonFile::encode($class).' is not an instance of UpdateHelperInterface.' + : 'UpdateHelper error: '.$e->getPrevious()->getMessage(). + "\nFile: ".$e->getPrevious()->getFile(). + "\nLine:".$e->getPrevious()->getLine(). + "\n\n".$e->getPrevious()->getTraceAsString() + ); + continue; + } + } + } + + public static function check(Event $event) + { + if (!($event instanceof ScriptEvent) && !($event instanceof PackageEvent)) { + return; + } + + $io = $event->getIO(); + $composer = $event->getComposer(); + $autoload = $composer->getConfig()->get('vendor-dir').'/autoload.php'; + + if (file_exists($autoload)) { + include_once $autoload; + } + + $classes = static::getUpdateHelperConfig($composer); + + foreach ($classes as $file => $subClasses) { + static::checkFileHelpers($file, $event, $io, $composer, (array) $subClasses); + } + } + + public function __construct(Event $event, IOInterface $io = null, Composer $composer = null) + { + $this->event = $event; + $this->io = $io ?: (method_exists($event, 'getIO') ? $event->getIO() : null); + $this->composer = $composer ?: (method_exists($event, 'getComposer') ? $event->getComposer() : null); + + if ($this->composer && + ($directory = $this->composer->getConfig()->get('archive-dir')) && + file_exists($file = $directory.'/composer.json') + ) { + $this->composerFilePath = $file; + $this->file = new JsonFile($this->composerFilePath); + $this->dependencies = $this->file->read(); + } + } + + /** + * @return JsonFile + */ + public function getFile() + { + return $this->file; + } + + /** + * @return string + */ + public function getComposerFilePath() + { + return $this->composerFilePath; + } + + /** + * @return Composer + */ + public function getComposer() + { + return $this->composer; + } + + /** + * @return Event + */ + public function getEvent() + { + return $this->event; + } + + /** + * @return IOInterface|null + */ + public function getIo() + { + return $this->io; + } + + /** + * @return array + */ + public function getDependencies() + { + return $this->dependencies; + } + + /** + * @return array + */ + public function getDevDependencies() + { + return isset($this->dependencies['require-dev']) ? $this->dependencies['require-dev'] : array(); + } + + /** + * @return array + */ + public function getProdDependencies() + { + return isset($this->dependencies['require']) ? $this->dependencies['require'] : array(); + } + + /** + * @return array + */ + public function getFlattenDependencies() + { + return array_merge($this->getDevDependencies(), $this->getProdDependencies()); + } + + /** + * @param string $dependency + * + * @return bool + */ + public function hasAsDevDependency($dependency) + { + return isset($this->dependencies['require-dev'][$dependency]); + } + + /** + * @param string $dependency + * + * @return bool + */ + public function hasAsProdDependency($dependency) + { + return isset($this->dependencies['require'][$dependency]); + } + + /** + * @param string $dependency + * + * @return bool + */ + public function hasAsDependency($dependency) + { + return $this->hasAsDevDependency($dependency) || $this->hasAsProdDependency($dependency); + } + + /** + * @param string $dependency + * @param string $version + * + * @return bool + */ + public function isDependencyAtLeast($dependency, $version) + { + if ($this->hasAsProdDependency($dependency)) { + return Semver::satisfies($version, $this->dependencies['require'][$dependency]); + } + + if ($this->hasAsDevDependency($dependency)) { + return Semver::satisfies($version, $this->dependencies['require-dev'][$dependency]); + } + + return false; + } + + /** + * @param string $dependency + * @param string $version + * + * @return bool + */ + public function isDependencyLesserThan($dependency, $version) + { + return !$this->isDependencyAtLeast($dependency, $version); + } + + /** + * @param string $dependency + * @param string $version + * @param array $environments + * + * @throws Exception + * + * @return $this + */ + public function setDependencyVersion($dependency, $version, $environments = array('require', 'require-dev')) + { + return $this->setDependencyVersions(array($dependency => $version), $environments); + } + + /** + * @param array $dependencies + * @param array $environments + * + * @throws Exception + * + * @return $this + */ + public function setDependencyVersions($dependencies, $environments = array('require', 'require-dev')) + { + if (!$this->composerFilePath) { + throw new RuntimeException('No composer instance detected.'); + } + + $touched = false; + + foreach ($environments as $environment) { + foreach ($dependencies as $dependency => $version) { + if (isset($this->dependencies[$environment], $this->dependencies[$environment][$dependency])) { + $this->dependencies[$environment][$dependency] = $version; + $touched = true; + } + } + } + + if ($touched) { + if (!$this->composerFilePath) { + throw new RuntimeException('composer.json not found (custom vendor-dir are not yet supported).'); + } + + $file = new JsonFile($this->composerFilePath); + $file->write($this->dependencies); + } + + return $this; + } + + /** + * @return $this + */ + public function update() + { + $output = shell_exec('composer update --no-scripts'); + + if (!empty($output)) { + $this->write($output); + } + + return $this; + } + + /** + * @param string|array $text + */ + public function write($text) + { + if ($this->io) { + $this->io->write($text); + + return; + } + + if (is_array($text)) { + $text = implode("\n", $text); + } + + echo $text; + } + + /** + * @return bool + */ + public function isInteractive() + { + return $this->io && $this->io->isInteractive(); + } +} diff --git a/application/vendor/kylekatarnls/update-helper/src/UpdateHelper/UpdateHelperInterface.php b/application/vendor/kylekatarnls/update-helper/src/UpdateHelper/UpdateHelperInterface.php new file mode 100644 index 0000000..3809dc0 --- /dev/null +++ b/application/vendor/kylekatarnls/update-helper/src/UpdateHelper/UpdateHelperInterface.php @@ -0,0 +1,8 @@ +=5.4.0", - "ext-openssl": "*", - "ext-mcrypt": "*", + "php": ">=5.5.9", "ext-mbstring": "*", - "classpreloader/classpreloader": "~1.2", + "ext-openssl": "*", + "classpreloader/classpreloader": "~2.0|~3.0", "danielstjules/stringy": "~1.8", "doctrine/inflector": "~1.0", - "ircmaxell/password-compat": "~1.0", "jeremeamia/superclosure": "~2.0", "league/flysystem": "~1.0", "monolog/monolog": "~1.11", "mtdowling/cron-expression": "~1.0", - "nesbot/carbon": "~1.0", - "psy/psysh": "0.4.*", + "nesbot/carbon": "~1.19", + "paragonie/random_compat": "~1.4", + "psy/psysh": "0.7.*", "swiftmailer/swiftmailer": "~5.1", - "symfony/console": "2.6.*", - "symfony/debug": "2.6.*", - "symfony/finder": "2.6.*", - "symfony/http-foundation": "2.6.*", - "symfony/http-kernel": "2.6.*", - "symfony/process": "2.6.*", - "symfony/routing": "2.6.*", - "symfony/security-core": "2.6.*", - "symfony/translation": "2.6.*", - "symfony/var-dumper": "2.6.*", + "symfony/console": "2.7.*", + "symfony/css-selector": "2.7.*|2.8.*", + "symfony/debug": "2.7.*", + "symfony/dom-crawler": "2.7.*", + "symfony/finder": "2.7.*", + "symfony/http-foundation": "2.7.*", + "symfony/http-kernel": "2.7.*", + "symfony/process": "2.7.*", + "symfony/routing": "2.7.*", + "symfony/translation": "2.7.*", + "symfony/var-dumper": "2.7.*", "vlucas/phpdotenv": "~1.0" }, "replace": { "illuminate/auth": "self.version", "illuminate/bus": "self.version", + "illuminate/broadcasting": "self.version", "illuminate/cache": "self.version", "illuminate/config": "self.version", "illuminate/console": "self.version", @@ -56,7 +57,6 @@ "illuminate/events": "self.version", "illuminate/exception": "self.version", "illuminate/filesystem": "self.version", - "illuminate/foundation": "self.version", "illuminate/hashing": "self.version", "illuminate/http": "self.version", "illuminate/log": "self.version", @@ -73,12 +73,12 @@ "illuminate/view": "self.version" }, "require-dev": { - "aws/aws-sdk-php": "~2.4", - "iron-io/iron_mq": "~1.5", + "aws/aws-sdk-php": "~3.0", + "iron-io/iron_mq": "~2.0", + "mockery/mockery": "~0.9.4", "pda/pheanstalk": "~3.0", - "predis/predis": "~1.0", - "mockery/mockery": "~0.9", - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "~4.0", + "predis/predis": "~1.0" }, "autoload": { "classmap": [ @@ -94,18 +94,21 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "suggest": { - "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~2.4).", + "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~3.0).", "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).", - "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers (~5.0).", - "iron-io/iron_mq": "Required to use the iron queue driver (~1.5).", - "league/flysystem-aws-s3-v2": "Required to use the Flysystem S3 driver (~1.0).", + "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", + "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~5.3|~6.0).", + "iron-io/iron_mq": "Required to use the iron queue driver (~2.0).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).", "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).", "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).", - "predis/predis": "Required to use the redis cache and queue drivers (~1.0)." + "predis/predis": "Required to use the redis cache and queue drivers (~1.0).", + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0).", + "symfony/psr-http-message-bridge": "Required to psr7 bridging features (0.2.*)." }, "minimum-stability": "dev" } diff --git a/application/vendor/laravel/framework/readme.md b/application/vendor/laravel/framework/readme.md index 0cfc013..4500a7b 100644 --- a/application/vendor/laravel/framework/readme.md +++ b/application/vendor/laravel/framework/readme.md @@ -1,5 +1,6 @@ ## Laravel Framework (Kernel) +[![StyleCI](https://styleci.io/repos/7548986/shield?style=flat)](https://styleci.io/repos/7548986) [![Build Status](https://travis-ci.org/laravel/framework.svg)](https://travis-ci.org/laravel/framework) [![Total Downloads](https://poser.pugx.org/laravel/framework/d/total.svg)](https://packagist.org/packages/laravel/framework) [![Latest Stable Version](https://poser.pugx.org/laravel/framework/v/stable.svg)](https://packagist.org/packages/laravel/framework) diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php b/application/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php new file mode 100644 index 0000000..de057d6 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php @@ -0,0 +1,453 @@ +policies = $policies; + $this->container = $container; + $this->abilities = $abilities; + $this->userResolver = $userResolver; + $this->afterCallbacks = $afterCallbacks; + $this->beforeCallbacks = $beforeCallbacks; + } + + /** + * Determine if a given ability has been defined. + * + * @param string $ability + * @return bool + */ + public function has($ability) + { + return isset($this->abilities[$ability]); + } + + /** + * Define a new ability. + * + * @param string $ability + * @param callable|string $callback + * @return $this + * + * @throws \InvalidArgumentException + */ + public function define($ability, $callback) + { + if (is_callable($callback)) { + $this->abilities[$ability] = $callback; + } elseif (is_string($callback) && str_contains($callback, '@')) { + $this->abilities[$ability] = $this->buildAbilityCallback($callback); + } else { + throw new InvalidArgumentException("Callback must be a callable or a 'Class@method' string."); + } + + return $this; + } + + /** + * Create the ability callback for a callback string. + * + * @param string $callback + * @return \Closure + */ + protected function buildAbilityCallback($callback) + { + return function () use ($callback) { + list($class, $method) = explode('@', $callback); + + return call_user_func_array([$this->resolvePolicy($class), $method], func_get_args()); + }; + } + + /** + * Define a policy class for a given class type. + * + * @param string $class + * @param string $policy + * @return $this + */ + public function policy($class, $policy) + { + $this->policies[$class] = $policy; + + return $this; + } + + /** + * Register a callback to run before all Gate checks. + * + * @param callable $callback + * @return $this + */ + public function before(callable $callback) + { + $this->beforeCallbacks[] = $callback; + + return $this; + } + + /** + * Register a callback to run after all Gate checks. + * + * @param callable $callback + * @return $this + */ + public function after(callable $callback) + { + $this->afterCallbacks[] = $callback; + + return $this; + } + + /** + * Determine if the given ability should be granted for the current user. + * + * @param string $ability + * @param array|mixed $arguments + * @return bool + */ + public function allows($ability, $arguments = []) + { + return $this->check($ability, $arguments); + } + + /** + * Determine if the given ability should be denied for the current user. + * + * @param string $ability + * @param array|mixed $arguments + * @return bool + */ + public function denies($ability, $arguments = []) + { + return ! $this->allows($ability, $arguments); + } + + /** + * Determine if the given ability should be granted for the current user. + * + * @param string $ability + * @param array|mixed $arguments + * @return bool + */ + public function check($ability, $arguments = []) + { + try { + $result = $this->raw($ability, $arguments); + } catch (UnauthorizedException $e) { + return false; + } + + return (bool) $result; + } + + /** + * Determine if the given ability should be granted for the current user. + * + * @param string $ability + * @param array|mixed $arguments + * @return \Illuminate\Auth\Access\Response + * + * @throws \Illuminate\Auth\Access\UnauthorizedException + */ + public function authorize($ability, $arguments = []) + { + $result = $this->raw($ability, $arguments); + + if ($result instanceof Response) { + return $result; + } + + return $result ? $this->allow() : $this->deny(); + } + + /** + * Get the raw result for the given ability for the current user. + * + * @param string $ability + * @param array|mixed $arguments + * @return mixed + */ + protected function raw($ability, $arguments = []) + { + if (! $user = $this->resolveUser()) { + return false; + } + + $arguments = is_array($arguments) ? $arguments : [$arguments]; + + if (is_null($result = $this->callBeforeCallbacks($user, $ability, $arguments))) { + $result = $this->callAuthCallback($user, $ability, $arguments); + } + + $this->callAfterCallbacks( + $user, $ability, $arguments, $result + ); + + return $result; + } + + /** + * Resolve and call the appropriate authorization callback. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $ability + * @param array $arguments + * @return bool + */ + protected function callAuthCallback($user, $ability, array $arguments) + { + $callback = $this->resolveAuthCallback( + $user, $ability, $arguments + ); + + return call_user_func_array( + $callback, array_merge([$user], $arguments) + ); + } + + /** + * Call all of the before callbacks and return if a result is given. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $ability + * @param array $arguments + * @return bool|null + */ + protected function callBeforeCallbacks($user, $ability, array $arguments) + { + $arguments = array_merge([$user, $ability], $arguments); + + foreach ($this->beforeCallbacks as $before) { + if (! is_null($result = call_user_func_array($before, $arguments))) { + return $result; + } + } + } + + /** + * Call all of the after callbacks with check result. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $ability + * @param array $arguments + * @param bool $result + * @return void + */ + protected function callAfterCallbacks($user, $ability, array $arguments, $result) + { + $arguments = array_merge([$user, $ability, $result], $arguments); + + foreach ($this->afterCallbacks as $after) { + call_user_func_array($after, $arguments); + } + } + + /** + * Resolve the callable for the given ability and arguments. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $ability + * @param array $arguments + * @return callable + */ + protected function resolveAuthCallback($user, $ability, array $arguments) + { + if ($this->firstArgumentCorrespondsToPolicy($arguments)) { + return $this->resolvePolicyCallback($user, $ability, $arguments); + } elseif (isset($this->abilities[$ability])) { + return $this->abilities[$ability]; + } else { + return function () { + return false; + }; + } + } + + /** + * Determine if the first argument in the array corresponds to a policy. + * + * @param array $arguments + * @return bool + */ + protected function firstArgumentCorrespondsToPolicy(array $arguments) + { + if (! isset($arguments[0])) { + return false; + } + + if (is_object($arguments[0])) { + return isset($this->policies[get_class($arguments[0])]); + } + + return is_string($arguments[0]) && isset($this->policies[$arguments[0]]); + } + + /** + * Resolve the callback for a policy check. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $ability + * @param array $arguments + * @return callable + */ + protected function resolvePolicyCallback($user, $ability, array $arguments) + { + return function () use ($user, $ability, $arguments) { + $instance = $this->getPolicyFor($arguments[0]); + + if (method_exists($instance, 'before')) { + // We will prepend the user and ability onto the arguments so that the before + // callback can determine which ability is being called. Then we will call + // into the policy before methods with the arguments and get the result. + $beforeArguments = array_merge([$user, $ability], $arguments); + + $result = call_user_func_array( + [$instance, 'before'], $beforeArguments + ); + + // If we recieved a non-null result from the before method, we will return it + // as the result of a check. This allows developers to override the checks + // in the policy and return a result for all rules defined in the class. + if (! is_null($result)) { + return $result; + } + } + + if (strpos($ability, '-') !== false) { + $ability = Str::camel($ability); + } + + if (! is_callable([$instance, $ability])) { + return false; + } + + return call_user_func_array( + [$instance, $ability], array_merge([$user], $arguments) + ); + }; + } + + /** + * Get a policy instance for a given class. + * + * @param object|string $class + * @return mixed + * + * @throws \InvalidArgumentException + */ + public function getPolicyFor($class) + { + if (is_object($class)) { + $class = get_class($class); + } + + if (! isset($this->policies[$class])) { + throw new InvalidArgumentException("Policy not defined for [{$class}]."); + } + + return $this->resolvePolicy($this->policies[$class]); + } + + /** + * Build a policy class instance of the given type. + * + * @param object|string $class + * @return mixed + */ + public function resolvePolicy($class) + { + return $this->container->make($class); + } + + /** + * Get a guard instance for the given user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user + * @return static + */ + public function forUser($user) + { + $callback = function () use ($user) { + return $user; + }; + + return new static( + $this->container, $callback, $this->abilities, + $this->policies, $this->beforeCallbacks, $this->afterCallbacks + ); + } + + /** + * Resolve the user from the user resolver. + * + * @return mixed + */ + protected function resolveUser() + { + return call_user_func($this->userResolver); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php b/application/vendor/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php new file mode 100644 index 0000000..148b584 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php @@ -0,0 +1,30 @@ +message = $message; + } + + /** + * Get the response message. + * + * @return string|null + */ + public function message() + { + return $this->message; + } + + /** + * Get the string representation of the message. + * + * @return string + */ + public function __toString() + { + return $this->message(); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/Access/UnauthorizedException.php b/application/vendor/laravel/framework/src/Illuminate/Auth/Access/UnauthorizedException.php new file mode 100644 index 0000000..7488c5b --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/Access/UnauthorizedException.php @@ -0,0 +1,10 @@ +setCookieJar($this->app['cookie']); - - $guard->setDispatcher($this->app['events']); - - return $guard->setRequest($this->app->refresh('request', $guard, 'setRequest')); - } - - /** - * Call a custom driver creator. - * - * @param string $driver - * @return \Illuminate\Auth\Guard - */ - protected function callCustomCreator($driver) - { - $custom = parent::callCustomCreator($driver); - - if ($custom instanceof Guard) - { - return $custom; - } - - return new Guard($custom, $this->app['session.store']); - } - - /** - * Create an instance of the database driver. - * - * @return \Illuminate\Auth\Guard - */ - public function createDatabaseDriver() - { - $provider = $this->createDatabaseProvider(); - - return new Guard($provider, $this->app['session.store']); - } - - /** - * Create an instance of the database user provider. - * - * @return \Illuminate\Auth\DatabaseUserProvider - */ - protected function createDatabaseProvider() - { - $connection = $this->app['db']->connection(); - - // When using the basic database user provider, we need to inject the table we - // want to use, since this is not an Eloquent model we will have no way to - // know without telling the provider, so we'll inject the config value. - $table = $this->app['config']['auth.table']; - - return new DatabaseUserProvider($connection, $this->app['hash'], $table); - } - - /** - * Create an instance of the Eloquent driver. - * - * @return \Illuminate\Auth\Guard - */ - public function createEloquentDriver() - { - $provider = $this->createEloquentProvider(); - - return new Guard($provider, $this->app['session.store']); - } - - /** - * Create an instance of the Eloquent user provider. - * - * @return \Illuminate\Auth\EloquentUserProvider - */ - protected function createEloquentProvider() - { - $model = $this->app['config']['auth.model']; - - return new EloquentUserProvider($this->app['hash'], $model); - } - - /** - * Get the default authentication driver name. - * - * @return string - */ - public function getDefaultDriver() - { - return $this->app['config']['auth.driver']; - } - - /** - * Set the default authentication driver name. - * - * @param string $name - * @return void - */ - public function setDefaultDriver($name) - { - $this->app['config']['auth.driver'] = $name; - } +namespace Illuminate\Auth; +use Illuminate\Support\Manager; +use Illuminate\Contracts\Auth\Guard as GuardContract; + +class AuthManager extends Manager +{ + /** + * Create a new driver instance. + * + * @param string $driver + * @return mixed + */ + protected function createDriver($driver) + { + $guard = parent::createDriver($driver); + + // When using the remember me functionality of the authentication services we + // will need to be set the encryption instance of the guard, which allows + // secure, encrypted cookie values to get generated for those cookies. + if (method_exists($guard, 'setCookieJar')) { + $guard->setCookieJar($this->app['cookie']); + } + + if (method_exists($guard, 'setDispatcher')) { + $guard->setDispatcher($this->app['events']); + } + + if (method_exists($guard, 'setRequest')) { + $guard->setRequest($this->app->refresh('request', $guard, 'setRequest')); + } + + return $guard; + } + + /** + * Call a custom driver creator. + * + * @param string $driver + * @return \Illuminate\Contracts\Auth\Guard + */ + protected function callCustomCreator($driver) + { + $custom = parent::callCustomCreator($driver); + + if ($custom instanceof GuardContract) { + return $custom; + } + + return new Guard($custom, $this->app['session.store']); + } + + /** + * Create an instance of the database driver. + * + * @return \Illuminate\Auth\Guard + */ + public function createDatabaseDriver() + { + $provider = $this->createDatabaseProvider(); + + return new Guard($provider, $this->app['session.store']); + } + + /** + * Create an instance of the database user provider. + * + * @return \Illuminate\Auth\DatabaseUserProvider + */ + protected function createDatabaseProvider() + { + $connection = $this->app['db']->connection(); + + // When using the basic database user provider, we need to inject the table we + // want to use, since this is not an Eloquent model we will have no way to + // know without telling the provider, so we'll inject the config value. + $table = $this->app['config']['auth.table']; + + return new DatabaseUserProvider($connection, $this->app['hash'], $table); + } + + /** + * Create an instance of the Eloquent driver. + * + * @return \Illuminate\Auth\Guard + */ + public function createEloquentDriver() + { + $provider = $this->createEloquentProvider(); + + return new Guard($provider, $this->app['session.store']); + } + + /** + * Create an instance of the Eloquent user provider. + * + * @return \Illuminate\Auth\EloquentUserProvider + */ + protected function createEloquentProvider() + { + $model = $this->app['config']['auth.model']; + + return new EloquentUserProvider($this->app['hash'], $model); + } + + /** + * Get the default authentication driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['auth.driver']; + } + + /** + * Set the default authentication driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['auth.driver'] = $name; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php index a2b9c8d..9ef8041 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php @@ -1,73 +1,88 @@ -registerAuthenticator(); - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $this->registerAuthenticator(); + $this->registerUserResolver(); - $this->registerUserResolver(); + $this->registerAccessGate(); - $this->registerRequestRebindHandler(); - } + $this->registerRequestRebindHandler(); + } - /** - * Register the authenticator services. - * - * @return void - */ - protected function registerAuthenticator() - { - $this->app->singleton('auth', function($app) - { - // Once the authentication service has actually been requested by the developer - // we will set a variable in the application indicating such. This helps us - // know that we need to set any queued cookies in the after event later. - $app['auth.loaded'] = true; + /** + * Register the authenticator services. + * + * @return void + */ + protected function registerAuthenticator() + { + $this->app->singleton('auth', function ($app) { + // Once the authentication service has actually been requested by the developer + // we will set a variable in the application indicating such. This helps us + // know that we need to set any queued cookies in the after event later. + $app['auth.loaded'] = true; - return new AuthManager($app); - }); + return new AuthManager($app); + }); - $this->app->singleton('auth.driver', function($app) - { - return $app['auth']->driver(); - }); - } + $this->app->singleton('auth.driver', function ($app) { + return $app['auth']->driver(); + }); + } - /** - * Register a resolver for the authenticated user. - * - * @return void - */ - protected function registerUserResolver() - { - $this->app->bind('Illuminate\Contracts\Auth\Authenticatable', function($app) - { - return $app['auth']->user(); - }); - } + /** + * Register a resolver for the authenticated user. + * + * @return void + */ + protected function registerUserResolver() + { + $this->app->bind(AuthenticatableContract::class, function ($app) { + return $app['auth']->user(); + }); + } - /** - * Register a resolver for the authenticated user. - * - * @return void - */ - protected function registerRequestRebindHandler() - { - $this->app->rebinding('request', function($app, $request) - { - $request->setUserResolver(function() use ($app) - { - return $app['auth']->user(); - }); - }); - } + /** + * Register the access gate service. + * + * @return void + */ + protected function registerAccessGate() + { + $this->app->singleton(GateContract::class, function ($app) { + return new Gate($app, function () use ($app) { + return $app['auth']->user(); + }); + }); + } + /** + * Register a resolver for the authenticated user. + * + * @return void + */ + protected function registerRequestRebindHandler() + { + $this->app->rebinding('request', function ($app, $request) { + $request->setUserResolver(function () use ($app) { + return $app['auth']->user(); + }); + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php b/application/vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php index 85db097..46101d2 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php @@ -1,56 +1,57 @@ -getKey(); - } +trait Authenticatable +{ + /** + * Get the unique identifier for the user. + * + * @return mixed + */ + public function getAuthIdentifier() + { + return $this->getKey(); + } - /** - * Get the password for the user. - * - * @return string - */ - public function getAuthPassword() - { - return $this->password; - } + /** + * Get the password for the user. + * + * @return string + */ + public function getAuthPassword() + { + return $this->password; + } - /** - * Get the token value for the "remember me" session. - * - * @return string - */ - public function getRememberToken() - { - return $this->{$this->getRememberTokenName()}; - } + /** + * Get the token value for the "remember me" session. + * + * @return string + */ + public function getRememberToken() + { + return $this->{$this->getRememberTokenName()}; + } - /** - * Set the token value for the "remember me" session. - * - * @param string $value - * @return void - */ - public function setRememberToken($value) - { - $this->{$this->getRememberTokenName()} = $value; - } - - /** - * Get the column name for the "remember me" token. - * - * @return string - */ - public function getRememberTokenName() - { - return 'remember_token'; - } + /** + * Set the token value for the "remember me" session. + * + * @param string $value + * @return void + */ + public function setRememberToken($value) + { + $this->{$this->getRememberTokenName()} = $value; + } + /** + * Get the column name for the "remember me" token. + * + * @return string + */ + public function getRememberTokenName() + { + return 'remember_token'; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/Console/ClearResetsCommand.php b/application/vendor/laravel/framework/src/Illuminate/Auth/Console/ClearResetsCommand.php index 05ae4fb..88dcb8c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Auth/Console/ClearResetsCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/Console/ClearResetsCommand.php @@ -1,33 +1,34 @@ -laravel['auth.password.tokens']->deleteExpired(); + /** + * The console command description. + * + * @var string + */ + protected $description = 'Flush expired password reset tokens'; - $this->info('Expired reset tokens cleared!'); - } + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $this->laravel['auth.password.tokens']->deleteExpired(); + $this->info('Expired reset tokens cleared!'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/DatabaseUserProvider.php b/application/vendor/laravel/framework/src/Illuminate/Auth/DatabaseUserProvider.php index 2cd63c6..e23a63f 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Auth/DatabaseUserProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/DatabaseUserProvider.php @@ -1,147 +1,146 @@ -conn = $conn; - $this->table = $table; - $this->hasher = $hasher; - } - - /** - * Retrieve a user by their unique identifier. - * - * @param mixed $identifier - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function retrieveById($identifier) - { - $user = $this->conn->table($this->table)->find($identifier); - - return $this->getGenericUser($user); - } - - /** - * Retrieve a user by their unique identifier and "remember me" token. - * - * @param mixed $identifier - * @param string $token - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function retrieveByToken($identifier, $token) - { - $user = $this->conn->table($this->table) - ->where('id', $identifier) - ->where('remember_token', $token) - ->first(); - - return $this->getGenericUser($user); - } - - /** - * Update the "remember me" token for the given user in storage. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @param string $token - * @return void - */ - public function updateRememberToken(UserContract $user, $token) - { - $this->conn->table($this->table) - ->where('id', $user->getAuthIdentifier()) - ->update(['remember_token' => $token]); - } - - /** - * Retrieve a user by the given credentials. - * - * @param array $credentials - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function retrieveByCredentials(array $credentials) - { - // First we will add each credential element to the query as a where clause. - // Then we can execute the query and, if we found a user, return it in a - // generic "user" object that will be utilized by the Guard instances. - $query = $this->conn->table($this->table); - - foreach ($credentials as $key => $value) - { - if ( ! str_contains($key, 'password')) - { - $query->where($key, $value); - } - } - - // Now we are ready to execute the query to see if we have an user matching - // the given credentials. If not, we will just return nulls and indicate - // that there are no matching users for these given credential arrays. - $user = $query->first(); - - return $this->getGenericUser($user); - } - - /** - * Get the generic user. - * - * @param mixed $user - * @return \Illuminate\Auth\GenericUser|null - */ - protected function getGenericUser($user) - { - if ($user !== null) - { - return new GenericUser((array) $user); - } - } - - /** - * Validate a user against the given credentials. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @param array $credentials - * @return bool - */ - public function validateCredentials(UserContract $user, array $credentials) - { - $plain = $credentials['password']; - - return $this->hasher->check($plain, $user->getAuthPassword()); - } - +class DatabaseUserProvider implements UserProvider +{ + /** + * The active database connection. + * + * @var \Illuminate\Database\ConnectionInterface + */ + protected $conn; + + /** + * The hasher implementation. + * + * @var \Illuminate\Contracts\Hashing\Hasher + */ + protected $hasher; + + /** + * The table containing the users. + * + * @var string + */ + protected $table; + + /** + * Create a new database user provider. + * + * @param \Illuminate\Database\ConnectionInterface $conn + * @param \Illuminate\Contracts\Hashing\Hasher $hasher + * @param string $table + * @return void + */ + public function __construct(ConnectionInterface $conn, HasherContract $hasher, $table) + { + $this->conn = $conn; + $this->table = $table; + $this->hasher = $hasher; + } + + /** + * Retrieve a user by their unique identifier. + * + * @param mixed $identifier + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveById($identifier) + { + $user = $this->conn->table($this->table)->find($identifier); + + return $this->getGenericUser($user); + } + + /** + * Retrieve a user by their unique identifier and "remember me" token. + * + * @param mixed $identifier + * @param string $token + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveByToken($identifier, $token) + { + $user = $this->conn->table($this->table) + ->where('id', $identifier) + ->where('remember_token', $token) + ->first(); + + return $this->getGenericUser($user); + } + + /** + * Update the "remember me" token for the given user in storage. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $token + * @return void + */ + public function updateRememberToken(UserContract $user, $token) + { + $this->conn->table($this->table) + ->where('id', $user->getAuthIdentifier()) + ->update(['remember_token' => $token]); + } + + /** + * Retrieve a user by the given credentials. + * + * @param array $credentials + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveByCredentials(array $credentials) + { + // First we will add each credential element to the query as a where clause. + // Then we can execute the query and, if we found a user, return it in a + // generic "user" object that will be utilized by the Guard instances. + $query = $this->conn->table($this->table); + + foreach ($credentials as $key => $value) { + if (! Str::contains($key, 'password')) { + $query->where($key, $value); + } + } + + // Now we are ready to execute the query to see if we have an user matching + // the given credentials. If not, we will just return nulls and indicate + // that there are no matching users for these given credential arrays. + $user = $query->first(); + + return $this->getGenericUser($user); + } + + /** + * Get the generic user. + * + * @param mixed $user + * @return \Illuminate\Auth\GenericUser|null + */ + protected function getGenericUser($user) + { + if ($user !== null) { + return new GenericUser((array) $user); + } + } + + /** + * Validate a user against the given credentials. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param array $credentials + * @return bool + */ + public function validateCredentials(UserContract $user, array $credentials) + { + $plain = $credentials['password']; + + return $this->hasher->check($plain, $user->getAuthPassword()); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php b/application/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php index 484e322..e2b6dc7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php @@ -1,128 +1,174 @@ -model = $model; - $this->hasher = $hasher; - } - - /** - * Retrieve a user by their unique identifier. - * - * @param mixed $identifier - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function retrieveById($identifier) - { - return $this->createModel()->newQuery()->find($identifier); - } - - /** - * Retrieve a user by their unique identifier and "remember me" token. - * - * @param mixed $identifier - * @param string $token - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function retrieveByToken($identifier, $token) - { - $model = $this->createModel(); - - return $model->newQuery() - ->where($model->getKeyName(), $identifier) - ->where($model->getRememberTokenName(), $token) - ->first(); - } - - /** - * Update the "remember me" token for the given user in storage. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @param string $token - * @return void - */ - public function updateRememberToken(UserContract $user, $token) - { - $user->setRememberToken($token); - - $user->save(); - } - - /** - * Retrieve a user by the given credentials. - * - * @param array $credentials - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function retrieveByCredentials(array $credentials) - { - // First we will add each credential element to the query as a where clause. - // Then we can execute the query and, if we found a user, return it in a - // Eloquent User "model" that will be utilized by the Guard instances. - $query = $this->createModel()->newQuery(); - - foreach ($credentials as $key => $value) - { - if ( ! str_contains($key, 'password')) - { - $query->where($key, $value); - } - } - - return $query->first(); - } - - /** - * Validate a user against the given credentials. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @param array $credentials - * @return bool - */ - public function validateCredentials(UserContract $user, array $credentials) - { - $plain = $credentials['password']; - - return $this->hasher->check($plain, $user->getAuthPassword()); - } - - /** - * Create a new instance of the model. - * - * @return \Illuminate\Database\Eloquent\Model - */ - public function createModel() - { - $class = '\\'.ltrim($this->model, '\\'); - - return new $class; - } - +class EloquentUserProvider implements UserProvider +{ + /** + * The hasher implementation. + * + * @var \Illuminate\Contracts\Hashing\Hasher + */ + protected $hasher; + + /** + * The Eloquent user model. + * + * @var string + */ + protected $model; + + /** + * Create a new database user provider. + * + * @param \Illuminate\Contracts\Hashing\Hasher $hasher + * @param string $model + * @return void + */ + public function __construct(HasherContract $hasher, $model) + { + $this->model = $model; + $this->hasher = $hasher; + } + + /** + * Retrieve a user by their unique identifier. + * + * @param mixed $identifier + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveById($identifier) + { + return $this->createModel()->newQuery()->find($identifier); + } + + /** + * Retrieve a user by their unique identifier and "remember me" token. + * + * @param mixed $identifier + * @param string $token + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveByToken($identifier, $token) + { + $model = $this->createModel(); + + return $model->newQuery() + ->where($model->getKeyName(), $identifier) + ->where($model->getRememberTokenName(), $token) + ->first(); + } + + /** + * Update the "remember me" token for the given user in storage. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $token + * @return void + */ + public function updateRememberToken(UserContract $user, $token) + { + $user->setRememberToken($token); + + $user->save(); + } + + /** + * Retrieve a user by the given credentials. + * + * @param array $credentials + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveByCredentials(array $credentials) + { + // First we will add each credential element to the query as a where clause. + // Then we can execute the query and, if we found a user, return it in a + // Eloquent User "model" that will be utilized by the Guard instances. + $query = $this->createModel()->newQuery(); + + foreach ($credentials as $key => $value) { + if (! Str::contains($key, 'password')) { + $query->where($key, $value); + } + } + + return $query->first(); + } + + /** + * Validate a user against the given credentials. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param array $credentials + * @return bool + */ + public function validateCredentials(UserContract $user, array $credentials) + { + $plain = $credentials['password']; + + return $this->hasher->check($plain, $user->getAuthPassword()); + } + + /** + * Create a new instance of the model. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function createModel() + { + $class = '\\'.ltrim($this->model, '\\'); + + return new $class; + } + + /** + * Gets the hasher implementation. + * + * @return \Illuminate\Contracts\Hashing\Hasher + */ + public function getHasher() + { + return $this->hasher; + } + + /** + * Sets the hasher implementation. + * + * @param \Illuminate\Contracts\Hashing\Hasher $hasher + * @return $this + */ + public function setHasher(HasherContract $hasher) + { + $this->hasher = $hasher; + + return $this; + } + + /** + * Gets the name of the Eloquent user model. + * + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Sets the name of the Eloquent user model. + * + * @param string $model + * @return $this + */ + public function setModel($model) + { + $this->model = $model; + + return $this; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/GeneratorServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Auth/GeneratorServiceProvider.php index 4e14f2d..1b9ce10 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Auth/GeneratorServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/GeneratorServiceProvider.php @@ -1,66 +1,65 @@ -commands as $command) - { - $this->{"register{$command}Command"}(); - } + /** + * The commands to be registered. + * + * @var array + */ + protected $commands = [ + 'ClearResets', + ]; - $this->commands( - 'command.auth.resets.clear' - ); - } + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + foreach ($this->commands as $command) { + $this->{"register{$command}Command"}(); + } - /** - * Register the command. - * - * @return void - */ - protected function registerClearResetsCommand() - { - $this->app->singleton('command.auth.resets.clear', function() - { - return new ClearResetsCommand; - }); - } + $this->commands( + 'command.auth.resets.clear' + ); + } - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - 'command.auth.resets.clear', - ]; - } + /** + * Register the command. + * + * @return void + */ + protected function registerClearResetsCommand() + { + $this->app->singleton('command.auth.resets.clear', function () { + return new ClearResetsCommand; + }); + } + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'command.auth.resets.clear', + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/GenericUser.php b/application/vendor/laravel/framework/src/Illuminate/Auth/GenericUser.php index f0c86e0..d349d49 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Auth/GenericUser.php +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/GenericUser.php @@ -1,121 +1,122 @@ -attributes = $attributes; - } +class GenericUser implements UserContract +{ + /** + * All of the user's attributes. + * + * @var array + */ + protected $attributes; - /** - * Get the unique identifier for the user. - * - * @return mixed - */ - public function getAuthIdentifier() - { - return $this->attributes['id']; - } + /** + * Create a new generic User object. + * + * @param array $attributes + * @return void + */ + public function __construct(array $attributes) + { + $this->attributes = $attributes; + } - /** - * Get the password for the user. - * - * @return string - */ - public function getAuthPassword() - { - return $this->attributes['password']; - } + /** + * Get the unique identifier for the user. + * + * @return mixed + */ + public function getAuthIdentifier() + { + return $this->attributes['id']; + } - /** - * Get the "remember me" token value. - * - * @return string - */ - public function getRememberToken() - { - return $this->attributes[$this->getRememberTokenName()]; - } + /** + * Get the password for the user. + * + * @return string + */ + public function getAuthPassword() + { + return $this->attributes['password']; + } - /** - * Set the "remember me" token value. - * - * @param string $value - * @return void - */ - public function setRememberToken($value) - { - $this->attributes[$this->getRememberTokenName()] = $value; - } + /** + * Get the "remember me" token value. + * + * @return string + */ + public function getRememberToken() + { + return $this->attributes[$this->getRememberTokenName()]; + } - /** - * Get the column name for the "remember me" token. - * - * @return string - */ - public function getRememberTokenName() - { - return 'remember_token'; - } + /** + * Set the "remember me" token value. + * + * @param string $value + * @return void + */ + public function setRememberToken($value) + { + $this->attributes[$this->getRememberTokenName()] = $value; + } - /** - * Dynamically access the user's attributes. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this->attributes[$key]; - } + /** + * Get the column name for the "remember me" token. + * + * @return string + */ + public function getRememberTokenName() + { + return 'remember_token'; + } - /** - * Dynamically set an attribute on the user. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function __set($key, $value) - { - $this->attributes[$key] = $value; - } + /** + * Dynamically access the user's attributes. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->attributes[$key]; + } - /** - * Dynamically check if a value is set on the user. - * - * @param string $key - * @return bool - */ - public function __isset($key) - { - return isset($this->attributes[$key]); - } + /** + * Dynamically set an attribute on the user. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this->attributes[$key] = $value; + } - /** - * Dynamically unset a value on the user. - * - * @param string $key - * @return void - */ - public function __unset($key) - { - unset($this->attributes[$key]); - } + /** + * Dynamically check if a value is set on the user. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return isset($this->attributes[$key]); + } + /** + * Dynamically unset a value on the user. + * + * @param string $key + * @return void + */ + public function __unset($key) + { + unset($this->attributes[$key]); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/Guard.php b/application/vendor/laravel/framework/src/Illuminate/Auth/Guard.php index a43ea31..482c3ea 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Auth/Guard.php +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/Guard.php @@ -1,8 +1,11 @@ -session = $session; - $this->request = $request; - $this->provider = $provider; - } - - /** - * Determine if the current user is authenticated. - * - * @return bool - */ - public function check() - { - return ! is_null($this->user()); - } - - /** - * Determine if the current user is a guest. - * - * @return bool - */ - public function guest() - { - return ! $this->check(); - } - - /** - * Get the currently authenticated user. - * - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function user() - { - if ($this->loggedOut) return; - - // If we have already retrieved the user for the current request we can just - // return it back immediately. We do not want to pull the user data every - // request into the method because that would tremendously slow an app. - if ( ! is_null($this->user)) - { - return $this->user; - } - - $id = $this->session->get($this->getName()); - - // First we will try to load the user using the identifier in the session if - // one exists. Otherwise we will check for a "remember me" cookie in this - // request, and if one exists, attempt to retrieve the user using that. - $user = null; - - if ( ! is_null($id)) - { - $user = $this->provider->retrieveById($id); - } - - // If the user is null, but we decrypt a "recaller" cookie we can attempt to - // pull the user data on that cookie which serves as a remember cookie on - // the application. Once we have a user we can return it to the caller. - $recaller = $this->getRecaller(); - - if (is_null($user) && ! is_null($recaller)) - { - $user = $this->getUserByRecaller($recaller); - - if ($user) - { - $this->updateSession($user->getAuthIdentifier()); - - $this->fireLoginEvent($user, true); - } - } - - return $this->user = $user; - } - - /** - * Get the ID for the currently authenticated user. - * - * @return int|null - */ - public function id() - { - if ($this->loggedOut) - { - return; - } - - $id = $this->session->get($this->getName(), $this->getRecallerId()); - - if (is_null($id) && $this->user()) - { - $id = $this->user()->getAuthIdentifier(); - } - - return $id; - } - - /** - * Pull a user from the repository by its recaller ID. - * - * @param string $recaller - * @return mixed - */ - protected function getUserByRecaller($recaller) - { - if ($this->validRecaller($recaller) && ! $this->tokenRetrievalAttempted) - { - $this->tokenRetrievalAttempted = true; - - list($id, $token) = explode('|', $recaller, 2); - - $this->viaRemember = ! is_null($user = $this->provider->retrieveByToken($id, $token)); - - return $user; - } - } - - /** - * Get the decrypted recaller cookie for the request. - * - * @return string|null - */ - protected function getRecaller() - { - return $this->request->cookies->get($this->getRecallerName()); - } - - /** - * Get the user ID from the recaller cookie. - * - * @return string - */ - protected function getRecallerId() - { - if ($this->validRecaller($recaller = $this->getRecaller())) - { - return head(explode('|', $recaller)); - } - } - - /** - * Determine if the recaller cookie is in a valid format. - * - * @param string $recaller - * @return bool - */ - protected function validRecaller($recaller) - { - if ( ! is_string($recaller) || ! str_contains($recaller, '|')) return false; - - $segments = explode('|', $recaller); - - return count($segments) == 2 && trim($segments[0]) !== '' && trim($segments[1]) !== ''; - } - - /** - * Log a user into the application without sessions or cookies. - * - * @param array $credentials - * @return bool - */ - public function once(array $credentials = []) - { - if ($this->validate($credentials)) - { - $this->setUser($this->lastAttempted); - - return true; - } - - return false; - } - - /** - * Validate a user's credentials. - * - * @param array $credentials - * @return bool - */ - public function validate(array $credentials = []) - { - return $this->attempt($credentials, false, false); - } - - /** - * Attempt to authenticate using HTTP Basic Auth. - * - * @param string $field - * @return \Symfony\Component\HttpFoundation\Response|null - */ - public function basic($field = 'email') - { - if ($this->check()) - { - return; - } - - // If a username is set on the HTTP basic request, we will return out without - // interrupting the request lifecycle. Otherwise, we'll need to generate a - // request indicating that the given credentials were invalid for login. - if ($this->attemptBasic($this->getRequest(), $field)) - { - return; - } - - return $this->getBasicResponse(); - } - - /** - * Perform a stateless HTTP Basic login attempt. - * - * @param string $field - * @return \Symfony\Component\HttpFoundation\Response|null - */ - public function onceBasic($field = 'email') - { - if ( ! $this->once($this->getBasicCredentials($this->getRequest(), $field))) - { - return $this->getBasicResponse(); - } - } - - /** - * Attempt to authenticate using basic authentication. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param string $field - * @return bool - */ - protected function attemptBasic(Request $request, $field) - { - if ( ! $request->getUser()) - { - return false; - } - - return $this->attempt($this->getBasicCredentials($request, $field)); - } - - /** - * Get the credential array for a HTTP Basic request. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param string $field - * @return array - */ - protected function getBasicCredentials(Request $request, $field) - { - return [$field => $request->getUser(), 'password' => $request->getPassword()]; - } - - /** - * Get the response for basic authentication. - * - * @return \Symfony\Component\HttpFoundation\Response - */ - protected function getBasicResponse() - { - $headers = ['WWW-Authenticate' => 'Basic']; - - return new Response('Invalid credentials.', 401, $headers); - } - - /** - * Attempt to authenticate a user using the given credentials. - * - * @param array $credentials - * @param bool $remember - * @param bool $login - * @return bool - */ - public function attempt(array $credentials = [], $remember = false, $login = true) - { - $this->fireAttemptEvent($credentials, $remember, $login); - - $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); - - // If an implementation of UserInterface was returned, we'll ask the provider - // to validate the user against the given credentials, and if they are in - // fact valid we'll log the users into the application and return true. - if ($this->hasValidCredentials($user, $credentials)) - { - if ($login) $this->login($user, $remember); - { - return true; - - } - } - - return false; - } - - /** - * Determine if the user matches the credentials. - * - * @param mixed $user - * @param array $credentials - * @return bool - */ - protected function hasValidCredentials($user, $credentials) - { - return ! is_null($user) && $this->provider->validateCredentials($user, $credentials); - } - - /** - * Fire the attempt event with the arguments. - * - * @param array $credentials - * @param bool $remember - * @param bool $login - * @return void - */ - protected function fireAttemptEvent(array $credentials, $remember, $login) - { - if ($this->events) - { - $payload = [$credentials, $remember, $login]; - - $this->events->fire('auth.attempt', $payload); - } - } - - /** - * Register an authentication attempt event listener. - * - * @param mixed $callback - * @return void - */ - public function attempting($callback) - { - if ($this->events) - { - $this->events->listen('auth.attempt', $callback); - } - } - - /** - * Log a user into the application. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @param bool $remember - * @return void - */ - public function login(UserContract $user, $remember = false) - { - $this->updateSession($user->getAuthIdentifier()); - - // If the user should be permanently "remembered" by the application we will - // queue a permanent cookie that contains the encrypted copy of the user - // identifier. We will then decrypt this later to retrieve the users. - if ($remember) - { - $this->createRememberTokenIfDoesntExist($user); - - $this->queueRecallerCookie($user); - } - - // If we have an event dispatcher instance set we will fire an event so that - // any listeners will hook into the authentication events and run actions - // based on the login and logout events fired from the guard instances. - $this->fireLoginEvent($user, $remember); - - $this->setUser($user); - } - - /** - * Fire the login event if the dispatcher is set. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @param bool $remember - * @return void - */ - protected function fireLoginEvent($user, $remember = false) - { - if (isset($this->events)) - { - $this->events->fire('auth.login', [$user, $remember]); - } - } - - /** - * Update the session with the given ID. - * - * @param string $id - * @return void - */ - protected function updateSession($id) - { - $this->session->set($this->getName(), $id); - - $this->session->migrate(true); - } - - /** - * Log the given user ID into the application. - * - * @param mixed $id - * @param bool $remember - * @return \Illuminate\Contracts\Auth\Authenticatable - */ - public function loginUsingId($id, $remember = false) - { - $this->session->set($this->getName(), $id); - - $this->login($user = $this->provider->retrieveById($id), $remember); - - return $user; - } - - /** - * Log the given user ID into the application without sessions or cookies. - * - * @param mixed $id - * @return bool - */ - public function onceUsingId($id) - { - if ( ! is_null($user = $this->provider->retrieveById($id))) - { - $this->setUser($user); - - return true; - } - - return false; - } - - /** - * Queue the recaller cookie into the cookie jar. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @return void - */ - protected function queueRecallerCookie(UserContract $user) - { - $value = $user->getAuthIdentifier().'|'.$user->getRememberToken(); - - $this->getCookieJar()->queue($this->createRecaller($value)); - } - - /** - * Create a "remember me" cookie for a given ID. - * - * @param string $value - * @return \Symfony\Component\HttpFoundation\Cookie - */ - protected function createRecaller($value) - { - return $this->getCookieJar()->forever($this->getRecallerName(), $value); - } - - /** - * Log the user out of the application. - * - * @return void - */ - public function logout() - { - $user = $this->user(); - - // If we have an event dispatcher instance, we can fire off the logout event - // so any further processing can be done. This allows the developer to be - // listening for anytime a user signs out of this application manually. - $this->clearUserDataFromStorage(); - - if ( ! is_null($this->user)) - { - $this->refreshRememberToken($user); - } - - if (isset($this->events)) - { - $this->events->fire('auth.logout', [$user]); - } - - // Once we have fired the logout event we will clear the users out of memory - // so they are no longer available as the user is no longer considered as - // being signed into this application and should not be available here. - $this->user = null; - - $this->loggedOut = true; - } - - /** - * Remove the user data from the session and cookies. - * - * @return void - */ - protected function clearUserDataFromStorage() - { - $this->session->remove($this->getName()); - - $recaller = $this->getRecallerName(); - - $this->getCookieJar()->queue($this->getCookieJar()->forget($recaller)); - } - - /** - * Refresh the "remember me" token for the user. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @return void - */ - protected function refreshRememberToken(UserContract $user) - { - $user->setRememberToken($token = str_random(60)); - - $this->provider->updateRememberToken($user, $token); - } - - /** - * Create a new "remember me" token for the user if one doesn't already exist. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @return void - */ - protected function createRememberTokenIfDoesntExist(UserContract $user) - { - $rememberToken = $user->getRememberToken(); - - if (empty($rememberToken)) - { - $this->refreshRememberToken($user); - } - } - - /** - * Get the cookie creator instance used by the guard. - * - * @return \Illuminate\Contracts\Cookie\QueueingFactory - * - * @throws \RuntimeException - */ - public function getCookieJar() - { - if ( ! isset($this->cookie)) - { - throw new RuntimeException("Cookie jar has not been set."); - } - - return $this->cookie; - } - - /** - * Set the cookie creator instance used by the guard. - * - * @param \Illuminate\Contracts\Cookie\QueueingFactory $cookie - * @return void - */ - public function setCookieJar(CookieJar $cookie) - { - $this->cookie = $cookie; - } - - /** - * Get the event dispatcher instance. - * - * @return \Illuminate\Contracts\Events\Dispatcher - */ - public function getDispatcher() - { - return $this->events; - } - - /** - * Set the event dispatcher instance. - * - * @param \Illuminate\Contracts\Events\Dispatcher - * @return void - */ - public function setDispatcher(Dispatcher $events) - { - $this->events = $events; - } - - /** - * Get the session store used by the guard. - * - * @return \Illuminate\Session\Store - */ - public function getSession() - { - return $this->session; - } - - /** - * Get the user provider used by the guard. - * - * @return \Illuminate\Contracts\Auth\UserProvider - */ - public function getProvider() - { - return $this->provider; - } - - /** - * Set the user provider used by the guard. - * - * @param \Illuminate\Contracts\Auth\UserProvider $provider - * @return void - */ - public function setProvider(UserProvider $provider) - { - $this->provider = $provider; - } - - /** - * Return the currently cached user. - * - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function getUser() - { - return $this->user; - } - - /** - * Set the current user. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @return void - */ - public function setUser(UserContract $user) - { - $this->user = $user; - - $this->loggedOut = false; - } - - /** - * Get the current request instance. - * - * @return \Symfony\Component\HttpFoundation\Request - */ - public function getRequest() - { - return $this->request ?: Request::createFromGlobals(); - } - - /** - * Set the current request instance. - * - * @param \Symfony\Component\HttpFoundation\Request - * @return $this - */ - public function setRequest(Request $request) - { - $this->request = $request; - - return $this; - } - - /** - * Get the last user we attempted to authenticate. - * - * @return \Illuminate\Contracts\Auth\Authenticatable - */ - public function getLastAttempted() - { - return $this->lastAttempted; - } - - /** - * Get a unique identifier for the auth session value. - * - * @return string - */ - public function getName() - { - return 'login_'.md5(get_class($this)); - } - - /** - * Get the name of the cookie used to store the "recaller". - * - * @return string - */ - public function getRecallerName() - { - return 'remember_'.md5(get_class($this)); - } - - /** - * Determine if the user was authenticated via "remember me" cookie. - * - * @return bool - */ - public function viaRemember() - { - return $this->viaRemember; - } - +class Guard implements GuardContract +{ + /** + * The currently authenticated user. + * + * @var \Illuminate\Contracts\Auth\Authenticatable + */ + protected $user; + + /** + * The user we last attempted to retrieve. + * + * @var \Illuminate\Contracts\Auth\Authenticatable + */ + protected $lastAttempted; + + /** + * Indicates if the user was authenticated via a recaller cookie. + * + * @var bool + */ + protected $viaRemember = false; + + /** + * The user provider implementation. + * + * @var \Illuminate\Contracts\Auth\UserProvider + */ + protected $provider; + + /** + * The session used by the guard. + * + * @var \Symfony\Component\HttpFoundation\Session\SessionInterface + */ + protected $session; + + /** + * The Illuminate cookie creator service. + * + * @var \Illuminate\Contracts\Cookie\QueueingFactory + */ + protected $cookie; + + /** + * The request instance. + * + * @var \Symfony\Component\HttpFoundation\Request + */ + protected $request; + + /** + * The event dispatcher instance. + * + * @var \Illuminate\Contracts\Events\Dispatcher + */ + protected $events; + + /** + * Indicates if the logout method has been called. + * + * @var bool + */ + protected $loggedOut = false; + + /** + * Indicates if a token user retrieval has been attempted. + * + * @var bool + */ + protected $tokenRetrievalAttempted = false; + + /** + * Create a new authentication guard. + * + * @param \Illuminate\Contracts\Auth\UserProvider $provider + * @param \Symfony\Component\HttpFoundation\Session\SessionInterface $session + * @param \Symfony\Component\HttpFoundation\Request $request + * @return void + */ + public function __construct(UserProvider $provider, + SessionInterface $session, + Request $request = null) + { + $this->session = $session; + $this->request = $request; + $this->provider = $provider; + } + + /** + * Determine if the current user is authenticated. + * + * @return bool + */ + public function check() + { + return ! is_null($this->user()); + } + + /** + * Determine if the current user is a guest. + * + * @return bool + */ + public function guest() + { + return ! $this->check(); + } + + /** + * Get the currently authenticated user. + * + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function user() + { + if ($this->loggedOut) { + return; + } + + // If we've already retrieved the user for the current request we can just + // return it back immediately. We do not want to fetch the user data on + // every call to this method because that would be tremendously slow. + if (! is_null($this->user)) { + return $this->user; + } + + $id = $this->session->get($this->getName()); + + // First we will try to load the user using the identifier in the session if + // one exists. Otherwise we will check for a "remember me" cookie in this + // request, and if one exists, attempt to retrieve the user using that. + $user = null; + + if (! is_null($id)) { + $user = $this->provider->retrieveById($id); + } + + // If the user is null, but we decrypt a "recaller" cookie we can attempt to + // pull the user data on that cookie which serves as a remember cookie on + // the application. Once we have a user we can return it to the caller. + $recaller = $this->getRecaller(); + + if (is_null($user) && ! is_null($recaller)) { + $user = $this->getUserByRecaller($recaller); + + if ($user) { + $this->updateSession($user->getAuthIdentifier()); + + $this->fireLoginEvent($user, true); + } + } + + return $this->user = $user; + } + + /** + * Get the ID for the currently authenticated user. + * + * @return int|null + */ + public function id() + { + if ($this->loggedOut) { + return; + } + + $id = $this->session->get($this->getName()); + + if (is_null($id) && $this->user()) { + $id = $this->user()->getAuthIdentifier(); + } + + return $id; + } + + /** + * Pull a user from the repository by its recaller ID. + * + * @param string $recaller + * @return mixed + */ + protected function getUserByRecaller($recaller) + { + if ($this->validRecaller($recaller) && ! $this->tokenRetrievalAttempted) { + $this->tokenRetrievalAttempted = true; + + list($id, $token) = explode('|', $recaller, 2); + + $this->viaRemember = ! is_null($user = $this->provider->retrieveByToken($id, $token)); + + return $user; + } + } + + /** + * Get the decrypted recaller cookie for the request. + * + * @return string|null + */ + protected function getRecaller() + { + return $this->request->cookies->get($this->getRecallerName()); + } + + /** + * Get the user ID from the recaller cookie. + * + * @return string|null + */ + protected function getRecallerId() + { + if ($this->validRecaller($recaller = $this->getRecaller())) { + return head(explode('|', $recaller)); + } + } + + /** + * Determine if the recaller cookie is in a valid format. + * + * @param string $recaller + * @return bool + */ + protected function validRecaller($recaller) + { + if (! is_string($recaller) || ! Str::contains($recaller, '|')) { + return false; + } + + $segments = explode('|', $recaller); + + return count($segments) == 2 && trim($segments[0]) !== '' && trim($segments[1]) !== ''; + } + + /** + * Log a user into the application without sessions or cookies. + * + * @param array $credentials + * @return bool + */ + public function once(array $credentials = []) + { + if ($this->validate($credentials)) { + $this->setUser($this->lastAttempted); + + return true; + } + + return false; + } + + /** + * Validate a user's credentials. + * + * @param array $credentials + * @return bool + */ + public function validate(array $credentials = []) + { + return $this->attempt($credentials, false, false); + } + + /** + * Attempt to authenticate using HTTP Basic Auth. + * + * @param string $field + * @return \Symfony\Component\HttpFoundation\Response|null + */ + public function basic($field = 'email') + { + if ($this->check()) { + return; + } + + // If a username is set on the HTTP basic request, we will return out without + // interrupting the request lifecycle. Otherwise, we'll need to generate a + // request indicating that the given credentials were invalid for login. + if ($this->attemptBasic($this->getRequest(), $field)) { + return; + } + + return $this->getBasicResponse(); + } + + /** + * Perform a stateless HTTP Basic login attempt. + * + * @param string $field + * @return \Symfony\Component\HttpFoundation\Response|null + */ + public function onceBasic($field = 'email') + { + if (! $this->once($this->getBasicCredentials($this->getRequest(), $field))) { + return $this->getBasicResponse(); + } + } + + /** + * Attempt to authenticate using basic authentication. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param string $field + * @return bool + */ + protected function attemptBasic(Request $request, $field) + { + if (! $request->getUser()) { + return false; + } + + return $this->attempt($this->getBasicCredentials($request, $field)); + } + + /** + * Get the credential array for a HTTP Basic request. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param string $field + * @return array + */ + protected function getBasicCredentials(Request $request, $field) + { + return [$field => $request->getUser(), 'password' => $request->getPassword()]; + } + + /** + * Get the response for basic authentication. + * + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function getBasicResponse() + { + $headers = ['WWW-Authenticate' => 'Basic']; + + return new Response('Invalid credentials.', 401, $headers); + } + + /** + * Attempt to authenticate a user using the given credentials. + * + * @param array $credentials + * @param bool $remember + * @param bool $login + * @return bool + */ + public function attempt(array $credentials = [], $remember = false, $login = true) + { + $this->fireAttemptEvent($credentials, $remember, $login); + + $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); + + // If an implementation of UserInterface was returned, we'll ask the provider + // to validate the user against the given credentials, and if they are in + // fact valid we'll log the users into the application and return true. + if ($this->hasValidCredentials($user, $credentials)) { + if ($login) { + $this->login($user, $remember); + } + + return true; + } + + return false; + } + + /** + * Determine if the user matches the credentials. + * + * @param mixed $user + * @param array $credentials + * @return bool + */ + protected function hasValidCredentials($user, $credentials) + { + return ! is_null($user) && $this->provider->validateCredentials($user, $credentials); + } + + /** + * Fire the attempt event with the arguments. + * + * @param array $credentials + * @param bool $remember + * @param bool $login + * @return void + */ + protected function fireAttemptEvent(array $credentials, $remember, $login) + { + if ($this->events) { + $payload = [$credentials, $remember, $login]; + + $this->events->fire('auth.attempt', $payload); + } + } + + /** + * Register an authentication attempt event listener. + * + * @param mixed $callback + * @return void + */ + public function attempting($callback) + { + if ($this->events) { + $this->events->listen('auth.attempt', $callback); + } + } + + /** + * Log a user into the application. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param bool $remember + * @return void + */ + public function login(UserContract $user, $remember = false) + { + $this->updateSession($user->getAuthIdentifier()); + + // If the user should be permanently "remembered" by the application we will + // queue a permanent cookie that contains the encrypted copy of the user + // identifier. We will then decrypt this later to retrieve the users. + if ($remember) { + $this->createRememberTokenIfDoesntExist($user); + + $this->queueRecallerCookie($user); + } + + // If we have an event dispatcher instance set we will fire an event so that + // any listeners will hook into the authentication events and run actions + // based on the login and logout events fired from the guard instances. + $this->fireLoginEvent($user, $remember); + + $this->setUser($user); + } + + /** + * Fire the login event if the dispatcher is set. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param bool $remember + * @return void + */ + protected function fireLoginEvent($user, $remember = false) + { + if (isset($this->events)) { + $this->events->fire('auth.login', [$user, $remember]); + } + } + + /** + * Update the session with the given ID. + * + * @param string $id + * @return void + */ + protected function updateSession($id) + { + $this->session->set($this->getName(), $id); + + $this->session->migrate(true); + } + + /** + * Log the given user ID into the application. + * + * @param mixed $id + * @param bool $remember + * @return \Illuminate\Contracts\Auth\Authenticatable + */ + public function loginUsingId($id, $remember = false) + { + $this->session->set($this->getName(), $id); + + $this->login($user = $this->provider->retrieveById($id), $remember); + + return $user; + } + + /** + * Log the given user ID into the application without sessions or cookies. + * + * @param mixed $id + * @return bool + */ + public function onceUsingId($id) + { + if (! is_null($user = $this->provider->retrieveById($id))) { + $this->setUser($user); + + return true; + } + + return false; + } + + /** + * Queue the recaller cookie into the cookie jar. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return void + */ + protected function queueRecallerCookie(UserContract $user) + { + $value = $user->getAuthIdentifier().'|'.$user->getRememberToken(); + + $this->getCookieJar()->queue($this->createRecaller($value)); + } + + /** + * Create a "remember me" cookie for a given ID. + * + * @param string $value + * @return \Symfony\Component\HttpFoundation\Cookie + */ + protected function createRecaller($value) + { + return $this->getCookieJar()->forever($this->getRecallerName(), $value); + } + + /** + * Log the user out of the application. + * + * @return void + */ + public function logout() + { + $user = $this->user(); + + // If we have an event dispatcher instance, we can fire off the logout event + // so any further processing can be done. This allows the developer to be + // listening for anytime a user signs out of this application manually. + $this->clearUserDataFromStorage(); + + if (! is_null($this->user)) { + $this->refreshRememberToken($user); + } + + if (isset($this->events)) { + $this->events->fire('auth.logout', [$user]); + } + + // Once we have fired the logout event we will clear the users out of memory + // so they are no longer available as the user is no longer considered as + // being signed into this application and should not be available here. + $this->user = null; + + $this->loggedOut = true; + } + + /** + * Remove the user data from the session and cookies. + * + * @return void + */ + protected function clearUserDataFromStorage() + { + $this->session->remove($this->getName()); + + if (! is_null($this->getRecaller())) { + $recaller = $this->getRecallerName(); + + $this->getCookieJar()->queue($this->getCookieJar()->forget($recaller)); + } + } + + /** + * Refresh the "remember me" token for the user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return void + */ + protected function refreshRememberToken(UserContract $user) + { + $user->setRememberToken($token = Str::random(60)); + + $this->provider->updateRememberToken($user, $token); + } + + /** + * Create a new "remember me" token for the user if one doesn't already exist. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return void + */ + protected function createRememberTokenIfDoesntExist(UserContract $user) + { + if (empty($user->getRememberToken())) { + $this->refreshRememberToken($user); + } + } + + /** + * Get the cookie creator instance used by the guard. + * + * @return \Illuminate\Contracts\Cookie\QueueingFactory + * + * @throws \RuntimeException + */ + public function getCookieJar() + { + if (! isset($this->cookie)) { + throw new RuntimeException('Cookie jar has not been set.'); + } + + return $this->cookie; + } + + /** + * Set the cookie creator instance used by the guard. + * + * @param \Illuminate\Contracts\Cookie\QueueingFactory $cookie + * @return void + */ + public function setCookieJar(CookieJar $cookie) + { + $this->cookie = $cookie; + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getDispatcher() + { + return $this->events; + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function setDispatcher(Dispatcher $events) + { + $this->events = $events; + } + + /** + * Get the session store used by the guard. + * + * @return \Illuminate\Session\Store + */ + public function getSession() + { + return $this->session; + } + + /** + * Get the user provider used by the guard. + * + * @return \Illuminate\Contracts\Auth\UserProvider + */ + public function getProvider() + { + return $this->provider; + } + + /** + * Set the user provider used by the guard. + * + * @param \Illuminate\Contracts\Auth\UserProvider $provider + * @return void + */ + public function setProvider(UserProvider $provider) + { + $this->provider = $provider; + } + + /** + * Return the currently cached user. + * + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function getUser() + { + return $this->user; + } + + /** + * Set the current user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return void + */ + public function setUser(UserContract $user) + { + $this->user = $user; + + $this->loggedOut = false; + } + + /** + * Get the current request instance. + * + * @return \Symfony\Component\HttpFoundation\Request + */ + public function getRequest() + { + return $this->request ?: Request::createFromGlobals(); + } + + /** + * Set the current request instance. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return $this + */ + public function setRequest(Request $request) + { + $this->request = $request; + + return $this; + } + + /** + * Get the last user we attempted to authenticate. + * + * @return \Illuminate\Contracts\Auth\Authenticatable + */ + public function getLastAttempted() + { + return $this->lastAttempted; + } + + /** + * Get a unique identifier for the auth session value. + * + * @return string + */ + public function getName() + { + return 'login_'.md5(get_class($this)); + } + + /** + * Get the name of the cookie used to store the "recaller". + * + * @return string + */ + public function getRecallerName() + { + return 'remember_'.md5(get_class($this)); + } + + /** + * Determine if the user was authenticated via "remember me" cookie. + * + * @return bool + */ + public function viaRemember() + { + return $this->viaRemember; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php b/application/vendor/laravel/framework/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php index f861805..a2418b3 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php @@ -1,39 +1,39 @@ -auth = $auth; - } +class AuthenticateWithBasicAuth +{ + /** + * The guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - return $this->auth->basic() ?: $next($request); - } + /** + * Create a new middleware instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * @return void + */ + public function __construct(Guard $auth) + { + $this->auth = $auth; + } + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + return $this->auth->basic() ?: $next($request); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/CanResetPassword.php b/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/CanResetPassword.php index ad59a98..d5d8e16 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/CanResetPassword.php +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/CanResetPassword.php @@ -1,15 +1,16 @@ -email; - } +namespace Illuminate\Auth\Passwords; +trait CanResetPassword +{ + /** + * Get the e-mail address where password reset links are sent. + * + * @return string + */ + public function getEmailForPasswordReset() + { + return $this->email; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php b/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php index c0efced..db93cf9 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php @@ -1,192 +1,193 @@ -table = $table; - $this->hashKey = $hashKey; - $this->expires = $expires * 60; - $this->connection = $connection; - } - - /** - * Create a new token record. - * - * @param \Illuminate\Contracts\Auth\CanResetPassword $user - * @return string - */ - public function create(CanResetPasswordContract $user) - { - $email = $user->getEmailForPasswordReset(); - - $this->deleteExisting($user); - - // We will create a new, random token for the user so that we can e-mail them - // a safe link to the password reset form. Then we will insert a record in - // the database so that we can verify the token within the actual reset. - $token = $this->createNewToken($user); - - $this->getTable()->insert($this->getPayload($email, $token)); - - return $token; - } - - /** - * Delete all existing reset tokens from the database. - * - * @param \Illuminate\Contracts\Auth\CanResetPassword $user - * @return int - */ - protected function deleteExisting(CanResetPasswordContract $user) - { - return $this->getTable()->where('email', $user->getEmailForPasswordReset())->delete(); - } - - /** - * Build the record payload for the table. - * - * @param string $email - * @param string $token - * @return array - */ - protected function getPayload($email, $token) - { - return ['email' => $email, 'token' => $token, 'created_at' => new Carbon]; - } - - /** - * Determine if a token record exists and is valid. - * - * @param \Illuminate\Contracts\Auth\CanResetPassword $user - * @param string $token - * @return bool - */ - public function exists(CanResetPasswordContract $user, $token) - { - $email = $user->getEmailForPasswordReset(); - - $token = (array) $this->getTable()->where('email', $email)->where('token', $token)->first(); - - return $token && ! $this->tokenExpired($token); - } - - /** - * Determine if the token has expired. - * - * @param array $token - * @return bool - */ - protected function tokenExpired($token) - { - $expirationTime = strtotime($token['created_at']) + $this->expires; - - return $expirationTime < $this->getCurrentTime(); - } - - /** - * Get the current UNIX timestamp. - * - * @return int - */ - protected function getCurrentTime() - { - return time(); - } - - /** - * Delete a token record by token. - * - * @param string $token - * @return void - */ - public function delete($token) - { - $this->getTable()->where('token', $token)->delete(); - } - - /** - * Delete expired tokens. - * - * @return void - */ - public function deleteExpired() - { - $expiredAt = Carbon::now()->subSeconds($this->expires); - - $this->getTable()->where('created_at', '<', $expiredAt)->delete(); - } - - /** - * Create a new token for the user. - * - * @param \Illuminate\Contracts\Auth\CanResetPassword $user - * @return string - */ - public function createNewToken(CanResetPasswordContract $user) - { - return hash_hmac('sha256', str_random(40), $this->hashKey); - } - - /** - * Begin a new database query against the table. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function getTable() - { - return $this->connection->table($this->table); - } - - /** - * Get the database connection instance. - * - * @return \Illuminate\Database\ConnectionInterface - */ - public function getConnection() - { - return $this->connection; - } - +class DatabaseTokenRepository implements TokenRepositoryInterface +{ + /** + * The database connection instance. + * + * @var \Illuminate\Database\ConnectionInterface + */ + protected $connection; + + /** + * The token database table. + * + * @var string + */ + protected $table; + + /** + * The hashing key. + * + * @var string + */ + protected $hashKey; + + /** + * The number of seconds a token should last. + * + * @var int + */ + protected $expires; + + /** + * Create a new token repository instance. + * + * @param \Illuminate\Database\ConnectionInterface $connection + * @param string $table + * @param string $hashKey + * @param int $expires + * @return void + */ + public function __construct(ConnectionInterface $connection, $table, $hashKey, $expires = 60) + { + $this->table = $table; + $this->hashKey = $hashKey; + $this->expires = $expires * 60; + $this->connection = $connection; + } + + /** + * Create a new token record. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @return string + */ + public function create(CanResetPasswordContract $user) + { + $email = $user->getEmailForPasswordReset(); + + $this->deleteExisting($user); + + // We will create a new, random token for the user so that we can e-mail them + // a safe link to the password reset form. Then we will insert a record in + // the database so that we can verify the token within the actual reset. + $token = $this->createNewToken(); + + $this->getTable()->insert($this->getPayload($email, $token)); + + return $token; + } + + /** + * Delete all existing reset tokens from the database. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @return int + */ + protected function deleteExisting(CanResetPasswordContract $user) + { + return $this->getTable()->where('email', $user->getEmailForPasswordReset())->delete(); + } + + /** + * Build the record payload for the table. + * + * @param string $email + * @param string $token + * @return array + */ + protected function getPayload($email, $token) + { + return ['email' => $email, 'token' => $token, 'created_at' => new Carbon]; + } + + /** + * Determine if a token record exists and is valid. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @param string $token + * @return bool + */ + public function exists(CanResetPasswordContract $user, $token) + { + $email = $user->getEmailForPasswordReset(); + + $token = (array) $this->getTable()->where('email', $email)->where('token', $token)->first(); + + return $token && ! $this->tokenExpired($token); + } + + /** + * Determine if the token has expired. + * + * @param array $token + * @return bool + */ + protected function tokenExpired($token) + { + $expirationTime = strtotime($token['created_at']) + $this->expires; + + return $expirationTime < $this->getCurrentTime(); + } + + /** + * Get the current UNIX timestamp. + * + * @return int + */ + protected function getCurrentTime() + { + return time(); + } + + /** + * Delete a token record by token. + * + * @param string $token + * @return void + */ + public function delete($token) + { + $this->getTable()->where('token', $token)->delete(); + } + + /** + * Delete expired tokens. + * + * @return void + */ + public function deleteExpired() + { + $expiredAt = Carbon::now()->subSeconds($this->expires); + + $this->getTable()->where('created_at', '<', $expiredAt)->delete(); + } + + /** + * Create a new token for the user. + * + * @return string + */ + public function createNewToken() + { + return hash_hmac('sha256', Str::random(40), $this->hashKey); + } + + /** + * Begin a new database query against the table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function getTable() + { + return $this->connection->table($this->table); + } + + /** + * Get the database connection instance. + * + * @return \Illuminate\Database\ConnectionInterface + */ + public function getConnection() + { + return $this->connection; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBroker.php b/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBroker.php index 55b8043..2fecd5b 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBroker.php +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBroker.php @@ -1,260 +1,253 @@ -users = $users; - $this->mailer = $mailer; - $this->tokens = $tokens; - $this->emailView = $emailView; - } - - /** - * Send a password reset link to a user. - * - * @param array $credentials - * @param \Closure|null $callback - * @return string - */ - public function sendResetLink(array $credentials, Closure $callback = null) - { - // First we will check to see if we found a user at the given credentials and - // if we did not we will redirect back to this current URI with a piece of - // "flash" data in the session to indicate to the developers the errors. - $user = $this->getUser($credentials); - - if (is_null($user)) - { - return PasswordBrokerContract::INVALID_USER; - } - - // Once we have the reset token, we are ready to send the message out to this - // user with a link to reset their password. We will then redirect back to - // the current URI having nothing set in the session to indicate errors. - $token = $this->tokens->create($user); - - $this->emailResetLink($user, $token, $callback); - - return PasswordBrokerContract::RESET_LINK_SENT; - } - - /** - * Send the password reset link via e-mail. - * - * @param \Illuminate\Contracts\Auth\CanResetPassword $user - * @param string $token - * @param \Closure|null $callback - * @return int - */ - public function emailResetLink(CanResetPasswordContract $user, $token, Closure $callback = null) - { - // We will use the reminder view that was given to the broker to display the - // password reminder e-mail. We'll pass a "token" variable into the views - // so that it may be displayed for an user to click for password reset. - $view = $this->emailView; - - return $this->mailer->send($view, compact('token', 'user'), function($m) use ($user, $token, $callback) - { - $m->to($user->getEmailForPasswordReset()); - - if ( ! is_null($callback)) - { - call_user_func($callback, $m, $user, $token); - } - }); - } - - /** - * Reset the password for the given token. - * - * @param array $credentials - * @param \Closure $callback - * @return mixed - */ - public function reset(array $credentials, Closure $callback) - { - // If the responses from the validate method is not a user instance, we will - // assume that it is a redirect and simply return it from this method and - // the user is properly redirected having an error message on the post. - $user = $this->validateReset($credentials); - - if ( ! $user instanceof CanResetPasswordContract) - { - return $user; - } - - $pass = $credentials['password']; - - // Once we have called this callback, we will remove this token row from the - // table and return the response from this callback so the user gets sent - // to the destination given by the developers from the callback return. - call_user_func($callback, $user, $pass); - - $this->tokens->delete($credentials['token']); - - return PasswordBrokerContract::PASSWORD_RESET; - } - - /** - * Validate a password reset for the given credentials. - * - * @param array $credentials - * @return \Illuminate\Contracts\Auth\CanResetPassword - */ - protected function validateReset(array $credentials) - { - if (is_null($user = $this->getUser($credentials))) - { - return PasswordBrokerContract::INVALID_USER; - } - - if ( ! $this->validateNewPassword($credentials)) - { - return PasswordBrokerContract::INVALID_PASSWORD; - } - - if ( ! $this->tokens->exists($user, $credentials['token'])) - { - return PasswordBrokerContract::INVALID_TOKEN; - } - - return $user; - } - - /** - * Set a custom password validator. - * - * @param \Closure $callback - * @return void - */ - public function validator(Closure $callback) - { - $this->passwordValidator = $callback; - } - - /** - * Determine if the passwords match for the request. - * - * @param array $credentials - * @return bool - */ - public function validateNewPassword(array $credentials) - { - list($password, $confirm) = [ - $credentials['password'], - $credentials['password_confirmation'], - ]; - - if (isset($this->passwordValidator)) - { - return call_user_func( - $this->passwordValidator, $credentials) && $password === $confirm; - } - - return $this->validatePasswordWithDefaults($credentials); - } - - /** - * Determine if the passwords are valid for the request. - * - * @param array $credentials - * @return bool - */ - protected function validatePasswordWithDefaults(array $credentials) - { - list($password, $confirm) = [ - $credentials['password'], - $credentials['password_confirmation'], - ]; - - return $password === $confirm && mb_strlen($password) >= 6; - } - - /** - * Get the user for the given credentials. - * - * @param array $credentials - * @return \Illuminate\Contracts\Auth\CanResetPassword - * - * @throws \UnexpectedValueException - */ - public function getUser(array $credentials) - { - $credentials = array_except($credentials, ['token']); - - $user = $this->users->retrieveByCredentials($credentials); - - if ($user && ! $user instanceof CanResetPasswordContract) - { - throw new UnexpectedValueException("User must implement CanResetPassword interface."); - } - - return $user; - } - - /** - * Get the password reset token repository implementation. - * - * @return \Illuminate\Auth\Passwords\TokenRepositoryInterface - */ - protected function getRepository() - { - return $this->tokens; - } - + { + $this->users = $users; + $this->mailer = $mailer; + $this->tokens = $tokens; + $this->emailView = $emailView; + } + + /** + * Send a password reset link to a user. + * + * @param array $credentials + * @param \Closure|null $callback + * @return string + */ + public function sendResetLink(array $credentials, Closure $callback = null) + { + // First we will check to see if we found a user at the given credentials and + // if we did not we will redirect back to this current URI with a piece of + // "flash" data in the session to indicate to the developers the errors. + $user = $this->getUser($credentials); + + if (is_null($user)) { + return PasswordBrokerContract::INVALID_USER; + } + + // Once we have the reset token, we are ready to send the message out to this + // user with a link to reset their password. We will then redirect back to + // the current URI having nothing set in the session to indicate errors. + $token = $this->tokens->create($user); + + $this->emailResetLink($user, $token, $callback); + + return PasswordBrokerContract::RESET_LINK_SENT; + } + + /** + * Send the password reset link via e-mail. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @param string $token + * @param \Closure|null $callback + * @return int + */ + public function emailResetLink(CanResetPasswordContract $user, $token, Closure $callback = null) + { + // We will use the reminder view that was given to the broker to display the + // password reminder e-mail. We'll pass a "token" variable into the views + // so that it may be displayed for an user to click for password reset. + $view = $this->emailView; + + return $this->mailer->send($view, compact('token', 'user'), function ($m) use ($user, $token, $callback) { + $m->to($user->getEmailForPasswordReset()); + + if (! is_null($callback)) { + call_user_func($callback, $m, $user, $token); + } + }); + } + + /** + * Reset the password for the given token. + * + * @param array $credentials + * @param \Closure $callback + * @return mixed + */ + public function reset(array $credentials, Closure $callback) + { + // If the responses from the validate method is not a user instance, we will + // assume that it is a redirect and simply return it from this method and + // the user is properly redirected having an error message on the post. + $user = $this->validateReset($credentials); + + if (! $user instanceof CanResetPasswordContract) { + return $user; + } + + $pass = $credentials['password']; + + // Once we have called this callback, we will remove this token row from the + // table and return the response from this callback so the user gets sent + // to the destination given by the developers from the callback return. + call_user_func($callback, $user, $pass); + + $this->tokens->delete($credentials['token']); + + return PasswordBrokerContract::PASSWORD_RESET; + } + + /** + * Validate a password reset for the given credentials. + * + * @param array $credentials + * @return \Illuminate\Contracts\Auth\CanResetPassword + */ + protected function validateReset(array $credentials) + { + if (is_null($user = $this->getUser($credentials))) { + return PasswordBrokerContract::INVALID_USER; + } + + if (! $this->validateNewPassword($credentials)) { + return PasswordBrokerContract::INVALID_PASSWORD; + } + + if (! $this->tokens->exists($user, $credentials['token'])) { + return PasswordBrokerContract::INVALID_TOKEN; + } + + return $user; + } + + /** + * Set a custom password validator. + * + * @param \Closure $callback + * @return void + */ + public function validator(Closure $callback) + { + $this->passwordValidator = $callback; + } + + /** + * Determine if the passwords match for the request. + * + * @param array $credentials + * @return bool + */ + public function validateNewPassword(array $credentials) + { + list($password, $confirm) = [ + $credentials['password'], + $credentials['password_confirmation'], + ]; + + if (isset($this->passwordValidator)) { + return call_user_func( + $this->passwordValidator, $credentials) && $password === $confirm; + } + + return $this->validatePasswordWithDefaults($credentials); + } + + /** + * Determine if the passwords are valid for the request. + * + * @param array $credentials + * @return bool + */ + protected function validatePasswordWithDefaults(array $credentials) + { + list($password, $confirm) = [ + $credentials['password'], + $credentials['password_confirmation'], + ]; + + return $password === $confirm && mb_strlen($password) >= 6; + } + + /** + * Get the user for the given credentials. + * + * @param array $credentials + * @return \Illuminate\Contracts\Auth\CanResetPassword + * + * @throws \UnexpectedValueException + */ + public function getUser(array $credentials) + { + $credentials = Arr::except($credentials, ['token']); + + $user = $this->users->retrieveByCredentials($credentials); + + if ($user && ! $user instanceof CanResetPasswordContract) { + throw new UnexpectedValueException('User must implement CanResetPassword interface.'); + } + + return $user; + } + + /** + * Get the password reset token repository implementation. + * + * @return \Illuminate\Auth\Passwords\TokenRepositoryInterface + */ + protected function getRepository() + { + return $this->tokens; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php index 5615ec6..2da8f7d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php @@ -1,88 +1,87 @@ -registerPasswordBroker(); - - $this->registerTokenRepository(); - } - - /** - * Register the password broker instance. - * - * @return void - */ - protected function registerPasswordBroker() - { - $this->app->singleton('auth.password', function($app) - { - // The password token repository is responsible for storing the email addresses - // and password reset tokens. It will be used to verify the tokens are valid - // for the given e-mail addresses. We will resolve an implementation here. - $tokens = $app['auth.password.tokens']; - - $users = $app['auth']->driver()->getProvider(); - - $view = $app['config']['auth.password.email']; - - // The password broker uses a token repository to validate tokens and send user - // password e-mails, as well as validating that password reset process as an - // aggregate service of sorts providing a convenient interface for resets. - return new PasswordBroker( - $tokens, $users, $app['mailer'], $view - ); - }); - } - - /** - * Register the token repository implementation. - * - * @return void - */ - protected function registerTokenRepository() - { - $this->app->singleton('auth.password.tokens', function($app) - { - $connection = $app['db']->connection(); - - // The database token repository is an implementation of the token repository - // interface, and is responsible for the actual storing of auth tokens and - // their e-mail addresses. We will inject this table and hash key to it. - $table = $app['config']['auth.password.table']; - - $key = $app['config']['app.key']; - - $expire = $app['config']->get('auth.password.expire', 60); - - return new DbRepository($connection, $table, $key, $expire); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return ['auth.password', 'auth.password.tokens']; - } - +class PasswordResetServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerPasswordBroker(); + + $this->registerTokenRepository(); + } + + /** + * Register the password broker instance. + * + * @return void + */ + protected function registerPasswordBroker() + { + $this->app->singleton('auth.password', function ($app) { + // The password token repository is responsible for storing the email addresses + // and password reset tokens. It will be used to verify the tokens are valid + // for the given e-mail addresses. We will resolve an implementation here. + $tokens = $app['auth.password.tokens']; + + $users = $app['auth']->driver()->getProvider(); + + $view = $app['config']['auth.password.email']; + + // The password broker uses a token repository to validate tokens and send user + // password e-mails, as well as validating that password reset process as an + // aggregate service of sorts providing a convenient interface for resets. + return new PasswordBroker( + $tokens, $users, $app['mailer'], $view + ); + }); + } + + /** + * Register the token repository implementation. + * + * @return void + */ + protected function registerTokenRepository() + { + $this->app->singleton('auth.password.tokens', function ($app) { + $connection = $app['db']->connection(); + + // The database token repository is an implementation of the token repository + // interface, and is responsible for the actual storing of auth tokens and + // their e-mail addresses. We will inject this table and hash key to it. + $table = $app['config']['auth.password.table']; + + $key = $app['config']['app.key']; + + $expire = $app['config']->get('auth.password.expire', 60); + + return new DbRepository($connection, $table, $key, $expire); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['auth.password', 'auth.password.tokens']; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php b/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php index 06609d0..0570773 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php @@ -1,39 +1,40 @@ -=5.4.0", - "illuminate/contracts": "5.0.*", - "illuminate/http": "5.0.*", - "illuminate/session": "5.0.*", - "illuminate/support": "5.0.*", - "nesbot/carbon": "~1.0" + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*", + "illuminate/http": "5.1.*", + "illuminate/session": "5.1.*", + "illuminate/support": "5.1.*", + "nesbot/carbon": "~1.19" }, "autoload": { "psr-4": { @@ -28,11 +28,11 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "suggest": { - "illuminate/console": "Required to use the auth:clear-resets command (5.0.*)." + "illuminate/console": "Required to use the auth:clear-resets command (5.1.*)." }, "minimum-stability": "dev" } diff --git a/application/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php b/application/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php new file mode 100644 index 0000000..1b6bad9 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php @@ -0,0 +1,87 @@ +broadcaster = $broadcaster; + } + + /** + * Handle the queued job. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param array $data + * @return void + */ + public function fire(Job $job, array $data) + { + $event = unserialize($data['event']); + + $name = method_exists($event, 'broadcastAs') + ? $event->broadcastAs() : get_class($event); + + $this->broadcaster->broadcast( + $event->broadcastOn(), $name, $this->getPayloadFromEvent($event) + ); + + $job->delete(); + } + + /** + * Get the payload for the given event. + * + * @param mixed $event + * @return array + */ + protected function getPayloadFromEvent($event) + { + if (method_exists($event, 'broadcastWith')) { + return $event->broadcastWith(); + } + + $payload = []; + + foreach ((new ReflectionClass($event))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { + $payload[$property->getName()] = $this->formatProperty($property->getValue($event)); + } + + return $payload; + } + + /** + * Format the given value for a property. + * + * @param mixed $value + * @return mixed + */ + protected function formatProperty($value) + { + if ($value instanceof Arrayable) { + return $value->toArray(); + } + + return $value; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php b/application/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php new file mode 100644 index 0000000..97a0fe5 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php @@ -0,0 +1,219 @@ +app = $app; + } + + /** + * Get a driver instance. + * + * @param string $driver + * @return mixed + */ + public function connection($driver = null) + { + return $this->driver($driver); + } + + /** + * Get a driver instance. + * + * @param string $name + * @return mixed + */ + public function driver($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + return $this->drivers[$name] = $this->get($name); + } + + /** + * Attempt to get the connection from the local cache. + * + * @param string $name + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + */ + protected function get($name) + { + return isset($this->drivers[$name]) ? $this->drivers[$name] : $this->resolve($name); + } + + /** + * Resolve the given store. + * + * @param string $name + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + if (is_null($config)) { + throw new InvalidArgumentException("Broadcaster [{$name}] is not defined."); + } + + if (isset($this->customCreators[$config['driver']])) { + return $this->callCustomCreator($config); + } else { + $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; + + if (method_exists($this, $driverMethod)) { + return $this->{$driverMethod}($config); + } else { + throw new InvalidArgumentException("Driver [{$config['driver']}] not supported."); + } + } + } + + /** + * Call a custom driver creator. + * + * @param array $config + * @return mixed + */ + protected function callCustomCreator(array $config) + { + return $this->customCreators[$config['driver']]($this->app, $config); + } + + /** + * Create an instance of the driver. + * + * @param array $config + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + */ + protected function createPusherDriver(array $config) + { + return new PusherBroadcaster( + new Pusher($config['key'], $config['secret'], $config['app_id'], Arr::get($config, 'options', [])) + ); + } + + /** + * Create an instance of the driver. + * + * @param array $config + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + */ + protected function createRedisDriver(array $config) + { + return new RedisBroadcaster( + $this->app->make('redis'), Arr::get($config, 'connection') + ); + } + + /** + * Create an instance of the driver. + * + * @param array $config + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + */ + protected function createLogDriver(array $config) + { + return new LogBroadcaster( + $this->app->make('Psr\Log\LoggerInterface') + ); + } + + /** + * Get the connection configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + return $this->app['config']["broadcasting.connections.{$name}"]; + } + + /** + * Get the default driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['broadcasting.default']; + } + + /** + * Set the default driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['broadcasting.default'] = $name; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback; + + return $this; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return call_user_func_array([$this->driver(), $method], $parameters); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastServiceProvider.php new file mode 100644 index 0000000..c6f14fe --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastServiceProvider.php @@ -0,0 +1,49 @@ +app->singleton('Illuminate\Broadcasting\BroadcastManager', function ($app) { + return new BroadcastManager($app); + }); + + $this->app->singleton('Illuminate\Contracts\Broadcasting\Broadcaster', function ($app) { + return $app->make('Illuminate\Broadcasting\BroadcastManager')->connection(); + }); + + $this->app->alias( + 'Illuminate\Broadcasting\BroadcastManager', 'Illuminate\Contracts\Broadcasting\Factory' + ); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'Illuminate\Broadcasting\BroadcastManager', + 'Illuminate\Contracts\Broadcasting\Factory', + 'Illuminate\Contracts\Broadcasting\Broadcaster', + ]; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php b/application/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php new file mode 100644 index 0000000..6b90492 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php @@ -0,0 +1,39 @@ +logger = $logger; + } + + /** + * {@inheritdoc} + */ + public function broadcast(array $channels, $event, array $payload = []) + { + $channels = implode(', ', $channels); + + $payload = json_encode($payload, JSON_PRETTY_PRINT); + + $this->logger->info('Broadcasting ['.$event.'] on channels ['.$channels.'] with payload:'.PHP_EOL.$payload); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php b/application/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php new file mode 100644 index 0000000..cea2d38 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php @@ -0,0 +1,45 @@ +pusher = $pusher; + } + + /** + * {@inheritdoc} + */ + public function broadcast(array $channels, $event, array $payload = []) + { + $this->pusher->trigger($channels, $event, $payload); + } + + /** + * Get the Pusher SDK instance. + * + * @return \Pusher + */ + public function getPusher() + { + return $this->pusher; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php b/application/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php new file mode 100644 index 0000000..91c7c61 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php @@ -0,0 +1,50 @@ +redis = $redis; + $this->connection = $connection; + } + + /** + * {@inheritdoc} + */ + public function broadcast(array $channels, $event, array $payload = []) + { + $connection = $this->redis->connection($this->connection); + + $payload = json_encode(['event' => $event, 'data' => $payload]); + + foreach ($channels as $channel) { + $connection->publish($channel, $payload); + } + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Broadcasting/composer.json b/application/vendor/laravel/framework/src/Illuminate/Broadcasting/composer.json new file mode 100644 index 0000000..c3e89d1 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Broadcasting/composer.json @@ -0,0 +1,35 @@ +{ + "name": "illuminate/broadcasting", + "description": "The Illuminate Broadcasting package.", + "license": "MIT", + "homepage": "http://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" + } + ], + "require": { + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*" + }, + "autoload": { + "psr-4": { + "Illuminate\\Broadcasting\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "suggest": { + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0)." + }, + "minimum-stability": "dev" +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Bus/BusServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Bus/BusServiceProvider.php index e63d61f..55eeb2a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Bus/BusServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Bus/BusServiceProvider.php @@ -1,52 +1,51 @@ -app->singleton('Illuminate\Bus\Dispatcher', function($app) - { - return new Dispatcher($app, function() use ($app) - { - return $app['Illuminate\Contracts\Queue\Queue']; - }); - }); +namespace Illuminate\Bus; - $this->app->alias( - 'Illuminate\Bus\Dispatcher', 'Illuminate\Contracts\Bus\Dispatcher' - ); - - $this->app->alias( - 'Illuminate\Bus\Dispatcher', 'Illuminate\Contracts\Bus\QueueingDispatcher' - ); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - 'Illuminate\Bus\Dispatcher', - 'Illuminate\Contracts\Bus\Dispatcher', - 'Illuminate\Contracts\Bus\QueueingDispatcher', - ]; - } +use Illuminate\Support\ServiceProvider; +class BusServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton('Illuminate\Bus\Dispatcher', function ($app) { + return new Dispatcher($app, function () use ($app) { + return $app['Illuminate\Contracts\Queue\Queue']; + }); + }); + + $this->app->alias( + 'Illuminate\Bus\Dispatcher', 'Illuminate\Contracts\Bus\Dispatcher' + ); + + $this->app->alias( + 'Illuminate\Bus\Dispatcher', 'Illuminate\Contracts\Bus\QueueingDispatcher' + ); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'Illuminate\Bus\Dispatcher', + 'Illuminate\Contracts\Bus\Dispatcher', + 'Illuminate\Contracts\Bus\QueueingDispatcher', + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php b/application/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php index 2e254ff..cecf9f1 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php +++ b/application/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php @@ -1,4 +1,6 @@ -container = $container; - $this->queueResolver = $queueResolver; - $this->pipeline = new Pipeline($container); - } - - /** - * Marshal a command and dispatch it to its appropriate handler. - * - * @param mixed $command - * @param array $array - * @return mixed - */ - public function dispatchFromArray($command, array $array) - { - return $this->dispatch($this->marshalFromArray($command, $array)); - } - - /** - * Marshal a command and dispatch it to its appropriate handler. - * - * @param mixed $command - * @param \ArrayAccess $source - * @param array $extras - * @return mixed - */ - public function dispatchFrom($command, ArrayAccess $source, array $extras = []) - { - return $this->dispatch($this->marshal($command, $source, $extras)); - } - - /** - * Marshal a command from the given array. - * - * @param string $command - * @param array $array - * @return mixed - */ - protected function marshalFromArray($command, array $array) - { - return $this->marshal($command, new Collection, $array); - } - - /** - * Marshal a command from the given array accessible object. - * - * @param string $command - * @param \ArrayAccess $source - * @param array $extras - * @return mixed - */ - protected function marshal($command, ArrayAccess $source, array $extras = []) - { - $injected = []; - - $reflection = new ReflectionClass($command); - - if ($constructor = $reflection->getConstructor()) - { - $injected = array_map(function($parameter) use ($command, $source, $extras) - { - return $this->getParameterValueForCommand($command, $source, $parameter, $extras); - - }, $constructor->getParameters()); - } - - return $reflection->newInstanceArgs($injected); - } - - /** - * Get a parameter value for a marshaled command. - * - * @param string $command - * @param \ArrayAccess $source - * @param \ReflectionParameter $parameter - * @param array $extras - * @return mixed - */ - protected function getParameterValueForCommand($command, ArrayAccess $source, - ReflectionParameter $parameter, array $extras = array()) - { - if (array_key_exists($parameter->name, $extras)) - { - return $extras[$parameter->name]; - } - - if (isset($source[$parameter->name])) - { - return $source[$parameter->name]; - } - - if ($parameter->isDefaultValueAvailable()) - { - return $parameter->getDefaultValue(); - } - - MarshalException::whileMapping($command, $parameter); - } - - /** - * Dispatch a command to its appropriate handler. - * - * @param mixed $command - * @param \Closure|null $afterResolving - * @return mixed - */ - public function dispatch($command, Closure $afterResolving = null) - { - if ($this->queueResolver && $this->commandShouldBeQueued($command)) - { - return $this->dispatchToQueue($command); - } - else - { - return $this->dispatchNow($command, $afterResolving); - } - } - - /** - * Dispatch a command to its appropriate handler in the current process. - * - * @param mixed $command - * @param \Closure|null $afterResolving - * @return mixed - */ - public function dispatchNow($command, Closure $afterResolving = null) - { - return $this->pipeline->send($command)->through($this->pipes)->then(function($command) use ($afterResolving) - { - if ($command instanceof SelfHandling) - { - return $this->container->call([$command, 'handle']); - } - - $handler = $this->resolveHandler($command); - - if ($afterResolving) - { - call_user_func($afterResolving, $handler); - } - - return call_user_func( - [$handler, $this->getHandlerMethod($command)], $command - ); - }); - - } - - /** - * Determine if the given command should be queued. - * - * @param mixed $command - * @return bool - */ - protected function commandShouldBeQueued($command) - { - if ($command instanceof ShouldBeQueued) - { - return true; - } - - return (new ReflectionClass($this->getHandlerClass($command)))->implementsInterface( - 'Illuminate\Contracts\Queue\ShouldBeQueued' - ); - } - - /** - * Dispatch a command to its appropriate handler behind a queue. - * - * @param mixed $command - * @return mixed - * - * @throws \RuntimeException - */ - public function dispatchToQueue($command) - { - $queue = call_user_func($this->queueResolver); - - if ( ! $queue instanceof Queue) - { - throw new RuntimeException("Queue resolver did not return a Queue implementation."); - } - - if (method_exists($command, 'queue')) - { - $command->queue($queue, $command); - } - else - { - $queue->push($command); - } - } - - /** - * Get the handler instance for the given command. - * - * @param mixed $command - * @return mixed - */ - public function resolveHandler($command) - { - if ($command instanceof SelfHandling) - { - return $command; - } - - return $this->container->make($this->getHandlerClass($command)); - } - - /** - * Get the handler class for the given command. - * - * @param mixed $command - * @return string - */ - public function getHandlerClass($command) - { - if ($command instanceof SelfHandling) - { - return get_class($command); - } - - return $this->inflectSegment($command, 0); - } - - /** - * Get the handler method for the given command. - * - * @param mixed $command - * @return string - */ - public function getHandlerMethod($command) - { - if ($command instanceof SelfHandling) - { - return 'handle'; - } - - return $this->inflectSegment($command, 1); - } - - /** - * Get the given handler segment for the given command. - * - * @param mixed $command - * @param int $segment - * @return string - */ - protected function inflectSegment($command, $segment) - { - $className = get_class($command); - - if (isset($this->mappings[$className])) - { - return $this->getMappingSegment($className, $segment); - } - elseif ($this->mapper) - { - return $this->getMapperSegment($command, $segment); - } - - throw new InvalidArgumentException("No handler registered for command [{$className}]"); - } - - /** - * Get the given segment from a given class handler. - * - * @param string $className - * @param int $segment - * @return string - */ - protected function getMappingSegment($className, $segment) - { - return explode('@', $this->mappings[$className])[$segment]; - } - - /** - * Get the given segment from a given class handler using the custom mapper. - * - * @param mixed $command - * @param int $segment - * @return string - */ - protected function getMapperSegment($command, $segment) - { - return explode('@', call_user_func($this->mapper, $command))[$segment]; - } - - /** - * Register command-to-handler mappings. - * - * @param array $commands - * @return void - */ - public function maps(array $commands) - { - $this->mappings = array_merge($this->mappings, $commands); - } - - /** - * Register a fallback mapper callback. - * - * @param \Closure $mapper - * @return void - */ - public function mapUsing(Closure $mapper) - { - $this->mapper = $mapper; - } - - /** - * Map the command to a handler within a given root namespace. - * - * @param mixed $command - * @param string $commandNamespace - * @param string $handlerNamespace - * @return string - */ - public static function simpleMapping($command, $commandNamespace, $handlerNamespace) - { - $command = str_replace($commandNamespace, '', get_class($command)); - - return $handlerNamespace.'\\'.trim($command, '\\').'Handler@handle'; - } - - /** - * Set the pipes through which commands should be piped before dispatching. - * - * @param array $pipes - * @return $this - */ - public function pipeThrough(array $pipes) - { - $this->pipes = $pipes; - - return $this; - } - +class Dispatcher implements DispatcherContract, QueueingDispatcher, HandlerResolver +{ + /** + * The container implementation. + * + * @var \Illuminate\Contracts\Container\Container + */ + protected $container; + + /** + * The pipeline instance for the bus. + * + * @var \Illuminate\Pipeline\Pipeline + */ + protected $pipeline; + + /** + * The pipes to send commands through before dispatching. + * + * @var array + */ + protected $pipes = []; + + /** + * The queue resolver callback. + * + * @var \Closure|null + */ + protected $queueResolver; + + /** + * All of the command-to-handler mappings. + * + * @var array + */ + protected $mappings = []; + + /** + * The fallback mapping Closure. + * + * @var \Closure + */ + protected $mapper; + + /** + * Create a new command dispatcher instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @param \Closure|null $queueResolver + * @return void + */ + public function __construct(Container $container, Closure $queueResolver = null) + { + $this->container = $container; + $this->queueResolver = $queueResolver; + $this->pipeline = new Pipeline($container); + } + + /** + * Marshal a command and dispatch it to its appropriate handler. + * + * @param mixed $command + * @param array $array + * @return mixed + */ + public function dispatchFromArray($command, array $array) + { + return $this->dispatch($this->marshalFromArray($command, $array)); + } + + /** + * Marshal a command and dispatch it to its appropriate handler. + * + * @param mixed $command + * @param \ArrayAccess $source + * @param array $extras + * @return mixed + */ + public function dispatchFrom($command, ArrayAccess $source, array $extras = []) + { + return $this->dispatch($this->marshal($command, $source, $extras)); + } + + /** + * Marshal a command from the given array. + * + * @param string $command + * @param array $array + * @return mixed + */ + protected function marshalFromArray($command, array $array) + { + return $this->marshal($command, new Collection, $array); + } + + /** + * Marshal a command from the given array accessible object. + * + * @param string $command + * @param \ArrayAccess $source + * @param array $extras + * @return mixed + */ + protected function marshal($command, ArrayAccess $source, array $extras = []) + { + $injected = []; + + $reflection = new ReflectionClass($command); + + if ($constructor = $reflection->getConstructor()) { + $injected = array_map(function ($parameter) use ($command, $source, $extras) { + return $this->getParameterValueForCommand($command, $source, $parameter, $extras); + }, $constructor->getParameters()); + } + + return $reflection->newInstanceArgs($injected); + } + + /** + * Get a parameter value for a marshalled command. + * + * @param string $command + * @param \ArrayAccess $source + * @param \ReflectionParameter $parameter + * @param array $extras + * @return mixed + */ + protected function getParameterValueForCommand($command, ArrayAccess $source, ReflectionParameter $parameter, array $extras = []) + { + if (array_key_exists($parameter->name, $extras)) { + return $extras[$parameter->name]; + } + + if (isset($source[$parameter->name])) { + return $source[$parameter->name]; + } + + if ($parameter->isDefaultValueAvailable()) { + return $parameter->getDefaultValue(); + } + + MarshalException::whileMapping($command, $parameter); + } + + /** + * Dispatch a command to its appropriate handler. + * + * @param mixed $command + * @param \Closure|null $afterResolving + * @return mixed + */ + public function dispatch($command, Closure $afterResolving = null) + { + if ($this->queueResolver && $this->commandShouldBeQueued($command)) { + return $this->dispatchToQueue($command); + } else { + return $this->dispatchNow($command, $afterResolving); + } + } + + /** + * Dispatch a command to its appropriate handler in the current process. + * + * @param mixed $command + * @param \Closure|null $afterResolving + * @return mixed + */ + public function dispatchNow($command, Closure $afterResolving = null) + { + return $this->pipeline->send($command)->through($this->pipes)->then(function ($command) use ($afterResolving) { + if ($command instanceof SelfHandling) { + return $this->container->call([$command, 'handle']); + } + + $handler = $this->resolveHandler($command); + + if ($afterResolving) { + call_user_func($afterResolving, $handler); + } + + return call_user_func( + [$handler, $this->getHandlerMethod($command)], $command + ); + }); + } + + /** + * Determine if the given command should be queued. + * + * @param mixed $command + * @return bool + */ + protected function commandShouldBeQueued($command) + { + if ($command instanceof ShouldQueue) { + return true; + } + + return (new ReflectionClass($this->getHandlerClass($command)))->implementsInterface( + 'Illuminate\Contracts\Queue\ShouldQueue' + ); + } + + /** + * Dispatch a command to its appropriate handler behind a queue. + * + * @param mixed $command + * @return mixed + * + * @throws \RuntimeException + */ + public function dispatchToQueue($command) + { + $queue = call_user_func($this->queueResolver); + + if (! $queue instanceof Queue) { + throw new RuntimeException('Queue resolver did not return a Queue implementation.'); + } + + if (method_exists($command, 'queue')) { + return $command->queue($queue, $command); + } else { + return $this->pushCommandToQueue($queue, $command); + } + } + + /** + * Push the command onto the given queue instance. + * + * @param \Illuminate\Contracts\Queue\Queue $queue + * @param mixed $command + * @return mixed + */ + protected function pushCommandToQueue($queue, $command) + { + if (isset($command->queue, $command->delay)) { + return $queue->laterOn($command->queue, $command->delay, $command); + } + + if (isset($command->queue)) { + return $queue->pushOn($command->queue, $command); + } + + if (isset($command->delay)) { + return $queue->later($command->delay, $command); + } + + return $queue->push($command); + } + + /** + * Get the handler instance for the given command. + * + * @param mixed $command + * @return mixed + */ + public function resolveHandler($command) + { + if ($command instanceof SelfHandling) { + return $command; + } + + return $this->container->make($this->getHandlerClass($command)); + } + + /** + * Get the handler class for the given command. + * + * @param mixed $command + * @return string + */ + public function getHandlerClass($command) + { + if ($command instanceof SelfHandling) { + return get_class($command); + } + + return $this->inflectSegment($command, 0); + } + + /** + * Get the handler method for the given command. + * + * @param mixed $command + * @return string + */ + public function getHandlerMethod($command) + { + if ($command instanceof SelfHandling) { + return 'handle'; + } + + return $this->inflectSegment($command, 1); + } + + /** + * Get the given handler segment for the given command. + * + * @param mixed $command + * @param int $segment + * @return string + */ + protected function inflectSegment($command, $segment) + { + $className = get_class($command); + + if (isset($this->mappings[$className])) { + return $this->getMappingSegment($className, $segment); + } elseif ($this->mapper) { + return $this->getMapperSegment($command, $segment); + } + + throw new InvalidArgumentException("No handler registered for command [{$className}]"); + } + + /** + * Get the given segment from a given class handler. + * + * @param string $className + * @param int $segment + * @return string + */ + protected function getMappingSegment($className, $segment) + { + return explode('@', $this->mappings[$className])[$segment]; + } + + /** + * Get the given segment from a given class handler using the custom mapper. + * + * @param mixed $command + * @param int $segment + * @return string + */ + protected function getMapperSegment($command, $segment) + { + return explode('@', call_user_func($this->mapper, $command))[$segment]; + } + + /** + * Register command-to-handler mappings. + * + * @param array $commands + * @return void + */ + public function maps(array $commands) + { + $this->mappings = array_merge($this->mappings, $commands); + } + + /** + * Register a fallback mapper callback. + * + * @param \Closure $mapper + * @return void + */ + public function mapUsing(Closure $mapper) + { + $this->mapper = $mapper; + } + + /** + * Map the command to a handler within a given root namespace. + * + * @param mixed $command + * @param string $commandNamespace + * @param string $handlerNamespace + * @return string + */ + public static function simpleMapping($command, $commandNamespace, $handlerNamespace) + { + $command = str_replace($commandNamespace, '', get_class($command)); + + return $handlerNamespace.'\\'.trim($command, '\\').'Handler@handle'; + } + + /** + * Set the pipes through which commands should be piped before dispatching. + * + * @param array $pipes + * @return $this + */ + public function pipeThrough(array $pipes) + { + $this->pipes = $pipes; + + return $this; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Bus/MarshalException.php b/application/vendor/laravel/framework/src/Illuminate/Bus/MarshalException.php index 35c9bf8..49c7674 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Bus/MarshalException.php +++ b/application/vendor/laravel/framework/src/Illuminate/Bus/MarshalException.php @@ -1,20 +1,23 @@ -name}] to command [{$command}]"); - } - +class MarshalException extends RuntimeException +{ + /** + * Throw a new exception. + * + * @param string $command + * @param \ReflectionParameter $parameter + * @return void + * + * @throws static + */ + public static function whileMapping($command, ReflectionParameter $parameter) + { + throw new static("Unable to map parameter [{$parameter->name}] to command [{$command}]"); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Bus/Queueable.php b/application/vendor/laravel/framework/src/Illuminate/Bus/Queueable.php new file mode 100644 index 0000000..42d1ca5 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Bus/Queueable.php @@ -0,0 +1,46 @@ +queue = $queue; + + return $this; + } + + /** + * Set the desired delay for the job. + * + * @param int $delay + * @return $this + */ + public function delay($delay) + { + $this->delay = $delay; + + return $this; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Bus/composer.json b/application/vendor/laravel/framework/src/Illuminate/Bus/composer.json index cb3a40d..16982e6 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Bus/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Bus/composer.json @@ -14,10 +14,10 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/contracts": "5.0.*", - "illuminate/pipeline": "5.0.*", - "illuminate/support": "5.0.*" + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*", + "illuminate/pipeline": "5.1.*", + "illuminate/support": "5.1.*" }, "autoload": { "psr-4": { @@ -26,7 +26,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/ApcStore.php b/application/vendor/laravel/framework/src/Illuminate/Cache/ApcStore.php index 52c3ffc..9125dec 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/ApcStore.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/ApcStore.php @@ -1,130 +1,130 @@ -apc = $apc; - $this->prefix = $prefix; - } + /** + * A string that should be prepended to keys. + * + * @var string + */ + protected $prefix; - /** - * Retrieve an item from the cache by key. - * - * @param string $key - * @return mixed - */ - public function get($key) - { - $value = $this->apc->get($this->prefix.$key); + /** + * Create a new APC store. + * + * @param \Illuminate\Cache\ApcWrapper $apc + * @param string $prefix + * @return void + */ + public function __construct(ApcWrapper $apc, $prefix = '') + { + $this->apc = $apc; + $this->prefix = $prefix; + } - if ($value !== false) - { - return $value; - } - } + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @return mixed + */ + public function get($key) + { + $value = $this->apc->get($this->prefix.$key); - /** - * Store an item in the cache for a given number of minutes. - * - * @param string $key - * @param mixed $value - * @param int $minutes - * @return void - */ - public function put($key, $value, $minutes) - { - $this->apc->put($this->prefix.$key, $value, $minutes * 60); - } + if ($value !== false) { + return $value; + } + } - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function increment($key, $value = 1) - { - return $this->apc->increment($this->prefix.$key, $value); - } + /** + * Store an item in the cache for a given number of minutes. + * + * @param string $key + * @param mixed $value + * @param int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + $this->apc->put($this->prefix.$key, $value, $minutes * 60); + } - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function decrement($key, $value = 1) - { - return $this->apc->decrement($this->prefix.$key, $value); - } + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value = 1) + { + return $this->apc->increment($this->prefix.$key, $value); + } - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return array|bool - */ - public function forever($key, $value) - { - return $this->put($key, $value, 0); - } + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value = 1) + { + return $this->apc->decrement($this->prefix.$key, $value); + } - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - return $this->apc->delete($this->prefix.$key); - } + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->put($key, $value, 0); + } - /** - * Remove all items from the cache. - * - * @return void - */ - public function flush() - { - $this->apc->flush(); - } + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + return $this->apc->delete($this->prefix.$key); + } - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } + /** + * Remove all items from the cache. + * + * @return void + */ + public function flush() + { + $this->apc->flush(); + } + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/ApcWrapper.php b/application/vendor/laravel/framework/src/Illuminate/Cache/ApcWrapper.php index 09ac6e8..9fdf293 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/ApcWrapper.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/ApcWrapper.php @@ -1,91 +1,92 @@ -apcu = function_exists('apcu_fetch'); - } + /** + * Create a new APC wrapper instance. + * + * @return void + */ + public function __construct() + { + $this->apcu = function_exists('apcu_fetch'); + } - /** - * Get an item from the cache. - * - * @param string $key - * @return mixed - */ - public function get($key) - { - return $this->apcu ? apcu_fetch($key) : apc_fetch($key); - } + /** + * Get an item from the cache. + * + * @param string $key + * @return mixed + */ + public function get($key) + { + return $this->apcu ? apcu_fetch($key) : apc_fetch($key); + } - /** - * Store an item in the cache. - * - * @param string $key - * @param mixed $value - * @param int $seconds - * @return array|bool - */ - public function put($key, $value, $seconds) - { - return $this->apcu ? apcu_store($key, $value, $seconds) : apc_store($key, $value, $seconds); - } + /** + * Store an item in the cache. + * + * @param string $key + * @param mixed $value + * @param int $seconds + * @return array|bool + */ + public function put($key, $value, $seconds) + { + return $this->apcu ? apcu_store($key, $value, $seconds) : apc_store($key, $value, $seconds); + } - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function increment($key, $value) - { - return $this->apcu ? apcu_inc($key, $value) : apc_inc($key, $value); - } + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value) + { + return $this->apcu ? apcu_inc($key, $value) : apc_inc($key, $value); + } - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function decrement($key, $value) - { - return $this->apcu ? apcu_dec($key, $value) : apc_dec($key, $value); - } + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value) + { + return $this->apcu ? apcu_dec($key, $value) : apc_dec($key, $value); + } - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function delete($key) - { - return $this->apcu ? apcu_delete($key) : apc_delete($key); - } - - /** - * Remove all items from the cache. - * - * @return void - */ - public function flush() - { - $this->apcu ? apcu_clear_cache() : apc_clear_cache('user'); - } + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function delete($key) + { + return $this->apcu ? apcu_delete($key) : apc_delete($key); + } + /** + * Remove all items from the cache. + * + * @return void + */ + public function flush() + { + $this->apcu ? apcu_clear_cache() : apc_clear_cache('user'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/ArrayStore.php b/application/vendor/laravel/framework/src/Illuminate/Cache/ArrayStore.php index 07f05d1..3dd8c04 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/ArrayStore.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/ArrayStore.php @@ -1,112 +1,112 @@ -storage)) - { - return $this->storage[$key]; - } - } +class ArrayStore extends TaggableStore implements Store +{ + /** + * The array of stored values. + * + * @var array + */ + protected $storage = []; - /** - * Store an item in the cache for a given number of minutes. - * - * @param string $key - * @param mixed $value - * @param int $minutes - * @return void - */ - public function put($key, $value, $minutes) - { - $this->storage[$key] = $value; - } + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @return mixed + */ + public function get($key) + { + if (array_key_exists($key, $this->storage)) { + return $this->storage[$key]; + } + } - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int - */ - public function increment($key, $value = 1) - { - $this->storage[$key] = $this->storage[$key] + $value; + /** + * Store an item in the cache for a given number of minutes. + * + * @param string $key + * @param mixed $value + * @param int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + $this->storage[$key] = $value; + } - return $this->storage[$key]; - } + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function increment($key, $value = 1) + { + $this->storage[$key] = ((int) $this->storage[$key]) + $value; - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int - */ - public function decrement($key, $value = 1) - { - return $this->increment($key, $value * -1); - } + return $this->storage[$key]; + } - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function forever($key, $value) - { - $this->put($key, $value, 0); - } + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function decrement($key, $value = 1) + { + return $this->increment($key, $value * -1); + } - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - unset($this->storage[$key]); + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->put($key, $value, 0); + } - return true; - } + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + unset($this->storage[$key]); - /** - * Remove all items from the cache. - * - * @return void - */ - public function flush() - { - $this->storage = array(); - } + return true; + } - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return ''; - } + /** + * Remove all items from the cache. + * + * @return void + */ + public function flush() + { + $this->storage = []; + } + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return ''; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php b/application/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php index 95dfa4f..1eb7935 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php @@ -1,315 +1,320 @@ -app = $app; - } - - /** - * Get a cache store instance by name. - * - * @param string|null $name - * @return mixed - */ - public function store($name = null) - { - $name = $name ?: $this->getDefaultDriver(); - - return $this->stores[$name] = $this->get($name); - } - - /** - * Get a cache driver instance. - * - * @param string $driver - * @return mixed - */ - public function driver($driver = null) - { - return $this->store($driver); - } - - /** - * Attempt to get the store from the local cache. - * - * @param string $name - * @return \Illuminate\Contracts\Cache\Repository - */ - protected function get($name) - { - return isset($this->stores[$name]) ? $this->stores[$name] : $this->resolve($name); - } - - /** - * Resolve the given store. - * - * @param string $name - * @return \Illuminate\Contracts\Cache\Repository - */ - protected function resolve($name) - { - $config = $this->getConfig($name); - - if (is_null($config)) - { - throw new InvalidArgumentException("Cache store [{$name}] is not defined."); - } - - if (isset($this->customCreators[$config['driver']])) - { - return $this->callCustomCreator($config); - } - else - { - return $this->{"create".ucfirst($config['driver'])."Driver"}($config); - } - } - - /** - * Call a custom driver creator. - * - * @param array $config - * @return mixed - */ - protected function callCustomCreator(array $config) - { - return $this->customCreators[$config['driver']]($this->app, $config); - } - - /** - * Create an instance of the APC cache driver. - * - * @param array $config - * @return \Illuminate\Cache\ApcStore - */ - protected function createApcDriver(array $config) - { - $prefix = $this->getPrefix($config); - - return $this->repository(new ApcStore(new ApcWrapper, $prefix)); - } - - /** - * Create an instance of the array cache driver. - * - * @return \Illuminate\Cache\ArrayStore - */ - protected function createArrayDriver() - { - return $this->repository(new ArrayStore); - } - - /** - * Create an instance of the file cache driver. - * - * @param array $config - * @return \Illuminate\Cache\FileStore - */ - protected function createFileDriver(array $config) - { - return $this->repository(new FileStore($this->app['files'], $config['path'])); - } - - /** - * Create an instance of the Memcached cache driver. - * - * @param array $config - * @return \Illuminate\Cache\MemcachedStore - */ - protected function createMemcachedDriver(array $config) - { - $prefix = $this->getPrefix($config); - - $memcached = $this->app['memcached.connector']->connect($config['servers']); - - return $this->repository(new MemcachedStore($memcached, $prefix)); - } - - /** - * Create an instance of the Null cache driver. - * - * @return \Illuminate\Cache\NullStore - */ - protected function createNullDriver() - { - return $this->repository(new NullStore); - } - - /** - * Create an instance of the WinCache cache driver. - * - * @param array $config - * @return \Illuminate\Cache\WinCacheStore - */ - protected function createWincacheDriver(array $config) - { - return $this->repository(new WinCacheStore($this->getPrefix($config))); - } - - /** - * Create an instance of the XCache cache driver. - * - * @param array $config - * @return \Illuminate\Cache\WinCacheStore - */ - protected function createXcacheDriver(array $config) - { - return $this->repository(new XCacheStore($this->getPrefix($config))); - } - - /** - * Create an instance of the Redis cache driver. - * - * @param array $config - * @return \Illuminate\Cache\RedisStore - */ - protected function createRedisDriver(array $config) - { - $redis = $this->app['redis']; - - $connection = array_get($config, 'connection', 'default') ?: 'default'; - - return $this->repository(new RedisStore($redis, $this->getPrefix($config), $connection)); - } - - /** - * Create an instance of the database cache driver. - * - * @param array $config - * @return \Illuminate\Cache\DatabaseStore - */ - protected function createDatabaseDriver(array $config) - { - $connection = $this->app['db']->connection(array_get($config, 'connection')); - - return $this->repository( - new DatabaseStore( - $connection, $this->app['encrypter'], $config['table'], $this->getPrefix($config) - ) - ); - } - - /** - * Create a new cache repository with the given implementation. - * - * @param \Illuminate\Contracts\Cache\Store $store - * @return \Illuminate\Cache\Repository - */ - public function repository(Store $store) - { - $repository = new Repository($store); - - if ($this->app->bound('Illuminate\Contracts\Events\Dispatcher')) - { - $repository->setEventDispatcher( - $this->app['Illuminate\Contracts\Events\Dispatcher'] - ); - } - - return $repository; - } - - /** - * Get the cache prefix. - * - * @param array $config - * @return string - */ - protected function getPrefix(array $config) - { - return array_get($config, 'prefix') ?: $this->app['config']['cache.prefix']; - } - - /** - * Get the cache connection configuration. - * - * @param string $name - * @return array - */ - protected function getConfig($name) - { - return $this->app['config']["cache.stores.{$name}"]; - } - - /** - * Get the default cache driver name. - * - * @return string - */ - public function getDefaultDriver() - { - return $this->app['config']['cache.default']; - } - - /** - * Set the default cache driver name. - * - * @param string $name - * @return void - */ - public function setDefaultDriver($name) - { - $this->app['config']['cache.default'] = $name; - } - - /** - * Register a custom driver creator Closure. - * - * @param string $driver - * @param \Closure $callback - * @return $this - */ - public function extend($driver, Closure $callback) - { - $this->customCreators[$driver] = $callback; - - return $this; - } - - /** - * Dynamically call the default driver instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return call_user_func_array(array($this->store(), $method), $parameters); - } - +class CacheManager implements FactoryContract +{ + /** + * The application instance. + * + * @var \Illuminate\Foundation\Application + */ + protected $app; + + /** + * The array of resolved cache stores. + * + * @var array + */ + protected $stores = []; + + /** + * The registered custom driver creators. + * + * @var array + */ + protected $customCreators = []; + + /** + * Create a new Cache manager instance. + * + * @param \Illuminate\Foundation\Application $app + * @return void + */ + public function __construct($app) + { + $this->app = $app; + } + + /** + * Get a cache store instance by name. + * + * @param string|null $name + * @return mixed + */ + public function store($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + return $this->stores[$name] = $this->get($name); + } + + /** + * Get a cache driver instance. + * + * @param string $driver + * @return mixed + */ + public function driver($driver = null) + { + return $this->store($driver); + } + + /** + * Attempt to get the store from the local cache. + * + * @param string $name + * @return \Illuminate\Contracts\Cache\Repository + */ + protected function get($name) + { + return isset($this->stores[$name]) ? $this->stores[$name] : $this->resolve($name); + } + + /** + * Resolve the given store. + * + * @param string $name + * @return \Illuminate\Contracts\Cache\Repository + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + if (is_null($config)) { + throw new InvalidArgumentException("Cache store [{$name}] is not defined."); + } + + if (isset($this->customCreators[$config['driver']])) { + return $this->callCustomCreator($config); + } else { + $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; + + if (method_exists($this, $driverMethod)) { + return $this->{$driverMethod}($config); + } else { + throw new InvalidArgumentException("Driver [{$config['driver']}] not supported."); + } + } + } + + /** + * Call a custom driver creator. + * + * @param array $config + * @return mixed + */ + protected function callCustomCreator(array $config) + { + return $this->customCreators[$config['driver']]($this->app, $config); + } + + /** + * Create an instance of the APC cache driver. + * + * @param array $config + * @return \Illuminate\Cache\ApcStore + */ + protected function createApcDriver(array $config) + { + $prefix = $this->getPrefix($config); + + return $this->repository(new ApcStore(new ApcWrapper, $prefix)); + } + + /** + * Create an instance of the array cache driver. + * + * @return \Illuminate\Cache\ArrayStore + */ + protected function createArrayDriver() + { + return $this->repository(new ArrayStore); + } + + /** + * Create an instance of the file cache driver. + * + * @param array $config + * @return \Illuminate\Cache\FileStore + */ + protected function createFileDriver(array $config) + { + return $this->repository(new FileStore($this->app['files'], $config['path'])); + } + + /** + * Create an instance of the Memcached cache driver. + * + * @param array $config + * @return \Illuminate\Cache\MemcachedStore + */ + protected function createMemcachedDriver(array $config) + { + $prefix = $this->getPrefix($config); + + $memcached = $this->app['memcached.connector']->connect($config['servers']); + + return $this->repository(new MemcachedStore($memcached, $prefix)); + } + + /** + * Create an instance of the Null cache driver. + * + * @return \Illuminate\Cache\NullStore + */ + protected function createNullDriver() + { + return $this->repository(new NullStore); + } + + /** + * Create an instance of the WinCache cache driver. + * + * @param array $config + * @return \Illuminate\Cache\WinCacheStore + */ + protected function createWincacheDriver(array $config) + { + return $this->repository(new WinCacheStore($this->getPrefix($config))); + } + + /** + * Create an instance of the XCache cache driver. + * + * @param array $config + * @return \Illuminate\Cache\WinCacheStore + */ + protected function createXcacheDriver(array $config) + { + return $this->repository(new XCacheStore($this->getPrefix($config))); + } + + /** + * Create an instance of the Redis cache driver. + * + * @param array $config + * @return \Illuminate\Cache\RedisStore + */ + protected function createRedisDriver(array $config) + { + $redis = $this->app['redis']; + + $connection = Arr::get($config, 'connection', 'default'); + + return $this->repository(new RedisStore($redis, $this->getPrefix($config), $connection)); + } + + /** + * Create an instance of the database cache driver. + * + * @param array $config + * @return \Illuminate\Cache\DatabaseStore + */ + protected function createDatabaseDriver(array $config) + { + $connection = $this->app['db']->connection(Arr::get($config, 'connection')); + + return $this->repository( + new DatabaseStore( + $connection, $this->app['encrypter'], $config['table'], $this->getPrefix($config) + ) + ); + } + + /** + * Create a new cache repository with the given implementation. + * + * @param \Illuminate\Contracts\Cache\Store $store + * @return \Illuminate\Cache\Repository + */ + public function repository(Store $store) + { + $repository = new Repository($store); + + if ($this->app->bound('Illuminate\Contracts\Events\Dispatcher')) { + $repository->setEventDispatcher( + $this->app['Illuminate\Contracts\Events\Dispatcher'] + ); + } + + return $repository; + } + + /** + * Get the cache prefix. + * + * @param array $config + * @return string + */ + protected function getPrefix(array $config) + { + return Arr::get($config, 'prefix') ?: $this->app['config']['cache.prefix']; + } + + /** + * Get the cache connection configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + return $this->app['config']["cache.stores.{$name}"]; + } + + /** + * Get the default cache driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['cache.default']; + } + + /** + * Set the default cache driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['cache.default'] = $name; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback; + + return $this; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return call_user_func_array([$this->store(), $method], $parameters); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php index c646294..fe4801e 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php @@ -1,73 +1,69 @@ -app->singleton('cache', function($app) - { - return new CacheManager($app); - }); +class CacheServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; - $this->app->singleton('cache.store', function($app) - { - return $app['cache']->driver(); - }); + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton('cache', function ($app) { + return new CacheManager($app); + }); - $this->app->singleton('memcached.connector', function() - { - return new MemcachedConnector; - }); + $this->app->singleton('cache.store', function ($app) { + return $app['cache']->driver(); + }); - $this->registerCommands(); - } + $this->app->singleton('memcached.connector', function () { + return new MemcachedConnector; + }); - /** - * Register the cache related console commands. - * - * @return void - */ - public function registerCommands() - { - $this->app->singleton('command.cache.clear', function($app) - { - return new ClearCommand($app['cache']); - }); + $this->registerCommands(); + } - $this->app->singleton('command.cache.table', function($app) - { - return new CacheTableCommand($app['files'], $app['composer']); - }); + /** + * Register the cache related console commands. + * + * @return void + */ + public function registerCommands() + { + $this->app->singleton('command.cache.clear', function ($app) { + return new ClearCommand($app['cache']); + }); - $this->commands('command.cache.clear', 'command.cache.table'); - } + $this->app->singleton('command.cache.table', function ($app) { + return new CacheTableCommand($app['files'], $app['composer']); + }); - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - 'cache', 'cache.store', 'memcached.connector', 'command.cache.clear', 'command.cache.table', - ]; - } + $this->commands('command.cache.clear', 'command.cache.table'); + } + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'cache', 'cache.store', 'memcached.connector', 'command.cache.clear', 'command.cache.table', + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/Console/CacheTableCommand.php b/application/vendor/laravel/framework/src/Illuminate/Cache/Console/CacheTableCommand.php index 589e676..2e436d6 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/Console/CacheTableCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/Console/CacheTableCommand.php @@ -1,80 +1,81 @@ -files = $files; - $this->composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $fullPath = $this->createBaseMigration(); - - $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/cache.stub')); - - $this->info('Migration created successfully!'); - - $this->composer->dumpAutoloads(); - } - - /** - * Create a base migration file for the table. - * - * @return string - */ - protected function createBaseMigration() - { - $name = 'create_cache_table'; - - $path = $this->laravel->databasePath().'/migrations'; - - return $this->laravel['migration.creator']->create($name, $path); - } - +class CacheTableCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'cache:table'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Create a migration for the cache database table'; + + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * @var \Illuminate\Foundation\Composer + */ + protected $composer; + + /** + * Create a new cache table command instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @param \Illuminate\Foundation\Composer $composer + * @return void + */ + public function __construct(Filesystem $files, Composer $composer) + { + parent::__construct(); + + $this->files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $fullPath = $this->createBaseMigration(); + + $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/cache.stub')); + + $this->info('Migration created successfully!'); + + $this->composer->dumpAutoloads(); + } + + /** + * Create a base migration file for the table. + * + * @return string + */ + protected function createBaseMigration() + { + $name = 'create_cache_table'; + + $path = $this->laravel->databasePath().'/migrations'; + + return $this->laravel['migration.creator']->create($name, $path); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/Console/ClearCommand.php b/application/vendor/laravel/framework/src/Illuminate/Cache/Console/ClearCommand.php index 3e55f83..02ea032 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/Console/ClearCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/Console/ClearCommand.php @@ -1,73 +1,74 @@ -cache = $cache; - } + /** + * Create a new cache clear command instance. + * + * @param \Illuminate\Cache\CacheManager $cache + * @return void + */ + public function __construct(CacheManager $cache) + { + parent::__construct(); - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $storeName = $this->argument('store'); + $this->cache = $cache; + } - $this->laravel['events']->fire('cache:clearing', [$storeName]); + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $storeName = $this->argument('store'); - $this->cache->store($storeName)->flush(); + $this->laravel['events']->fire('cache:clearing', [$storeName]); - $this->laravel['events']->fire('cache:cleared', [$storeName]); + $this->cache->store($storeName)->flush(); - $this->info('Application cache cleared!'); - } + $this->laravel['events']->fire('cache:cleared', [$storeName]); - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return [ - ['store', InputArgument::OPTIONAL, 'The name of the store you would like to clear.'], - ]; - } + $this->info('Application cache cleared!'); + } + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['store', InputArgument::OPTIONAL, 'The name of the store you would like to clear.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/Console/stubs/cache.stub b/application/vendor/laravel/framework/src/Illuminate/Cache/Console/stubs/cache.stub index 8ba4467..c972a4f 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/Console/stubs/cache.stub +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/Console/stubs/cache.stub @@ -3,31 +3,29 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class CreateCacheTable extends Migration { - - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('cache', function(Blueprint $table) - { - $table->string('key')->unique(); - $table->text('value'); - $table->integer('expiration'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('cache'); - } +class CreateCacheTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('cache', function (Blueprint $table) { + $table->string('key')->unique(); + $table->text('value'); + $table->integer('expiration'); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('cache'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/DatabaseStore.php b/application/vendor/laravel/framework/src/Illuminate/Cache/DatabaseStore.php index cc9c07f..20f20c7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/DatabaseStore.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/DatabaseStore.php @@ -1,228 +1,260 @@ -table = $table; - $this->prefix = $prefix; - $this->encrypter = $encrypter; - $this->connection = $connection; - } - - /** - * Retrieve an item from the cache by key. - * - * @param string $key - * @return mixed - */ - public function get($key) - { - $prefixed = $this->prefix.$key; - - $cache = $this->table()->where('key', '=', $prefixed)->first(); - - // If we have a cache record we will check the expiration time against current - // time on the system and see if the record has expired. If it has, we will - // remove the records from the database table so it isn't returned again. - if ( ! is_null($cache)) - { - if (is_array($cache)) $cache = (object) $cache; - - if (time() >= $cache->expiration) - { - $this->forget($key); - - return; - } - - return $this->encrypter->decrypt($cache->value); - } - } - - /** - * Store an item in the cache for a given number of minutes. - * - * @param string $key - * @param mixed $value - * @param int $minutes - * @return void - */ - public function put($key, $value, $minutes) - { - $key = $this->prefix.$key; - - // All of the cached values in the database are encrypted in case this is used - // as a session data store by the consumer. We'll also calculate the expire - // time and place that on the table so we will check it on our retrieval. - $value = $this->encrypter->encrypt($value); - - $expiration = $this->getTime() + ($minutes * 60); - - try - { - $this->table()->insert(compact('key', 'value', 'expiration')); - } - catch (Exception $e) - { - $this->table()->where('key', '=', $key)->update(compact('value', 'expiration')); - } - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return void - * - * @throws \LogicException - */ - public function increment($key, $value = 1) - { - throw new LogicException("Increment operations not supported by this driver."); - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return void - * - * @throws \LogicException - */ - public function decrement($key, $value = 1) - { - throw new LogicException("Decrement operations not supported by this driver."); - } - - /** - * Get the current system time. - * - * @return int - */ - protected function getTime() - { - return time(); - } - - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function forever($key, $value) - { - $this->put($key, $value, 5256000); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - $this->table()->where('key', '=', $this->prefix.$key)->delete(); - - return true; - } - - /** - * Remove all items from the cache. - * - * @return void - */ - public function flush() - { - $this->table()->delete(); - } - - /** - * Get a query builder for the cache table. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function table() - { - return $this->connection->table($this->table); - } - - /** - * Get the underlying database connection. - * - * @return \Illuminate\Database\ConnectionInterface - */ - public function getConnection() - { - return $this->connection; - } - - /** - * Get the encrypter instance. - * - * @return \Illuminate\Contracts\Encryption\Encrypter - */ - public function getEncrypter() - { - return $this->encrypter; - } - - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } +class DatabaseStore implements Store +{ + /** + * The database connection instance. + * + * @var \Illuminate\Database\ConnectionInterface + */ + protected $connection; + + /** + * The encrypter instance. + * + * @var \Illuminate\Contracts\Encryption\Encrypter + */ + protected $encrypter; + + /** + * The name of the cache table. + * + * @var string + */ + protected $table; + + /** + * A string that should be prepended to keys. + * + * @var string + */ + protected $prefix; + + /** + * Create a new database store. + * + * @param \Illuminate\Database\ConnectionInterface $connection + * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter + * @param string $table + * @param string $prefix + * @return void + */ + public function __construct(ConnectionInterface $connection, EncrypterContract $encrypter, $table, $prefix = '') + { + $this->table = $table; + $this->prefix = $prefix; + $this->encrypter = $encrypter; + $this->connection = $connection; + } + + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @return mixed + */ + public function get($key) + { + $prefixed = $this->prefix.$key; + + $cache = $this->table()->where('key', '=', $prefixed)->first(); + + // If we have a cache record we will check the expiration time against current + // time on the system and see if the record has expired. If it has, we will + // remove the records from the database table so it isn't returned again. + if (! is_null($cache)) { + if (is_array($cache)) { + $cache = (object) $cache; + } + + if (time() >= $cache->expiration) { + $this->forget($key); + + return; + } + + return $this->encrypter->decrypt($cache->value); + } + } + + /** + * Store an item in the cache for a given number of minutes. + * + * @param string $key + * @param mixed $value + * @param int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + $key = $this->prefix.$key; + + // All of the cached values in the database are encrypted in case this is used + // as a session data store by the consumer. We'll also calculate the expire + // time and place that on the table so we will check it on our retrieval. + $value = $this->encrypter->encrypt($value); + + $expiration = $this->getTime() + ($minutes * 60); + + try { + $this->table()->insert(compact('key', 'value', 'expiration')); + } catch (Exception $e) { + $this->table()->where('key', '=', $key)->update(compact('value', 'expiration')); + } + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value = 1) + { + return $this->incrementOrDecrement($key, $value, function ($current, $value) { + return $current + $value; + }); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value = 1) + { + return $this->incrementOrDecrement($key, $value, function ($current, $value) { + return $current - $value; + }); + } + + /** + * Increment or decrement an item in the cache. + * + * @param string $key + * @param mixed $value + * @param \Closure $callback + * @return int|bool + */ + protected function incrementOrDecrement($key, $value, Closure $callback) + { + return $this->connection->transaction(function () use ($key, $value, $callback) { + $prefixed = $this->prefix.$key; + + $cache = $this->table()->where('key', $prefixed)->lockForUpdate()->first(); + + if (is_null($cache)) { + return false; + } + + $current = $this->encrypter->decrypt($cache->value); + $new = $callback((int) $current, $value); + + if (! is_numeric($current)) { + return false; + } + + $this->table()->where('key', $prefixed)->update([ + 'value' => $this->encrypter->encrypt($new), + ]); + + return $new; + }); + } + + /** + * Get the current system time. + * + * @return int + */ + protected function getTime() + { + return time(); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->put($key, $value, 5256000); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + $this->table()->where('key', '=', $this->prefix.$key)->delete(); + + return true; + } + + /** + * Remove all items from the cache. + * + * @return void + */ + public function flush() + { + $this->table()->delete(); + } + + /** + * Get a query builder for the cache table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function table() + { + return $this->connection->table($this->table); + } + + /** + * Get the underlying database connection. + * + * @return \Illuminate\Database\ConnectionInterface + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Get the encrypter instance. + * + * @return \Illuminate\Contracts\Encryption\Encrypter + */ + public function getEncrypter() + { + return $this->encrypter; + } + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php b/application/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php index 4728334..05f3eda 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php @@ -1,256 +1,250 @@ -files = $files; - $this->directory = $directory; - } - - /** - * Retrieve an item from the cache by key. - * - * @param string $key - * @return mixed - */ - public function get($key) - { - return array_get($this->getPayload($key), 'data'); - } - - /** - * Retrieve an item and expiry time from the cache by key. - * - * @param string $key - * @return array - */ - protected function getPayload($key) - { - $path = $this->path($key); - - // If the file doesn't exists, we obviously can't return the cache so we will - // just return null. Otherwise, we'll get the contents of the file and get - // the expiration UNIX timestamps from the start of the file's contents. - try - { - $expire = substr($contents = $this->files->get($path), 0, 10); - } - catch (Exception $e) - { - return array('data' => null, 'time' => null); - } - - // If the current time is greater than expiration timestamps we will delete - // the file and return null. This helps clean up the old files and keeps - // this directory much cleaner for us as old files aren't hanging out. - if (time() >= $expire) - { - $this->forget($key); - - return array('data' => null, 'time' => null); - } - - $data = unserialize(substr($contents, 10)); - - // Next, we'll extract the number of minutes that are remaining for a cache - // so that we can properly retain the time for things like the increment - // operation that may be performed on the cache. We'll round this out. - $time = ceil(($expire - time()) / 60); - - return compact('data', 'time'); - } - - /** - * Store an item in the cache for a given number of minutes. - * - * @param string $key - * @param mixed $value - * @param int $minutes - * @return void - */ - public function put($key, $value, $minutes) - { - $value = $this->expiration($minutes).serialize($value); - - $this->createCacheDirectory($path = $this->path($key)); - - $this->files->put($path, $value); - } - - /** - * Create the file cache directory if necessary. - * - * @param string $path - * @return void - */ - protected function createCacheDirectory($path) - { - try - { - $this->files->makeDirectory(dirname($path), 0777, true, true); - } - catch (Exception $e) - { - // - } - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int - */ - public function increment($key, $value = 1) - { - $raw = $this->getPayload($key); - - $int = ((int) $raw['data']) + $value; - - $this->put($key, $int, (int) $raw['time']); - - return $int; - } - - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int - */ - public function decrement($key, $value = 1) - { - return $this->increment($key, $value * -1); - } - - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function forever($key, $value) - { - $this->put($key, $value, 0); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - $file = $this->path($key); - - if ($this->files->exists($file)) - { - return $this->files->delete($file); - } - - return false; - } - - /** - * Remove all items from the cache. - * - * @return void - */ - public function flush() - { - if ($this->files->isDirectory($this->directory)) - { - foreach ($this->files->directories($this->directory) as $directory) - { - $this->files->deleteDirectory($directory); - } - } - } - - /** - * Get the full path for the given cache key. - * - * @param string $key - * @return string - */ - protected function path($key) - { - $parts = array_slice(str_split($hash = md5($key), 2), 0, 2); - - return $this->directory.'/'.implode('/', $parts).'/'.$hash; - } - - /** - * Get the expiration time based on the given minutes. - * - * @param int $minutes - * @return int - */ - protected function expiration($minutes) - { - if ($minutes === 0) return 9999999999; - - return time() + ($minutes * 60); - } - - /** - * Get the Filesystem instance. - * - * @return \Illuminate\Filesystem\Filesystem - */ - public function getFilesystem() - { - return $this->files; - } - - /** - * Get the working directory of the cache. - * - * @return string - */ - public function getDirectory() - { - return $this->directory; - } - - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return ''; - } - +class FileStore implements Store +{ + /** + * The Illuminate Filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * The file cache directory. + * + * @var string + */ + protected $directory; + + /** + * Create a new file cache store instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @param string $directory + * @return void + */ + public function __construct(Filesystem $files, $directory) + { + $this->files = $files; + $this->directory = $directory; + } + + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @return mixed + */ + public function get($key) + { + return Arr::get($this->getPayload($key), 'data'); + } + + /** + * Retrieve an item and expiry time from the cache by key. + * + * @param string $key + * @return array + */ + protected function getPayload($key) + { + $path = $this->path($key); + + // If the file doesn't exists, we obviously can't return the cache so we will + // just return null. Otherwise, we'll get the contents of the file and get + // the expiration UNIX timestamps from the start of the file's contents. + try { + $expire = substr($contents = $this->files->get($path), 0, 10); + } catch (Exception $e) { + return ['data' => null, 'time' => null]; + } + + // If the current time is greater than expiration timestamps we will delete + // the file and return null. This helps clean up the old files and keeps + // this directory much cleaner for us as old files aren't hanging out. + if (time() >= $expire) { + $this->forget($key); + + return ['data' => null, 'time' => null]; + } + + $data = unserialize(substr($contents, 10)); + + // Next, we'll extract the number of minutes that are remaining for a cache + // so that we can properly retain the time for things like the increment + // operation that may be performed on the cache. We'll round this out. + $time = ceil(($expire - time()) / 60); + + return compact('data', 'time'); + } + + /** + * Store an item in the cache for a given number of minutes. + * + * @param string $key + * @param mixed $value + * @param int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + $value = $this->expiration($minutes).serialize($value); + + $this->createCacheDirectory($path = $this->path($key)); + + $this->files->put($path, $value); + } + + /** + * Create the file cache directory if necessary. + * + * @param string $path + * @return void + */ + protected function createCacheDirectory($path) + { + if (! $this->files->exists(dirname($path))) { + $this->files->makeDirectory(dirname($path), 0777, true, true); + } + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function increment($key, $value = 1) + { + $raw = $this->getPayload($key); + + $int = ((int) $raw['data']) + $value; + + $this->put($key, $int, (int) $raw['time']); + + return $int; + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function decrement($key, $value = 1) + { + return $this->increment($key, $value * -1); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->put($key, $value, 0); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + $file = $this->path($key); + + if ($this->files->exists($file)) { + return $this->files->delete($file); + } + + return false; + } + + /** + * Remove all items from the cache. + * + * @return void + */ + public function flush() + { + if ($this->files->isDirectory($this->directory)) { + foreach ($this->files->directories($this->directory) as $directory) { + $this->files->deleteDirectory($directory); + } + } + } + + /** + * Get the full path for the given cache key. + * + * @param string $key + * @return string + */ + protected function path($key) + { + $parts = array_slice(str_split($hash = md5($key), 2), 0, 2); + + return $this->directory.'/'.implode('/', $parts).'/'.$hash; + } + + /** + * Get the expiration time based on the given minutes. + * + * @param int $minutes + * @return int + */ + protected function expiration($minutes) + { + $time = time() + ($minutes * 60); + + if ($minutes === 0 || $time > 9999999999) { + return 9999999999; + } + + return $time; + } + + /** + * Get the Filesystem instance. + * + * @return \Illuminate\Filesystem\Filesystem + */ + public function getFilesystem() + { + return $this->files; + } + + /** + * Get the working directory of the cache. + * + * @return string + */ + public function getDirectory() + { + return $this->directory; + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return ''; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php b/application/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php index 44b378f..49f5cd8 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php @@ -1,55 +1,53 @@ -getMemcached(); - - // For each server in the array, we'll just extract the configuration and add - // the server to the Memcached connection. Once we have added all of these - // servers we'll verify the connection is successful and return it back. - foreach ($servers as $server) - { - $memcached->addServer( - $server['host'], $server['port'], $server['weight'] - ); - } - - $memcachedStatus = $memcached->getVersion(); - - if ( ! is_array($memcachedStatus)) - { - throw new RuntimeException("No Memcached servers added."); - } - - if (in_array('255.255.255', $memcachedStatus) && count(array_unique($memcachedStatus)) === 1) - { - throw new RuntimeException("Could not establish Memcached connection."); - } - - return $memcached; - } - - /** - * Get a new Memcached instance. - * - * @return \Memcached - */ - protected function getMemcached() - { - return new Memcached; - } - +class MemcachedConnector +{ + /** + * Create a new Memcached connection. + * + * @param array $servers + * @return \Memcached + * + * @throws \RuntimeException + */ + public function connect(array $servers) + { + $memcached = $this->getMemcached(); + + // For each server in the array, we'll just extract the configuration and add + // the server to the Memcached connection. Once we have added all of these + // servers we'll verify the connection is successful and return it back. + foreach ($servers as $server) { + $memcached->addServer( + $server['host'], $server['port'], $server['weight'] + ); + } + + $memcachedStatus = $memcached->getVersion(); + + if (! is_array($memcachedStatus)) { + throw new RuntimeException('No Memcached servers added.'); + } + + if (in_array('255.255.255', $memcachedStatus) && count(array_unique($memcachedStatus)) === 1) { + throw new RuntimeException('Could not establish Memcached connection.'); + } + + return $memcached; + } + + /** + * Get a new Memcached instance. + * + * @return \Memcached + */ + protected function getMemcached() + { + return new Memcached; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/MemcachedStore.php b/application/vendor/laravel/framework/src/Illuminate/Cache/MemcachedStore.php index a3913f9..2c2aee0 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/MemcachedStore.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/MemcachedStore.php @@ -1,153 +1,164 @@ -memcached = $memcached; - $this->prefix = strlen($prefix) > 0 ? $prefix.':' : ''; - } - - /** - * Retrieve an item from the cache by key. - * - * @param string $key - * @return mixed - */ - public function get($key) - { - $value = $this->memcached->get($this->prefix.$key); - - if ($this->memcached->getResultCode() == 0) - { - return $value; - } - } - - /** - * Store an item in the cache for a given number of minutes. - * - * @param string $key - * @param mixed $value - * @param int $minutes - * @return void - */ - public function put($key, $value, $minutes) - { - $this->memcached->set($this->prefix.$key, $value, $minutes * 60); - } - - /** - * Store an item in the cache if the key doesn't exist. - * - * @param string $key - * @param mixed $value - * @param int $minutes - * @return bool - */ - public function add($key, $value, $minutes) - { - return $this->memcached->add($this->prefix.$key, $value, $minutes * 60); - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function increment($key, $value = 1) - { - return $this->memcached->increment($this->prefix.$key, $value); - } - - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function decrement($key, $value = 1) - { - return $this->memcached->decrement($this->prefix.$key, $value); - } - - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function forever($key, $value) - { - $this->put($key, $value, 0); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - return $this->memcached->delete($this->prefix.$key); - } - - /** - * Remove all items from the cache. - * - * @return void - */ - public function flush() - { - $this->memcached->flush(); - } - - /** - * Get the underlying Memcached connection. - * - * @return \Memcached - */ - public function getMemcached() - { - return $this->memcached; - } - - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } +use Illuminate\Contracts\Cache\Store; +class MemcachedStore extends TaggableStore implements Store +{ + /** + * The Memcached instance. + * + * @var \Memcached + */ + protected $memcached; + + /** + * A string that should be prepended to keys. + * + * @var string + */ + protected $prefix; + + /** + * Create a new Memcached store. + * + * @param \Memcached $memcached + * @param string $prefix + * @return void + */ + public function __construct($memcached, $prefix = '') + { + $this->setPrefix($prefix); + $this->memcached = $memcached; + } + + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @return mixed + */ + public function get($key) + { + $value = $this->memcached->get($this->prefix.$key); + + if ($this->memcached->getResultCode() == 0) { + return $value; + } + } + + /** + * Store an item in the cache for a given number of minutes. + * + * @param string $key + * @param mixed $value + * @param int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + $this->memcached->set($this->prefix.$key, $value, $minutes * 60); + } + + /** + * Store an item in the cache if the key doesn't exist. + * + * @param string $key + * @param mixed $value + * @param int $minutes + * @return bool + */ + public function add($key, $value, $minutes) + { + return $this->memcached->add($this->prefix.$key, $value, $minutes * 60); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value = 1) + { + return $this->memcached->increment($this->prefix.$key, $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value = 1) + { + return $this->memcached->decrement($this->prefix.$key, $value); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->put($key, $value, 0); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + return $this->memcached->delete($this->prefix.$key); + } + + /** + * Remove all items from the cache. + * + * @return void + */ + public function flush() + { + $this->memcached->flush(); + } + + /** + * Get the underlying Memcached connection. + * + * @return \Memcached + */ + public function getMemcached() + { + return $this->memcached; + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * Set the cache key prefix. + * + * @param string $prefix + * @return void + */ + public function setPrefix($prefix) + { + $this->prefix = ! empty($prefix) ? $prefix.':' : ''; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/NullStore.php b/application/vendor/laravel/framework/src/Illuminate/Cache/NullStore.php index b8b2bb8..46aed16 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/NullStore.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/NullStore.php @@ -1,105 +1,106 @@ -cache = $cache; + } + + /** + * Determine if the given key has been "accessed" too many times. + * + * @param string $key + * @param int $maxAttempts + * @param int $decayMinutes + * @return bool + */ + public function tooManyAttempts($key, $maxAttempts, $decayMinutes = 1) + { + $lockedOut = $this->cache->has($key.':lockout'); + + if ($this->attempts($key) > $maxAttempts || $lockedOut) { + if (! $lockedOut) { + $this->cache->add($key.':lockout', time() + ($decayMinutes * 60), $decayMinutes); + } + + return true; + } + + return false; + } + + /** + * Increment the counter for a given key for a given decay time. + * + * @param string $key + * @param int $decayMinutes + * @return int + */ + public function hit($key, $decayMinutes = 1) + { + $this->cache->add($key, 1, $decayMinutes); + + return (int) $this->cache->increment($key); + } + + /** + * Get the number of attempts for the given key. + * + * @param string $key + * @return mixed + */ + public function attempts($key) + { + return $this->cache->get($key, 0); + } + + /** + * Clear the hits and lockout for the given key. + * + * @param string $key + * @return void + */ + public function clear($key) + { + $this->cache->forget($key); + + $this->cache->forget($key.':lockout'); + } + + /** + * Get the number of seconds until the "key" is accessible again. + * + * @param string $key + * @return int + */ + public function availableIn($key) + { + return $this->cache->get($key.':lockout') - time(); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php b/application/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php index e5f06f4..aeea3f4 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php @@ -1,186 +1,197 @@ -redis = $redis; - $this->connection = $connection; - $this->prefix = strlen($prefix) > 0 ? $prefix.':' : ''; - } - - /** - * Retrieve an item from the cache by key. - * - * @param string $key - * @return mixed - */ - public function get($key) - { - if ( ! is_null($value = $this->connection()->get($this->prefix.$key))) - { - return is_numeric($value) ? $value : unserialize($value); - } - } - - /** - * Store an item in the cache for a given number of minutes. - * - * @param string $key - * @param mixed $value - * @param int $minutes - * @return void - */ - public function put($key, $value, $minutes) - { - $value = is_numeric($value) ? $value : serialize($value); - - $minutes = max(1, $minutes); - - $this->connection()->setex($this->prefix.$key, $minutes * 60, $value); - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int - */ - public function increment($key, $value = 1) - { - return $this->connection()->incrby($this->prefix.$key, $value); - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int - */ - public function decrement($key, $value = 1) - { - return $this->connection()->decrby($this->prefix.$key, $value); - } - - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function forever($key, $value) - { - $value = is_numeric($value) ? $value : serialize($value); - - $this->connection()->set($this->prefix.$key, $value); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - return (bool) $this->connection()->del($this->prefix.$key); - } - - /** - * Remove all items from the cache. - * - * @return void - */ - public function flush() - { - $this->connection()->flushdb(); - } - - /** - * Begin executing a new tags operation. - * - * @param array|mixed $names - * @return \Illuminate\Cache\RedisTaggedCache - */ - public function tags($names) - { - return new RedisTaggedCache($this, new TagSet($this, is_array($names) ? $names : func_get_args())); - } - - /** - * Get the Redis connection instance. - * - * @return \Predis\ClientInterface - */ - public function connection() - { - return $this->redis->connection($this->connection); - } - - /** - * Set the connection name to be used. - * - * @param string $connection - * @return void - */ - public function setConnection($connection) - { - $this->connection = $connection; - } - - /** - * Get the Redis database instance. - * - * @return \Illuminate\Redis\Database - */ - public function getRedis() - { - return $this->redis; - } - - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } - +class RedisStore extends TaggableStore implements Store +{ + /** + * The Redis database connection. + * + * @var \Illuminate\Redis\Database + */ + protected $redis; + + /** + * A string that should be prepended to keys. + * + * @var string + */ + protected $prefix; + + /** + * The Redis connection that should be used. + * + * @var string + */ + protected $connection; + + /** + * Create a new Redis store. + * + * @param \Illuminate\Redis\Database $redis + * @param string $prefix + * @param string $connection + * @return void + */ + public function __construct(Redis $redis, $prefix = '', $connection = 'default') + { + $this->redis = $redis; + $this->setPrefix($prefix); + $this->connection = $connection; + } + + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @return mixed + */ + public function get($key) + { + if (! is_null($value = $this->connection()->get($this->prefix.$key))) { + return is_numeric($value) ? $value : unserialize($value); + } + } + + /** + * Store an item in the cache for a given number of minutes. + * + * @param string $key + * @param mixed $value + * @param int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + $value = is_numeric($value) ? $value : serialize($value); + + $minutes = max(1, $minutes); + + $this->connection()->setex($this->prefix.$key, $minutes * 60, $value); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function increment($key, $value = 1) + { + return $this->connection()->incrby($this->prefix.$key, $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function decrement($key, $value = 1) + { + return $this->connection()->decrby($this->prefix.$key, $value); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $value = is_numeric($value) ? $value : serialize($value); + + $this->connection()->set($this->prefix.$key, $value); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + return (bool) $this->connection()->del($this->prefix.$key); + } + + /** + * Remove all items from the cache. + * + * @return void + */ + public function flush() + { + $this->connection()->flushdb(); + } + + /** + * Begin executing a new tags operation. + * + * @param array|mixed $names + * @return \Illuminate\Cache\RedisTaggedCache + */ + public function tags($names) + { + return new RedisTaggedCache($this, new TagSet($this, is_array($names) ? $names : func_get_args())); + } + + /** + * Get the Redis connection instance. + * + * @return \Predis\ClientInterface + */ + public function connection() + { + return $this->redis->connection($this->connection); + } + + /** + * Set the connection name to be used. + * + * @param string $connection + * @return void + */ + public function setConnection($connection) + { + $this->connection = $connection; + } + + /** + * Get the Redis database instance. + * + * @return \Illuminate\Redis\Database + */ + public function getRedis() + { + return $this->redis; + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * Set the cache key prefix. + * + * @param string $prefix + * @return void + */ + public function setPrefix($prefix) + { + $this->prefix = ! empty($prefix) ? $prefix.':' : ''; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php b/application/vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php index bd54827..285eaf9 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php @@ -1,90 +1,164 @@ -pushForeverKeys($namespace = $this->tags->getNamespace(), $key); - - $this->store->forever(sha1($namespace).':'.$key, $value); - } - - /** - * Remove all items from the cache. - * - * @return void - */ - public function flush() - { - $this->deleteForeverKeys(); - - parent::flush(); - } - - /** - * Store a copy of the full key for each namespace segment. - * - * @param string $namespace - * @param string $key - * @return void - */ - protected function pushForeverKeys($namespace, $key) - { - $fullKey = $this->getPrefix().sha1($namespace).':'.$key; - - foreach (explode('|', $namespace) as $segment) - { - $this->store->connection()->lpush($this->foreverKey($segment), $fullKey); - } - } - - /** - * Delete all of the items that were stored forever. - * - * @return void - */ - protected function deleteForeverKeys() - { - foreach (explode('|', $this->tags->getNamespace()) as $segment) - { - $this->deleteForeverValues($segment = $this->foreverKey($segment)); - - $this->store->connection()->del($segment); - } - } - - /** - * Delete all of the keys that have been stored forever. - * - * @param string $foreverKey - * @return void - */ - protected function deleteForeverValues($foreverKey) - { - $forever = array_unique($this->store->connection()->lrange($foreverKey, 0, -1)); - - if (count($forever) > 0) - { - call_user_func_array(array($this->store->connection(), 'del'), $forever); - } - } - - /** - * Get the forever reference key for the segment. - * - * @param string $segment - * @return string - */ - protected function foreverKey($segment) - { - return $this->getPrefix().$segment.':forever'; - } +pushStandardKeys($this->tags->getNamespace(), $key); + + parent::put($key, $value, $minutes); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->pushForeverKeys($this->tags->getNamespace(), $key); + + parent::forever($key, $value); + } + + /** + * Remove all items from the cache. + * + * @return void + */ + public function flush() + { + $this->deleteForeverKeys(); + $this->deleteStandardKeys(); + + parent::flush(); + } + + /** + * Store standard key references into store. + * + * @param string $namespace + * @param string $key + * @return void + */ + protected function pushStandardKeys($namespace, $key) + { + $this->pushKeys($namespace, $key, self::REFERENCE_KEY_STANDARD); + } + + /** + * Store forever key references into store. + * + * @param string $namespace + * @param string $key + * @return void + */ + protected function pushForeverKeys($namespace, $key) + { + $this->pushKeys($namespace, $key, self::REFERENCE_KEY_FOREVER); + } + + /** + * Store a reference to the cache key against the reference key. + * + * @param string $namespace + * @param string $key + * @param string $reference + * @return void + */ + protected function pushKeys($namespace, $key, $reference) + { + $fullKey = $this->getPrefix().sha1($namespace).':'.$key; + + foreach (explode('|', $namespace) as $segment) { + $this->store->connection()->sadd($this->referenceKey($segment, $reference), $fullKey); + } + } + + /** + * Delete all of the items that were stored forever. + * + * @return void + */ + protected function deleteForeverKeys() + { + $this->deleteKeysByReference(self::REFERENCE_KEY_FOREVER); + } + + /** + * Delete all standard items. + * + * @return void + */ + protected function deleteStandardKeys() + { + $this->deleteKeysByReference(self::REFERENCE_KEY_STANDARD); + } + + /** + * Find and delete all of the items that were stored against a reference. + * + * @param string $reference + * @return void + */ + protected function deleteKeysByReference($reference) + { + foreach (explode('|', $this->tags->getNamespace()) as $segment) { + $this->deleteValues($segment = $this->referenceKey($segment, $reference)); + + $this->store->connection()->del($segment); + } + } + + /** + * Delete item keys that have been stored against a reference. + * + * @param string $referenceKey + * @return void + */ + protected function deleteValues($referenceKey) + { + $values = array_unique($this->store->connection()->smembers($referenceKey)); + + if (count($values) > 0) { + call_user_func_array([$this->store->connection(), 'del'], $values); + } + } + + /** + * Get the reference key for the segment. + * + * @param string $segment + * @param string $suffix + * @return string + */ + protected function referenceKey($segment, $suffix) + { + return $this->getPrefix().$segment.':'.$suffix; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/Repository.php b/application/vendor/laravel/framework/src/Illuminate/Cache/Repository.php index fdde11a..fb76105 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/Repository.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/Repository.php @@ -1,369 +1,426 @@ -store = $store; - } - - /** - * Set the event dispatcher instance. - * - * @param \Illuminate\Contracts\Events\Dispatcher - * @return void - */ - public function setEventDispatcher(Dispatcher $events) - { - $this->events = $events; - } - - /** - * Fire an event for this cache instance. - * - * @param string $event - * @param array $payload - * @return void - */ - protected function fireCacheEvent($event, $payload) - { - if (isset($this->events)) - { - $this->events->fire('cache.'.$event, $payload); - } - } - - /** - * Determine if an item exists in the cache. - * - * @param string $key - * @return bool - */ - public function has($key) - { - return ! is_null($this->get($key)); - } - - /** - * Retrieve an item from the cache by key. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function get($key, $default = null) - { - $value = $this->store->get($key); - - if (is_null($value)) - { - $this->fireCacheEvent('missed', [$key]); - - $value = value($default); - } - else - { - $this->fireCacheEvent('hit', [$key, $value]); - } - - return $value; - } - - /** - * Retrieve an item from the cache and delete it. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function pull($key, $default = null) - { - $value = $this->get($key, $default); - - $this->forget($key); - - return $value; - } - - /** - * Store an item in the cache. - * - * @param string $key - * @param mixed $value - * @param \DateTime|int $minutes - * @return void - */ - public function put($key, $value, $minutes) - { - $minutes = $this->getMinutes($minutes); - - if ( ! is_null($minutes)) - { - $this->store->put($key, $value, $minutes); - - $this->fireCacheEvent('write', [$key, $value, $minutes]); - } - } - - /** - * Store an item in the cache if the key does not exist. - * - * @param string $key - * @param mixed $value - * @param \DateTime|int $minutes - * @return bool - */ - public function add($key, $value, $minutes) - { - if (method_exists($this->store, 'add')) - { - return $this->store->add($key, $value, $minutes); - } - - if (is_null($this->get($key))) - { - $this->put($key, $value, $minutes); - - return true; - } - - return false; - } - - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function forever($key, $value) - { - $this->store->forever($key, $value); - - $this->fireCacheEvent('write', [$key, $value, 0]); - } - - /** - * Get an item from the cache, or store the default value. - * - * @param string $key - * @param \DateTime|int $minutes - * @param \Closure $callback - * @return mixed - */ - public function remember($key, $minutes, Closure $callback) - { - // If the item exists in the cache we will just return this immediately - // otherwise we will execute the given Closure and cache the result - // of that execution for the given number of minutes in storage. - if ( ! is_null($value = $this->get($key))) - { - return $value; - } - - $this->put($key, $value = $callback(), $minutes); - - return $value; - } - - /** - * Get an item from the cache, or store the default value forever. - * - * @param string $key - * @param \Closure $callback - * @return mixed - */ - public function sear($key, Closure $callback) - { - return $this->rememberForever($key, $callback); - } - - /** - * Get an item from the cache, or store the default value forever. - * - * @param string $key - * @param \Closure $callback - * @return mixed - */ - public function rememberForever($key, Closure $callback) - { - // If the item exists in the cache we will just return this immediately - // otherwise we will execute the given Closure and cache the result - // of that execution for the given number of minutes. It's easy. - if ( ! is_null($value = $this->get($key))) - { - return $value; - } - - $this->forever($key, $value = $callback()); - - return $value; - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - $success = $this->store->forget($key); - - $this->fireCacheEvent('delete', [$key]); - - return $success; - } - - /** - * Get the default cache time. - * - * @return int - */ - public function getDefaultCacheTime() - { - return $this->default; - } - - /** - * Set the default cache time in minutes. - * - * @param int $minutes - * @return void - */ - public function setDefaultCacheTime($minutes) - { - $this->default = $minutes; - } - - /** - * Get the cache store implementation. - * - * @return \Illuminate\Contracts\Cache\Store - */ - public function getStore() - { - return $this->store; - } - - /** - * Determine if a cached value exists. - * - * @param string $key - * @return bool - */ - public function offsetExists($key) - { - return $this->has($key); - } - - /** - * Retrieve an item from the cache by key. - * - * @param string $key - * @return mixed - */ - public function offsetGet($key) - { - return $this->get($key); - } - - /** - * Store an item in the cache for the default time. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value) - { - $this->put($key, $value, $this->default); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return void - */ - public function offsetUnset($key) - { - $this->forget($key); - } - - /** - * Calculate the number of minutes with the given duration. - * - * @param \DateTime|int $duration - * @return int|null - */ - protected function getMinutes($duration) - { - if ($duration instanceof DateTime) - { - $fromNow = Carbon::instance($duration)->diffInMinutes(); - - return $fromNow > 0 ? $fromNow : null; - } - - return is_string($duration) ? (int) $duration : $duration; - } - - /** - * Handle dynamic calls into macros or pass missing methods to the store. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if (static::hasMacro($method)) - { - return $this->macroCall($method, $parameters); - } - - return call_user_func_array(array($this->store, $method), $parameters); - } - +class Repository implements CacheContract, ArrayAccess +{ + use Macroable { + __call as macroCall; + } + + /** + * The cache store implementation. + * + * @var \Illuminate\Contracts\Cache\Store + */ + protected $store; + + /** + * The event dispatcher implementation. + * + * @var \Illuminate\Contracts\Events\Dispatcher + */ + protected $events; + + /** + * The default number of minutes to store items. + * + * @var int + */ + protected $default = 60; + + /** + * Create a new cache repository instance. + * + * @param \Illuminate\Contracts\Cache\Store $store + * @return void + */ + public function __construct(Store $store) + { + $this->store = $store; + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function setEventDispatcher(Dispatcher $events) + { + $this->events = $events; + } + + /** + * Fire an event for this cache instance. + * + * @param string $event + * @param array $payload + * @return void + */ + protected function fireCacheEvent($event, $payload) + { + if (isset($this->events)) { + $this->events->fire('cache.'.$event, $payload); + } + } + + /** + * Determine if an item exists in the cache. + * + * @param string $key + * @return bool + */ + public function has($key) + { + return ! is_null($this->get($key)); + } + + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + $value = $this->store->get($this->itemKey($key)); + + if (is_null($value)) { + $this->fireCacheEvent('missed', [$key]); + + $value = value($default); + } else { + $this->fireCacheEvent('hit', [$key, $value]); + } + + return $value; + } + + /** + * Retrieve an item from the cache and delete it. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function pull($key, $default = null) + { + $value = $this->get($key, $default); + + $this->forget($key); + + return $value; + } + + /** + * Store an item in the cache. + * + * @param string $key + * @param mixed $value + * @param \DateTime|int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + $minutes = $this->getMinutes($minutes); + + if (! is_null($minutes)) { + $this->store->put($this->itemKey($key), $value, $minutes); + + $this->fireCacheEvent('write', [$key, $value, $minutes]); + } + } + + /** + * Store an item in the cache if the key does not exist. + * + * @param string $key + * @param mixed $value + * @param \DateTime|int $minutes + * @return bool + */ + public function add($key, $value, $minutes) + { + $minutes = $this->getMinutes($minutes); + + if (is_null($minutes)) { + return false; + } + + if (method_exists($this->store, 'add')) { + return $this->store->add($this->itemKey($key), $value, $minutes); + } + + if (is_null($this->get($key))) { + $this->put($key, $value, $minutes); + + return true; + } + + return false; + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->store->forever($this->itemKey($key), $value); + + $this->fireCacheEvent('write', [$key, $value, 0]); + } + + /** + * Get an item from the cache, or store the default value. + * + * @param string $key + * @param \DateTime|int $minutes + * @param \Closure $callback + * @return mixed + */ + public function remember($key, $minutes, Closure $callback) + { + // If the item exists in the cache we will just return this immediately + // otherwise we will execute the given Closure and cache the result + // of that execution for the given number of minutes in storage. + if (! is_null($value = $this->get($key))) { + return $value; + } + + $this->put($key, $value = $callback(), $minutes); + + return $value; + } + + /** + * Get an item from the cache, or store the default value forever. + * + * @param string $key + * @param \Closure $callback + * @return mixed + */ + public function sear($key, Closure $callback) + { + return $this->rememberForever($key, $callback); + } + + /** + * Get an item from the cache, or store the default value forever. + * + * @param string $key + * @param \Closure $callback + * @return mixed + */ + public function rememberForever($key, Closure $callback) + { + // If the item exists in the cache we will just return this immediately + // otherwise we will execute the given Closure and cache the result + // of that execution for the given number of minutes. It's easy. + if (! is_null($value = $this->get($key))) { + return $value; + } + + $this->forever($key, $value = $callback()); + + return $value; + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + $success = $this->store->forget($this->itemKey($key)); + + $this->fireCacheEvent('delete', [$key]); + + return $success; + } + + /** + * Begin executing a new tags operation if the store supports it. + * + * @param string $name + * @return \Illuminate\Cache\TaggedCache + * + * @deprecated since version 5.1. Use tags instead. + */ + public function section($name) + { + return $this->tags($name); + } + + /** + * Begin executing a new tags operation if the store supports it. + * + * @param array|mixed $names + * @return \Illuminate\Cache\TaggedCache + * + * @throws \BadMethodCallException + */ + public function tags($names) + { + if (method_exists($this->store, 'tags')) { + $taggedCache = $this->store->tags($names); + + if (! is_null($this->events)) { + $taggedCache->setEventDispatcher($this->events); + } + + $taggedCache->setDefaultCacheTime($this->default); + + return $taggedCache; + } + + throw new BadMethodCallException('This cache store does not support tagging.'); + } + + /** + * Format the key for a cache item. + * + * @param string $key + * @return string + */ + protected function itemKey($key) + { + return $key; + } + + /** + * Get the default cache time. + * + * @return int + */ + public function getDefaultCacheTime() + { + return $this->default; + } + + /** + * Set the default cache time in minutes. + * + * @param int $minutes + * @return void + */ + public function setDefaultCacheTime($minutes) + { + $this->default = $minutes; + } + + /** + * Get the cache store implementation. + * + * @return \Illuminate\Contracts\Cache\Store + */ + public function getStore() + { + return $this->store; + } + + /** + * Determine if a cached value exists. + * + * @param string $key + * @return bool + */ + public function offsetExists($key) + { + return $this->has($key); + } + + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->get($key); + } + + /** + * Store an item in the cache for the default time. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->put($key, $value, $this->default); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + $this->forget($key); + } + + /** + * Calculate the number of minutes with the given duration. + * + * @param \DateTime|int $duration + * @return int|null + */ + protected function getMinutes($duration) + { + if ($duration instanceof DateTime) { + $fromNow = Carbon::now()->diffInMinutes(Carbon::instance($duration), false); + + return $fromNow > 0 ? $fromNow : null; + } + + return is_string($duration) ? (int) $duration : $duration; + } + + /** + * Handle dynamic calls into macros or pass missing methods to the store. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + return call_user_func_array([$this->store, $method], $parameters); + } + + /** + * Clone cache repository instance. + * + * @return void + */ + public function __clone() + { + $this->store = clone $this->store; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/TagSet.php b/application/vendor/laravel/framework/src/Illuminate/Cache/TagSet.php index 1e03289..3f15f23 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/TagSet.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/TagSet.php @@ -1,99 +1,110 @@ -store = $store; - $this->names = $names; - } + /** + * Create a new TagSet instance. + * + * @param \Illuminate\Contracts\Cache\Store $store + * @param array $names + * @return void + */ + public function __construct(Store $store, array $names = []) + { + $this->store = $store; + $this->names = $names; + } - /** - * Reset all tags in the set. - * - * @return void - */ - public function reset() - { - array_walk($this->names, array($this, 'resetTag')); - } + /** + * Reset all tags in the set. + * + * @return void + */ + public function reset() + { + array_walk($this->names, [$this, 'resetTag']); + } - /** - * Get the unique tag identifier for a given tag. - * - * @param string $name - * @return string - */ - public function tagId($name) - { - return $this->store->get($this->tagKey($name)) ?: $this->resetTag($name); - } + /** + * Get the unique tag identifier for a given tag. + * + * @param string $name + * @return string + */ + public function tagId($name) + { + return $this->store->get($this->tagKey($name)) ?: $this->resetTag($name); + } - /** - * Get an array of tag identifiers for all of the tags in the set. - * - * @return array - */ - protected function tagIds() - { - return array_map(array($this, 'tagId'), $this->names); - } + /** + * Get an array of tag identifiers for all of the tags in the set. + * + * @return array + */ + protected function tagIds() + { + return array_map([$this, 'tagId'], $this->names); + } - /** - * Get a unique namespace that changes when any of the tags are flushed. - * - * @return string - */ - public function getNamespace() - { - return implode('|', $this->tagIds()); - } + /** + * Get a unique namespace that changes when any of the tags are flushed. + * + * @return string + */ + public function getNamespace() + { + return implode('|', $this->tagIds()); + } - /** - * Reset the tag and return the new tag identifier. - * - * @param string $name - * @return string - */ - public function resetTag($name) - { - $this->store->forever($this->tagKey($name), $id = str_replace('.', '', uniqid('', true))); + /** + * Reset the tag and return the new tag identifier. + * + * @param string $name + * @return string + */ + public function resetTag($name) + { + $this->store->forever($this->tagKey($name), $id = str_replace('.', '', uniqid('', true))); - return $id; - } + return $id; + } - /** - * Get the tag identifier key for a given tag. - * - * @param string $name - * @return string - */ - public function tagKey($name) - { - return 'tag:'.$name.':key'; - } + /** + * Get the tag identifier key for a given tag. + * + * @param string $name + * @return string + */ + public function tagKey($name) + { + return 'tag:'.$name.':key'; + } + /** + * Get all of the tag names in the set. + * + * @return array + */ + public function getNames() + { + return $this->names; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/TaggableStore.php b/application/vendor/laravel/framework/src/Illuminate/Cache/TaggableStore.php index c0b965d..4479fcc 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/TaggableStore.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/TaggableStore.php @@ -1,27 +1,30 @@ -tags($name); - } - - /** - * Begin executing a new tags operation. - * - * @param array|mixed $names - * @return \Illuminate\Cache\TaggedCache - */ - public function tags($names) - { - return new TaggedCache($this, new TagSet($this, is_array($names) ? $names : func_get_args())); - } +abstract class TaggableStore +{ + /** + * Begin executing a new tags operation. + * + * @param string $name + * @return \Illuminate\Cache\TaggedCache + * + * @deprecated since version 5.1. Use tags instead. + */ + public function section($name) + { + return $this->tags($name); + } + /** + * Begin executing a new tags operation. + * + * @param array|mixed $names + * @return \Illuminate\Cache\TaggedCache + */ + public function tags($names) + { + return new TaggedCache($this, new TagSet($this, is_array($names) ? $names : func_get_args())); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/TaggedCache.php b/application/vendor/laravel/framework/src/Illuminate/Cache/TaggedCache.php index 30f4b1a..c1cfec8 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/TaggedCache.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/TaggedCache.php @@ -1,247 +1,92 @@ -tags = $tags; - $this->store = $store; - } - - /** - * Determine if an item exists in the cache. - * - * @param string $key - * @return bool - */ - public function has($key) - { - return ! is_null($this->get($key)); - } - - /** - * Retrieve an item from the cache by key. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function get($key, $default = null) - { - $value = $this->store->get($this->taggedItemKey($key)); - - return ! is_null($value) ? $value : value($default); - } - - /** - * Store an item in the cache for a given number of minutes. - * - * @param string $key - * @param mixed $value - * @param \DateTime|int $minutes - * @return void - */ - public function put($key, $value, $minutes) - { - $minutes = $this->getMinutes($minutes); - - if ( ! is_null($minutes)) - { - $this->store->put($this->taggedItemKey($key), $value, $minutes); - } - } - - /** - * Store an item in the cache if the key does not exist. - * - * @param string $key - * @param mixed $value - * @param \DateTime|int $minutes - * @return bool - */ - public function add($key, $value, $minutes) - { - if (is_null($this->get($key))) - { - $this->put($key, $value, $minutes); - - return true; - } - - return false; - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function increment($key, $value = 1) - { - $this->store->increment($this->taggedItemKey($key), $value); - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function decrement($key, $value = 1) - { - $this->store->decrement($this->taggedItemKey($key), $value); - } +namespace Illuminate\Cache; - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function forever($key, $value) - { - $this->store->forever($this->taggedItemKey($key), $value); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - return $this->store->forget($this->taggedItemKey($key)); - } - - /** - * Remove all items from the cache. - * - * @return void - */ - public function flush() - { - $this->tags->reset(); - } - - /** - * Get an item from the cache, or store the default value. - * - * @param string $key - * @param \DateTime|int $minutes - * @param \Closure $callback - * @return mixed - */ - public function remember($key, $minutes, Closure $callback) - { - // If the item exists in the cache we will just return this immediately - // otherwise we will execute the given Closure and cache the result - // of that execution for the given number of minutes in storage. - if ( ! is_null($value = $this->get($key))) return $value; - - $this->put($key, $value = $callback(), $minutes); - - return $value; - } - - /** - * Get an item from the cache, or store the default value forever. - * - * @param string $key - * @param \Closure $callback - * @return mixed - */ - public function sear($key, Closure $callback) - { - return $this->rememberForever($key, $callback); - } - - /** - * Get an item from the cache, or store the default value forever. - * - * @param string $key - * @param \Closure $callback - * @return mixed - */ - public function rememberForever($key, Closure $callback) - { - // If the item exists in the cache we will just return this immediately - // otherwise we will execute the given Closure and cache the result - // of that execution for the given number of minutes. It's easy. - if ( ! is_null($value = $this->get($key))) return $value; - - $this->forever($key, $value = $callback()); - - return $value; - } - - /** - * Get a fully qualified key for a tagged item. - * - * @param string $key - * @return string - */ - public function taggedItemKey($key) - { - return sha1($this->tags->getNamespace()).':'.$key; - } - - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return $this->store->getPrefix(); - } - - /** - * Calculate the number of minutes with the given duration. - * - * @param \DateTime|int $duration - * @return int|null - */ - protected function getMinutes($duration) - { - if ($duration instanceof DateTime) - { - $fromNow = Carbon::instance($duration)->diffInMinutes(); - - return $fromNow > 0 ? $fromNow : null; - } - - return is_string($duration) ? (int) $duration : $duration; - } +use Illuminate\Contracts\Cache\Store; +class TaggedCache extends Repository +{ + /** + * The tag set instance. + * + * @var \Illuminate\Cache\TagSet + */ + protected $tags; + + /** + * Create a new tagged cache instance. + * + * @param \Illuminate\Contracts\Cache\Store $store + * @param \Illuminate\Cache\TagSet $tags + * @return void + */ + public function __construct(Store $store, TagSet $tags) + { + parent::__construct($store); + + $this->tags = $tags; + } + + /** + * {@inheritdoc} + */ + protected function fireCacheEvent($event, $payload) + { + $payload[] = $this->tags->getNames(); + + parent::fireCacheEvent($event, $payload); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function increment($key, $value = 1) + { + $this->store->increment($this->itemKey($key), $value); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function decrement($key, $value = 1) + { + $this->store->decrement($this->itemKey($key), $value); + } + + /** + * Remove all items from the cache. + * + * @return void + */ + public function flush() + { + $this->tags->reset(); + } + + /** + * {@inheritdoc} + */ + protected function itemKey($key) + { + return $this->taggedItemKey($key); + } + + /** + * Get a fully qualified key for a tagged item. + * + * @param string $key + * @return string + */ + public function taggedItemKey($key) + { + return sha1($this->tags->getNamespace()).':'.$key; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/WinCacheStore.php b/application/vendor/laravel/framework/src/Illuminate/Cache/WinCacheStore.php index d4fe62e..6dc3fc7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/WinCacheStore.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/WinCacheStore.php @@ -1,121 +1,121 @@ -prefix = $prefix; - } +class WinCacheStore extends TaggableStore implements Store +{ + /** + * A string that should be prepended to keys. + * + * @var string + */ + protected $prefix; - /** - * Retrieve an item from the cache by key. - * - * @param string $key - * @return mixed - */ - public function get($key) - { - $value = wincache_ucache_get($this->prefix.$key); + /** + * Create a new WinCache store. + * + * @param string $prefix + * @return void + */ + public function __construct($prefix = '') + { + $this->prefix = $prefix; + } - if ($value !== false) - { - return $value; - } - } + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @return mixed + */ + public function get($key) + { + $value = wincache_ucache_get($this->prefix.$key); - /** - * Store an item in the cache for a given number of minutes. - * - * @param string $key - * @param mixed $value - * @param int $minutes - * @return void - */ - public function put($key, $value, $minutes) - { - wincache_ucache_set($this->prefix.$key, $value, $minutes * 60); - } + if ($value !== false) { + return $value; + } + } - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function increment($key, $value = 1) - { - return wincache_ucache_inc($this->prefix.$key, $value); - } + /** + * Store an item in the cache for a given number of minutes. + * + * @param string $key + * @param mixed $value + * @param int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + wincache_ucache_set($this->prefix.$key, $value, $minutes * 60); + } - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function decrement($key, $value = 1) - { - return wincache_ucache_dec($this->prefix.$key, $value); - } + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value = 1) + { + return wincache_ucache_inc($this->prefix.$key, $value); + } - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function forever($key, $value) - { - $this->put($key, $value, 0); - } + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value = 1) + { + return wincache_ucache_dec($this->prefix.$key, $value); + } - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - return wincache_ucache_delete($this->prefix.$key); - } + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->put($key, $value, 0); + } - /** - * Remove all items from the cache. - * - * @return void - */ - public function flush() - { - wincache_ucache_clear(); - } + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + return wincache_ucache_delete($this->prefix.$key); + } - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } + /** + * Remove all items from the cache. + * + * @return void + */ + public function flush() + { + wincache_ucache_clear(); + } + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/XCacheStore.php b/application/vendor/laravel/framework/src/Illuminate/Cache/XCacheStore.php index b60141a..7ef64cf 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/XCacheStore.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/XCacheStore.php @@ -1,121 +1,121 @@ -prefix = $prefix; - } +class XCacheStore extends TaggableStore implements Store +{ + /** + * A string that should be prepended to keys. + * + * @var string + */ + protected $prefix; - /** - * Retrieve an item from the cache by key. - * - * @param string $key - * @return mixed - */ - public function get($key) - { - $value = xcache_get($this->prefix.$key); + /** + * Create a new WinCache store. + * + * @param string $prefix + * @return void + */ + public function __construct($prefix = '') + { + $this->prefix = $prefix; + } - if (isset($value)) - { - return $value; - } - } + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @return mixed + */ + public function get($key) + { + $value = xcache_get($this->prefix.$key); - /** - * Store an item in the cache for a given number of minutes. - * - * @param string $key - * @param mixed $value - * @param int $minutes - * @return void - */ - public function put($key, $value, $minutes) - { - xcache_set($this->prefix.$key, $value, $minutes * 60); - } + if (isset($value)) { + return $value; + } + } - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int - */ - public function increment($key, $value = 1) - { - return xcache_inc($this->prefix.$key, $value); - } + /** + * Store an item in the cache for a given number of minutes. + * + * @param string $key + * @param mixed $value + * @param int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + xcache_set($this->prefix.$key, $value, $minutes * 60); + } - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int - */ - public function decrement($key, $value = 1) - { - return xcache_dec($this->prefix.$key, $value); - } + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function increment($key, $value = 1) + { + return xcache_inc($this->prefix.$key, $value); + } - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function forever($key, $value) - { - return $this->put($key, $value, 0); - } + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function decrement($key, $value = 1) + { + return xcache_dec($this->prefix.$key, $value); + } - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - return xcache_unset($this->prefix.$key); - } + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + return $this->put($key, $value, 0); + } - /** - * Remove all items from the cache. - * - * @return void - */ - public function flush() - { - xcache_clear_cache(XC_TYPE_VAR); - } + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + return xcache_unset($this->prefix.$key); + } - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } + /** + * Remove all items from the cache. + * + * @return void + */ + public function flush() + { + xcache_clear_cache(XC_TYPE_VAR); + } + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cache/composer.json b/application/vendor/laravel/framework/src/Illuminate/Cache/composer.json index ecf8933..51ee8ac 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cache/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Cache/composer.json @@ -14,10 +14,10 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*", - "nesbot/carbon": "~1.0" + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*", + "nesbot/carbon": "~1.19" }, "autoload": { "psr-4": { @@ -26,13 +26,13 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "suggest": { - "illuminate/database": "Required to use the database cache driver (5.0.*).", - "illuminate/filesystem": "Required to use the file cache driver (5.0.*).", - "illuminate/redis": "Required to use the redis cache driver (5.0.*)." + "illuminate/database": "Required to use the database cache driver (5.1.*).", + "illuminate/filesystem": "Required to use the file cache driver (5.1.*).", + "illuminate/redis": "Required to use the redis cache driver (5.1.*)." }, "minimum-stability": "dev" } diff --git a/application/vendor/laravel/framework/src/Illuminate/Config/Repository.php b/application/vendor/laravel/framework/src/Illuminate/Config/Repository.php index 5e9ffd3..184a04a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Config/Repository.php +++ b/application/vendor/laravel/framework/src/Illuminate/Config/Repository.php @@ -1,158 +1,156 @@ -items = $items; - } - - /** - * Determine if the given configuration value exists. - * - * @param string $key - * @return bool - */ - public function has($key) - { - return array_has($this->items, $key); - } - - /** - * Get the specified configuration value. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function get($key, $default = null) - { - return array_get($this->items, $key, $default); - } - - /** - * Set a given configuration value. - * - * @param array|string $key - * @param mixed $value - * @return void - */ - public function set($key, $value = null) - { - if (is_array($key)) - { - foreach ($key as $innerKey => $innerValue) - { - array_set($this->items, $innerKey, $innerValue); - } - } - else - { - array_set($this->items, $key, $value); - } - } - - /** - * Prepend a value onto an array configuration value. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function prepend($key, $value) - { - $array = $this->get($key); - - array_unshift($array, $value); - - $this->set($key, $array); - } - - /** - * Push a value onto an array configuration value. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function push($key, $value) - { - $array = $this->get($key); - - $array[] = $value; - - $this->set($key, $array); - } - - /** - * Get all of the configuration items for the application. - * - * @return array - */ - public function all() - { - return $this->items; - } - - /** - * Determine if the given configuration option exists. - * - * @param string $key - * @return bool - */ - public function offsetExists($key) - { - return $this->has($key); - } - - /** - * Get a configuration option. - * - * @param string $key - * @return mixed - */ - public function offsetGet($key) - { - return $this->get($key); - } - - /** - * Set a configuration option. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value) - { - $this->set($key, $value); - } - - /** - * Unset a configuration option. - * - * @param string $key - * @return void - */ - public function offsetUnset($key) - { - $this->set($key, null); - } - +class Repository implements ArrayAccess, ConfigContract +{ + /** + * All of the configuration items. + * + * @var array + */ + protected $items = []; + + /** + * Create a new configuration repository. + * + * @param array $items + * @return void + */ + public function __construct(array $items = []) + { + $this->items = $items; + } + + /** + * Determine if the given configuration value exists. + * + * @param string $key + * @return bool + */ + public function has($key) + { + return Arr::has($this->items, $key); + } + + /** + * Get the specified configuration value. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + return Arr::get($this->items, $key, $default); + } + + /** + * Set a given configuration value. + * + * @param array|string $key + * @param mixed $value + * @return void + */ + public function set($key, $value = null) + { + if (is_array($key)) { + foreach ($key as $innerKey => $innerValue) { + Arr::set($this->items, $innerKey, $innerValue); + } + } else { + Arr::set($this->items, $key, $value); + } + } + + /** + * Prepend a value onto an array configuration value. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function prepend($key, $value) + { + $array = $this->get($key); + + array_unshift($array, $value); + + $this->set($key, $array); + } + + /** + * Push a value onto an array configuration value. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function push($key, $value) + { + $array = $this->get($key); + + $array[] = $value; + + $this->set($key, $array); + } + + /** + * Get all of the configuration items for the application. + * + * @return array + */ + public function all() + { + return $this->items; + } + + /** + * Determine if the given configuration option exists. + * + * @param string $key + * @return bool + */ + public function offsetExists($key) + { + return $this->has($key); + } + + /** + * Get a configuration option. + * + * @param string $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->get($key); + } + + /** + * Set a configuration option. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->set($key, $value); + } + + /** + * Unset a configuration option. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + $this->set($key, null); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Config/composer.json b/application/vendor/laravel/framework/src/Illuminate/Config/composer.json index ef3080a..b4c4f23 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Config/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Config/composer.json @@ -14,9 +14,10 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*" + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*", + "illuminate/filesystem": "5.1.*", + "illuminate/support": "5.1.*" }, "autoload": { "psr-4": { @@ -25,7 +26,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Console/AppNamespaceDetectorTrait.php b/application/vendor/laravel/framework/src/Illuminate/Console/AppNamespaceDetectorTrait.php index 1938c7b..4feede9 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Console/AppNamespaceDetectorTrait.php +++ b/application/vendor/laravel/framework/src/Illuminate/Console/AppNamespaceDetectorTrait.php @@ -1,29 +1,18 @@ - $path) - { - foreach ((array) $path as $pathChoice) - { - if (realpath(app_path()) == realpath(base_path().'/'.$pathChoice)) return $namespace; - } - } - - throw new RuntimeException("Unable to detect application namespace."); - } +use Illuminate\Container\Container; +trait AppNamespaceDetectorTrait +{ + /** + * Get the application namespace. + * + * @return string + */ + protected function getAppNamespace() + { + return Container::getInstance()->getNamespace(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Console/Application.php b/application/vendor/laravel/framework/src/Illuminate/Console/Application.php index 094b133..ee45c0a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Console/Application.php +++ b/application/vendor/laravel/framework/src/Illuminate/Console/Application.php @@ -1,4 +1,6 @@ -laravel = $laravel; - $this->setAutoExit(false); - $this->setCatchExceptions(false); - - $events->fire('artisan.start', [$this]); - } - - /** - * Run an Artisan console command by name. - * - * @param string $command - * @param array $parameters - * @return int - */ - public function call($command, array $parameters = array()) - { - $parameters['command'] = $command; - - $this->lastOutput = new BufferedOutput; - - return $this->find($command)->run(new ArrayInput($parameters), $this->lastOutput); - } - - /** - * Get the output for the last run command. - * - * @return string - */ - public function output() - { - return $this->lastOutput ? $this->lastOutput->fetch() : ''; - } - - /** - * Add a command to the console. - * - * @param \Symfony\Component\Console\Command\Command $command - * @return \Symfony\Component\Console\Command\Command - */ - public function add(SymfonyCommand $command) - { - if ($command instanceof Command) - { - $command->setLaravel($this->laravel); - } - - return $this->addToParent($command); - } - - /** - * Add the command to the parent instance. - * - * @param \Symfony\Component\Console\Command\Command $command - * @return \Symfony\Component\Console\Command\Command - */ - protected function addToParent(SymfonyCommand $command) - { - return parent::add($command); - } - - /** - * Add a command, resolving through the application. - * - * @param string $command - * @return \Symfony\Component\Console\Command\Command - */ - public function resolve($command) - { - return $this->add($this->laravel->make($command)); - } - - /** - * Resolve an array of commands through the application. - * - * @param array|mixed $commands - * @return $this - */ - public function resolveCommands($commands) - { - $commands = is_array($commands) ? $commands : func_get_args(); - - foreach ($commands as $command) - { - $this->resolve($command); - } - - return $this; - } - - /** - * Get the default input definitions for the applications. - * - * This is used to add the --env option to every available command. - * - * @return \Symfony\Component\Console\Input\InputDefinition - */ - protected function getDefaultInputDefinition() - { - $definition = parent::getDefaultInputDefinition(); - - $definition->addOption($this->getEnvironmentOption()); - - return $definition; - } - - /** - * Get the global environment option for the definition. - * - * @return \Symfony\Component\Console\Input\InputOption - */ - protected function getEnvironmentOption() - { - $message = 'The environment the command should run under.'; - - return new InputOption('--env', null, InputOption::VALUE_OPTIONAL, $message); - } - - /** - * Get the Laravel application instance. - * - * @return \Illuminate\Contracts\Foundation\Application - */ - public function getLaravel() - { - return $this->laravel; - } - +class Application extends SymfonyApplication implements ApplicationContract +{ + /** + * The Laravel application instance. + * + * @var \Illuminate\Contracts\Container\Container + */ + protected $laravel; + + /** + * The output from the previous command. + * + * @var \Symfony\Component\Console\Output\BufferedOutput + */ + protected $lastOutput; + + /** + * Create a new Artisan console application. + * + * @param \Illuminate\Contracts\Container\Container $laravel + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @param string $version + * @return void + */ + public function __construct(Container $laravel, Dispatcher $events, $version) + { + parent::__construct('Laravel Framework', $version); + + $this->laravel = $laravel; + $this->setAutoExit(false); + $this->setCatchExceptions(false); + + $events->fire('artisan.start', [$this]); + } + + /** + * Run an Artisan console command by name. + * + * @param string $command + * @param array $parameters + * @return int + */ + public function call($command, array $parameters = []) + { + $parameters = collect($parameters)->prepend($command); + + $this->lastOutput = new BufferedOutput; + + $this->setCatchExceptions(false); + + $result = $this->run(new ArrayInput($parameters->toArray()), $this->lastOutput); + + $this->setCatchExceptions(true); + + return $result; + } + + /** + * Get the output for the last run command. + * + * @return string + */ + public function output() + { + return $this->lastOutput ? $this->lastOutput->fetch() : ''; + } + + /** + * Add a command to the console. + * + * @param \Symfony\Component\Console\Command\Command $command + * @return \Symfony\Component\Console\Command\Command + */ + public function add(SymfonyCommand $command) + { + if ($command instanceof Command) { + $command->setLaravel($this->laravel); + } + + return $this->addToParent($command); + } + + /** + * Add the command to the parent instance. + * + * @param \Symfony\Component\Console\Command\Command $command + * @return \Symfony\Component\Console\Command\Command + */ + protected function addToParent(SymfonyCommand $command) + { + return parent::add($command); + } + + /** + * Add a command, resolving through the application. + * + * @param string $command + * @return \Symfony\Component\Console\Command\Command + */ + public function resolve($command) + { + return $this->add($this->laravel->make($command)); + } + + /** + * Resolve an array of commands through the application. + * + * @param array|mixed $commands + * @return $this + */ + public function resolveCommands($commands) + { + $commands = is_array($commands) ? $commands : func_get_args(); + + foreach ($commands as $command) { + $this->resolve($command); + } + + return $this; + } + + /** + * Get the default input definitions for the applications. + * + * This is used to add the --env option to every available command. + * + * @return \Symfony\Component\Console\Input\InputDefinition + */ + protected function getDefaultInputDefinition() + { + $definition = parent::getDefaultInputDefinition(); + + $definition->addOption($this->getEnvironmentOption()); + + return $definition; + } + + /** + * Get the global environment option for the definition. + * + * @return \Symfony\Component\Console\Input\InputOption + */ + protected function getEnvironmentOption() + { + $message = 'The environment the command should run under.'; + + return new InputOption('--env', null, InputOption::VALUE_OPTIONAL, $message); + } + + /** + * Get the Laravel application instance. + * + * @return \Illuminate\Contracts\Foundation\Application + */ + public function getLaravel() + { + return $this->laravel; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Console/Command.php b/application/vendor/laravel/framework/src/Illuminate/Console/Command.php index 868385b..47b79d0 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Console/Command.php +++ b/application/vendor/laravel/framework/src/Illuminate/Console/Command.php @@ -1,5 +1,8 @@ -name); - - // We will go ahead and set the name, description, and parameters on console - // commands just to make things a little easier on the developer. This is - // so they don't have to all be manually specified in the constructors. - $this->setDescription($this->description); - - $this->specifyParameters(); - } - - /** - * Specify the arguments and options on the command. - * - * @return void - */ - protected function specifyParameters() - { - // We will loop through all of the arguments and options for the command and - // set them all on the base command instance. This specifies what can get - // passed into these commands as "parameters" to control the execution. - foreach ($this->getArguments() as $arguments) - { - call_user_func_array(array($this, 'addArgument'), $arguments); - } - - foreach ($this->getOptions() as $options) - { - call_user_func_array(array($this, 'addOption'), $options); - } - } - - /** - * Run the console command. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return int - */ - public function run(InputInterface $input, OutputInterface $output) - { - $this->input = $input; - - $this->output = $output; - - return parent::run($input, $output); - } - - /** - * Execute the console command. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return mixed - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $method = method_exists($this, 'handle') ? 'handle' : 'fire'; - - return $this->laravel->call([$this, $method]); - } - - /** - * Call another console command. - * - * @param string $command - * @param array $arguments - * @return int - */ - public function call($command, array $arguments = array()) - { - $instance = $this->getApplication()->find($command); - - $arguments['command'] = $command; - - return $instance->run(new ArrayInput($arguments), $this->output); - } - - /** - * Call another console command silently. - * - * @param string $command - * @param array $arguments - * @return int - */ - public function callSilent($command, array $arguments = array()) - { - $instance = $this->getApplication()->find($command); - - $arguments['command'] = $command; - - return $instance->run(new ArrayInput($arguments), new NullOutput); - } - - /** - * Get the value of a command argument. - * - * @param string $key - * @return string|array - */ - public function argument($key = null) - { - if (is_null($key)) return $this->input->getArguments(); - - return $this->input->getArgument($key); - } - - /** - * Get the value of a command option. - * - * @param string $key - * @return string|array - */ - public function option($key = null) - { - if (is_null($key)) return $this->input->getOptions(); - - return $this->input->getOption($key); - } - - /** - * Confirm a question with the user. - * - * @param string $question - * @param bool $default - * @return bool - */ - public function confirm($question, $default = false) - { - $helper = $this->getHelperSet()->get('question'); - - $question = new ConfirmationQuestion("{$question} ", $default); - - return $helper->ask($this->input, $this->output, $question); - } - - /** - * Prompt the user for input. - * - * @param string $question - * @param string $default - * @return string - */ - public function ask($question, $default = null) - { - $helper = $this->getHelperSet()->get('question'); - - $question = new Question("$question ", $default); - - return $helper->ask($this->input, $this->output, $question); - } - - /** - * Prompt the user for input with auto completion. - * - * @param string $question - * @param array $choices - * @param string $default - * @return string - */ - public function askWithCompletion($question, array $choices, $default = null) - { - $helper = $this->getHelperSet()->get('question'); - - $question = new Question("$question ", $default); - - $question->setAutocompleterValues($choices); - - return $helper->ask($this->input, $this->output, $question); - } - - /** - * Prompt the user for input but hide the answer from the console. - * - * @param string $question - * @param bool $fallback - * @return string - */ - public function secret($question, $fallback = true) - { - $helper = $this->getHelperSet()->get('question'); - - $question = new Question("$question "); - - $question->setHidden(true)->setHiddenFallback($fallback); - - return $helper->ask($this->input, $this->output, $question); - } - - /** - * Give the user a single choice from an array of answers. - * - * @param string $question - * @param array $choices - * @param string $default - * @param mixed $attempts - * @param bool $multiple - * @return bool - */ - public function choice($question, array $choices, $default = null, $attempts = null, $multiple = null) - { - $helper = $this->getHelperSet()->get('question'); - - $question = new ChoiceQuestion("$question ", $choices, $default); - - $question->setMaxAttempts($attempts)->setMultiselect($multiple); - - return $helper->ask($this->input, $this->output, $question); - } - - /** - * Format input to textual table. - * - * @param array $headers - * @param array $rows - * @param string $style - * @return void - */ - public function table(array $headers, array $rows, $style = 'default') - { - $table = new Table($this->output); - - $table->setHeaders($headers)->setRows($rows)->setStyle($style)->render(); - } - - /** - * Write a string as information output. - * - * @param string $string - * @return void - */ - public function info($string) - { - $this->output->writeln("$string"); - } - - /** - * Write a string as standard output. - * - * @param string $string - * @return void - */ - public function line($string) - { - $this->output->writeln($string); - } - - /** - * Write a string as comment output. - * - * @param string $string - * @return void - */ - public function comment($string) - { - $this->output->writeln("$string"); - } - - /** - * Write a string as question output. - * - * @param string $string - * @return void - */ - public function question($string) - { - $this->output->writeln("$string"); - } - - /** - * Write a string as error output. - * - * @param string $string - * @return void - */ - public function error($string) - { - $this->output->writeln("$string"); - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return array(); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array(); - } - - /** - * Get the output implementation. - * - * @return \Symfony\Component\Console\Output\OutputInterface - */ - public function getOutput() - { - return $this->output; - } - - /** - * Get the Laravel application instance. - * - * @return \Illuminate\Contracts\Foundation\Application - */ - public function getLaravel() - { - return $this->laravel; - } - - /** - * Set the Laravel application instance. - * - * @param \Illuminate\Contracts\Foundation\Application $laravel - * @return void - */ - public function setLaravel(LaravelApplication $laravel) - { - $this->laravel = $laravel; - } - +class Command extends SymfonyCommand +{ + /** + * The Laravel application instance. + * + * @var \Illuminate\Contracts\Foundation\Application + */ + protected $laravel; + + /** + * The input interface implementation. + * + * @var \Symfony\Component\Console\Input\InputInterface + */ + protected $input; + + /** + * The output interface implementation. + * + * @var \Illuminate\Console\OutputStyle + */ + protected $output; + + /** + * The name and signature of the console command. + * + * @var string + */ + protected $signature; + + /** + * The console command name. + * + * @var string + */ + protected $name; + + /** + * The console command description. + * + * @var string + */ + protected $description; + + /** + * Create a new console command instance. + * + * @return void + */ + public function __construct() + { + // We will go ahead and set the name, description, and parameters on console + // commands just to make things a little easier on the developer. This is + // so they don't have to all be manually specified in the constructors. + if (isset($this->signature)) { + $this->configureUsingFluentDefinition(); + } else { + parent::__construct($this->name); + } + + $this->setDescription($this->description); + + if (! isset($this->signature)) { + $this->specifyParameters(); + } + } + + /** + * Configure the console command using a fluent definition. + * + * @return void + */ + protected function configureUsingFluentDefinition() + { + list($name, $arguments, $options) = Parser::parse($this->signature); + + parent::__construct($name); + + foreach ($arguments as $argument) { + $this->getDefinition()->addArgument($argument); + } + + foreach ($options as $option) { + $this->getDefinition()->addOption($option); + } + } + + /** + * Specify the arguments and options on the command. + * + * @return void + */ + protected function specifyParameters() + { + // We will loop through all of the arguments and options for the command and + // set them all on the base command instance. This specifies what can get + // passed into these commands as "parameters" to control the execution. + foreach ($this->getArguments() as $arguments) { + call_user_func_array([$this, 'addArgument'], $arguments); + } + + foreach ($this->getOptions() as $options) { + call_user_func_array([$this, 'addOption'], $options); + } + } + + /** + * Run the console command. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @return int + */ + public function run(InputInterface $input, OutputInterface $output) + { + $this->input = $input; + + $this->output = new OutputStyle($input, $output); + + return parent::run($input, $output); + } + + /** + * Execute the console command. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @return mixed + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $method = method_exists($this, 'handle') ? 'handle' : 'fire'; + + return $this->laravel->call([$this, $method]); + } + + /** + * Call another console command. + * + * @param string $command + * @param array $arguments + * @return int + */ + public function call($command, array $arguments = []) + { + $instance = $this->getApplication()->find($command); + + $arguments['command'] = $command; + + return $instance->run(new ArrayInput($arguments), $this->output); + } + + /** + * Call another console command silently. + * + * @param string $command + * @param array $arguments + * @return int + */ + public function callSilent($command, array $arguments = []) + { + $instance = $this->getApplication()->find($command); + + $arguments['command'] = $command; + + return $instance->run(new ArrayInput($arguments), new NullOutput); + } + + /** + * Get the value of a command argument. + * + * @param string $key + * @return string|array + */ + public function argument($key = null) + { + if (is_null($key)) { + return $this->input->getArguments(); + } + + return $this->input->getArgument($key); + } + + /** + * Get the value of a command option. + * + * @param string $key + * @return string|array + */ + public function option($key = null) + { + if (is_null($key)) { + return $this->input->getOptions(); + } + + return $this->input->getOption($key); + } + + /** + * Confirm a question with the user. + * + * @param string $question + * @param bool $default + * @return bool + */ + public function confirm($question, $default = false) + { + return $this->output->confirm($question, $default); + } + + /** + * Prompt the user for input. + * + * @param string $question + * @param string $default + * @return string + */ + public function ask($question, $default = null) + { + return $this->output->ask($question, $default); + } + + /** + * Prompt the user for input with auto completion. + * + * @param string $question + * @param array $choices + * @param string $default + * @return string + */ + public function anticipate($question, array $choices, $default = null) + { + return $this->askWithCompletion($question, $choices, $default); + } + + /** + * Prompt the user for input with auto completion. + * + * @param string $question + * @param array $choices + * @param string $default + * @return string + */ + public function askWithCompletion($question, array $choices, $default = null) + { + $question = new Question($question, $default); + + $question->setAutocompleterValues($choices); + + return $this->output->askQuestion($question); + } + + /** + * Prompt the user for input but hide the answer from the console. + * + * @param string $question + * @param bool $fallback + * @return string + */ + public function secret($question, $fallback = true) + { + $question = new Question($question); + + $question->setHidden(true)->setHiddenFallback($fallback); + + return $this->output->askQuestion($question); + } + + /** + * Give the user a single choice from an array of answers. + * + * @param string $question + * @param array $choices + * @param string $default + * @param mixed $attempts + * @param bool $multiple + * @return string + */ + public function choice($question, array $choices, $default = null, $attempts = null, $multiple = null) + { + $question = new ChoiceQuestion($question, $choices, $default); + + $question->setMaxAttempts($attempts)->setMultiselect($multiple); + + return $this->output->askQuestion($question); + } + + /** + * Format input to textual table. + * + * @param array $headers + * @param \Illuminate\Contracts\Support\Arrayable|array $rows + * @param string $style + * @return void + */ + public function table(array $headers, $rows, $style = 'default') + { + $table = new Table($this->output); + + if ($rows instanceof Arrayable) { + $rows = $rows->toArray(); + } + + $table->setHeaders($headers)->setRows($rows)->setStyle($style)->render(); + } + + /** + * Write a string as information output. + * + * @param string $string + * @return void + */ + public function info($string) + { + $this->output->writeln("$string"); + } + + /** + * Write a string as standard output. + * + * @param string $string + * @return void + */ + public function line($string) + { + $this->output->writeln($string); + } + + /** + * Write a string as comment output. + * + * @param string $string + * @return void + */ + public function comment($string) + { + $this->output->writeln("$string"); + } + + /** + * Write a string as question output. + * + * @param string $string + * @return void + */ + public function question($string) + { + $this->output->writeln("$string"); + } + + /** + * Write a string as error output. + * + * @param string $string + * @return void + */ + public function error($string) + { + $this->output->writeln("$string"); + } + + /** + * Write a string as warning output. + * + * @param string $string + * @return void + */ + public function warn($string) + { + if (! $this->output->getFormatter()->hasStyle('warning')) { + $style = new OutputFormatterStyle('yellow'); + + $this->output->getFormatter()->setStyle('warning', $style); + } + + $this->output->writeln("$string"); + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return []; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return []; + } + + /** + * Get the output implementation. + * + * @return \Symfony\Component\Console\Output\OutputInterface + */ + public function getOutput() + { + return $this->output; + } + + /** + * Get the Laravel application instance. + * + * @return \Illuminate\Contracts\Foundation\Application + */ + public function getLaravel() + { + return $this->laravel; + } + + /** + * Set the Laravel application instance. + * + * @param \Illuminate\Contracts\Foundation\Application $laravel + * @return void + */ + public function setLaravel(LaravelApplication $laravel) + { + $this->laravel = $laravel; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php b/application/vendor/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php index 71872eb..30f4402 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php +++ b/application/vendor/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php @@ -1,50 +1,57 @@ -getDefaultConfirmCallback(); - - if (call_user_func($shouldConfirm)) - { - if ($this->option('force')) return true; - - $this->comment(str_repeat('*', strlen($warning) + 12)); - $this->comment('* '.$warning.' *'); - $this->comment(str_repeat('*', strlen($warning) + 12)); - $this->output->writeln(''); - - $confirmed = $this->confirm('Do you really wish to run this command? [y/N]'); - - if ( ! $confirmed) - { - $this->comment('Command Cancelled!'); - - return false; - } - } - - return true; - } - - /** - * Get the default confirmation callback. - * - * @return \Closure - */ - protected function getDefaultConfirmCallback() - { - return function() { return $this->getLaravel()->environment() == 'production'; }; - } +use Closure; +trait ConfirmableTrait +{ + /** + * Confirm before proceeding with the action. + * + * This method only asks for confirmation in production. + * + * @param string $warning + * @param \Closure|bool|null $callback + * @return bool + */ + public function confirmToProceed($warning = 'Application In Production!', $callback = null) + { + $callback = is_null($callback) ? $this->getDefaultConfirmCallback() : $callback; + + $shouldConfirm = $callback instanceof Closure ? call_user_func($callback) : $callback; + + if ($shouldConfirm) { + if ($this->option('force')) { + return true; + } + + $this->comment(str_repeat('*', strlen($warning) + 12)); + $this->comment('* '.$warning.' *'); + $this->comment(str_repeat('*', strlen($warning) + 12)); + $this->output->writeln(''); + + $confirmed = $this->confirm('Do you really wish to run this command?'); + + if (! $confirmed) { + $this->comment('Command Cancelled!'); + + return false; + } + } + + return true; + } + + /** + * Get the default confirmation callback. + * + * @return \Closure + */ + protected function getDefaultConfirmCallback() + { + return function () { + return $this->getLaravel()->environment() == 'production'; + }; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Console/GeneratorCommand.php b/application/vendor/laravel/framework/src/Illuminate/Console/GeneratorCommand.php index 7aad4ce..65203f9 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Console/GeneratorCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Console/GeneratorCommand.php @@ -1,208 +1,219 @@ -files = $files; - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - abstract protected function getStub(); - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $name = $this->parseName($this->getNameInput()); - - if ($this->files->exists($path = $this->getPath($name))) - { - $this->error($this->type.' already exists!'); - - return false; - } - - $this->makeDirectory($path); - - $this->files->put($path, $this->buildClass($name)); - - $this->info($this->type.' created successfully.'); - } - - /** - * Get the destination class path. - * - * @param string $name - * @return string - */ - protected function getPath($name) - { - $name = str_replace($this->getAppNamespace(), '', $name); - - return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'.php'; - } - - /** - * Parse the name and format according to the root namespace. - * - * @param string $name - * @return string - */ - protected function parseName($name) - { - $rootNamespace = $this->getAppNamespace(); - - if (starts_with($name, $rootNamespace)) - { - return $name; - } - - if (str_contains($name, '/')) - { - $name = str_replace('/', '\\', $name); - } - - return $this->parseName($this->getDefaultNamespace(trim($rootNamespace, '\\')).'\\'.$name); - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace; - } - - /** - * Build the directory for the class if necessary. - * - * @param string $path - * @return string - */ - protected function makeDirectory($path) - { - if ( ! $this->files->isDirectory(dirname($path))) - { - $this->files->makeDirectory(dirname($path), 0777, true, true); - } - } - - /** - * Build the class with the given name. - * - * @param string $name - * @return string - */ - protected function buildClass($name) - { - $stub = $this->files->get($this->getStub()); - - return $this->replaceNamespace($stub, $name)->replaceClass($stub, $name); - } - - /** - * Replace the namespace for the given stub. - * - * @param string $stub - * @param string $name - * @return $this - */ - protected function replaceNamespace(&$stub, $name) - { - $stub = str_replace( - '{{namespace}}', $this->getNamespace($name), $stub - ); - - $stub = str_replace( - '{{rootNamespace}}', $this->getAppNamespace(), $stub - ); - - return $this; - } - - /** - * Get the full namespace name for a given class. - * - * @param string $name - * @return string - */ - protected function getNamespace($name) - { - return trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\'); - } - - /** - * Replace the class name for the given stub. - * - * @param string $stub - * @param string $name - * @return string - */ - protected function replaceClass($stub, $name) - { - $class = str_replace($this->getNamespace($name).'\\', '', $name); - - return str_replace('{{class}}', $class, $stub); - } - - /** - * Get the desired class name from the input. - * - * @return string - */ - protected function getNameInput() - { - return $this->argument('name'); - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return array( - array('name', InputArgument::REQUIRED, 'The name of the class'), - ); - } - +abstract class GeneratorCommand extends Command +{ + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * The type of class being generated. + * + * @var string + */ + protected $type; + + /** + * Create a new controller creator command instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @return void + */ + public function __construct(Filesystem $files) + { + parent::__construct(); + + $this->files = $files; + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + abstract protected function getStub(); + + /** + * Execute the console command. + * + * @return bool|null + */ + public function fire() + { + $name = $this->parseName($this->getNameInput()); + + $path = $this->getPath($name); + + if ($this->alreadyExists($this->getNameInput())) { + $this->error($this->type.' already exists!'); + + return false; + } + + $this->makeDirectory($path); + + $this->files->put($path, $this->buildClass($name)); + + $this->info($this->type.' created successfully.'); + } + + /** + * Determine if the class already exists. + * + * @param string $rawName + * @return bool + */ + protected function alreadyExists($rawName) + { + $name = $this->parseName($rawName); + + return $this->files->exists($this->getPath($name)); + } + + /** + * Get the destination class path. + * + * @param string $name + * @return string + */ + protected function getPath($name) + { + $name = str_replace($this->laravel->getNamespace(), '', $name); + + return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'.php'; + } + + /** + * Parse the name and format according to the root namespace. + * + * @param string $name + * @return string + */ + protected function parseName($name) + { + $rootNamespace = $this->laravel->getNamespace(); + + if (Str::startsWith($name, $rootNamespace)) { + return $name; + } + + if (Str::contains($name, '/')) { + $name = str_replace('/', '\\', $name); + } + + return $this->parseName($this->getDefaultNamespace(trim($rootNamespace, '\\')).'\\'.$name); + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace; + } + + /** + * Build the directory for the class if necessary. + * + * @param string $path + * @return string + */ + protected function makeDirectory($path) + { + if (! $this->files->isDirectory(dirname($path))) { + $this->files->makeDirectory(dirname($path), 0777, true, true); + } + } + + /** + * Build the class with the given name. + * + * @param string $name + * @return string + */ + protected function buildClass($name) + { + $stub = $this->files->get($this->getStub()); + + return $this->replaceNamespace($stub, $name)->replaceClass($stub, $name); + } + + /** + * Replace the namespace for the given stub. + * + * @param string $stub + * @param string $name + * @return $this + */ + protected function replaceNamespace(&$stub, $name) + { + $stub = str_replace( + 'DummyNamespace', $this->getNamespace($name), $stub + ); + + $stub = str_replace( + 'DummyRootNamespace', $this->laravel->getNamespace(), $stub + ); + + return $this; + } + + /** + * Get the full namespace name for a given class. + * + * @param string $name + * @return string + */ + protected function getNamespace($name) + { + return trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\'); + } + + /** + * Replace the class name for the given stub. + * + * @param string $stub + * @param string $name + * @return string + */ + protected function replaceClass($stub, $name) + { + $class = str_replace($this->getNamespace($name).'\\', '', $name); + + return str_replace('DummyClass', $class, $stub); + } + + /** + * Get the desired class name from the input. + * + * @return string + */ + protected function getNameInput() + { + return trim($this->argument('name')); + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['name', InputArgument::REQUIRED, 'The name of the class'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Console/OutputStyle.php b/application/vendor/laravel/framework/src/Illuminate/Console/OutputStyle.php new file mode 100644 index 0000000..925e66d --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Console/OutputStyle.php @@ -0,0 +1,71 @@ +output = $output; + + parent::__construct($input, $output); + } + + /** + * Returns whether verbosity is quiet (-q). + * + * @return bool + */ + public function isQuiet() + { + return $this->output->isQuiet(); + } + + /** + * Returns whether verbosity is verbose (-v). + * + * @return bool + */ + public function isVerbose() + { + return $this->output->isVerbose(); + } + + /** + * Returns whether verbosity is very verbose (-vv). + * + * @return bool + */ + public function isVeryVerbose() + { + return $this->output->isVeryVerbose(); + } + + /** + * Returns whether verbosity is debug (-vvv). + * + * @return bool + */ + public function isDebug() + { + return $this->output->isDebug(); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Console/Parser.php b/application/vendor/laravel/framework/src/Illuminate/Console/Parser.php new file mode 100644 index 0000000..babba0e --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Console/Parser.php @@ -0,0 +1,134 @@ +commands('Illuminate\Console\Scheduling\ScheduleRunCommand'); - } +class ScheduleServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - 'Illuminate\Console\Scheduling\ScheduleRunCommand', - ]; - } + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->commands('Illuminate\Console\Scheduling\ScheduleRunCommand'); + } + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'Illuminate\Console\Scheduling\ScheduleRunCommand', + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php b/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php index 0d7ee67..494f0e8 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php +++ b/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php @@ -1,126 +1,122 @@ -callback = $callback; - $this->parameters = $parameters; - - if ( ! is_string($this->callback) && ! is_callable($this->callback)) - { - throw new InvalidArgumentException( - "Invalid scheduled callback event. Must be string or callable." - ); - } - } - - /** - * Run the given event. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return mixed - */ - public function run(Container $container) - { - if ($this->description) - { - touch($this->mutexPath()); - } - - try { - $response = $container->call($this->callback, $this->parameters); - } catch (\Exception $e) { - $this->removeMutex(); - - throw $e; - } - - $this->removeMutex(); - - parent::callAfterCallbacks($container); - - return $response; - } - - /** - * Remove the mutex file from disk. - * - * @return void - */ - protected function removeMutex() - { - if ($this->description) - { - @unlink($this->mutexPath()); - } - } - - /** - * Do not allow the event to overlap each other. - * - * @return $this - */ - public function withoutOverlapping() - { - if ( ! isset($this->description)) - { - throw new LogicException( - "A scheduled event name is required to prevent overlapping. Use the 'name' method before 'withoutOverlapping'." - ); - } - - return $this->skip(function() - { - return file_exists($this->mutexPath()); - }); - } - - /** - * Get the mutex path for the scheduled command. - * - * @return string - */ - protected function mutexPath() - { - return storage_path().'/framework/schedule-'.md5($this->description); - } - - /** - * Get the summary of the event for display. - * - * @return string - */ - public function getSummaryForDisplay() - { - if (is_string($this->description)) return $this->description; - - return is_string($this->callback) ? $this->callback : 'Closure'; - } - +class CallbackEvent extends Event +{ + /** + * The callback to call. + * + * @var string + */ + protected $callback; + + /** + * The parameters to pass to the method. + * + * @var array + */ + protected $parameters; + + /** + * Create a new event instance. + * + * @param string $callback + * @param array $parameters + * @return void + */ + public function __construct($callback, array $parameters = []) + { + $this->callback = $callback; + $this->parameters = $parameters; + + if (! is_string($this->callback) && ! is_callable($this->callback)) { + throw new InvalidArgumentException( + 'Invalid scheduled callback event. Must be string or callable.' + ); + } + } + + /** + * Run the given event. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return mixed + * + * @throws \Exception + */ + public function run(Container $container) + { + if ($this->description) { + touch($this->mutexPath()); + } + + try { + $response = $container->call($this->callback, $this->parameters); + } finally { + $this->removeMutex(); + } + + parent::callAfterCallbacks($container); + + return $response; + } + + /** + * Remove the mutex file from disk. + * + * @return void + */ + protected function removeMutex() + { + if ($this->description) { + @unlink($this->mutexPath()); + } + } + + /** + * Do not allow the event to overlap each other. + * + * @return $this + */ + public function withoutOverlapping() + { + if (! isset($this->description)) { + throw new LogicException( + "A scheduled event name is required to prevent overlapping. Use the 'name' method before 'withoutOverlapping'." + ); + } + + return $this->skip(function () { + return file_exists($this->mutexPath()); + }); + } + + /** + * Get the mutex path for the scheduled command. + * + * @return string + */ + protected function mutexPath() + { + return storage_path('framework/schedule-'.md5($this->description)); + } + + /** + * Get the summary of the event for display. + * + * @return string + */ + public function getSummaryForDisplay() + { + if (is_string($this->description)) { + return $this->description; + } + + return is_string($this->callback) ? $this->callback : 'Closure'; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php b/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php index 6541a95..6fee7ed 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php +++ b/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php @@ -1,4 +1,6 @@ -command = $command; - } - - /** - * Run the given event. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - public function run(Container $container) - { - if (count($this->afterCallbacks) > 0) - { - $this->runCommandInForeground($container); - } - else - { - $this->runCommandInBackground(); - } - } - - /** - * Run the command in the background using exec. - * - * @return void - */ - protected function runCommandInBackground() - { - chdir(base_path()); - - exec($this->buildCommand()); - } - - /** - * Run the command in the foreground. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - protected function runCommandInForeground(Container $container) - { - (new Process( - trim($this->buildCommand(), '& '), base_path(), null, null, null - ))->run(); - - $this->callAfterCallbacks($container); - } - - /** - * Call all of the "after" callbacks for the event. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - protected function callAfterCallbacks(Container $container) - { - foreach ($this->afterCallbacks as $callback) - { - $container->call($callback); - } - } - - /** - * Build the comand string. - * - * @return string - */ - public function buildCommand() - { - if ($this->withoutOverlapping) - { - $command = '(touch '.$this->mutexPath().'; '.$this->command.'; rm '.$this->mutexPath().') > '.$this->output.' 2>&1 &'; - } - else - { - $command = $this->command.' > '.$this->output.' 2>&1 &'; - } - - - return $this->user ? 'sudo -u '.$this->user.' '.$command : $command; - } - - /** - * Get the mutex path for the scheduled command. - * - * @return string - */ - protected function mutexPath() - { - return storage_path().'/framework/schedule-'.md5($this->expression.$this->command); - } - - /** - * Determine if the given event should run based on the Cron expression. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return bool - */ - public function isDue(Application $app) - { - if ( ! $this->runsInMaintenanceMode() && $app->isDownForMaintenance()) - { - return false; - } - - return $this->expressionPasses() && - $this->filtersPass($app) && - $this->runsInEnvironment($app->environment()); - } - - /** - * Determine if the Cron expression passes. - * - * @return bool - */ - protected function expressionPasses() - { - $date = Carbon::now(); - - if ($this->timezone) - { - $date->setTimezone($this->timezone); - } - - return CronExpression::factory($this->expression)->isDue($date->toDateTimeString()); - } - - /** - * Determine if the filters pass for the event. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return bool - */ - protected function filtersPass(Application $app) - { - if (($this->filter && ! $app->call($this->filter)) || - $this->reject && $app->call($this->reject)) - { - return false; - } - - return true; - } - - /** - * Determine if the event runs in the given environment. - * - * @param string $environment - * @return bool - */ - public function runsInEnvironment($environment) - { - return empty($this->environments) || in_array($environment, $this->environments); - } - - /** - * Determine if the event runs in maintenance mode. - * - * @return bool - */ - public function runsInMaintenanceMode() - { - return $this->evenInMaintenanceMode; - } - - /** - * The Cron expression representing the event's frequency. - * - * @param string $expression - * @return $this - */ - public function cron($expression) - { - $this->expression = $expression; - - return $this; - } - - /** - * Schedule the event to run hourly. - * - * @return $this - */ - public function hourly() - { - return $this->cron('0 * * * * *'); - } - - /** - * Schedule the event to run daily. - * - * @return $this - */ - public function daily() - { - return $this->cron('0 0 * * * *'); - } - - /** - * Schedule the command at a given time. - * - * @param string $time - * @return $this - */ - public function at($time) - { - return $this->dailyAt($time); - } - - /** - * Schedule the event to run daily at a given time (10:00, 19:30, etc). - * - * @param string $time - * @return $this - */ - public function dailyAt($time) - { - $segments = explode(':', $time); - - return $this->spliceIntoPosition(2, (int) $segments[0]) - ->spliceIntoPosition(1, count($segments) == 2 ? (int) $segments[1] : '0'); - } - - /** - * Schedule the event to run twice daily. - * - * @return $this - */ - public function twiceDaily() - { - return $this->cron('0 1,13 * * * *'); - } - - /** - * Schedule the event to run only on weekdays. - * - * @return $this - */ - public function weekdays() - { - return $this->spliceIntoPosition(5, '1-5'); - } - - /** - * Schedule the event to run only on Mondays. - * - * @return $this - */ - public function mondays() - { - return $this->days(1); - } - - /** - * Schedule the event to run only on Tuesdays. - * - * @return $this - */ - public function tuesdays() - { - return $this->days(2); - } - - /** - * Schedule the event to run only on Wednesdays. - * - * @return $this - */ - public function wednesdays() - { - return $this->days(3); - } - - /** - * Schedule the event to run only on Thursdays. - * - * @return $this - */ - public function thursdays() - { - return $this->days(4); - } - - /** - * Schedule the event to run only on Fridays. - * - * @return $this - */ - public function fridays() - { - return $this->days(5); - } - - /** - * Schedule the event to run only on Saturdays. - * - * @return $this - */ - public function saturdays() - { - return $this->days(6); - } - - /** - * Schedule the event to run only on Sundays. - * - * @return $this - */ - public function sundays() - { - return $this->days(0); - } - - /** - * Schedule the event to run weekly. - * - * @return $this - */ - public function weekly() - { - return $this->cron('0 0 * * 0 *'); - } - - /** - * Schedule the event to run weekly on a given day and time. - * - * @param int $day - * @param string $time - * @return $this - */ - public function weeklyOn($day, $time = '0:0') - { - $this->dailyAt($time); - - return $this->spliceIntoPosition(5, $day); - } - - /** - * Schedule the event to run monthly. - * - * @return $this - */ - public function monthly() - { - return $this->cron('0 0 1 * * *'); - } - - /** - * Schedule the event to run yearly. - * - * @return $this - */ - public function yearly() - { - return $this->cron('0 0 1 1 * *'); - } - - /** - * Schedule the event to run every five minutes. - * - * @return $this - */ - public function everyFiveMinutes() - { - return $this->cron('*/5 * * * * *'); - } - - /** - * Schedule the event to run every ten minutes. - * - * @return $this - */ - public function everyTenMinutes() - { - return $this->cron('*/10 * * * * *'); - } - - /** - * Schedule the event to run every thirty minutes. - * - * @return $this - */ - public function everyThirtyMinutes() - { - return $this->cron('0,30 * * * * *'); - } - - /** - * Set the days of the week the command should run on. - * - * @param array|dynamic $days - * @return $this - */ - public function days($days) - { - $days = is_array($days) ? $days : func_get_args(); - - return $this->spliceIntoPosition(5, implode(',', $days)); - } - - /** - * Set the timezone the date should be evaluated on. - * - * @param \DateTimeZone|string $timezone - * @return $this - */ - public function timezone($timezone) - { - $this->timezone = $timezone; - - return $this; - } - - /** - * Set which user the command should run as. - * - * @param string $user - * @return $this - */ - public function user($user) - { - $this->user = $user; - - return $this; - } - - /** - * Limit the environments the command should run in. - * - * @param array|dynamic $environments - * @return $this - */ - public function environments($environments) - { - $this->environments = is_array($environments) ? $environments : func_get_args(); - - return $this; - } - - /** - * State that the command should run even in maintenance mode. - * - * @return $this - */ - public function evenInMaintenanceMode() - { - $this->evenInMaintenanceMode = true; - - return $this; - } - - /** - * Do not allow the event to overlap each other. - * - * @return $this - */ - public function withoutOverlapping() - { - $this->withoutOverlapping = true; - - return $this->skip(function() - { - return file_exists($this->mutexPath()); - }); - } - - /** - * Register a callback to further filter the schedule. - * - * @param \Closure $callback - * @return $this - */ - public function when(Closure $callback) - { - $this->filter = $callback; - - return $this; - } - - /** - * Register a callback to further filter the schedule. - * - * @param \Closure $callback - * @return $this - */ - public function skip(Closure $callback) - { - $this->reject = $callback; - - return $this; - } - - /** - * Send the output of the command to a given location. - * - * @param string $location - * @return $this - */ - public function sendOutputTo($location) - { - $this->output = $location; - - return $this; - } - - /** - * E-mail the results of the scheduled operation. - * - * @param array|dynamic $addresses - * @return $this - * - * @throws \LogicException - */ - public function emailOutputTo($addresses) - { - if (is_null($this->output) || $this->output == '/dev/null') - { - throw new LogicException("Must direct output to a file in order to e-mail results."); - } - - $addresses = is_array($addresses) ? $addresses : func_get_args(); - - return $this->then(function(Mailer $mailer) use ($addresses) - { - $this->emailOutput($mailer, $addresses); - }); - } - - /** - * E-mail the output of the event to the recipients. - * - * @param \Illuminate\Contracts\Mail\Mailer $mailer - * @param array $addresses - * @return void - */ - protected function emailOutput(Mailer $mailer, $addresses) - { - $mailer->raw(file_get_contents($this->output), function($m) use ($addresses) - { - $m->subject($this->getEmailSubject()); - - foreach ($addresses as $address) - { - $m->to($address); - } - }); - } - - /** - * Get the e-mail subject line for output results. - * - * @return string - */ - protected function getEmailSubject() - { - if ($this->description) - { - return 'Scheduled Job Output ('.$this->description.')'; - } - - return 'Scheduled Job Output'; - } - - /** - * Register a callback to ping a given URL after the job runs. - * - * @param string $url - * @return $this - */ - public function thenPing($url) - { - return $this->then(function() use ($url) { (new HttpClient)->get($url); }); - } - - /** - * Register a callback to be called after the operation. - * - * @param \Closure $callback - * @return $this - */ - public function then(Closure $callback) - { - $this->afterCallbacks[] = $callback; - - return $this; - } - - /** - * Set the human-friendly description of the event. - * - * @param string $description - * @return $this - */ - public function name($description) - { - return $this->description($description); - } - - /** - * Set the human-friendly description of the event. - * - * @param string $description - * @return $this - */ - public function description($description) - { - $this->description = $description; - - return $this; - } - - /** - * Splice the given value into the given position of the expression. - * - * @param int $position - * @param string $value - * @return void - */ - protected function spliceIntoPosition($position, $value) - { - $segments = explode(' ', $this->expression); - - $segments[$position - 1] = $value; - - return $this->cron(implode(' ', $segments)); - } - - /** - * Get the summary of the event for display. - * - * @return string - */ - public function getSummaryForDisplay() - { - if (is_string($this->description)) return $this->description; - - return $this->buildCommand(); - } - - /** - * Get the Cron expression for the event. - * - * @return string - */ - public function getExpression() - { - return $this->expression; - } - +class Event +{ + /** + * The command string. + * + * @var string + */ + public $command; + + /** + * The cron expression representing the event's frequency. + * + * @var string + */ + public $expression = '* * * * * *'; + + /** + * The timezone the date should be evaluated on. + * + * @var \DateTimeZone|string + */ + public $timezone; + + /** + * The user the command should run as. + * + * @var string + */ + public $user; + + /** + * The list of environments the command should run under. + * + * @var array + */ + public $environments = []; + + /** + * Indicates if the command should run in maintenance mode. + * + * @var bool + */ + public $evenInMaintenanceMode = false; + + /** + * Indicates if the command should not overlap itself. + * + * @var bool + */ + public $withoutOverlapping = false; + + /** + * The filter callback. + * + * @var \Closure + */ + protected $filter; + + /** + * The reject callback. + * + * @var \Closure + */ + protected $reject; + + /** + * The location that output should be sent to. + * + * @var string + */ + public $output = '/dev/null'; + + /** + * Indicates whether output should be appended. + * + * @var bool + */ + protected $shouldAppendOutput = false; + + /** + * The array of callbacks to be run before the event is started. + * + * @var array + */ + protected $beforeCallbacks = []; + + /** + * The array of callbacks to be run after the event is finished. + * + * @var array + */ + protected $afterCallbacks = []; + + /** + * The human readable description of the event. + * + * @var string + */ + public $description; + + /** + * Create a new event instance. + * + * @param string $command + * @return void + */ + public function __construct($command) + { + $this->command = $command; + $this->output = $this->getDefaultOutput(); + } + + /** + * Get the default output depending on the OS. + * + * @return string + */ + protected function getDefaultOutput() + { + return (DIRECTORY_SEPARATOR == '\\') ? 'NUL' : '/dev/null'; + } + + /** + * Run the given event. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function run(Container $container) + { + if (count($this->afterCallbacks) > 0 || count($this->beforeCallbacks) > 0) { + $this->runCommandInForeground($container); + } else { + $this->runCommandInBackground(); + } + } + + /** + * Run the command in the background using exec. + * + * @return void + */ + protected function runCommandInBackground() + { + chdir(base_path()); + + exec($this->buildCommand()); + } + + /** + * Run the command in the foreground. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + protected function runCommandInForeground(Container $container) + { + $this->callBeforeCallbacks($container); + + (new Process( + trim($this->buildCommand(), '& '), base_path(), null, null, null + ))->run(); + + $this->callAfterCallbacks($container); + } + + /** + * Call all of the "before" callbacks for the event. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + protected function callBeforeCallbacks(Container $container) + { + foreach ($this->beforeCallbacks as $callback) { + $container->call($callback); + } + } + + /** + * Call all of the "after" callbacks for the event. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + protected function callAfterCallbacks(Container $container) + { + foreach ($this->afterCallbacks as $callback) { + $container->call($callback); + } + } + + /** + * Build the command string. + * + * @return string + */ + public function buildCommand() + { + $output = ProcessUtils::escapeArgument($this->output); + + $redirect = $this->shouldAppendOutput ? ' >> ' : ' > '; + + if ($this->withoutOverlapping) { + if (windows_os()) { + $command = '(echo \'\' > "'.$this->mutexPath().'" & '.$this->command.' & del "'.$this->mutexPath().'")'.$redirect.$output.' 2>&1 &'; + } else { + $command = '(touch '.$this->mutexPath().'; '.$this->command.'; rm '.$this->mutexPath().')'.$redirect.$output.' 2>&1 &'; + } + } else { + $command = $this->command.$redirect.$output.' 2>&1 &'; + } + + return $this->user && ! windows_os() ? 'sudo -u '.$this->user.' -- sh -c \''.$command.'\'' : $command; + } + + /** + * Get the mutex path for the scheduled command. + * + * @return string + */ + protected function mutexPath() + { + return storage_path('framework/schedule-'.md5($this->expression.$this->command)); + } + + /** + * Determine if the given event should run based on the Cron expression. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return bool + */ + public function isDue(Application $app) + { + if (! $this->runsInMaintenanceMode() && $app->isDownForMaintenance()) { + return false; + } + + return $this->expressionPasses() && + $this->filtersPass($app) && + $this->runsInEnvironment($app->environment()); + } + + /** + * Determine if the Cron expression passes. + * + * @return bool + */ + protected function expressionPasses() + { + $date = Carbon::now(); + + if ($this->timezone) { + $date->setTimezone($this->timezone); + } + + return CronExpression::factory($this->expression)->isDue($date->toDateTimeString()); + } + + /** + * Determine if the filters pass for the event. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return bool + */ + protected function filtersPass(Application $app) + { + if (($this->filter && ! $app->call($this->filter)) || + $this->reject && $app->call($this->reject)) { + return false; + } + + return true; + } + + /** + * Determine if the event runs in the given environment. + * + * @param string $environment + * @return bool + */ + public function runsInEnvironment($environment) + { + return empty($this->environments) || in_array($environment, $this->environments); + } + + /** + * Determine if the event runs in maintenance mode. + * + * @return bool + */ + public function runsInMaintenanceMode() + { + return $this->evenInMaintenanceMode; + } + + /** + * The Cron expression representing the event's frequency. + * + * @param string $expression + * @return $this + */ + public function cron($expression) + { + $this->expression = $expression; + + return $this; + } + + /** + * Schedule the event to run hourly. + * + * @return $this + */ + public function hourly() + { + return $this->cron('0 * * * * *'); + } + + /** + * Schedule the event to run daily. + * + * @return $this + */ + public function daily() + { + return $this->cron('0 0 * * * *'); + } + + /** + * Schedule the command at a given time. + * + * @param string $time + * @return $this + */ + public function at($time) + { + return $this->dailyAt($time); + } + + /** + * Schedule the event to run daily at a given time (10:00, 19:30, etc). + * + * @param string $time + * @return $this + */ + public function dailyAt($time) + { + $segments = explode(':', $time); + + return $this->spliceIntoPosition(2, (int) $segments[0]) + ->spliceIntoPosition(1, count($segments) == 2 ? (int) $segments[1] : '0'); + } + + /** + * Schedule the event to run twice daily. + * + * @param int $first + * @param int $second + * @return $this + */ + public function twiceDaily($first = 1, $second = 13) + { + $hours = $first.','.$second; + + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, $hours); + } + + /** + * Schedule the event to run only on weekdays. + * + * @return $this + */ + public function weekdays() + { + return $this->spliceIntoPosition(5, '1-5'); + } + + /** + * Schedule the event to run only on Mondays. + * + * @return $this + */ + public function mondays() + { + return $this->days(1); + } + + /** + * Schedule the event to run only on Tuesdays. + * + * @return $this + */ + public function tuesdays() + { + return $this->days(2); + } + + /** + * Schedule the event to run only on Wednesdays. + * + * @return $this + */ + public function wednesdays() + { + return $this->days(3); + } + + /** + * Schedule the event to run only on Thursdays. + * + * @return $this + */ + public function thursdays() + { + return $this->days(4); + } + + /** + * Schedule the event to run only on Fridays. + * + * @return $this + */ + public function fridays() + { + return $this->days(5); + } + + /** + * Schedule the event to run only on Saturdays. + * + * @return $this + */ + public function saturdays() + { + return $this->days(6); + } + + /** + * Schedule the event to run only on Sundays. + * + * @return $this + */ + public function sundays() + { + return $this->days(0); + } + + /** + * Schedule the event to run weekly. + * + * @return $this + */ + public function weekly() + { + return $this->cron('0 0 * * 0 *'); + } + + /** + * Schedule the event to run weekly on a given day and time. + * + * @param int $day + * @param string $time + * @return $this + */ + public function weeklyOn($day, $time = '0:0') + { + $this->dailyAt($time); + + return $this->spliceIntoPosition(5, $day); + } + + /** + * Schedule the event to run monthly. + * + * @return $this + */ + public function monthly() + { + return $this->cron('0 0 1 * * *'); + } + + /** + * Schedule the event to run yearly. + * + * @return $this + */ + public function yearly() + { + return $this->cron('0 0 1 1 * *'); + } + + /** + * Schedule the event to run every minute. + * + * @return $this + */ + public function everyMinute() + { + return $this->cron('* * * * * *'); + } + + /** + * Schedule the event to run every five minutes. + * + * @return $this + */ + public function everyFiveMinutes() + { + return $this->cron('*/5 * * * * *'); + } + + /** + * Schedule the event to run every ten minutes. + * + * @return $this + */ + public function everyTenMinutes() + { + return $this->cron('*/10 * * * * *'); + } + + /** + * Schedule the event to run every thirty minutes. + * + * @return $this + */ + public function everyThirtyMinutes() + { + return $this->cron('0,30 * * * * *'); + } + + /** + * Set the days of the week the command should run on. + * + * @param array|mixed $days + * @return $this + */ + public function days($days) + { + $days = is_array($days) ? $days : func_get_args(); + + return $this->spliceIntoPosition(5, implode(',', $days)); + } + + /** + * Set the timezone the date should be evaluated on. + * + * @param \DateTimeZone|string $timezone + * @return $this + */ + public function timezone($timezone) + { + $this->timezone = $timezone; + + return $this; + } + + /** + * Set which user the command should run as. + * + * @param string $user + * @return $this + */ + public function user($user) + { + $this->user = $user; + + return $this; + } + + /** + * Limit the environments the command should run in. + * + * @param array|mixed $environments + * @return $this + */ + public function environments($environments) + { + $this->environments = is_array($environments) ? $environments : func_get_args(); + + return $this; + } + + /** + * State that the command should run even in maintenance mode. + * + * @return $this + */ + public function evenInMaintenanceMode() + { + $this->evenInMaintenanceMode = true; + + return $this; + } + + /** + * Do not allow the event to overlap each other. + * + * @return $this + */ + public function withoutOverlapping() + { + $this->withoutOverlapping = true; + + return $this->skip(function () { + return file_exists($this->mutexPath()); + }); + } + + /** + * Register a callback to further filter the schedule. + * + * @param \Closure $callback + * @return $this + */ + public function when(Closure $callback) + { + $this->filter = $callback; + + return $this; + } + + /** + * Register a callback to further filter the schedule. + * + * @param \Closure $callback + * @return $this + */ + public function skip(Closure $callback) + { + $this->reject = $callback; + + return $this; + } + + /** + * Send the output of the command to a given location. + * + * @param string $location + * @param bool $append + * @return $this + */ + public function sendOutputTo($location, $append = false) + { + $this->output = $location; + + $this->shouldAppendOutput = $append; + + return $this; + } + + /** + * Append the output of the command to a given location. + * + * @param string $location + * @return $this + */ + public function appendOutputTo($location) + { + return $this->sendOutputTo($location, true); + } + + /** + * E-mail the results of the scheduled operation. + * + * @param array|mixed $addresses + * @return $this + * + * @throws \LogicException + */ + public function emailOutputTo($addresses) + { + if (is_null($this->output) || $this->output == $this->getDefaultOutput()) { + throw new LogicException('Must direct output to a file in order to e-mail results.'); + } + + $addresses = is_array($addresses) ? $addresses : func_get_args(); + + return $this->then(function (Mailer $mailer) use ($addresses) { + $this->emailOutput($mailer, $addresses); + }); + } + + /** + * E-mail the output of the event to the recipients. + * + * @param \Illuminate\Contracts\Mail\Mailer $mailer + * @param array $addresses + * @return void + */ + protected function emailOutput(Mailer $mailer, $addresses) + { + $mailer->raw(file_get_contents($this->output), function ($m) use ($addresses) { + $m->subject($this->getEmailSubject()); + + foreach ($addresses as $address) { + $m->to($address); + } + }); + } + + /** + * Get the e-mail subject line for output results. + * + * @return string + */ + protected function getEmailSubject() + { + if ($this->description) { + return 'Scheduled Job Output ('.$this->description.')'; + } + + return 'Scheduled Job Output'; + } + + /** + * Register a callback to ping a given URL before the job runs. + * + * @param string $url + * @return $this + */ + public function pingBefore($url) + { + return $this->before(function () use ($url) { + (new HttpClient)->get($url); + }); + } + + /** + * Register a callback to be called before the operation. + * + * @param \Closure $callback + * @return $this + */ + public function before(Closure $callback) + { + $this->beforeCallbacks[] = $callback; + + return $this; + } + + /** + * Register a callback to ping a given URL after the job runs. + * + * @param string $url + * @return $this + */ + public function thenPing($url) + { + return $this->then(function () use ($url) { + (new HttpClient)->get($url); + }); + } + + /** + * Register a callback to be called after the operation. + * + * @param \Closure $callback + * @return $this + */ + public function after(Closure $callback) + { + return $this->then($callback); + } + + /** + * Register a callback to be called after the operation. + * + * @param \Closure $callback + * @return $this + */ + public function then(Closure $callback) + { + $this->afterCallbacks[] = $callback; + + return $this; + } + + /** + * Set the human-friendly description of the event. + * + * @param string $description + * @return $this + */ + public function name($description) + { + return $this->description($description); + } + + /** + * Set the human-friendly description of the event. + * + * @param string $description + * @return $this + */ + public function description($description) + { + $this->description = $description; + + return $this; + } + + /** + * Splice the given value into the given position of the expression. + * + * @param int $position + * @param string $value + * @return $this + */ + protected function spliceIntoPosition($position, $value) + { + $segments = explode(' ', $this->expression); + + $segments[$position - 1] = $value; + + return $this->cron(implode(' ', $segments)); + } + + /** + * Get the summary of the event for display. + * + * @return string + */ + public function getSummaryForDisplay() + { + if (is_string($this->description)) { + return $this->description; + } + + return $this->buildCommand(); + } + + /** + * Get the Cron expression for the event. + * + * @return string + */ + public function getExpression() + { + return $this->expression; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Schedule.php b/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Schedule.php index 5e0a850..1f56b3d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Schedule.php +++ b/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Schedule.php @@ -1,76 +1,109 @@ -events[] = $event = new CallbackEvent($callback, $parameters); + + return $event; + } -class Schedule { + /** + * Add a new Artisan command event to the schedule. + * + * @param string $command + * @param array $parameters + * @return \Illuminate\Console\Scheduling\Event + */ + public function command($command, array $parameters = []) + { + $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); - /** - * All of the events on the schedule. - * - * @var array - */ - protected $events = []; + if (defined('HHVM_VERSION')) { + $binary .= ' --php'; + } - /** - * Add a new callback event to the schedule. - * - * @param string $callback - * @param array $parameters - * @return \Illuminate\Console\Scheduling\Event - */ - public function call($callback, array $parameters = array()) - { - $this->events[] = $event = new CallbackEvent($callback, $parameters); + if (defined('ARTISAN_BINARY')) { + $artisan = ProcessUtils::escapeArgument(ARTISAN_BINARY); + } else { + $artisan = 'artisan'; + } - return $event; - } + return $this->exec("{$binary} {$artisan} {$command}", $parameters); + } - /** - * Add a new Artisan command event to the schedule. - * - * @param string $command - * @return \Illuminate\Console\Scheduling\Event - */ - public function command($command) - { - return $this->exec(PHP_BINARY.' artisan '.$command); - } + /** + * Add a new command event to the schedule. + * + * @param string $command + * @param array $parameters + * @return \Illuminate\Console\Scheduling\Event + */ + public function exec($command, array $parameters = []) + { + if (count($parameters)) { + $command .= ' '.$this->compileParameters($parameters); + } - /** - * Add a new command event to the schedule. - * - * @param string $command - * @return \Illuminate\Console\Scheduling\Event - */ - public function exec($command) - { - $this->events[] = $event = new Event($command); + $this->events[] = $event = new Event($command); - return $event; - } + return $event; + } - /** - * Get all of the events on the schedule. - * - * @return array - */ - public function events() - { - return $this->events; - } + /** + * Compile parameters for a command. + * + * @param array $parameters + * @return string + */ + protected function compileParameters(array $parameters) + { + return collect($parameters)->map(function ($value, $key) { + return is_numeric($key) ? $value : $key.'='.(is_numeric($value) ? $value : ProcessUtils::escapeArgument($value)); + })->implode(' '); + } - /** - * Get all of the events on the schedule that are due. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return array - */ - public function dueEvents(Application $app) - { - return array_filter($this->events, function($event) use ($app) - { - return $event->isDue($app); - }); - } + /** + * Get all of the events on the schedule. + * + * @return array + */ + public function events() + { + return $this->events; + } + /** + * Get all of the events on the schedule that are due. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return array + */ + public function dueEvents(Application $app) + { + return array_filter($this->events, function ($event) use ($app) { + return $event->isDue($app); + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php b/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php index da30250..3ce658c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php @@ -1,63 +1,62 @@ -schedule = $schedule; - - parent::__construct(); - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $events = $this->schedule->dueEvents($this->laravel); - - foreach ($events as $event) - { - $this->line('Running scheduled command: '.$event->getSummaryForDisplay()); - - $event->run($this->laravel); - } - - if (count($events) === 0) - { - $this->info('No scheduled commands are ready to run.'); - } - } +use Illuminate\Console\Command; +class ScheduleRunCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'schedule:run'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Run the scheduled commands'; + + /** + * The schedule instance. + * + * @var \Illuminate\Console\Scheduling\Schedule + */ + protected $schedule; + + /** + * Create a new command instance. + * + * @param \Illuminate\Console\Scheduling\Schedule $schedule + * @return void + */ + public function __construct(Schedule $schedule) + { + $this->schedule = $schedule; + + parent::__construct(); + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $events = $this->schedule->dueEvents($this->laravel); + + foreach ($events as $event) { + $this->line('Running scheduled command: '.$event->getSummaryForDisplay()); + + $event->run($this->laravel); + } + + if (count($events) === 0) { + $this->info('No scheduled commands are ready to run.'); + } + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Console/composer.json b/application/vendor/laravel/framework/src/Illuminate/Console/composer.json index c9460bd..e7c8652 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Console/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Console/composer.json @@ -14,10 +14,11 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/contracts": "5.0.*", - "symfony/console": "2.6.*", - "nesbot/carbon": "~1.0" + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*", + "symfony/console": "2.7.*", + "nesbot/carbon": "~1.19" }, "autoload": { "psr-4": { @@ -26,14 +27,13 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "suggest": { - "guzzlehttp/guzzle": "Required to use the thenPing method on schedules (~5.0).", + "guzzlehttp/guzzle": "Required to use the ping methods on schedules (~5.3|~6.0).", "mtdowling/cron-expression": "Required to use scheduling component (~1.0).", - "symfony/process": "Required to use scheduling component (2.6.*).", - "nesbot/carbon": "Required to use scheduling component (~1.0)." + "symfony/process": "Required to use scheduling component (2.7.*)." }, "minimum-stability": "dev" } diff --git a/application/vendor/laravel/framework/src/Illuminate/Container/BindingResolutionException.php b/application/vendor/laravel/framework/src/Illuminate/Container/BindingResolutionException.php index 105c018..198963e 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Container/BindingResolutionException.php +++ b/application/vendor/laravel/framework/src/Illuminate/Container/BindingResolutionException.php @@ -1,5 +1,13 @@ -bound($abstract); - } - - /** - * Determine if the given abstract type has been bound. - * - * @param string $abstract - * @return bool - */ - public function bound($abstract) - { - return isset($this->bindings[$abstract]) || isset($this->instances[$abstract]) || $this->isAlias($abstract); - } - - /** - * Determine if the given abstract type has been resolved. - * - * @param string $abstract - * @return bool - */ - public function resolved($abstract) - { - return isset($this->resolved[$abstract]) || isset($this->instances[$abstract]); - } - - /** - * Determine if a given string is an alias. - * - * @param string $name - * @return bool - */ - public function isAlias($name) - { - return isset($this->aliases[$name]); - } - - /** - * Register a binding with the container. - * - * @param string|array $abstract - * @param \Closure|string|null $concrete - * @param bool $shared - * @return void - */ - public function bind($abstract, $concrete = null, $shared = false) - { - // If the given types are actually an array, we will assume an alias is being - // defined and will grab this "real" abstract class name and register this - // alias with the container so that it can be used as a shortcut for it. - if (is_array($abstract)) - { - list($abstract, $alias) = $this->extractAlias($abstract); - - $this->alias($abstract, $alias); - } - - // If no concrete type was given, we will simply set the concrete type to the - // abstract type. This will allow concrete type to be registered as shared - // without being forced to state their classes in both of the parameter. - $this->dropStaleInstances($abstract); - - if (is_null($concrete)) - { - $concrete = $abstract; - } - - // If the factory is not a Closure, it means it is just a class name which is - // is bound into this container to the abstract type and we will just wrap - // it up inside a Closure to make things more convenient when extending. - if ( ! $concrete instanceof Closure) - { - $concrete = $this->getClosure($abstract, $concrete); - } - - $this->bindings[$abstract] = compact('concrete', 'shared'); - - // If the abstract type was already resolved in this container we'll fire the - // rebound listener so that any objects which have already gotten resolved - // can have their copy of the object updated via the listener callbacks. - if ($this->resolved($abstract)) - { - $this->rebound($abstract); - } - } - - /** - * Get the Closure to be used when building a type. - * - * @param string $abstract - * @param string $concrete - * @return \Closure - */ - protected function getClosure($abstract, $concrete) - { - return function($c, $parameters = []) use ($abstract, $concrete) - { - $method = ($abstract == $concrete) ? 'build' : 'make'; - - return $c->$method($concrete, $parameters); - }; - } - - /** - * Add a contextual binding to the container. - * - * @param string $concrete - * @param string $abstract - * @param \Closure|string $implementation - */ - public function addContextualBinding($concrete, $abstract, $implementation) - { - $this->contextual[$concrete][$abstract] = $implementation; - } - - /** - * Register a binding if it hasn't already been registered. - * - * @param string $abstract - * @param \Closure|string|null $concrete - * @param bool $shared - * @return void - */ - public function bindIf($abstract, $concrete = null, $shared = false) - { - if ( ! $this->bound($abstract)) - { - $this->bind($abstract, $concrete, $shared); - } - } - - /** - * Register a shared binding in the container. - * - * @param string $abstract - * @param \Closure|string|null $concrete - * @return void - */ - public function singleton($abstract, $concrete = null) - { - $this->bind($abstract, $concrete, true); - } - - /** - * Wrap a Closure such that it is shared. - * - * @param \Closure $closure - * @return \Closure - */ - public function share(Closure $closure) - { - return function($container) use ($closure) - { - // We'll simply declare a static variable within the Closures and if it has - // not been set we will execute the given Closures to resolve this value - // and return it back to these consumers of the method as an instance. - static $object; - - if (is_null($object)) - { - $object = $closure($container); - } - - return $object; - }; - } - - /** - * Bind a shared Closure into the container. - * - * @param string $abstract - * @param \Closure $closure - * @return void - */ - public function bindShared($abstract, Closure $closure) - { - $this->bind($abstract, $this->share($closure), true); - } - - /** - * "Extend" an abstract type in the container. - * - * @param string $abstract - * @param \Closure $closure - * @return void - * - * @throws \InvalidArgumentException - */ - public function extend($abstract, Closure $closure) - { - if (isset($this->instances[$abstract])) - { - $this->instances[$abstract] = $closure($this->instances[$abstract], $this); - - $this->rebound($abstract); - } - else - { - $this->extenders[$abstract][] = $closure; - } - } - - /** - * Register an existing instance as shared in the container. - * - * @param string $abstract - * @param mixed $instance - * @return void - */ - public function instance($abstract, $instance) - { - // First, we will extract the alias from the abstract if it is an array so we - // are using the correct name when binding the type. If we get an alias it - // will be registered with the container so we can resolve it out later. - if (is_array($abstract)) - { - list($abstract, $alias) = $this->extractAlias($abstract); - - $this->alias($abstract, $alias); - } - - unset($this->aliases[$abstract]); - - // We'll check to determine if this type has been bound before, and if it has - // we will fire the rebound callbacks registered with the container and it - // can be updated with consuming classes that have gotten resolved here. - $bound = $this->bound($abstract); - - $this->instances[$abstract] = $instance; - - if ($bound) - { - $this->rebound($abstract); - } - } - - /** - * Assign a set of tags to a given binding. - * - * @param array|string $abstracts - * @param array|mixed ...$tags - * @return void - */ - public function tag($abstracts, $tags) - { - $tags = is_array($tags) ? $tags : array_slice(func_get_args(), 1); - - foreach ($tags as $tag) - { - if ( ! isset($this->tags[$tag])) $this->tags[$tag] = []; - - foreach ((array) $abstracts as $abstract) - { - $this->tags[$tag][] = $abstract; - } - } - } - - /** - * Resolve all of the bindings for a given tag. - * - * @param string $tag - * @return array - */ - public function tagged($tag) - { - $results = []; - - if (isset($this->tags[$tag])) - { - foreach ($this->tags[$tag] as $abstract) - { - $results[] = $this->make($abstract); - } - } - - return $results; - } - - /** - * Alias a type to a different name. - * - * @param string $abstract - * @param string $alias - * @return void - */ - public function alias($abstract, $alias) - { - $this->aliases[$alias] = $abstract; - } - - /** - * Extract the type and alias from a given definition. - * - * @param array $definition - * @return array - */ - protected function extractAlias(array $definition) - { - return [key($definition), current($definition)]; - } - - /** - * Bind a new callback to an abstract's rebind event. - * - * @param string $abstract - * @param \Closure $callback - * @return mixed - */ - public function rebinding($abstract, Closure $callback) - { - $this->reboundCallbacks[$abstract][] = $callback; - - if ($this->bound($abstract)) return $this->make($abstract); - } - - /** - * Refresh an instance on the given target and method. - * - * @param string $abstract - * @param mixed $target - * @param string $method - * @return mixed - */ - public function refresh($abstract, $target, $method) - { - return $this->rebinding($abstract, function($app, $instance) use ($target, $method) - { - $target->{$method}($instance); - }); - } - - /** - * Fire the "rebound" callbacks for the given abstract type. - * - * @param string $abstract - * @return void - */ - protected function rebound($abstract) - { - $instance = $this->make($abstract); - - foreach ($this->getReboundCallbacks($abstract) as $callback) - { - call_user_func($callback, $this, $instance); - } - } - - /** - * Get the rebound callbacks for a given type. - * - * @param string $abstract - * @return array - */ - protected function getReboundCallbacks($abstract) - { - if (isset($this->reboundCallbacks[$abstract])) - { - return $this->reboundCallbacks[$abstract]; - } - - return []; - } - - /** - * Wrap the given closure such that its dependencies will be injected when executed. - * - * @param \Closure $callback - * @param array $parameters - * @return \Closure - */ - public function wrap(Closure $callback, array $parameters = []) - { - return function() use ($callback, $parameters) - { - return $this->call($callback, $parameters); - }; - } - - /** - * Call the given Closure / class@method and inject its dependencies. - * - * @param callable|string $callback - * @param array $parameters - * @param string|null $defaultMethod - * @return mixed - */ - public function call($callback, array $parameters = [], $defaultMethod = null) - { - if ($this->isCallableWithAtSign($callback) || $defaultMethod) - { - return $this->callClass($callback, $parameters, $defaultMethod); - } - - $dependencies = $this->getMethodDependencies($callback, $parameters); - - return call_user_func_array($callback, $dependencies); - } - - /** - * Determine if the given string is in Class@method syntax. - * - * @param mixed $callback - * @return bool - */ - protected function isCallableWithAtSign($callback) - { - if ( ! is_string($callback)) return false; - - return strpos($callback, '@') !== false; - } - - /** - * Get all dependencies for a given method. - * - * @param callable|string $callback - * @param array $parameters - * @return array - */ - protected function getMethodDependencies($callback, $parameters = []) - { - $dependencies = []; - - foreach ($this->getCallReflector($callback)->getParameters() as $key => $parameter) - { - $this->addDependencyForCallParameter($parameter, $parameters, $dependencies); - } - - return array_merge($dependencies, $parameters); - } - - /** - * Get the proper reflection instance for the given callback. - * - * @param callable|string $callback - * @return \ReflectionFunctionAbstract - */ - protected function getCallReflector($callback) - { - if (is_string($callback) && strpos($callback, '::') !== false) - { - $callback = explode('::', $callback); - } - - if (is_array($callback)) - { - return new ReflectionMethod($callback[0], $callback[1]); - } - - return new ReflectionFunction($callback); - } - - /** - * Get the dependency for the given call parameter. - * - * @param \ReflectionParameter $parameter - * @param array $parameters - * @param array $dependencies - * @return mixed - */ - protected function addDependencyForCallParameter(ReflectionParameter $parameter, array &$parameters, &$dependencies) - { - if (array_key_exists($parameter->name, $parameters)) - { - $dependencies[] = $parameters[$parameter->name]; - - unset($parameters[$parameter->name]); - } - elseif ($parameter->getClass()) - { - $dependencies[] = $this->make($parameter->getClass()->name); - } - elseif ($parameter->isDefaultValueAvailable()) - { - $dependencies[] = $parameter->getDefaultValue(); - } - } - - /** - * Call a string reference to a class using Class@method syntax. - * - * @param string $target - * @param array $parameters - * @param string|null $defaultMethod - * @return mixed - */ - protected function callClass($target, array $parameters = [], $defaultMethod = null) - { - $segments = explode('@', $target); - - // If the listener has an @ sign, we will assume it is being used to delimit - // the class name from the handle method name. This allows for handlers - // to run multiple handler methods in a single class for convenience. - $method = count($segments) == 2 ? $segments[1] : $defaultMethod; - - if (is_null($method)) - { - throw new InvalidArgumentException("Method not provided."); - } - - return $this->call([$this->make($segments[0]), $method], $parameters); - } - - /** - * Resolve the given type from the container. - * - * @param string $abstract - * @param array $parameters - * @return mixed - */ - public function make($abstract, $parameters = []) - { - $abstract = $this->getAlias($abstract); - - // If an instance of the type is currently being managed as a singleton we'll - // just return an existing instance instead of instantiating new instances - // so the developer can keep using the same objects instance every time. - if (isset($this->instances[$abstract])) - { - return $this->instances[$abstract]; - } - - $concrete = $this->getConcrete($abstract); - - // We're ready to instantiate an instance of the concrete type registered for - // the binding. This will instantiate the types, as well as resolve any of - // its "nested" dependencies recursively until all have gotten resolved. - if ($this->isBuildable($concrete, $abstract)) - { - $object = $this->build($concrete, $parameters); - } - else - { - $object = $this->make($concrete, $parameters); - } - - // If we defined any extenders for this type, we'll need to spin through them - // and apply them to the object being built. This allows for the extension - // of services, such as changing configuration or decorating the object. - foreach ($this->getExtenders($abstract) as $extender) - { - $object = $extender($object, $this); - } - - // If the requested type is registered as a singleton we'll want to cache off - // the instances in "memory" so we can return it later without creating an - // entirely new instance of an object on each subsequent request for it. - if ($this->isShared($abstract)) - { - $this->instances[$abstract] = $object; - } - - $this->fireResolvingCallbacks($abstract, $object); - - $this->resolved[$abstract] = true; - - return $object; - } - - /** - * Get the concrete type for a given abstract. - * - * @param string $abstract - * @return mixed $concrete - */ - protected function getConcrete($abstract) - { - if ( ! is_null($concrete = $this->getContextualConcrete($abstract))) - { - return $concrete; - } - - // If we don't have a registered resolver or concrete for the type, we'll just - // assume each type is a concrete name and will attempt to resolve it as is - // since the container should be able to resolve concretes automatically. - if ( ! isset($this->bindings[$abstract])) - { - if ($this->missingLeadingSlash($abstract) && - isset($this->bindings['\\'.$abstract])) - { - $abstract = '\\'.$abstract; - } - - return $abstract; - } - - return $this->bindings[$abstract]['concrete']; - } - - /** - * Get the contextual concrete binding for the given abstract. - * - * @param string $abstract - * @return string - */ - protected function getContextualConcrete($abstract) - { - if (isset($this->contextual[end($this->buildStack)][$abstract])) - { - return $this->contextual[end($this->buildStack)][$abstract]; - } - } - - /** - * Determine if the given abstract has a leading slash. - * - * @param string $abstract - * @return bool - */ - protected function missingLeadingSlash($abstract) - { - return is_string($abstract) && strpos($abstract, '\\') !== 0; - } - - /** - * Get the extender callbacks for a given type. - * - * @param string $abstract - * @return array - */ - protected function getExtenders($abstract) - { - if (isset($this->extenders[$abstract])) - { - return $this->extenders[$abstract]; - } - - return []; - } - - /** - * Instantiate a concrete instance of the given type. - * - * @param string $concrete - * @param array $parameters - * @return mixed - * - * @throws BindingResolutionException - */ - public function build($concrete, $parameters = []) - { - // If the concrete type is actually a Closure, we will just execute it and - // hand back the results of the functions, which allows functions to be - // used as resolvers for more fine-tuned resolution of these objects. - if ($concrete instanceof Closure) - { - return $concrete($this, $parameters); - } - - $reflector = new ReflectionClass($concrete); - - // If the type is not instantiable, the developer is attempting to resolve - // an abstract type such as an Interface of Abstract Class and there is - // no binding registered for the abstractions so we need to bail out. - if ( ! $reflector->isInstantiable()) - { - $message = "Target [$concrete] is not instantiable."; - - throw new BindingResolutionException($message); - } - - $this->buildStack[] = $concrete; - - $constructor = $reflector->getConstructor(); - - // If there are no constructors, that means there are no dependencies then - // we can just resolve the instances of the objects right away, without - // resolving any other types or dependencies out of these containers. - if (is_null($constructor)) - { - array_pop($this->buildStack); - - return new $concrete; - } - - $dependencies = $constructor->getParameters(); - - // Once we have all the constructor's parameters we can create each of the - // dependency instances and then use the reflection instances to make a - // new instance of this class, injecting the created dependencies in. - $parameters = $this->keyParametersByArgument( - $dependencies, $parameters - ); - - $instances = $this->getDependencies( - $dependencies, $parameters - ); - - array_pop($this->buildStack); - - return $reflector->newInstanceArgs($instances); - } - - /** - * Resolve all of the dependencies from the ReflectionParameters. - * - * @param array $parameters - * @param array $primitives - * @return array - */ - protected function getDependencies($parameters, array $primitives = []) - { - $dependencies = []; - - foreach ($parameters as $parameter) - { - $dependency = $parameter->getClass(); - - // If the class is null, it means the dependency is a string or some other - // primitive type which we can not resolve since it is not a class and - // we will just bomb out with an error since we have no-where to go. - if (array_key_exists($parameter->name, $primitives)) - { - $dependencies[] = $primitives[$parameter->name]; - } - elseif (is_null($dependency)) - { - $dependencies[] = $this->resolveNonClass($parameter); - } - else - { - $dependencies[] = $this->resolveClass($parameter); - } - } - - return (array) $dependencies; - } - - /** - * Resolve a non-class hinted dependency. - * - * @param \ReflectionParameter $parameter - * @return mixed - * - * @throws BindingResolutionException - */ - protected function resolveNonClass(ReflectionParameter $parameter) - { - if ($parameter->isDefaultValueAvailable()) - { - return $parameter->getDefaultValue(); - } - - $message = "Unresolvable dependency resolving [$parameter] in class {$parameter->getDeclaringClass()->getName()}"; - - throw new BindingResolutionException($message); - } - - /** - * Resolve a class based dependency from the container. - * - * @param \ReflectionParameter $parameter - * @return mixed - * - * @throws BindingResolutionException - */ - protected function resolveClass(ReflectionParameter $parameter) - { - try - { - return $this->make($parameter->getClass()->name); - } - - // If we can not resolve the class instance, we will check to see if the value - // is optional, and if it is we will return the optional parameter value as - // the value of the dependency, similarly to how we do this with scalars. - catch (BindingResolutionException $e) - { - if ($parameter->isOptional()) - { - return $parameter->getDefaultValue(); - } - - throw $e; - } - } - - /** - * If extra parameters are passed by numeric ID, rekey them by argument name. - * - * @param array $dependencies - * @param array $parameters - * @return array - */ - protected function keyParametersByArgument(array $dependencies, array $parameters) - { - foreach ($parameters as $key => $value) - { - if (is_numeric($key)) - { - unset($parameters[$key]); - - $parameters[$dependencies[$key]->name] = $value; - } - } - - return $parameters; - } - - /** - * Register a new resolving callback. - * - * @param string $abstract - * @param \Closure $callback - * @return void - */ - public function resolving($abstract, Closure $callback = null) - { - if ($callback === null && $abstract instanceof Closure) - { - $this->resolvingCallback($abstract); - } - else - { - $this->resolvingCallbacks[$abstract][] = $callback; - } - } - - /** - * Register a new after resolving callback for all types. - * - * @param string $abstract - * @param \Closure $callback - * @return void - */ - public function afterResolving($abstract, Closure $callback = null) - { - if ($abstract instanceof Closure && $callback === null) - { - $this->afterResolvingCallback($abstract); - } - else - { - $this->afterResolvingCallbacks[$abstract][] = $callback; - } - } - - /** - * Register a new resolving callback by type of its first argument. - * - * @param \Closure $callback - * @return void - */ - protected function resolvingCallback(Closure $callback) - { - $abstract = $this->getFunctionHint($callback); - - if ($abstract) - { - $this->resolvingCallbacks[$abstract][] = $callback; - } - else - { - $this->globalResolvingCallbacks[] = $callback; - } - } - - /** - * Register a new after resolving callback by type of its first argument. - * - * @param \Closure $callback - * @return void - */ - protected function afterResolvingCallback(Closure $callback) - { - $abstract = $this->getFunctionHint($callback); - - if ($abstract) - { - $this->afterResolvingCallbacks[$abstract][] = $callback; - } - else - { - $this->globalAfterResolvingCallbacks[] = $callback; - } - } - - /** - * Get the type hint for this closure's first argument. - * - * @param \Closure $callback - * @return mixed - */ - protected function getFunctionHint(Closure $callback) - { - $function = new ReflectionFunction($callback); - - if ($function->getNumberOfParameters() == 0) - { - return; - } - - $expected = $function->getParameters()[0]; - - if ( ! $expected->getClass()) - { - return; - } - - return $expected->getClass()->name; - } - - /** - * Fire all of the resolving callbacks. - * - * @param string $abstract - * @param mixed $object - * @return void - */ - protected function fireResolvingCallbacks($abstract, $object) - { - $this->fireCallbackArray($object, $this->globalResolvingCallbacks); - - $this->fireCallbackArray( - $object, $this->getCallbacksForType( - $abstract, $object, $this->resolvingCallbacks - ) - ); - - $this->fireCallbackArray($object, $this->globalAfterResolvingCallbacks); - - $this->fireCallbackArray( - $object, $this->getCallbacksForType( - $abstract, $object, $this->afterResolvingCallbacks - ) - ); - } - - /** - * Get all callbacks for a given type. - * - * @param string $abstract - * @param object $object - * @param array $callbacksPerType - * - * @return array - */ - protected function getCallbacksForType($abstract, $object, array $callbacksPerType) - { - $results = []; - - foreach ($callbacksPerType as $type => $callbacks) - { - if ($type === $abstract || $object instanceof $type) - { - $results = array_merge($results, $callbacks); - } - } - - return $results; - } - - /** - * Fire an array of callbacks with an object. - * - * @param mixed $object - * @param array $callbacks - */ - protected function fireCallbackArray($object, array $callbacks) - { - foreach ($callbacks as $callback) - { - $callback($object, $this); - } - } - - /** - * Determine if a given type is shared. - * - * @param string $abstract - * @return bool - */ - public function isShared($abstract) - { - if (isset($this->bindings[$abstract]['shared'])) - { - $shared = $this->bindings[$abstract]['shared']; - } - else - { - $shared = false; - } - - return isset($this->instances[$abstract]) || $shared === true; - } - - /** - * Determine if the given concrete is buildable. - * - * @param mixed $concrete - * @param string $abstract - * @return bool - */ - protected function isBuildable($concrete, $abstract) - { - return $concrete === $abstract || $concrete instanceof Closure; - } - - /** - * Get the alias for an abstract if available. - * - * @param string $abstract - * @return string - */ - protected function getAlias($abstract) - { - return isset($this->aliases[$abstract]) ? $this->aliases[$abstract] : $abstract; - } - - /** - * Get the container's bindings. - * - * @return array - */ - public function getBindings() - { - return $this->bindings; - } - - /** - * Drop all of the stale instances and aliases. - * - * @param string $abstract - * @return void - */ - protected function dropStaleInstances($abstract) - { - unset($this->instances[$abstract], $this->aliases[$abstract]); - } - - /** - * Remove a resolved instance from the instance cache. - * - * @param string $abstract - * @return void - */ - public function forgetInstance($abstract) - { - unset($this->instances[$abstract]); - } - - /** - * Clear all of the instances from the container. - * - * @return void - */ - public function forgetInstances() - { - $this->instances = []; - } - - /** - * Flush the container of all bindings and resolved instances. - * - * @return void - */ - public function flush() - { - $this->aliases = []; - $this->resolved = []; - $this->bindings = []; - $this->instances = []; - } - - /** - * Set the globally available instance of the container. - * - * @return static - */ - public static function getInstance() - { - return static::$instance; - } - - /** - * Set the shared instance of the container. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - public static function setInstance(ContainerContract $container) - { - static::$instance = $container; - } - - /** - * Determine if a given offset exists. - * - * @param string $key - * @return bool - */ - public function offsetExists($key) - { - return isset($this->bindings[$key]); - } - - /** - * Get the value at a given offset. - * - * @param string $key - * @return mixed - */ - public function offsetGet($key) - { - return $this->make($key); - } - - /** - * Set the value at a given offset. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value) - { - // If the value is not a Closure, we will make it one. This simply gives - // more "drop-in" replacement functionality for the Pimple which this - // container's simplest functions are base modeled and built after. - if ( ! $value instanceof Closure) - { - $value = function() use ($value) - { - return $value; - }; - } - - $this->bind($key, $value); - } - - /** - * Unset the value at a given offset. - * - * @param string $key - * @return void - */ - public function offsetUnset($key) - { - unset($this->bindings[$key], $this->instances[$key], $this->resolved[$key]); - } - - /** - * Dynamically access container services. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this[$key]; - } - - /** - * Dynamically set container services. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function __set($key, $value) - { - $this[$key] = $value; - } - +use Illuminate\Contracts\Container\BindingResolutionException as BindingResolutionContractException; + +class Container implements ArrayAccess, ContainerContract +{ + /** + * The current globally available container (if any). + * + * @var static + */ + protected static $instance; + + /** + * An array of the types that have been resolved. + * + * @var array + */ + protected $resolved = []; + + /** + * The container's bindings. + * + * @var array + */ + protected $bindings = []; + + /** + * The container's shared instances. + * + * @var array + */ + protected $instances = []; + + /** + * The registered type aliases. + * + * @var array + */ + protected $aliases = []; + + /** + * The extension closures for services. + * + * @var array + */ + protected $extenders = []; + + /** + * All of the registered tags. + * + * @var array + */ + protected $tags = []; + + /** + * The stack of concretions currently being built. + * + * @var array + */ + protected $buildStack = []; + + /** + * The contextual binding map. + * + * @var array + */ + public $contextual = []; + + /** + * All of the registered rebound callbacks. + * + * @var array + */ + protected $reboundCallbacks = []; + + /** + * All of the global resolving callbacks. + * + * @var array + */ + protected $globalResolvingCallbacks = []; + + /** + * All of the global after resolving callbacks. + * + * @var array + */ + protected $globalAfterResolvingCallbacks = []; + + /** + * All of the after resolving callbacks by class type. + * + * @var array + */ + protected $resolvingCallbacks = []; + + /** + * All of the after resolving callbacks by class type. + * + * @var array + */ + protected $afterResolvingCallbacks = []; + + /** + * Define a contextual binding. + * + * @param string $concrete + * @return \Illuminate\Contracts\Container\ContextualBindingBuilder + */ + public function when($concrete) + { + return new ContextualBindingBuilder($this, $concrete); + } + + /** + * Determine if the given abstract type has been bound. + * + * @param string $abstract + * @return bool + */ + public function bound($abstract) + { + return isset($this->bindings[$abstract]) || isset($this->instances[$abstract]) || $this->isAlias($abstract); + } + + /** + * Determine if the given abstract type has been resolved. + * + * @param string $abstract + * @return bool + */ + public function resolved($abstract) + { + if ($this->isAlias($abstract)) { + $abstract = $this->getAlias($abstract); + } + + return isset($this->resolved[$abstract]) || isset($this->instances[$abstract]); + } + + /** + * Determine if a given string is an alias. + * + * @param string $name + * @return bool + */ + public function isAlias($name) + { + return isset($this->aliases[$name]); + } + + /** + * Register a binding with the container. + * + * @param string|array $abstract + * @param \Closure|string|null $concrete + * @param bool $shared + * @return void + */ + public function bind($abstract, $concrete = null, $shared = false) + { + // If the given types are actually an array, we will assume an alias is being + // defined and will grab this "real" abstract class name and register this + // alias with the container so that it can be used as a shortcut for it. + if (is_array($abstract)) { + list($abstract, $alias) = $this->extractAlias($abstract); + + $this->alias($abstract, $alias); + } + + // If no concrete type was given, we will simply set the concrete type to the + // abstract type. This will allow concrete type to be registered as shared + // without being forced to state their classes in both of the parameter. + $this->dropStaleInstances($abstract); + + if (is_null($concrete)) { + $concrete = $abstract; + } + + // If the factory is not a Closure, it means it is just a class name which is + // bound into this container to the abstract type and we will just wrap it + // up inside its own Closure to give us more convenience when extending. + if (! $concrete instanceof Closure) { + $concrete = $this->getClosure($abstract, $concrete); + } + + $this->bindings[$abstract] = compact('concrete', 'shared'); + + // If the abstract type was already resolved in this container we'll fire the + // rebound listener so that any objects which have already gotten resolved + // can have their copy of the object updated via the listener callbacks. + if ($this->resolved($abstract)) { + $this->rebound($abstract); + } + } + + /** + * Get the Closure to be used when building a type. + * + * @param string $abstract + * @param string $concrete + * @return \Closure + */ + protected function getClosure($abstract, $concrete) + { + return function ($c, $parameters = []) use ($abstract, $concrete) { + $method = ($abstract == $concrete) ? 'build' : 'make'; + + return $c->$method($concrete, $parameters); + }; + } + + /** + * Add a contextual binding to the container. + * + * @param string $concrete + * @param string $abstract + * @param \Closure|string $implementation + * @return void + */ + public function addContextualBinding($concrete, $abstract, $implementation) + { + $this->contextual[$concrete][$abstract] = $implementation; + } + + /** + * Register a binding if it hasn't already been registered. + * + * @param string $abstract + * @param \Closure|string|null $concrete + * @param bool $shared + * @return void + */ + public function bindIf($abstract, $concrete = null, $shared = false) + { + if (! $this->bound($abstract)) { + $this->bind($abstract, $concrete, $shared); + } + } + + /** + * Register a shared binding in the container. + * + * @param string|array $abstract + * @param \Closure|string|null $concrete + * @return void + */ + public function singleton($abstract, $concrete = null) + { + $this->bind($abstract, $concrete, true); + } + + /** + * Wrap a Closure such that it is shared. + * + * @param \Closure $closure + * @return \Closure + */ + public function share(Closure $closure) + { + return function ($container) use ($closure) { + // We'll simply declare a static variable within the Closures and if it has + // not been set we will execute the given Closures to resolve this value + // and return it back to these consumers of the method as an instance. + static $object; + + if (is_null($object)) { + $object = $closure($container); + } + + return $object; + }; + } + + /** + * Bind a shared Closure into the container. + * + * @param string $abstract + * @param \Closure $closure + * @return void + * + * @deprecated since version 5.1. Use singleton instead. + */ + public function bindShared($abstract, Closure $closure) + { + $this->bind($abstract, $this->share($closure), true); + } + + /** + * "Extend" an abstract type in the container. + * + * @param string $abstract + * @param \Closure $closure + * @return void + * + * @throws \InvalidArgumentException + */ + public function extend($abstract, Closure $closure) + { + if (isset($this->instances[$abstract])) { + $this->instances[$abstract] = $closure($this->instances[$abstract], $this); + + $this->rebound($abstract); + } else { + $this->extenders[$abstract][] = $closure; + } + } + + /** + * Register an existing instance as shared in the container. + * + * @param string $abstract + * @param mixed $instance + * @return void + */ + public function instance($abstract, $instance) + { + // First, we will extract the alias from the abstract if it is an array so we + // are using the correct name when binding the type. If we get an alias it + // will be registered with the container so we can resolve it out later. + if (is_array($abstract)) { + list($abstract, $alias) = $this->extractAlias($abstract); + + $this->alias($abstract, $alias); + } + + unset($this->aliases[$abstract]); + + // We'll check to determine if this type has been bound before, and if it has + // we will fire the rebound callbacks registered with the container and it + // can be updated with consuming classes that have gotten resolved here. + $bound = $this->bound($abstract); + + $this->instances[$abstract] = $instance; + + if ($bound) { + $this->rebound($abstract); + } + } + + /** + * Assign a set of tags to a given binding. + * + * @param array|string $abstracts + * @param array|mixed ...$tags + * @return void + */ + public function tag($abstracts, $tags) + { + $tags = is_array($tags) ? $tags : array_slice(func_get_args(), 1); + + foreach ($tags as $tag) { + if (! isset($this->tags[$tag])) { + $this->tags[$tag] = []; + } + + foreach ((array) $abstracts as $abstract) { + $this->tags[$tag][] = $abstract; + } + } + } + + /** + * Resolve all of the bindings for a given tag. + * + * @param string $tag + * @return array + */ + public function tagged($tag) + { + $results = []; + + if (isset($this->tags[$tag])) { + foreach ($this->tags[$tag] as $abstract) { + $results[] = $this->make($abstract); + } + } + + return $results; + } + + /** + * Alias a type to a different name. + * + * @param string $abstract + * @param string $alias + * @return void + */ + public function alias($abstract, $alias) + { + $this->aliases[$alias] = $abstract; + } + + /** + * Extract the type and alias from a given definition. + * + * @param array $definition + * @return array + */ + protected function extractAlias(array $definition) + { + return [key($definition), current($definition)]; + } + + /** + * Bind a new callback to an abstract's rebind event. + * + * @param string $abstract + * @param \Closure $callback + * @return mixed + */ + public function rebinding($abstract, Closure $callback) + { + $this->reboundCallbacks[$abstract][] = $callback; + + if ($this->bound($abstract)) { + return $this->make($abstract); + } + } + + /** + * Refresh an instance on the given target and method. + * + * @param string $abstract + * @param mixed $target + * @param string $method + * @return mixed + */ + public function refresh($abstract, $target, $method) + { + return $this->rebinding($abstract, function ($app, $instance) use ($target, $method) { + $target->{$method}($instance); + }); + } + + /** + * Fire the "rebound" callbacks for the given abstract type. + * + * @param string $abstract + * @return void + */ + protected function rebound($abstract) + { + $instance = $this->make($abstract); + + foreach ($this->getReboundCallbacks($abstract) as $callback) { + call_user_func($callback, $this, $instance); + } + } + + /** + * Get the rebound callbacks for a given type. + * + * @param string $abstract + * @return array + */ + protected function getReboundCallbacks($abstract) + { + if (isset($this->reboundCallbacks[$abstract])) { + return $this->reboundCallbacks[$abstract]; + } + + return []; + } + + /** + * Wrap the given closure such that its dependencies will be injected when executed. + * + * @param \Closure $callback + * @param array $parameters + * @return \Closure + */ + public function wrap(Closure $callback, array $parameters = []) + { + return function () use ($callback, $parameters) { + return $this->call($callback, $parameters); + }; + } + + /** + * Call the given Closure / class@method and inject its dependencies. + * + * @param callable|string $callback + * @param array $parameters + * @param string|null $defaultMethod + * @return mixed + */ + public function call($callback, array $parameters = [], $defaultMethod = null) + { + if ($this->isCallableWithAtSign($callback) || $defaultMethod) { + return $this->callClass($callback, $parameters, $defaultMethod); + } + + $dependencies = $this->getMethodDependencies($callback, $parameters); + + return call_user_func_array($callback, $dependencies); + } + + /** + * Determine if the given string is in Class@method syntax. + * + * @param mixed $callback + * @return bool + */ + protected function isCallableWithAtSign($callback) + { + if (! is_string($callback)) { + return false; + } + + return strpos($callback, '@') !== false; + } + + /** + * Get all dependencies for a given method. + * + * @param callable|string $callback + * @param array $parameters + * @return array + */ + protected function getMethodDependencies($callback, array $parameters = []) + { + $dependencies = []; + + foreach ($this->getCallReflector($callback)->getParameters() as $key => $parameter) { + $this->addDependencyForCallParameter($parameter, $parameters, $dependencies); + } + + return array_merge($dependencies, $parameters); + } + + /** + * Get the proper reflection instance for the given callback. + * + * @param callable|string $callback + * @return \ReflectionFunctionAbstract + */ + protected function getCallReflector($callback) + { + if (is_string($callback) && strpos($callback, '::') !== false) { + $callback = explode('::', $callback); + } + + if (is_array($callback)) { + return new ReflectionMethod($callback[0], $callback[1]); + } + + return new ReflectionFunction($callback); + } + + /** + * Get the dependency for the given call parameter. + * + * @param \ReflectionParameter $parameter + * @param array $parameters + * @param array $dependencies + * @return mixed + */ + protected function addDependencyForCallParameter(ReflectionParameter $parameter, array &$parameters, &$dependencies) + { + if (array_key_exists($parameter->name, $parameters)) { + $dependencies[] = $parameters[$parameter->name]; + + unset($parameters[$parameter->name]); + } elseif ($parameter->getClass()) { + $dependencies[] = $this->make($parameter->getClass()->name); + } elseif ($parameter->isDefaultValueAvailable()) { + $dependencies[] = $parameter->getDefaultValue(); + } + } + + /** + * Call a string reference to a class using Class@method syntax. + * + * @param string $target + * @param array $parameters + * @param string|null $defaultMethod + * @return mixed + */ + protected function callClass($target, array $parameters = [], $defaultMethod = null) + { + $segments = explode('@', $target); + + // If the listener has an @ sign, we will assume it is being used to delimit + // the class name from the handle method name. This allows for handlers + // to run multiple handler methods in a single class for convenience. + $method = count($segments) == 2 ? $segments[1] : $defaultMethod; + + if (is_null($method)) { + throw new InvalidArgumentException('Method not provided.'); + } + + return $this->call([$this->make($segments[0]), $method], $parameters); + } + + /** + * Resolve the given type from the container. + * + * @param string $abstract + * @param array $parameters + * @return mixed + */ + public function make($abstract, array $parameters = []) + { + $abstract = $this->getAlias($abstract); + + // If an instance of the type is currently being managed as a singleton we'll + // just return an existing instance instead of instantiating new instances + // so the developer can keep using the same objects instance every time. + if (isset($this->instances[$abstract])) { + return $this->instances[$abstract]; + } + + $concrete = $this->getConcrete($abstract); + + // We're ready to instantiate an instance of the concrete type registered for + // the binding. This will instantiate the types, as well as resolve any of + // its "nested" dependencies recursively until all have gotten resolved. + if ($this->isBuildable($concrete, $abstract)) { + $object = $this->build($concrete, $parameters); + } else { + $object = $this->make($concrete, $parameters); + } + + // If we defined any extenders for this type, we'll need to spin through them + // and apply them to the object being built. This allows for the extension + // of services, such as changing configuration or decorating the object. + foreach ($this->getExtenders($abstract) as $extender) { + $object = $extender($object, $this); + } + + // If the requested type is registered as a singleton we'll want to cache off + // the instances in "memory" so we can return it later without creating an + // entirely new instance of an object on each subsequent request for it. + if ($this->isShared($abstract)) { + $this->instances[$abstract] = $object; + } + + $this->fireResolvingCallbacks($abstract, $object); + + $this->resolved[$abstract] = true; + + return $object; + } + + /** + * Get the concrete type for a given abstract. + * + * @param string $abstract + * @return mixed $concrete + */ + protected function getConcrete($abstract) + { + if (! is_null($concrete = $this->getContextualConcrete($abstract))) { + return $concrete; + } + + // If we don't have a registered resolver or concrete for the type, we'll just + // assume each type is a concrete name and will attempt to resolve it as is + // since the container should be able to resolve concretes automatically. + if (! isset($this->bindings[$abstract])) { + if ($this->missingLeadingSlash($abstract) && + isset($this->bindings['\\'.$abstract])) { + $abstract = '\\'.$abstract; + } + + return $abstract; + } + + return $this->bindings[$abstract]['concrete']; + } + + /** + * Get the contextual concrete binding for the given abstract. + * + * @param string $abstract + * @return string|null + */ + protected function getContextualConcrete($abstract) + { + if (isset($this->contextual[end($this->buildStack)][$abstract])) { + return $this->contextual[end($this->buildStack)][$abstract]; + } + } + + /** + * Determine if the given abstract has a leading slash. + * + * @param string $abstract + * @return bool + */ + protected function missingLeadingSlash($abstract) + { + return is_string($abstract) && strpos($abstract, '\\') !== 0; + } + + /** + * Get the extender callbacks for a given type. + * + * @param string $abstract + * @return array + */ + protected function getExtenders($abstract) + { + if (isset($this->extenders[$abstract])) { + return $this->extenders[$abstract]; + } + + return []; + } + + /** + * Instantiate a concrete instance of the given type. + * + * @param string $concrete + * @param array $parameters + * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + public function build($concrete, array $parameters = []) + { + // If the concrete type is actually a Closure, we will just execute it and + // hand back the results of the functions, which allows functions to be + // used as resolvers for more fine-tuned resolution of these objects. + if ($concrete instanceof Closure) { + return $concrete($this, $parameters); + } + + $reflector = new ReflectionClass($concrete); + + // If the type is not instantiable, the developer is attempting to resolve + // an abstract type such as an Interface of Abstract Class and there is + // no binding registered for the abstractions so we need to bail out. + if (! $reflector->isInstantiable()) { + $message = "Target [$concrete] is not instantiable."; + + throw new BindingResolutionContractException($message); + } + + $this->buildStack[] = $concrete; + + $constructor = $reflector->getConstructor(); + + // If there are no constructors, that means there are no dependencies then + // we can just resolve the instances of the objects right away, without + // resolving any other types or dependencies out of these containers. + if (is_null($constructor)) { + array_pop($this->buildStack); + + return new $concrete; + } + + $dependencies = $constructor->getParameters(); + + // Once we have all the constructor's parameters we can create each of the + // dependency instances and then use the reflection instances to make a + // new instance of this class, injecting the created dependencies in. + $parameters = $this->keyParametersByArgument( + $dependencies, $parameters + ); + + $instances = $this->getDependencies( + $dependencies, $parameters + ); + + array_pop($this->buildStack); + + return $reflector->newInstanceArgs($instances); + } + + /** + * Resolve all of the dependencies from the ReflectionParameters. + * + * @param array $parameters + * @param array $primitives + * @return array + */ + protected function getDependencies(array $parameters, array $primitives = []) + { + $dependencies = []; + + foreach ($parameters as $parameter) { + $dependency = $parameter->getClass(); + + // If the class is null, it means the dependency is a string or some other + // primitive type which we can not resolve since it is not a class and + // we will just bomb out with an error since we have no-where to go. + if (array_key_exists($parameter->name, $primitives)) { + $dependencies[] = $primitives[$parameter->name]; + } elseif (is_null($dependency)) { + $dependencies[] = $this->resolveNonClass($parameter); + } else { + $dependencies[] = $this->resolveClass($parameter); + } + } + + return (array) $dependencies; + } + + /** + * Resolve a non-class hinted dependency. + * + * @param \ReflectionParameter $parameter + * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + protected function resolveNonClass(ReflectionParameter $parameter) + { + if ($parameter->isDefaultValueAvailable()) { + return $parameter->getDefaultValue(); + } + + $message = "Unresolvable dependency resolving [$parameter] in class {$parameter->getDeclaringClass()->getName()}"; + + throw new BindingResolutionContractException($message); + } + + /** + * Resolve a class based dependency from the container. + * + * @param \ReflectionParameter $parameter + * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + protected function resolveClass(ReflectionParameter $parameter) + { + try { + return $this->make($parameter->getClass()->name); + } + + // If we can not resolve the class instance, we will check to see if the value + // is optional, and if it is we will return the optional parameter value as + // the value of the dependency, similarly to how we do this with scalars. + catch (BindingResolutionContractException $e) { + if ($parameter->isOptional()) { + return $parameter->getDefaultValue(); + } + + throw $e; + } + } + + /** + * If extra parameters are passed by numeric ID, rekey them by argument name. + * + * @param array $dependencies + * @param array $parameters + * @return array + */ + protected function keyParametersByArgument(array $dependencies, array $parameters) + { + foreach ($parameters as $key => $value) { + if (is_numeric($key)) { + unset($parameters[$key]); + + $parameters[$dependencies[$key]->name] = $value; + } + } + + return $parameters; + } + + /** + * Register a new resolving callback. + * + * @param string $abstract + * @param \Closure|null $callback + * @return void + */ + public function resolving($abstract, Closure $callback = null) + { + if ($callback === null && $abstract instanceof Closure) { + $this->resolvingCallback($abstract); + } else { + $this->resolvingCallbacks[$abstract][] = $callback; + } + } + + /** + * Register a new after resolving callback for all types. + * + * @param string $abstract + * @param \Closure|null $callback + * @return void + */ + public function afterResolving($abstract, Closure $callback = null) + { + if ($abstract instanceof Closure && $callback === null) { + $this->afterResolvingCallback($abstract); + } else { + $this->afterResolvingCallbacks[$abstract][] = $callback; + } + } + + /** + * Register a new resolving callback by type of its first argument. + * + * @param \Closure $callback + * @return void + */ + protected function resolvingCallback(Closure $callback) + { + $abstract = $this->getFunctionHint($callback); + + if ($abstract) { + $this->resolvingCallbacks[$abstract][] = $callback; + } else { + $this->globalResolvingCallbacks[] = $callback; + } + } + + /** + * Register a new after resolving callback by type of its first argument. + * + * @param \Closure $callback + * @return void + */ + protected function afterResolvingCallback(Closure $callback) + { + $abstract = $this->getFunctionHint($callback); + + if ($abstract) { + $this->afterResolvingCallbacks[$abstract][] = $callback; + } else { + $this->globalAfterResolvingCallbacks[] = $callback; + } + } + + /** + * Get the type hint for this closure's first argument. + * + * @param \Closure $callback + * @return mixed + */ + protected function getFunctionHint(Closure $callback) + { + $function = new ReflectionFunction($callback); + + if ($function->getNumberOfParameters() == 0) { + return; + } + + $expected = $function->getParameters()[0]; + + if (! $expected->getClass()) { + return; + } + + return $expected->getClass()->name; + } + + /** + * Fire all of the resolving callbacks. + * + * @param string $abstract + * @param mixed $object + * @return void + */ + protected function fireResolvingCallbacks($abstract, $object) + { + $this->fireCallbackArray($object, $this->globalResolvingCallbacks); + + $this->fireCallbackArray( + $object, $this->getCallbacksForType( + $abstract, $object, $this->resolvingCallbacks + ) + ); + + $this->fireCallbackArray($object, $this->globalAfterResolvingCallbacks); + + $this->fireCallbackArray( + $object, $this->getCallbacksForType( + $abstract, $object, $this->afterResolvingCallbacks + ) + ); + } + + /** + * Get all callbacks for a given type. + * + * @param string $abstract + * @param object $object + * @param array $callbacksPerType + * + * @return array + */ + protected function getCallbacksForType($abstract, $object, array $callbacksPerType) + { + $results = []; + + foreach ($callbacksPerType as $type => $callbacks) { + if ($type === $abstract || $object instanceof $type) { + $results = array_merge($results, $callbacks); + } + } + + return $results; + } + + /** + * Fire an array of callbacks with an object. + * + * @param mixed $object + * @param array $callbacks + * @return void + */ + protected function fireCallbackArray($object, array $callbacks) + { + foreach ($callbacks as $callback) { + $callback($object, $this); + } + } + + /** + * Determine if a given type is shared. + * + * @param string $abstract + * @return bool + */ + public function isShared($abstract) + { + if (isset($this->bindings[$abstract]['shared'])) { + $shared = $this->bindings[$abstract]['shared']; + } else { + $shared = false; + } + + return isset($this->instances[$abstract]) || $shared === true; + } + + /** + * Determine if the given concrete is buildable. + * + * @param mixed $concrete + * @param string $abstract + * @return bool + */ + protected function isBuildable($concrete, $abstract) + { + return $concrete === $abstract || $concrete instanceof Closure; + } + + /** + * Get the alias for an abstract if available. + * + * @param string $abstract + * @return string + */ + protected function getAlias($abstract) + { + if (! isset($this->aliases[$abstract])) { + return $abstract; + } + + return $this->getAlias($this->aliases[$abstract]); + } + + /** + * Get the container's bindings. + * + * @return array + */ + public function getBindings() + { + return $this->bindings; + } + + /** + * Drop all of the stale instances and aliases. + * + * @param string $abstract + * @return void + */ + protected function dropStaleInstances($abstract) + { + unset($this->instances[$abstract], $this->aliases[$abstract]); + } + + /** + * Remove a resolved instance from the instance cache. + * + * @param string $abstract + * @return void + */ + public function forgetInstance($abstract) + { + unset($this->instances[$abstract]); + } + + /** + * Clear all of the instances from the container. + * + * @return void + */ + public function forgetInstances() + { + $this->instances = []; + } + + /** + * Flush the container of all bindings and resolved instances. + * + * @return void + */ + public function flush() + { + $this->aliases = []; + $this->resolved = []; + $this->bindings = []; + $this->instances = []; + } + + /** + * Set the globally available instance of the container. + * + * @return static + */ + public static function getInstance() + { + return static::$instance; + } + + /** + * Set the shared instance of the container. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public static function setInstance(ContainerContract $container) + { + static::$instance = $container; + } + + /** + * Determine if a given offset exists. + * + * @param string $key + * @return bool + */ + public function offsetExists($key) + { + return $this->bound($key); + } + + /** + * Get the value at a given offset. + * + * @param string $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->make($key); + } + + /** + * Set the value at a given offset. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + // If the value is not a Closure, we will make it one. This simply gives + // more "drop-in" replacement functionality for the Pimple which this + // container's simplest functions are base modeled and built after. + if (! $value instanceof Closure) { + $value = function () use ($value) { + return $value; + }; + } + + $this->bind($key, $value); + } + + /** + * Unset the value at a given offset. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + unset($this->bindings[$key], $this->instances[$key], $this->resolved[$key]); + } + + /** + * Dynamically access container services. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this[$key]; + } + + /** + * Dynamically set container services. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this[$key] = $value; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Container/ContextualBindingBuilder.php b/application/vendor/laravel/framework/src/Illuminate/Container/ContextualBindingBuilder.php index c96d56b..fc5cd61 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Container/ContextualBindingBuilder.php +++ b/application/vendor/laravel/framework/src/Illuminate/Container/ContextualBindingBuilder.php @@ -1,58 +1,66 @@ -concrete = $concrete; - $this->container = $container; - } - - /** - * Define the abstract target that depends on the context. - * - * @param string $abstract - * @return $this - */ - public function needs($abstract) - { - $this->needs = $abstract; - - return $this; - } - - /** - * Define the implementation for the contextual binding. - * - * @param \Closure|string $implementation - * @return void - */ - public function give($implementation) - { - $this->container->addContextualBinding($this->concrete, $this->needs, $implementation); - } +class ContextualBindingBuilder implements ContextualBindingBuilderContract +{ + /** + * The underlying container instance. + * + * @var \Illuminate\Container\Container + */ + protected $container; + + /** + * The concrete instance. + * + * @var string + */ + protected $concrete; + + /** + * The abstract target. + * + * @var string + */ + protected $needs; + + /** + * Create a new contextual binding builder. + * + * @param \Illuminate\Container\Container $container + * @param string $concrete + * @return void + */ + public function __construct(Container $container, $concrete) + { + $this->concrete = $concrete; + $this->container = $container; + } + + /** + * Define the abstract target that depends on the context. + * + * @param string $abstract + * @return $this + */ + public function needs($abstract) + { + $this->needs = $abstract; + + return $this; + } + /** + * Define the implementation for the contextual binding. + * + * @param \Closure|string $implementation + * @return void + */ + public function give($implementation) + { + $this->container->addContextualBinding($this->concrete, $this->needs, $implementation); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Container/composer.json b/application/vendor/laravel/framework/src/Illuminate/Container/composer.json index 3ebb17d..567d018 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Container/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Container/composer.json @@ -14,8 +14,8 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/contracts": "5.0.*" + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*" }, "autoload": { "psr-4": { @@ -24,7 +24,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Contracts/Auth/Access/Authorizable.php b/application/vendor/laravel/framework/src/Illuminate/Contracts/Auth/Access/Authorizable.php new file mode 100644 index 0000000..2f9657c --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Contracts/Auth/Access/Authorizable.php @@ -0,0 +1,15 @@ +id = $id; - $this->class = $class; - } + /** + * The unique identifier of the model. + * + * @var mixed + */ + public $id; + /** + * Create a new model identifier. + * + * @param string $class + * @param mixed $id + * @return void + */ + public function __construct($class, $id) + { + $this->id = $id; + $this->class = $class; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php b/application/vendor/laravel/framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php index d85fff5..e3f18a5 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php +++ b/application/vendor/laravel/framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php @@ -1,33 +1,34 @@ -provider = $provider; - } +class ValidationException extends RuntimeException +{ + /** + * The message provider implementation. + * + * @var \Illuminate\Contracts\Support\MessageProvider + */ + protected $provider; - /** - * Get the validation error message provider. - * - * @return \Illuminate\Contracts\Support\MessageProvider - */ - public function errors() - { - return $this->provider->getMessageBag(); - } + /** + * Create a new validation exception instance. + * + * @param \Illuminate\Contracts\Support\MessageProvider $provider + * @return void + */ + public function __construct(MessageProvider $provider) + { + $this->provider = $provider; + } - /** - * Get the validation error message provider. - * - * @return \Illuminate\Contracts\Support\MessageProvider - */ - public function getMessageProvider() - { - return $this->provider; - } + /** + * Get the validation error message provider. + * + * @return \Illuminate\Contracts\Support\MessageBag + */ + public function errors() + { + return $this->provider->getMessageBag(); + } + /** + * Get the validation error message provider. + * + * @return \Illuminate\Contracts\Support\MessageProvider + */ + public function getMessageProvider() + { + return $this->provider; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Contracts/Validation/Validator.php b/application/vendor/laravel/framework/src/Illuminate/Contracts/Validation/Validator.php index 8cc736f..9cf68c7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Contracts/Validation/Validator.php +++ b/application/vendor/laravel/framework/src/Illuminate/Contracts/Validation/Validator.php @@ -1,39 +1,40 @@ -=5.4.0" + "php": ">=5.5.9" }, "autoload": { "psr-4": { @@ -23,7 +23,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Cookie/CookieJar.php b/application/vendor/laravel/framework/src/Illuminate/Cookie/CookieJar.php index 2820367..ec7540a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cookie/CookieJar.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cookie/CookieJar.php @@ -1,168 +1,177 @@ -getPathAndDomain($path, $domain); - - $time = ($minutes == 0) ? 0 : time() + ($minutes * 60); - - return new Cookie($name, $value, $time, $path, $domain, $secure, $httpOnly); - } - - /** - * Create a cookie that lasts "forever" (five years). - * - * @param string $name - * @param string $value - * @param string $path - * @param string $domain - * @param bool $secure - * @param bool $httpOnly - * @return \Symfony\Component\HttpFoundation\Cookie - */ - public function forever($name, $value, $path = null, $domain = null, $secure = false, $httpOnly = true) - { - return $this->make($name, $value, 2628000, $path, $domain, $secure, $httpOnly); - } - - /** - * Expire the given cookie. - * - * @param string $name - * @param string $path - * @param string $domain - * @return \Symfony\Component\HttpFoundation\Cookie - */ - public function forget($name, $path = null, $domain = null) - { - return $this->make($name, null, -2628000, $path, $domain); - } - - /** - * Determine if a cookie has been queued. - * - * @param string $key - * @return bool - */ - public function hasQueued($key) - { - return ! is_null($this->queued($key)); - } - - /** - * Get a queued cookie instance. - * - * @param string $key - * @param mixed $default - * @return \Symfony\Component\HttpFoundation\Cookie - */ - public function queued($key, $default = null) - { - return array_get($this->queued, $key, $default); - } - - /** - * Queue a cookie to send with the next response. - * - * @param mixed - * @return void - */ - public function queue() - { - if (head(func_get_args()) instanceof Cookie) - { - $cookie = head(func_get_args()); - } - else - { - $cookie = call_user_func_array(array($this, 'make'), func_get_args()); - } - - $this->queued[$cookie->getName()] = $cookie; - } - - /** - * Remove a cookie from the queue. - * - * @param string $name - */ - public function unqueue($name) - { - unset($this->queued[$name]); - } - - /** - * Get the path and domain, or the default values. - * - * @param string $path - * @param string $domain - * @return array - */ - protected function getPathAndDomain($path, $domain) - { - return array($path ?: $this->path, $domain ?: $this->domain); - } - - /** - * Set the default path and domain for the jar. - * - * @param string $path - * @param string $domain - * @return $this - */ - public function setDefaultPathAndDomain($path, $domain) - { - list($this->path, $this->domain) = array($path, $domain); - - return $this; - } - - /** - * Get the cookies which have been queued for the next request. - * - * @return array - */ - public function getQueuedCookies() - { - return $this->queued; - } - +class CookieJar implements JarContract +{ + /** + * The default path (if specified). + * + * @var string + */ + protected $path = '/'; + + /** + * The default domain (if specified). + * + * @var string + */ + protected $domain = null; + + /** + * The default secure setting (defaults to false). + * + * @var bool + */ + protected $secure = false; + + /** + * All of the cookies queued for sending. + * + * @var array + */ + protected $queued = []; + + /** + * Create a new cookie instance. + * + * @param string $name + * @param string $value + * @param int $minutes + * @param string $path + * @param string $domain + * @param bool $secure + * @param bool $httpOnly + * @return \Symfony\Component\HttpFoundation\Cookie + */ + public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true) + { + list($path, $domain, $secure) = $this->getPathAndDomain($path, $domain, $secure); + + $time = ($minutes == 0) ? 0 : time() + ($minutes * 60); + + return new Cookie($name, $value, $time, $path, $domain, $secure, $httpOnly); + } + + /** + * Create a cookie that lasts "forever" (five years). + * + * @param string $name + * @param string $value + * @param string $path + * @param string $domain + * @param bool $secure + * @param bool $httpOnly + * @return \Symfony\Component\HttpFoundation\Cookie + */ + public function forever($name, $value, $path = null, $domain = null, $secure = false, $httpOnly = true) + { + return $this->make($name, $value, 2628000, $path, $domain, $secure, $httpOnly); + } + + /** + * Expire the given cookie. + * + * @param string $name + * @param string $path + * @param string $domain + * @return \Symfony\Component\HttpFoundation\Cookie + */ + public function forget($name, $path = null, $domain = null) + { + return $this->make($name, null, -2628000, $path, $domain); + } + + /** + * Determine if a cookie has been queued. + * + * @param string $key + * @return bool + */ + public function hasQueued($key) + { + return ! is_null($this->queued($key)); + } + + /** + * Get a queued cookie instance. + * + * @param string $key + * @param mixed $default + * @return \Symfony\Component\HttpFoundation\Cookie + */ + public function queued($key, $default = null) + { + return Arr::get($this->queued, $key, $default); + } + + /** + * Queue a cookie to send with the next response. + * + * @param mixed + * @return void + */ + public function queue() + { + if (head(func_get_args()) instanceof Cookie) { + $cookie = head(func_get_args()); + } else { + $cookie = call_user_func_array([$this, 'make'], func_get_args()); + } + + $this->queued[$cookie->getName()] = $cookie; + } + + /** + * Remove a cookie from the queue. + * + * @param string $name + * @return void + */ + public function unqueue($name) + { + unset($this->queued[$name]); + } + + /** + * Get the path and domain, or the default values. + * + * @param string $path + * @param string $domain + * @param bool $secure + * @return array + */ + protected function getPathAndDomain($path, $domain, $secure = false) + { + return [$path ?: $this->path, $domain ?: $this->domain, $secure ?: $this->secure]; + } + + /** + * Set the default path and domain for the jar. + * + * @param string $path + * @param string $domain + * @param bool $secure + * @return $this + */ + public function setDefaultPathAndDomain($path, $domain, $secure = false) + { + list($this->path, $this->domain, $this->secure) = [$path, $domain, $secure]; + + return $this; + } + + /** + * Get the cookies which have been queued for the next request. + * + * @return array + */ + public function getQueuedCookies() + { + return $this->queued; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cookie/CookieServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Cookie/CookieServiceProvider.php index 74589ce..cd04f12 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cookie/CookieServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cookie/CookieServiceProvider.php @@ -1,22 +1,22 @@ -app->singleton('cookie', function($app) - { - $config = $app['config']['session']; +use Illuminate\Support\ServiceProvider; - return (new CookieJar)->setDefaultPathAndDomain($config['path'], $config['domain']); - }); - } +class CookieServiceProvider extends ServiceProvider +{ + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton('cookie', function ($app) { + $config = $app['config']['session']; + return (new CookieJar)->setDefaultPathAndDomain($config['path'], $config['domain'], $config['secure']); + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php b/application/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php index 31b362b..4caa574 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php @@ -1,46 +1,45 @@ -cookies = $cookies; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - $response = $next($request); - - foreach ($this->cookies->getQueuedCookies() as $cookie) - { - $response->headers->setCookie($cookie); - } - - return $response; - } - +class AddQueuedCookiesToResponse +{ + /** + * The cookie jar instance. + * + * @var \Illuminate\Contracts\Cookie\QueueingFactory + */ + protected $cookies; + + /** + * Create a new CookieQueue instance. + * + * @param \Illuminate\Contracts\Cookie\QueueingFactory $cookies + * @return void + */ + public function __construct(CookieJar $cookies) + { + $this->cookies = $cookies; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + $response = $next($request); + + foreach ($this->cookies->getQueuedCookies() as $cookie) { + $response->headers->setCookie($cookie); + } + + return $response; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php b/application/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php index b291b43..c30d38c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php +++ b/application/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php @@ -1,130 +1,163 @@ -encrypter = $encrypter; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - return $this->encrypt($next($this->decrypt($request))); - } - - /** - * Decrypt the cookies on the request. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @return \Symfony\Component\HttpFoundation\Request - */ - protected function decrypt(Request $request) - { - foreach ($request->cookies as $key => $c) - { - try - { - $request->cookies->set($key, $this->decryptCookie($c)); - } - catch (DecryptException $e) - { - $request->cookies->set($key, null); - } - } - - return $request; - } - - /** - * Decrypt the given cookie and return the value. - * - * @param string|array $cookie - * @return string|array - */ - protected function decryptCookie($cookie) - { - return is_array($cookie) - ? $this->decryptArray($cookie) - : $this->encrypter->decrypt($cookie); - } - - /** - * Decrypt an array based cookie. - * - * @param array $cookie - * @return array - */ - protected function decryptArray(array $cookie) - { - $decrypted = array(); - - foreach ($cookie as $key => $value) - { - $decrypted[$key] = $this->encrypter->decrypt($value); - } - - return $decrypted; - } - - /** - * Encrypt the cookies on an outgoing response. - * - * @param \Symfony\Component\HttpFoundation\Response $response - * @return \Symfony\Component\HttpFoundation\Response - */ - protected function encrypt(Response $response) - { - foreach ($response->headers->getCookies() as $key => $cookie) - { - $response->headers->setCookie($this->duplicate( - $cookie, $this->encrypter->encrypt($cookie->getValue()) - )); - } - - return $response; - } - - /** - * Duplicate a cookie with a new value. - * - * @param \Symfony\Component\HttpFoundation\Cookie $c - * @param mixed $value - * @return \Symfony\Component\HttpFoundation\Cookie - */ - protected function duplicate(Cookie $c, $value) - { - return new Cookie( - $c->getName(), $value, $c->getExpiresTime(), $c->getPath(), - $c->getDomain(), $c->isSecure(), $c->isHttpOnly() - ); - } +class EncryptCookies +{ + /** + * The encrypter instance. + * + * @var \Illuminate\Contracts\Encryption\Encrypter + */ + protected $encrypter; + + /** + * The names of the cookies that should not be encrypted. + * + * @var array + */ + protected $except = []; + + /** + * Create a new CookieGuard instance. + * + * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter + * @return void + */ + public function __construct(EncrypterContract $encrypter) + { + $this->encrypter = $encrypter; + } + + /** + * Disable encryption for the given cookie name(s). + * + * @param string|array $cookieName + * @return void + */ + public function disableFor($cookieName) + { + $this->except = array_merge($this->except, (array) $cookieName); + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + return $this->encrypt($next($this->decrypt($request))); + } + + /** + * Decrypt the cookies on the request. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return \Symfony\Component\HttpFoundation\Request + */ + protected function decrypt(Request $request) + { + foreach ($request->cookies as $key => $c) { + if ($this->isDisabled($key)) { + continue; + } + + try { + $request->cookies->set($key, $this->decryptCookie($c)); + } catch (DecryptException $e) { + $request->cookies->set($key, null); + } + } + + return $request; + } + + /** + * Decrypt the given cookie and return the value. + * + * @param string|array $cookie + * @return string|array + */ + protected function decryptCookie($cookie) + { + return is_array($cookie) + ? $this->decryptArray($cookie) + : $this->encrypter->decrypt($cookie); + } + + /** + * Decrypt an array based cookie. + * + * @param array $cookie + * @return array + */ + protected function decryptArray(array $cookie) + { + $decrypted = []; + + foreach ($cookie as $key => $value) { + if (is_string($value)) { + $decrypted[$key] = $this->encrypter->decrypt($value); + } + } + + return $decrypted; + } + + /** + * Encrypt the cookies on an outgoing response. + * + * @param \Symfony\Component\HttpFoundation\Response $response + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function encrypt(Response $response) + { + foreach ($response->headers->getCookies() as $cookie) { + if ($this->isDisabled($cookie->getName())) { + continue; + } + + $response->headers->setCookie($this->duplicate( + $cookie, $this->encrypter->encrypt($cookie->getValue()) + )); + } + + return $response; + } + + /** + * Duplicate a cookie with a new value. + * + * @param \Symfony\Component\HttpFoundation\Cookie $c + * @param mixed $value + * @return \Symfony\Component\HttpFoundation\Cookie + */ + protected function duplicate(Cookie $c, $value) + { + return new Cookie( + $c->getName(), $value, $c->getExpiresTime(), $c->getPath(), + $c->getDomain(), $c->isSecure(), $c->isHttpOnly() + ); + } + /** + * Determine whether encryption has been disabled for the given cookie. + * + * @param string $name + * @return bool + */ + public function isDisabled($name) + { + return in_array($name, $this->except); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Cookie/composer.json b/application/vendor/laravel/framework/src/Illuminate/Cookie/composer.json index 22101e0..a3c3312 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Cookie/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Cookie/composer.json @@ -14,11 +14,11 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*", - "symfony/http-kernel": "2.6.*", - "symfony/http-foundation": "2.6.*" + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*", + "symfony/http-kernel": "2.7.*", + "symfony/http-foundation": "2.7.*" }, "autoload": { "psr-4": { @@ -27,7 +27,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php b/application/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php index aa272fa..1a14401 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php @@ -1,202 +1,201 @@ -setupContainer($container ?: new Container); - - // Once we have the container setup, we will setup the default configuration - // options in the container "config" binding. This will make the database - // manager behave correctly since all the correct binding are in place. - $this->setupDefaultConfiguration(); - - $this->setupManager(); - } - - /** - * Setup the default database configuration options. - * - * @return void - */ - protected function setupDefaultConfiguration() - { - $this->container['config']['database.fetch'] = PDO::FETCH_ASSOC; - - $this->container['config']['database.default'] = 'default'; - } - - /** - * Build the database manager instance. - * - * @return void - */ - protected function setupManager() - { - $factory = new ConnectionFactory($this->container); - - $this->manager = new DatabaseManager($this->container, $factory); - } - - /** - * Get a connection instance from the global manager. - * - * @param string $connection - * @return \Illuminate\Database\Connection - */ - public static function connection($connection = null) - { - return static::$instance->getConnection($connection); - } - - /** - * Get a fluent query builder instance. - * - * @param string $table - * @param string $connection - * @return \Illuminate\Database\Query\Builder - */ - public static function table($table, $connection = null) - { - return static::$instance->connection($connection)->table($table); - } - - /** - * Get a schema builder instance. - * - * @param string $connection - * @return \Illuminate\Database\Schema\Builder - */ - public static function schema($connection = null) - { - return static::$instance->connection($connection)->getSchemaBuilder(); - } - - /** - * Get a registered connection instance. - * - * @param string $name - * @return \Illuminate\Database\Connection - */ - public function getConnection($name = null) - { - return $this->manager->connection($name); - } - - /** - * Register a connection with the manager. - * - * @param array $config - * @param string $name - * @return void - */ - public function addConnection(array $config, $name = 'default') - { - $connections = $this->container['config']['database.connections']; - - $connections[$name] = $config; - - $this->container['config']['database.connections'] = $connections; - } - - /** - * Bootstrap Eloquent so it is ready for usage. - * - * @return void - */ - public function bootEloquent() - { - Eloquent::setConnectionResolver($this->manager); - - // If we have an event dispatcher instance, we will go ahead and register it - // with the Eloquent ORM, allowing for model callbacks while creating and - // updating "model" instances; however, if it not necessary to operate. - if ($dispatcher = $this->getEventDispatcher()) - { - Eloquent::setEventDispatcher($dispatcher); - } - } - - /** - * Set the fetch mode for the database connections. - * - * @param int $fetchMode - * @return $this - */ - public function setFetchMode($fetchMode) - { - $this->container['config']['database.fetch'] = $fetchMode; - - return $this; - } - - /** - * Get the database manager instance. - * - * @return \Illuminate\Database\DatabaseManager - */ - public function getDatabaseManager() - { - return $this->manager; - } - - /** - * Get the current event dispatcher instance. - * - * @return \Illuminate\Contracts\Events\Dispatcher - */ - public function getEventDispatcher() - { - if ($this->container->bound('events')) - { - return $this->container['events']; - } - } - - /** - * Set the event dispatcher instance to be used by connections. - * - * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher - * @return void - */ - public function setEventDispatcher(Dispatcher $dispatcher) - { - $this->container->instance('events', $dispatcher); - } - - /** - * Dynamically pass methods to the default connection. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public static function __callStatic($method, $parameters) - { - return call_user_func_array(array(static::connection(), $method), $parameters); - } +class Manager +{ + use CapsuleManagerTrait; + + /** + * The database manager instance. + * + * @var \Illuminate\Database\DatabaseManager + */ + protected $manager; + + /** + * Create a new database capsule manager. + * + * @param \Illuminate\Container\Container|null $container + * @return void + */ + public function __construct(Container $container = null) + { + $this->setupContainer($container ?: new Container); + + // Once we have the container setup, we will setup the default configuration + // options in the container "config" binding. This will make the database + // manager behave correctly since all the correct binding are in place. + $this->setupDefaultConfiguration(); + + $this->setupManager(); + } + + /** + * Setup the default database configuration options. + * + * @return void + */ + protected function setupDefaultConfiguration() + { + $this->container['config']['database.fetch'] = PDO::FETCH_OBJ; + + $this->container['config']['database.default'] = 'default'; + } + + /** + * Build the database manager instance. + * + * @return void + */ + protected function setupManager() + { + $factory = new ConnectionFactory($this->container); + + $this->manager = new DatabaseManager($this->container, $factory); + } + + /** + * Get a connection instance from the global manager. + * + * @param string $connection + * @return \Illuminate\Database\Connection + */ + public static function connection($connection = null) + { + return static::$instance->getConnection($connection); + } + + /** + * Get a fluent query builder instance. + * + * @param string $table + * @param string $connection + * @return \Illuminate\Database\Query\Builder + */ + public static function table($table, $connection = null) + { + return static::$instance->connection($connection)->table($table); + } + + /** + * Get a schema builder instance. + * + * @param string $connection + * @return \Illuminate\Database\Schema\Builder + */ + public static function schema($connection = null) + { + return static::$instance->connection($connection)->getSchemaBuilder(); + } + + /** + * Get a registered connection instance. + * + * @param string $name + * @return \Illuminate\Database\Connection + */ + public function getConnection($name = null) + { + return $this->manager->connection($name); + } + + /** + * Register a connection with the manager. + * + * @param array $config + * @param string $name + * @return void + */ + public function addConnection(array $config, $name = 'default') + { + $connections = $this->container['config']['database.connections']; + + $connections[$name] = $config; + + $this->container['config']['database.connections'] = $connections; + } + + /** + * Bootstrap Eloquent so it is ready for usage. + * + * @return void + */ + public function bootEloquent() + { + Eloquent::setConnectionResolver($this->manager); + + // If we have an event dispatcher instance, we will go ahead and register it + // with the Eloquent ORM, allowing for model callbacks while creating and + // updating "model" instances; however, if it not necessary to operate. + if ($dispatcher = $this->getEventDispatcher()) { + Eloquent::setEventDispatcher($dispatcher); + } + } + + /** + * Set the fetch mode for the database connections. + * + * @param int $fetchMode + * @return $this + */ + public function setFetchMode($fetchMode) + { + $this->container['config']['database.fetch'] = $fetchMode; + + return $this; + } + + /** + * Get the database manager instance. + * + * @return \Illuminate\Database\DatabaseManager + */ + public function getDatabaseManager() + { + return $this->manager; + } + + /** + * Get the current event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher|null + */ + public function getEventDispatcher() + { + if ($this->container->bound('events')) { + return $this->container['events']; + } + } + + /** + * Set the event dispatcher instance to be used by connections. + * + * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher + * @return void + */ + public function setEventDispatcher(Dispatcher $dispatcher) + { + $this->container->instance('events', $dispatcher); + } + + /** + * Dynamically pass methods to the default connection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + return call_user_func_array([static::connection(), $method], $parameters); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Connection.php b/application/vendor/laravel/framework/src/Illuminate/Database/Connection.php index 42d86ea..cc46b2e 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Connection.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Connection.php @@ -1,1126 +1,1165 @@ -pdo = $pdo; - - // First we will setup the default properties. We keep track of the DB - // name we are connected to since it is needed when some reflective - // type commands are run such as checking whether a table exists. - $this->database = $database; - - $this->tablePrefix = $tablePrefix; - - $this->config = $config; - - // We need to initialize a query grammar and the query post processors - // which are both very important parts of the database abstractions - // so we initialize these to their default values while starting. - $this->useDefaultQueryGrammar(); - - $this->useDefaultPostProcessor(); - } - - /** - * Set the query grammar to the default implementation. - * - * @return void - */ - public function useDefaultQueryGrammar() - { - $this->queryGrammar = $this->getDefaultQueryGrammar(); - } - - /** - * Get the default query grammar instance. - * - * @return \Illuminate\Database\Query\Grammars\Grammar - */ - protected function getDefaultQueryGrammar() - { - return new QueryGrammar; - } - - /** - * Set the schema grammar to the default implementation. - * - * @return void - */ - public function useDefaultSchemaGrammar() - { - $this->schemaGrammar = $this->getDefaultSchemaGrammar(); - } - - /** - * Get the default schema grammar instance. - * - * @return \Illuminate\Database\Schema\Grammars\Grammar - */ - protected function getDefaultSchemaGrammar() - { - // - } - - /** - * Set the query post processor to the default implementation. - * - * @return void - */ - public function useDefaultPostProcessor() - { - $this->postProcessor = $this->getDefaultPostProcessor(); - } - - /** - * Get the default post processor instance. - * - * @return \Illuminate\Database\Query\Processors\Processor - */ - protected function getDefaultPostProcessor() - { - return new Query\Processors\Processor; - } - - /** - * Get a schema builder instance for the connection. - * - * @return \Illuminate\Database\Schema\Builder - */ - public function getSchemaBuilder() - { - if (is_null($this->schemaGrammar)) { $this->useDefaultSchemaGrammar(); } - - return new Schema\Builder($this); - } - - /** - * Begin a fluent query against a database table. - * - * @param string $table - * @return \Illuminate\Database\Query\Builder - */ - public function table($table) - { - $processor = $this->getPostProcessor(); - - $query = new Query\Builder($this, $this->getQueryGrammar(), $processor); - - return $query->from($table); - } - - /** - * Get a new raw query expression. - * - * @param mixed $value - * @return \Illuminate\Database\Query\Expression - */ - public function raw($value) - { - return new Query\Expression($value); - } - - /** - * Run a select statement and return a single result. - * - * @param string $query - * @param array $bindings - * @return mixed - */ - public function selectOne($query, $bindings = array()) - { - $records = $this->select($query, $bindings); - - return count($records) > 0 ? reset($records) : null; - } - - /** - * Run a select statement against the database. - * - * @param string $query - * @param array $bindings - * @return array - */ - public function selectFromWriteConnection($query, $bindings = array()) - { - return $this->select($query, $bindings, false); - } - - /** - * Run a select statement against the database. - * - * @param string $query - * @param array $bindings - * @param bool $useReadPdo - * @return array - */ - public function select($query, $bindings = array(), $useReadPdo = true) - { - return $this->run($query, $bindings, function($me, $query, $bindings) use ($useReadPdo) - { - if ($me->pretending()) return array(); - - // For select statements, we'll simply execute the query and return an array - // of the database result set. Each element in the array will be a single - // row from the database table, and will either be an array or objects. - $statement = $this->getPdoForSelect($useReadPdo)->prepare($query); - - $statement->execute($me->prepareBindings($bindings)); - - return $statement->fetchAll($me->getFetchMode()); - }); - } - - /** - * Get the PDO connection to use for a select query. - * - * @param bool $useReadPdo - * @return \PDO - */ - protected function getPdoForSelect($useReadPdo = true) - { - return $useReadPdo ? $this->getReadPdo() : $this->getPdo(); - } - - /** - * Run an insert statement against the database. - * - * @param string $query - * @param array $bindings - * @return bool - */ - public function insert($query, $bindings = array()) - { - return $this->statement($query, $bindings); - } - - /** - * Run an update statement against the database. - * - * @param string $query - * @param array $bindings - * @return int - */ - public function update($query, $bindings = array()) - { - return $this->affectingStatement($query, $bindings); - } - - /** - * Run a delete statement against the database. - * - * @param string $query - * @param array $bindings - * @return int - */ - public function delete($query, $bindings = array()) - { - return $this->affectingStatement($query, $bindings); - } - - /** - * Execute an SQL statement and return the boolean result. - * - * @param string $query - * @param array $bindings - * @return bool - */ - public function statement($query, $bindings = array()) - { - return $this->run($query, $bindings, function($me, $query, $bindings) - { - if ($me->pretending()) return true; - - $bindings = $me->prepareBindings($bindings); - - return $me->getPdo()->prepare($query)->execute($bindings); - }); - } - - /** - * Run an SQL statement and get the number of rows affected. - * - * @param string $query - * @param array $bindings - * @return int - */ - public function affectingStatement($query, $bindings = array()) - { - return $this->run($query, $bindings, function($me, $query, $bindings) - { - if ($me->pretending()) return 0; - - // For update or delete statements, we want to get the number of rows affected - // by the statement and return that back to the developer. We'll first need - // to execute the statement and then we'll use PDO to fetch the affected. - $statement = $me->getPdo()->prepare($query); - - $statement->execute($me->prepareBindings($bindings)); - - return $statement->rowCount(); - }); - } - - /** - * Run a raw, unprepared query against the PDO connection. - * - * @param string $query - * @return bool - */ - public function unprepared($query) - { - return $this->run($query, array(), function($me, $query) - { - if ($me->pretending()) return true; - - return (bool) $me->getPdo()->exec($query); - }); - } - - /** - * Prepare the query bindings for execution. - * - * @param array $bindings - * @return array - */ - public function prepareBindings(array $bindings) - { - $grammar = $this->getQueryGrammar(); - - foreach ($bindings as $key => $value) - { - // We need to transform all instances of the DateTime class into an actual - // date string. Each query grammar maintains its own date string format - // so we'll just ask the grammar for the format to get from the date. - if ($value instanceof DateTime) - { - $bindings[$key] = $value->format($grammar->getDateFormat()); - } - elseif ($value === false) - { - $bindings[$key] = 0; - } - } - - return $bindings; - } - - /** - * Execute a Closure within a transaction. - * - * @param \Closure $callback - * @return mixed - * - * @throws \Exception - */ - public function transaction(Closure $callback) - { - $this->beginTransaction(); - - // We'll simply execute the given callback within a try / catch block - // and if we catch any exception we can rollback the transaction - // so that none of the changes are persisted to the database. - try - { - $result = $callback($this); - - $this->commit(); - } - - // If we catch an exception, we will roll back so nothing gets messed - // up in the database. Then we'll re-throw the exception so it can - // be handled how the developer sees fit for their applications. - catch (Exception $e) - { - $this->rollBack(); - - throw $e; - } - - return $result; - } - - /** - * Start a new database transaction. - * - * @return void - */ - public function beginTransaction() - { - ++$this->transactions; - - if ($this->transactions == 1) - { - $this->pdo->beginTransaction(); - } - - $this->fireConnectionEvent('beganTransaction'); - } - - /** - * Commit the active database transaction. - * - * @return void - */ - public function commit() - { - if ($this->transactions == 1) $this->pdo->commit(); - - --$this->transactions; - - $this->fireConnectionEvent('committed'); - } - - /** - * Rollback the active database transaction. - * - * @return void - */ - public function rollBack() - { - if ($this->transactions == 1) - { - $this->transactions = 0; - - $this->pdo->rollBack(); - } - else - { - --$this->transactions; - } - - $this->fireConnectionEvent('rollingBack'); - } - - /** - * Get the number of active transactions. - * - * @return int - */ - public function transactionLevel() - { - return $this->transactions; - } - - /** - * Execute the given callback in "dry run" mode. - * - * @param \Closure $callback - * @return array - */ - public function pretend(Closure $callback) - { - $loggingQueries = $this->loggingQueries; - - $this->enableQueryLog(); - - $this->pretending = true; - - $this->queryLog = []; - - // Basically to make the database connection "pretend", we will just return - // the default values for all the query methods, then we will return an - // array of queries that were "executed" within the Closure callback. - $callback($this); - - $this->pretending = false; - - $this->loggingQueries = $loggingQueries; - - return $this->queryLog; - } - - /** - * Run a SQL statement and log its execution context. - * - * @param string $query - * @param array $bindings - * @param \Closure $callback - * @return mixed - * - * @throws \Illuminate\Database\QueryException - */ - protected function run($query, $bindings, Closure $callback) - { - $this->reconnectIfMissingConnection(); - - $start = microtime(true); - - // Here we will run this query. If an exception occurs we'll determine if it was - // caused by a connection that has been lost. If that is the cause, we'll try - // to re-establish connection and re-run the query with a fresh connection. - try - { - $result = $this->runQueryCallback($query, $bindings, $callback); - } - catch (QueryException $e) - { - $result = $this->tryAgainIfCausedByLostConnection( - $e, $query, $bindings, $callback - ); - } - - // Once we have run the query we will calculate the time that it took to run and - // then log the query, bindings, and execution time so we will report them on - // the event that the developer needs them. We'll log time in milliseconds. - $time = $this->getElapsedTime($start); - - $this->logQuery($query, $bindings, $time); - - return $result; - } - - /** - * Run a SQL statement. - * - * @param string $query - * @param array $bindings - * @param \Closure $callback - * @return mixed - * - * @throws \Illuminate\Database\QueryException - */ - protected function runQueryCallback($query, $bindings, Closure $callback) - { - // To execute the statement, we'll simply call the callback, which will actually - // run the SQL against the PDO connection. Then we can calculate the time it - // took to execute and log the query SQL, bindings and time in our memory. - try - { - $result = $callback($this, $query, $bindings); - } - - // If an exception occurs when attempting to run a query, we'll format the error - // message to include the bindings with SQL, which will make this exception a - // lot more helpful to the developer instead of just the database's errors. - catch (Exception $e) - { - throw new QueryException( - $query, $this->prepareBindings($bindings), $e - ); - } - - return $result; - } - - /** - * Handle a query exception that occurred during query execution. - * - * @param \Illuminate\Database\QueryException $e - * @param string $query - * @param array $bindings - * @param \Closure $callback - * @return mixed - * - * @throws \Illuminate\Database\QueryException - */ - protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback) - { - if ($this->causedByLostConnection($e)) - { - $this->reconnect(); - - return $this->runQueryCallback($query, $bindings, $callback); - } - - throw $e; - } - - /** - * Determine if the given exception was caused by a lost connection. - * - * @param \Illuminate\Database\QueryException $e - * @return bool - */ - protected function causedByLostConnection(QueryException $e) - { - $message = $e->getPrevious()->getMessage(); - - return str_contains($message, [ - 'server has gone away', - 'no connection to the server', - 'Lost connection', - ]); - } - - /** - * Disconnect from the underlying PDO connection. - * - * @return void - */ - public function disconnect() - { - $this->setPdo(null)->setReadPdo(null); - } - - /** - * Reconnect to the database. - * - * @return void - * - * @throws \LogicException - */ - public function reconnect() - { - if (is_callable($this->reconnector)) - { - return call_user_func($this->reconnector, $this); - } - - throw new LogicException("Lost connection and no reconnector available."); - } - - /** - * Reconnect to the database if a PDO connection is missing. - * - * @return void - */ - protected function reconnectIfMissingConnection() - { - if (is_null($this->getPdo()) || is_null($this->getReadPdo())) - { - $this->reconnect(); - } - } - - /** - * Log a query in the connection's query log. - * - * @param string $query - * @param array $bindings - * @param float|null $time - * @return void - */ - public function logQuery($query, $bindings, $time = null) - { - if (isset($this->events)) - { - $this->events->fire('illuminate.query', array($query, $bindings, $time, $this->getName())); - } - - if ( ! $this->loggingQueries) return; - - $this->queryLog[] = compact('query', 'bindings', 'time'); - } - - /** - * Register a database query listener with the connection. - * - * @param \Closure $callback - * @return void - */ - public function listen(Closure $callback) - { - if (isset($this->events)) - { - $this->events->listen('illuminate.query', $callback); - } - } - - /** - * Fire an event for this connection. - * - * @param string $event - * @return void - */ - protected function fireConnectionEvent($event) - { - if (isset($this->events)) - { - $this->events->fire('connection.'.$this->getName().'.'.$event, $this); - } - } - - /** - * Get the elapsed time since a given starting point. - * - * @param int $start - * @return float - */ - protected function getElapsedTime($start) - { - return round((microtime(true) - $start) * 1000, 2); - } - - /** - * Get a Doctrine Schema Column instance. - * - * @param string $table - * @param string $column - * @return \Doctrine\DBAL\Schema\Column - */ - public function getDoctrineColumn($table, $column) - { - $schema = $this->getDoctrineSchemaManager(); - - return $schema->listTableDetails($table)->getColumn($column); - } - - /** - * Get the Doctrine DBAL schema manager for the connection. - * - * @return \Doctrine\DBAL\Schema\AbstractSchemaManager - */ - public function getDoctrineSchemaManager() - { - return $this->getDoctrineDriver()->getSchemaManager($this->getDoctrineConnection()); - } - - /** - * Get the Doctrine DBAL database connection instance. - * - * @return \Doctrine\DBAL\Connection - */ - public function getDoctrineConnection() - { - $driver = $this->getDoctrineDriver(); - - $data = array('pdo' => $this->pdo, 'dbname' => $this->getConfig('database')); - - return new DoctrineConnection($data, $driver); - } - - /** - * Get the current PDO connection. - * - * @return \PDO - */ - public function getPdo() - { - return $this->pdo; - } - - /** - * Get the current PDO connection used for reading. - * - * @return \PDO - */ - public function getReadPdo() - { - if ($this->transactions >= 1) return $this->getPdo(); - - return $this->readPdo ?: $this->pdo; - } - - /** - * Set the PDO connection. - * - * @param \PDO|null $pdo - * @return $this - */ - public function setPdo($pdo) - { - if ($this->transactions >= 1) - throw new RuntimeException("Can't swap PDO instance while within transaction."); - - $this->pdo = $pdo; - - return $this; - } - - /** - * Set the PDO connection used for reading. - * - * @param \PDO|null $pdo - * @return $this - */ - public function setReadPdo($pdo) - { - $this->readPdo = $pdo; - - return $this; - } - - /** - * Set the reconnect instance on the connection. - * - * @param callable $reconnector - * @return $this - */ - public function setReconnector(callable $reconnector) - { - $this->reconnector = $reconnector; - - return $this; - } - - /** - * Get the database connection name. - * - * @return string|null - */ - public function getName() - { - return $this->getConfig('name'); - } - - /** - * Get an option from the configuration options. - * - * @param string $option - * @return mixed - */ - public function getConfig($option) - { - return array_get($this->config, $option); - } - - /** - * Get the PDO driver name. - * - * @return string - */ - public function getDriverName() - { - return $this->pdo->getAttribute(PDO::ATTR_DRIVER_NAME); - } - - /** - * Get the query grammar used by the connection. - * - * @return \Illuminate\Database\Query\Grammars\Grammar - */ - public function getQueryGrammar() - { - return $this->queryGrammar; - } - - /** - * Set the query grammar used by the connection. - * - * @param \Illuminate\Database\Query\Grammars\Grammar - * @return void - */ - public function setQueryGrammar(Query\Grammars\Grammar $grammar) - { - $this->queryGrammar = $grammar; - } - - /** - * Get the schema grammar used by the connection. - * - * @return \Illuminate\Database\Schema\Grammars\Grammar - */ - public function getSchemaGrammar() - { - return $this->schemaGrammar; - } - - /** - * Set the schema grammar used by the connection. - * - * @param \Illuminate\Database\Schema\Grammars\Grammar - * @return void - */ - public function setSchemaGrammar(Schema\Grammars\Grammar $grammar) - { - $this->schemaGrammar = $grammar; - } - - /** - * Get the query post processor used by the connection. - * - * @return \Illuminate\Database\Query\Processors\Processor - */ - public function getPostProcessor() - { - return $this->postProcessor; - } - - /** - * Set the query post processor used by the connection. - * - * @param \Illuminate\Database\Query\Processors\Processor - * @return void - */ - public function setPostProcessor(Processor $processor) - { - $this->postProcessor = $processor; - } - - /** - * Get the event dispatcher used by the connection. - * - * @return \Illuminate\Contracts\Events\Dispatcher - */ - public function getEventDispatcher() - { - return $this->events; - } - - /** - * Set the event dispatcher instance on the connection. - * - * @param \Illuminate\Contracts\Events\Dispatcher - * @return void - */ - public function setEventDispatcher(Dispatcher $events) - { - $this->events = $events; - } - - /** - * Determine if the connection in a "dry run". - * - * @return bool - */ - public function pretending() - { - return $this->pretending === true; - } - - /** - * Get the default fetch mode for the connection. - * - * @return int - */ - public function getFetchMode() - { - return $this->fetchMode; - } - - /** - * Set the default fetch mode for the connection. - * - * @param int $fetchMode - * @return int - */ - public function setFetchMode($fetchMode) - { - $this->fetchMode = $fetchMode; - } - - /** - * Get the connection query log. - * - * @return array - */ - public function getQueryLog() - { - return $this->queryLog; - } - - /** - * Clear the query log. - * - * @return void - */ - public function flushQueryLog() - { - $this->queryLog = array(); - } - - /** - * Enable the query log on the connection. - * - * @return void - */ - public function enableQueryLog() - { - $this->loggingQueries = true; - } - - /** - * Disable the query log on the connection. - * - * @return void - */ - public function disableQueryLog() - { - $this->loggingQueries = false; - } - - /** - * Determine whether we're logging queries. - * - * @return bool - */ - public function logging() - { - return $this->loggingQueries; - } - - /** - * Get the name of the connected database. - * - * @return string - */ - public function getDatabaseName() - { - return $this->database; - } - - /** - * Set the name of the connected database. - * - * @param string $database - * @return string - */ - public function setDatabaseName($database) - { - $this->database = $database; - } - - /** - * Get the table prefix for the connection. - * - * @return string - */ - public function getTablePrefix() - { - return $this->tablePrefix; - } - - /** - * Set the table prefix in use by the connection. - * - * @param string $prefix - * @return void - */ - public function setTablePrefix($prefix) - { - $this->tablePrefix = $prefix; - - $this->getQueryGrammar()->setTablePrefix($prefix); - } - - /** - * Set the table prefix and return the grammar. - * - * @param \Illuminate\Database\Grammar $grammar - * @return \Illuminate\Database\Grammar - */ - public function withTablePrefix(Grammar $grammar) - { - $grammar->setTablePrefix($this->tablePrefix); - - return $grammar; - } - +class Connection implements ConnectionInterface +{ + use DetectsLostConnections; + + /** + * The active PDO connection. + * + * @var PDO + */ + protected $pdo; + + /** + * The active PDO connection used for reads. + * + * @var PDO + */ + protected $readPdo; + + /** + * The reconnector instance for the connection. + * + * @var callable + */ + protected $reconnector; + + /** + * The query grammar implementation. + * + * @var \Illuminate\Database\Query\Grammars\Grammar + */ + protected $queryGrammar; + + /** + * The schema grammar implementation. + * + * @var \Illuminate\Database\Schema\Grammars\Grammar + */ + protected $schemaGrammar; + + /** + * The query post processor implementation. + * + * @var \Illuminate\Database\Query\Processors\Processor + */ + protected $postProcessor; + + /** + * The event dispatcher instance. + * + * @var \Illuminate\Contracts\Events\Dispatcher + */ + protected $events; + + /** + * The default fetch mode of the connection. + * + * @var int + */ + protected $fetchMode = PDO::FETCH_OBJ; + + /** + * The number of active transactions. + * + * @var int + */ + protected $transactions = 0; + + /** + * All of the queries run against the connection. + * + * @var array + */ + protected $queryLog = []; + + /** + * Indicates whether queries are being logged. + * + * @var bool + */ + protected $loggingQueries = false; + + /** + * Indicates if the connection is in a "dry run". + * + * @var bool + */ + protected $pretending = false; + + /** + * The name of the connected database. + * + * @var string + */ + protected $database; + + /** + * The instance of Doctrine connection. + * + * @var \Doctrine\DBAL\Connection + */ + protected $doctrineConnection; + + /** + * The table prefix for the connection. + * + * @var string + */ + protected $tablePrefix = ''; + + /** + * The database connection configuration options. + * + * @var array + */ + protected $config = []; + + /** + * Create a new database connection instance. + * + * @param \PDO $pdo + * @param string $database + * @param string $tablePrefix + * @param array $config + * @return void + */ + public function __construct(PDO $pdo, $database = '', $tablePrefix = '', array $config = []) + { + $this->pdo = $pdo; + + // First we will setup the default properties. We keep track of the DB + // name we are connected to since it is needed when some reflective + // type commands are run such as checking whether a table exists. + $this->database = $database; + + $this->tablePrefix = $tablePrefix; + + $this->config = $config; + + // We need to initialize a query grammar and the query post processors + // which are both very important parts of the database abstractions + // so we initialize these to their default values while starting. + $this->useDefaultQueryGrammar(); + + $this->useDefaultPostProcessor(); + } + + /** + * Set the query grammar to the default implementation. + * + * @return void + */ + public function useDefaultQueryGrammar() + { + $this->queryGrammar = $this->getDefaultQueryGrammar(); + } + + /** + * Get the default query grammar instance. + * + * @return \Illuminate\Database\Query\Grammars\Grammar + */ + protected function getDefaultQueryGrammar() + { + return new QueryGrammar; + } + + /** + * Set the schema grammar to the default implementation. + * + * @return void + */ + public function useDefaultSchemaGrammar() + { + $this->schemaGrammar = $this->getDefaultSchemaGrammar(); + } + + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\Grammar + */ + protected function getDefaultSchemaGrammar() + { + // + } + + /** + * Set the query post processor to the default implementation. + * + * @return void + */ + public function useDefaultPostProcessor() + { + $this->postProcessor = $this->getDefaultPostProcessor(); + } + + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\Processor + */ + protected function getDefaultPostProcessor() + { + return new Processor; + } + + /** + * Get a schema builder instance for the connection. + * + * @return \Illuminate\Database\Schema\Builder + */ + public function getSchemaBuilder() + { + if (is_null($this->schemaGrammar)) { + $this->useDefaultSchemaGrammar(); + } + + return new SchemaBuilder($this); + } + + /** + * Begin a fluent query against a database table. + * + * @param string $table + * @return \Illuminate\Database\Query\Builder + */ + public function table($table) + { + return $this->query()->from($table); + } + + /** + * Get a new query builder instance. + * + * @return \Illuminate\Database\Query\Builder + */ + public function query() + { + return new QueryBuilder( + $this, $this->getQueryGrammar(), $this->getPostProcessor() + ); + } + + /** + * Get a new raw query expression. + * + * @param mixed $value + * @return \Illuminate\Database\Query\Expression + */ + public function raw($value) + { + return new Expression($value); + } + + /** + * Run a select statement and return a single result. + * + * @param string $query + * @param array $bindings + * @return mixed + */ + public function selectOne($query, $bindings = []) + { + $records = $this->select($query, $bindings); + + return count($records) > 0 ? reset($records) : null; + } + + /** + * Run a select statement against the database. + * + * @param string $query + * @param array $bindings + * @return array + */ + public function selectFromWriteConnection($query, $bindings = []) + { + return $this->select($query, $bindings, false); + } + + /** + * Run a select statement against the database. + * + * @param string $query + * @param array $bindings + * @param bool $useReadPdo + * @return array + */ + public function select($query, $bindings = [], $useReadPdo = true) + { + return $this->run($query, $bindings, function ($me, $query, $bindings) use ($useReadPdo) { + if ($me->pretending()) { + return []; + } + + // For select statements, we'll simply execute the query and return an array + // of the database result set. Each element in the array will be a single + // row from the database table, and will either be an array or objects. + $statement = $this->getPdoForSelect($useReadPdo)->prepare($query); + + $statement->execute($me->prepareBindings($bindings)); + + return $statement->fetchAll($me->getFetchMode()); + }); + } + + /** + * Get the PDO connection to use for a select query. + * + * @param bool $useReadPdo + * @return \PDO + */ + protected function getPdoForSelect($useReadPdo = true) + { + return $useReadPdo ? $this->getReadPdo() : $this->getPdo(); + } + + /** + * Run an insert statement against the database. + * + * @param string $query + * @param array $bindings + * @return bool + */ + public function insert($query, $bindings = []) + { + return $this->statement($query, $bindings); + } + + /** + * Run an update statement against the database. + * + * @param string $query + * @param array $bindings + * @return int + */ + public function update($query, $bindings = []) + { + return $this->affectingStatement($query, $bindings); + } + + /** + * Run a delete statement against the database. + * + * @param string $query + * @param array $bindings + * @return int + */ + public function delete($query, $bindings = []) + { + return $this->affectingStatement($query, $bindings); + } + + /** + * Execute an SQL statement and return the boolean result. + * + * @param string $query + * @param array $bindings + * @return bool + */ + public function statement($query, $bindings = []) + { + return $this->run($query, $bindings, function ($me, $query, $bindings) { + if ($me->pretending()) { + return true; + } + + $bindings = $me->prepareBindings($bindings); + + return $me->getPdo()->prepare($query)->execute($bindings); + }); + } + + /** + * Run an SQL statement and get the number of rows affected. + * + * @param string $query + * @param array $bindings + * @return int + */ + public function affectingStatement($query, $bindings = []) + { + return $this->run($query, $bindings, function ($me, $query, $bindings) { + if ($me->pretending()) { + return 0; + } + + // For update or delete statements, we want to get the number of rows affected + // by the statement and return that back to the developer. We'll first need + // to execute the statement and then we'll use PDO to fetch the affected. + $statement = $me->getPdo()->prepare($query); + + $statement->execute($me->prepareBindings($bindings)); + + return $statement->rowCount(); + }); + } + + /** + * Run a raw, unprepared query against the PDO connection. + * + * @param string $query + * @return bool + */ + public function unprepared($query) + { + return $this->run($query, [], function ($me, $query) { + if ($me->pretending()) { + return true; + } + + return (bool) $me->getPdo()->exec($query); + }); + } + + /** + * Prepare the query bindings for execution. + * + * @param array $bindings + * @return array + */ + public function prepareBindings(array $bindings) + { + $grammar = $this->getQueryGrammar(); + + foreach ($bindings as $key => $value) { + // We need to transform all instances of DateTimeInterface into the actual + // date string. Each query grammar maintains its own date string format + // so we'll just ask the grammar for the format to get from the date. + if ($value instanceof DateTimeInterface) { + $bindings[$key] = $value->format($grammar->getDateFormat()); + } elseif ($value === false) { + $bindings[$key] = 0; + } + } + + return $bindings; + } + + /** + * Execute a Closure within a transaction. + * + * @param \Closure $callback + * @return mixed + * + * @throws \Throwable + */ + public function transaction(Closure $callback) + { + $this->beginTransaction(); + + // We'll simply execute the given callback within a try / catch block + // and if we catch any exception we can rollback the transaction + // so that none of the changes are persisted to the database. + try { + $result = $callback($this); + + $this->commit(); + } + + // If we catch an exception, we will roll back so nothing gets messed + // up in the database. Then we'll re-throw the exception so it can + // be handled how the developer sees fit for their applications. + catch (Exception $e) { + $this->rollBack(); + + throw $e; + } catch (Throwable $e) { + $this->rollBack(); + + throw $e; + } + + return $result; + } + + /** + * Start a new database transaction. + * + * @return void + * + * @throws \Exception + */ + public function beginTransaction() + { + if ($this->transactions == 0) { + try { + $this->pdo->beginTransaction(); + } catch (Exception $e) { + if ($this->causedByLostConnection($e)) { + $this->reconnect(); + $this->pdo->beginTransaction(); + } else { + throw $e; + } + } + } elseif ($this->transactions >= 1 && $this->queryGrammar->supportsSavepoints()) { + $this->pdo->exec( + $this->queryGrammar->compileSavepoint('trans'.($this->transactions + 1)) + ); + } + + ++$this->transactions; + + $this->fireConnectionEvent('beganTransaction'); + } + + /** + * Commit the active database transaction. + * + * @return void + */ + public function commit() + { + if ($this->transactions == 1) { + $this->pdo->commit(); + } + + --$this->transactions; + + $this->fireConnectionEvent('committed'); + } + + /** + * Rollback the active database transaction. + * + * @return void + */ + public function rollBack() + { + if ($this->transactions == 1) { + $this->pdo->rollBack(); + } elseif ($this->transactions > 1 && $this->queryGrammar->supportsSavepoints()) { + $this->pdo->exec( + $this->queryGrammar->compileSavepointRollBack('trans'.$this->transactions) + ); + } + + $this->transactions = max(0, $this->transactions - 1); + + $this->fireConnectionEvent('rollingBack'); + } + + /** + * Get the number of active transactions. + * + * @return int + */ + public function transactionLevel() + { + return $this->transactions; + } + + /** + * Execute the given callback in "dry run" mode. + * + * @param \Closure $callback + * @return array + */ + public function pretend(Closure $callback) + { + $loggingQueries = $this->loggingQueries; + + $this->enableQueryLog(); + + $this->pretending = true; + + $this->queryLog = []; + + // Basically to make the database connection "pretend", we will just return + // the default values for all the query methods, then we will return an + // array of queries that were "executed" within the Closure callback. + $callback($this); + + $this->pretending = false; + + $this->loggingQueries = $loggingQueries; + + return $this->queryLog; + } + + /** + * Run a SQL statement and log its execution context. + * + * @param string $query + * @param array $bindings + * @param \Closure $callback + * @return mixed + * + * @throws \Illuminate\Database\QueryException + */ + protected function run($query, $bindings, Closure $callback) + { + $this->reconnectIfMissingConnection(); + + $start = microtime(true); + + // Here we will run this query. If an exception occurs we'll determine if it was + // caused by a connection that has been lost. If that is the cause, we'll try + // to re-establish connection and re-run the query with a fresh connection. + try { + $result = $this->runQueryCallback($query, $bindings, $callback); + } catch (QueryException $e) { + if ($this->transactions >= 1) { + throw $e; + } + + $result = $this->tryAgainIfCausedByLostConnection( + $e, $query, $bindings, $callback + ); + } + + // Once we have run the query we will calculate the time that it took to run and + // then log the query, bindings, and execution time so we will report them on + // the event that the developer needs them. We'll log time in milliseconds. + $time = $this->getElapsedTime($start); + + $this->logQuery($query, $bindings, $time); + + return $result; + } + + /** + * Run a SQL statement. + * + * @param string $query + * @param array $bindings + * @param \Closure $callback + * @return mixed + * + * @throws \Illuminate\Database\QueryException + */ + protected function runQueryCallback($query, $bindings, Closure $callback) + { + // To execute the statement, we'll simply call the callback, which will actually + // run the SQL against the PDO connection. Then we can calculate the time it + // took to execute and log the query SQL, bindings and time in our memory. + try { + $result = $callback($this, $query, $bindings); + } + + // If an exception occurs when attempting to run a query, we'll format the error + // message to include the bindings with SQL, which will make this exception a + // lot more helpful to the developer instead of just the database's errors. + catch (Exception $e) { + throw new QueryException( + $query, $this->prepareBindings($bindings), $e + ); + } + + return $result; + } + + /** + * Handle a query exception that occurred during query execution. + * + * @param \Illuminate\Database\QueryException $e + * @param string $query + * @param array $bindings + * @param \Closure $callback + * @return mixed + * + * @throws \Illuminate\Database\QueryException + */ + protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback) + { + if ($this->causedByLostConnection($e->getPrevious())) { + $this->reconnect(); + + return $this->runQueryCallback($query, $bindings, $callback); + } + + throw $e; + } + + /** + * Disconnect from the underlying PDO connection. + * + * @return void + */ + public function disconnect() + { + $this->setPdo(null)->setReadPdo(null); + } + + /** + * Reconnect to the database. + * + * @return void + * + * @throws \LogicException + */ + public function reconnect() + { + if (is_callable($this->reconnector)) { + return call_user_func($this->reconnector, $this); + } + + throw new LogicException('Lost connection and no reconnector available.'); + } + + /** + * Reconnect to the database if a PDO connection is missing. + * + * @return void + */ + protected function reconnectIfMissingConnection() + { + if (is_null($this->getPdo()) || is_null($this->getReadPdo())) { + $this->reconnect(); + } + } + + /** + * Log a query in the connection's query log. + * + * @param string $query + * @param array $bindings + * @param float|null $time + * @return void + */ + public function logQuery($query, $bindings, $time = null) + { + if (isset($this->events)) { + $this->events->fire('illuminate.query', [$query, $bindings, $time, $this->getName()]); + } + + if (! $this->loggingQueries) { + return; + } + + $this->queryLog[] = compact('query', 'bindings', 'time'); + } + + /** + * Register a database query listener with the connection. + * + * @param \Closure $callback + * @return void + */ + public function listen(Closure $callback) + { + if (isset($this->events)) { + $this->events->listen('illuminate.query', $callback); + } + } + + /** + * Fire an event for this connection. + * + * @param string $event + * @return void + */ + protected function fireConnectionEvent($event) + { + if (isset($this->events)) { + $this->events->fire('connection.'.$this->getName().'.'.$event, $this); + } + } + + /** + * Get the elapsed time since a given starting point. + * + * @param int $start + * @return float + */ + protected function getElapsedTime($start) + { + return round((microtime(true) - $start) * 1000, 2); + } + + /** + * Is Doctrine available? + * + * @return bool + */ + public function isDoctrineAvailable() + { + return class_exists('Doctrine\DBAL\Connection'); + } + + /** + * Get a Doctrine Schema Column instance. + * + * @param string $table + * @param string $column + * @return \Doctrine\DBAL\Schema\Column + */ + public function getDoctrineColumn($table, $column) + { + $schema = $this->getDoctrineSchemaManager(); + + return $schema->listTableDetails($table)->getColumn($column); + } + + /** + * Get the Doctrine DBAL schema manager for the connection. + * + * @return \Doctrine\DBAL\Schema\AbstractSchemaManager + */ + public function getDoctrineSchemaManager() + { + return $this->getDoctrineDriver()->getSchemaManager($this->getDoctrineConnection()); + } + + /** + * Get the Doctrine DBAL database connection instance. + * + * @return \Doctrine\DBAL\Connection + */ + public function getDoctrineConnection() + { + if (is_null($this->doctrineConnection)) { + $driver = $this->getDoctrineDriver(); + + $data = ['pdo' => $this->pdo, 'dbname' => $this->getConfig('database')]; + + $this->doctrineConnection = new DoctrineConnection($data, $driver); + } + + return $this->doctrineConnection; + } + + /** + * Get the current PDO connection. + * + * @return \PDO + */ + public function getPdo() + { + return $this->pdo; + } + + /** + * Get the current PDO connection used for reading. + * + * @return \PDO + */ + public function getReadPdo() + { + if ($this->transactions >= 1) { + return $this->getPdo(); + } + + return $this->readPdo ?: $this->pdo; + } + + /** + * Set the PDO connection. + * + * @param \PDO|null $pdo + * @return $this + * + * @throws \RuntimeException + */ + public function setPdo($pdo) + { + if ($this->transactions >= 1) { + throw new RuntimeException("Can't swap PDO instance while within transaction."); + } + + $this->pdo = $pdo; + + return $this; + } + + /** + * Set the PDO connection used for reading. + * + * @param \PDO|null $pdo + * @return $this + */ + public function setReadPdo($pdo) + { + $this->readPdo = $pdo; + + return $this; + } + + /** + * Set the reconnect instance on the connection. + * + * @param callable $reconnector + * @return $this + */ + public function setReconnector(callable $reconnector) + { + $this->reconnector = $reconnector; + + return $this; + } + + /** + * Get the database connection name. + * + * @return string|null + */ + public function getName() + { + return $this->getConfig('name'); + } + + /** + * Get an option from the configuration options. + * + * @param string $option + * @return mixed + */ + public function getConfig($option) + { + return Arr::get($this->config, $option); + } + + /** + * Get the PDO driver name. + * + * @return string + */ + public function getDriverName() + { + return $this->pdo->getAttribute(PDO::ATTR_DRIVER_NAME); + } + + /** + * Get the query grammar used by the connection. + * + * @return \Illuminate\Database\Query\Grammars\Grammar + */ + public function getQueryGrammar() + { + return $this->queryGrammar; + } + + /** + * Set the query grammar used by the connection. + * + * @param \Illuminate\Database\Query\Grammars\Grammar $grammar + * @return void + */ + public function setQueryGrammar(Query\Grammars\Grammar $grammar) + { + $this->queryGrammar = $grammar; + } + + /** + * Get the schema grammar used by the connection. + * + * @return \Illuminate\Database\Schema\Grammars\Grammar + */ + public function getSchemaGrammar() + { + return $this->schemaGrammar; + } + + /** + * Set the schema grammar used by the connection. + * + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @return void + */ + public function setSchemaGrammar(Schema\Grammars\Grammar $grammar) + { + $this->schemaGrammar = $grammar; + } + + /** + * Get the query post processor used by the connection. + * + * @return \Illuminate\Database\Query\Processors\Processor + */ + public function getPostProcessor() + { + return $this->postProcessor; + } + + /** + * Set the query post processor used by the connection. + * + * @param \Illuminate\Database\Query\Processors\Processor $processor + * @return void + */ + public function setPostProcessor(Processor $processor) + { + $this->postProcessor = $processor; + } + + /** + * Get the event dispatcher used by the connection. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getEventDispatcher() + { + return $this->events; + } + + /** + * Set the event dispatcher instance on the connection. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function setEventDispatcher(Dispatcher $events) + { + $this->events = $events; + } + + /** + * Determine if the connection in a "dry run". + * + * @return bool + */ + public function pretending() + { + return $this->pretending === true; + } + + /** + * Get the default fetch mode for the connection. + * + * @return int + */ + public function getFetchMode() + { + return $this->fetchMode; + } + + /** + * Set the default fetch mode for the connection. + * + * @param int $fetchMode + * @return int + */ + public function setFetchMode($fetchMode) + { + $this->fetchMode = $fetchMode; + } + + /** + * Get the connection query log. + * + * @return array + */ + public function getQueryLog() + { + return $this->queryLog; + } + + /** + * Clear the query log. + * + * @return void + */ + public function flushQueryLog() + { + $this->queryLog = []; + } + + /** + * Enable the query log on the connection. + * + * @return void + */ + public function enableQueryLog() + { + $this->loggingQueries = true; + } + + /** + * Disable the query log on the connection. + * + * @return void + */ + public function disableQueryLog() + { + $this->loggingQueries = false; + } + + /** + * Determine whether we're logging queries. + * + * @return bool + */ + public function logging() + { + return $this->loggingQueries; + } + + /** + * Get the name of the connected database. + * + * @return string + */ + public function getDatabaseName() + { + return $this->database; + } + + /** + * Set the name of the connected database. + * + * @param string $database + * @return string + */ + public function setDatabaseName($database) + { + $this->database = $database; + } + + /** + * Get the table prefix for the connection. + * + * @return string + */ + public function getTablePrefix() + { + return $this->tablePrefix; + } + + /** + * Set the table prefix in use by the connection. + * + * @param string $prefix + * @return void + */ + public function setTablePrefix($prefix) + { + $this->tablePrefix = $prefix; + + $this->getQueryGrammar()->setTablePrefix($prefix); + } + + /** + * Set the table prefix and return the grammar. + * + * @param \Illuminate\Database\Grammar $grammar + * @return \Illuminate\Database\Grammar + */ + public function withTablePrefix(Grammar $grammar) + { + $grammar->setTablePrefix($this->tablePrefix); + + return $grammar; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/ConnectionInterface.php b/application/vendor/laravel/framework/src/Illuminate/Database/ConnectionInterface.php index 48d69b3..16eb667 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/ConnectionInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/ConnectionInterface.php @@ -1,148 +1,149 @@ - $connection) - { - $this->addConnection($name, $connection); - } - } + /** + * Create a new connection resolver instance. + * + * @param array $connections + * @return void + */ + public function __construct(array $connections = []) + { + foreach ($connections as $name => $connection) { + $this->addConnection($name, $connection); + } + } - /** - * Get a database connection instance. - * - * @param string $name - * @return \Illuminate\Database\ConnectionInterface - */ - public function connection($name = null) - { - if (is_null($name)) $name = $this->getDefaultConnection(); + /** + * Get a database connection instance. + * + * @param string $name + * @return \Illuminate\Database\ConnectionInterface + */ + public function connection($name = null) + { + if (is_null($name)) { + $name = $this->getDefaultConnection(); + } - return $this->connections[$name]; - } + return $this->connections[$name]; + } - /** - * Add a connection to the resolver. - * - * @param string $name - * @param \Illuminate\Database\ConnectionInterface $connection - * @return void - */ - public function addConnection($name, ConnectionInterface $connection) - { - $this->connections[$name] = $connection; - } + /** + * Add a connection to the resolver. + * + * @param string $name + * @param \Illuminate\Database\ConnectionInterface $connection + * @return void + */ + public function addConnection($name, ConnectionInterface $connection) + { + $this->connections[$name] = $connection; + } - /** - * Check if a connection has been registered. - * - * @param string $name - * @return bool - */ - public function hasConnection($name) - { - return isset($this->connections[$name]); - } + /** + * Check if a connection has been registered. + * + * @param string $name + * @return bool + */ + public function hasConnection($name) + { + return isset($this->connections[$name]); + } - /** - * Get the default connection name. - * - * @return string - */ - public function getDefaultConnection() - { - return $this->default; - } - - /** - * Set the default connection name. - * - * @param string $name - * @return void - */ - public function setDefaultConnection($name) - { - $this->default = $name; - } + /** + * Get the default connection name. + * + * @return string + */ + public function getDefaultConnection() + { + return $this->default; + } + /** + * Set the default connection name. + * + * @param string $name + * @return void + */ + public function setDefaultConnection($name) + { + $this->default = $name; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/ConnectionResolverInterface.php b/application/vendor/laravel/framework/src/Illuminate/Database/ConnectionResolverInterface.php index 46abdc0..eb0397a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/ConnectionResolverInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/ConnectionResolverInterface.php @@ -1,28 +1,29 @@ -container = $container; - } - - /** - * Establish a PDO connection based on the configuration. - * - * @param array $config - * @param string $name - * @return \Illuminate\Database\Connection - */ - public function make(array $config, $name = null) - { - $config = $this->parseConfig($config, $name); - - if (isset($config['read'])) - { - return $this->createReadWriteConnection($config); - } - - return $this->createSingleConnection($config); - } - - /** - * Create a single database connection instance. - * - * @param array $config - * @return \Illuminate\Database\Connection - */ - protected function createSingleConnection(array $config) - { - $pdo = $this->createConnector($config)->connect($config); - - return $this->createConnection($config['driver'], $pdo, $config['database'], $config['prefix'], $config); - } - - /** - * Create a single database connection instance. - * - * @param array $config - * @return \Illuminate\Database\Connection - */ - protected function createReadWriteConnection(array $config) - { - $connection = $this->createSingleConnection($this->getWriteConfig($config)); - - return $connection->setReadPdo($this->createReadPdo($config)); - } - - /** - * Create a new PDO instance for reading. - * - * @param array $config - * @return \PDO - */ - protected function createReadPdo(array $config) - { - $readConfig = $this->getReadConfig($config); - - return $this->createConnector($readConfig)->connect($readConfig); - } - - /** - * Get the read configuration for a read / write connection. - * - * @param array $config - * @return array - */ - protected function getReadConfig(array $config) - { - $readConfig = $this->getReadWriteConfig($config, 'read'); - - return $this->mergeReadWriteConfig($config, $readConfig); - } - - /** - * Get the read configuration for a read / write connection. - * - * @param array $config - * @return array - */ - protected function getWriteConfig(array $config) - { - $writeConfig = $this->getReadWriteConfig($config, 'write'); - - return $this->mergeReadWriteConfig($config, $writeConfig); - } - - /** - * Get a read / write level configuration. - * - * @param array $config - * @param string $type - * @return array - */ - protected function getReadWriteConfig(array $config, $type) - { - if (isset($config[$type][0])) - { - return $config[$type][array_rand($config[$type])]; - } - - return $config[$type]; - } - - /** - * Merge a configuration for a read / write connection. - * - * @param array $config - * @param array $merge - * @return array - */ - protected function mergeReadWriteConfig(array $config, array $merge) - { - return array_except(array_merge($config, $merge), array('read', 'write')); - } - - /** - * Parse and prepare the database configuration. - * - * @param array $config - * @param string $name - * @return array - */ - protected function parseConfig(array $config, $name) - { - return array_add(array_add($config, 'prefix', ''), 'name', $name); - } - - /** - * Create a connector instance based on the configuration. - * - * @param array $config - * @return \Illuminate\Database\Connectors\ConnectorInterface - * - * @throws \InvalidArgumentException - */ - public function createConnector(array $config) - { - if ( ! isset($config['driver'])) - { - throw new InvalidArgumentException("A driver must be specified."); - } - - if ($this->container->bound($key = "db.connector.{$config['driver']}")) - { - return $this->container->make($key); - } - - switch ($config['driver']) - { - case 'mysql': - return new MySqlConnector; - - case 'pgsql': - return new PostgresConnector; - - case 'sqlite': - return new SQLiteConnector; - - case 'sqlsrv': - return new SqlServerConnector; - } - - throw new InvalidArgumentException("Unsupported driver [{$config['driver']}]"); - } - - /** - * Create a new connection instance. - * - * @param string $driver - * @param \PDO $connection - * @param string $database - * @param string $prefix - * @param array $config - * @return \Illuminate\Database\Connection - * - * @throws \InvalidArgumentException - */ - protected function createConnection($driver, PDO $connection, $database, $prefix = '', array $config = array()) - { - if ($this->container->bound($key = "db.connection.{$driver}")) - { - return $this->container->make($key, array($connection, $database, $prefix, $config)); - } - - switch ($driver) - { - case 'mysql': - return new MySqlConnection($connection, $database, $prefix, $config); - - case 'pgsql': - return new PostgresConnection($connection, $database, $prefix, $config); - - case 'sqlite': - return new SQLiteConnection($connection, $database, $prefix, $config); - - case 'sqlsrv': - return new SqlServerConnection($connection, $database, $prefix, $config); - } - - throw new InvalidArgumentException("Unsupported driver [$driver]"); - } - +class ConnectionFactory +{ + /** + * The IoC container instance. + * + * @var \Illuminate\Contracts\Container\Container + */ + protected $container; + + /** + * Create a new connection factory instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function __construct(Container $container) + { + $this->container = $container; + } + + /** + * Establish a PDO connection based on the configuration. + * + * @param array $config + * @param string $name + * @return \Illuminate\Database\Connection + */ + public function make(array $config, $name = null) + { + $config = $this->parseConfig($config, $name); + + if (isset($config['read'])) { + return $this->createReadWriteConnection($config); + } + + return $this->createSingleConnection($config); + } + + /** + * Create a single database connection instance. + * + * @param array $config + * @return \Illuminate\Database\Connection + */ + protected function createSingleConnection(array $config) + { + $pdo = $this->createConnector($config)->connect($config); + + return $this->createConnection($config['driver'], $pdo, $config['database'], $config['prefix'], $config); + } + + /** + * Create a single database connection instance. + * + * @param array $config + * @return \Illuminate\Database\Connection + */ + protected function createReadWriteConnection(array $config) + { + $connection = $this->createSingleConnection($this->getWriteConfig($config)); + + return $connection->setReadPdo($this->createReadPdo($config)); + } + + /** + * Create a new PDO instance for reading. + * + * @param array $config + * @return \PDO + */ + protected function createReadPdo(array $config) + { + $readConfig = $this->getReadConfig($config); + + return $this->createConnector($readConfig)->connect($readConfig); + } + + /** + * Get the read configuration for a read / write connection. + * + * @param array $config + * @return array + */ + protected function getReadConfig(array $config) + { + $readConfig = $this->getReadWriteConfig($config, 'read'); + + if (isset($readConfig['host']) && is_array($readConfig['host'])) { + $readConfig['host'] = count($readConfig['host']) > 1 + ? $readConfig['host'][array_rand($readConfig['host'])] + : $readConfig['host'][0]; + } + + return $this->mergeReadWriteConfig($config, $readConfig); + } + + /** + * Get the read configuration for a read / write connection. + * + * @param array $config + * @return array + */ + protected function getWriteConfig(array $config) + { + $writeConfig = $this->getReadWriteConfig($config, 'write'); + + return $this->mergeReadWriteConfig($config, $writeConfig); + } + + /** + * Get a read / write level configuration. + * + * @param array $config + * @param string $type + * @return array + */ + protected function getReadWriteConfig(array $config, $type) + { + if (isset($config[$type][0])) { + return $config[$type][array_rand($config[$type])]; + } + + return $config[$type]; + } + + /** + * Merge a configuration for a read / write connection. + * + * @param array $config + * @param array $merge + * @return array + */ + protected function mergeReadWriteConfig(array $config, array $merge) + { + return Arr::except(array_merge($config, $merge), ['read', 'write']); + } + + /** + * Parse and prepare the database configuration. + * + * @param array $config + * @param string $name + * @return array + */ + protected function parseConfig(array $config, $name) + { + return Arr::add(Arr::add($config, 'prefix', ''), 'name', $name); + } + + /** + * Create a connector instance based on the configuration. + * + * @param array $config + * @return \Illuminate\Database\Connectors\ConnectorInterface + * + * @throws \InvalidArgumentException + */ + public function createConnector(array $config) + { + if (! isset($config['driver'])) { + throw new InvalidArgumentException('A driver must be specified.'); + } + + if ($this->container->bound($key = "db.connector.{$config['driver']}")) { + return $this->container->make($key); + } + + switch ($config['driver']) { + case 'mysql': + return new MySqlConnector; + case 'pgsql': + return new PostgresConnector; + case 'sqlite': + return new SQLiteConnector; + case 'sqlsrv': + return new SqlServerConnector; + } + + throw new InvalidArgumentException("Unsupported driver [{$config['driver']}]"); + } + + /** + * Create a new connection instance. + * + * @param string $driver + * @param \PDO $connection + * @param string $database + * @param string $prefix + * @param array $config + * @return \Illuminate\Database\Connection + * + * @throws \InvalidArgumentException + */ + protected function createConnection($driver, PDO $connection, $database, $prefix = '', array $config = []) + { + if ($this->container->bound($key = "db.connection.{$driver}")) { + return $this->container->make($key, [$connection, $database, $prefix, $config]); + } + + switch ($driver) { + case 'mysql': + return new MySqlConnection($connection, $database, $prefix, $config); + case 'pgsql': + return new PostgresConnection($connection, $database, $prefix, $config); + case 'sqlite': + return new SQLiteConnection($connection, $database, $prefix, $config); + case 'sqlsrv': + return new SqlServerConnection($connection, $database, $prefix, $config); + } + + throw new InvalidArgumentException("Unsupported driver [$driver]"); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php b/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php index 6c388e0..ea2637c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php @@ -1,71 +1,106 @@ - PDO::CASE_NATURAL, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, + PDO::ATTR_STRINGIFY_FETCHES => false, + PDO::ATTR_EMULATE_PREPARES => false, + ]; -class Connector { + /** + * Get the PDO options based on the configuration. + * + * @param array $config + * @return array + */ + public function getOptions(array $config) + { + $options = Arr::get($config, 'options', []); - /** - * The default PDO connection options. - * - * @var array - */ - protected $options = array( - PDO::ATTR_CASE => PDO::CASE_NATURAL, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, - PDO::ATTR_STRINGIFY_FETCHES => false, - PDO::ATTR_EMULATE_PREPARES => false, - ); + return array_diff_key($this->options, $options) + $options; + } - /** - * Get the PDO options based on the configuration. - * - * @param array $config - * @return array - */ - public function getOptions(array $config) - { - $options = array_get($config, 'options', array()); + /** + * Create a new PDO connection. + * + * @param string $dsn + * @param array $config + * @param array $options + * @return \PDO + */ + public function createConnection($dsn, array $config, array $options) + { + $username = Arr::get($config, 'username'); - return array_diff_key($this->options, $options) + $options; - } + $password = Arr::get($config, 'password'); - /** - * Create a new PDO connection. - * - * @param string $dsn - * @param array $config - * @param array $options - * @return \PDO - */ - public function createConnection($dsn, array $config, array $options) - { - $username = array_get($config, 'username'); + try { + $pdo = new PDO($dsn, $username, $password, $options); + } catch (Exception $e) { + $pdo = $this->tryAgainIfCausedByLostConnection( + $e, $dsn, $username, $password, $options + ); + } - $password = array_get($config, 'password'); + return $pdo; + } - return new PDO($dsn, $username, $password, $options); - } + /** + * Get the default PDO connection options. + * + * @return array + */ + public function getDefaultOptions() + { + return $this->options; + } - /** - * Get the default PDO connection options. - * - * @return array - */ - public function getDefaultOptions() - { - return $this->options; - } + /** + * Set the default PDO connection options. + * + * @param array $options + * @return void + */ + public function setDefaultOptions(array $options) + { + $this->options = $options; + } - /** - * Set the default PDO connection options. - * - * @param array $options - * @return void - */ - public function setDefaultOptions(array $options) - { - $this->options = $options; - } + /** + * Handle a exception that occurred during connect execution. + * + * @param \Exception $e + * @param string $dsn + * @param string $username + * @param string $password + * @param array $options + * @return \PDO + * + * @throws \Exception + */ + protected function tryAgainIfCausedByLostConnection(Exception $e, $dsn, $username, $password, $options) + { + if ($this->causedByLostConnection($e)) { + return new PDO($dsn, $username, $password, $options); + } + throw $e; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectorInterface.php b/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectorInterface.php index c2c76a5..08597ac 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectorInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectorInterface.php @@ -1,13 +1,14 @@ -getDsn($config); - - $options = $this->getOptions($config); - - // We need to grab the PDO options that should be used while making the brand - // new connection instance. The PDO options control various aspects of the - // connection's behavior, and some might be specified by the developers. - $connection = $this->createConnection($dsn, $config, $options); - - if (isset($config['unix_socket'])) - { - $connection->exec("use `{$config['database']}`;"); - } - - $collation = $config['collation']; - - // Next we will set the "names" and "collation" on the clients connections so - // a correct character set will be used by this client. The collation also - // is set on the server but needs to be set here on this client objects. - $charset = $config['charset']; - - $names = "set names '$charset'". - ( ! is_null($collation) ? " collate '$collation'" : ''); - - $connection->prepare($names)->execute(); - - // Next, we will check to see if a timezone has been specified in this config - // and if it has we will issue a statement to modify the timezone with the - // database. Setting this DB timezone is an optional configuration item. - if (isset($config['timezone'])) - { - $connection->prepare( - 'set time_zone="'.$config['timezone'].'"' - )->execute(); - } - - // If the "strict" option has been configured for the connection we'll enable - // strict mode on all of these tables. This enforces some extra rules when - // using the MySQL database system and is a quicker way to enforce them. - if (isset($config['strict']) && $config['strict']) - { - $connection->prepare("set session sql_mode='STRICT_ALL_TABLES'")->execute(); - } - else - { - $connection->prepare("set session sql_mode=''")->execute(); - } - - return $connection; - } - - /** - * Create a DSN string from a configuration. - * - * Chooses socket or host/port based on the 'unix_socket' config value. - * - * @param array $config - * @return string - */ - protected function getDsn(array $config) - { - return $this->configHasSocket($config) ? $this->getSocketDsn($config) : $this->getHostDsn($config); - } - - /** - * Determine if the given configuration array has a UNIX socket value. - * - * @param array $config - * @return bool - */ - protected function configHasSocket(array $config) - { - return isset($config['unix_socket']) && ! empty($config['unix_socket']); - } - - /** - * Get the DSN string for a socket configuration. - * - * @param array $config - * @return string - */ - protected function getSocketDsn(array $config) - { - extract($config); - - return "mysql:unix_socket={$config['unix_socket']};dbname={$database}"; - } - - /** - * Get the DSN string for a host / port configuration. - * - * @param array $config - * @return string - */ - protected function getHostDsn(array $config) - { - extract($config); - - return isset($config['port']) +getDsn($config); + + $options = $this->getOptions($config); + + // We need to grab the PDO options that should be used while making the brand + // new connection instance. The PDO options control various aspects of the + // connection's behavior, and some might be specified by the developers. + $connection = $this->createConnection($dsn, $config, $options); + + if (isset($config['unix_socket'])) { + $connection->exec("use `{$config['database']}`;"); + } + + $collation = $config['collation']; + + // Next we will set the "names" and "collation" on the clients connections so + // a correct character set will be used by this client. The collation also + // is set on the server but needs to be set here on this client objects. + if (isset($config['charset'])) { + $charset = $config['charset']; + + $names = "set names '$charset'". + (! is_null($collation) ? " collate '$collation'" : ''); + + $connection->prepare($names)->execute(); + } + // Next, we will check to see if a timezone has been specified in this config + // and if it has we will issue a statement to modify the timezone with the + // database. Setting this DB timezone is an optional configuration item. + if (isset($config['timezone'])) { + $connection->prepare( + 'set time_zone="'.$config['timezone'].'"' + )->execute(); + } + + // If the "strict" option has been configured for the connection we will setup + // strict mode for this session. Strict mode enforces some extra rules when + // using the MySQL database system and is a quicker way to enforce them. + if (isset($config['strict'])) { + if ($config['strict']) { + $connection->prepare("set session sql_mode='STRICT_ALL_TABLES'")->execute(); + } else { + $connection->prepare("set session sql_mode=''")->execute(); + } + } + + return $connection; + } + + /** + * Create a DSN string from a configuration. + * + * Chooses socket or host/port based on the 'unix_socket' config value. + * + * @param array $config + * @return string + */ + protected function getDsn(array $config) + { + return $this->configHasSocket($config) ? $this->getSocketDsn($config) : $this->getHostDsn($config); + } + + /** + * Determine if the given configuration array has a UNIX socket value. + * + * @param array $config + * @return bool + */ + protected function configHasSocket(array $config) + { + return isset($config['unix_socket']) && ! empty($config['unix_socket']); + } + + /** + * Get the DSN string for a socket configuration. + * + * @param array $config + * @return string + */ + protected function getSocketDsn(array $config) + { + return "mysql:unix_socket={$config['unix_socket']};dbname={$config['database']}"; + } + + /** + * Get the DSN string for a host / port configuration. + * + * @param array $config + * @return string + */ + protected function getHostDsn(array $config) + { + extract($config, EXTR_SKIP); + + return isset($port) ? "mysql:host={$host};port={$port};dbname={$database}" : "mysql:host={$host};dbname={$database}"; - } - + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/PostgresConnector.php b/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/PostgresConnector.php index d725d72..9371c8d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/PostgresConnector.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/PostgresConnector.php @@ -1,96 +1,117 @@ - PDO::CASE_NATURAL, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, - PDO::ATTR_STRINGIFY_FETCHES => false, - ); - - /** - * Establish a database connection. - * - * @param array $config - * @return \PDO - */ - public function connect(array $config) - { - // First we'll create the basic DSN and connection instance connecting to the - // using the configuration option specified by the developer. We will also - // set the default character set on the connections to UTF-8 by default. - $dsn = $this->getDsn($config); - - $options = $this->getOptions($config); - - $connection = $this->createConnection($dsn, $config, $options); - - $charset = $config['charset']; - - $connection->prepare("set names '$charset'")->execute(); - - // Next, we will check to see if a timezone has been specified in this config - // and if it has we will issue a statement to modify the timezone with the - // database. Setting this DB timezone is an optional configuration item. - if (isset($config['timezone'])) - { - $timezone = $config['timezone']; - - $connection->prepare("set time zone '$timezone'")->execute(); - } - - // Unlike MySQL, Postgres allows the concept of "schema" and a default schema - // may have been specified on the connections. If that is the case we will - // set the default schema search paths to the specified database schema. - if (isset($config['schema'])) - { - $schema = $config['schema']; - - $connection->prepare("set search_path to \"{$schema}\"")->execute(); - } - - return $connection; - } - - /** - * Create a DSN string from a configuration. - * - * @param array $config - * @return string - */ - protected function getDsn(array $config) - { - // First we will create the basic DSN setup as well as the port if it is in - // in the configuration options. This will give us the basic DSN we will - // need to establish the PDO connections and return them back for use. - extract($config); - - $host = isset($host) ? "host={$host};" : ''; - - $dsn = "pgsql:{$host}dbname={$database}"; - - // If a port was specified, we will add it to this Postgres DSN connections - // format. Once we have done that we are ready to return this connection - // string back out for usage, as this has been fully constructed here. - if (isset($config['port'])) - { - $dsn .= ";port={$port}"; - } - - if (isset($config['sslmode'])) - { - $dsn .= ";sslmode={$sslmode}"; - } - - return $dsn; - } +use PDO; +class PostgresConnector extends Connector implements ConnectorInterface +{ + /** + * The default PDO connection options. + * + * @var array + */ + protected $options = [ + PDO::ATTR_CASE => PDO::CASE_NATURAL, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, + PDO::ATTR_STRINGIFY_FETCHES => false, + ]; + + /** + * Establish a database connection. + * + * @param array $config + * @return \PDO + */ + public function connect(array $config) + { + // First we'll create the basic DSN and connection instance connecting to the + // using the configuration option specified by the developer. We will also + // set the default character set on the connections to UTF-8 by default. + $dsn = $this->getDsn($config); + + $options = $this->getOptions($config); + + $connection = $this->createConnection($dsn, $config, $options); + + $charset = $config['charset']; + + $connection->prepare("set names '$charset'")->execute(); + + // Next, we will check to see if a timezone has been specified in this config + // and if it has we will issue a statement to modify the timezone with the + // database. Setting this DB timezone is an optional configuration item. + if (isset($config['timezone'])) { + $timezone = $config['timezone']; + + $connection->prepare("set time zone '$timezone'")->execute(); + } + + // Unlike MySQL, Postgres allows the concept of "schema" and a default schema + // may have been specified on the connections. If that is the case we will + // set the default schema search paths to the specified database schema. + if (isset($config['schema'])) { + $schema = $this->formatSchema($config['schema']); + + $connection->prepare("set search_path to {$schema}")->execute(); + } + + // Postgres allows an application_name to be set by the user and this name is + // used to when monitoring the application with pg_stat_activity. So we'll + // determine if the option has been specified and run a statement if so. + if (isset($config['application_name'])) { + $applicationName = $config['application_name']; + + $connection->prepare("set application_name to '$applicationName'")->execute(); + } + + return $connection; + } + + /** + * Create a DSN string from a configuration. + * + * @param array $config + * @return string + */ + protected function getDsn(array $config) + { + // First we will create the basic DSN setup as well as the port if it is in + // in the configuration options. This will give us the basic DSN we will + // need to establish the PDO connections and return them back for use. + extract($config, EXTR_SKIP); + + $host = isset($host) ? "host={$host};" : ''; + + $dsn = "pgsql:{$host}dbname={$database}"; + + // If a port was specified, we will add it to this Postgres DSN connections + // format. Once we have done that we are ready to return this connection + // string back out for usage, as this has been fully constructed here. + if (isset($config['port'])) { + $dsn .= ";port={$port}"; + } + + if (isset($config['sslmode'])) { + $dsn .= ";sslmode={$sslmode}"; + } + + return $dsn; + } + + /** + * Format the schema for the DSN. + * + * @param array|string $schema + * @return string + */ + protected function formatSchema($schema) + { + if (is_array($schema)) { + return '"'.implode('", "', $schema).'"'; + } else { + return '"'.$schema.'"'; + } + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/SQLiteConnector.php b/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/SQLiteConnector.php index 697a72b..28f9091 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/SQLiteConnector.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/SQLiteConnector.php @@ -1,40 +1,39 @@ -getOptions($config); - - // SQLite supports "in-memory" databases that only last as long as the owning - // connection does. These are useful for tests or for short lifetime store - // querying. In-memory databases may only have a single open connection. - if ($config['database'] == ':memory:') - { - return $this->createConnection('sqlite::memory:', $config, $options); - } +namespace Illuminate\Database\Connectors; - $path = realpath($config['database']); - - // Here we'll verify that the SQLite database exists before going any further - // as the developer probably wants to know if the database exists and this - // SQLite driver will not throw any exception if it does not by default. - if ($path === false) - { - throw new InvalidArgumentException("Database does not exist."); - } - - return $this->createConnection("sqlite:{$path}", $config, $options); - } +use InvalidArgumentException; +class SQLiteConnector extends Connector implements ConnectorInterface +{ + /** + * Establish a database connection. + * + * @param array $config + * @return \PDO + * + * @throws \InvalidArgumentException + */ + public function connect(array $config) + { + $options = $this->getOptions($config); + + // SQLite supports "in-memory" databases that only last as long as the owning + // connection does. These are useful for tests or for short lifetime store + // querying. In-memory databases may only have a single open connection. + if ($config['database'] == ':memory:') { + return $this->createConnection('sqlite::memory:', $config, $options); + } + + $path = realpath($config['database']); + + // Here we'll verify that the SQLite database exists before going any further + // as the developer probably wants to know if the database exists and this + // SQLite driver will not throw any exception if it does not by default. + if ($path === false) { + throw new InvalidArgumentException("Database (${config['database']}) does not exist."); + } + + return $this->createConnection("sqlite:{$path}", $config, $options); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/SqlServerConnector.php b/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/SqlServerConnector.php index 020cbaf..46e0b84 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/SqlServerConnector.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Connectors/SqlServerConnector.php @@ -1,142 +1,137 @@ - PDO::CASE_NATURAL, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, - PDO::ATTR_STRINGIFY_FETCHES => false, - ); - - /** - * Establish a database connection. - * - * @param array $config - * @return \PDO - */ - public function connect(array $config) - { - $options = $this->getOptions($config); - - return $this->createConnection($this->getDsn($config), $config, $options); - } - - /** - * Create a DSN string from a configuration. - * - * @param array $config - * @return string - */ - protected function getDsn(array $config) - { - // First we will create the basic DSN setup as well as the port if it is in - // in the configuration options. This will give us the basic DSN we will - // need to establish the PDO connections and return them back for use. - if (in_array('dblib', $this->getAvailableDrivers())) - { - return $this->getDblibDsn($config); - } - else - { - return $this->getSqlSrvDsn($config); - } - } - - /** - * Get the DSN string for a DbLib connection. - * - * @param array $config - * @return string - */ - protected function getDblibDsn(array $config) - { - $arguments = array( - 'host' => $this->buildHostString($config, ':'), - 'dbname' => $config['database'] - ); - - $arguments = array_merge( - $arguments, array_only($config, ['appname', 'charset']) - ); - - return $this->buildConnectString('dblib', $arguments); - } - - /** - * Get the DSN string for a SqlSrv connection. - * - * @param array $config - * @return string - */ - protected function getSqlSrvDsn(array $config) - { - $arguments = array( - 'Server' => $this->buildHostString($config, ',') - ); - - if (isset($config['database'])) { - $arguments['Database'] = $config['database']; - } - - if (isset($config['appname'])) { - $arguments['APP'] = $config['appname']; - } - - return $this->buildConnectString('sqlsrv', $arguments); - } - - /** - * Build a connection string from the given arguments. - * - * @param string $driver - * @param array $arguments - * @return string - */ - protected function buildConnectString($driver, array $arguments) - { - $options = array_map(function($key) use ($arguments) - { - return sprintf("%s=%s", $key, $arguments[$key]); - }, array_keys($arguments)); - - return $driver.":".implode(';', $options); - } - - /** - * Build a host string from the given configuration. - * - * @param array $config - * @param string $separator - * @return string - */ - protected function buildHostString(array $config, $separator) - { - if(isset($config['port'])) - { - return $config['host'].$separator.$config['port']; - } - else - { - return $config['host']; - } - } - - /** - * Get the available PDO drivers. - * - * @return array - */ - protected function getAvailableDrivers() - { - return PDO::getAvailableDrivers(); - } +namespace Illuminate\Database\Connectors; +use PDO; +use Illuminate\Support\Arr; + +class SqlServerConnector extends Connector implements ConnectorInterface +{ + /** + * The PDO connection options. + * + * @var array + */ + protected $options = [ + PDO::ATTR_CASE => PDO::CASE_NATURAL, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, + PDO::ATTR_STRINGIFY_FETCHES => false, + ]; + + /** + * Establish a database connection. + * + * @param array $config + * @return \PDO + */ + public function connect(array $config) + { + $options = $this->getOptions($config); + + return $this->createConnection($this->getDsn($config), $config, $options); + } + + /** + * Create a DSN string from a configuration. + * + * @param array $config + * @return string + */ + protected function getDsn(array $config) + { + // First we will create the basic DSN setup as well as the port if it is in + // in the configuration options. This will give us the basic DSN we will + // need to establish the PDO connections and return them back for use. + if (in_array('dblib', $this->getAvailableDrivers())) { + return $this->getDblibDsn($config); + } else { + return $this->getSqlSrvDsn($config); + } + } + + /** + * Get the DSN string for a DbLib connection. + * + * @param array $config + * @return string + */ + protected function getDblibDsn(array $config) + { + $arguments = [ + 'host' => $this->buildHostString($config, ':'), + 'dbname' => $config['database'], + ]; + + $arguments = array_merge( + $arguments, Arr::only($config, ['appname', 'charset']) + ); + + return $this->buildConnectString('dblib', $arguments); + } + + /** + * Get the DSN string for a SqlSrv connection. + * + * @param array $config + * @return string + */ + protected function getSqlSrvDsn(array $config) + { + $arguments = [ + 'Server' => $this->buildHostString($config, ','), + ]; + + if (isset($config['database'])) { + $arguments['Database'] = $config['database']; + } + + if (isset($config['appname'])) { + $arguments['APP'] = $config['appname']; + } + + return $this->buildConnectString('sqlsrv', $arguments); + } + + /** + * Build a connection string from the given arguments. + * + * @param string $driver + * @param array $arguments + * @return string + */ + protected function buildConnectString($driver, array $arguments) + { + $options = array_map(function ($key) use ($arguments) { + return sprintf('%s=%s', $key, $arguments[$key]); + }, array_keys($arguments)); + + return $driver.':'.implode(';', $options); + } + + /** + * Build a host string from the given configuration. + * + * @param array $config + * @param string $separator + * @return string + */ + protected function buildHostString(array $config, $separator) + { + if (isset($config['port'])) { + return $config['host'].$separator.$config['port']; + } else { + return $config['host']; + } + } + + /** + * Get the available PDO drivers. + * + * @return array + */ + protected function getAvailableDrivers() + { + return PDO::getAvailableDrivers(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/BaseCommand.php b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/BaseCommand.php index 6300755..f3459ac 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/BaseCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/BaseCommand.php @@ -1,17 +1,18 @@ -laravel->databasePath().'/migrations'; - } +use Illuminate\Console\Command; +class BaseCommand extends Command +{ + /** + * Get the path to the migration directory. + * + * @return string + */ + protected function getMigrationPath() + { + return $this->laravel->databasePath().'/migrations'; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/InstallCommand.php b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/InstallCommand.php index d89c0c4..103dcaa 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/InstallCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/InstallCommand.php @@ -1,69 +1,70 @@ -repository = $repository; - } + /** + * Create a new migration install command instance. + * + * @param \Illuminate\Database\Migrations\MigrationRepositoryInterface $repository + * @return void + */ + public function __construct(MigrationRepositoryInterface $repository) + { + parent::__construct(); - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->repository->setSource($this->input->getOption('database')); + $this->repository = $repository; + } - $this->repository->createRepository(); + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $this->repository->setSource($this->input->getOption('database')); - $this->info("Migration table created successfully."); - } + $this->repository->createRepository(); - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'), - ); - } + $this->info('Migration table created successfully.'); + } + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php index 148325c..920d417 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php @@ -1,129 +1,126 @@ -migrator = $migrator; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - if ( ! $this->confirmToProceed()) return; - - $this->prepareDatabase(); - - // The pretend option can be used for "simulating" the migration and grabbing - // the SQL queries that would fire if the migration were to be run against - // a database for real, which is helpful for double checking migrations. - $pretend = $this->input->getOption('pretend'); - - // Next, we will check to see if a path option has been defined. If it has - // we will use the path relative to the root of this installation folder - // so that migrations may be run for any path within the applications. - if ( ! is_null($path = $this->input->getOption('path'))) - { - $path = $this->laravel->basePath().'/'.$path; - } - else - { - $path = $this->getMigrationPath(); - } - - $this->migrator->run($path, $pretend); - - // Once the migrator has run we will grab the note output and send it out to - // the console screen, since the migrator itself functions without having - // any instances of the OutputInterface contract passed into the class. - foreach ($this->migrator->getNotes() as $note) - { - $this->output->writeln($note); - } - - // Finally, if the "seed" option has been given, we will re-run the database - // seed task to re-populate the database, which is convenient when adding - // a migration and a seed at the same time, as it is only this command. - if ($this->input->getOption('seed')) - { - $this->call('db:seed', ['--force' => true]); - } - } - - /** - * Prepare the migration database for running. - * - * @return void - */ - protected function prepareDatabase() - { - $this->migrator->setConnection($this->input->getOption('database')); - - if ( ! $this->migrator->repositoryExists()) - { - $options = array('--database' => $this->input->getOption('database')); - - $this->call('migrate:install', $options); - } - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'), - - array('force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'), - - array('path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to be executed.'), - - array('pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'), - - array('seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run.'), - ); - } - +class MigrateCommand extends BaseCommand +{ + use ConfirmableTrait; + + /** + * The console command name. + * + * @var string + */ + protected $name = 'migrate'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Run the database migrations'; + + /** + * The migrator instance. + * + * @var \Illuminate\Database\Migrations\Migrator + */ + protected $migrator; + + /** + * Create a new migration command instance. + * + * @param \Illuminate\Database\Migrations\Migrator $migrator + * @return void + */ + public function __construct(Migrator $migrator) + { + parent::__construct(); + + $this->migrator = $migrator; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + if (! $this->confirmToProceed()) { + return; + } + + $this->prepareDatabase(); + + // The pretend option can be used for "simulating" the migration and grabbing + // the SQL queries that would fire if the migration were to be run against + // a database for real, which is helpful for double checking migrations. + $pretend = $this->input->getOption('pretend'); + + // Next, we will check to see if a path option has been defined. If it has + // we will use the path relative to the root of this installation folder + // so that migrations may be run for any path within the applications. + if (! is_null($path = $this->input->getOption('path'))) { + $path = $this->laravel->basePath().'/'.$path; + } else { + $path = $this->getMigrationPath(); + } + + $this->migrator->run($path, $pretend); + + // Once the migrator has run we will grab the note output and send it out to + // the console screen, since the migrator itself functions without having + // any instances of the OutputInterface contract passed into the class. + foreach ($this->migrator->getNotes() as $note) { + $this->output->writeln($note); + } + + // Finally, if the "seed" option has been given, we will re-run the database + // seed task to re-populate the database, which is convenient when adding + // a migration and a seed at the same time, as it is only this command. + if ($this->input->getOption('seed')) { + $this->call('db:seed', ['--force' => true]); + } + } + + /** + * Prepare the migration database for running. + * + * @return void + */ + protected function prepareDatabase() + { + $this->migrator->setConnection($this->input->getOption('database')); + + if (! $this->migrator->repositoryExists()) { + $options = ['--database' => $this->input->getOption('database')]; + + $this->call('migrate:install', $options); + } + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], + + ['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to be executed.'], + + ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'], + + ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php index 2aafca6..8c78790 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php @@ -1,120 +1,114 @@ -creator = $creator; - $this->composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - // It's possible for the developer to specify the tables to modify in this - // schema operation. The developer may also specify if this table needs - // to be freshly created so we can create the appropriate migrations. - $name = $this->input->getArgument('name'); - - $table = $this->input->getOption('table'); - - $create = $this->input->getOption('create'); - - if ( ! $table && is_string($create)) $table = $create; - - // Now we are ready to write the migration out to disk. Once we've written - // the migration out, we will dump-autoload for the entire framework to - // make sure that the migrations are registered by the class loaders. - $this->writeMigration($name, $table, $create); - - $this->composer->dumpAutoloads(); - } - - /** - * Write the migration file to disk. - * - * @param string $name - * @param string $table - * @param bool $create - * @return string - */ - protected function writeMigration($name, $table, $create) - { - $path = $this->getMigrationPath(); - - $file = pathinfo($this->creator->create($name, $path, $table, $create), PATHINFO_FILENAME); - - $this->line("Created Migration: $file"); - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return array( - array('name', InputArgument::REQUIRED, 'The name of the migration'), - ); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('create', null, InputOption::VALUE_OPTIONAL, 'The table to be created.'), - - array('table', null, InputOption::VALUE_OPTIONAL, 'The table to migrate.'), - ); - } - +class MigrateMakeCommand extends BaseCommand +{ + /** + * The console command signature. + * + * @var string + */ + protected $signature = 'make:migration {name : The name of the migration.} + {--create= : The table to be created.} + {--table= : The table to migrate.} + {--path= : The location where the migration file should be created.}'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Create a new migration file'; + + /** + * The migration creator instance. + * + * @var \Illuminate\Database\Migrations\MigrationCreator + */ + protected $creator; + + /** + * The Composer instance. + * + * @var \Illuminate\Foundation\Composer + */ + protected $composer; + + /** + * Create a new migration install command instance. + * + * @param \Illuminate\Database\Migrations\MigrationCreator $creator + * @param \Illuminate\Foundation\Composer $composer + * @return void + */ + public function __construct(MigrationCreator $creator, Composer $composer) + { + parent::__construct(); + + $this->creator = $creator; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + // It's possible for the developer to specify the tables to modify in this + // schema operation. The developer may also specify if this table needs + // to be freshly created so we can create the appropriate migrations. + $name = trim($this->input->getArgument('name')); + + $table = $this->input->getOption('table'); + + $create = $this->input->getOption('create'); + + if (! $table && is_string($create)) { + $table = $create; + } + + // Now we are ready to write the migration out to disk. Once we've written + // the migration out, we will dump-autoload for the entire framework to + // make sure that the migrations are registered by the class loaders. + $this->writeMigration($name, $table, $create); + + $this->composer->dumpAutoloads(); + } + + /** + * Write the migration file to disk. + * + * @param string $name + * @param string $table + * @param bool $create + * @return string + */ + protected function writeMigration($name, $table, $create) + { + $path = $this->getMigrationPath(); + + $file = pathinfo($this->creator->create($name, $path, $table, $create), PATHINFO_FILENAME); + + $this->line("Created Migration: $file"); + } + + /** + * Get migration path (either specified by '--path' option or default location). + * + * @return string + */ + protected function getMigrationPath() + { + if (! is_null($targetPath = $this->input->getOption('path'))) { + return $this->laravel->basePath().'/'.$targetPath; + } + + return parent::getMigrationPath(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RefreshCommand.php b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RefreshCommand.php index 8ee4e09..ce4e8f1 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RefreshCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RefreshCommand.php @@ -1,100 +1,108 @@ -confirmToProceed()) return; - - $database = $this->input->getOption('database'); - - $force = $this->input->getOption('force'); - - $this->call('migrate:reset', array( - '--database' => $database, '--force' => $force, - )); - - // The refresh command is essentially just a brief aggregate of a few other of - // the migration commands and just provides a convenient wrapper to execute - // them in succession. We'll also see if we need to re-seed the database. - $this->call('migrate', array( - '--database' => $database, '--force' => $force, - )); - - if ($this->needsSeeding()) - { - $this->runSeeder($database); - } - } - - /** - * Determine if the developer has requested database seeding. - * - * @return bool - */ - protected function needsSeeding() - { - return $this->option('seed') || $this->option('seeder'); - } - - /** - * Run the database seeder command. - * - * @param string $database - * @return void - */ - protected function runSeeder($database) - { - $class = $this->option('seeder') ?: 'DatabaseSeeder'; - - $force = $this->input->getOption('force'); - - $this->call('db:seed', array( - '--database' => $database, '--class' => $class, '--force' => $force, - )); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'), - - array('force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'), - - array('seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run.'), - - array('seeder', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder.'), - ); - } - +class RefreshCommand extends Command +{ + use ConfirmableTrait; + + /** + * The console command name. + * + * @var string + */ + protected $name = 'migrate:refresh'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Reset and re-run all migrations'; + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + if (! $this->confirmToProceed()) { + return; + } + + $database = $this->input->getOption('database'); + + $force = $this->input->getOption('force'); + + $path = $this->input->getOption('path'); + + $this->call('migrate:reset', [ + '--database' => $database, '--force' => $force, + ]); + + // The refresh command is essentially just a brief aggregate of a few other of + // the migration commands and just provides a convenient wrapper to execute + // them in succession. We'll also see if we need to re-seed the database. + $this->call('migrate', [ + '--database' => $database, + '--force' => $force, + '--path' => $path, + ]); + + if ($this->needsSeeding()) { + $this->runSeeder($database); + } + } + + /** + * Determine if the developer has requested database seeding. + * + * @return bool + */ + protected function needsSeeding() + { + return $this->option('seed') || $this->option('seeder'); + } + + /** + * Run the database seeder command. + * + * @param string $database + * @return void + */ + protected function runSeeder($database) + { + $class = $this->option('seeder') ?: 'DatabaseSeeder'; + + $force = $this->input->getOption('force'); + + $this->call('db:seed', [ + '--database' => $database, '--class' => $class, '--force' => $force, + ]); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], + + ['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to be executed.'], + + ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run.'], + + ['seeder', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php index 2ff6905..8871d3d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php @@ -1,93 +1,94 @@ -migrator = $migrator; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - if ( ! $this->confirmToProceed()) return; - - $this->migrator->setConnection($this->input->getOption('database')); - - if ( ! $this->migrator->repositoryExists()) - { - $this->output->writeln('Migration table not found.'); - - return; - } - - $pretend = $this->input->getOption('pretend'); - - $this->migrator->reset($pretend); - - // Once the migrator has run we will grab the note output and send it out to - // the console screen, since the migrator itself functions without having - // any instances of the OutputInterface contract passed into the class. - foreach ($this->migrator->getNotes() as $note) - { - $this->output->writeln($note); - } - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'), - - array('force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'), - - array('pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'), - ); - } - +class ResetCommand extends Command +{ + use ConfirmableTrait; + + /** + * The console command name. + * + * @var string + */ + protected $name = 'migrate:reset'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Rollback all database migrations'; + + /** + * The migrator instance. + * + * @var \Illuminate\Database\Migrations\Migrator + */ + protected $migrator; + + /** + * Create a new migration rollback command instance. + * + * @param \Illuminate\Database\Migrations\Migrator $migrator + * @return void + */ + public function __construct(Migrator $migrator) + { + parent::__construct(); + + $this->migrator = $migrator; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + if (! $this->confirmToProceed()) { + return; + } + + $this->migrator->setConnection($this->input->getOption('database')); + + if (! $this->migrator->repositoryExists()) { + $this->output->writeln('Migration table not found.'); + + return; + } + + $pretend = $this->input->getOption('pretend'); + + $this->migrator->reset($pretend); + + // Once the migrator has run we will grab the note output and send it out to + // the console screen, since the migrator itself functions without having + // any instances of the OutputInterface contract passed into the class. + foreach ($this->migrator->getNotes() as $note) { + $this->output->writeln($note); + } + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], + + ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RollbackCommand.php b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RollbackCommand.php index c11198f..a341b4f 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RollbackCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RollbackCommand.php @@ -1,86 +1,88 @@ -migrator = $migrator; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - if ( ! $this->confirmToProceed()) return; - - $this->migrator->setConnection($this->input->getOption('database')); - - $pretend = $this->input->getOption('pretend'); - - $this->migrator->rollback($pretend); - - // Once the migrator has run we will grab the note output and send it out to - // the console screen, since the migrator itself functions without having - // any instances of the OutputInterface contract passed into the class. - foreach ($this->migrator->getNotes() as $note) - { - $this->output->writeln($note); - } - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'), - - array('force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'), - - array('pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'), - ); - } - +class RollbackCommand extends Command +{ + use ConfirmableTrait; + + /** + * The console command name. + * + * @var string + */ + protected $name = 'migrate:rollback'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Rollback the last database migration'; + + /** + * The migrator instance. + * + * @var \Illuminate\Database\Migrations\Migrator + */ + protected $migrator; + + /** + * Create a new migration rollback command instance. + * + * @param \Illuminate\Database\Migrations\Migrator $migrator + * @return void + */ + public function __construct(Migrator $migrator) + { + parent::__construct(); + + $this->migrator = $migrator; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + if (! $this->confirmToProceed()) { + return; + } + + $this->migrator->setConnection($this->input->getOption('database')); + + $pretend = $this->input->getOption('pretend'); + + $this->migrator->rollback($pretend); + + // Once the migrator has run we will grab the note output and send it out to + // the console screen, since the migrator itself functions without having + // any instances of the OutputInterface contract passed into the class. + foreach ($this->migrator->getNotes() as $note) { + $this->output->writeln($note); + } + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], + + ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/StatusCommand.php b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/StatusCommand.php index 5405ac9..aba7acf 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/StatusCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/StatusCommand.php @@ -1,82 +1,102 @@ -migrator = $migrator; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + if (! $this->migrator->repositoryExists()) { + return $this->error('No migrations found.'); + } + + $this->migrator->setConnection($this->input->getOption('database')); + + if (! is_null($path = $this->input->getOption('path'))) { + $path = $this->laravel->basePath().'/'.$path; + } else { + $path = $this->getMigrationPath(); + } + + $ran = $this->migrator->getRepository()->getRan(); + + $migrations = []; + + foreach ($this->getAllMigrationFiles($path) as $migration) { + $migrations[] = in_array($migration, $ran) ? ['Y', $migration] : ['N', $migration]; + } + + if (count($migrations) > 0) { + $this->table(['Ran?', 'Migration'], $migrations); + } else { + $this->error('No migrations found'); + } + } + + /** + * Get all of the migration files. + * + * @param string $path + * @return array + */ + protected function getAllMigrationFiles($path) + { + return $this->migrator->getMigrationFiles($path); + } -class StatusCommand extends BaseCommand { - - /** - * The console command name. - * - * @var string - */ - protected $name = 'migrate:status'; - - /** - * The console command description. - * - * @var string - */ - protected $description = 'Show the status of each migration'; - - /** - * The migrator instance. - * - * @var \Illuminate\Database\Migrations\Migrator - */ - protected $migrator; - - /** - * Create a new migration rollback command instance. - * - * @param \Illuminate\Database\Migrations\Migrator $migrator - * @return \Illuminate\Database\Console\Migrations\StatusCommand - */ - public function __construct(Migrator $migrator) - { - parent::__construct(); - - $this->migrator = $migrator; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - if ( ! $this->migrator->repositoryExists()) - { - return $this->error('No migrations found.'); - } - - $ran = $this->migrator->getRepository()->getRan(); - - $migrations = []; - - foreach ($this->getAllMigrationFiles() as $migration) - { - $migrations[] = in_array($migration, $ran) ? ['Y', $migration] : ['N', $migration]; - } - - if (count($migrations) > 0) - { - $this->table(['Ran?', 'Migration'], $migrations); - } - else - { - $this->error('No migrations found'); - } - } - - /** - * Get all of the migration files. - * - * @return array - */ - protected function getAllMigrationFiles() - { - return $this->migrator->getMigrationFiles($this->getMigrationPath()); - } + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'], + ['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to use.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Console/SeedCommand.php b/application/vendor/laravel/framework/src/Illuminate/Database/Console/SeedCommand.php deleted file mode 100644 index cba115b..0000000 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Console/SeedCommand.php +++ /dev/null @@ -1,100 +0,0 @@ -resolver = $resolver; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - if ( ! $this->confirmToProceed()) return; - - $this->resolver->setDefaultConnection($this->getDatabase()); - - $this->getSeeder()->run(); - } - - /** - * Get a seeder instance from the container. - * - * @return \Illuminate\Database\Seeder - */ - protected function getSeeder() - { - $class = $this->laravel->make($this->input->getOption('class')); - - return $class->setContainer($this->laravel)->setCommand($this); - } - - /** - * Get the name of the database connection to use. - * - * @return string - */ - protected function getDatabase() - { - $database = $this->input->getOption('database'); - - return $database ?: $this->laravel['config']['database.default']; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('class', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder', 'DatabaseSeeder'), - - array('database', null, InputOption::VALUE_OPTIONAL, 'The database connection to seed'), - - array('force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'), - ); - } - -} diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php new file mode 100644 index 0000000..f74164b --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php @@ -0,0 +1,103 @@ +resolver = $resolver; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + if (! $this->confirmToProceed()) { + return; + } + + $this->resolver->setDefaultConnection($this->getDatabase()); + + $this->getSeeder()->run(); + } + + /** + * Get a seeder instance from the container. + * + * @return \Illuminate\Database\Seeder + */ + protected function getSeeder() + { + $class = $this->laravel->make($this->input->getOption('class')); + + return $class->setContainer($this->laravel)->setCommand($this); + } + + /** + * Get the name of the database connection to use. + * + * @return string + */ + protected function getDatabase() + { + $database = $this->input->getOption('database'); + + return $database ?: $this->laravel['config']['database.default']; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['class', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder', 'DatabaseSeeder'], + + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to seed'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], + ]; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php new file mode 100644 index 0000000..06a83c1 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php @@ -0,0 +1,96 @@ +composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + parent::fire(); + + $this->composer->dumpAutoloads(); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return __DIR__.'/stubs/seeder.stub'; + } + + /** + * Get the destination class path. + * + * @param string $name + * @return string + */ + protected function getPath($name) + { + return $this->laravel->databasePath().'/seeds/'.$name.'.php'; + } + + /** + * Parse the name and format according to the root namespace. + * + * @param string $name + * @return string + */ + protected function parseName($name) + { + return $name; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/stubs/seeder.stub b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/stubs/seeder.stub new file mode 100644 index 0000000..4aa3845 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/stubs/seeder.stub @@ -0,0 +1,16 @@ +app = $app; - $this->factory = $factory; - } - - /** - * Get a database connection instance. - * - * @param string $name - * @return \Illuminate\Database\Connection - */ - public function connection($name = null) - { - list($name, $type) = $this->parseConnectionName($name); - - // If we haven't created this connection, we'll create it based on the config - // provided in the application. Once we've created the connections we will - // set the "fetch mode" for PDO which determines the query return types. - if ( ! isset($this->connections[$name])) - { - $connection = $this->makeConnection($name); - - $this->setPdoForType($connection, $type); - - $this->connections[$name] = $this->prepare($connection); - } - - return $this->connections[$name]; - } - - /** - * Parse the connection into an array of the name and read / write type. - * - * @param string $name - * @return array - */ - protected function parseConnectionName($name) - { - $name = $name ?: $this->getDefaultConnection(); - - return Str::endsWith($name, ['::read', '::write']) +class DatabaseManager implements ConnectionResolverInterface +{ + /** + * The application instance. + * + * @var \Illuminate\Foundation\Application + */ + protected $app; + + /** + * The database connection factory instance. + * + * @var \Illuminate\Database\Connectors\ConnectionFactory + */ + protected $factory; + + /** + * The active connection instances. + * + * @var array + */ + protected $connections = []; + + /** + * The custom connection resolvers. + * + * @var array + */ + protected $extensions = []; + + /** + * Create a new database manager instance. + * + * @param \Illuminate\Foundation\Application $app + * @param \Illuminate\Database\Connectors\ConnectionFactory $factory + * @return void + */ + public function __construct($app, ConnectionFactory $factory) + { + $this->app = $app; + $this->factory = $factory; + } + + /** + * Get a database connection instance. + * + * @param string $name + * @return \Illuminate\Database\Connection + */ + public function connection($name = null) + { + list($name, $type) = $this->parseConnectionName($name); + + // If we haven't created this connection, we'll create it based on the config + // provided in the application. Once we've created the connections we will + // set the "fetch mode" for PDO which determines the query return types. + if (! isset($this->connections[$name])) { + $connection = $this->makeConnection($name); + + $this->setPdoForType($connection, $type); + + $this->connections[$name] = $this->prepare($connection); + } + + return $this->connections[$name]; + } + + /** + * Parse the connection into an array of the name and read / write type. + * + * @param string $name + * @return array + */ + protected function parseConnectionName($name) + { + $name = $name ?: $this->getDefaultConnection(); + + return Str::endsWith($name, ['::read', '::write']) ? explode('::', $name, 2) : [$name, null]; - } - - /** - * Disconnect from the given database and remove from local cache. - * - * @param string $name - * @return void - */ - public function purge($name = null) - { - $this->disconnect($name); - - unset($this->connections[$name]); - } - - /** - * Disconnect from the given database. - * - * @param string $name - * @return void - */ - public function disconnect($name = null) - { - if (isset($this->connections[$name = $name ?: $this->getDefaultConnection()])) - { - $this->connections[$name]->disconnect(); - } - } - - /** - * Reconnect to the given database. - * - * @param string $name - * @return \Illuminate\Database\Connection - */ - public function reconnect($name = null) - { - $this->disconnect($name = $name ?: $this->getDefaultConnection()); - - if ( ! isset($this->connections[$name])) - { - return $this->connection($name); - } - - return $this->refreshPdoConnections($name); - } - - /** - * Refresh the PDO connections on a given connection. - * - * @param string $name - * @return \Illuminate\Database\Connection - */ - protected function refreshPdoConnections($name) - { - $fresh = $this->makeConnection($name); - - return $this->connections[$name] + } + + /** + * Disconnect from the given database and remove from local cache. + * + * @param string $name + * @return void + */ + public function purge($name = null) + { + $this->disconnect($name); + + unset($this->connections[$name]); + } + + /** + * Disconnect from the given database. + * + * @param string $name + * @return void + */ + public function disconnect($name = null) + { + if (isset($this->connections[$name = $name ?: $this->getDefaultConnection()])) { + $this->connections[$name]->disconnect(); + } + } + + /** + * Reconnect to the given database. + * + * @param string $name + * @return \Illuminate\Database\Connection + */ + public function reconnect($name = null) + { + $this->disconnect($name = $name ?: $this->getDefaultConnection()); + + if (! isset($this->connections[$name])) { + return $this->connection($name); + } + + return $this->refreshPdoConnections($name); + } + + /** + * Refresh the PDO connections on a given connection. + * + * @param string $name + * @return \Illuminate\Database\Connection + */ + protected function refreshPdoConnections($name) + { + $fresh = $this->makeConnection($name); + + return $this->connections[$name] ->setPdo($fresh->getPdo()) ->setReadPdo($fresh->getReadPdo()); - } - - /** - * Make the database connection instance. - * - * @param string $name - * @return \Illuminate\Database\Connection - */ - protected function makeConnection($name) - { - $config = $this->getConfig($name); - - // First we will check by the connection name to see if an extension has been - // registered specifically for that connection. If it has we will call the - // Closure and pass it the config allowing it to resolve the connection. - if (isset($this->extensions[$name])) - { - return call_user_func($this->extensions[$name], $config, $name); - } - - $driver = $config['driver']; - - // Next we will check to see if an extension has been registered for a driver - // and will call the Closure if so, which allows us to have a more generic - // resolver for the drivers themselves which applies to all connections. - if (isset($this->extensions[$driver])) - { - return call_user_func($this->extensions[$driver], $config, $name); - } - - return $this->factory->make($config, $name); - } - - /** - * Prepare the database connection instance. - * - * @param \Illuminate\Database\Connection $connection - * @return \Illuminate\Database\Connection - */ - protected function prepare(Connection $connection) - { - $connection->setFetchMode($this->app['config']['database.fetch']); - - if ($this->app->bound('events')) - { - $connection->setEventDispatcher($this->app['events']); - } - - // Here we'll set a reconnector callback. This reconnector can be any callable - // so we will set a Closure to reconnect from this manager with the name of - // the connection, which will allow us to reconnect from the connections. - $connection->setReconnector(function($connection) - { - $this->reconnect($connection->getName()); - }); - - return $connection; - } - - /** - * Prepare the read write mode for database connection instance. - * - * @param \Illuminate\Database\Connection $connection - * @param string $type - * @return \Illuminate\Database\Connection - */ - protected function setPdoForType(Connection $connection, $type = null) - { - if ($type == 'read') - { - $connection->setPdo($connection->getReadPdo()); - } - elseif ($type == 'write') - { - $connection->setReadPdo($connection->getPdo()); - } - - return $connection; - } - - /** - * Get the configuration for a connection. - * - * @param string $name - * @return array - * - * @throws \InvalidArgumentException - */ - protected function getConfig($name) - { - $name = $name ?: $this->getDefaultConnection(); - - // To get the database connection configuration, we will just pull each of the - // connection configurations and get the configurations for the given name. - // If the configuration doesn't exist, we'll throw an exception and bail. - $connections = $this->app['config']['database.connections']; - - if (is_null($config = array_get($connections, $name))) - { - throw new InvalidArgumentException("Database [$name] not configured."); - } - - return $config; - } - - /** - * Get the default connection name. - * - * @return string - */ - public function getDefaultConnection() - { - return $this->app['config']['database.default']; - } - - /** - * Set the default connection name. - * - * @param string $name - * @return void - */ - public function setDefaultConnection($name) - { - $this->app['config']['database.default'] = $name; - } - - /** - * Register an extension connection resolver. - * - * @param string $name - * @param callable $resolver - * @return void - */ - public function extend($name, callable $resolver) - { - $this->extensions[$name] = $resolver; - } - - /** - * Return all of the created connections. - * - * @return array - */ - public function getConnections() - { - return $this->connections; - } - - /** - * Dynamically pass methods to the default connection. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return call_user_func_array(array($this->connection(), $method), $parameters); - } - + } + + /** + * Make the database connection instance. + * + * @param string $name + * @return \Illuminate\Database\Connection + */ + protected function makeConnection($name) + { + $config = $this->getConfig($name); + + // First we will check by the connection name to see if an extension has been + // registered specifically for that connection. If it has we will call the + // Closure and pass it the config allowing it to resolve the connection. + if (isset($this->extensions[$name])) { + return call_user_func($this->extensions[$name], $config, $name); + } + + $driver = $config['driver']; + + // Next we will check to see if an extension has been registered for a driver + // and will call the Closure if so, which allows us to have a more generic + // resolver for the drivers themselves which applies to all connections. + if (isset($this->extensions[$driver])) { + return call_user_func($this->extensions[$driver], $config, $name); + } + + return $this->factory->make($config, $name); + } + + /** + * Prepare the database connection instance. + * + * @param \Illuminate\Database\Connection $connection + * @return \Illuminate\Database\Connection + */ + protected function prepare(Connection $connection) + { + $connection->setFetchMode($this->app['config']['database.fetch']); + + if ($this->app->bound('events')) { + $connection->setEventDispatcher($this->app['events']); + } + + // Here we'll set a reconnector callback. This reconnector can be any callable + // so we will set a Closure to reconnect from this manager with the name of + // the connection, which will allow us to reconnect from the connections. + $connection->setReconnector(function ($connection) { + $this->reconnect($connection->getName()); + }); + + return $connection; + } + + /** + * Prepare the read write mode for database connection instance. + * + * @param \Illuminate\Database\Connection $connection + * @param string $type + * @return \Illuminate\Database\Connection + */ + protected function setPdoForType(Connection $connection, $type = null) + { + if ($type == 'read') { + $connection->setPdo($connection->getReadPdo()); + } elseif ($type == 'write') { + $connection->setReadPdo($connection->getPdo()); + } + + return $connection; + } + + /** + * Get the configuration for a connection. + * + * @param string $name + * @return array + * + * @throws \InvalidArgumentException + */ + protected function getConfig($name) + { + $name = $name ?: $this->getDefaultConnection(); + + // To get the database connection configuration, we will just pull each of the + // connection configurations and get the configurations for the given name. + // If the configuration doesn't exist, we'll throw an exception and bail. + $connections = $this->app['config']['database.connections']; + + if (is_null($config = Arr::get($connections, $name))) { + throw new InvalidArgumentException("Database [$name] not configured."); + } + + return $config; + } + + /** + * Get the default connection name. + * + * @return string + */ + public function getDefaultConnection() + { + return $this->app['config']['database.default']; + } + + /** + * Set the default connection name. + * + * @param string $name + * @return void + */ + public function setDefaultConnection($name) + { + $this->app['config']['database.default'] = $name; + } + + /** + * Register an extension connection resolver. + * + * @param string $name + * @param callable $resolver + * @return void + */ + public function extend($name, callable $resolver) + { + $this->extensions[$name] = $resolver; + } + + /** + * Return all of the created connections. + * + * @return array + */ + public function getConnections() + { + return $this->connections; + } + + /** + * Dynamically pass methods to the default connection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return call_user_func_array([$this->connection(), $method], $parameters); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php index adb10b0..64d9d4b 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php @@ -1,61 +1,88 @@ -app['db']); + + Model::setEventDispatcher($this->app['events']); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + Model::clearBootedModels(); + + $this->registerEloquentFactory(); + + $this->registerQueueableEntityResolver(); + + // The connection factory is used to create the actual connection instances on + // the database. We will inject the factory into the manager so that it may + // make the connections while they are actually needed and not of before. + $this->app->singleton('db.factory', function ($app) { + return new ConnectionFactory($app); + }); + + // The database manager is used to resolve various connections, since multiple + // connections might be managed. It also implements the connection resolver + // interface which may be used by other components requiring connections. + $this->app->singleton('db', function ($app) { + return new DatabaseManager($app, $app['db.factory']); + }); + + $this->app->bind('db.connection', function ($app) { + return $app['db']->connection(); + }); + } + + /** + * Register the Eloquent factory instance in the container. + * + * @return void + */ + protected function registerEloquentFactory() + { + $this->app->singleton(FakerGenerator::class, function () { + return FakerFactory::create(); + }); + + $this->app->singleton(EloquentFactory::class, function ($app) { + $faker = $app->make(FakerGenerator::class); -class DatabaseServiceProvider extends ServiceProvider { - - /** - * Bootstrap the application events. - * - * @return void - */ - public function boot() - { - Model::setConnectionResolver($this->app['db']); - - Model::setEventDispatcher($this->app['events']); - } - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $this->registerQueueableEntityResolver(); - - // The connection factory is used to create the actual connection instances on - // the database. We will inject the factory into the manager so that it may - // make the connections while they are actually needed and not of before. - $this->app->singleton('db.factory', function($app) - { - return new ConnectionFactory($app); - }); - - // The database manager is used to resolve various connections, since multiple - // connections might be managed. It also implements the connection resolver - // interface which may be used by other components requiring connections. - $this->app->singleton('db', function($app) - { - return new DatabaseManager($app, $app['db.factory']); - }); - } - - /** - * Register the queueable entity resolver implementation. - * - * @return void - */ - protected function registerQueueableEntityResolver() - { - $this->app->singleton('Illuminate\Contracts\Queue\EntityResolver', function() - { - return new QueueEntityResolver; - }); - } + return EloquentFactory::construct($faker, database_path('factories')); + }); + } + /** + * Register the queueable entity resolver implementation. + * + * @return void + */ + protected function registerQueueableEntityResolver() + { + $this->app->singleton('Illuminate\Contracts\Queue\EntityResolver', function () { + return new QueueEntityResolver; + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php b/application/vendor/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php new file mode 100644 index 0000000..bee3482 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php @@ -0,0 +1,33 @@ +getMessage(); + + return Str::contains($message, [ + 'server has gone away', + 'no connection to the server', + 'Lost connection', + 'is dead or not enabled', + 'Error while sending', + 'decryption failed or bad record mac', + 'server closed the connection unexpectedly', + 'SSL connection has been closed unexpectedly', + 'Error writing data to the connection', + 'Resource deadlock avoided', + ]); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php index 4ea4ab3..5e45ba7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php @@ -1,948 +1,1029 @@ -query = $query; - } - - /** - * Find a model by its primary key. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null - */ - public function find($id, $columns = array('*')) - { - if (is_array($id)) - { - return $this->findMany($id, $columns); - } - - $this->query->where($this->model->getQualifiedKeyName(), '=', $id); - - return $this->first($columns); - } - - /** - * Find a model by its primary key. - * - * @param array $ids - * @param array $columns - * @return \Illuminate\Database\Eloquent\Collection - */ - public function findMany($ids, $columns = array('*')) - { - if (empty($ids)) return $this->model->newCollection(); - - $this->query->whereIn($this->model->getQualifiedKeyName(), $ids); - - return $this->get($columns); - } - - /** - * Find a model by its primary key or throw an exception. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException - */ - public function findOrFail($id, $columns = array('*')) - { - $result = $this->find($id, $columns); - - if (is_array($id)) - { - if (count($result) == count(array_unique($id))) return $result; - } - elseif ( ! is_null($result)) - { - return $result; - } - - throw (new ModelNotFoundException)->setModel(get_class($this->model)); - } - - /** - * Execute the query and get the first result. - * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|static|null - */ - public function first($columns = array('*')) - { - return $this->take(1)->get($columns)->first(); - } - - /** - * Execute the query and get the first result or throw an exception. - * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|static - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException - */ - public function firstOrFail($columns = array('*')) - { - if ( ! is_null($model = $this->first($columns))) return $model; - - throw (new ModelNotFoundException)->setModel(get_class($this->model)); - } - - /** - * Execute the query as a "select" statement. - * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Collection|static[] - */ - public function get($columns = array('*')) - { - $models = $this->getModels($columns); - - // If we actually found models we will also eager load any relationships that - // have been specified as needing to be eager loaded, which will solve the - // n+1 query issue for the developers to avoid running a lot of queries. - if (count($models) > 0) - { - $models = $this->eagerLoadRelations($models); - } - - return $this->model->newCollection($models); - } - - /** - * Pluck a single column from the database. - * - * @param string $column - * @return mixed - */ - public function pluck($column) - { - $result = $this->first(array($column)); - - if ($result) return $result->{$column}; - } - - /** - * Chunk the results of the query. - * - * @param int $count - * @param callable $callback - * @return void - */ - public function chunk($count, callable $callback) - { - $results = $this->forPage($page = 1, $count)->get(); - - while (count($results) > 0) - { - // On each chunk result set, we will pass them to the callback and then let the - // developer take care of everything within the callback, which allows us to - // keep the memory low for spinning through large result sets for working. - call_user_func($callback, $results); - - $page++; - - $results = $this->forPage($page, $count)->get(); - } - } - - /** - * Get an array with the values of a given column. - * - * @param string $column - * @param string $key - * @return array - */ - public function lists($column, $key = null) - { - $results = $this->query->lists($column, $key); - - // If the model has a mutator for the requested column, we will spin through - // the results and mutate the values so that the mutated version of these - // columns are returned as you would expect from these Eloquent models. - if ($this->model->hasGetMutator($column)) - { - foreach ($results as $key => &$value) - { - $fill = array($column => $value); - - $value = $this->model->newFromBuilder($fill)->$column; - } - } - - return $results; - } - - /** - * Paginate the given query. - * - * @param int $perPage - * @param array $columns - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator - */ - public function paginate($perPage = null, $columns = ['*']) - { - $total = $this->query->getCountForPagination(); - - $this->query->forPage( - $page = Paginator::resolveCurrentPage(), - $perPage = $perPage ?: $this->model->getPerPage() - ); - - return new LengthAwarePaginator($this->get($columns), $total, $perPage, $page, [ - 'path' => Paginator::resolveCurrentPath(), - ]); - } - - /** - * Paginate the given query into a simple paginator. - * - * @param int $perPage - * @param array $columns - * @return \Illuminate\Contracts\Pagination\Paginator - */ - public function simplePaginate($perPage = null, $columns = ['*']) - { - $page = Paginator::resolveCurrentPage(); - - $perPage = $perPage ?: $this->model->getPerPage(); - - $this->skip(($page - 1) * $perPage)->take($perPage + 1); - - return new Paginator($this->get($columns), $perPage, $page, [ - 'path' => Paginator::resolveCurrentPath(), - ]); - } - - /** - * Update a record in the database. - * - * @param array $values - * @return int - */ - public function update(array $values) - { - return $this->query->update($this->addUpdatedAtColumn($values)); - } - - /** - * Increment a column's value by a given amount. - * - * @param string $column - * @param int $amount - * @param array $extra - * @return int - */ - public function increment($column, $amount = 1, array $extra = array()) - { - $extra = $this->addUpdatedAtColumn($extra); - - return $this->query->increment($column, $amount, $extra); - } - - /** - * Decrement a column's value by a given amount. - * - * @param string $column - * @param int $amount - * @param array $extra - * @return int - */ - public function decrement($column, $amount = 1, array $extra = array()) - { - $extra = $this->addUpdatedAtColumn($extra); - - return $this->query->decrement($column, $amount, $extra); - } - - /** - * Add the "updated at" column to an array of values. - * - * @param array $values - * @return array - */ - protected function addUpdatedAtColumn(array $values) - { - if ( ! $this->model->usesTimestamps()) return $values; - - $column = $this->model->getUpdatedAtColumn(); - - return array_add($values, $column, $this->model->freshTimestampString()); - } - - /** - * Delete a record from the database. - * - * @return mixed - */ - public function delete() - { - if (isset($this->onDelete)) - { - return call_user_func($this->onDelete, $this); - } - - return $this->query->delete(); - } - - /** - * Run the default delete function on the builder. - * - * @return mixed - */ - public function forceDelete() - { - return $this->query->delete(); - } - - /** - * Register a replacement for the default delete function. - * - * @param \Closure $callback - * @return void - */ - public function onDelete(Closure $callback) - { - $this->onDelete = $callback; - } - - /** - * Get the hydrated models without eager loading. - * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model[] - */ - public function getModels($columns = array('*')) - { - $results = $this->query->get($columns); - - $connection = $this->model->getConnectionName(); - - return $this->model->hydrate($results, $connection)->all(); - } - - /** - * Eager load the relationships for the models. - * - * @param array $models - * @return array - */ - public function eagerLoadRelations(array $models) - { - foreach ($this->eagerLoad as $name => $constraints) - { - // For nested eager loads we'll skip loading them here and they will be set as an - // eager load on the query to retrieve the relation so that they will be eager - // loaded on that query, because that is where they get hydrated as models. - if (strpos($name, '.') === false) - { - $models = $this->loadRelation($models, $name, $constraints); - } - } - - return $models; - } - - /** - * Eagerly load the relationship on a set of models. - * - * @param array $models - * @param string $name - * @param \Closure $constraints - * @return array - */ - protected function loadRelation(array $models, $name, Closure $constraints) - { - // First we will "back up" the existing where conditions on the query so we can - // add our eager constraints. Then we will merge the wheres that were on the - // query back to it in order that any where conditions might be specified. - $relation = $this->getRelation($name); - - $relation->addEagerConstraints($models); - - call_user_func($constraints, $relation); - - $models = $relation->initRelation($models, $name); - - // Once we have the results, we just match those back up to their parent models - // using the relationship instance. Then we just return the finished arrays - // of models which have been eagerly hydrated and are readied for return. - $results = $relation->getEager(); - - return $relation->match($models, $results, $name); - } - - /** - * Get the relation instance for the given relation name. - * - * @param string $relation - * @return \Illuminate\Database\Eloquent\Relations\Relation - */ - public function getRelation($relation) - { - // We want to run a relationship query without any constrains so that we will - // not have to remove these where clauses manually which gets really hacky - // and is error prone while we remove the developer's own where clauses. - $query = Relation::noConstraints(function() use ($relation) - { - return $this->getModel()->$relation(); - }); - - $nested = $this->nestedRelations($relation); - - // If there are nested relationships set on the query, we will put those onto - // the query instances so that they can be handled after this relationship - // is loaded. In this way they will all trickle down as they are loaded. - if (count($nested) > 0) - { - $query->getQuery()->with($nested); - } - - return $query; - } - - /** - * Get the deeply nested relations for a given top-level relation. - * - * @param string $relation - * @return array - */ - protected function nestedRelations($relation) - { - $nested = array(); - - // We are basically looking for any relationships that are nested deeper than - // the given top-level relationship. We will just check for any relations - // that start with the given top relations and adds them to our arrays. - foreach ($this->eagerLoad as $name => $constraints) - { - if ($this->isNested($name, $relation)) - { - $nested[substr($name, strlen($relation.'.'))] = $constraints; - } - } - - return $nested; - } - - /** - * Determine if the relationship is nested. - * - * @param string $name - * @param string $relation - * @return bool - */ - protected function isNested($name, $relation) - { - $dots = str_contains($name, '.'); - - return $dots && starts_with($name, $relation.'.'); - } - - /** - * Add a basic where clause to the query. - * - * @param string $column - * @param string $operator - * @param mixed $value - * @param string $boolean - * @return $this - */ - public function where($column, $operator = null, $value = null, $boolean = 'and') - { - if ($column instanceof Closure) - { - $query = $this->model->newQueryWithoutScopes(); - - call_user_func($column, $query); - - $this->query->addNestedWhereQuery($query->getQuery(), $boolean); - } - else - { - call_user_func_array(array($this->query, 'where'), func_get_args()); - } - - return $this; - } - - /** - * Add an "or where" clause to the query. - * - * @param string $column - * @param string $operator - * @param mixed $value - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function orWhere($column, $operator = null, $value = null) - { - return $this->where($column, $operator, $value, 'or'); - } - - /** - * Add a relationship count condition to the query. - * - * @param string $relation - * @param string $operator - * @param int $count - * @param string $boolean - * @param \Closure|null $callback - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', Closure $callback = null) - { - if (strpos($relation, '.') !== false) - { - return $this->hasNested($relation, $operator, $count, $boolean, $callback); - } - - $relation = $this->getHasRelationQuery($relation); - - $query = $relation->getRelationCountQuery($relation->getRelated()->newQuery(), $this); - - if ($callback) call_user_func($callback, $query); - - return $this->addHasWhere($query, $relation, $operator, $count, $boolean); - } - - /** - * Add nested relationship count conditions to the query. - * - * @param string $relations - * @param string $operator - * @param int $count - * @param string $boolean - * @param \Closure $callback - * @return \Illuminate\Database\Eloquent\Builder|static - */ - protected function hasNested($relations, $operator = '>=', $count = 1, $boolean = 'and', $callback = null) - { - $relations = explode('.', $relations); - - // In order to nest "has", we need to add count relation constraints on the - // callback Closure. We'll do this by simply passing the Closure its own - // reference to itself so it calls itself recursively on each segment. - $closure = function ($q) use (&$closure, &$relations, $operator, $count, $boolean, $callback) - { - if (count($relations) > 1) - { - $q->whereHas(array_shift($relations), $closure); - } - else - { - $q->has(array_shift($relations), $operator, $count, 'and', $callback); - } - }; - - return $this->has(array_shift($relations), '>=', 1, $boolean, $closure); - } - - /** - * Add a relationship count condition to the query. - * - * @param string $relation - * @param string $boolean - * @param \Closure|null $callback - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function doesntHave($relation, $boolean = 'and', Closure $callback = null) - { - return $this->has($relation, '<', 1, $boolean, $callback); - } - - /** - * Add a relationship count condition to the query with where clauses. - * - * @param string $relation - * @param \Closure $callback - * @param string $operator - * @param int $count - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function whereHas($relation, Closure $callback, $operator = '>=', $count = 1) - { - return $this->has($relation, $operator, $count, 'and', $callback); - } - - /** - * Add a relationship count condition to the query with where clauses. - * - * @param string $relation - * @param \Closure|null $callback - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function whereDoesntHave($relation, Closure $callback = null) - { - return $this->doesntHave($relation, 'and', $callback); - } - - /** - * Add a relationship count condition to the query with an "or". - * - * @param string $relation - * @param string $operator - * @param int $count - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function orHas($relation, $operator = '>=', $count = 1) - { - return $this->has($relation, $operator, $count, 'or'); - } - - /** - * Add a relationship count condition to the query with where clauses and an "or". - * - * @param string $relation - * @param \Closure $callback - * @param string $operator - * @param int $count - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function orWhereHas($relation, Closure $callback, $operator = '>=', $count = 1) - { - return $this->has($relation, $operator, $count, 'or', $callback); - } - - /** - * Add the "has" condition where clause to the query. - * - * @param \Illuminate\Database\Eloquent\Builder $hasQuery - * @param \Illuminate\Database\Eloquent\Relations\Relation $relation - * @param string $operator - * @param int $count - * @param string $boolean - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function addHasWhere(Builder $hasQuery, Relation $relation, $operator, $count, $boolean) - { - $this->mergeWheresToHas($hasQuery, $relation); - - if (is_numeric($count)) - { - $count = new Expression($count); - } - - return $this->where(new Expression('('.$hasQuery->toSql().')'), $operator, $count, $boolean); - } - - /** - * Merge the "wheres" from a relation query to a has query. - * - * @param \Illuminate\Database\Eloquent\Builder $hasQuery - * @param \Illuminate\Database\Eloquent\Relations\Relation $relation - * @return void - */ - protected function mergeWheresToHas(Builder $hasQuery, Relation $relation) - { - // Here we have the "has" query and the original relation. We need to copy over any - // where clauses the developer may have put in the relationship function over to - // the has query, and then copy the bindings from the "has" query to the main. - $relationQuery = $relation->getBaseQuery(); - - $hasQuery = $hasQuery->getModel()->removeGlobalScopes($hasQuery); - - $hasQuery->mergeWheres( - $relationQuery->wheres, $relationQuery->getBindings() - ); - - $this->query->mergeBindings($hasQuery->getQuery()); - } - - /** - * Get the "has relation" base query instance. - * - * @param string $relation - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function getHasRelationQuery($relation) - { - return Relation::noConstraints(function() use ($relation) - { - return $this->getModel()->$relation(); - }); - } - - /** - * Set the relationships that should be eager loaded. - * - * @param mixed $relations - * @return $this - */ - public function with($relations) - { - if (is_string($relations)) $relations = func_get_args(); - - $eagers = $this->parseRelations($relations); - - $this->eagerLoad = array_merge($this->eagerLoad, $eagers); - - return $this; - } - - /** - * Parse a list of relations into individuals. - * - * @param array $relations - * @return array - */ - protected function parseRelations(array $relations) - { - $results = array(); - - foreach ($relations as $name => $constraints) - { - // If the "relation" value is actually a numeric key, we can assume that no - // constraints have been specified for the eager load and we'll just put - // an empty Closure with the loader so that we can treat all the same. - if (is_numeric($name)) - { - $f = function() {}; - - list($name, $constraints) = array($constraints, $f); - } - - // We need to separate out any nested includes. Which allows the developers - // to load deep relationships using "dots" without stating each level of - // the relationship with its own key in the array of eager load names. - $results = $this->parseNested($name, $results); - - $results[$name] = $constraints; - } - - return $results; - } - - /** - * Parse the nested relationships in a relation. - * - * @param string $name - * @param array $results - * @return array - */ - protected function parseNested($name, $results) - { - $progress = array(); - - // If the relation has already been set on the result array, we will not set it - // again, since that would override any constraints that were already placed - // on the relationships. We will only set the ones that are not specified. - foreach (explode('.', $name) as $segment) - { - $progress[] = $segment; - - if ( ! isset($results[$last = implode('.', $progress)])) - { - $results[$last] = function() {}; - } - } - - return $results; - } - - /** - * Call the given model scope on the underlying model. - * - * @param string $scope - * @param array $parameters - * @return \Illuminate\Database\Query\Builder - */ - protected function callScope($scope, $parameters) - { - array_unshift($parameters, $this); - - return call_user_func_array(array($this->model, $scope), $parameters) ?: $this; - } - - /** - * Get the underlying query builder instance. - * - * @return \Illuminate\Database\Query\Builder|static - */ - public function getQuery() - { - return $this->query; - } - - /** - * Set the underlying query builder instance. - * - * @param \Illuminate\Database\Query\Builder $query - * @return $this - */ - public function setQuery($query) - { - $this->query = $query; - - return $this; - } - - /** - * Get the relationships being eagerly loaded. - * - * @return array - */ - public function getEagerLoads() - { - return $this->eagerLoad; - } - - /** - * Set the relationships being eagerly loaded. - * - * @param array $eagerLoad - * @return $this - */ - public function setEagerLoads(array $eagerLoad) - { - $this->eagerLoad = $eagerLoad; - - return $this; - } - - /** - * Get the model instance being queried. - * - * @return \Illuminate\Database\Eloquent\Model - */ - public function getModel() - { - return $this->model; - } - - /** - * Set a model instance for the model being queried. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return $this - */ - public function setModel(Model $model) - { - $this->model = $model; - - $this->query->from($model->getTable()); - - return $this; - } - - /** - * Extend the builder with a given callback. - * - * @param string $name - * @param \Closure $callback - * @return void - */ - public function macro($name, Closure $callback) - { - $this->macros[$name] = $callback; - } - - /** - * Get the given macro by name. - * - * @param string $name - * @return \Closure - */ - public function getMacro($name) - { - return array_get($this->macros, $name); - } - - /** - * Dynamically handle calls into the query instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if (isset($this->macros[$method])) - { - array_unshift($parameters, $this); - - return call_user_func_array($this->macros[$method], $parameters); - } - elseif (method_exists($this->model, $scope = 'scope'.ucfirst($method))) - { - return $this->callScope($scope, $parameters); - } - - $result = call_user_func_array(array($this->query, $method), $parameters); - - return in_array($method, $this->passthru) ? $result : $this; - } - - /** - * Force a clone of the underlying query builder when cloning. - * - * @return void - */ - public function __clone() - { - $this->query = clone $this->query; - } - +class Builder +{ + /** + * The base query builder instance. + * + * @var \Illuminate\Database\Query\Builder + */ + protected $query; + + /** + * The model being queried. + * + * @var \Illuminate\Database\Eloquent\Model + */ + protected $model; + + /** + * The relationships that should be eager loaded. + * + * @var array + */ + protected $eagerLoad = []; + + /** + * All of the registered builder macros. + * + * @var array + */ + protected $macros = []; + + /** + * A replacement for the typical delete function. + * + * @var \Closure + */ + protected $onDelete; + + /** + * The methods that should be returned from query builder. + * + * @var array + */ + protected $passthru = [ + 'insert', 'insertGetId', 'getBindings', 'toSql', + 'exists', 'count', 'min', 'max', 'avg', 'sum', + ]; + + /** + * Create a new Eloquent query builder instance. + * + * @param \Illuminate\Database\Query\Builder $query + * @return void + */ + public function __construct(QueryBuilder $query) + { + $this->query = $query; + } + + /** + * Find a model by its primary key. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null + */ + public function find($id, $columns = ['*']) + { + if (is_array($id)) { + return $this->findMany($id, $columns); + } + + $this->query->where($this->model->getQualifiedKeyName(), '=', $id); + + return $this->first($columns); + } + + /** + * Find a model by its primary key. + * + * @param array $ids + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function findMany($ids, $columns = ['*']) + { + if (empty($ids)) { + return $this->model->newCollection(); + } + + $this->query->whereIn($this->model->getQualifiedKeyName(), $ids); + + return $this->get($columns); + } + + /** + * Find a model by its primary key or throw an exception. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function findOrFail($id, $columns = ['*']) + { + $result = $this->find($id, $columns); + + if (is_array($id)) { + if (count($result) == count(array_unique($id))) { + return $result; + } + } elseif (! is_null($result)) { + return $result; + } + + throw (new ModelNotFoundException)->setModel(get_class($this->model)); + } + + /** + * Find a model by its primary key or return fresh model instance. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model + */ + public function findOrNew($id, $columns = ['*']) + { + if (! is_null($model = $this->find($id, $columns))) { + return $model; + } + + return $this->model->newInstance(); + } + + /** + * Get the first record matching the attributes or instantiate it. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrNew(array $attributes) + { + if (! is_null($instance = $this->where($attributes)->first())) { + return $instance; + } + + return $this->model->newInstance($attributes); + } + + /** + * Get the first record matching the attributes or create it. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrCreate(array $attributes) + { + if (! is_null($instance = $this->where($attributes)->first())) { + return $instance; + } + + $instance = $this->model->newInstance($attributes); + + $instance->save(); + + return $instance; + } + + /** + * Create or update a record matching the attributes, and fill it with values. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model + */ + public function updateOrCreate(array $attributes, array $values = []) + { + $instance = $this->firstOrNew($attributes); + + $instance->fill($values)->save(); + + return $instance; + } + + /** + * Execute the query and get the first result. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|static|null + */ + public function first($columns = ['*']) + { + return $this->take(1)->get($columns)->first(); + } + + /** + * Execute the query and get the first result or throw an exception. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|static + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function firstOrFail($columns = ['*']) + { + if (! is_null($model = $this->first($columns))) { + return $model; + } + + throw (new ModelNotFoundException)->setModel(get_class($this->model)); + } + + /** + * Execute the query as a "select" statement. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection|static[] + */ + public function get($columns = ['*']) + { + $models = $this->getModels($columns); + + // If we actually found models we will also eager load any relationships that + // have been specified as needing to be eager loaded, which will solve the + // n+1 query issue for the developers to avoid running a lot of queries. + if (count($models) > 0) { + $models = $this->eagerLoadRelations($models); + } + + return $this->model->newCollection($models); + } + + /** + * Get a single column's value from the first result of a query. + * + * @param string $column + * @return mixed + */ + public function value($column) + { + $result = $this->first([$column]); + + if ($result) { + return $result->{$column}; + } + } + + /** + * Get a single column's value from the first result of a query. + * + * This is an alias for the "value" method. + * + * @param string $column + * @return mixed + * + * @deprecated since version 5.1. + */ + public function pluck($column) + { + return $this->value($column); + } + + /** + * Chunk the results of the query. + * + * @param int $count + * @param callable $callback + * @return bool + */ + public function chunk($count, callable $callback) + { + $results = $this->forPage($page = 1, $count)->get(); + + while (count($results) > 0) { + // On each chunk result set, we will pass them to the callback and then let the + // developer take care of everything within the callback, which allows us to + // keep the memory low for spinning through large result sets for working. + if (call_user_func($callback, $results) === false) { + return false; + } + + $page++; + + $results = $this->forPage($page, $count)->get(); + } + + return true; + } + + /** + * Get an array with the values of a given column. + * + * @param string $column + * @param string|null $key + * @return \Illuminate\Support\Collection + */ + public function lists($column, $key = null) + { + $results = $this->query->lists($column, $key); + + // If the model has a mutator for the requested column, we will spin through + // the results and mutate the values so that the mutated version of these + // columns are returned as you would expect from these Eloquent models. + if ($this->model->hasGetMutator($column)) { + foreach ($results as $key => &$value) { + $fill = [$column => $value]; + + $value = $this->model->newFromBuilder($fill)->$column; + } + } + + return collect($results); + } + + /** + * Paginate the given query. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + * + * @throws \InvalidArgumentException + */ + public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $total = $this->query->getCountForPagination(); + + $this->query->forPage( + $page = $page ?: Paginator::resolveCurrentPage($pageName), + $perPage = $perPage ?: $this->model->getPerPage() + ); + + return new LengthAwarePaginator($this->get($columns), $total, $perPage, $page, [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ]); + } + + /** + * Paginate the given query into a simple paginator. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @return \Illuminate\Contracts\Pagination\Paginator + */ + public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page') + { + $page = Paginator::resolveCurrentPage($pageName); + + $perPage = $perPage ?: $this->model->getPerPage(); + + $this->skip(($page - 1) * $perPage)->take($perPage + 1); + + return new Paginator($this->get($columns), $perPage, $page, [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ]); + } + + /** + * Update a record in the database. + * + * @param array $values + * @return int + */ + public function update(array $values) + { + return $this->query->update($this->addUpdatedAtColumn($values)); + } + + /** + * Increment a column's value by a given amount. + * + * @param string $column + * @param int $amount + * @param array $extra + * @return int + */ + public function increment($column, $amount = 1, array $extra = []) + { + $extra = $this->addUpdatedAtColumn($extra); + + return $this->query->increment($column, $amount, $extra); + } + + /** + * Decrement a column's value by a given amount. + * + * @param string $column + * @param int $amount + * @param array $extra + * @return int + */ + public function decrement($column, $amount = 1, array $extra = []) + { + $extra = $this->addUpdatedAtColumn($extra); + + return $this->query->decrement($column, $amount, $extra); + } + + /** + * Add the "updated at" column to an array of values. + * + * @param array $values + * @return array + */ + protected function addUpdatedAtColumn(array $values) + { + if (! $this->model->usesTimestamps()) { + return $values; + } + + $column = $this->model->getUpdatedAtColumn(); + + return Arr::add($values, $column, $this->model->freshTimestampString()); + } + + /** + * Delete a record from the database. + * + * @return mixed + */ + public function delete() + { + if (isset($this->onDelete)) { + return call_user_func($this->onDelete, $this); + } + + return $this->query->delete(); + } + + /** + * Run the default delete function on the builder. + * + * @return mixed + */ + public function forceDelete() + { + return $this->query->delete(); + } + + /** + * Register a replacement for the default delete function. + * + * @param \Closure $callback + * @return void + */ + public function onDelete(Closure $callback) + { + $this->onDelete = $callback; + } + + /** + * Get the hydrated models without eager loading. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model[] + */ + public function getModels($columns = ['*']) + { + $results = $this->query->get($columns); + + $connection = $this->model->getConnectionName(); + + return $this->model->hydrate($results, $connection)->all(); + } + + /** + * Eager load the relationships for the models. + * + * @param array $models + * @return array + */ + public function eagerLoadRelations(array $models) + { + foreach ($this->eagerLoad as $name => $constraints) { + // For nested eager loads we'll skip loading them here and they will be set as an + // eager load on the query to retrieve the relation so that they will be eager + // loaded on that query, because that is where they get hydrated as models. + if (strpos($name, '.') === false) { + $models = $this->loadRelation($models, $name, $constraints); + } + } + + return $models; + } + + /** + * Eagerly load the relationship on a set of models. + * + * @param array $models + * @param string $name + * @param \Closure $constraints + * @return array + */ + protected function loadRelation(array $models, $name, Closure $constraints) + { + // First we will "back up" the existing where conditions on the query so we can + // add our eager constraints. Then we will merge the wheres that were on the + // query back to it in order that any where conditions might be specified. + $relation = $this->getRelation($name); + + $relation->addEagerConstraints($models); + + call_user_func($constraints, $relation); + + $models = $relation->initRelation($models, $name); + + // Once we have the results, we just match those back up to their parent models + // using the relationship instance. Then we just return the finished arrays + // of models which have been eagerly hydrated and are readied for return. + $results = $relation->getEager(); + + return $relation->match($models, $results, $name); + } + + /** + * Get the relation instance for the given relation name. + * + * @param string $name + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + public function getRelation($name) + { + // We want to run a relationship query without any constrains so that we will + // not have to remove these where clauses manually which gets really hacky + // and is error prone while we remove the developer's own where clauses. + $relation = Relation::noConstraints(function () use ($name) { + return $this->getModel()->$name(); + }); + + $nested = $this->nestedRelations($name); + + // If there are nested relationships set on the query, we will put those onto + // the query instances so that they can be handled after this relationship + // is loaded. In this way they will all trickle down as they are loaded. + if (count($nested) > 0) { + $relation->getQuery()->with($nested); + } + + return $relation; + } + + /** + * Get the deeply nested relations for a given top-level relation. + * + * @param string $relation + * @return array + */ + protected function nestedRelations($relation) + { + $nested = []; + + // We are basically looking for any relationships that are nested deeper than + // the given top-level relationship. We will just check for any relations + // that start with the given top relations and adds them to our arrays. + foreach ($this->eagerLoad as $name => $constraints) { + if ($this->isNested($name, $relation)) { + $nested[substr($name, strlen($relation.'.'))] = $constraints; + } + } + + return $nested; + } + + /** + * Determine if the relationship is nested. + * + * @param string $name + * @param string $relation + * @return bool + */ + protected function isNested($name, $relation) + { + $dots = Str::contains($name, '.'); + + return $dots && Str::startsWith($name, $relation.'.'); + } + + /** + * Add a basic where clause to the query. + * + * @param string $column + * @param string $operator + * @param mixed $value + * @param string $boolean + * @return $this + */ + public function where($column, $operator = null, $value = null, $boolean = 'and') + { + if ($column instanceof Closure) { + $query = $this->model->newQueryWithoutScopes(); + + call_user_func($column, $query); + + $this->query->addNestedWhereQuery($query->getQuery(), $boolean); + } else { + call_user_func_array([$this->query, 'where'], func_get_args()); + } + + return $this; + } + + /** + * Add an "or where" clause to the query. + * + * @param string $column + * @param string $operator + * @param mixed $value + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orWhere($column, $operator = null, $value = null) + { + return $this->where($column, $operator, $value, 'or'); + } + + /** + * Add a relationship count condition to the query. + * + * @param string $relation + * @param string $operator + * @param int $count + * @param string $boolean + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', Closure $callback = null) + { + if (strpos($relation, '.') !== false) { + return $this->hasNested($relation, $operator, $count, $boolean, $callback); + } + + $relation = $this->getHasRelationQuery($relation); + + $query = $relation->getRelationCountQuery($relation->getRelated()->newQuery(), $this); + + if ($callback) { + call_user_func($callback, $query); + } + + return $this->addHasWhere($query, $relation, $operator, $count, $boolean); + } + + /** + * Add nested relationship count conditions to the query. + * + * @param string $relations + * @param string $operator + * @param int $count + * @param string $boolean + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + protected function hasNested($relations, $operator = '>=', $count = 1, $boolean = 'and', $callback = null) + { + $relations = explode('.', $relations); + + // In order to nest "has", we need to add count relation constraints on the + // callback Closure. We'll do this by simply passing the Closure its own + // reference to itself so it calls itself recursively on each segment. + $closure = function ($q) use (&$closure, &$relations, $operator, $count, $boolean, $callback) { + if (count($relations) > 1) { + $q->whereHas(array_shift($relations), $closure); + } else { + $q->has(array_shift($relations), $operator, $count, 'and', $callback); + } + }; + + return $this->has(array_shift($relations), '>=', 1, $boolean, $closure); + } + + /** + * Add a relationship count condition to the query. + * + * @param string $relation + * @param string $boolean + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function doesntHave($relation, $boolean = 'and', Closure $callback = null) + { + return $this->has($relation, '<', 1, $boolean, $callback); + } + + /** + * Add a relationship count condition to the query with where clauses. + * + * @param string $relation + * @param \Closure $callback + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function whereHas($relation, Closure $callback, $operator = '>=', $count = 1) + { + return $this->has($relation, $operator, $count, 'and', $callback); + } + + /** + * Add a relationship count condition to the query with where clauses. + * + * @param string $relation + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function whereDoesntHave($relation, Closure $callback = null) + { + return $this->doesntHave($relation, 'and', $callback); + } + + /** + * Add a relationship count condition to the query with an "or". + * + * @param string $relation + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orHas($relation, $operator = '>=', $count = 1) + { + return $this->has($relation, $operator, $count, 'or'); + } + + /** + * Add a relationship count condition to the query with where clauses and an "or". + * + * @param string $relation + * @param \Closure $callback + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orWhereHas($relation, Closure $callback, $operator = '>=', $count = 1) + { + return $this->has($relation, $operator, $count, 'or', $callback); + } + + /** + * Add the "has" condition where clause to the query. + * + * @param \Illuminate\Database\Eloquent\Builder $hasQuery + * @param \Illuminate\Database\Eloquent\Relations\Relation $relation + * @param string $operator + * @param int $count + * @param string $boolean + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function addHasWhere(Builder $hasQuery, Relation $relation, $operator, $count, $boolean) + { + $this->mergeWheresToHas($hasQuery, $relation); + + if (is_numeric($count)) { + $count = new Expression($count); + } + + return $this->where(new Expression('('.$hasQuery->toSql().')'), $operator, $count, $boolean); + } + + /** + * Merge the "wheres" from a relation query to a has query. + * + * @param \Illuminate\Database\Eloquent\Builder $hasQuery + * @param \Illuminate\Database\Eloquent\Relations\Relation $relation + * @return void + */ + protected function mergeWheresToHas(Builder $hasQuery, Relation $relation) + { + // Here we have the "has" query and the original relation. We need to copy over any + // where clauses the developer may have put in the relationship function over to + // the has query, and then copy the bindings from the "has" query to the main. + $relationQuery = $relation->getBaseQuery(); + + $hasQuery = $hasQuery->getModel()->removeGlobalScopes($hasQuery); + + $whereBindings = array_get($relationQuery->getRawBindings(), 'where', []); + + $hasQuery->mergeWheres($relationQuery->wheres, $whereBindings); + + $this->query->addBinding($hasQuery->getQuery()->getBindings(), 'where'); + } + + /** + * Get the "has relation" base query instance. + * + * @param string $relation + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + protected function getHasRelationQuery($relation) + { + return Relation::noConstraints(function () use ($relation) { + return $this->getModel()->$relation(); + }); + } + + /** + * Set the relationships that should be eager loaded. + * + * @param mixed $relations + * @return $this + */ + public function with($relations) + { + if (is_string($relations)) { + $relations = func_get_args(); + } + + $eagers = $this->parseRelations($relations); + + $this->eagerLoad = array_merge($this->eagerLoad, $eagers); + + return $this; + } + + /** + * Parse a list of relations into individuals. + * + * @param array $relations + * @return array + */ + protected function parseRelations(array $relations) + { + $results = []; + + foreach ($relations as $name => $constraints) { + // If the "relation" value is actually a numeric key, we can assume that no + // constraints have been specified for the eager load and we'll just put + // an empty Closure with the loader so that we can treat all the same. + if (is_numeric($name)) { + $f = function () { + // + }; + + list($name, $constraints) = [$constraints, $f]; + } + + // We need to separate out any nested includes. Which allows the developers + // to load deep relationships using "dots" without stating each level of + // the relationship with its own key in the array of eager load names. + $results = $this->parseNested($name, $results); + + $results[$name] = $constraints; + } + + return $results; + } + + /** + * Parse the nested relationships in a relation. + * + * @param string $name + * @param array $results + * @return array + */ + protected function parseNested($name, $results) + { + $progress = []; + + // If the relation has already been set on the result array, we will not set it + // again, since that would override any constraints that were already placed + // on the relationships. We will only set the ones that are not specified. + foreach (explode('.', $name) as $segment) { + $progress[] = $segment; + + if (! isset($results[$last = implode('.', $progress)])) { + $results[$last] = function () { + // + }; + } + } + + return $results; + } + + /** + * Call the given model scope on the underlying model. + * + * @param string $scope + * @param array $parameters + * @return \Illuminate\Database\Query\Builder + */ + protected function callScope($scope, $parameters) + { + array_unshift($parameters, $this); + + return call_user_func_array([$this->model, $scope], $parameters) ?: $this; + } + + /** + * Get the underlying query builder instance. + * + * @return \Illuminate\Database\Query\Builder|static + */ + public function getQuery() + { + return $this->query; + } + + /** + * Set the underlying query builder instance. + * + * @param \Illuminate\Database\Query\Builder $query + * @return $this + */ + public function setQuery($query) + { + $this->query = $query; + + return $this; + } + + /** + * Get the relationships being eagerly loaded. + * + * @return array + */ + public function getEagerLoads() + { + return $this->eagerLoad; + } + + /** + * Set the relationships being eagerly loaded. + * + * @param array $eagerLoad + * @return $this + */ + public function setEagerLoads(array $eagerLoad) + { + $this->eagerLoad = $eagerLoad; + + return $this; + } + + /** + * Get the model instance being queried. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function getModel() + { + return $this->model; + } + + /** + * Set a model instance for the model being queried. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return $this + */ + public function setModel(Model $model) + { + $this->model = $model; + + $this->query->from($model->getTable()); + + return $this; + } + + /** + * Extend the builder with a given callback. + * + * @param string $name + * @param \Closure $callback + * @return void + */ + public function macro($name, Closure $callback) + { + $this->macros[$name] = $callback; + } + + /** + * Get the given macro by name. + * + * @param string $name + * @return \Closure + */ + public function getMacro($name) + { + return Arr::get($this->macros, $name); + } + + /** + * Dynamically handle calls into the query instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (isset($this->macros[$method])) { + array_unshift($parameters, $this); + + return call_user_func_array($this->macros[$method], $parameters); + } elseif (method_exists($this->model, $scope = 'scope'.ucfirst($method))) { + return $this->callScope($scope, $parameters); + } + + $result = call_user_func_array([$this->query, $method], $parameters); + + return in_array($method, $this->passthru) ? $result : $this; + } + + /** + * Force a clone of the underlying query builder when cloning. + * + * @return void + */ + public function __clone() + { + $this->query = clone $this->query; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php index 0809dde..19a449e 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php @@ -1,263 +1,254 @@ -getKey(); - } - - return array_first($this->items, function($itemKey, $model) use ($key) - { - return $model->getKey() == $key; - - }, $default); - } - - /** - * Load a set of relationships onto the collection. - * - * @param mixed $relations - * @return $this - */ - public function load($relations) - { - if (count($this->items) > 0) - { - if (is_string($relations)) $relations = func_get_args(); - - $query = $this->first()->newQuery()->with($relations); - - $this->items = $query->eagerLoadRelations($this->items); - } - - return $this; - } - - /** - * Add an item to the collection. - * - * @param mixed $item - * @return $this - */ - public function add($item) - { - $this->items[] = $item; - - return $this; - } - - /** - * Determine if a key exists in the collection. - * - * @param mixed $key - * @param mixed $value - * @return bool - */ - public function contains($key, $value = null) - { - if (func_num_args() == 2) return parent::contains($key, $value); - - if ($this->useAsCallable($key)) return parent::contains($key); - - $key = $key instanceof Model ? $key->getKey() : $key; - - return parent::contains(function($k, $m) use ($key) - { - return $m->getKey() == $key; - }); - } - - /** - * Fetch a nested element of the collection. - * - * @param string $key - * @return static - */ - public function fetch($key) - { - return new static(array_fetch($this->toArray(), $key)); - } - - /** - * Get the max value of a given key. - * - * @param string $key - * @return mixed - */ - public function max($key) - { - return $this->reduce(function($result, $item) use ($key) - { - return is_null($result) || $item->{$key} > $result ? $item->{$key} : $result; - }); - } - - /** - * Get the min value of a given key. - * - * @param string $key - * @return mixed - */ - public function min($key) - { - return $this->reduce(function($result, $item) use ($key) - { - return is_null($result) || $item->{$key} < $result ? $item->{$key} : $result; - }); - } - - /** - * Get the array of primary keys. - * - * @return array - */ - public function modelKeys() - { - return array_map(function($m) { return $m->getKey(); }, $this->items); - } - - /** - * Merge the collection with the given items. - * - * @param \ArrayAccess|array $items - * @return static - */ - public function merge($items) - { - $dictionary = $this->getDictionary(); - - foreach ($items as $item) - { - $dictionary[$item->getKey()] = $item; - } - - return new static(array_values($dictionary)); - } - - /** - * Diff the collection with the given items. - * - * @param \ArrayAccess|array $items - * @return static - */ - public function diff($items) - { - $diff = new static; - - $dictionary = $this->getDictionary($items); - - foreach ($this->items as $item) - { - if ( ! isset($dictionary[$item->getKey()])) - { - $diff->add($item); - } - } - - return $diff; - } - - /** - * Intersect the collection with the given items. - * - * @param \ArrayAccess|array $items - * @return static - */ - public function intersect($items) - { - $intersect = new static; - - $dictionary = $this->getDictionary($items); - - foreach ($this->items as $item) - { - if (isset($dictionary[$item->getKey()])) - { - $intersect->add($item); - } - } - - return $intersect; - } - - /** - * Return only unique items from the collection. - * - * @return static - */ - public function unique() - { - $dictionary = $this->getDictionary(); - - return new static(array_values($dictionary)); - } - - /** - * Returns only the models from the collection with the specified keys. - * - * @param mixed $keys - * @return static - */ - public function only($keys) - { - $dictionary = array_only($this->getDictionary(), $keys); - - return new static(array_values($dictionary)); - } - - /** - * Returns all models in the collection except the models with specified keys. - * - * @param mixed $keys - * @return static - */ - public function except($keys) - { - $dictionary = array_except($this->getDictionary(), $keys); - - return new static(array_values($dictionary)); - } - - /** - * Get a dictionary keyed by primary keys. - * - * @param \ArrayAccess|array $items - * @return array - */ - public function getDictionary($items = null) - { - $items = is_null($items) ? $this->items : $items; - - $dictionary = array(); - - foreach ($items as $value) - { - $dictionary[$value->getKey()] = $value; - } - - return $dictionary; - } - - /** - * Get a base Support collection instance from this collection. - * - * @return \Illuminate\Support\Collection - */ - public function toBase() - { - return new BaseCollection($this->items); - } +use Illuminate\Support\Arr; +use Illuminate\Support\Collection as BaseCollection; +class Collection extends BaseCollection +{ + /** + * Find a model in the collection by key. + * + * @param mixed $key + * @param mixed $default + * @return \Illuminate\Database\Eloquent\Model + */ + public function find($key, $default = null) + { + if ($key instanceof Model) { + $key = $key->getKey(); + } + + return Arr::first($this->items, function ($itemKey, $model) use ($key) { + return $model->getKey() == $key; + }, $default); + } + + /** + * Load a set of relationships onto the collection. + * + * @param mixed $relations + * @return $this + */ + public function load($relations) + { + if (count($this->items) > 0) { + if (is_string($relations)) { + $relations = func_get_args(); + } + + $query = $this->first()->newQuery()->with($relations); + + $this->items = $query->eagerLoadRelations($this->items); + } + + return $this; + } + + /** + * Add an item to the collection. + * + * @param mixed $item + * @return $this + */ + public function add($item) + { + $this->items[] = $item; + + return $this; + } + + /** + * Determine if a key exists in the collection. + * + * @param mixed $key + * @param mixed $value + * @return bool + */ + public function contains($key, $value = null) + { + if (func_num_args() == 2) { + return parent::contains($key, $value); + } + + if ($this->useAsCallable($key)) { + return parent::contains($key); + } + + $key = $key instanceof Model ? $key->getKey() : $key; + + return parent::contains(function ($k, $m) use ($key) { + return $m->getKey() == $key; + }); + } + + /** + * Fetch a nested element of the collection. + * + * @param string $key + * @return static + * + * @deprecated since version 5.1. Use pluck instead. + */ + public function fetch($key) + { + return new static(Arr::fetch($this->toArray(), $key)); + } + + /** + * Get the array of primary keys. + * + * @return array + */ + public function modelKeys() + { + return array_map(function ($m) { + return $m->getKey(); + }, $this->items); + } + + /** + * Merge the collection with the given items. + * + * @param \ArrayAccess|array $items + * @return static + */ + public function merge($items) + { + $dictionary = $this->getDictionary(); + + foreach ($items as $item) { + $dictionary[$item->getKey()] = $item; + } + + return new static(array_values($dictionary)); + } + + /** + * Diff the collection with the given items. + * + * @param \ArrayAccess|array $items + * @return static + */ + public function diff($items) + { + $diff = new static; + + $dictionary = $this->getDictionary($items); + + foreach ($this->items as $item) { + if (! isset($dictionary[$item->getKey()])) { + $diff->add($item); + } + } + + return $diff; + } + + /** + * Intersect the collection with the given items. + * + * @param \ArrayAccess|array $items + * @return static + */ + public function intersect($items) + { + $intersect = new static; + + $dictionary = $this->getDictionary($items); + + foreach ($this->items as $item) { + if (isset($dictionary[$item->getKey()])) { + $intersect->add($item); + } + } + + return $intersect; + } + + /** + * Return only unique items from the collection. + * + * @param string|callable|null $key + * @return static + */ + public function unique($key = null) + { + if (! is_null($key)) { + return parent::unique($key); + } + + return new static(array_values($this->getDictionary())); + } + + /** + * Returns only the models from the collection with the specified keys. + * + * @param mixed $keys + * @return static + */ + public function only($keys) + { + $dictionary = Arr::only($this->getDictionary(), $keys); + + return new static(array_values($dictionary)); + } + + /** + * Returns all models in the collection except the models with specified keys. + * + * @param mixed $keys + * @return static + */ + public function except($keys) + { + $dictionary = Arr::except($this->getDictionary(), $keys); + + return new static(array_values($dictionary)); + } + + /** + * Make the given, typically hidden, attributes visible across the entire collection. + * + * @param array|string $attributes + * @return $this + */ + public function withHidden($attributes) + { + $this->each(function ($model) use ($attributes) { + $model->withHidden($attributes); + }); + + return $this; + } + + /** + * Get a dictionary keyed by primary keys. + * + * @param \ArrayAccess|array $items + * @return array + */ + public function getDictionary($items = null) + { + $items = is_null($items) ? $this->items : $items; + + $dictionary = []; + + foreach ($items as $value) { + $dictionary[$value->getKey()] = $value; + } + + return $dictionary; + } + + /** + * Get a base Support collection instance from this collection. + * + * @return \Illuminate\Support\Collection + */ + public function toBase() + { + return new BaseCollection($this->items); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php new file mode 100644 index 0000000..099f4b4 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php @@ -0,0 +1,229 @@ +faker = $faker; + } + + /** + * The model definitions in the container. + * + * @var array + */ + protected $definitions = []; + + /** + * Create a new factory container. + * + * @param \Faker\Generator $faker + * @param string|null $pathToFactories + * @return static + */ + public static function construct(Faker $faker, $pathToFactories = null) + { + $pathToFactories = $pathToFactories ?: database_path('factories'); + + return (new static($faker))->load($pathToFactories); + } + + /** + * Define a class with a given short-name. + * + * @param string $class + * @param string $name + * @param callable $attributes + * @return void + */ + public function defineAs($class, $name, callable $attributes) + { + return $this->define($class, $attributes, $name); + } + + /** + * Define a class with a given set of attributes. + * + * @param string $class + * @param callable $attributes + * @param string $name + * @return void + */ + public function define($class, callable $attributes, $name = 'default') + { + $this->definitions[$class][$name] = $attributes; + } + + /** + * Create an instance of the given model and persist it to the database. + * + * @param string $class + * @param array $attributes + * @return mixed + */ + public function create($class, array $attributes = []) + { + return $this->of($class)->create($attributes); + } + + /** + * Create an instance of the given model and type and persist it to the database. + * + * @param string $class + * @param string $name + * @param array $attributes + * @return mixed + */ + public function createAs($class, $name, array $attributes = []) + { + return $this->of($class, $name)->create($attributes); + } + + /** + * Load factories from path. + * + * @param string $path + * @return $this + */ + public function load($path) + { + $factory = $this; + + if (is_dir($path)) { + foreach (Finder::create()->files()->in($path) as $file) { + require $file->getRealPath(); + } + } + + return $factory; + } + + /** + * Create an instance of the given model. + * + * @param string $class + * @param array $attributes + * @return mixed + */ + public function make($class, array $attributes = []) + { + return $this->of($class)->make($attributes); + } + + /** + * Create an instance of the given model and type. + * + * @param string $class + * @param string $name + * @param array $attributes + * @return mixed + */ + public function makeAs($class, $name, array $attributes = []) + { + return $this->of($class, $name)->make($attributes); + } + + /** + * Get the raw attribute array for a given named model. + * + * @param string $class + * @param string $name + * @param array $attributes + * @return array + */ + public function rawOf($class, $name, array $attributes = []) + { + return $this->raw($class, $attributes, $name); + } + + /** + * Get the raw attribute array for a given model. + * + * @param string $class + * @param array $attributes + * @param string $name + * @return array + */ + public function raw($class, array $attributes = [], $name = 'default') + { + $raw = call_user_func($this->definitions[$class][$name], $this->faker); + + return array_merge($raw, $attributes); + } + + /** + * Create a builder for the given model. + * + * @param string $class + * @param string $name + * @return \Illuminate\Database\Eloquent\FactoryBuilder + */ + public function of($class, $name = 'default') + { + return new FactoryBuilder($class, $name, $this->definitions, $this->faker); + } + + /** + * Determine if the given offset exists. + * + * @param string $offset + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->definitions[$offset]); + } + + /** + * Get the value of the given offset. + * + * @param string $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->make($offset); + } + + /** + * Set the given offset to the given value. + * + * @param string $offset + * @param callable $value + * @return void + */ + public function offsetSet($offset, $value) + { + return $this->define($offset, $value); + } + + /** + * Unset the value at the given offset. + * + * @param string $offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->definitions[$offset]); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php new file mode 100644 index 0000000..89d274e --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php @@ -0,0 +1,135 @@ +name = $name; + $this->class = $class; + $this->faker = $faker; + $this->definitions = $definitions; + } + + /** + * Set the amount of models you wish to create / make. + * + * @param int $amount + * @return $this + */ + public function times($amount) + { + $this->amount = $amount; + + return $this; + } + + /** + * Create a collection of models and persist them to the database. + * + * @param array $attributes + * @return mixed + */ + public function create(array $attributes = []) + { + $results = $this->make($attributes); + + if ($this->amount === 1) { + $results->save(); + } else { + foreach ($results as $result) { + $result->save(); + } + } + + return $results; + } + + /** + * Create a collection of models. + * + * @param array $attributes + * @return mixed + */ + public function make(array $attributes = []) + { + if ($this->amount === 1) { + return $this->makeInstance($attributes); + } else { + $results = []; + + for ($i = 0; $i < $this->amount; $i++) { + $results[] = $this->makeInstance($attributes); + } + + return new Collection($results); + } + } + + /** + * Make an instance of the model with the given attributes. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + protected function makeInstance(array $attributes = []) + { + return Model::unguarded(function () use ($attributes) { + if (! isset($this->definitions[$this->class][$this->name])) { + throw new InvalidArgumentException("Unable to locate factory with name [{$this->name}] [{$this->class}]."); + } + + $definition = call_user_func($this->definitions[$this->class][$this->name], $this->faker, $attributes); + + return new $this->class(array_merge($definition, $attributes)); + }); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/MassAssignmentException.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/MassAssignmentException.php index 8874c7c..7c81aae 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/MassAssignmentException.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/MassAssignmentException.php @@ -1,5 +1,10 @@ -bootIfNotBooted(); - - $this->syncOriginal(); - - $this->fill($attributes); - } - - /** - * Check if the model needs to be booted and if so, do it. - * - * @return void - */ - protected function bootIfNotBooted() - { - $class = get_class($this); - - if ( ! isset(static::$booted[$class])) - { - static::$booted[$class] = true; - - $this->fireModelEvent('booting', false); - - static::boot(); - - $this->fireModelEvent('booted', false); - } - } - - /** - * The "booting" method of the model. - * - * @return void - */ - protected static function boot() - { - static::bootTraits(); - } - - /** - * Boot all of the bootable traits on the model. - * - * @return void - */ - protected static function bootTraits() - { - foreach (class_uses_recursive(get_called_class()) as $trait) - { - if (method_exists(get_called_class(), $method = 'boot'.class_basename($trait))) - { - forward_static_call([get_called_class(), $method]); - } - } - } - - /** - * Register a new global scope on the model. - * - * @param \Illuminate\Database\Eloquent\ScopeInterface $scope - * @return void - */ - public static function addGlobalScope(ScopeInterface $scope) - { - static::$globalScopes[get_called_class()][get_class($scope)] = $scope; - } - - /** - * Determine if a model has a global scope. - * - * @param \Illuminate\Database\Eloquent\ScopeInterface $scope - * @return bool - */ - public static function hasGlobalScope($scope) - { - return ! is_null(static::getGlobalScope($scope)); - } - - /** - * Get a global scope registered with the model. - * - * @param \Illuminate\Database\Eloquent\ScopeInterface $scope - * @return \Illuminate\Database\Eloquent\ScopeInterface|null - */ - public static function getGlobalScope($scope) - { - return array_first(static::$globalScopes[get_called_class()], function($key, $value) use ($scope) - { - return $scope instanceof $value; - }); - } - - /** - * Get the global scopes for this class instance. - * - * @return \Illuminate\Database\Eloquent\ScopeInterface[] - */ - public function getGlobalScopes() - { - return array_get(static::$globalScopes, get_class($this), []); - } - - /** - * Register an observer with the Model. - * - * @param object|string $class - * @return void - */ - public static function observe($class) - { - $instance = new static; - - $className = is_string($class) ? $class : get_class($class); - - // When registering a model observer, we will spin through the possible events - // and determine if this observer has that method. If it does, we will hook - // it into the model's event system, making it convenient to watch these. - foreach ($instance->getObservableEvents() as $event) - { - if (method_exists($class, $event)) - { - static::registerModelEvent($event, $className.'@'.$event); - } - } - } - - /** - * Fill the model with an array of attributes. - * - * @param array $attributes - * @return $this - * - * @throws \Illuminate\Database\Eloquent\MassAssignmentException - */ - public function fill(array $attributes) - { - $totallyGuarded = $this->totallyGuarded(); - - foreach ($this->fillableFromArray($attributes) as $key => $value) - { - $key = $this->removeTableFromKey($key); - - // The developers may choose to place some attributes in the "fillable" - // array, which means only those attributes may be set through mass - // assignment to the model, and all others will just be ignored. - if ($this->isFillable($key)) - { - $this->setAttribute($key, $value); - } - elseif ($totallyGuarded) - { - throw new MassAssignmentException($key); - } - } - - return $this; - } - - /** - * Fill the model with an array of attributes. Force mass assignment. - * - * @param array $attributes - * @return $this - */ - public function forceFill(array $attributes) - { - // Since some versions of PHP have a bug that prevents it from properly - // binding the late static context in a closure, we will first store - // the model in a variable, which we will then use in the closure. - $model = $this; - - return static::unguarded(function() use ($model, $attributes) - { - return $model->fill($attributes); - }); - } - - /** - * Get the fillable attributes of a given array. - * - * @param array $attributes - * @return array - */ - protected function fillableFromArray(array $attributes) - { - if (count($this->fillable) > 0 && ! static::$unguarded) - { - return array_intersect_key($attributes, array_flip($this->fillable)); - } - - return $attributes; - } - - /** - * Create a new instance of the given model. - * - * @param array $attributes - * @param bool $exists - * @return static - */ - public function newInstance($attributes = array(), $exists = false) - { - // This method just provides a convenient way for us to generate fresh model - // instances of this current model. It is particularly useful during the - // hydration of new objects via the Eloquent query builder instances. - $model = new static((array) $attributes); - - $model->exists = $exists; - - return $model; - } - - /** - * Create a new model instance that is existing. - * - * @param array $attributes - * @param string|null $connection - * @return static - */ - public function newFromBuilder($attributes = array(), $connection = null) - { - $model = $this->newInstance(array(), true); - - $model->setRawAttributes((array) $attributes, true); - - $model->setConnection($connection ?: $this->connection); - - return $model; - } - - /** - * Create a collection of models from plain arrays. - * - * @param array $items - * @param string|null $connection - * @return \Illuminate\Database\Eloquent\Collection - */ - public static function hydrate(array $items, $connection = null) - { - $instance = (new static)->setConnection($connection); - - $items = array_map(function ($item) use ($instance) - { - return $instance->newFromBuilder($item); - }, $items); - - return $instance->newCollection($items); - } - - /** - * Create a collection of models from a raw query. - * - * @param string $query - * @param array $bindings - * @param string|null $connection - * @return \Illuminate\Database\Eloquent\Collection - */ - public static function hydrateRaw($query, $bindings = array(), $connection = null) - { - $instance = (new static)->setConnection($connection); - - $items = $instance->getConnection()->select($query, $bindings); - - return static::hydrate($items, $connection); - } - - /** - * Save a new model and return the instance. - * - * @param array $attributes - * @return static - */ - public static function create(array $attributes) - { - $model = new static($attributes); - - $model->save(); - - return $model; - } - - /** - * Save a new model and return the instance. Allow mass-assignment. - * - * @param array $attributes - * @return static - */ - public static function forceCreate(array $attributes) - { - // Since some versions of PHP have a bug that prevents it from properly - // binding the late static context in a closure, we will first store - // the model in a variable, which we will then use in the closure. - $model = new static; - - return static::unguarded(function() use ($model, $attributes) - { - return $model->create($attributes); - }); - } - - /** - * Get the first record matching the attributes or create it. - * - * @param array $attributes - * @return static - */ - public static function firstOrCreate(array $attributes) - { - if ( ! is_null($instance = static::where($attributes)->first())) - { - return $instance; - } - - return static::create($attributes); - } - - /** - * Get the first record matching the attributes or instantiate it. - * - * @param array $attributes - * @return static - */ - public static function firstOrNew(array $attributes) - { - if ( ! is_null($instance = static::where($attributes)->first())) - { - return $instance; - } - - return new static($attributes); - } - - /** - * Create or update a record matching the attributes, and fill it with values. - * - * @param array $attributes - * @param array $values - * @return static - */ - public static function updateOrCreate(array $attributes, array $values = array()) - { - $instance = static::firstOrNew($attributes); - - $instance->fill($values)->save(); - - return $instance; - } - - /** - * Get the first model for the given attributes. - * - * @param array $attributes - * @return static|null - */ - protected static function firstByAttributes($attributes) - { - return static::where($attributes)->first(); - } - - /** - * Begin querying the model. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - public static function query() - { - return (new static)->newQuery(); - } - - /** - * Begin querying the model on a given connection. - * - * @param string|null $connection - * @return \Illuminate\Database\Eloquent\Builder - */ - public static function on($connection = null) - { - // First we will just create a fresh instance of this model, and then we can - // set the connection on the model so that it is be used for the queries - // we execute, as well as being set on each relationship we retrieve. - $instance = new static; - - $instance->setConnection($connection); - - return $instance->newQuery(); - } - - /** - * Begin querying the model on the write connection. - * - * @return \Illuminate\Database\Query\Builder - */ - public static function onWriteConnection() - { - $instance = new static; - - return $instance->newQuery()->useWritePdo(); - } - - /** - * Get all of the models from the database. - * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Collection|static[] - */ - public static function all($columns = array('*')) - { - $instance = new static; - - return $instance->newQuery()->get($columns); - } - - /** - * Find a model by its primary key. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Support\Collection|static|null - */ - public static function find($id, $columns = array('*')) - { - return static::query()->find($id, $columns); - } - - /** - * Find a model by its primary key or return new static. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Support\Collection|static - */ - public static function findOrNew($id, $columns = array('*')) - { - if ( ! is_null($model = static::find($id, $columns))) return $model; - - return new static; - } - - /** - * Reload a fresh model instance from the database. - * - * @param array $with - * @return $this - */ - public function fresh(array $with = array()) - { - if ( ! $this->exists) return; - - $key = $this->getKeyName(); - - return static::with($with)->where($key, $this->getKey())->first(); - } - - /** - * Eager load relations on the model. - * - * @param array|string $relations - * @return $this - */ - public function load($relations) - { - if (is_string($relations)) $relations = func_get_args(); - - $query = $this->newQuery()->with($relations); - - $query->eagerLoadRelations(array($this)); - - return $this; - } - - /** - * Being querying a model with eager loading. - * - * @param array|string $relations - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public static function with($relations) - { - if (is_string($relations)) $relations = func_get_args(); - - $instance = new static; - - return $instance->newQuery()->with($relations); - } - - /** - * Define a one-to-one relationship. - * - * @param string $related - * @param string $foreignKey - * @param string $localKey - * @return \Illuminate\Database\Eloquent\Relations\HasOne - */ - public function hasOne($related, $foreignKey = null, $localKey = null) - { - $foreignKey = $foreignKey ?: $this->getForeignKey(); - - $instance = new $related; - - $localKey = $localKey ?: $this->getKeyName(); - - return new HasOne($instance->newQuery(), $this, $instance->getTable().'.'.$foreignKey, $localKey); - } - - /** - * Define a polymorphic one-to-one relationship. - * - * @param string $related - * @param string $name - * @param string $type - * @param string $id - * @param string $localKey - * @return \Illuminate\Database\Eloquent\Relations\MorphOne - */ - public function morphOne($related, $name, $type = null, $id = null, $localKey = null) - { - $instance = new $related; - - list($type, $id) = $this->getMorphs($name, $type, $id); - - $table = $instance->getTable(); - - $localKey = $localKey ?: $this->getKeyName(); - - return new MorphOne($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey); - } - - /** - * Define an inverse one-to-one or many relationship. - * - * @param string $related - * @param string $foreignKey - * @param string $otherKey - * @param string $relation - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function belongsTo($related, $foreignKey = null, $otherKey = null, $relation = null) - { - // If no relation name was given, we will use this debug backtrace to extract - // the calling method's name and use that as the relationship name as most - // of the time this will be what we desire to use for the relationships. - if (is_null($relation)) - { - list(, $caller) = debug_backtrace(false, 2); - - $relation = $caller['function']; - } - - // If no foreign key was supplied, we can use a backtrace to guess the proper - // foreign key name by using the name of the relationship function, which - // when combined with an "_id" should conventionally match the columns. - if (is_null($foreignKey)) - { - $foreignKey = snake_case($relation).'_id'; - } - - $instance = new $related; - - // Once we have the foreign key names, we'll just create a new Eloquent query - // for the related models and returns the relationship instance which will - // actually be responsible for retrieving and hydrating every relations. - $query = $instance->newQuery(); - - $otherKey = $otherKey ?: $instance->getKeyName(); - - return new BelongsTo($query, $this, $foreignKey, $otherKey, $relation); - } - - /** - * Define a polymorphic, inverse one-to-one or many relationship. - * - * @param string $name - * @param string $type - * @param string $id - * @return \Illuminate\Database\Eloquent\Relations\MorphTo - */ - public function morphTo($name = null, $type = null, $id = null) - { - // If no name is provided, we will use the backtrace to get the function name - // since that is most likely the name of the polymorphic interface. We can - // use that to get both the class and foreign key that will be utilized. - if (is_null($name)) - { - list(, $caller) = debug_backtrace(false, 2); - - $name = snake_case($caller['function']); - } - - list($type, $id) = $this->getMorphs($name, $type, $id); - - // If the type value is null it is probably safe to assume we're eager loading - // the relationship. When that is the case we will pass in a dummy query as - // there are multiple types in the morph and we can't use single queries. - if (is_null($class = $this->$type)) - { - return new MorphTo( - $this->newQuery(), $this, $id, null, $type, $name - ); - } - - // If we are not eager loading the relationship we will essentially treat this - // as a belongs-to style relationship since morph-to extends that class and - // we will pass in the appropriate values so that it behaves as expected. - else - { - $instance = new $class; - - return new MorphTo( - $instance->newQuery(), $this, $id, $instance->getKeyName(), $type, $name - ); - } - } - - /** - * Define a one-to-many relationship. - * - * @param string $related - * @param string $foreignKey - * @param string $localKey - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function hasMany($related, $foreignKey = null, $localKey = null) - { - $foreignKey = $foreignKey ?: $this->getForeignKey(); - - $instance = new $related; - - $localKey = $localKey ?: $this->getKeyName(); - - return new HasMany($instance->newQuery(), $this, $instance->getTable().'.'.$foreignKey, $localKey); - } - - /** - * Define a has-many-through relationship. - * - * @param string $related - * @param string $through - * @param string|null $firstKey - * @param string|null $secondKey - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough - */ - public function hasManyThrough($related, $through, $firstKey = null, $secondKey = null) - { - $through = new $through; - - $firstKey = $firstKey ?: $this->getForeignKey(); - - $secondKey = $secondKey ?: $through->getForeignKey(); - - return new HasManyThrough((new $related)->newQuery(), $this, $through, $firstKey, $secondKey); - } - - /** - * Define a polymorphic one-to-many relationship. - * - * @param string $related - * @param string $name - * @param string $type - * @param string $id - * @param string $localKey - * @return \Illuminate\Database\Eloquent\Relations\MorphMany - */ - public function morphMany($related, $name, $type = null, $id = null, $localKey = null) - { - $instance = new $related; - - // Here we will gather up the morph type and ID for the relationship so that we - // can properly query the intermediate table of a relation. Finally, we will - // get the table and create the relationship instances for the developers. - list($type, $id) = $this->getMorphs($name, $type, $id); - - $table = $instance->getTable(); - - $localKey = $localKey ?: $this->getKeyName(); - - return new MorphMany($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey); - } - - /** - * Define a many-to-many relationship. - * - * @param string $related - * @param string $table - * @param string $foreignKey - * @param string $otherKey - * @param string $relation - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany - */ - public function belongsToMany($related, $table = null, $foreignKey = null, $otherKey = null, $relation = null) - { - // If no relationship name was passed, we will pull backtraces to get the - // name of the calling function. We will use that function name as the - // title of this relation since that is a great convention to apply. - if (is_null($relation)) - { - $relation = $this->getBelongsToManyCaller(); - } - - // First, we'll need to determine the foreign key and "other key" for the - // relationship. Once we have determined the keys we'll make the query - // instances as well as the relationship instances we need for this. - $foreignKey = $foreignKey ?: $this->getForeignKey(); - - $instance = new $related; - - $otherKey = $otherKey ?: $instance->getForeignKey(); - - // If no table name was provided, we can guess it by concatenating the two - // models using underscores in alphabetical order. The two model names - // are transformed to snake case from their default CamelCase also. - if (is_null($table)) - { - $table = $this->joiningTable($related); - } - - // Now we're ready to create a new query builder for the related model and - // the relationship instances for the relation. The relations will set - // appropriate query constraint and entirely manages the hydrations. - $query = $instance->newQuery(); - - return new BelongsToMany($query, $this, $table, $foreignKey, $otherKey, $relation); - } - - /** - * Define a polymorphic many-to-many relationship. - * - * @param string $related - * @param string $name - * @param string $table - * @param string $foreignKey - * @param string $otherKey - * @param bool $inverse - * @return \Illuminate\Database\Eloquent\Relations\MorphToMany - */ - public function morphToMany($related, $name, $table = null, $foreignKey = null, $otherKey = null, $inverse = false) - { - $caller = $this->getBelongsToManyCaller(); - - // First, we will need to determine the foreign key and "other key" for the - // relationship. Once we have determined the keys we will make the query - // instances, as well as the relationship instances we need for these. - $foreignKey = $foreignKey ?: $name.'_id'; - - $instance = new $related; - - $otherKey = $otherKey ?: $instance->getForeignKey(); - - // Now we're ready to create a new query builder for this related model and - // the relationship instances for this relation. This relations will set - // appropriate query constraints then entirely manages the hydrations. - $query = $instance->newQuery(); - - $table = $table ?: str_plural($name); - - return new MorphToMany( - $query, $this, $name, $table, $foreignKey, - $otherKey, $caller, $inverse - ); - } - - /** - * Define a polymorphic, inverse many-to-many relationship. - * - * @param string $related - * @param string $name - * @param string $table - * @param string $foreignKey - * @param string $otherKey - * @return \Illuminate\Database\Eloquent\Relations\MorphToMany - */ - public function morphedByMany($related, $name, $table = null, $foreignKey = null, $otherKey = null) - { - $foreignKey = $foreignKey ?: $this->getForeignKey(); - - // For the inverse of the polymorphic many-to-many relations, we will change - // the way we determine the foreign and other keys, as it is the opposite - // of the morph-to-many method since we're figuring out these inverses. - $otherKey = $otherKey ?: $name.'_id'; - - return $this->morphToMany($related, $name, $table, $foreignKey, $otherKey, true); - } - - /** - * Get the relationship name of the belongs to many. - * - * @return string - */ - protected function getBelongsToManyCaller() - { - $self = __FUNCTION__; - - $caller = array_first(debug_backtrace(false), function($key, $trace) use ($self) - { - $caller = $trace['function']; - - return ! in_array($caller, Model::$manyMethods) && $caller != $self; - }); - - return ! is_null($caller) ? $caller['function'] : null; - } - - /** - * Get the joining table name for a many-to-many relation. - * - * @param string $related - * @return string - */ - public function joiningTable($related) - { - // The joining table name, by convention, is simply the snake cased models - // sorted alphabetically and concatenated with an underscore, so we can - // just sort the models and join them together to get the table name. - $base = snake_case(class_basename($this)); - - $related = snake_case(class_basename($related)); - - $models = array($related, $base); - - // Now that we have the model names in an array we can just sort them and - // use the implode function to join them together with an underscores, - // which is typically used by convention within the database system. - sort($models); - - return strtolower(implode('_', $models)); - } - - /** - * Destroy the models for the given IDs. - * - * @param array|int $ids - * @return int - */ - public static function destroy($ids) - { - // We'll initialize a count here so we will return the total number of deletes - // for the operation. The developers can then check this number as a boolean - // type value or get this total count of records deleted for logging, etc. - $count = 0; - - $ids = is_array($ids) ? $ids : func_get_args(); - - $instance = new static; - - // We will actually pull the models from the database table and call delete on - // each of them individually so that their events get fired properly with a - // correct set of attributes in case the developers wants to check these. - $key = $instance->getKeyName(); - - foreach ($instance->whereIn($key, $ids)->get() as $model) - { - if ($model->delete()) $count++; - } - - return $count; - } - - /** - * Delete the model from the database. - * - * @return bool|null - * @throws \Exception - */ - public function delete() - { - if (is_null($this->primaryKey)) - { - throw new Exception("No primary key defined on model."); - } - - if ($this->exists) - { - if ($this->fireModelEvent('deleting') === false) return false; - - // Here, we'll touch the owning models, verifying these timestamps get updated - // for the models. This will allow any caching to get broken on the parents - // by the timestamp. Then we will go ahead and delete the model instance. - $this->touchOwners(); - - $this->performDeleteOnModel(); - - $this->exists = false; - - // Once the model has been deleted, we will fire off the deleted event so that - // the developers may hook into post-delete operations. We will then return - // a boolean true as the delete is presumably successful on the database. - $this->fireModelEvent('deleted', false); - - return true; - } - } - - /** - * Force a hard delete on a soft deleted model. - * - * This method protects developers from running forceDelete when trait is missing. - * - * @return void - */ - public function forceDelete() - { - return $this->delete(); - } - - /** - * Perform the actual delete query on this model instance. - * - * @return void - */ - protected function performDeleteOnModel() - { - $this->setKeysForSaveQuery($this->newQuery())->delete(); - } - - /** - * Register a saving model event with the dispatcher. - * - * @param \Closure|string $callback - * @param int $priority - * @return void - */ - public static function saving($callback, $priority = 0) - { - static::registerModelEvent('saving', $callback, $priority); - } - - /** - * Register a saved model event with the dispatcher. - * - * @param \Closure|string $callback - * @param int $priority - * @return void - */ - public static function saved($callback, $priority = 0) - { - static::registerModelEvent('saved', $callback, $priority); - } - - /** - * Register an updating model event with the dispatcher. - * - * @param \Closure|string $callback - * @param int $priority - * @return void - */ - public static function updating($callback, $priority = 0) - { - static::registerModelEvent('updating', $callback, $priority); - } - - /** - * Register an updated model event with the dispatcher. - * - * @param \Closure|string $callback - * @param int $priority - * @return void - */ - public static function updated($callback, $priority = 0) - { - static::registerModelEvent('updated', $callback, $priority); - } - - /** - * Register a creating model event with the dispatcher. - * - * @param \Closure|string $callback - * @param int $priority - * @return void - */ - public static function creating($callback, $priority = 0) - { - static::registerModelEvent('creating', $callback, $priority); - } - - /** - * Register a created model event with the dispatcher. - * - * @param \Closure|string $callback - * @param int $priority - * @return void - */ - public static function created($callback, $priority = 0) - { - static::registerModelEvent('created', $callback, $priority); - } - - /** - * Register a deleting model event with the dispatcher. - * - * @param \Closure|string $callback - * @param int $priority - * @return void - */ - public static function deleting($callback, $priority = 0) - { - static::registerModelEvent('deleting', $callback, $priority); - } - - /** - * Register a deleted model event with the dispatcher. - * - * @param \Closure|string $callback - * @param int $priority - * @return void - */ - public static function deleted($callback, $priority = 0) - { - static::registerModelEvent('deleted', $callback, $priority); - } - - /** - * Remove all of the event listeners for the model. - * - * @return void - */ - public static function flushEventListeners() - { - if ( ! isset(static::$dispatcher)) return; - - $instance = new static; - - foreach ($instance->getObservableEvents() as $event) - { - static::$dispatcher->forget("eloquent.{$event}: ".get_called_class()); - } - } - - /** - * Register a model event with the dispatcher. - * - * @param string $event - * @param \Closure|string $callback - * @param int $priority - * @return void - */ - protected static function registerModelEvent($event, $callback, $priority = 0) - { - if (isset(static::$dispatcher)) - { - $name = get_called_class(); - - static::$dispatcher->listen("eloquent.{$event}: {$name}", $callback, $priority); - } - } - - /** - * Get the observable event names. - * - * @return array - */ - public function getObservableEvents() - { - return array_merge( - array( - 'creating', 'created', 'updating', 'updated', - 'deleting', 'deleted', 'saving', 'saved', - 'restoring', 'restored', - ), - $this->observables - ); - } - - /** - * Set the observable event names. - * - * @param array $observables - * @return void - */ - public function setObservableEvents(array $observables) - { - $this->observables = $observables; - } - - /** - * Add an observable event name. - * - * @param mixed $observables - * @return void - */ - public function addObservableEvents($observables) - { - $observables = is_array($observables) ? $observables : func_get_args(); - - $this->observables = array_unique(array_merge($this->observables, $observables)); - } - - /** - * Remove an observable event name. - * - * @param mixed $observables - * @return void - */ - public function removeObservableEvents($observables) - { - $observables = is_array($observables) ? $observables : func_get_args(); - - $this->observables = array_diff($this->observables, $observables); - } - - /** - * Increment a column's value by a given amount. - * - * @param string $column - * @param int $amount - * @return int - */ - protected function increment($column, $amount = 1) - { - return $this->incrementOrDecrement($column, $amount, 'increment'); - } - - /** - * Decrement a column's value by a given amount. - * - * @param string $column - * @param int $amount - * @return int - */ - protected function decrement($column, $amount = 1) - { - return $this->incrementOrDecrement($column, $amount, 'decrement'); - } - - /** - * Run the increment or decrement method on the model. - * - * @param string $column - * @param int $amount - * @param string $method - * @return int - */ - protected function incrementOrDecrement($column, $amount, $method) - { - $query = $this->newQuery(); - - if ( ! $this->exists) - { - return $query->{$method}($column, $amount); - } - - $this->incrementOrDecrementAttributeValue($column, $amount, $method); - - return $query->where($this->getKeyName(), $this->getKey())->{$method}($column, $amount); - } - - /** - * Increment the underlying attribute value and sync with original. - * - * @param string $column - * @param int $amount - * @param string $method - * @return void - */ - protected function incrementOrDecrementAttributeValue($column, $amount, $method) - { - $this->{$column} = $this->{$column} + ($method == 'increment' ? $amount : $amount * -1); - - $this->syncOriginalAttribute($column); - } - - /** - * Update the model in the database. - * - * @param array $attributes - * @return bool|int - */ - public function update(array $attributes = array()) - { - if ( ! $this->exists) - { - return $this->newQuery()->update($attributes); - } - - return $this->fill($attributes)->save(); - } - - /** - * Save the model and all of its relationships. - * - * @return bool - */ - public function push() - { - if ( ! $this->save()) return false; - - // To sync all of the relationships to the database, we will simply spin through - // the relationships and save each model via this "push" method, which allows - // us to recurse into all of these nested relations for the model instance. - foreach ($this->relations as $models) - { - $models = $models instanceof Collection - ? $models->all() : array($models); - - foreach (array_filter($models) as $model) - { - if ( ! $model->push()) return false; - } - } - - return true; - } - - /** - * Save the model to the database. - * - * @param array $options - * @return bool - */ - public function save(array $options = array()) - { - $query = $this->newQueryWithoutScopes(); - - // If the "saving" event returns false we'll bail out of the save and return - // false, indicating that the save failed. This provides a chance for any - // listeners to cancel save operations if validations fail or whatever. - if ($this->fireModelEvent('saving') === false) - { - return false; - } - - // If the model already exists in the database we can just update our record - // that is already in this database using the current IDs in this "where" - // clause to only update this model. Otherwise, we'll just insert them. - if ($this->exists) - { - $saved = $this->performUpdate($query, $options); - } - - // If the model is brand new, we'll insert it into our database and set the - // ID attribute on the model to the value of the newly inserted row's ID - // which is typically an auto-increment value managed by the database. - else - { - $saved = $this->performInsert($query, $options); - } - - if ($saved) $this->finishSave($options); - - return $saved; - } - - /** - * Finish processing on a successful save operation. - * - * @param array $options - * @return void - */ - protected function finishSave(array $options) - { - $this->fireModelEvent('saved', false); - - $this->syncOriginal(); - - if (array_get($options, 'touch', true)) $this->touchOwners(); - } - - /** - * Perform a model update operation. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param array $options - * @return bool|null - */ - protected function performUpdate(Builder $query, array $options = []) - { - $dirty = $this->getDirty(); - - if (count($dirty) > 0) - { - // If the updating event returns false, we will cancel the update operation so - // developers can hook Validation systems into their models and cancel this - // operation if the model does not pass validation. Otherwise, we update. - if ($this->fireModelEvent('updating') === false) - { - return false; - } - - // First we need to create a fresh query instance and touch the creation and - // update timestamp on the model which are maintained by us for developer - // convenience. Then we will just continue saving the model instances. - if ($this->timestamps && array_get($options, 'timestamps', true)) - { - $this->updateTimestamps(); - } - - // Once we have run the update operation, we will fire the "updated" event for - // this model instance. This will allow developers to hook into these after - // models are updated, giving them a chance to do any special processing. - $dirty = $this->getDirty(); - - if (count($dirty) > 0) - { - $this->setKeysForSaveQuery($query)->update($dirty); - - $this->fireModelEvent('updated', false); - } - } - - return true; - } - - /** - * Perform a model insert operation. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param array $options - * @return bool - */ - protected function performInsert(Builder $query, array $options = []) - { - if ($this->fireModelEvent('creating') === false) return false; - - // First we'll need to create a fresh query instance and touch the creation and - // update timestamps on this model, which are maintained by us for developer - // convenience. After, we will just continue saving these model instances. - if ($this->timestamps && array_get($options, 'timestamps', true)) - { - $this->updateTimestamps(); - } - - // If the model has an incrementing key, we can use the "insertGetId" method on - // the query builder, which will give us back the final inserted ID for this - // table from the database. Not all tables have to be incrementing though. - $attributes = $this->attributes; - - if ($this->incrementing) - { - $this->insertAndSetId($query, $attributes); - } - - // If the table is not incrementing we'll simply insert this attributes as they - // are, as this attributes arrays must contain an "id" column already placed - // there by the developer as the manually determined key for these models. - else - { - $query->insert($attributes); - } - - // We will go ahead and set the exists property to true, so that it is set when - // the created event is fired, just in case the developer tries to update it - // during the event. This will allow them to do so and run an update here. - $this->exists = true; - - $this->fireModelEvent('created', false); - - return true; - } - - /** - * Insert the given attributes and set the ID on the model. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param array $attributes - * @return void - */ - protected function insertAndSetId(Builder $query, $attributes) - { - $id = $query->insertGetId($attributes, $keyName = $this->getKeyName()); - - $this->setAttribute($keyName, $id); - } - - /** - * Touch the owning relations of the model. - * - * @return void - */ - public function touchOwners() - { - foreach ($this->touches as $relation) - { - $this->$relation()->touch(); - - if ($this->$relation instanceof Model) - { - $this->$relation->touchOwners(); - } - elseif ($this->$relation instanceof Collection) - { - $this->$relation->each(function (Model $relation) - { - $relation->touchOwners(); - }); - } - } - } - - /** - * Determine if the model touches a given relation. - * - * @param string $relation - * @return bool - */ - public function touches($relation) - { - return in_array($relation, $this->touches); - } - - /** - * Fire the given event for the model. - * - * @param string $event - * @param bool $halt - * @return mixed - */ - protected function fireModelEvent($event, $halt = true) - { - if ( ! isset(static::$dispatcher)) return true; - - // We will append the names of the class to the event to distinguish it from - // other model events that are fired, allowing us to listen on each model - // event set individually instead of catching event for all the models. - $event = "eloquent.{$event}: ".get_class($this); - - $method = $halt ? 'until' : 'fire'; - - return static::$dispatcher->$method($event, $this); - } - - /** - * Set the keys for a save update query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function setKeysForSaveQuery(Builder $query) - { - $query->where($this->getKeyName(), '=', $this->getKeyForSaveQuery()); - - return $query; - } - - /** - * Get the primary key value for a save query. - * - * @return mixed - */ - protected function getKeyForSaveQuery() - { - if (isset($this->original[$this->getKeyName()])) - { - return $this->original[$this->getKeyName()]; - } - - return $this->getAttribute($this->getKeyName()); - } - - /** - * Update the model's update timestamp. - * - * @return bool - */ - public function touch() - { - if ( ! $this->timestamps) return false; - - $this->updateTimestamps(); - - return $this->save(); - } - - /** - * Update the creation and update timestamps. - * - * @return void - */ - protected function updateTimestamps() - { - $time = $this->freshTimestamp(); - - if ( ! $this->isDirty(static::UPDATED_AT)) - { - $this->setUpdatedAt($time); - } - - if ( ! $this->exists && ! $this->isDirty(static::CREATED_AT)) - { - $this->setCreatedAt($time); - } - } - - /** - * Set the value of the "created at" attribute. - * - * @param mixed $value - * @return void - */ - public function setCreatedAt($value) - { - $this->{static::CREATED_AT} = $value; - } - - /** - * Set the value of the "updated at" attribute. - * - * @param mixed $value - * @return void - */ - public function setUpdatedAt($value) - { - $this->{static::UPDATED_AT} = $value; - } - - /** - * Get the name of the "created at" column. - * - * @return string - */ - public function getCreatedAtColumn() - { - return static::CREATED_AT; - } - - /** - * Get the name of the "updated at" column. - * - * @return string - */ - public function getUpdatedAtColumn() - { - return static::UPDATED_AT; - } - - /** - * Get a fresh timestamp for the model. - * - * @return \Carbon\Carbon - */ - public function freshTimestamp() - { - return new Carbon; - } - - /** - * Get a fresh timestamp for the model. - * - * @return string - */ - public function freshTimestampString() - { - return $this->fromDateTime($this->freshTimestamp()); - } - - /** - * Get a new query builder for the model's table. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - public function newQuery() - { - $builder = $this->newQueryWithoutScopes(); - - return $this->applyGlobalScopes($builder); - } - - /** - * Get a new query instance without a given scope. - * - * @param \Illuminate\Database\Eloquent\ScopeInterface $scope - * @return \Illuminate\Database\Eloquent\Builder - */ - public function newQueryWithoutScope($scope) - { - $this->getGlobalScope($scope)->remove($builder = $this->newQuery(), $this); - - return $builder; - } - - /** - * Get a new query builder that doesn't have any global scopes. - * - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function newQueryWithoutScopes() - { - $builder = $this->newEloquentBuilder( - $this->newBaseQueryBuilder() - ); - - // Once we have the query builders, we will set the model instances so the - // builder can easily access any information it may need from the model - // while it is constructing and executing various queries against it. - return $builder->setModel($this)->with($this->with); - } - - /** - * Apply all of the global scopes to an Eloquent builder. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return \Illuminate\Database\Eloquent\Builder - */ - public function applyGlobalScopes($builder) - { - foreach ($this->getGlobalScopes() as $scope) - { - $scope->apply($builder, $this); - } - - return $builder; - } - - /** - * Remove all of the global scopes from an Eloquent builder. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return \Illuminate\Database\Eloquent\Builder - */ - public function removeGlobalScopes($builder) - { - foreach ($this->getGlobalScopes() as $scope) - { - $scope->remove($builder, $this); - } - - return $builder; - } - - /** - * Create a new Eloquent query builder for the model. - * - * @param \Illuminate\Database\Query\Builder $query - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function newEloquentBuilder($query) - { - return new Builder($query); - } - - /** - * Get a new query builder instance for the connection. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function newBaseQueryBuilder() - { - $conn = $this->getConnection(); - - $grammar = $conn->getQueryGrammar(); - - return new QueryBuilder($conn, $grammar, $conn->getPostProcessor()); - } - - /** - * Create a new Eloquent Collection instance. - * - * @param array $models - * @return \Illuminate\Database\Eloquent\Collection - */ - public function newCollection(array $models = array()) - { - return new Collection($models); - } - - /** - * Create a new pivot model instance. - * - * @param \Illuminate\Database\Eloquent\Model $parent - * @param array $attributes - * @param string $table - * @param bool $exists - * @return \Illuminate\Database\Eloquent\Relations\Pivot - */ - public function newPivot(Model $parent, array $attributes, $table, $exists) - { - return new Pivot($parent, $attributes, $table, $exists); - } - - /** - * Get the table associated with the model. - * - * @return string - */ - public function getTable() - { - if (isset($this->table)) return $this->table; - - return str_replace('\\', '', snake_case(str_plural(class_basename($this)))); - } - - /** - * Set the table associated with the model. - * - * @param string $table - * @return void - */ - public function setTable($table) - { - $this->table = $table; - } - - /** - * Get the value of the model's primary key. - * - * @return mixed - */ - public function getKey() - { - return $this->getAttribute($this->getKeyName()); - } - - /** - * Get the queueable identity for the entity. - * - * @return mixed - */ - public function getQueueableId() - { - return $this->getKey(); - } - - /** - * Get the primary key for the model. - * - * @return string - */ - public function getKeyName() - { - return $this->primaryKey; - } - - /** - * Set the primary key for the model. - * - * @param string $key - * @return void - */ - public function setKeyName($key) - { - $this->primaryKey = $key; - } - - /** - * Get the table qualified key name. - * - * @return string - */ - public function getQualifiedKeyName() - { - return $this->getTable().'.'.$this->getKeyName(); - } - - /** - * Get the value of the model's route key. - * - * @return mixed - */ - public function getRouteKey() - { - return $this->getAttribute($this->getRouteKeyName()); - } - - /** - * Get the route key for the model. - * - * @return string - */ - public function getRouteKeyName() - { - return $this->getKeyName(); - } - - /** - * Determine if the model uses timestamps. - * - * @return bool - */ - public function usesTimestamps() - { - return $this->timestamps; - } - - /** - * Get the polymorphic relationship columns. - * - * @param string $name - * @param string $type - * @param string $id - * @return array - */ - protected function getMorphs($name, $type, $id) - { - $type = $type ?: $name.'_type'; - - $id = $id ?: $name.'_id'; - - return array($type, $id); - } - - /** - * Get the class name for polymorphic relations. - * - * @return string - */ - public function getMorphClass() - { - return $this->morphClass ?: get_class($this); - } - - /** - * Get the number of models to return per page. - * - * @return int - */ - public function getPerPage() - { - return $this->perPage; - } - - /** - * Set the number of models to return per page. - * - * @param int $perPage - * @return void - */ - public function setPerPage($perPage) - { - $this->perPage = $perPage; - } - - /** - * Get the default foreign key name for the model. - * - * @return string - */ - public function getForeignKey() - { - return snake_case(class_basename($this)).'_id'; - } - - /** - * Get the hidden attributes for the model. - * - * @return array - */ - public function getHidden() - { - return $this->hidden; - } - - /** - * Set the hidden attributes for the model. - * - * @param array $hidden - * @return void - */ - public function setHidden(array $hidden) - { - $this->hidden = $hidden; - } - - /** - * Add hidden attributes for the model. - * - * @param array|string|null $attributes - * @return void - */ - public function addHidden($attributes = null) - { - $attributes = is_array($attributes) ? $attributes : func_get_args(); - - $this->hidden = array_merge($this->hidden, $attributes); - } - - /** - * Get the visible attributes for the model. - * - * @return array - */ - public function getVisible() - { - return $this->visible; - } - - /** - * Set the visible attributes for the model. - * - * @param array $visible - * @return void - */ - public function setVisible(array $visible) - { - $this->visible = $visible; - } - - /** - * Add visible attributes for the model. - * - * @param array|string|null $attributes - * @return void - */ - public function addVisible($attributes = null) - { - $attributes = is_array($attributes) ? $attributes : func_get_args(); - - $this->visible = array_merge($this->visible, $attributes); - } - - /** - * Set the accessors to append to model arrays. - * - * @param array $appends - * @return void - */ - public function setAppends(array $appends) - { - $this->appends = $appends; - } - - /** - * Get the fillable attributes for the model. - * - * @return array - */ - public function getFillable() - { - return $this->fillable; - } - - /** - * Set the fillable attributes for the model. - * - * @param array $fillable - * @return $this - */ - public function fillable(array $fillable) - { - $this->fillable = $fillable; - - return $this; - } - - /** - * Get the guarded attributes for the model. - * - * @return array - */ - public function getGuarded() - { - return $this->guarded; - } - - /** - * Set the guarded attributes for the model. - * - * @param array $guarded - * @return $this - */ - public function guard(array $guarded) - { - $this->guarded = $guarded; - - return $this; - } - - /** - * Disable all mass assignable restrictions. - * - * @return void - */ - public static function unguard($state = true) - { - static::$unguarded = $state; - } - - /** - * Enable the mass assignment restrictions. - * - * @return void - */ - public static function reguard() - { - static::$unguarded = false; - } - - /** - * Determine if current state is "unguarded". - * - * @return bool - */ - public static function isUnguarded() - { - return static::$unguarded; - } - - /** - * Run the given callable while being unguarded. - * - * @param callable $callback - * @return mixed - */ - public static function unguarded(callable $callback) - { - if (static::$unguarded) return $callback(); - - static::unguard(); - - $result = $callback(); - - static::reguard(); - - return $result; - } - - /** - * Determine if the given attribute may be mass assigned. - * - * @param string $key - * @return bool - */ - public function isFillable($key) - { - if (static::$unguarded) return true; - - // If the key is in the "fillable" array, we can of course assume that it's - // a fillable attribute. Otherwise, we will check the guarded array when - // we need to determine if the attribute is black-listed on the model. - if (in_array($key, $this->fillable)) return true; - - if ($this->isGuarded($key)) return false; - - return empty($this->fillable) && ! starts_with($key, '_'); - } - - /** - * Determine if the given key is guarded. - * - * @param string $key - * @return bool - */ - public function isGuarded($key) - { - return in_array($key, $this->guarded) || $this->guarded == array('*'); - } - - /** - * Determine if the model is totally guarded. - * - * @return bool - */ - public function totallyGuarded() - { - return count($this->fillable) == 0 && $this->guarded == array('*'); - } - - /** - * Remove the table name from a given key. - * - * @param string $key - * @return string - */ - protected function removeTableFromKey($key) - { - if ( ! str_contains($key, '.')) return $key; - - return last(explode('.', $key)); - } - - /** - * Get the relationships that are touched on save. - * - * @return array - */ - public function getTouchedRelations() - { - return $this->touches; - } - - /** - * Set the relationships that are touched on save. - * - * @param array $touches - * @return void - */ - public function setTouchedRelations(array $touches) - { - $this->touches = $touches; - } - - /** - * Get the value indicating whether the IDs are incrementing. - * - * @return bool - */ - public function getIncrementing() - { - return $this->incrementing; - } - - /** - * Set whether IDs are incrementing. - * - * @param bool $value - * @return void - */ - public function setIncrementing($value) - { - $this->incrementing = $value; - } - - /** - * Convert the model instance to JSON. - * - * @param int $options - * @return string - */ - public function toJson($options = 0) - { - return json_encode($this->toArray(), $options); - } - - /** - * Convert the object into something JSON serializable. - * - * @return array - */ - public function jsonSerialize() - { - return $this->toArray(); - } - - /** - * Convert the model instance to an array. - * - * @return array - */ - public function toArray() - { - $attributes = $this->attributesToArray(); - - return array_merge($attributes, $this->relationsToArray()); - } - - /** - * Convert the model's attributes to an array. - * - * @return array - */ - public function attributesToArray() - { - $attributes = $this->getArrayableAttributes(); - - // If an attribute is a date, we will cast it to a string after converting it - // to a DateTime / Carbon instance. This is so we will get some consistent - // formatting while accessing attributes vs. arraying / JSONing a model. - foreach ($this->getDates() as $key) - { - if ( ! isset($attributes[$key])) continue; - - $attributes[$key] = (string) $this->asDateTime($attributes[$key]); - } - - $mutatedAttributes = $this->getMutatedAttributes(); - - // We want to spin through all the mutated attributes for this model and call - // the mutator for the attribute. We cache off every mutated attributes so - // we don't have to constantly check on attributes that actually change. - foreach ($mutatedAttributes as $key) - { - if ( ! array_key_exists($key, $attributes)) continue; - - $attributes[$key] = $this->mutateAttributeForArray( - $key, $attributes[$key] - ); - } - - // Next we will handle any casts that have been setup for this model and cast - // the values to their appropriate type. If the attribute has a mutator we - // will not perform the cast on those attributes to avoid any confusion. - foreach ($this->casts as $key => $value) - { - if ( ! array_key_exists($key, $attributes) || - in_array($key, $mutatedAttributes)) continue; - - $attributes[$key] = $this->castAttribute( - $key, $attributes[$key] - ); - } - - // Here we will grab all of the appended, calculated attributes to this model - // as these attributes are not really in the attributes array, but are run - // when we need to array or JSON the model for convenience to the coder. - foreach ($this->getArrayableAppends() as $key) - { - $attributes[$key] = $this->mutateAttributeForArray($key, null); - } - - return $attributes; - } - - /** - * Get an attribute array of all arrayable attributes. - * - * @return array - */ - protected function getArrayableAttributes() - { - return $this->getArrayableItems($this->attributes); - } - - /** - * Get all of the appendable values that are arrayable. - * - * @return array - */ - protected function getArrayableAppends() - { - if ( ! count($this->appends)) return []; - - return $this->getArrayableItems( - array_combine($this->appends, $this->appends) - ); - } - - /** - * Get the model's relationships in array form. - * - * @return array - */ - public function relationsToArray() - { - $attributes = array(); - - foreach ($this->getArrayableRelations() as $key => $value) - { - if (in_array($key, $this->hidden)) continue; - - // If the values implements the Arrayable interface we can just call this - // toArray method on the instances which will convert both models and - // collections to their proper array form and we'll set the values. - if ($value instanceof Arrayable) - { - $relation = $value->toArray(); - } - - // If the value is null, we'll still go ahead and set it in this list of - // attributes since null is used to represent empty relationships if - // if it a has one or belongs to type relationships on the models. - elseif (is_null($value)) - { - $relation = $value; - } - - // If the relationships snake-casing is enabled, we will snake case this - // key so that the relation attribute is snake cased in this returned - // array to the developers, making this consistent with attributes. - if (static::$snakeAttributes) - { - $key = snake_case($key); - } - - // If the relation value has been set, we will set it on this attributes - // list for returning. If it was not arrayable or null, we'll not set - // the value on the array because it is some type of invalid value. - if (isset($relation) || is_null($value)) - { - $attributes[$key] = $relation; - } - - unset($relation); - } - - return $attributes; - } - - /** - * Get an attribute array of all arrayable relations. - * - * @return array - */ - protected function getArrayableRelations() - { - return $this->getArrayableItems($this->relations); - } - - /** - * Get an attribute array of all arrayable values. - * - * @param array $values - * @return array - */ - protected function getArrayableItems(array $values) - { - if (count($this->visible) > 0) - { - return array_intersect_key($values, array_flip($this->visible)); - } - - return array_diff_key($values, array_flip($this->hidden)); - } - - /** - * Get an attribute from the model. - * - * @param string $key - * @return mixed - */ - public function getAttribute($key) - { - $inAttributes = array_key_exists($key, $this->attributes); - - // If the key references an attribute, we can just go ahead and return the - // plain attribute value from the model. This allows every attribute to - // be dynamically accessed through the _get method without accessors. - if ($inAttributes || $this->hasGetMutator($key)) - { - return $this->getAttributeValue($key); - } - - // If the key already exists in the relationships array, it just means the - // relationship has already been loaded, so we'll just return it out of - // here because there is no need to query within the relations twice. - if (array_key_exists($key, $this->relations)) - { - return $this->relations[$key]; - } - - // If the "attribute" exists as a method on the model, we will just assume - // it is a relationship and will load and return results from the query - // and hydrate the relationship's value on the "relationships" array. - if (method_exists($this, $key)) - { - return $this->getRelationshipFromMethod($key); - } - } - - /** - * Get a plain attribute (not a relationship). - * - * @param string $key - * @return mixed - */ - protected function getAttributeValue($key) - { - $value = $this->getAttributeFromArray($key); - - // If the attribute has a get mutator, we will call that then return what - // it returns as the value, which is useful for transforming values on - // retrieval from the model to a form that is more useful for usage. - if ($this->hasGetMutator($key)) - { - return $this->mutateAttribute($key, $value); - } - - // If the attribute exists within the cast array, we will convert it to - // an appropriate native PHP type dependant upon the associated value - // given with the key in the pair. Dayle made this comment line up. - if ($this->hasCast($key)) - { - $value = $this->castAttribute($key, $value); - } - - // If the attribute is listed as a date, we will convert it to a DateTime - // instance on retrieval, which makes it quite convenient to work with - // date fields without having to create a mutator for each property. - elseif (in_array($key, $this->getDates())) - { - if ( ! is_null($value)) return $this->asDateTime($value); - } - - return $value; - } - - /** - * Get an attribute from the $attributes array. - * - * @param string $key - * @return mixed - */ - protected function getAttributeFromArray($key) - { - if (array_key_exists($key, $this->attributes)) - { - return $this->attributes[$key]; - } - } - - /** - * Get a relationship value from a method. - * - * @param string $method - * @return mixed - * - * @throws \LogicException - */ - protected function getRelationshipFromMethod($method) - { - $relations = $this->$method(); - - if ( ! $relations instanceof Relation) - { - throw new LogicException('Relationship method must return an object of type ' - . 'Illuminate\Database\Eloquent\Relations\Relation'); - } - - return $this->relations[$method] = $relations->getResults(); - } - - /** - * Determine if a get mutator exists for an attribute. - * - * @param string $key - * @return bool - */ - public function hasGetMutator($key) - { - return method_exists($this, 'get'.studly_case($key).'Attribute'); - } - - /** - * Get the value of an attribute using its mutator. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function mutateAttribute($key, $value) - { - return $this->{'get'.studly_case($key).'Attribute'}($value); - } - - /** - * Get the value of an attribute using its mutator for array conversion. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function mutateAttributeForArray($key, $value) - { - $value = $this->mutateAttribute($key, $value); - - return $value instanceof Arrayable ? $value->toArray() : $value; - } - - /** - * Determine whether an attribute should be casted to a native type. - * - * @param string $key - * @return bool - */ - protected function hasCast($key) - { - return array_key_exists($key, $this->casts); - } - - /** - * Determine whether a value is JSON castable for inbound manipulation. - * - * @param string $key - * @return bool - */ - protected function isJsonCastable($key) - { - if ($this->hasCast($key)) - { - return in_array( - $this->getCastType($key), ['array', 'json', 'object', 'collection'], true - ); - } - - return false; - } - - /** - * Get the type of cast for a model attribute. - * - * @param string $key - * @return string - */ - protected function getCastType($key) - { - return trim(strtolower($this->casts[$key])); - } - - /** - * Cast an attribute to a native PHP type. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function castAttribute($key, $value) - { - if (is_null($value)) return $value; - - switch ($this->getCastType($key)) - { - case 'int': - case 'integer': - return (int) $value; - case 'real': - case 'float': - case 'double': - return (float) $value; - case 'string': - return (string) $value; - case 'bool': - case 'boolean': - return (bool) $value; - case 'object': - return json_decode($value); - case 'array': - case 'json': - return json_decode($value, true); - case 'collection': - return $this->newCollection(json_decode($value, true)); - default: - return $value; - } - } - - /** - * Set a given attribute on the model. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function setAttribute($key, $value) - { - // First we will check for the presence of a mutator for the set operation - // which simply lets the developers tweak the attribute as it is set on - // the model, such as "json_encoding" an listing of data for storage. - if ($this->hasSetMutator($key)) - { - $method = 'set'.studly_case($key).'Attribute'; - - return $this->{$method}($value); - } - - // If an attribute is listed as a "date", we'll convert it from a DateTime - // instance into a form proper for storage on the database tables using - // the connection grammar's date format. We will auto set the values. - elseif (in_array($key, $this->getDates()) && $value) - { - $value = $this->fromDateTime($value); - } - - if ($this->isJsonCastable($key)) - { - $value = json_encode($value); - } - - $this->attributes[$key] = $value; - } - - /** - * Determine if a set mutator exists for an attribute. - * - * @param string $key - * @return bool - */ - public function hasSetMutator($key) - { - return method_exists($this, 'set'.studly_case($key).'Attribute'); - } - - /** - * Get the attributes that should be converted to dates. - * - * @return array - */ - public function getDates() - { - $defaults = array(static::CREATED_AT, static::UPDATED_AT); - - return array_merge($this->dates, $defaults); - } - - /** - * Convert a DateTime to a storable string. - * - * @param \DateTime|int $value - * @return string - */ - public function fromDateTime($value) - { - $format = $this->getDateFormat(); - - // If the value is already a DateTime instance, we will just skip the rest of - // these checks since they will be a waste of time, and hinder performance - // when checking the field. We will just return the DateTime right away. - if ($value instanceof DateTime) - { - // - } - - // If the value is totally numeric, we will assume it is a UNIX timestamp and - // format the date as such. Once we have the date in DateTime form we will - // format it according to the proper format for the database connection. - elseif (is_numeric($value)) - { - $value = Carbon::createFromTimestamp($value); - } - - // If the value is in simple year, month, day format, we will format it using - // that setup. This is for simple "date" fields which do not have hours on - // the field. This conveniently picks up those dates and format correct. - elseif (preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $value)) - { - $value = Carbon::createFromFormat('Y-m-d', $value)->startOfDay(); - } - - // If this value is some other type of string, we'll create the DateTime with - // the format used by the database connection. Once we get the instance we - // can return back the finally formatted DateTime instances to the devs. - else - { - $value = Carbon::createFromFormat($format, $value); - } - - return $value->format($format); - } - - /** - * Return a timestamp as DateTime object. - * - * @param mixed $value - * @return \Carbon\Carbon - */ - protected function asDateTime($value) - { - // If this value is an integer, we will assume it is a UNIX timestamp's value - // and format a Carbon object from this timestamp. This allows flexibility - // when defining your date fields as they might be UNIX timestamps here. - if (is_numeric($value)) - { - return Carbon::createFromTimestamp($value); - } - - // If the value is in simply year, month, day format, we will instantiate the - // Carbon instances from that format. Again, this provides for simple date - // fields on the database, while still supporting Carbonized conversion. - elseif (preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $value)) - { - return Carbon::createFromFormat('Y-m-d', $value)->startOfDay(); - } - - // Finally, we will just assume this date is in the format used by default on - // the database connection and use that format to create the Carbon object - // that is returned back out to the developers after we convert it here. - elseif ( ! $value instanceof DateTime) - { - $format = $this->getDateFormat(); - - return Carbon::createFromFormat($format, $value); - } - - return Carbon::instance($value); - } - - /** - * Get the format for database stored dates. - * - * @return string - */ - protected function getDateFormat() - { - return $this->getConnection()->getQueryGrammar()->getDateFormat(); - } - - /** - * Clone the model into a new, non-existing instance. - * - * @param array $except - * @return \Illuminate\Database\Eloquent\Model - */ - public function replicate(array $except = null) - { - $except = $except ?: [ - $this->getKeyName(), - $this->getCreatedAtColumn(), - $this->getUpdatedAtColumn(), - ]; - - $attributes = array_except($this->attributes, $except); - - with($instance = new static)->setRawAttributes($attributes); - - return $instance->setRelations($this->relations); - } - - /** - * Get all of the current attributes on the model. - * - * @return array - */ - public function getAttributes() - { - return $this->attributes; - } - - /** - * Set the array of model attributes. No checking is done. - * - * @param array $attributes - * @param bool $sync - * @return void - */ - public function setRawAttributes(array $attributes, $sync = false) - { - $this->attributes = $attributes; - - if ($sync) $this->syncOriginal(); - } - - /** - * Get the model's original attribute values. - * - * @param string $key - * @param mixed $default - * @return array - */ - public function getOriginal($key = null, $default = null) - { - return array_get($this->original, $key, $default); - } - - /** - * Sync the original attributes with the current. - * - * @return $this - */ - public function syncOriginal() - { - $this->original = $this->attributes; - - return $this; - } - - /** - * Sync a single original attribute with its current value. - * - * @param string $attribute - * @return $this - */ - public function syncOriginalAttribute($attribute) - { - $this->original[$attribute] = $this->attributes[$attribute]; - - return $this; - } - - /** - * Determine if the model or given attribute(s) have been modified. - * - * @param array|string|null $attributes - * @return bool - */ - public function isDirty($attributes = null) - { - $dirty = $this->getDirty(); - - if (is_null($attributes)) return count($dirty) > 0; - - if ( ! is_array($attributes)) $attributes = func_get_args(); - - foreach ($attributes as $attribute) - { - if (array_key_exists($attribute, $dirty)) return true; - } - - return false; - } - - /** - * Get the attributes that have been changed since last sync. - * - * @return array - */ - public function getDirty() - { - $dirty = array(); - - foreach ($this->attributes as $key => $value) - { - if ( ! array_key_exists($key, $this->original)) - { - $dirty[$key] = $value; - } - elseif ($value !== $this->original[$key] && - ! $this->originalIsNumericallyEquivalent($key)) - { - $dirty[$key] = $value; - } - } - - return $dirty; - } - - /** - * Determine if the new and old values for a given key are numerically equivalent. - * - * @param string $key - * @return bool - */ - protected function originalIsNumericallyEquivalent($key) - { - $current = $this->attributes[$key]; - - $original = $this->original[$key]; - - return is_numeric($current) && is_numeric($original) && strcmp((string) $current, (string) $original) === 0; - } - - /** - * Get all the loaded relations for the instance. - * - * @return array - */ - public function getRelations() - { - return $this->relations; - } - - /** - * Get a specified relationship. - * - * @param string $relation - * @return mixed - */ - public function getRelation($relation) - { - return $this->relations[$relation]; - } - - /** - * Set the specific relationship in the model. - * - * @param string $relation - * @param mixed $value - * @return $this - */ - public function setRelation($relation, $value) - { - $this->relations[$relation] = $value; - - return $this; - } - - /** - * Set the entire relations array on the model. - * - * @param array $relations - * @return $this - */ - public function setRelations(array $relations) - { - $this->relations = $relations; - - return $this; - } - - /** - * Get the database connection for the model. - * - * @return \Illuminate\Database\Connection - */ - public function getConnection() - { - return static::resolveConnection($this->connection); - } - - /** - * Get the current connection name for the model. - * - * @return string - */ - public function getConnectionName() - { - return $this->connection; - } - - /** - * Set the connection associated with the model. - * - * @param string $name - * @return $this - */ - public function setConnection($name) - { - $this->connection = $name; - - return $this; - } - - /** - * Resolve a connection instance. - * - * @param string $connection - * @return \Illuminate\Database\Connection - */ - public static function resolveConnection($connection = null) - { - return static::$resolver->connection($connection); - } - - /** - * Get the connection resolver instance. - * - * @return \Illuminate\Database\ConnectionResolverInterface - */ - public static function getConnectionResolver() - { - return static::$resolver; - } - - /** - * Set the connection resolver instance. - * - * @param \Illuminate\Database\ConnectionResolverInterface $resolver - * @return void - */ - public static function setConnectionResolver(Resolver $resolver) - { - static::$resolver = $resolver; - } - - /** - * Unset the connection resolver for models. - * - * @return void - */ - public static function unsetConnectionResolver() - { - static::$resolver = null; - } - - /** - * Get the event dispatcher instance. - * - * @return \Illuminate\Contracts\Events\Dispatcher - */ - public static function getEventDispatcher() - { - return static::$dispatcher; - } - - /** - * Set the event dispatcher instance. - * - * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher - * @return void - */ - public static function setEventDispatcher(Dispatcher $dispatcher) - { - static::$dispatcher = $dispatcher; - } - - /** - * Unset the event dispatcher for models. - * - * @return void - */ - public static function unsetEventDispatcher() - { - static::$dispatcher = null; - } - - /** - * Get the mutated attributes for a given instance. - * - * @return array - */ - public function getMutatedAttributes() - { - $class = get_class($this); - - if ( ! isset(static::$mutatorCache[$class])) - { - static::cacheMutatedAttributes($class); - } - - return static::$mutatorCache[$class]; - } - - /** - * Extract and cache all the mutated attributes of a class. - * - * @param string $class - * @return void - */ - public static function cacheMutatedAttributes($class) - { - $mutatedAttributes = array(); - - // Here we will extract all of the mutated attributes so that we can quickly - // spin through them after we export models to their array form, which we - // need to be fast. This'll let us know the attributes that can mutate. - foreach (get_class_methods($class) as $method) - { - if (strpos($method, 'Attribute') !== false && - preg_match('/^get(.+)Attribute$/', $method, $matches)) - { - if (static::$snakeAttributes) $matches[1] = snake_case($matches[1]); - - $mutatedAttributes[] = lcfirst($matches[1]); - } - } - - static::$mutatorCache[$class] = $mutatedAttributes; - } - - /** - * Dynamically retrieve attributes on the model. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this->getAttribute($key); - } - - /** - * Dynamically set attributes on the model. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function __set($key, $value) - { - $this->setAttribute($key, $value); - } - - /** - * Determine if the given attribute exists. - * - * @param mixed $offset - * @return bool - */ - public function offsetExists($offset) - { - return isset($this->$offset); - } - - /** - * Get the value for a given offset. - * - * @param mixed $offset - * @return mixed - */ - public function offsetGet($offset) - { - return $this->$offset; - } - - /** - * Set the value for a given offset. - * - * @param mixed $offset - * @param mixed $value - * @return void - */ - public function offsetSet($offset, $value) - { - $this->$offset = $value; - } - - /** - * Unset the value for a given offset. - * - * @param mixed $offset - * @return void - */ - public function offsetUnset($offset) - { - unset($this->$offset); - } - - /** - * Determine if an attribute exists on the model. - * - * @param string $key - * @return bool - */ - public function __isset($key) - { - return (isset($this->attributes[$key]) || isset($this->relations[$key])) || - ($this->hasGetMutator($key) && ! is_null($this->getAttributeValue($key))); - } - - /** - * Unset an attribute on the model. - * - * @param string $key - * @return void - */ - public function __unset($key) - { - unset($this->attributes[$key], $this->relations[$key]); - } - - /** - * Handle dynamic method calls into the model. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if (in_array($method, array('increment', 'decrement'))) - { - return call_user_func_array(array($this, $method), $parameters); - } - - $query = $this->newQuery(); - - return call_user_func_array(array($query, $method), $parameters); - } - - /** - * Handle dynamic static method calls into the method. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public static function __callStatic($method, $parameters) - { - $instance = new static; - - return call_user_func_array(array($instance, $method), $parameters); - } - - /** - * Convert the model to its string representation. - * - * @return string - */ - public function __toString() - { - return $this->toJson(); - } - - /** - * When a model is being unserialized, check if it needs to be booted. - * - * @return void - */ - public function __wakeup() - { - $this->bootIfNotBooted(); - } - +abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializable, QueueableEntity, UrlRoutable +{ + /** + * The connection name for the model. + * + * @var string + */ + protected $connection; + + /** + * The table associated with the model. + * + * @var string + */ + protected $table; + + /** + * The primary key for the model. + * + * @var string + */ + protected $primaryKey = 'id'; + + /** + * The number of models to return for pagination. + * + * @var int + */ + protected $perPage = 15; + + /** + * Indicates if the IDs are auto-incrementing. + * + * @var bool + */ + public $incrementing = true; + + /** + * Indicates if the model should be timestamped. + * + * @var bool + */ + public $timestamps = true; + + /** + * The model's attributes. + * + * @var array + */ + protected $attributes = []; + + /** + * The model attribute's original state. + * + * @var array + */ + protected $original = []; + + /** + * The loaded relationships for the model. + * + * @var array + */ + protected $relations = []; + + /** + * The attributes that should be hidden for arrays. + * + * @var array + */ + protected $hidden = []; + + /** + * The attributes that should be visible in arrays. + * + * @var array + */ + protected $visible = []; + + /** + * The accessors to append to the model's array form. + * + * @var array + */ + protected $appends = []; + + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = []; + + /** + * The attributes that aren't mass assignable. + * + * @var array + */ + protected $guarded = ['*']; + + /** + * The attributes that should be mutated to dates. + * + * @var array + */ + protected $dates = []; + + /** + * The storage format of the model's date columns. + * + * @var string + */ + protected $dateFormat; + + /** + * The attributes that should be cast to native types. + * + * @var array + */ + protected $casts = []; + + /** + * The relationships that should be touched on save. + * + * @var array + */ + protected $touches = []; + + /** + * User exposed observable events. + * + * @var array + */ + protected $observables = []; + + /** + * The relations to eager load on every query. + * + * @var array + */ + protected $with = []; + + /** + * The class name to be used in polymorphic relations. + * + * @var string + */ + protected $morphClass; + + /** + * Indicates if the model exists. + * + * @var bool + */ + public $exists = false; + + /** + * Indicates if the model was inserted during the current request lifecycle. + * + * @var bool + */ + public $wasRecentlyCreated = false; + + /** + * Indicates whether attributes are snake cased on arrays. + * + * @var bool + */ + public static $snakeAttributes = true; + + /** + * The connection resolver instance. + * + * @var \Illuminate\Database\ConnectionResolverInterface + */ + protected static $resolver; + + /** + * The event dispatcher instance. + * + * @var \Illuminate\Contracts\Events\Dispatcher + */ + protected static $dispatcher; + + /** + * The array of booted models. + * + * @var array + */ + protected static $booted = []; + + /** + * The array of global scopes on the model. + * + * @var array + */ + protected static $globalScopes = []; + + /** + * Indicates if all mass assignment is enabled. + * + * @var bool + */ + protected static $unguarded = false; + + /** + * The cache of the mutated attributes for each class. + * + * @var array + */ + protected static $mutatorCache = []; + + /** + * The many to many relationship methods. + * + * @var array + */ + public static $manyMethods = ['belongsToMany', 'morphToMany', 'morphedByMany']; + + /** + * The name of the "created at" column. + * + * @var string + */ + const CREATED_AT = 'created_at'; + + /** + * The name of the "updated at" column. + * + * @var string + */ + const UPDATED_AT = 'updated_at'; + + /** + * Create a new Eloquent model instance. + * + * @param array $attributes + * @return void + */ + public function __construct(array $attributes = []) + { + $this->bootIfNotBooted(); + + $this->syncOriginal(); + + $this->fill($attributes); + } + + /** + * Check if the model needs to be booted and if so, do it. + * + * @return void + */ + protected function bootIfNotBooted() + { + $class = get_class($this); + + if (! isset(static::$booted[$class])) { + static::$booted[$class] = true; + + $this->fireModelEvent('booting', false); + + static::boot(); + + $this->fireModelEvent('booted', false); + } + } + + /** + * The "booting" method of the model. + * + * @return void + */ + protected static function boot() + { + static::bootTraits(); + } + + /** + * Boot all of the bootable traits on the model. + * + * @return void + */ + protected static function bootTraits() + { + foreach (class_uses_recursive(get_called_class()) as $trait) { + if (method_exists(get_called_class(), $method = 'boot'.class_basename($trait))) { + forward_static_call([get_called_class(), $method]); + } + } + } + + /** + * Clear the list of booted models so they will be re-booted. + * + * @return void + */ + public static function clearBootedModels() + { + static::$booted = []; + } + + /** + * Register a new global scope on the model. + * + * @param \Illuminate\Database\Eloquent\ScopeInterface $scope + * @return void + */ + public static function addGlobalScope(ScopeInterface $scope) + { + static::$globalScopes[get_called_class()][get_class($scope)] = $scope; + } + + /** + * Determine if a model has a global scope. + * + * @param \Illuminate\Database\Eloquent\ScopeInterface $scope + * @return bool + */ + public static function hasGlobalScope($scope) + { + return ! is_null(static::getGlobalScope($scope)); + } + + /** + * Get a global scope registered with the model. + * + * @param \Illuminate\Database\Eloquent\ScopeInterface $scope + * @return \Illuminate\Database\Eloquent\ScopeInterface|null + */ + public static function getGlobalScope($scope) + { + return Arr::first(static::$globalScopes[get_called_class()], function ($key, $value) use ($scope) { + return $scope instanceof $value; + }); + } + + /** + * Get the global scopes for this class instance. + * + * @return array + */ + public function getGlobalScopes() + { + return Arr::get(static::$globalScopes, get_class($this), []); + } + + /** + * Register an observer with the Model. + * + * @param object|string $class + * @param int $priority + * @return void + */ + public static function observe($class, $priority = 0) + { + $instance = new static; + + $className = is_string($class) ? $class : get_class($class); + + // When registering a model observer, we will spin through the possible events + // and determine if this observer has that method. If it does, we will hook + // it into the model's event system, making it convenient to watch these. + foreach ($instance->getObservableEvents() as $event) { + if (method_exists($class, $event)) { + static::registerModelEvent($event, $className.'@'.$event, $priority); + } + } + } + + /** + * Fill the model with an array of attributes. + * + * @param array $attributes + * @return $this + * + * @throws \Illuminate\Database\Eloquent\MassAssignmentException + */ + public function fill(array $attributes) + { + $totallyGuarded = $this->totallyGuarded(); + + foreach ($this->fillableFromArray($attributes) as $key => $value) { + $key = $this->removeTableFromKey($key); + + // The developers may choose to place some attributes in the "fillable" + // array, which means only those attributes may be set through mass + // assignment to the model, and all others will just be ignored. + if ($this->isFillable($key)) { + $this->setAttribute($key, $value); + } elseif ($totallyGuarded) { + throw new MassAssignmentException($key); + } + } + + return $this; + } + + /** + * Fill the model with an array of attributes. Force mass assignment. + * + * @param array $attributes + * @return $this + */ + public function forceFill(array $attributes) + { + // Since some versions of PHP have a bug that prevents it from properly + // binding the late static context in a closure, we will first store + // the model in a variable, which we will then use in the closure. + $model = $this; + + return static::unguarded(function () use ($model, $attributes) { + return $model->fill($attributes); + }); + } + + /** + * Get the fillable attributes of a given array. + * + * @param array $attributes + * @return array + */ + protected function fillableFromArray(array $attributes) + { + if (count($this->fillable) > 0 && ! static::$unguarded) { + return array_intersect_key($attributes, array_flip($this->fillable)); + } + + return $attributes; + } + + /** + * Create a new instance of the given model. + * + * @param array $attributes + * @param bool $exists + * @return static + */ + public function newInstance($attributes = [], $exists = false) + { + // This method just provides a convenient way for us to generate fresh model + // instances of this current model. It is particularly useful during the + // hydration of new objects via the Eloquent query builder instances. + $model = new static((array) $attributes); + + $model->exists = $exists; + + return $model; + } + + /** + * Create a new model instance that is existing. + * + * @param array $attributes + * @param string|null $connection + * @return static + */ + public function newFromBuilder($attributes = [], $connection = null) + { + $model = $this->newInstance([], true); + + $model->setRawAttributes((array) $attributes, true); + + $model->setConnection($connection ?: $this->connection); + + return $model; + } + + /** + * Create a collection of models from plain arrays. + * + * @param array $items + * @param string|null $connection + * @return \Illuminate\Database\Eloquent\Collection + */ + public static function hydrate(array $items, $connection = null) + { + $instance = (new static)->setConnection($connection); + + $items = array_map(function ($item) use ($instance) { + return $instance->newFromBuilder($item); + }, $items); + + return $instance->newCollection($items); + } + + /** + * Create a collection of models from a raw query. + * + * @param string $query + * @param array $bindings + * @param string|null $connection + * @return \Illuminate\Database\Eloquent\Collection + */ + public static function hydrateRaw($query, $bindings = [], $connection = null) + { + $instance = (new static)->setConnection($connection); + + $items = $instance->getConnection()->select($query, $bindings); + + return static::hydrate($items, $connection); + } + + /** + * Save a new model and return the instance. + * + * @param array $attributes + * @return static + */ + public static function create(array $attributes = []) + { + $model = new static($attributes); + + $model->save(); + + return $model; + } + + /** + * Save a new model and return the instance. Allow mass-assignment. + * + * @param array $attributes + * @return static + */ + public static function forceCreate(array $attributes) + { + // Since some versions of PHP have a bug that prevents it from properly + // binding the late static context in a closure, we will first store + // the model in a variable, which we will then use in the closure. + $model = new static; + + return static::unguarded(function () use ($model, $attributes) { + return $model->create($attributes); + }); + } + + /** + * Begin querying the model. + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public static function query() + { + return (new static)->newQuery(); + } + + /** + * Begin querying the model on a given connection. + * + * @param string|null $connection + * @return \Illuminate\Database\Eloquent\Builder + */ + public static function on($connection = null) + { + // First we will just create a fresh instance of this model, and then we can + // set the connection on the model so that it is be used for the queries + // we execute, as well as being set on each relationship we retrieve. + $instance = new static; + + $instance->setConnection($connection); + + return $instance->newQuery(); + } + + /** + * Begin querying the model on the write connection. + * + * @return \Illuminate\Database\Query\Builder + */ + public static function onWriteConnection() + { + $instance = new static; + + return $instance->newQuery()->useWritePdo(); + } + + /** + * Get all of the models from the database. + * + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Collection|static[] + */ + public static function all($columns = ['*']) + { + $columns = is_array($columns) ? $columns : func_get_args(); + + $instance = new static; + + return $instance->newQuery()->get($columns); + } + + /** + * Reload a fresh model instance from the database. + * + * @param array $with + * @return static|null + */ + public function fresh(array $with = []) + { + if (! $this->exists) { + return; + } + + $key = $this->getKeyName(); + + return static::with($with)->where($key, $this->getKey())->first(); + } + + /** + * Eager load relations on the model. + * + * @param array|string $relations + * @return $this + */ + public function load($relations) + { + if (is_string($relations)) { + $relations = func_get_args(); + } + + $query = $this->newQuery()->with($relations); + + $query->eagerLoadRelations([$this]); + + return $this; + } + + /** + * Begin querying a model with eager loading. + * + * @param array|string $relations + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public static function with($relations) + { + if (is_string($relations)) { + $relations = func_get_args(); + } + + $instance = new static; + + return $instance->newQuery()->with($relations); + } + + /** + * Append attributes to query when building a query. + * + * @param array|string $attributes + * @return $this + */ + public function append($attributes) + { + if (is_string($attributes)) { + $attributes = func_get_args(); + } + + $this->appends = array_unique( + array_merge($this->appends, $attributes) + ); + + return $this; + } + + /** + * Define a one-to-one relationship. + * + * @param string $related + * @param string $foreignKey + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\HasOne + */ + public function hasOne($related, $foreignKey = null, $localKey = null) + { + $foreignKey = $foreignKey ?: $this->getForeignKey(); + + $instance = new $related; + + $localKey = $localKey ?: $this->getKeyName(); + + return new HasOne($instance->newQuery(), $this, $instance->getTable().'.'.$foreignKey, $localKey); + } + + /** + * Define a polymorphic one-to-one relationship. + * + * @param string $related + * @param string $name + * @param string $type + * @param string $id + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\MorphOne + */ + public function morphOne($related, $name, $type = null, $id = null, $localKey = null) + { + $instance = new $related; + + list($type, $id) = $this->getMorphs($name, $type, $id); + + $table = $instance->getTable(); + + $localKey = $localKey ?: $this->getKeyName(); + + return new MorphOne($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey); + } + + /** + * Define an inverse one-to-one or many relationship. + * + * @param string $related + * @param string $foreignKey + * @param string $otherKey + * @param string $relation + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function belongsTo($related, $foreignKey = null, $otherKey = null, $relation = null) + { + // If no relation name was given, we will use this debug backtrace to extract + // the calling method's name and use that as the relationship name as most + // of the time this will be what we desire to use for the relationships. + if (is_null($relation)) { + list($current, $caller) = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); + + $relation = $caller['function']; + } + + // If no foreign key was supplied, we can use a backtrace to guess the proper + // foreign key name by using the name of the relationship function, which + // when combined with an "_id" should conventionally match the columns. + if (is_null($foreignKey)) { + $foreignKey = Str::snake($relation).'_id'; + } + + $instance = new $related; + + // Once we have the foreign key names, we'll just create a new Eloquent query + // for the related models and returns the relationship instance which will + // actually be responsible for retrieving and hydrating every relations. + $query = $instance->newQuery(); + + $otherKey = $otherKey ?: $instance->getKeyName(); + + return new BelongsTo($query, $this, $foreignKey, $otherKey, $relation); + } + + /** + * Define a polymorphic, inverse one-to-one or many relationship. + * + * @param string $name + * @param string $type + * @param string $id + * @return \Illuminate\Database\Eloquent\Relations\MorphTo + */ + public function morphTo($name = null, $type = null, $id = null) + { + // If no name is provided, we will use the backtrace to get the function name + // since that is most likely the name of the polymorphic interface. We can + // use that to get both the class and foreign key that will be utilized. + if (is_null($name)) { + list($current, $caller) = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); + + $name = Str::snake($caller['function']); + } + + list($type, $id) = $this->getMorphs($name, $type, $id); + + // If the type value is null it is probably safe to assume we're eager loading + // the relationship. In this case we'll just pass in a dummy query where we + // need to remove any eager loads that may already be defined on a model. + if (empty($class = $this->$type)) { + return new MorphTo( + $this->newQuery()->setEagerLoads([]), $this, $id, null, $type, $name + ); + } + + // If we are not eager loading the relationship we will essentially treat this + // as a belongs-to style relationship since morph-to extends that class and + // we will pass in the appropriate values so that it behaves as expected. + else { + $class = $this->getActualClassNameForMorph($class); + + $instance = new $class; + + return new MorphTo( + $instance->newQuery(), $this, $id, $instance->getKeyName(), $type, $name + ); + } + } + + /** + * Retrieve the fully qualified class name from a slug. + * + * @param string $class + * @return string + */ + public function getActualClassNameForMorph($class) + { + return Arr::get(Relation::morphMap(), $class, $class); + } + + /** + * Define a one-to-many relationship. + * + * @param string $related + * @param string $foreignKey + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function hasMany($related, $foreignKey = null, $localKey = null) + { + $foreignKey = $foreignKey ?: $this->getForeignKey(); + + $instance = new $related; + + $localKey = $localKey ?: $this->getKeyName(); + + return new HasMany($instance->newQuery(), $this, $instance->getTable().'.'.$foreignKey, $localKey); + } + + /** + * Define a has-many-through relationship. + * + * @param string $related + * @param string $through + * @param string|null $firstKey + * @param string|null $secondKey + * @param string|null $localKey + * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough + */ + public function hasManyThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null) + { + $through = new $through; + + $firstKey = $firstKey ?: $this->getForeignKey(); + + $secondKey = $secondKey ?: $through->getForeignKey(); + + $localKey = $localKey ?: $this->getKeyName(); + + return new HasManyThrough((new $related)->newQuery(), $this, $through, $firstKey, $secondKey, $localKey); + } + + /** + * Define a polymorphic one-to-many relationship. + * + * @param string $related + * @param string $name + * @param string $type + * @param string $id + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\MorphMany + */ + public function morphMany($related, $name, $type = null, $id = null, $localKey = null) + { + $instance = new $related; + + // Here we will gather up the morph type and ID for the relationship so that we + // can properly query the intermediate table of a relation. Finally, we will + // get the table and create the relationship instances for the developers. + list($type, $id) = $this->getMorphs($name, $type, $id); + + $table = $instance->getTable(); + + $localKey = $localKey ?: $this->getKeyName(); + + return new MorphMany($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey); + } + + /** + * Define a many-to-many relationship. + * + * @param string $related + * @param string $table + * @param string $foreignKey + * @param string $otherKey + * @param string $relation + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + public function belongsToMany($related, $table = null, $foreignKey = null, $otherKey = null, $relation = null) + { + // If no relationship name was passed, we will pull backtraces to get the + // name of the calling function. We will use that function name as the + // title of this relation since that is a great convention to apply. + if (is_null($relation)) { + $relation = $this->getBelongsToManyCaller(); + } + + // First, we'll need to determine the foreign key and "other key" for the + // relationship. Once we have determined the keys we'll make the query + // instances as well as the relationship instances we need for this. + $foreignKey = $foreignKey ?: $this->getForeignKey(); + + $instance = new $related; + + $otherKey = $otherKey ?: $instance->getForeignKey(); + + // If no table name was provided, we can guess it by concatenating the two + // models using underscores in alphabetical order. The two model names + // are transformed to snake case from their default CamelCase also. + if (is_null($table)) { + $table = $this->joiningTable($related); + } + + // Now we're ready to create a new query builder for the related model and + // the relationship instances for the relation. The relations will set + // appropriate query constraint and entirely manages the hydrations. + $query = $instance->newQuery(); + + return new BelongsToMany($query, $this, $table, $foreignKey, $otherKey, $relation); + } + + /** + * Define a polymorphic many-to-many relationship. + * + * @param string $related + * @param string $name + * @param string $table + * @param string $foreignKey + * @param string $otherKey + * @param bool $inverse + * @return \Illuminate\Database\Eloquent\Relations\MorphToMany + */ + public function morphToMany($related, $name, $table = null, $foreignKey = null, $otherKey = null, $inverse = false) + { + $caller = $this->getBelongsToManyCaller(); + + // First, we will need to determine the foreign key and "other key" for the + // relationship. Once we have determined the keys we will make the query + // instances, as well as the relationship instances we need for these. + $foreignKey = $foreignKey ?: $name.'_id'; + + $instance = new $related; + + $otherKey = $otherKey ?: $instance->getForeignKey(); + + // Now we're ready to create a new query builder for this related model and + // the relationship instances for this relation. This relations will set + // appropriate query constraints then entirely manages the hydrations. + $query = $instance->newQuery(); + + $table = $table ?: Str::plural($name); + + return new MorphToMany( + $query, $this, $name, $table, $foreignKey, + $otherKey, $caller, $inverse + ); + } + + /** + * Define a polymorphic, inverse many-to-many relationship. + * + * @param string $related + * @param string $name + * @param string $table + * @param string $foreignKey + * @param string $otherKey + * @return \Illuminate\Database\Eloquent\Relations\MorphToMany + */ + public function morphedByMany($related, $name, $table = null, $foreignKey = null, $otherKey = null) + { + $foreignKey = $foreignKey ?: $this->getForeignKey(); + + // For the inverse of the polymorphic many-to-many relations, we will change + // the way we determine the foreign and other keys, as it is the opposite + // of the morph-to-many method since we're figuring out these inverses. + $otherKey = $otherKey ?: $name.'_id'; + + return $this->morphToMany($related, $name, $table, $foreignKey, $otherKey, true); + } + + /** + * Get the relationship name of the belongs to many. + * + * @return string + */ + protected function getBelongsToManyCaller() + { + $self = __FUNCTION__; + + $caller = Arr::first(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), function ($key, $trace) use ($self) { + $caller = $trace['function']; + + return ! in_array($caller, Model::$manyMethods) && $caller != $self; + }); + + return ! is_null($caller) ? $caller['function'] : null; + } + + /** + * Get the joining table name for a many-to-many relation. + * + * @param string $related + * @return string + */ + public function joiningTable($related) + { + // The joining table name, by convention, is simply the snake cased models + // sorted alphabetically and concatenated with an underscore, so we can + // just sort the models and join them together to get the table name. + $base = Str::snake(class_basename($this)); + + $related = Str::snake(class_basename($related)); + + $models = [$related, $base]; + + // Now that we have the model names in an array we can just sort them and + // use the implode function to join them together with an underscores, + // which is typically used by convention within the database system. + sort($models); + + return strtolower(implode('_', $models)); + } + + /** + * Destroy the models for the given IDs. + * + * @param array|int $ids + * @return int + */ + public static function destroy($ids) + { + // We'll initialize a count here so we will return the total number of deletes + // for the operation. The developers can then check this number as a boolean + // type value or get this total count of records deleted for logging, etc. + $count = 0; + + $ids = is_array($ids) ? $ids : func_get_args(); + + $instance = new static; + + // We will actually pull the models from the database table and call delete on + // each of them individually so that their events get fired properly with a + // correct set of attributes in case the developers wants to check these. + $key = $instance->getKeyName(); + + foreach ($instance->whereIn($key, $ids)->get() as $model) { + if ($model->delete()) { + $count++; + } + } + + return $count; + } + + /** + * Delete the model from the database. + * + * @return bool|null + * + * @throws \Exception + */ + public function delete() + { + if (is_null($this->getKeyName())) { + throw new Exception('No primary key defined on model.'); + } + + if ($this->exists) { + if ($this->fireModelEvent('deleting') === false) { + return false; + } + + // Here, we'll touch the owning models, verifying these timestamps get updated + // for the models. This will allow any caching to get broken on the parents + // by the timestamp. Then we will go ahead and delete the model instance. + $this->touchOwners(); + + $this->performDeleteOnModel(); + + $this->exists = false; + + // Once the model has been deleted, we will fire off the deleted event so that + // the developers may hook into post-delete operations. We will then return + // a boolean true as the delete is presumably successful on the database. + $this->fireModelEvent('deleted', false); + + return true; + } + } + + /** + * Force a hard delete on a soft deleted model. + * + * This method protects developers from running forceDelete when trait is missing. + * + * @return bool|null + */ + public function forceDelete() + { + return $this->delete(); + } + + /** + * Perform the actual delete query on this model instance. + * + * @return void + */ + protected function performDeleteOnModel() + { + $this->setKeysForSaveQuery($this->newQueryWithoutScopes())->delete(); + } + + /** + * Register a saving model event with the dispatcher. + * + * @param \Closure|string $callback + * @param int $priority + * @return void + */ + public static function saving($callback, $priority = 0) + { + static::registerModelEvent('saving', $callback, $priority); + } + + /** + * Register a saved model event with the dispatcher. + * + * @param \Closure|string $callback + * @param int $priority + * @return void + */ + public static function saved($callback, $priority = 0) + { + static::registerModelEvent('saved', $callback, $priority); + } + + /** + * Register an updating model event with the dispatcher. + * + * @param \Closure|string $callback + * @param int $priority + * @return void + */ + public static function updating($callback, $priority = 0) + { + static::registerModelEvent('updating', $callback, $priority); + } + + /** + * Register an updated model event with the dispatcher. + * + * @param \Closure|string $callback + * @param int $priority + * @return void + */ + public static function updated($callback, $priority = 0) + { + static::registerModelEvent('updated', $callback, $priority); + } + + /** + * Register a creating model event with the dispatcher. + * + * @param \Closure|string $callback + * @param int $priority + * @return void + */ + public static function creating($callback, $priority = 0) + { + static::registerModelEvent('creating', $callback, $priority); + } + + /** + * Register a created model event with the dispatcher. + * + * @param \Closure|string $callback + * @param int $priority + * @return void + */ + public static function created($callback, $priority = 0) + { + static::registerModelEvent('created', $callback, $priority); + } + + /** + * Register a deleting model event with the dispatcher. + * + * @param \Closure|string $callback + * @param int $priority + * @return void + */ + public static function deleting($callback, $priority = 0) + { + static::registerModelEvent('deleting', $callback, $priority); + } + + /** + * Register a deleted model event with the dispatcher. + * + * @param \Closure|string $callback + * @param int $priority + * @return void + */ + public static function deleted($callback, $priority = 0) + { + static::registerModelEvent('deleted', $callback, $priority); + } + + /** + * Remove all of the event listeners for the model. + * + * @return void + */ + public static function flushEventListeners() + { + if (! isset(static::$dispatcher)) { + return; + } + + $instance = new static; + + foreach ($instance->getObservableEvents() as $event) { + static::$dispatcher->forget("eloquent.{$event}: ".get_called_class()); + } + } + + /** + * Register a model event with the dispatcher. + * + * @param string $event + * @param \Closure|string $callback + * @param int $priority + * @return void + */ + protected static function registerModelEvent($event, $callback, $priority = 0) + { + if (isset(static::$dispatcher)) { + $name = get_called_class(); + + static::$dispatcher->listen("eloquent.{$event}: {$name}", $callback, $priority); + } + } + + /** + * Get the observable event names. + * + * @return array + */ + public function getObservableEvents() + { + return array_merge( + [ + 'creating', 'created', 'updating', 'updated', + 'deleting', 'deleted', 'saving', 'saved', + 'restoring', 'restored', + ], + $this->observables + ); + } + + /** + * Set the observable event names. + * + * @param array $observables + * @return $this + */ + public function setObservableEvents(array $observables) + { + $this->observables = $observables; + + return $this; + } + + /** + * Add an observable event name. + * + * @param array|mixed $observables + * @return void + */ + public function addObservableEvents($observables) + { + $observables = is_array($observables) ? $observables : func_get_args(); + + $this->observables = array_unique(array_merge($this->observables, $observables)); + } + + /** + * Remove an observable event name. + * + * @param array|mixed $observables + * @return void + */ + public function removeObservableEvents($observables) + { + $observables = is_array($observables) ? $observables : func_get_args(); + + $this->observables = array_diff($this->observables, $observables); + } + + /** + * Increment a column's value by a given amount. + * + * @param string $column + * @param int $amount + * @return int + */ + protected function increment($column, $amount = 1) + { + return $this->incrementOrDecrement($column, $amount, 'increment'); + } + + /** + * Decrement a column's value by a given amount. + * + * @param string $column + * @param int $amount + * @return int + */ + protected function decrement($column, $amount = 1) + { + return $this->incrementOrDecrement($column, $amount, 'decrement'); + } + + /** + * Run the increment or decrement method on the model. + * + * @param string $column + * @param int $amount + * @param string $method + * @return int + */ + protected function incrementOrDecrement($column, $amount, $method) + { + $query = $this->newQuery(); + + if (! $this->exists) { + return $query->{$method}($column, $amount); + } + + $this->incrementOrDecrementAttributeValue($column, $amount, $method); + + return $query->where($this->getKeyName(), $this->getKey())->{$method}($column, $amount); + } + + /** + * Increment the underlying attribute value and sync with original. + * + * @param string $column + * @param int $amount + * @param string $method + * @return void + */ + protected function incrementOrDecrementAttributeValue($column, $amount, $method) + { + $this->{$column} = $this->{$column} + ($method == 'increment' ? $amount : $amount * -1); + + $this->syncOriginalAttribute($column); + } + + /** + * Update the model in the database. + * + * @param array $attributes + * @return bool|int + */ + public function update(array $attributes = []) + { + if (! $this->exists) { + return false; + } + + return $this->fill($attributes)->save(); + } + + /** + * Save the model and all of its relationships. + * + * @return bool + */ + public function push() + { + if (! $this->save()) { + return false; + } + + // To sync all of the relationships to the database, we will simply spin through + // the relationships and save each model via this "push" method, which allows + // us to recurse into all of these nested relations for the model instance. + foreach ($this->relations as $models) { + $models = $models instanceof Collection + ? $models->all() : [$models]; + + foreach (array_filter($models) as $model) { + if (! $model->push()) { + return false; + } + } + } + + return true; + } + + /** + * Save the model to the database. + * + * @param array $options + * @return bool + */ + public function save(array $options = []) + { + $query = $this->newQueryWithoutScopes(); + + // If the "saving" event returns false we'll bail out of the save and return + // false, indicating that the save failed. This provides a chance for any + // listeners to cancel save operations if validations fail or whatever. + if ($this->fireModelEvent('saving') === false) { + return false; + } + + // If the model already exists in the database we can just update our record + // that is already in this database using the current IDs in this "where" + // clause to only update this model. Otherwise, we'll just insert them. + if ($this->exists) { + $saved = $this->performUpdate($query, $options); + } + + // If the model is brand new, we'll insert it into our database and set the + // ID attribute on the model to the value of the newly inserted row's ID + // which is typically an auto-increment value managed by the database. + else { + $saved = $this->performInsert($query, $options); + } + + if ($saved) { + $this->finishSave($options); + } + + return $saved; + } + + /** + * Save the model to the database using transaction. + * + * @param array $options + * @return bool + * + * @throws \Throwable + */ + public function saveOrFail(array $options = []) + { + return $this->getConnection()->transaction(function () use ($options) { + return $this->save($options); + }); + } + + /** + * Finish processing on a successful save operation. + * + * @param array $options + * @return void + */ + protected function finishSave(array $options) + { + $this->fireModelEvent('saved', false); + + $this->syncOriginal(); + + if (Arr::get($options, 'touch', true)) { + $this->touchOwners(); + } + } + + /** + * Perform a model update operation. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param array $options + * @return bool + */ + protected function performUpdate(Builder $query, array $options = []) + { + $dirty = $this->getDirty(); + + if (count($dirty) > 0) { + // If the updating event returns false, we will cancel the update operation so + // developers can hook Validation systems into their models and cancel this + // operation if the model does not pass validation. Otherwise, we update. + if ($this->fireModelEvent('updating') === false) { + return false; + } + + // First we need to create a fresh query instance and touch the creation and + // update timestamp on the model which are maintained by us for developer + // convenience. Then we will just continue saving the model instances. + if ($this->timestamps && Arr::get($options, 'timestamps', true)) { + $this->updateTimestamps(); + } + + // Once we have run the update operation, we will fire the "updated" event for + // this model instance. This will allow developers to hook into these after + // models are updated, giving them a chance to do any special processing. + $dirty = $this->getDirty(); + + if (count($dirty) > 0) { + $numRows = $this->setKeysForSaveQuery($query)->update($dirty); + + $this->fireModelEvent('updated', false); + } + } + + return true; + } + + /** + * Perform a model insert operation. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param array $options + * @return bool + */ + protected function performInsert(Builder $query, array $options = []) + { + if ($this->fireModelEvent('creating') === false) { + return false; + } + + // First we'll need to create a fresh query instance and touch the creation and + // update timestamps on this model, which are maintained by us for developer + // convenience. After, we will just continue saving these model instances. + if ($this->timestamps && Arr::get($options, 'timestamps', true)) { + $this->updateTimestamps(); + } + + // If the model has an incrementing key, we can use the "insertGetId" method on + // the query builder, which will give us back the final inserted ID for this + // table from the database. Not all tables have to be incrementing though. + $attributes = $this->attributes; + + if ($this->incrementing) { + $this->insertAndSetId($query, $attributes); + } + + // If the table isn't incrementing we'll simply insert these attributes as they + // are. These attribute arrays must contain an "id" column previously placed + // there by the developer as the manually determined key for these models. + else { + $query->insert($attributes); + } + + // We will go ahead and set the exists property to true, so that it is set when + // the created event is fired, just in case the developer tries to update it + // during the event. This will allow them to do so and run an update here. + $this->exists = true; + + $this->wasRecentlyCreated = true; + + $this->fireModelEvent('created', false); + + return true; + } + + /** + * Insert the given attributes and set the ID on the model. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param array $attributes + * @return void + */ + protected function insertAndSetId(Builder $query, $attributes) + { + $id = $query->insertGetId($attributes, $keyName = $this->getKeyName()); + + $this->setAttribute($keyName, $id); + } + + /** + * Touch the owning relations of the model. + * + * @return void + */ + public function touchOwners() + { + foreach ($this->touches as $relation) { + $this->$relation()->touch(); + + if ($this->$relation instanceof self) { + $this->$relation->fireModelEvent('saved', false); + + $this->$relation->touchOwners(); + } elseif ($this->$relation instanceof Collection) { + $this->$relation->each(function (Model $relation) { + $relation->touchOwners(); + }); + } + } + } + + /** + * Determine if the model touches a given relation. + * + * @param string $relation + * @return bool + */ + public function touches($relation) + { + return in_array($relation, $this->touches); + } + + /** + * Fire the given event for the model. + * + * @param string $event + * @param bool $halt + * @return mixed + */ + protected function fireModelEvent($event, $halt = true) + { + if (! isset(static::$dispatcher)) { + return true; + } + + // We will append the names of the class to the event to distinguish it from + // other model events that are fired, allowing us to listen on each model + // event set individually instead of catching event for all the models. + $event = "eloquent.{$event}: ".get_class($this); + + $method = $halt ? 'until' : 'fire'; + + return static::$dispatcher->$method($event, $this); + } + + /** + * Set the keys for a save update query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function setKeysForSaveQuery(Builder $query) + { + $query->where($this->getKeyName(), '=', $this->getKeyForSaveQuery()); + + return $query; + } + + /** + * Get the primary key value for a save query. + * + * @return mixed + */ + protected function getKeyForSaveQuery() + { + if (isset($this->original[$this->getKeyName()])) { + return $this->original[$this->getKeyName()]; + } + + return $this->getAttribute($this->getKeyName()); + } + + /** + * Update the model's update timestamp. + * + * @return bool + */ + public function touch() + { + if (! $this->timestamps) { + return false; + } + + $this->updateTimestamps(); + + return $this->save(); + } + + /** + * Update the creation and update timestamps. + * + * @return void + */ + protected function updateTimestamps() + { + $time = $this->freshTimestamp(); + + if (! $this->isDirty(static::UPDATED_AT)) { + $this->setUpdatedAt($time); + } + + if (! $this->exists && ! $this->isDirty(static::CREATED_AT)) { + $this->setCreatedAt($time); + } + } + + /** + * Set the value of the "created at" attribute. + * + * @param mixed $value + * @return $this + */ + public function setCreatedAt($value) + { + $this->{static::CREATED_AT} = $value; + + return $this; + } + + /** + * Set the value of the "updated at" attribute. + * + * @param mixed $value + * @return $this + */ + public function setUpdatedAt($value) + { + $this->{static::UPDATED_AT} = $value; + + return $this; + } + + /** + * Get the name of the "created at" column. + * + * @return string + */ + public function getCreatedAtColumn() + { + return static::CREATED_AT; + } + + /** + * Get the name of the "updated at" column. + * + * @return string + */ + public function getUpdatedAtColumn() + { + return static::UPDATED_AT; + } + + /** + * Get a fresh timestamp for the model. + * + * @return \Carbon\Carbon + */ + public function freshTimestamp() + { + return new Carbon; + } + + /** + * Get a fresh timestamp for the model. + * + * @return string + */ + public function freshTimestampString() + { + return $this->fromDateTime($this->freshTimestamp()); + } + + /** + * Get a new query builder for the model's table. + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQuery() + { + $builder = $this->newQueryWithoutScopes(); + + return $this->applyGlobalScopes($builder); + } + + /** + * Get a new query instance without a given scope. + * + * @param \Illuminate\Database\Eloquent\ScopeInterface $scope + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQueryWithoutScope($scope) + { + $this->getGlobalScope($scope)->remove($builder = $this->newQuery(), $this); + + return $builder; + } + + /** + * Get a new query builder that doesn't have any global scopes. + * + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function newQueryWithoutScopes() + { + $builder = $this->newEloquentBuilder( + $this->newBaseQueryBuilder() + ); + + // Once we have the query builders, we will set the model instances so the + // builder can easily access any information it may need from the model + // while it is constructing and executing various queries against it. + return $builder->setModel($this)->with($this->with); + } + + /** + * Apply all of the global scopes to an Eloquent builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return \Illuminate\Database\Eloquent\Builder + */ + public function applyGlobalScopes($builder) + { + foreach ($this->getGlobalScopes() as $scope) { + $scope->apply($builder, $this); + } + + return $builder; + } + + /** + * Remove all of the global scopes from an Eloquent builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return \Illuminate\Database\Eloquent\Builder + */ + public function removeGlobalScopes($builder) + { + foreach ($this->getGlobalScopes() as $scope) { + $scope->remove($builder, $this); + } + + return $builder; + } + + /** + * Create a new Eloquent query builder for the model. + * + * @param \Illuminate\Database\Query\Builder $query + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function newEloquentBuilder($query) + { + return new Builder($query); + } + + /** + * Get a new query builder instance for the connection. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function newBaseQueryBuilder() + { + $conn = $this->getConnection(); + + $grammar = $conn->getQueryGrammar(); + + return new QueryBuilder($conn, $grammar, $conn->getPostProcessor()); + } + + /** + * Create a new Eloquent Collection instance. + * + * @param array $models + * @return \Illuminate\Database\Eloquent\Collection + */ + public function newCollection(array $models = []) + { + return new Collection($models); + } + + /** + * Create a new pivot model instance. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @param array $attributes + * @param string $table + * @param bool $exists + * @return \Illuminate\Database\Eloquent\Relations\Pivot + */ + public function newPivot(Model $parent, array $attributes, $table, $exists) + { + return new Pivot($parent, $attributes, $table, $exists); + } + + /** + * Get the table associated with the model. + * + * @return string + */ + public function getTable() + { + if (isset($this->table)) { + return $this->table; + } + + return str_replace('\\', '', Str::snake(Str::plural(class_basename($this)))); + } + + /** + * Set the table associated with the model. + * + * @param string $table + * @return $this + */ + public function setTable($table) + { + $this->table = $table; + + return $this; + } + + /** + * Get the value of the model's primary key. + * + * @return mixed + */ + public function getKey() + { + return $this->getAttribute($this->getKeyName()); + } + + /** + * Get the queueable identity for the entity. + * + * @return mixed + */ + public function getQueueableId() + { + return $this->getKey(); + } + + /** + * Get the primary key for the model. + * + * @return string + */ + public function getKeyName() + { + return $this->primaryKey; + } + + /** + * Set the primary key for the model. + * + * @param string $key + * @return $this + */ + public function setKeyName($key) + { + $this->primaryKey = $key; + + return $this; + } + + /** + * Get the table qualified key name. + * + * @return string + */ + public function getQualifiedKeyName() + { + return $this->getTable().'.'.$this->getKeyName(); + } + + /** + * Get the value of the model's route key. + * + * @return mixed + */ + public function getRouteKey() + { + return $this->getAttribute($this->getRouteKeyName()); + } + + /** + * Get the route key for the model. + * + * @return string + */ + public function getRouteKeyName() + { + return $this->getKeyName(); + } + + /** + * Determine if the model uses timestamps. + * + * @return bool + */ + public function usesTimestamps() + { + return $this->timestamps; + } + + /** + * Get the polymorphic relationship columns. + * + * @param string $name + * @param string $type + * @param string $id + * @return array + */ + protected function getMorphs($name, $type, $id) + { + $type = $type ?: $name.'_type'; + + $id = $id ?: $name.'_id'; + + return [$type, $id]; + } + + /** + * Get the class name for polymorphic relations. + * + * @return string + */ + public function getMorphClass() + { + $morphMap = Relation::morphMap(); + + $class = get_class($this); + + if (! empty($morphMap) && in_array($class, $morphMap)) { + return array_search($class, $morphMap, true); + } + + return $this->morphClass ?: $class; + } + + /** + * Get the number of models to return per page. + * + * @return int + */ + public function getPerPage() + { + return $this->perPage; + } + + /** + * Set the number of models to return per page. + * + * @param int $perPage + * @return $this + */ + public function setPerPage($perPage) + { + $this->perPage = $perPage; + + return $this; + } + + /** + * Get the default foreign key name for the model. + * + * @return string + */ + public function getForeignKey() + { + return Str::snake(class_basename($this)).'_id'; + } + + /** + * Get the hidden attributes for the model. + * + * @return array + */ + public function getHidden() + { + return $this->hidden; + } + + /** + * Set the hidden attributes for the model. + * + * @param array $hidden + * @return $this + */ + public function setHidden(array $hidden) + { + $this->hidden = $hidden; + + return $this; + } + + /** + * Add hidden attributes for the model. + * + * @param array|string|null $attributes + * @return void + */ + public function addHidden($attributes = null) + { + $attributes = is_array($attributes) ? $attributes : func_get_args(); + + $this->hidden = array_merge($this->hidden, $attributes); + } + + /** + * Make the given, typically hidden, attributes visible. + * + * @param array|string $attributes + * @return $this + */ + public function withHidden($attributes) + { + $this->hidden = array_diff($this->hidden, (array) $attributes); + + return $this; + } + + /** + * Get the visible attributes for the model. + * + * @return array + */ + public function getVisible() + { + return $this->visible; + } + + /** + * Set the visible attributes for the model. + * + * @param array $visible + * @return $this + */ + public function setVisible(array $visible) + { + $this->visible = $visible; + + return $this; + } + + /** + * Add visible attributes for the model. + * + * @param array|string|null $attributes + * @return void + */ + public function addVisible($attributes = null) + { + $attributes = is_array($attributes) ? $attributes : func_get_args(); + + $this->visible = array_merge($this->visible, $attributes); + } + + /** + * Set the accessors to append to model arrays. + * + * @param array $appends + * @return $this + */ + public function setAppends(array $appends) + { + $this->appends = $appends; + + return $this; + } + + /** + * Get the fillable attributes for the model. + * + * @return array + */ + public function getFillable() + { + return $this->fillable; + } + + /** + * Set the fillable attributes for the model. + * + * @param array $fillable + * @return $this + */ + public function fillable(array $fillable) + { + $this->fillable = $fillable; + + return $this; + } + + /** + * Get the guarded attributes for the model. + * + * @return array + */ + public function getGuarded() + { + return $this->guarded; + } + + /** + * Set the guarded attributes for the model. + * + * @param array $guarded + * @return $this + */ + public function guard(array $guarded) + { + $this->guarded = $guarded; + + return $this; + } + + /** + * Disable all mass assignable restrictions. + * + * @param bool $state + * @return void + */ + public static function unguard($state = true) + { + static::$unguarded = $state; + } + + /** + * Enable the mass assignment restrictions. + * + * @return void + */ + public static function reguard() + { + static::$unguarded = false; + } + + /** + * Determine if current state is "unguarded". + * + * @return bool + */ + public static function isUnguarded() + { + return static::$unguarded; + } + + /** + * Run the given callable while being unguarded. + * + * @param callable $callback + * @return mixed + */ + public static function unguarded(callable $callback) + { + if (static::$unguarded) { + return $callback(); + } + + static::unguard(); + + try { + return $callback(); + } finally { + static::reguard(); + } + } + + /** + * Determine if the given attribute may be mass assigned. + * + * @param string $key + * @return bool + */ + public function isFillable($key) + { + if (static::$unguarded) { + return true; + } + + // If the key is in the "fillable" array, we can of course assume that it's + // a fillable attribute. Otherwise, we will check the guarded array when + // we need to determine if the attribute is black-listed on the model. + if (in_array($key, $this->fillable)) { + return true; + } + + if ($this->isGuarded($key)) { + return false; + } + + return empty($this->fillable) && ! Str::startsWith($key, '_'); + } + + /** + * Determine if the given key is guarded. + * + * @param string $key + * @return bool + */ + public function isGuarded($key) + { + return in_array($key, $this->guarded) || $this->guarded == ['*']; + } + + /** + * Determine if the model is totally guarded. + * + * @return bool + */ + public function totallyGuarded() + { + return count($this->fillable) == 0 && $this->guarded == ['*']; + } + + /** + * Remove the table name from a given key. + * + * @param string $key + * @return string + */ + protected function removeTableFromKey($key) + { + if (! Str::contains($key, '.')) { + return $key; + } + + return last(explode('.', $key)); + } + + /** + * Get the relationships that are touched on save. + * + * @return array + */ + public function getTouchedRelations() + { + return $this->touches; + } + + /** + * Set the relationships that are touched on save. + * + * @param array $touches + * @return $this + */ + public function setTouchedRelations(array $touches) + { + $this->touches = $touches; + + return $this; + } + + /** + * Get the value indicating whether the IDs are incrementing. + * + * @return bool + */ + public function getIncrementing() + { + return $this->incrementing; + } + + /** + * Set whether IDs are incrementing. + * + * @param bool $value + * @return $this + */ + public function setIncrementing($value) + { + $this->incrementing = $value; + + return $this; + } + + /** + * Convert the model instance to JSON. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->jsonSerialize(), $options); + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Convert the model instance to an array. + * + * @return array + */ + public function toArray() + { + $attributes = $this->attributesToArray(); + + return array_merge($attributes, $this->relationsToArray()); + } + + /** + * Convert the model's attributes to an array. + * + * @return array + */ + public function attributesToArray() + { + $attributes = $this->getArrayableAttributes(); + + // If an attribute is a date, we will cast it to a string after converting it + // to a DateTime / Carbon instance. This is so we will get some consistent + // formatting while accessing attributes vs. arraying / JSONing a model. + foreach ($this->getDates() as $key) { + if (! isset($attributes[$key])) { + continue; + } + + $attributes[$key] = $this->serializeDate( + $this->asDateTime($attributes[$key]) + ); + } + + $mutatedAttributes = $this->getMutatedAttributes(); + + // We want to spin through all the mutated attributes for this model and call + // the mutator for the attribute. We cache off every mutated attributes so + // we don't have to constantly check on attributes that actually change. + foreach ($mutatedAttributes as $key) { + if (! array_key_exists($key, $attributes)) { + continue; + } + + $attributes[$key] = $this->mutateAttributeForArray( + $key, $attributes[$key] + ); + } + + // Next we will handle any casts that have been setup for this model and cast + // the values to their appropriate type. If the attribute has a mutator we + // will not perform the cast on those attributes to avoid any confusion. + foreach ($this->casts as $key => $value) { + if (! array_key_exists($key, $attributes) || + in_array($key, $mutatedAttributes)) { + continue; + } + + $attributes[$key] = $this->castAttribute( + $key, $attributes[$key] + ); + } + + // Here we will grab all of the appended, calculated attributes to this model + // as these attributes are not really in the attributes array, but are run + // when we need to array or JSON the model for convenience to the coder. + foreach ($this->getArrayableAppends() as $key) { + $attributes[$key] = $this->mutateAttributeForArray($key, null); + } + + return $attributes; + } + + /** + * Get an attribute array of all arrayable attributes. + * + * @return array + */ + protected function getArrayableAttributes() + { + return $this->getArrayableItems($this->attributes); + } + + /** + * Get all of the appendable values that are arrayable. + * + * @return array + */ + protected function getArrayableAppends() + { + if (! count($this->appends)) { + return []; + } + + return $this->getArrayableItems( + array_combine($this->appends, $this->appends) + ); + } + + /** + * Get the model's relationships in array form. + * + * @return array + */ + public function relationsToArray() + { + $attributes = []; + + foreach ($this->getArrayableRelations() as $key => $value) { + // If the values implements the Arrayable interface we can just call this + // toArray method on the instances which will convert both models and + // collections to their proper array form and we'll set the values. + if ($value instanceof Arrayable) { + $relation = $value->toArray(); + } + + // If the value is null, we'll still go ahead and set it in this list of + // attributes since null is used to represent empty relationships if + // if it a has one or belongs to type relationships on the models. + elseif (is_null($value)) { + $relation = $value; + } + + // If the relationships snake-casing is enabled, we will snake case this + // key so that the relation attribute is snake cased in this returned + // array to the developers, making this consistent with attributes. + if (static::$snakeAttributes) { + $key = Str::snake($key); + } + + // If the relation value has been set, we will set it on this attributes + // list for returning. If it was not arrayable or null, we'll not set + // the value on the array because it is some type of invalid value. + if (isset($relation) || is_null($value)) { + $attributes[$key] = $relation; + } + + unset($relation); + } + + return $attributes; + } + + /** + * Get an attribute array of all arrayable relations. + * + * @return array + */ + protected function getArrayableRelations() + { + return $this->getArrayableItems($this->relations); + } + + /** + * Get an attribute array of all arrayable values. + * + * @param array $values + * @return array + */ + protected function getArrayableItems(array $values) + { + if (count($this->getVisible()) > 0) { + return array_intersect_key($values, array_flip($this->getVisible())); + } + + return array_diff_key($values, array_flip($this->getHidden())); + } + + /** + * Get an attribute from the model. + * + * @param string $key + * @return mixed + */ + public function getAttribute($key) + { + if (array_key_exists($key, $this->attributes) || $this->hasGetMutator($key)) { + return $this->getAttributeValue($key); + } + + return $this->getRelationValue($key); + } + + /** + * Get a plain attribute (not a relationship). + * + * @param string $key + * @return mixed + */ + public function getAttributeValue($key) + { + $value = $this->getAttributeFromArray($key); + + // If the attribute has a get mutator, we will call that then return what + // it returns as the value, which is useful for transforming values on + // retrieval from the model to a form that is more useful for usage. + if ($this->hasGetMutator($key)) { + return $this->mutateAttribute($key, $value); + } + + // If the attribute exists within the cast array, we will convert it to + // an appropriate native PHP type dependant upon the associated value + // given with the key in the pair. Dayle made this comment line up. + if ($this->hasCast($key)) { + $value = $this->castAttribute($key, $value); + } + + // If the attribute is listed as a date, we will convert it to a DateTime + // instance on retrieval, which makes it quite convenient to work with + // date fields without having to create a mutator for each property. + elseif (in_array($key, $this->getDates())) { + if (! is_null($value)) { + return $this->asDateTime($value); + } + } + + return $value; + } + + /** + * Get a relationship. + * + * @param string $key + * @return mixed + */ + public function getRelationValue($key) + { + // If the key already exists in the relationships array, it just means the + // relationship has already been loaded, so we'll just return it out of + // here because there is no need to query within the relations twice. + if ($this->relationLoaded($key)) { + return $this->relations[$key]; + } + + // If the "attribute" exists as a method on the model, we will just assume + // it is a relationship and will load and return results from the query + // and hydrate the relationship's value on the "relationships" array. + if (method_exists($this, $key)) { + return $this->getRelationshipFromMethod($key); + } + } + + /** + * Get an attribute from the $attributes array. + * + * @param string $key + * @return mixed + */ + protected function getAttributeFromArray($key) + { + if (array_key_exists($key, $this->attributes)) { + return $this->attributes[$key]; + } + } + + /** + * Get a relationship value from a method. + * + * @param string $method + * @return mixed + * + * @throws \LogicException + */ + protected function getRelationshipFromMethod($method) + { + $relations = $this->$method(); + + if (! $relations instanceof Relation) { + throw new LogicException('Relationship method must return an object of type ' + .'Illuminate\Database\Eloquent\Relations\Relation'); + } + + return $this->relations[$method] = $relations->getResults(); + } + + /** + * Determine if a get mutator exists for an attribute. + * + * @param string $key + * @return bool + */ + public function hasGetMutator($key) + { + return method_exists($this, 'get'.Str::studly($key).'Attribute'); + } + + /** + * Get the value of an attribute using its mutator. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function mutateAttribute($key, $value) + { + return $this->{'get'.Str::studly($key).'Attribute'}($value); + } + + /** + * Get the value of an attribute using its mutator for array conversion. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function mutateAttributeForArray($key, $value) + { + $value = $this->mutateAttribute($key, $value); + + return $value instanceof Arrayable ? $value->toArray() : $value; + } + + /** + * Determine whether an attribute should be cast to a native type. + * + * @param string $key + * @return bool + */ + protected function hasCast($key) + { + return array_key_exists($key, $this->casts); + } + + /** + * Determine whether a value is Date / DateTime castable for inbound manipulation. + * + * @param string $key + * @return bool + */ + protected function isDateCastable($key) + { + return $this->hasCast($key) && + in_array($this->getCastType($key), ['date', 'datetime'], true); + } + + /** + * Determine whether a value is JSON castable for inbound manipulation. + * + * @param string $key + * @return bool + */ + protected function isJsonCastable($key) + { + return $this->hasCast($key) && + in_array($this->getCastType($key), ['array', 'json', 'object', 'collection'], true); + } + + /** + * Get the type of cast for a model attribute. + * + * @param string $key + * @return string + */ + protected function getCastType($key) + { + return trim(strtolower($this->casts[$key])); + } + + /** + * Cast an attribute to a native PHP type. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function castAttribute($key, $value) + { + if (is_null($value)) { + return $value; + } + + switch ($this->getCastType($key)) { + case 'int': + case 'integer': + return (int) $value; + case 'real': + case 'float': + case 'double': + return (float) $value; + case 'string': + return (string) $value; + case 'bool': + case 'boolean': + return (bool) $value; + case 'object': + return $this->fromJson($value, true); + case 'array': + case 'json': + return $this->fromJson($value); + case 'collection': + return new BaseCollection($this->fromJson($value)); + case 'date': + case 'datetime': + return $this->asDateTime($value); + default: + return $value; + } + } + + /** + * Set a given attribute on the model. + * + * @param string $key + * @param mixed $value + * @return $this + */ + public function setAttribute($key, $value) + { + // First we will check for the presence of a mutator for the set operation + // which simply lets the developers tweak the attribute as it is set on + // the model, such as "json_encoding" an listing of data for storage. + if ($this->hasSetMutator($key)) { + $method = 'set'.Str::studly($key).'Attribute'; + + return $this->{$method}($value); + } + + // If an attribute is listed as a "date", we'll convert it from a DateTime + // instance into a form proper for storage on the database tables using + // the connection grammar's date format. We will auto set the values. + elseif ($value && (in_array($key, $this->getDates()) || $this->isDateCastable($key))) { + $value = $this->fromDateTime($value); + } + + if ($this->isJsonCastable($key) && ! is_null($value)) { + $value = $this->asJson($value); + } + + $this->attributes[$key] = $value; + + return $this; + } + + /** + * Determine if a set mutator exists for an attribute. + * + * @param string $key + * @return bool + */ + public function hasSetMutator($key) + { + return method_exists($this, 'set'.Str::studly($key).'Attribute'); + } + + /** + * Get the attributes that should be converted to dates. + * + * @return array + */ + public function getDates() + { + $defaults = [static::CREATED_AT, static::UPDATED_AT]; + + return $this->timestamps ? array_merge($this->dates, $defaults) : $this->dates; + } + + /** + * Convert a DateTime to a storable string. + * + * @param \DateTime|int $value + * @return string + */ + public function fromDateTime($value) + { + $format = $this->getDateFormat(); + + $value = $this->asDateTime($value); + + return $value->format($format); + } + + /** + * Return a timestamp as DateTime object. + * + * @param mixed $value + * @return \Carbon\Carbon + */ + protected function asDateTime($value) + { + // If this value is already a Carbon instance, we shall just return it as is. + // This prevents us having to reinstantiate a Carbon instance when we know + // it already is one, which wouldn't be fulfilled by the DateTime check. + if ($value instanceof Carbon) { + return $value; + } + + // If the value is already a DateTime instance, we will just skip the rest of + // these checks since they will be a waste of time, and hinder performance + // when checking the field. We will just return the DateTime right away. + if ($value instanceof DateTime) { + return Carbon::instance($value); + } + + // If this value is an integer, we will assume it is a UNIX timestamp's value + // and format a Carbon object from this timestamp. This allows flexibility + // when defining your date fields as they might be UNIX timestamps here. + if (is_numeric($value)) { + return Carbon::createFromTimestamp($value); + } + + // If the value is in simply year, month, day format, we will instantiate the + // Carbon instances from that format. Again, this provides for simple date + // fields on the database, while still supporting Carbonized conversion. + if (preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $value)) { + return Carbon::createFromFormat('Y-m-d', $value)->startOfDay(); + } + + // Finally, we will just assume this date is in the format used by default on + // the database connection and use that format to create the Carbon object + // that is returned back out to the developers after we convert it here. + return Carbon::createFromFormat($this->getDateFormat(), $value); + } + + /** + * Prepare a date for array / JSON serialization. + * + * @param \DateTime $date + * @return string + */ + protected function serializeDate(DateTime $date) + { + return $date->format($this->getDateFormat()); + } + + /** + * Get the format for database stored dates. + * + * @return string + */ + protected function getDateFormat() + { + return $this->dateFormat ?: $this->getConnection()->getQueryGrammar()->getDateFormat(); + } + + /** + * Set the date format used by the model. + * + * @param string $format + * @return $this + */ + public function setDateFormat($format) + { + $this->dateFormat = $format; + + return $this; + } + + /** + * Encode the given value as JSON. + * + * @param mixed $value + * @return string + */ + protected function asJson($value) + { + return json_encode($value); + } + + /** + * Decode the given JSON back into an array or object. + * + * @param string $value + * @param bool $asObject + * @return mixed + */ + public function fromJson($value, $asObject = false) + { + return json_decode($value, ! $asObject); + } + + /** + * Clone the model into a new, non-existing instance. + * + * @param array|null $except + * @return \Illuminate\Database\Eloquent\Model + */ + public function replicate(array $except = null) + { + $except = $except ?: [ + $this->getKeyName(), + $this->getCreatedAtColumn(), + $this->getUpdatedAtColumn(), + ]; + + $attributes = Arr::except($this->attributes, $except); + + with($instance = new static)->setRawAttributes($attributes); + + return $instance->setRelations($this->relations); + } + + /** + * Get all of the current attributes on the model. + * + * @return array + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Set the array of model attributes. No checking is done. + * + * @param array $attributes + * @param bool $sync + * @return $this + */ + public function setRawAttributes(array $attributes, $sync = false) + { + $this->attributes = $attributes; + + if ($sync) { + $this->syncOriginal(); + } + + return $this; + } + + /** + * Get the model's original attribute values. + * + * @param string|null $key + * @param mixed $default + * @return array + */ + public function getOriginal($key = null, $default = null) + { + return Arr::get($this->original, $key, $default); + } + + /** + * Sync the original attributes with the current. + * + * @return $this + */ + public function syncOriginal() + { + $this->original = $this->attributes; + + return $this; + } + + /** + * Sync a single original attribute with its current value. + * + * @param string $attribute + * @return $this + */ + public function syncOriginalAttribute($attribute) + { + $this->original[$attribute] = $this->attributes[$attribute]; + + return $this; + } + + /** + * Determine if the model or given attribute(s) have been modified. + * + * @param array|string|null $attributes + * @return bool + */ + public function isDirty($attributes = null) + { + $dirty = $this->getDirty(); + + if (is_null($attributes)) { + return count($dirty) > 0; + } + + if (! is_array($attributes)) { + $attributes = func_get_args(); + } + + foreach ($attributes as $attribute) { + if (array_key_exists($attribute, $dirty)) { + return true; + } + } + + return false; + } + + /** + * Get the attributes that have been changed since last sync. + * + * @return array + */ + public function getDirty() + { + $dirty = []; + + foreach ($this->attributes as $key => $value) { + if (! array_key_exists($key, $this->original)) { + $dirty[$key] = $value; + } elseif ($value !== $this->original[$key] && + ! $this->originalIsNumericallyEquivalent($key)) { + $dirty[$key] = $value; + } + } + + return $dirty; + } + + /** + * Determine if the new and old values for a given key are numerically equivalent. + * + * @param string $key + * @return bool + */ + protected function originalIsNumericallyEquivalent($key) + { + $current = $this->attributes[$key]; + + $original = $this->original[$key]; + + return is_numeric($current) && is_numeric($original) && strcmp((string) $current, (string) $original) === 0; + } + + /** + * Get all the loaded relations for the instance. + * + * @return array + */ + public function getRelations() + { + return $this->relations; + } + + /** + * Get a specified relationship. + * + * @param string $relation + * @return mixed + */ + public function getRelation($relation) + { + return $this->relations[$relation]; + } + + /** + * Determine if the given relation is loaded. + * + * @param string $key + * @return bool + */ + public function relationLoaded($key) + { + return array_key_exists($key, $this->relations); + } + + /** + * Set the specific relationship in the model. + * + * @param string $relation + * @param mixed $value + * @return $this + */ + public function setRelation($relation, $value) + { + $this->relations[$relation] = $value; + + return $this; + } + + /** + * Set the entire relations array on the model. + * + * @param array $relations + * @return $this + */ + public function setRelations(array $relations) + { + $this->relations = $relations; + + return $this; + } + + /** + * Get the database connection for the model. + * + * @return \Illuminate\Database\Connection + */ + public function getConnection() + { + return static::resolveConnection($this->connection); + } + + /** + * Get the current connection name for the model. + * + * @return string + */ + public function getConnectionName() + { + return $this->connection; + } + + /** + * Set the connection associated with the model. + * + * @param string $name + * @return $this + */ + public function setConnection($name) + { + $this->connection = $name; + + return $this; + } + + /** + * Resolve a connection instance. + * + * @param string|null $connection + * @return \Illuminate\Database\Connection + */ + public static function resolveConnection($connection = null) + { + return static::$resolver->connection($connection); + } + + /** + * Get the connection resolver instance. + * + * @return \Illuminate\Database\ConnectionResolverInterface + */ + public static function getConnectionResolver() + { + return static::$resolver; + } + + /** + * Set the connection resolver instance. + * + * @param \Illuminate\Database\ConnectionResolverInterface $resolver + * @return void + */ + public static function setConnectionResolver(Resolver $resolver) + { + static::$resolver = $resolver; + } + + /** + * Unset the connection resolver for models. + * + * @return void + */ + public static function unsetConnectionResolver() + { + static::$resolver = null; + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public static function getEventDispatcher() + { + return static::$dispatcher; + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher + * @return void + */ + public static function setEventDispatcher(Dispatcher $dispatcher) + { + static::$dispatcher = $dispatcher; + } + + /** + * Unset the event dispatcher for models. + * + * @return void + */ + public static function unsetEventDispatcher() + { + static::$dispatcher = null; + } + + /** + * Get the mutated attributes for a given instance. + * + * @return array + */ + public function getMutatedAttributes() + { + $class = get_class($this); + + if (! isset(static::$mutatorCache[$class])) { + static::cacheMutatedAttributes($class); + } + + return static::$mutatorCache[$class]; + } + + /** + * Extract and cache all the mutated attributes of a class. + * + * @param string $class + * @return void + */ + public static function cacheMutatedAttributes($class) + { + $mutatedAttributes = []; + + // Here we will extract all of the mutated attributes so that we can quickly + // spin through them after we export models to their array form, which we + // need to be fast. This'll let us know the attributes that can mutate. + if (preg_match_all('/(?<=^|;)get([^;]+?)Attribute(;|$)/', implode(';', get_class_methods($class)), $matches)) { + foreach ($matches[1] as $match) { + if (static::$snakeAttributes) { + $match = Str::snake($match); + } + + $mutatedAttributes[] = lcfirst($match); + } + } + + static::$mutatorCache[$class] = $mutatedAttributes; + } + + /** + * Dynamically retrieve attributes on the model. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->getAttribute($key); + } + + /** + * Dynamically set attributes on the model. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this->setAttribute($key, $value); + } + + /** + * Determine if the given attribute exists. + * + * @param mixed $offset + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->$offset); + } + + /** + * Get the value for a given offset. + * + * @param mixed $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->$offset; + } + + /** + * Set the value for a given offset. + * + * @param mixed $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset, $value) + { + $this->$offset = $value; + } + + /** + * Unset the value for a given offset. + * + * @param mixed $offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->$offset); + } + + /** + * Determine if an attribute or relation exists on the model. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + if (isset($this->attributes[$key]) || isset($this->relations[$key])) { + return true; + } + + if (method_exists($this, $key) && $this->$key && isset($this->relations[$key])) { + return true; + } + + return $this->hasGetMutator($key) && ! is_null($this->getAttributeValue($key)); + } + + /** + * Unset an attribute on the model. + * + * @param string $key + * @return void + */ + public function __unset($key) + { + unset($this->attributes[$key], $this->relations[$key]); + } + + /** + * Handle dynamic method calls into the model. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (in_array($method, ['increment', 'decrement'])) { + return call_user_func_array([$this, $method], $parameters); + } + + $query = $this->newQuery(); + + return call_user_func_array([$query, $method], $parameters); + } + + /** + * Handle dynamic static method calls into the method. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + $instance = new static; + + return call_user_func_array([$instance, $method], $parameters); + } + + /** + * Convert the model to its string representation. + * + * @return string + */ + public function __toString() + { + return $this->toJson(); + } + + /** + * When a model is being unserialized, check if it needs to be booted. + * + * @return void + */ + public function __wakeup() + { + $this->bootIfNotBooted(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/ModelNotFoundException.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/ModelNotFoundException.php index 84be36e..102683a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/ModelNotFoundException.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/ModelNotFoundException.php @@ -1,39 +1,40 @@ -model = $model; +namespace Illuminate\Database\Eloquent; - $this->message = "No query results for model [{$model}]."; - - return $this; - } - - /** - * Get the affected Eloquent model. - * - * @return string - */ - public function getModel() - { - return $this->model; - } +use RuntimeException; +class ModelNotFoundException extends RuntimeException +{ + /** + * Name of the affected Eloquent model. + * + * @var string + */ + protected $model; + + /** + * Set the affected Eloquent model. + * + * @param string $model + * @return $this + */ + public function setModel($model) + { + $this->model = $model; + + $this->message = "No query results for model [{$model}]."; + + return $this; + } + + /** + * Get the affected Eloquent model. + * + * @return string + */ + public function getModel() + { + return $this->model; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/QueueEntityResolver.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/QueueEntityResolver.php index 2dc2be5..0e630c7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/QueueEntityResolver.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/QueueEntityResolver.php @@ -1,27 +1,27 @@ -find($id); - - if ($instance) - { - return $instance; - } +class QueueEntityResolver implements EntityResolverContract +{ + /** + * Resolve the entity for the given ID. + * + * @param string $type + * @param mixed $id + * @return mixed + */ + public function resolve($type, $id) + { + $instance = (new $type)->find($id); - throw new EntityNotFoundException($type, $id); - } + if ($instance) { + return $instance; + } + throw new EntityNotFoundException($type, $id); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php index 2e1d01e..968749f 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php @@ -1,308 +1,308 @@ -otherKey = $otherKey; - $this->relation = $relation; - $this->foreignKey = $foreignKey; - - parent::__construct($query, $parent); - } - - /** - * Get the results of the relationship. - * - * @return mixed - */ - public function getResults() - { - return $this->query->first(); - } - - /** - * Set the base constraints on the relation query. - * - * @return void - */ - public function addConstraints() - { - if (static::$constraints) - { - // For belongs to relationships, which are essentially the inverse of has one - // or has many relationships, we need to actually query on the primary key - // of the related models matching on the foreign key that's on a parent. - $table = $this->related->getTable(); - - $this->query->where($table.'.'.$this->otherKey, '=', $this->parent->{$this->foreignKey}); - } - } - - /** - * Add the constraints for a relationship count query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parent - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationCountQuery(Builder $query, Builder $parent) - { - if ($parent->getQuery()->from == $query->getQuery()->from) - { - return $this->getRelationCountQueryForSelfRelation($query, $parent); - } - - $query->select(new Expression('count(*)')); - - $otherKey = $this->wrap($query->getModel()->getTable().'.'.$this->otherKey); - - return $query->where($this->getQualifiedForeignKey(), '=', new Expression($otherKey)); - } - - /** - * Add the constraints for a relationship count query on the same table. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parent - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationCountQueryForSelfRelation(Builder $query, Builder $parent) - { - $query->select(new Expression('count(*)')); - - $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash()); - - $key = $this->wrap($this->getQualifiedForeignKey()); - - return $query->where($hash.'.'.$query->getModel()->getKeyName(), '=', new Expression($key)); - } - - /** - * Get a relationship join table hash. - * - * @return string - */ - public function getRelationCountHash() - { - return 'self_'.md5(microtime(true)); - } - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - public function addEagerConstraints(array $models) - { - // We'll grab the primary key name of the related models since it could be set to - // a non-standard name and not "id". We will then construct the constraint for - // our eagerly loading query so it returns the proper models from execution. - $key = $this->related->getTable().'.'.$this->otherKey; - - $this->query->whereIn($key, $this->getEagerModelKeys($models)); - } - - /** - * Gather the keys from an array of related models. - * - * @param array $models - * @return array - */ - protected function getEagerModelKeys(array $models) - { - $keys = array(); - - // First we need to gather all of the keys from the parent models so we know what - // to query for via the eager loading query. We will add them to an array then - // execute a "where in" statement to gather up all of those related records. - foreach ($models as $model) - { - if ( ! is_null($value = $model->{$this->foreignKey})) - { - $keys[] = $value; - } - } - - // If there are no keys that were not null we will just return an array with 0 in - // it so the query doesn't fail, but will not return any results, which should - // be what this developer is expecting in a case where this happens to them. - if (count($keys) == 0) - { - return array(0); - } - - return array_values(array_unique($keys)); - } - - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) - { - $model->setRelation($relation, null); - } - - return $models; - } - - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - $foreign = $this->foreignKey; - - $other = $this->otherKey; - - // First we will get to build a dictionary of the child models by their primary - // key of the relationship, then we can easily match the children back onto - // the parents using that dictionary and the primary key of the children. - $dictionary = array(); - - foreach ($results as $result) - { - $dictionary[$result->getAttribute($other)] = $result; - } - - // Once we have the dictionary constructed, we can loop through all the parents - // and match back onto their children using these keys of the dictionary and - // the primary key of the children to map them onto the correct instances. - foreach ($models as $model) - { - if (isset($dictionary[$model->$foreign])) - { - $model->setRelation($relation, $dictionary[$model->$foreign]); - } - } - - return $models; - } - - /** - * Associate the model instance to the given parent. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return \Illuminate\Database\Eloquent\Model - */ - public function associate(Model $model) - { - $this->parent->setAttribute($this->foreignKey, $model->getAttribute($this->otherKey)); - - return $this->parent->setRelation($this->relation, $model); - } - - /** - * Dissociate previously associated model from the given parent. - * - * @return \Illuminate\Database\Eloquent\Model - */ - public function dissociate() - { - $this->parent->setAttribute($this->foreignKey, null); - - return $this->parent->setRelation($this->relation, null); - } - - /** - * Update the parent model on the relationship. - * - * @param array $attributes - * @return mixed - */ - public function update(array $attributes) - { - $instance = $this->getResults(); - - return $instance->fill($attributes)->save(); - } - - /** - * Get the foreign key of the relationship. - * - * @return string - */ - public function getForeignKey() - { - return $this->foreignKey; - } - - /** - * Get the fully qualified foreign key of the relationship. - * - * @return string - */ - public function getQualifiedForeignKey() - { - return $this->parent->getTable().'.'.$this->foreignKey; - } - - /** - * Get the associated key of the relationship. - * - * @return string - */ - public function getOtherKey() - { - return $this->otherKey; - } - - /** - * Get the fully qualified associated key of the relationship. - * - * @return string - */ - public function getQualifiedOtherKeyName() - { - return $this->related->getTable().'.'.$this->otherKey; - } - +class BelongsTo extends Relation +{ + /** + * The foreign key of the parent model. + * + * @var string + */ + protected $foreignKey; + + /** + * The associated key on the parent model. + * + * @var string + */ + protected $otherKey; + + /** + * The name of the relationship. + * + * @var string + */ + protected $relation; + + /** + * Create a new belongs to relationship instance. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $foreignKey + * @param string $otherKey + * @param string $relation + * @return void + */ + public function __construct(Builder $query, Model $parent, $foreignKey, $otherKey, $relation) + { + $this->otherKey = $otherKey; + $this->relation = $relation; + $this->foreignKey = $foreignKey; + + parent::__construct($query, $parent); + } + + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + return $this->query->first(); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + if (static::$constraints) { + // For belongs to relationships, which are essentially the inverse of has one + // or has many relationships, we need to actually query on the primary key + // of the related models matching on the foreign key that's on a parent. + $table = $this->related->getTable(); + + $this->query->where($table.'.'.$this->otherKey, '=', $this->parent->{$this->foreignKey}); + } + } + + /** + * Add the constraints for a relationship count query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parent + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationCountQuery(Builder $query, Builder $parent) + { + if ($parent->getQuery()->from == $query->getQuery()->from) { + return $this->getRelationCountQueryForSelfRelation($query, $parent); + } + + $query->select(new Expression('count(*)')); + + $otherKey = $this->wrap($query->getModel()->getTable().'.'.$this->otherKey); + + return $query->where($this->getQualifiedForeignKey(), '=', new Expression($otherKey)); + } + + /** + * Add the constraints for a relationship count query on the same table. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parent + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationCountQueryForSelfRelation(Builder $query, Builder $parent) + { + $query->select(new Expression('count(*)')); + + $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash()); + + $query->getModel()->setTable($hash); + + $key = $this->wrap($this->getQualifiedForeignKey()); + + return $query->where($hash.'.'.$query->getModel()->getKeyName(), '=', new Expression($key)); + } + + /** + * Get a relationship join table hash. + * + * @return string + */ + public function getRelationCountHash() + { + return 'self_'.md5(microtime(true)); + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + // We'll grab the primary key name of the related models since it could be set to + // a non-standard name and not "id". We will then construct the constraint for + // our eagerly loading query so it returns the proper models from execution. + $key = $this->related->getTable().'.'.$this->otherKey; + + $this->query->whereIn($key, $this->getEagerModelKeys($models)); + } + + /** + * Gather the keys from an array of related models. + * + * @param array $models + * @return array + */ + protected function getEagerModelKeys(array $models) + { + $keys = []; + + // First we need to gather all of the keys from the parent models so we know what + // to query for via the eager loading query. We will add them to an array then + // execute a "where in" statement to gather up all of those related records. + foreach ($models as $model) { + if (! is_null($value = $model->{$this->foreignKey})) { + $keys[] = $value; + } + } + + // If there are no keys that were not null we will just return an array with 0 in + // it so the query doesn't fail, but will not return any results, which should + // be what this developer is expecting in a case where this happens to them. + if (count($keys) == 0) { + return [0]; + } + + return array_values(array_unique($keys)); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, null); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + $foreign = $this->foreignKey; + + $other = $this->otherKey; + + // First we will get to build a dictionary of the child models by their primary + // key of the relationship, then we can easily match the children back onto + // the parents using that dictionary and the primary key of the children. + $dictionary = []; + + foreach ($results as $result) { + $dictionary[$result->getAttribute($other)] = $result; + } + + // Once we have the dictionary constructed, we can loop through all the parents + // and match back onto their children using these keys of the dictionary and + // the primary key of the children to map them onto the correct instances. + foreach ($models as $model) { + if (isset($dictionary[$model->$foreign])) { + $model->setRelation($relation, $dictionary[$model->$foreign]); + } + } + + return $models; + } + + /** + * Associate the model instance to the given parent. + * + * @param \Illuminate\Database\Eloquent\Model|int $model + * @return \Illuminate\Database\Eloquent\Model + */ + public function associate($model) + { + $otherKey = ($model instanceof Model ? $model->getAttribute($this->otherKey) : $model); + + $this->parent->setAttribute($this->foreignKey, $otherKey); + + if ($model instanceof Model) { + $this->parent->setRelation($this->relation, $model); + } + + return $this->parent; + } + + /** + * Dissociate previously associated model from the given parent. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function dissociate() + { + $this->parent->setAttribute($this->foreignKey, null); + + return $this->parent->setRelation($this->relation, null); + } + + /** + * Update the parent model on the relationship. + * + * @param array $attributes + * @return mixed + */ + public function update(array $attributes) + { + $instance = $this->getResults(); + + return $instance->fill($attributes)->save(); + } + + /** + * Get the foreign key of the relationship. + * + * @return string + */ + public function getForeignKey() + { + return $this->foreignKey; + } + + /** + * Get the fully qualified foreign key of the relationship. + * + * @return string + */ + public function getQualifiedForeignKey() + { + return $this->parent->getTable().'.'.$this->foreignKey; + } + + /** + * Get the associated key of the relationship. + * + * @return string + */ + public function getOtherKey() + { + return $this->otherKey; + } + + /** + * Get the fully qualified associated key of the relationship. + * + * @return string + */ + public function getQualifiedOtherKeyName() + { + return $this->related->getTable().'.'.$this->otherKey; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php index 8b9d2a1..809e1e7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php @@ -1,1230 +1,1255 @@ -table = $table; - $this->otherKey = $otherKey; - $this->foreignKey = $foreignKey; - $this->relationName = $relationName; - - parent::__construct($query, $parent); - } - - /** - * Get the results of the relationship. - * - * @return mixed - */ - public function getResults() - { - return $this->get(); - } - - /** - * Set a where clause for a pivot table column. - * - * @param string $column - * @param string $operator - * @param mixed $value - * @param string $boolean - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany - */ - public function wherePivot($column, $operator = null, $value = null, $boolean = 'and') - { - $this->pivotWheres[] = func_get_args(); - - return $this->where($this->table.'.'.$column, $operator, $value, $boolean); - } - - /** - * Set an or where clause for a pivot table column. - * - * @param string $column - * @param string $operator - * @param mixed $value - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany - */ - public function orWherePivot($column, $operator = null, $value = null) - { - return $this->wherePivot($column, $operator, $value, 'or'); - } - - /** - * Execute the query and get the first result. - * - * @param array $columns - * @return mixed - */ - public function first($columns = array('*')) - { - $results = $this->take(1)->get($columns); - - return count($results) > 0 ? $results->first() : null; - } - - /** - * Execute the query and get the first result or throw an exception. - * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|static - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException - */ - public function firstOrFail($columns = array('*')) - { - if ( ! is_null($model = $this->first($columns))) return $model; - - throw new ModelNotFoundException; - } - - /** - * Execute the query as a "select" statement. - * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Collection - */ - public function get($columns = array('*')) - { - // First we'll add the proper select columns onto the query so it is run with - // the proper columns. Then, we will get the results and hydrate out pivot - // models with the result of those columns as a separate model relation. - $columns = $this->query->getQuery()->columns ? array() : $columns; - - $select = $this->getSelectColumns($columns); - - $models = $this->query->addSelect($select)->getModels(); - - $this->hydratePivotRelation($models); - - // If we actually found models we will also eager load any relationships that - // have been specified as needing to be eager loaded. This will solve the - // n + 1 query problem for the developer and also increase performance. - if (count($models) > 0) - { - $models = $this->query->eagerLoadRelations($models); - } - - return $this->related->newCollection($models); - } - - /** - * Get a paginator for the "select" statement. - * - * @param int $perPage - * @param array $columns - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator - */ - public function paginate($perPage = null, $columns = array('*')) - { - $this->query->addSelect($this->getSelectColumns($columns)); - - $paginator = $this->query->paginate($perPage, $columns); - - $this->hydratePivotRelation($paginator->items()); - - return $paginator; - } - - /** - * Paginate the given query into a simple paginator. - * - * @param int $perPage - * @param array $columns - * @return \Illuminate\Contracts\Pagination\Paginator - */ - public function simplePaginate($perPage = null, $columns = array('*')) - { - $this->query->addSelect($this->getSelectColumns($columns)); - - $paginator = $this->query->simplePaginate($perPage, $columns); - - $this->hydratePivotRelation($paginator->items()); - - return $paginator; - } - - /** - * Chunk the results of the query. - * - * @param int $count - * @param callable $callback - * @return void - */ - public function chunk($count, callable $callback) - { - $this->query->addSelect($this->getSelectColumns()); - - $this->query->chunk($count, function($results) use ($callback) - { - $this->hydratePivotRelation($results->all()); - - call_user_func($callback, $results); - }); - } - - /** - * Hydrate the pivot table relationship on the models. - * - * @param array $models - * @return void - */ - protected function hydratePivotRelation(array $models) - { - // To hydrate the pivot relationship, we will just gather the pivot attributes - // and create a new Pivot model, which is basically a dynamic model that we - // will set the attributes, table, and connections on so it they be used. - foreach ($models as $model) - { - $pivot = $this->newExistingPivot($this->cleanPivotAttributes($model)); - - $model->setRelation('pivot', $pivot); - } - } - - /** - * Get the pivot attributes from a model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return array - */ - protected function cleanPivotAttributes(Model $model) - { - $values = array(); - - foreach ($model->getAttributes() as $key => $value) - { - // To get the pivots attributes we will just take any of the attributes which - // begin with "pivot_" and add those to this arrays, as well as unsetting - // them from the parent's models since they exist in a different table. - if (strpos($key, 'pivot_') === 0) - { - $values[substr($key, 6)] = $value; - - unset($model->$key); - } - } - - return $values; - } - - /** - * Set the base constraints on the relation query. - * - * @return void - */ - public function addConstraints() - { - $this->setJoin(); - - if (static::$constraints) $this->setWhere(); - } - - /** - * Add the constraints for a relationship count query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parent - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationCountQuery(Builder $query, Builder $parent) - { - if ($parent->getQuery()->from == $query->getQuery()->from) - { - return $this->getRelationCountQueryForSelfJoin($query, $parent); - } - - $this->setJoin($query); - - return parent::getRelationCountQuery($query, $parent); - } - - /** - * Add the constraints for a relationship count query on the same table. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parent - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationCountQueryForSelfJoin(Builder $query, Builder $parent) - { - $query->select(new Expression('count(*)')); - - $query->from($this->table.' as '.$hash = $this->getRelationCountHash()); - - $key = $this->wrap($this->getQualifiedParentKeyName()); - - return $query->where($hash.'.'.$this->foreignKey, '=', new Expression($key)); - } - - /** - * Get a relationship join table hash. - * - * @return string - */ - public function getRelationCountHash() - { - return 'self_'.md5(microtime(true)); - } - - /** - * Set the select clause for the relation query. - * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany - */ - protected function getSelectColumns(array $columns = array('*')) - { - if ($columns == array('*')) - { - $columns = array($this->related->getTable().'.*'); - } - - return array_merge($columns, $this->getAliasedPivotColumns()); - } - - /** - * Get the pivot columns for the relation. - * - * @return array - */ - protected function getAliasedPivotColumns() - { - $defaults = array($this->foreignKey, $this->otherKey); - - // We need to alias all of the pivot columns with the "pivot_" prefix so we - // can easily extract them out of the models and put them into the pivot - // relationships when they are retrieved and hydrated into the models. - $columns = array(); - - foreach (array_merge($defaults, $this->pivotColumns) as $column) - { - $columns[] = $this->table.'.'.$column.' as pivot_'.$column; - } - - return array_unique($columns); - } - - /** - * Determine whether the given column is defined as a pivot column. - * - * @param string $column - * @return bool - */ - protected function hasPivotColumn($column) - { - return in_array($column, $this->pivotColumns); - } - - /** - * Set the join clause for the relation query. - * - * @param \Illuminate\Database\Eloquent\Builder|null - * @return $this - */ - protected function setJoin($query = null) - { - $query = $query ?: $this->query; - - // We need to join to the intermediate table on the related model's primary - // key column with the intermediate table's foreign key for the related - // model instance. Then we can set the "where" for the parent models. - $baseTable = $this->related->getTable(); - - $key = $baseTable.'.'.$this->related->getKeyName(); - - $query->join($this->table, $key, '=', $this->getOtherKey()); - - return $this; - } - - /** - * Set the where clause for the relation query. - * - * @return $this - */ - protected function setWhere() - { - $foreign = $this->getForeignKey(); - - $this->query->where($foreign, '=', $this->parent->getKey()); - - return $this; - } - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - public function addEagerConstraints(array $models) - { - $this->query->whereIn($this->getForeignKey(), $this->getKeys($models)); - } - - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) - { - $model->setRelation($relation, $this->related->newCollection()); - } - - return $models; - } - - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - $dictionary = $this->buildDictionary($results); - - // Once we have an array dictionary of child objects we can easily match the - // children back to their parent using the dictionary and the keys on the - // the parent models. Then we will return the hydrated models back out. - foreach ($models as $model) - { - if (isset($dictionary[$key = $model->getKey()])) - { - $collection = $this->related->newCollection($dictionary[$key]); - - $model->setRelation($relation, $collection); - } - } - - return $models; - } - - /** - * Build model dictionary keyed by the relation's foreign key. - * - * @param \Illuminate\Database\Eloquent\Collection $results - * @return array - */ - protected function buildDictionary(Collection $results) - { - $foreign = $this->foreignKey; - - // First we will build a dictionary of child models keyed by the foreign key - // of the relation so that we will easily and quickly match them to their - // parents without having a possibly slow inner loops for every models. - $dictionary = array(); - - foreach ($results as $result) - { - $dictionary[$result->pivot->$foreign][] = $result; - } - - return $dictionary; - } - - /** - * Touch all of the related models for the relationship. - * - * E.g.: Touch all roles associated with this user. - * - * @return void - */ - public function touch() - { - $key = $this->getRelated()->getKeyName(); - - $columns = $this->getRelatedFreshUpdate(); - - // If we actually have IDs for the relation, we will run the query to update all - // the related model's timestamps, to make sure these all reflect the changes - // to the parent models. This will help us keep any caching synced up here. - $ids = $this->getRelatedIds(); - - if (count($ids) > 0) - { - $this->getRelated()->newQuery()->whereIn($key, $ids)->update($columns); - } - } - - /** - * Get all of the IDs for the related models. - * - * @return array - */ - public function getRelatedIds() - { - $related = $this->getRelated(); - - $fullKey = $related->getQualifiedKeyName(); - - return $this->getQuery()->select($fullKey)->lists($related->getKeyName()); - } - - /** - * Save a new model and attach it to the parent model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @param array $joining - * @param bool $touch - * @return \Illuminate\Database\Eloquent\Model - */ - public function save(Model $model, array $joining = array(), $touch = true) - { - $model->save(array('touch' => false)); - - $this->attach($model->getKey(), $joining, $touch); - - return $model; - } - - /** - * Save an array of new models and attach them to the parent model. - * - * @param array $models - * @param array $joinings - * @return array - */ - public function saveMany(array $models, array $joinings = array()) - { - foreach ($models as $key => $model) - { - $this->save($model, (array) array_get($joinings, $key), false); - } - - $this->touchIfTouching(); - - return $models; - } - - /** - * Find a related model by its primary key. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null - */ - public function find($id, $columns = ['*']) - { - if (is_array($id)) - { - return $this->findMany($id, $columns); - } - - $this->where($this->getRelated()->getQualifiedKeyName(), '=', $id); - - return $this->first($columns); - } - - /** - * Find multiple related models by their primary keys. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Database\Eloquent\Collection - */ - public function findMany($ids, $columns = ['*']) - { - if (empty($ids)) return $this->getRelated()->newCollection(); - - $this->whereIn($this->getRelated()->getQualifiedKeyName(), $ids); - - return $this->get($columns); - } - - /** - * Find a related model by its primary key or return new instance of the related model. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model - */ - public function findOrNew($id, $columns = ['*']) - { - if (is_null($instance = $this->find($id, $columns))) - { - $instance = $this->getRelated()->newInstance(); - } - - return $instance; - } - - /** - * Get the first related model record matching the attributes or instantiate it. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model - */ - public function firstOrNew(array $attributes) - { - if (is_null($instance = $this->where($attributes)->first())) - { - $instance = $this->related->newInstance($attributes); - } - - return $instance; - } - - /** - * Get the first related record matching the attributes or create it. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model - */ - public function firstOrCreate(array $attributes, array $joining = [], $touch = true) - { - if (is_null($instance = $this->where($attributes)->first())) - { - $instance = $this->create($attributes, $joining, $touch); - } - - return $instance; - } - - /** - * Create or update a related record matching the attributes, and fill it with values. - * - * @param array $attributes - * @param array $values - * @return \Illuminate\Database\Eloquent\Model - */ - public function updateOrCreate(array $attributes, array $values = [], array $joining = [], $touch = true) - { - if (is_null($instance = $this->where($attributes)->first())) - { - return $this->create($values, $joining, $touch); - } - - $instance->fill($values); - - $instance->save(['touch' => false]); - - return $instance; - } - - /** - * Create a new instance of the related model. - * - * @param array $attributes - * @param array $joining - * @param bool $touch - * @return \Illuminate\Database\Eloquent\Model - */ - public function create(array $attributes, array $joining = array(), $touch = true) - { - $instance = $this->related->newInstance($attributes); - - // Once we save the related model, we need to attach it to the base model via - // through intermediate table so we'll use the existing "attach" method to - // accomplish this which will insert the record and any more attributes. - $instance->save(array('touch' => false)); - - $this->attach($instance->getKey(), $joining, $touch); - - return $instance; - } - - /** - * Create an array of new instances of the related models. - * - * @param array $records - * @param array $joinings - * @return \Illuminate\Database\Eloquent\Model - */ - public function createMany(array $records, array $joinings = array()) - { - $instances = array(); - - foreach ($records as $key => $record) - { - $instances[] = $this->create($record, (array) array_get($joinings, $key), false); - } - - $this->touchIfTouching(); - - return $instances; - } - - /** - * Sync the intermediate tables with a list of IDs or collection of models. - * - * @param array $ids - * @param bool $detaching - * @return array - */ - public function sync($ids, $detaching = true) - { - $changes = array( - 'attached' => array(), 'detached' => array(), 'updated' => array(), - ); - - if ($ids instanceof Collection) $ids = $ids->modelKeys(); - - // First we need to attach any of the associated models that are not currently - // in this joining table. We'll spin through the given IDs, checking to see - // if they exist in the array of current ones, and if not we will insert. - $current = $this->newPivotQuery()->lists($this->otherKey); - - $records = $this->formatSyncList($ids); - - $detach = array_diff($current, array_keys($records)); - - // Next, we will take the differences of the currents and given IDs and detach - // all of the entities that exist in the "current" array but are not in the - // the array of the IDs given to the method which will complete the sync. - if ($detaching && count($detach) > 0) - { - $this->detach($detach); - - $changes['detached'] = (array) array_map(function($v) { return (int) $v; }, $detach); - } - - // Now we are finally ready to attach the new records. Note that we'll disable - // touching until after the entire operation is complete so we don't fire a - // ton of touch operations until we are totally done syncing the records. - $changes = array_merge( - $changes, $this->attachNew($records, $current, false) - ); - - if (count($changes['attached']) || count($changes['updated'])) - { - $this->touchIfTouching(); - } - - return $changes; - } - - /** - * Format the sync list so that it is keyed by ID. - * - * @param array $records - * @return array - */ - protected function formatSyncList(array $records) - { - $results = array(); - - foreach ($records as $id => $attributes) - { - if ( ! is_array($attributes)) - { - list($id, $attributes) = array($attributes, array()); - } - - $results[$id] = $attributes; - } - - return $results; - } - - /** - * Attach all of the IDs that aren't in the current array. - * - * @param array $records - * @param array $current - * @param bool $touch - * @return array - */ - protected function attachNew(array $records, array $current, $touch = true) - { - $changes = array('attached' => array(), 'updated' => array()); - - foreach ($records as $id => $attributes) - { - // If the ID is not in the list of existing pivot IDs, we will insert a new pivot - // record, otherwise, we will just update this existing record on this joining - // table, so that the developers will easily update these records pain free. - if ( ! in_array($id, $current)) - { - $this->attach($id, $attributes, $touch); - - $changes['attached'][] = (int) $id; - } - - // Now we'll try to update an existing pivot record with the attributes that were - // given to the method. If the model is actually updated we will add it to the - // list of updated pivot records so we return them back out to the consumer. - elseif (count($attributes) > 0 && - $this->updateExistingPivot($id, $attributes, $touch)) - { - $changes['updated'][] = (int) $id; - } - } - - return $changes; - } - - /** - * Update an existing pivot record on the table. - * - * @param mixed $id - * @param array $attributes - * @param bool $touch - * @return void - */ - public function updateExistingPivot($id, array $attributes, $touch = true) - { - if (in_array($this->updatedAt(), $this->pivotColumns)) - { - $attributes = $this->setTimestampsOnAttach($attributes, true); - } - - $updated = $this->newPivotStatementForId($id)->update($attributes); - - if ($touch) $this->touchIfTouching(); - - return $updated; - } - - /** - * Attach a model to the parent. - * - * @param mixed $id - * @param array $attributes - * @param bool $touch - * @return void - */ - public function attach($id, array $attributes = array(), $touch = true) - { - if ($id instanceof Model) $id = $id->getKey(); - - $query = $this->newPivotStatement(); - - $query->insert($this->createAttachRecords((array) $id, $attributes)); - - if ($touch) $this->touchIfTouching(); - } - - /** - * Create an array of records to insert into the pivot table. - * - * @param array $ids - * @param array $attributes - * @return array - */ - protected function createAttachRecords($ids, array $attributes) - { - $records = array(); - - $timed = ($this->hasPivotColumn($this->createdAt()) || - $this->hasPivotColumn($this->updatedAt())); - - // To create the attachment records, we will simply spin through the IDs given - // and create a new record to insert for each ID. Each ID may actually be a - // key in the array, with extra attributes to be placed in other columns. - foreach ($ids as $key => $value) - { - $records[] = $this->attacher($key, $value, $attributes, $timed); - } - - return $records; - } - - /** - * Create a full attachment record payload. - * - * @param int $key - * @param mixed $value - * @param array $attributes - * @param bool $timed - * @return array - */ - protected function attacher($key, $value, $attributes, $timed) - { - list($id, $extra) = $this->getAttachId($key, $value, $attributes); - - // To create the attachment records, we will simply spin through the IDs given - // and create a new record to insert for each ID. Each ID may actually be a - // key in the array, with extra attributes to be placed in other columns. - $record = $this->createAttachRecord($id, $timed); - - return array_merge($record, $extra); - } - - /** - * Get the attach record ID and extra attributes. - * - * @param mixed $key - * @param mixed $value - * @param array $attributes - * @return array - */ - protected function getAttachId($key, $value, array $attributes) - { - if (is_array($value)) - { - return array($key, array_merge($value, $attributes)); - } - - return array($value, $attributes); - } - - /** - * Create a new pivot attachment record. - * - * @param int $id - * @param bool $timed - * @return array - */ - protected function createAttachRecord($id, $timed) - { - $record[$this->foreignKey] = $this->parent->getKey(); - - $record[$this->otherKey] = $id; - - // If the record needs to have creation and update timestamps, we will make - // them by calling the parent model's "freshTimestamp" method which will - // provide us with a fresh timestamp in this model's preferred format. - if ($timed) - { - $record = $this->setTimestampsOnAttach($record); - } - - return $record; - } - - /** - * Set the creation and update timestamps on an attach record. - * - * @param array $record - * @param bool $exists - * @return array - */ - protected function setTimestampsOnAttach(array $record, $exists = false) - { - $fresh = $this->parent->freshTimestamp(); - - if ( ! $exists && $this->hasPivotColumn($this->createdAt())) - { - $record[$this->createdAt()] = $fresh; - } - - if ($this->hasPivotColumn($this->updatedAt())) - { - $record[$this->updatedAt()] = $fresh; - } - - return $record; - } - - /** - * Detach models from the relationship. - * - * @param int|array $ids - * @param bool $touch - * @return int - */ - public function detach($ids = array(), $touch = true) - { - if ($ids instanceof Model) $ids = (array) $ids->getKey(); - - $query = $this->newPivotQuery(); - - // If associated IDs were passed to the method we will only delete those - // associations, otherwise all of the association ties will be broken. - // We'll return the numbers of affected rows when we do the deletes. - $ids = (array) $ids; - - if (count($ids) > 0) - { - $query->whereIn($this->otherKey, (array) $ids); - } - - if ($touch) $this->touchIfTouching(); - - // Once we have all of the conditions set on the statement, we are ready - // to run the delete on the pivot table. Then, if the touch parameter - // is true, we will go ahead and touch all related models to sync. - $results = $query->delete(); - - return $results; - } - - /** - * If we're touching the parent model, touch. - * - * @return void - */ - public function touchIfTouching() - { - if ($this->touchingParent()) $this->getParent()->touch(); - - if ($this->getParent()->touches($this->relationName)) $this->touch(); - } - - /** - * Determine if we should touch the parent on sync. - * - * @return bool - */ - protected function touchingParent() - { - return $this->getRelated()->touches($this->guessInverseRelation()); - } - - /** - * Attempt to guess the name of the inverse of the relation. - * - * @return string - */ - protected function guessInverseRelation() - { - return camel_case(str_plural(class_basename($this->getParent()))); - } - - /** - * Create a new query builder for the pivot table. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function newPivotQuery() - { - $query = $this->newPivotStatement(); - - foreach ($this->pivotWheres as $whereArgs) - { - call_user_func_array([$query, 'where'], $whereArgs); - } - - return $query->where($this->foreignKey, $this->parent->getKey()); - } - - /** - * Get a new plain query builder for the pivot table. - * - * @return \Illuminate\Database\Query\Builder - */ - public function newPivotStatement() - { - return $this->query->getQuery()->newQuery()->from($this->table); - } - - /** - * Get a new pivot statement for a given "other" ID. - * - * @param mixed $id - * @return \Illuminate\Database\Query\Builder - */ - public function newPivotStatementForId($id) - { - return $this->newPivotQuery()->where($this->otherKey, $id); - } - - /** - * Create a new pivot model instance. - * - * @param array $attributes - * @param bool $exists - * @return \Illuminate\Database\Eloquent\Relations\Pivot - */ - public function newPivot(array $attributes = array(), $exists = false) - { - $pivot = $this->related->newPivot($this->parent, $attributes, $this->table, $exists); - - return $pivot->setPivotKeys($this->foreignKey, $this->otherKey); - } - - /** - * Create a new existing pivot model instance. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Relations\Pivot - */ - public function newExistingPivot(array $attributes = array()) - { - return $this->newPivot($attributes, true); - } - - /** - * Set the columns on the pivot table to retrieve. - * - * @param mixed $columns - * @return $this - */ - public function withPivot($columns) - { - $columns = is_array($columns) ? $columns : func_get_args(); - - $this->pivotColumns = array_merge($this->pivotColumns, $columns); - - return $this; - } - - /** - * Specify that the pivot table has creation and update timestamps. - * - * @param mixed $createdAt - * @param mixed $updatedAt - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany - */ - public function withTimestamps($createdAt = null, $updatedAt = null) - { - $this->pivotCreatedAt = $createdAt; - $this->pivotUpdatedAt = $updatedAt; - - return $this->withPivot($this->createdAt(), $this->updatedAt()); - } - - /** - * Get the name of the "created at" column. - * - * @return string - */ - public function createdAt() - { - return $this->pivotCreatedAt ?: $this->parent->getCreatedAtColumn(); - } - - /** - * Get the name of the "updated at" column. - * - * @return string - */ - public function updatedAt() - { - return $this->pivotUpdatedAt ?: $this->parent->getUpdatedAtColumn(); - } - - /** - * Get the related model's updated at column name. - * - * @return string - */ - public function getRelatedFreshUpdate() - { - return array($this->related->getUpdatedAtColumn() => $this->related->freshTimestamp()); - } - - /** - * Get the key for comparing against the parent key in "has" query. - * - * @return string - */ - public function getHasCompareKey() - { - return $this->getForeignKey(); - } - - /** - * Get the fully qualified foreign key for the relation. - * - * @return string - */ - public function getForeignKey() - { - return $this->table.'.'.$this->foreignKey; - } - - /** - * Get the fully qualified "other key" for the relation. - * - * @return string - */ - public function getOtherKey() - { - return $this->table.'.'.$this->otherKey; - } - - /** - * Get the intermediate table for the relationship. - * - * @return string - */ - public function getTable() - { - return $this->table; - } - - /** - * Get the relationship name for the relationship. - * - * @return string - */ - public function getRelationName() - { - return $this->relationName; - } - +class BelongsToMany extends Relation +{ + /** + * The intermediate table for the relation. + * + * @var string + */ + protected $table; + + /** + * The foreign key of the parent model. + * + * @var string + */ + protected $foreignKey; + + /** + * The associated key of the relation. + * + * @var string + */ + protected $otherKey; + + /** + * The "name" of the relationship. + * + * @var string + */ + protected $relationName; + + /** + * The pivot table columns to retrieve. + * + * @var array + */ + protected $pivotColumns = []; + + /** + * Any pivot table restrictions. + * + * @var array + */ + protected $pivotWheres = []; + + /** + * The custom pivot table column for the created_at timestamp. + * + * @var string + */ + protected $pivotCreatedAt; + + /** + * The custom pivot table column for the updated_at timestamp. + * + * @var string + */ + protected $pivotUpdatedAt; + + /** + * Create a new belongs to many relationship instance. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $table + * @param string $foreignKey + * @param string $otherKey + * @param string $relationName + * @return void + */ + public function __construct(Builder $query, Model $parent, $table, $foreignKey, $otherKey, $relationName = null) + { + $this->table = $table; + $this->otherKey = $otherKey; + $this->foreignKey = $foreignKey; + $this->relationName = $relationName; + + parent::__construct($query, $parent); + } + + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + return $this->get(); + } + + /** + * Set a where clause for a pivot table column. + * + * @param string $column + * @param string $operator + * @param mixed $value + * @param string $boolean + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + public function wherePivot($column, $operator = null, $value = null, $boolean = 'and') + { + $this->pivotWheres[] = func_get_args(); + + return $this->where($this->table.'.'.$column, $operator, $value, $boolean); + } + + /** + * Set an or where clause for a pivot table column. + * + * @param string $column + * @param string $operator + * @param mixed $value + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + public function orWherePivot($column, $operator = null, $value = null) + { + return $this->wherePivot($column, $operator, $value, 'or'); + } + + /** + * Execute the query and get the first result. + * + * @param array $columns + * @return mixed + */ + public function first($columns = ['*']) + { + $results = $this->take(1)->get($columns); + + return count($results) > 0 ? $results->first() : null; + } + + /** + * Execute the query and get the first result or throw an exception. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|static + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function firstOrFail($columns = ['*']) + { + if (! is_null($model = $this->first($columns))) { + return $model; + } + + throw new ModelNotFoundException; + } + + /** + * Execute the query as a "select" statement. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function get($columns = ['*']) + { + // First we'll add the proper select columns onto the query so it is run with + // the proper columns. Then, we will get the results and hydrate out pivot + // models with the result of those columns as a separate model relation. + $columns = $this->query->getQuery()->columns ? [] : $columns; + + $select = $this->getSelectColumns($columns); + + $models = $this->query->addSelect($select)->getModels(); + + $this->hydratePivotRelation($models); + + // If we actually found models we will also eager load any relationships that + // have been specified as needing to be eager loaded. This will solve the + // n + 1 query problem for the developer and also increase performance. + if (count($models) > 0) { + $models = $this->query->eagerLoadRelations($models); + } + + return $this->related->newCollection($models); + } + + /** + * Get a paginator for the "select" statement. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + */ + public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $this->query->addSelect($this->getSelectColumns($columns)); + + $paginator = $this->query->paginate($perPage, $columns, $pageName, $page); + + $this->hydratePivotRelation($paginator->items()); + + return $paginator; + } + + /** + * Paginate the given query into a simple paginator. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @return \Illuminate\Contracts\Pagination\Paginator + */ + public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page') + { + $this->query->addSelect($this->getSelectColumns($columns)); + + $paginator = $this->query->simplePaginate($perPage, $columns, $pageName); + + $this->hydratePivotRelation($paginator->items()); + + return $paginator; + } + + /** + * Chunk the results of the query. + * + * @param int $count + * @param callable $callback + * @return bool + */ + public function chunk($count, callable $callback) + { + $this->query->addSelect($this->getSelectColumns()); + + return $this->query->chunk($count, function ($results) use ($callback) { + $this->hydratePivotRelation($results->all()); + + return $callback($results); + }); + } + + /** + * Hydrate the pivot table relationship on the models. + * + * @param array $models + * @return void + */ + protected function hydratePivotRelation(array $models) + { + // To hydrate the pivot relationship, we will just gather the pivot attributes + // and create a new Pivot model, which is basically a dynamic model that we + // will set the attributes, table, and connections on so it they be used. + foreach ($models as $model) { + $pivot = $this->newExistingPivot($this->cleanPivotAttributes($model)); + + $model->setRelation('pivot', $pivot); + } + } + + /** + * Get the pivot attributes from a model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return array + */ + protected function cleanPivotAttributes(Model $model) + { + $values = []; + + foreach ($model->getAttributes() as $key => $value) { + // To get the pivots attributes we will just take any of the attributes which + // begin with "pivot_" and add those to this arrays, as well as unsetting + // them from the parent's models since they exist in a different table. + if (strpos($key, 'pivot_') === 0) { + $values[substr($key, 6)] = $value; + + unset($model->$key); + } + } + + return $values; + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + $this->setJoin(); + + if (static::$constraints) { + $this->setWhere(); + } + } + + /** + * Add the constraints for a relationship count query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parent + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationCountQuery(Builder $query, Builder $parent) + { + if ($parent->getQuery()->from == $query->getQuery()->from) { + return $this->getRelationCountQueryForSelfJoin($query, $parent); + } + + $this->setJoin($query); + + return parent::getRelationCountQuery($query, $parent); + } + + /** + * Add the constraints for a relationship count query on the same table. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parent + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationCountQueryForSelfJoin(Builder $query, Builder $parent) + { + $query->select(new Expression('count(*)')); + + $query->from($this->related->getTable().' as '.$hash = $this->getRelationCountHash()); + + $this->related->setTable($hash); + + $this->setJoin($query); + + return parent::getRelationCountQuery($query, $parent); + } + + /** + * Get a relationship join table hash. + * + * @return string + */ + public function getRelationCountHash() + { + return 'self_'.md5(microtime(true)); + } + + /** + * Set the select clause for the relation query. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + protected function getSelectColumns(array $columns = ['*']) + { + if ($columns == ['*']) { + $columns = [$this->related->getTable().'.*']; + } + + return array_merge($columns, $this->getAliasedPivotColumns()); + } + + /** + * Get the pivot columns for the relation. + * + * @return array + */ + protected function getAliasedPivotColumns() + { + $defaults = [$this->foreignKey, $this->otherKey]; + + // We need to alias all of the pivot columns with the "pivot_" prefix so we + // can easily extract them out of the models and put them into the pivot + // relationships when they are retrieved and hydrated into the models. + $columns = []; + + foreach (array_merge($defaults, $this->pivotColumns) as $column) { + $columns[] = $this->table.'.'.$column.' as pivot_'.$column; + } + + return array_unique($columns); + } + + /** + * Determine whether the given column is defined as a pivot column. + * + * @param string $column + * @return bool + */ + protected function hasPivotColumn($column) + { + return in_array($column, $this->pivotColumns); + } + + /** + * Set the join clause for the relation query. + * + * @param \Illuminate\Database\Eloquent\Builder|null $query + * @return $this + */ + protected function setJoin($query = null) + { + $query = $query ?: $this->query; + + // We need to join to the intermediate table on the related model's primary + // key column with the intermediate table's foreign key for the related + // model instance. Then we can set the "where" for the parent models. + $baseTable = $this->related->getTable(); + + $key = $baseTable.'.'.$this->related->getKeyName(); + + $query->join($this->table, $key, '=', $this->getOtherKey()); + + return $this; + } + + /** + * Set the where clause for the relation query. + * + * @return $this + */ + protected function setWhere() + { + $foreign = $this->getForeignKey(); + + $this->query->where($foreign, '=', $this->parent->getKey()); + + return $this; + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + $this->query->whereIn($this->getForeignKey(), $this->getKeys($models)); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->related->newCollection()); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + $dictionary = $this->buildDictionary($results); + + // Once we have an array dictionary of child objects we can easily match the + // children back to their parent using the dictionary and the keys on the + // the parent models. Then we will return the hydrated models back out. + foreach ($models as $model) { + if (isset($dictionary[$key = $model->getKey()])) { + $collection = $this->related->newCollection($dictionary[$key]); + + $model->setRelation($relation, $collection); + } + } + + return $models; + } + + /** + * Build model dictionary keyed by the relation's foreign key. + * + * @param \Illuminate\Database\Eloquent\Collection $results + * @return array + */ + protected function buildDictionary(Collection $results) + { + $foreign = $this->foreignKey; + + // First we will build a dictionary of child models keyed by the foreign key + // of the relation so that we will easily and quickly match them to their + // parents without having a possibly slow inner loops for every models. + $dictionary = []; + + foreach ($results as $result) { + $dictionary[$result->pivot->$foreign][] = $result; + } + + return $dictionary; + } + + /** + * Touch all of the related models for the relationship. + * + * E.g.: Touch all roles associated with this user. + * + * @return void + */ + public function touch() + { + $key = $this->getRelated()->getKeyName(); + + $columns = $this->getRelatedFreshUpdate(); + + // If we actually have IDs for the relation, we will run the query to update all + // the related model's timestamps, to make sure these all reflect the changes + // to the parent models. This will help us keep any caching synced up here. + $ids = $this->getRelatedIds(); + + if (count($ids) > 0) { + $this->getRelated()->newQuery()->whereIn($key, $ids)->update($columns); + } + } + + /** + * Get all of the IDs for the related models. + * + * @return \Illuminate\Support\Collection + */ + public function getRelatedIds() + { + $related = $this->getRelated(); + + $fullKey = $related->getQualifiedKeyName(); + + return $this->getQuery()->select($fullKey)->lists($related->getKeyName()); + } + + /** + * Save a new model and attach it to the parent model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @param array $joining + * @param bool $touch + * @return \Illuminate\Database\Eloquent\Model + */ + public function save(Model $model, array $joining = [], $touch = true) + { + $model->save(['touch' => false]); + + $this->attach($model->getKey(), $joining, $touch); + + return $model; + } + + /** + * Save an array of new models and attach them to the parent model. + * + * @param \Illuminate\Support\Collection|array $models + * @param array $joinings + * @return array + */ + public function saveMany($models, array $joinings = []) + { + foreach ($models as $key => $model) { + $this->save($model, (array) Arr::get($joinings, $key), false); + } + + $this->touchIfTouching(); + + return $models; + } + + /** + * Find a related model by its primary key. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null + */ + public function find($id, $columns = ['*']) + { + if (is_array($id)) { + return $this->findMany($id, $columns); + } + + $this->where($this->getRelated()->getQualifiedKeyName(), '=', $id); + + return $this->first($columns); + } + + /** + * Find multiple related models by their primary keys. + * + * @param mixed $ids + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function findMany($ids, $columns = ['*']) + { + if (empty($ids)) { + return $this->getRelated()->newCollection(); + } + + $this->whereIn($this->getRelated()->getQualifiedKeyName(), $ids); + + return $this->get($columns); + } + + /** + * Find a related model by its primary key or throw an exception. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function findOrFail($id, $columns = ['*']) + { + $result = $this->find($id, $columns); + + if (is_array($id)) { + if (count($result) == count(array_unique($id))) { + return $result; + } + } elseif (! is_null($result)) { + return $result; + } + + throw (new ModelNotFoundException)->setModel(get_class($this->parent)); + } + + /** + * Find a related model by its primary key or return new instance of the related model. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model + */ + public function findOrNew($id, $columns = ['*']) + { + if (is_null($instance = $this->find($id, $columns))) { + $instance = $this->getRelated()->newInstance(); + } + + return $instance; + } + + /** + * Get the first related model record matching the attributes or instantiate it. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrNew(array $attributes) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->related->newInstance($attributes); + } + + return $instance; + } + + /** + * Get the first related record matching the attributes or create it. + * + * @param array $attributes + * @param array $joining + * @param bool $touch + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrCreate(array $attributes, array $joining = [], $touch = true) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->create($attributes, $joining, $touch); + } + + return $instance; + } + + /** + * Create or update a related record matching the attributes, and fill it with values. + * + * @param array $attributes + * @param array $values + * @param array $joining + * @param bool $touch + * @return \Illuminate\Database\Eloquent\Model + */ + public function updateOrCreate(array $attributes, array $values = [], array $joining = [], $touch = true) + { + if (is_null($instance = $this->where($attributes)->first())) { + return $this->create($values, $joining, $touch); + } + + $instance->fill($values); + + $instance->save(['touch' => false]); + + return $instance; + } + + /** + * Create a new instance of the related model. + * + * @param array $attributes + * @param array $joining + * @param bool $touch + * @return \Illuminate\Database\Eloquent\Model + */ + public function create(array $attributes, array $joining = [], $touch = true) + { + $instance = $this->related->newInstance($attributes); + + // Once we save the related model, we need to attach it to the base model via + // through intermediate table so we'll use the existing "attach" method to + // accomplish this which will insert the record and any more attributes. + $instance->save(['touch' => false]); + + $this->attach($instance->getKey(), $joining, $touch); + + return $instance; + } + + /** + * Create an array of new instances of the related models. + * + * @param array $records + * @param array $joinings + * @return array + */ + public function createMany(array $records, array $joinings = []) + { + $instances = []; + + foreach ($records as $key => $record) { + $instances[] = $this->create($record, (array) Arr::get($joinings, $key), false); + } + + $this->touchIfTouching(); + + return $instances; + } + + /** + * Sync the intermediate tables with a list of IDs or collection of models. + * + * @param \Illuminate\Database\Eloquent\Collection|array $ids + * @param bool $detaching + * @return array + */ + public function sync($ids, $detaching = true) + { + $changes = [ + 'attached' => [], 'detached' => [], 'updated' => [], + ]; + + if ($ids instanceof Collection) { + $ids = $ids->modelKeys(); + } + + // First we need to attach any of the associated models that are not currently + // in this joining table. We'll spin through the given IDs, checking to see + // if they exist in the array of current ones, and if not we will insert. + $current = $this->newPivotQuery()->lists($this->otherKey); + + $records = $this->formatSyncList($ids); + + $detach = array_diff($current, array_keys($records)); + + // Next, we will take the differences of the currents and given IDs and detach + // all of the entities that exist in the "current" array but are not in the + // the array of the IDs given to the method which will complete the sync. + if ($detaching && count($detach) > 0) { + $this->detach($detach); + + $changes['detached'] = (array) array_map(function ($v) { + return is_numeric($v) ? (int) $v : (string) $v; + }, $detach); + } + + // Now we are finally ready to attach the new records. Note that we'll disable + // touching until after the entire operation is complete so we don't fire a + // ton of touch operations until we are totally done syncing the records. + $changes = array_merge( + $changes, $this->attachNew($records, $current, false) + ); + + if (count($changes['attached']) || count($changes['updated'])) { + $this->touchIfTouching(); + } + + return $changes; + } + + /** + * Format the sync list so that it is keyed by ID. + * + * @param array $records + * @return array + */ + protected function formatSyncList(array $records) + { + $results = []; + + foreach ($records as $id => $attributes) { + if (! is_array($attributes)) { + list($id, $attributes) = [$attributes, []]; + } + + $results[$id] = $attributes; + } + + return $results; + } + + /** + * Attach all of the IDs that aren't in the current array. + * + * @param array $records + * @param array $current + * @param bool $touch + * @return array + */ + protected function attachNew(array $records, array $current, $touch = true) + { + $changes = ['attached' => [], 'updated' => []]; + + foreach ($records as $id => $attributes) { + // If the ID is not in the list of existing pivot IDs, we will insert a new pivot + // record, otherwise, we will just update this existing record on this joining + // table, so that the developers will easily update these records pain free. + if (! in_array($id, $current)) { + $this->attach($id, $attributes, $touch); + + $changes['attached'][] = is_numeric($id) ? (int) $id : (string) $id; + } + + // Now we'll try to update an existing pivot record with the attributes that were + // given to the method. If the model is actually updated we will add it to the + // list of updated pivot records so we return them back out to the consumer. + elseif (count($attributes) > 0 && + $this->updateExistingPivot($id, $attributes, $touch)) { + $changes['updated'][] = is_numeric($id) ? (int) $id : (string) $id; + } + } + + return $changes; + } + + /** + * Update an existing pivot record on the table. + * + * @param mixed $id + * @param array $attributes + * @param bool $touch + * @return int + */ + public function updateExistingPivot($id, array $attributes, $touch = true) + { + if (in_array($this->updatedAt(), $this->pivotColumns)) { + $attributes = $this->setTimestampsOnAttach($attributes, true); + } + + $updated = $this->newPivotStatementForId($id)->update($attributes); + + if ($touch) { + $this->touchIfTouching(); + } + + return $updated; + } + + /** + * Attach a model to the parent. + * + * @param mixed $id + * @param array $attributes + * @param bool $touch + * @return void + */ + public function attach($id, array $attributes = [], $touch = true) + { + if ($id instanceof Model) { + $id = $id->getKey(); + } + + $query = $this->newPivotStatement(); + + $query->insert($this->createAttachRecords((array) $id, $attributes)); + + if ($touch) { + $this->touchIfTouching(); + } + } + + /** + * Create an array of records to insert into the pivot table. + * + * @param array $ids + * @param array $attributes + * @return array + */ + protected function createAttachRecords($ids, array $attributes) + { + $records = []; + + $timed = ($this->hasPivotColumn($this->createdAt()) || + $this->hasPivotColumn($this->updatedAt())); + + // To create the attachment records, we will simply spin through the IDs given + // and create a new record to insert for each ID. Each ID may actually be a + // key in the array, with extra attributes to be placed in other columns. + foreach ($ids as $key => $value) { + $records[] = $this->attacher($key, $value, $attributes, $timed); + } + + return $records; + } + + /** + * Create a full attachment record payload. + * + * @param int $key + * @param mixed $value + * @param array $attributes + * @param bool $timed + * @return array + */ + protected function attacher($key, $value, $attributes, $timed) + { + list($id, $extra) = $this->getAttachId($key, $value, $attributes); + + // To create the attachment records, we will simply spin through the IDs given + // and create a new record to insert for each ID. Each ID may actually be a + // key in the array, with extra attributes to be placed in other columns. + $record = $this->createAttachRecord($id, $timed); + + return array_merge($record, $extra); + } + + /** + * Get the attach record ID and extra attributes. + * + * @param mixed $key + * @param mixed $value + * @param array $attributes + * @return array + */ + protected function getAttachId($key, $value, array $attributes) + { + if (is_array($value)) { + return [$key, array_merge($value, $attributes)]; + } + + return [$value, $attributes]; + } + + /** + * Create a new pivot attachment record. + * + * @param int $id + * @param bool $timed + * @return array + */ + protected function createAttachRecord($id, $timed) + { + $record[$this->foreignKey] = $this->parent->getKey(); + + $record[$this->otherKey] = $id; + + // If the record needs to have creation and update timestamps, we will make + // them by calling the parent model's "freshTimestamp" method which will + // provide us with a fresh timestamp in this model's preferred format. + if ($timed) { + $record = $this->setTimestampsOnAttach($record); + } + + return $record; + } + + /** + * Set the creation and update timestamps on an attach record. + * + * @param array $record + * @param bool $exists + * @return array + */ + protected function setTimestampsOnAttach(array $record, $exists = false) + { + $fresh = $this->parent->freshTimestamp(); + + if (! $exists && $this->hasPivotColumn($this->createdAt())) { + $record[$this->createdAt()] = $fresh; + } + + if ($this->hasPivotColumn($this->updatedAt())) { + $record[$this->updatedAt()] = $fresh; + } + + return $record; + } + + /** + * Detach models from the relationship. + * + * @param int|array $ids + * @param bool $touch + * @return int + */ + public function detach($ids = [], $touch = true) + { + if ($ids instanceof Model) { + $ids = (array) $ids->getKey(); + } + + $query = $this->newPivotQuery(); + + // If associated IDs were passed to the method we will only delete those + // associations, otherwise all of the association ties will be broken. + // We'll return the numbers of affected rows when we do the deletes. + $ids = (array) $ids; + + if (count($ids) > 0) { + $query->whereIn($this->otherKey, (array) $ids); + } + + // Once we have all of the conditions set on the statement, we are ready + // to run the delete on the pivot table. Then, if the touch parameter + // is true, we will go ahead and touch all related models to sync. + $results = $query->delete(); + + if ($touch) { + $this->touchIfTouching(); + } + + return $results; + } + + /** + * If we're touching the parent model, touch. + * + * @return void + */ + public function touchIfTouching() + { + if ($this->touchingParent()) { + $this->getParent()->touch(); + } + + if ($this->getParent()->touches($this->relationName)) { + $this->touch(); + } + } + + /** + * Determine if we should touch the parent on sync. + * + * @return bool + */ + protected function touchingParent() + { + return $this->getRelated()->touches($this->guessInverseRelation()); + } + + /** + * Attempt to guess the name of the inverse of the relation. + * + * @return string + */ + protected function guessInverseRelation() + { + return Str::camel(Str::plural(class_basename($this->getParent()))); + } + + /** + * Create a new query builder for the pivot table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function newPivotQuery() + { + $query = $this->newPivotStatement(); + + foreach ($this->pivotWheres as $whereArgs) { + call_user_func_array([$query, 'where'], $whereArgs); + } + + return $query->where($this->foreignKey, $this->parent->getKey()); + } + + /** + * Get a new plain query builder for the pivot table. + * + * @return \Illuminate\Database\Query\Builder + */ + public function newPivotStatement() + { + return $this->query->getQuery()->newQuery()->from($this->table); + } + + /** + * Get a new pivot statement for a given "other" ID. + * + * @param mixed $id + * @return \Illuminate\Database\Query\Builder + */ + public function newPivotStatementForId($id) + { + return $this->newPivotQuery()->where($this->otherKey, $id); + } + + /** + * Create a new pivot model instance. + * + * @param array $attributes + * @param bool $exists + * @return \Illuminate\Database\Eloquent\Relations\Pivot + */ + public function newPivot(array $attributes = [], $exists = false) + { + $pivot = $this->related->newPivot($this->parent, $attributes, $this->table, $exists); + + return $pivot->setPivotKeys($this->foreignKey, $this->otherKey); + } + + /** + * Create a new existing pivot model instance. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Relations\Pivot + */ + public function newExistingPivot(array $attributes = []) + { + return $this->newPivot($attributes, true); + } + + /** + * Set the columns on the pivot table to retrieve. + * + * @param array|mixed $columns + * @return $this + */ + public function withPivot($columns) + { + $columns = is_array($columns) ? $columns : func_get_args(); + + $this->pivotColumns = array_merge($this->pivotColumns, $columns); + + return $this; + } + + /** + * Specify that the pivot table has creation and update timestamps. + * + * @param mixed $createdAt + * @param mixed $updatedAt + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + public function withTimestamps($createdAt = null, $updatedAt = null) + { + $this->pivotCreatedAt = $createdAt; + $this->pivotUpdatedAt = $updatedAt; + + return $this->withPivot($this->createdAt(), $this->updatedAt()); + } + + /** + * Get the name of the "created at" column. + * + * @return string + */ + public function createdAt() + { + return $this->pivotCreatedAt ?: $this->parent->getCreatedAtColumn(); + } + + /** + * Get the name of the "updated at" column. + * + * @return string + */ + public function updatedAt() + { + return $this->pivotUpdatedAt ?: $this->parent->getUpdatedAtColumn(); + } + + /** + * Get the related model's updated at column name. + * + * @return string + */ + public function getRelatedFreshUpdate() + { + return [$this->related->getUpdatedAtColumn() => $this->related->freshTimestamp()]; + } + + /** + * Get the key for comparing against the parent key in "has" query. + * + * @return string + */ + public function getHasCompareKey() + { + return $this->getForeignKey(); + } + + /** + * Get the fully qualified foreign key for the relation. + * + * @return string + */ + public function getForeignKey() + { + return $this->table.'.'.$this->foreignKey; + } + + /** + * Get the fully qualified "other key" for the relation. + * + * @return string + */ + public function getOtherKey() + { + return $this->table.'.'.$this->otherKey; + } + + /** + * Get the intermediate table for the relationship. + * + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * Get the relationship name for the relationship. + * + * @return string + */ + public function getRelationName() + { + return $this->relationName; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasMany.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasMany.php index 159a658..6149e47 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasMany.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasMany.php @@ -1,47 +1,47 @@ -query->get(); - } +use Illuminate\Database\Eloquent\Collection; - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) - { - $model->setRelation($relation, $this->related->newCollection()); - } +class HasMany extends HasOneOrMany +{ + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + return $this->query->get(); + } - return $models; - } + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->related->newCollection()); + } - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - return $this->matchMany($models, $results, $relation); - } + return $models; + } + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $this->matchMany($models, $results, $relation); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php index 220a095..2ae4eea 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php @@ -1,340 +1,410 @@ -firstKey = $firstKey; - $this->secondKey = $secondKey; - $this->farParent = $farParent; - - parent::__construct($query, $parent); - } - - /** - * Set the base constraints on the relation query. - * - * @return void - */ - public function addConstraints() - { - $parentTable = $this->parent->getTable(); - - $this->setJoin(); - - if (static::$constraints) - { - $this->query->where($parentTable.'.'.$this->firstKey, '=', $this->farParent->getKey()); - } - } - - /** - * Add the constraints for a relationship count query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parent - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationCountQuery(Builder $query, Builder $parent) - { - $parentTable = $this->parent->getTable(); - - $this->setJoin($query); - - $query->select(new Expression('count(*)')); - - $key = $this->wrap($parentTable.'.'.$this->firstKey); - - return $query->where($this->getHasCompareKey(), '=', new Expression($key)); - } - - /** - * Set the join clause on the query. - * - * @param \Illuminate\Database\Eloquent\Builder|null $query - * @return void - */ - protected function setJoin(Builder $query = null) - { - $query = $query ?: $this->query; - - $foreignKey = $this->related->getTable().'.'.$this->secondKey; - - $query->join($this->parent->getTable(), $this->getQualifiedParentKeyName(), '=', $foreignKey); - - if ($this->parentSoftDeletes()) - { - $query->whereNull($this->parent->getQualifiedDeletedAtColumn()); - } - } - - /** - * Determine whether close parent of the relation uses Soft Deletes. - * - * @return bool - */ - public function parentSoftDeletes() - { - return in_array('Illuminate\Database\Eloquent\SoftDeletes', class_uses_recursive(get_class($this->parent))); - } - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - public function addEagerConstraints(array $models) - { - $table = $this->parent->getTable(); - - $this->query->whereIn($table.'.'.$this->firstKey, $this->getKeys($models)); - } - - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) - { - $model->setRelation($relation, $this->related->newCollection()); - } - - return $models; - } - - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - $dictionary = $this->buildDictionary($results); - - // Once we have the dictionary we can simply spin through the parent models to - // link them up with their children using the keyed dictionary to make the - // matching very convenient and easy work. Then we'll just return them. - foreach ($models as $model) - { - $key = $model->getKey(); - - if (isset($dictionary[$key])) - { - $value = $this->related->newCollection($dictionary[$key]); - - $model->setRelation($relation, $value); - } - } - - return $models; - } - - /** - * Build model dictionary keyed by the relation's foreign key. - * - * @param \Illuminate\Database\Eloquent\Collection $results - * @return array - */ - protected function buildDictionary(Collection $results) - { - $dictionary = []; - - $foreign = $this->firstKey; - - // First we will create a dictionary of models keyed by the foreign key of the - // relationship as this will allow us to quickly access all of the related - // models without having to do nested looping which will be quite slow. - foreach ($results as $result) - { - $dictionary[$result->{$foreign}][] = $result; - } - - return $dictionary; - } - - /** - * Get the results of the relationship. - * - * @return mixed - */ - public function getResults() - { - return $this->get(); - } - - /** - * Execute the query and get the first related model. - * - * @param array $columns - * @return mixed - */ - public function first($columns = ['*']) - { - $results = $this->take(1)->get($columns); - - return count($results) > 0 ? $results->first() : null; - } - - /** - * Find a related model by its primary key. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null - */ - public function find($id, $columns = ['*']) - { - if (is_array($id)) - { - return $this->findMany($id, $columns); - } - - $this->where($this->getRelated()->getQualifiedKeyName(), '=', $id); - - return $this->first($columns); - } - - /** - * Find multiple related models by their primary keys. - * - * @param mixed $ids - * @param array $columns - * @return \Illuminate\Database\Eloquent\Collection - */ - public function findMany($ids, $columns = ['*']) - { - if (empty($ids)) return $this->getRelated()->newCollection(); - - $this->whereIn($this->getRelated()->getQualifiedKeyName(), $ids); - - return $this->get($columns); - } - - /** - * Execute the query as a "select" statement. - * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Collection - */ - public function get($columns = ['*']) - { - // First we'll add the proper select columns onto the query so it is run with - // the proper columns. Then, we will get the results and hydrate out pivot - // models with the result of those columns as a separate model relation. - $columns = $this->query->getQuery()->columns ? [] : $columns; - - $select = $this->getSelectColumns($columns); - - $models = $this->query->addSelect($select)->getModels(); - - // If we actually found models we will also eager load any relationships that - // have been specified as needing to be eager loaded. This will solve the - // n + 1 query problem for the developer and also increase performance. - if (count($models) > 0) - { - $models = $this->query->eagerLoadRelations($models); - } - - return $this->related->newCollection($models); - } - - /** - * Set the select clause for the relation query. - * - * @param array $columns - * @return array - */ - protected function getSelectColumns(array $columns = ['*']) - { - if ($columns == ['*']) - { - $columns = [$this->related->getTable().'.*']; - } - - return array_merge($columns, [$this->parent->getTable().'.'.$this->firstKey]); - } - - /** - * Get a paginator for the "select" statement. - * - * @param int $perPage - * @param array $columns - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator - */ - public function paginate($perPage = null, $columns = ['*']) - { - $this->query->addSelect($this->getSelectColumns($columns)); - - return $this->query->paginate($perPage, $columns); - } - - /** - * Paginate the given query into a simple paginator. - * - * @param int $perPage - * @param array $columns - * @return \Illuminate\Contracts\Pagination\Paginator - */ - public function simplePaginate($perPage = null, $columns = ['*']) - { - $this->query->addSelect($this->getSelectColumns($columns)); - - return $this->query->simplePaginate($perPage, $columns); - } - - /** - * Get the key for comparing against the parent key in "has" query. - * - * @return string - */ - public function getHasCompareKey() - { - return $this->farParent->getQualifiedKeyName(); - } - +use Illuminate\Database\Eloquent\ModelNotFoundException; + +class HasManyThrough extends Relation +{ + /** + * The distance parent model instance. + * + * @var \Illuminate\Database\Eloquent\Model + */ + protected $farParent; + + /** + * The near key on the relationship. + * + * @var string + */ + protected $firstKey; + + /** + * The far key on the relationship. + * + * @var string + */ + protected $secondKey; + + /** + * The local key on the relationship. + * + * @var string + */ + protected $localKey; + + /** + * Create a new has many through relationship instance. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $farParent + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $firstKey + * @param string $secondKey + * @param string $localKey + * @return void + */ + public function __construct(Builder $query, Model $farParent, Model $parent, $firstKey, $secondKey, $localKey) + { + $this->localKey = $localKey; + $this->firstKey = $firstKey; + $this->secondKey = $secondKey; + $this->farParent = $farParent; + + parent::__construct($query, $parent); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + $parentTable = $this->parent->getTable(); + + $localValue = $this->farParent[$this->localKey]; + + $this->setJoin(); + + if (static::$constraints) { + $this->query->where($parentTable.'.'.$this->firstKey, '=', $localValue); + } + } + + /** + * Add the constraints for a relationship count query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parent + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationCountQuery(Builder $query, Builder $parent) + { + $parentTable = $this->parent->getTable(); + + $this->setJoin($query); + + $query->select(new Expression('count(*)')); + + $key = $this->wrap($parentTable.'.'.$this->firstKey); + + return $query->where($this->getHasCompareKey(), '=', new Expression($key)); + } + + /** + * Set the join clause on the query. + * + * @param \Illuminate\Database\Eloquent\Builder|null $query + * @return void + */ + protected function setJoin(Builder $query = null) + { + $query = $query ?: $this->query; + + $foreignKey = $this->related->getTable().'.'.$this->secondKey; + + $query->join($this->parent->getTable(), $this->getQualifiedParentKeyName(), '=', $foreignKey); + + if ($this->parentSoftDeletes()) { + $query->whereNull($this->parent->getQualifiedDeletedAtColumn()); + } + } + + /** + * Determine whether close parent of the relation uses Soft Deletes. + * + * @return bool + */ + public function parentSoftDeletes() + { + return in_array('Illuminate\Database\Eloquent\SoftDeletes', class_uses_recursive(get_class($this->parent))); + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + $table = $this->parent->getTable(); + + $this->query->whereIn($table.'.'.$this->firstKey, $this->getKeys($models)); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->related->newCollection()); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + $dictionary = $this->buildDictionary($results); + + // Once we have the dictionary we can simply spin through the parent models to + // link them up with their children using the keyed dictionary to make the + // matching very convenient and easy work. Then we'll just return them. + foreach ($models as $model) { + $key = $model->getKey(); + + if (isset($dictionary[$key])) { + $value = $this->related->newCollection($dictionary[$key]); + + $model->setRelation($relation, $value); + } + } + + return $models; + } + + /** + * Build model dictionary keyed by the relation's foreign key. + * + * @param \Illuminate\Database\Eloquent\Collection $results + * @return array + */ + protected function buildDictionary(Collection $results) + { + $dictionary = []; + + $foreign = $this->firstKey; + + // First we will create a dictionary of models keyed by the foreign key of the + // relationship as this will allow us to quickly access all of the related + // models without having to do nested looping which will be quite slow. + foreach ($results as $result) { + $dictionary[$result->{$foreign}][] = $result; + } + + return $dictionary; + } + + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + return $this->get(); + } + + /** + * Execute the query and get the first related model. + * + * @param array $columns + * @return mixed + */ + public function first($columns = ['*']) + { + $results = $this->take(1)->get($columns); + + return count($results) > 0 ? $results->first() : null; + } + + /** + * Execute the query and get the first result or throw an exception. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|static + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function firstOrFail($columns = ['*']) + { + if (! is_null($model = $this->first($columns))) { + return $model; + } + + throw new ModelNotFoundException; + } + + /** + * Find a related model by its primary key. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null + */ + public function find($id, $columns = ['*']) + { + if (is_array($id)) { + return $this->findMany($id, $columns); + } + + $this->where($this->getRelated()->getQualifiedKeyName(), '=', $id); + + return $this->first($columns); + } + + /** + * Find multiple related models by their primary keys. + * + * @param mixed $ids + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function findMany($ids, $columns = ['*']) + { + if (empty($ids)) { + return $this->getRelated()->newCollection(); + } + + $this->whereIn($this->getRelated()->getQualifiedKeyName(), $ids); + + return $this->get($columns); + } + + /** + * Find a related model by its primary key or throw an exception. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function findOrFail($id, $columns = ['*']) + { + $result = $this->find($id, $columns); + + if (is_array($id)) { + if (count($result) == count(array_unique($id))) { + return $result; + } + } elseif (! is_null($result)) { + return $result; + } + + throw (new ModelNotFoundException)->setModel(get_class($this->parent)); + } + + /** + * Execute the query as a "select" statement. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function get($columns = ['*']) + { + // First we'll add the proper select columns onto the query so it is run with + // the proper columns. Then, we will get the results and hydrate out pivot + // models with the result of those columns as a separate model relation. + $columns = $this->query->getQuery()->columns ? [] : $columns; + + $select = $this->getSelectColumns($columns); + + $models = $this->query->addSelect($select)->getModels(); + + // If we actually found models we will also eager load any relationships that + // have been specified as needing to be eager loaded. This will solve the + // n + 1 query problem for the developer and also increase performance. + if (count($models) > 0) { + $models = $this->query->eagerLoadRelations($models); + } + + return $this->related->newCollection($models); + } + + /** + * Set the select clause for the relation query. + * + * @param array $columns + * @return array + */ + protected function getSelectColumns(array $columns = ['*']) + { + if ($columns == ['*']) { + $columns = [$this->related->getTable().'.*']; + } + + return array_merge($columns, [$this->parent->getTable().'.'.$this->firstKey]); + } + + /** + * Get a paginator for the "select" statement. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @param int $page + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + */ + public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $this->query->addSelect($this->getSelectColumns($columns)); + + return $this->query->paginate($perPage, $columns, $pageName, $page); + } + + /** + * Paginate the given query into a simple paginator. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @return \Illuminate\Contracts\Pagination\Paginator + */ + public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page') + { + $this->query->addSelect($this->getSelectColumns($columns)); + + return $this->query->simplePaginate($perPage, $columns, $pageName); + } + + /** + * Get the key for comparing against the parent key in "has" query. + * + * @return string + */ + public function getHasCompareKey() + { + return $this->farParent->getQualifiedKeyName(); + } + + /** + * Get the qualified foreign key on the related model. + * + * @return string + */ + public function getForeignKey() + { + return $this->related->getTable().'.'.$this->secondKey; + } + + /** + * Get the qualified foreign key on the "through" model. + * + * @return string + */ + public function getThroughKey() + { + return $this->parent->getTable().'.'.$this->firstKey; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOne.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOne.php index fd0f9a0..52ad2a6 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOne.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOne.php @@ -1,47 +1,47 @@ -query->first(); - } +use Illuminate\Database\Eloquent\Collection; - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) - { - $model->setRelation($relation, null); - } +class HasOne extends HasOneOrMany +{ + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + return $this->query->first(); + } - return $models; - } + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, null); + } - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - return $this->matchOne($models, $results, $relation); - } + return $models; + } + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $this->matchOne($models, $results, $relation); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php index 475b10d..dcf4de6 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php @@ -1,410 +1,405 @@ -localKey = $localKey; - $this->foreignKey = $foreignKey; - - parent::__construct($query, $parent); - } - - /** - * Set the base constraints on the relation query. - * - * @return void - */ - public function addConstraints() - { - if (static::$constraints) - { - $this->query->where($this->foreignKey, '=', $this->getParentKey()); - - $this->query->whereNotNull($this->foreignKey); - } - } - - /** - * Add the constraints for a relationship count query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parent - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationCountQuery(Builder $query, Builder $parent) - { - if ($parent->getQuery()->from == $query->getQuery()->from) - { - return $this->getRelationCountQueryForSelfRelation($query, $parent); - } - - return parent::getRelationCountQuery($query, $parent); - } - - /** - * Add the constraints for a relationship count query on the same table. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parent - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationCountQueryForSelfRelation(Builder $query, Builder $parent) - { - $query->select(new Expression('count(*)')); - - $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash()); - - $key = $this->wrap($this->getQualifiedParentKeyName()); - - return $query->where($hash.'.'.$this->getPlainForeignKey(), '=', new Expression($key)); - } - - /** - * Get a relationship join table hash. - * - * @return string - */ - public function getRelationCountHash() - { - return 'self_'.md5(microtime(true)); - } - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - public function addEagerConstraints(array $models) - { - $this->query->whereIn($this->foreignKey, $this->getKeys($models, $this->localKey)); - } - - /** - * Match the eagerly loaded results to their single parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function matchOne(array $models, Collection $results, $relation) - { - return $this->matchOneOrMany($models, $results, $relation, 'one'); - } - - /** - * Match the eagerly loaded results to their many parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function matchMany(array $models, Collection $results, $relation) - { - return $this->matchOneOrMany($models, $results, $relation, 'many'); - } - - /** - * Match the eagerly loaded results to their many parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @param string $type - * @return array - */ - protected function matchOneOrMany(array $models, Collection $results, $relation, $type) - { - $dictionary = $this->buildDictionary($results); - - // Once we have the dictionary we can simply spin through the parent models to - // link them up with their children using the keyed dictionary to make the - // matching very convenient and easy work. Then we'll just return them. - foreach ($models as $model) - { - $key = $model->getAttribute($this->localKey); - - if (isset($dictionary[$key])) - { - $value = $this->getRelationValue($dictionary, $key, $type); - - $model->setRelation($relation, $value); - } - } - - return $models; - } - - /** - * Get the value of a relationship by one or many type. - * - * @param array $dictionary - * @param string $key - * @param string $type - * @return mixed - */ - protected function getRelationValue(array $dictionary, $key, $type) - { - $value = $dictionary[$key]; - - return $type == 'one' ? reset($value) : $this->related->newCollection($value); - } - - /** - * Build model dictionary keyed by the relation's foreign key. - * - * @param \Illuminate\Database\Eloquent\Collection $results - * @return array - */ - protected function buildDictionary(Collection $results) - { - $dictionary = array(); - - $foreign = $this->getPlainForeignKey(); - - // First we will create a dictionary of models keyed by the foreign key of the - // relationship as this will allow us to quickly access all of the related - // models without having to do nested looping which will be quite slow. - foreach ($results as $result) - { - $dictionary[$result->{$foreign}][] = $result; - } - - return $dictionary; - } - - /** - * Attach a model instance to the parent model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return \Illuminate\Database\Eloquent\Model - */ - public function save(Model $model) - { - $model->setAttribute($this->getPlainForeignKey(), $this->getParentKey()); - - return $model->save() ? $model : false; - } - - /** - * Attach an array of models to the parent instance. - * - * @param array $models - * @return array - */ - public function saveMany(array $models) - { - array_walk($models, array($this, 'save')); - - return $models; - } - - /** - * Find a model by its primary key or return new instance of the related model. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model - */ - public function findOrNew($id, $columns = ['*']) - { - if (is_null($instance = $this->find($id, $columns))) - { - $instance = $this->related->newInstance(); - - $instance->setAttribute($this->getPlainForeignKey(), $this->getParentKey()); - } - - return $instance; - } - - /** - * Get the first related model record matching the attributes or instantiate it. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model - */ - public function firstOrNew(array $attributes) - { - if (is_null($instance = $this->where($attributes)->first())) - { - $instance = $this->related->newInstance($attributes); - - $instance->setAttribute($this->getPlainForeignKey(), $this->getParentKey()); - } - - return $instance; - } - - /** - * Get the first related record matching the attributes or create it. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model - */ - public function firstOrCreate(array $attributes) - { - if (is_null($instance = $this->where($attributes)->first())) - { - $instance = $this->create($attributes); - } - - return $instance; - } - - /** - * Create or update a related record matching the attributes, and fill it with values. - * - * @param array $attributes - * @param array $values - * @return \Illuminate\Database\Eloquent\Model - */ - public function updateOrCreate(array $attributes, array $values = []) - { - $instance = $this->firstOrNew($attributes); - - $instance->fill($values); - - $instance->save(); - - return $instance; - } - - /** - * Create a new instance of the related model. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model - */ - public function create(array $attributes) - { - // Here we will set the raw attributes to avoid hitting the "fill" method so - // that we do not have to worry about a mass accessor rules blocking sets - // on the models. Otherwise, some of these attributes will not get set. - $instance = $this->related->newInstance($attributes); - - $instance->setAttribute($this->getPlainForeignKey(), $this->getParentKey()); - - $instance->save(); - - return $instance; - } - - /** - * Create an array of new instances of the related model. - * - * @param array $records - * @return array - */ - public function createMany(array $records) - { - $instances = array(); - - foreach ($records as $record) - { - $instances[] = $this->create($record); - } - - return $instances; - } - - /** - * Perform an update on all the related models. - * - * @param array $attributes - * @return int - */ - public function update(array $attributes) - { - if ($this->related->usesTimestamps()) - { - $attributes[$this->relatedUpdatedAt()] = $this->related->freshTimestampString(); - } - - return $this->query->update($attributes); - } - - /** - * Get the key for comparing against the parent key in "has" query. - * - * @return string - */ - public function getHasCompareKey() - { - return $this->getForeignKey(); - } - - /** - * Get the foreign key for the relationship. - * - * @return string - */ - public function getForeignKey() - { - return $this->foreignKey; - } - - /** - * Get the plain foreign key. - * - * @return string - */ - public function getPlainForeignKey() - { - $segments = explode('.', $this->getForeignKey()); - - return $segments[count($segments) - 1]; - } - - /** - * Get the key value of the parent's local key. - * - * @return mixed - */ - public function getParentKey() - { - return $this->parent->getAttribute($this->localKey); - } - - /** - * Get the fully qualified parent key name. - * - * @return string - */ - public function getQualifiedParentKeyName() - { - return $this->parent->getTable().'.'.$this->localKey; - } - +abstract class HasOneOrMany extends Relation +{ + /** + * The foreign key of the parent model. + * + * @var string + */ + protected $foreignKey; + + /** + * The local key of the parent model. + * + * @var string + */ + protected $localKey; + + /** + * Create a new has one or many relationship instance. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $foreignKey + * @param string $localKey + * @return void + */ + public function __construct(Builder $query, Model $parent, $foreignKey, $localKey) + { + $this->localKey = $localKey; + $this->foreignKey = $foreignKey; + + parent::__construct($query, $parent); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + if (static::$constraints) { + $this->query->where($this->foreignKey, '=', $this->getParentKey()); + + $this->query->whereNotNull($this->foreignKey); + } + } + + /** + * Add the constraints for a relationship count query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parent + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationCountQuery(Builder $query, Builder $parent) + { + if ($parent->getQuery()->from == $query->getQuery()->from) { + return $this->getRelationCountQueryForSelfRelation($query, $parent); + } + + return parent::getRelationCountQuery($query, $parent); + } + + /** + * Add the constraints for a relationship count query on the same table. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parent + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationCountQueryForSelfRelation(Builder $query, Builder $parent) + { + $query->select(new Expression('count(*)')); + + $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash()); + + $query->getModel()->setTable($hash); + + $key = $this->wrap($this->getQualifiedParentKeyName()); + + return $query->where($hash.'.'.$this->getPlainForeignKey(), '=', new Expression($key)); + } + + /** + * Get a relationship join table hash. + * + * @return string + */ + public function getRelationCountHash() + { + return 'self_'.md5(microtime(true)); + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + $this->query->whereIn($this->foreignKey, $this->getKeys($models, $this->localKey)); + } + + /** + * Match the eagerly loaded results to their single parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function matchOne(array $models, Collection $results, $relation) + { + return $this->matchOneOrMany($models, $results, $relation, 'one'); + } + + /** + * Match the eagerly loaded results to their many parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function matchMany(array $models, Collection $results, $relation) + { + return $this->matchOneOrMany($models, $results, $relation, 'many'); + } + + /** + * Match the eagerly loaded results to their many parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @param string $type + * @return array + */ + protected function matchOneOrMany(array $models, Collection $results, $relation, $type) + { + $dictionary = $this->buildDictionary($results); + + // Once we have the dictionary we can simply spin through the parent models to + // link them up with their children using the keyed dictionary to make the + // matching very convenient and easy work. Then we'll just return them. + foreach ($models as $model) { + $key = $model->getAttribute($this->localKey); + + if (isset($dictionary[$key])) { + $value = $this->getRelationValue($dictionary, $key, $type); + + $model->setRelation($relation, $value); + } + } + + return $models; + } + + /** + * Get the value of a relationship by one or many type. + * + * @param array $dictionary + * @param string $key + * @param string $type + * @return mixed + */ + protected function getRelationValue(array $dictionary, $key, $type) + { + $value = $dictionary[$key]; + + return $type == 'one' ? reset($value) : $this->related->newCollection($value); + } + + /** + * Build model dictionary keyed by the relation's foreign key. + * + * @param \Illuminate\Database\Eloquent\Collection $results + * @return array + */ + protected function buildDictionary(Collection $results) + { + $dictionary = []; + + $foreign = $this->getPlainForeignKey(); + + // First we will create a dictionary of models keyed by the foreign key of the + // relationship as this will allow us to quickly access all of the related + // models without having to do nested looping which will be quite slow. + foreach ($results as $result) { + $dictionary[$result->{$foreign}][] = $result; + } + + return $dictionary; + } + + /** + * Attach a model instance to the parent model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return \Illuminate\Database\Eloquent\Model|false + */ + public function save(Model $model) + { + $model->setAttribute($this->getPlainForeignKey(), $this->getParentKey()); + + return $model->save() ? $model : false; + } + + /** + * Attach a collection of models to the parent instance. + * + * @param \Illuminate\Database\Eloquent\Collection|array $models + * @return \Illuminate\Database\Eloquent\Collection|array + */ + public function saveMany($models) + { + foreach ($models as $model) { + $this->save($model); + } + + return $models; + } + + /** + * Find a model by its primary key or return new instance of the related model. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model + */ + public function findOrNew($id, $columns = ['*']) + { + if (is_null($instance = $this->find($id, $columns))) { + $instance = $this->related->newInstance(); + + $instance->setAttribute($this->getPlainForeignKey(), $this->getParentKey()); + } + + return $instance; + } + + /** + * Get the first related model record matching the attributes or instantiate it. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrNew(array $attributes) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->related->newInstance($attributes); + + $instance->setAttribute($this->getPlainForeignKey(), $this->getParentKey()); + } + + return $instance; + } + + /** + * Get the first related record matching the attributes or create it. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrCreate(array $attributes) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->create($attributes); + } + + return $instance; + } + + /** + * Create or update a related record matching the attributes, and fill it with values. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model + */ + public function updateOrCreate(array $attributes, array $values = []) + { + $instance = $this->firstOrNew($attributes); + + $instance->fill($values); + + $instance->save(); + + return $instance; + } + + /** + * Create a new instance of the related model. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function create(array $attributes) + { + // Here we will set the raw attributes to avoid hitting the "fill" method so + // that we do not have to worry about a mass accessor rules blocking sets + // on the models. Otherwise, some of these attributes will not get set. + $instance = $this->related->newInstance($attributes); + + $instance->setAttribute($this->getPlainForeignKey(), $this->getParentKey()); + + $instance->save(); + + return $instance; + } + + /** + * Create an array of new instances of the related model. + * + * @param array $records + * @return array + */ + public function createMany(array $records) + { + $instances = []; + + foreach ($records as $record) { + $instances[] = $this->create($record); + } + + return $instances; + } + + /** + * Perform an update on all the related models. + * + * @param array $attributes + * @return int + */ + public function update(array $attributes) + { + if ($this->related->usesTimestamps()) { + $attributes[$this->relatedUpdatedAt()] = $this->related->freshTimestampString(); + } + + return $this->query->update($attributes); + } + + /** + * Get the key for comparing against the parent key in "has" query. + * + * @return string + */ + public function getHasCompareKey() + { + return $this->getForeignKey(); + } + + /** + * Get the foreign key for the relationship. + * + * @return string + */ + public function getForeignKey() + { + return $this->foreignKey; + } + + /** + * Get the plain foreign key. + * + * @return string + */ + public function getPlainForeignKey() + { + $segments = explode('.', $this->getForeignKey()); + + return $segments[count($segments) - 1]; + } + + /** + * Get the key value of the parent's local key. + * + * @return mixed + */ + public function getParentKey() + { + return $this->parent->getAttribute($this->localKey); + } + + /** + * Get the fully qualified parent key name. + * + * @return string + */ + public function getQualifiedParentKeyName() + { + return $this->parent->getTable().'.'.$this->localKey; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphMany.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphMany.php index 1abdf37..e2a5c5a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphMany.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphMany.php @@ -1,47 +1,47 @@ -query->get(); - } +use Illuminate\Database\Eloquent\Collection; - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) - { - $model->setRelation($relation, $this->related->newCollection()); - } +class MorphMany extends MorphOneOrMany +{ + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + return $this->query->get(); + } - return $models; - } + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->related->newCollection()); + } - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - return $this->matchMany($models, $results, $relation); - } + return $models; + } + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $this->matchMany($models, $results, $relation); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOne.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOne.php index fdebc24..339a68c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOne.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOne.php @@ -1,47 +1,47 @@ -query->first(); - } +use Illuminate\Database\Eloquent\Collection; - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) - { - $model->setRelation($relation, null); - } +class MorphOne extends MorphOneOrMany +{ + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + return $this->query->first(); + } - return $models; - } + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, null); + } - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - return $this->matchOne($models, $results, $relation); - } + return $models; + } + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $this->matchOne($models, $results, $relation); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php index 844ed78..658452c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php @@ -1,236 +1,233 @@ -morphType = $type; - - $this->morphClass = $parent->getMorphClass(); - - parent::__construct($query, $parent, $id, $localKey); - } - - /** - * Set the base constraints on the relation query. - * - * @return void - */ - public function addConstraints() - { - if (static::$constraints) - { - parent::addConstraints(); - - $this->query->where($this->morphType, $this->morphClass); - } - } - - /** - * Get the relationship count query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parent - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationCountQuery(Builder $query, Builder $parent) - { - $query = parent::getRelationCountQuery($query, $parent); - - return $query->where($this->morphType, $this->morphClass); - } - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - public function addEagerConstraints(array $models) - { - parent::addEagerConstraints($models); - - $this->query->where($this->morphType, $this->morphClass); - } - - /** - * Attach a model instance to the parent model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return \Illuminate\Database\Eloquent\Model - */ - public function save(Model $model) - { - $model->setAttribute($this->getPlainMorphType(), $this->morphClass); - - return parent::save($model); - } - - /** - * Find a related model by its primary key or return new instance of the related model. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model - */ - public function findOrNew($id, $columns = ['*']) - { - if (is_null($instance = $this->find($id, $columns))) - { - $instance = $this->related->newInstance(); - - // When saving a polymorphic relationship, we need to set not only the foreign - // key, but also the foreign key type, which is typically the class name of - // the parent model. This makes the polymorphic item unique in the table. - $this->setForeignAttributesForCreate($instance); - } - - return $instance; - } - - /** - * Get the first related model record matching the attributes or instantiate it. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model - */ - public function firstOrNew(array $attributes) - { - if (is_null($instance = $this->where($attributes)->first())) - { - $instance = $this->related->newInstance($attributes); - - // When saving a polymorphic relationship, we need to set not only the foreign - // key, but also the foreign key type, which is typically the class name of - // the parent model. This makes the polymorphic item unique in the table. - $this->setForeignAttributesForCreate($instance); - } - - return $instance; - } - - /** - * Get the first related record matching the attributes or create it. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model - */ - public function firstOrCreate(array $attributes) - { - if (is_null($instance = $this->where($attributes)->first())) - { - $instance = $this->create($attributes); - } - - return $instance; - } - - /** - * Create or update a related record matching the attributes, and fill it with values. - * - * @param array $attributes - * @param array $values - * @return \Illuminate\Database\Eloquent\Model - */ - public function updateOrCreate(array $attributes, array $values = []) - { - $instance = $this->firstOrNew($attributes); - - $instance->fill($values); - - $instance->save(); - - return $instance; - } - - /** - * Create a new instance of the related model. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model - */ - public function create(array $attributes) - { - $instance = $this->related->newInstance($attributes); - - // When saving a polymorphic relationship, we need to set not only the foreign - // key, but also the foreign key type, which is typically the class name of - // the parent model. This makes the polymorphic item unique in the table. - $this->setForeignAttributesForCreate($instance); - - $instance->save(); - - return $instance; - } - - /** - * Set the foreign ID and type for creating a related model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return void - */ - protected function setForeignAttributesForCreate(Model $model) - { - $model->{$this->getPlainForeignKey()} = $this->getParentKey(); - - $model->{last(explode('.', $this->morphType))} = $this->morphClass; - } - - /** - * Get the foreign key "type" name. - * - * @return string - */ - public function getMorphType() - { - return $this->morphType; - } - - /** - * Get the plain morph type name without the table. - * - * @return string - */ - public function getPlainMorphType() - { - return last(explode('.', $this->morphType)); - } - - /** - * Get the class name of the parent model. - * - * @return string - */ - public function getMorphClass() - { - return $this->morphClass; - } - +abstract class MorphOneOrMany extends HasOneOrMany +{ + /** + * The foreign key type for the relationship. + * + * @var string + */ + protected $morphType; + + /** + * The class name of the parent model. + * + * @var string + */ + protected $morphClass; + + /** + * Create a new morph one or many relationship instance. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $type + * @param string $id + * @param string $localKey + * @return void + */ + public function __construct(Builder $query, Model $parent, $type, $id, $localKey) + { + $this->morphType = $type; + + $this->morphClass = $parent->getMorphClass(); + + parent::__construct($query, $parent, $id, $localKey); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + if (static::$constraints) { + parent::addConstraints(); + + $this->query->where($this->morphType, $this->morphClass); + } + } + + /** + * Get the relationship count query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parent + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationCountQuery(Builder $query, Builder $parent) + { + $query = parent::getRelationCountQuery($query, $parent); + + return $query->where($this->morphType, $this->morphClass); + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + parent::addEagerConstraints($models); + + $this->query->where($this->morphType, $this->morphClass); + } + + /** + * Attach a model instance to the parent model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return \Illuminate\Database\Eloquent\Model + */ + public function save(Model $model) + { + $model->setAttribute($this->getPlainMorphType(), $this->morphClass); + + return parent::save($model); + } + + /** + * Find a related model by its primary key or return new instance of the related model. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model + */ + public function findOrNew($id, $columns = ['*']) + { + if (is_null($instance = $this->find($id, $columns))) { + $instance = $this->related->newInstance(); + + // When saving a polymorphic relationship, we need to set not only the foreign + // key, but also the foreign key type, which is typically the class name of + // the parent model. This makes the polymorphic item unique in the table. + $this->setForeignAttributesForCreate($instance); + } + + return $instance; + } + + /** + * Get the first related model record matching the attributes or instantiate it. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrNew(array $attributes) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->related->newInstance($attributes); + + // When saving a polymorphic relationship, we need to set not only the foreign + // key, but also the foreign key type, which is typically the class name of + // the parent model. This makes the polymorphic item unique in the table. + $this->setForeignAttributesForCreate($instance); + } + + return $instance; + } + + /** + * Get the first related record matching the attributes or create it. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrCreate(array $attributes) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->create($attributes); + } + + return $instance; + } + + /** + * Create or update a related record matching the attributes, and fill it with values. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model + */ + public function updateOrCreate(array $attributes, array $values = []) + { + $instance = $this->firstOrNew($attributes); + + $instance->fill($values); + + $instance->save(); + + return $instance; + } + + /** + * Create a new instance of the related model. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function create(array $attributes) + { + $instance = $this->related->newInstance($attributes); + + // When saving a polymorphic relationship, we need to set not only the foreign + // key, but also the foreign key type, which is typically the class name of + // the parent model. This makes the polymorphic item unique in the table. + $this->setForeignAttributesForCreate($instance); + + $instance->save(); + + return $instance; + } + + /** + * Set the foreign ID and type for creating a related model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return void + */ + protected function setForeignAttributesForCreate(Model $model) + { + $model->{$this->getPlainForeignKey()} = $this->getParentKey(); + + $model->{last(explode('.', $this->morphType))} = $this->morphClass; + } + + /** + * Get the foreign key "type" name. + * + * @return string + */ + public function getMorphType() + { + return $this->morphType; + } + + /** + * Get the plain morph type name without the table. + * + * @return string + */ + public function getPlainMorphType() + { + return last(explode('.', $this->morphType)); + } + + /** + * Get the class name of the parent model. + * + * @return string + */ + public function getMorphClass() + { + return $this->morphClass; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php index fe8c644..b7a2f34 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php @@ -1,78 +1,79 @@ -where($this->morphType, $this->morphClass); + /** + * The value of the polymorphic relation. + * + * Explicitly define this so it's not included in saved attributes. + * + * @var string + */ + protected $morphClass; - return parent::setKeysForSaveQuery($query); - } + /** + * Set the keys for a save update query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function setKeysForSaveQuery(Builder $query) + { + $query->where($this->morphType, $this->morphClass); - /** - * Delete the pivot model record from the database. - * - * @return int - */ - public function delete() - { - $query = $this->getDeleteQuery(); + return parent::setKeysForSaveQuery($query); + } - $query->where($this->morphType, $this->morphClass); + /** + * Delete the pivot model record from the database. + * + * @return int + */ + public function delete() + { + $query = $this->getDeleteQuery(); - return $query->delete(); - } + $query->where($this->morphType, $this->morphClass); - /** - * Set the morph type for the pivot. - * - * @param string $morphType - * @return $this - */ - public function setMorphType($morphType) - { - $this->morphType = $morphType; + return $query->delete(); + } - return $this; - } + /** + * Set the morph type for the pivot. + * + * @param string $morphType + * @return $this + */ + public function setMorphType($morphType) + { + $this->morphType = $morphType; - /** - * Set the morph class for the pivot. - * - * @param string $morphClass - * @return \Illuminate\Database\Eloquent\Relations\MorphPivot - */ - public function setMorphClass($morphClass) - { - $this->morphClass = $morphClass; + return $this; + } - return $this; - } + /** + * Set the morph class for the pivot. + * + * @param string $morphClass + * @return \Illuminate\Database\Eloquent\Relations\MorphPivot + */ + public function setMorphClass($morphClass) + { + $this->morphClass = $morphClass; + return $this; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphTo.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphTo.php index 1d9821d..94b6feb 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphTo.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphTo.php @@ -1,273 +1,268 @@ -morphType = $type; - - parent::__construct($query, $parent, $foreignKey, $otherKey, $relation); - } - - /** - * Get the results of the relationship. - * - * @return mixed - */ - public function getResults() - { - if ( ! $this->otherKey) return; - - return $this->query->first(); - } - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - public function addEagerConstraints(array $models) - { - $this->buildDictionary($this->models = Collection::make($models)); - } - - /** - * Build a dictionary with the models. - * - * @param \Illuminate\Database\Eloquent\Collection $models - * @return void - */ - protected function buildDictionary(Collection $models) - { - foreach ($models as $model) - { - if ($model->{$this->morphType}) - { - $this->dictionary[$model->{$this->morphType}][$model->{$this->foreignKey}][] = $model; - } - } - } - - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - return $models; - } - - /** - * Associate the model instance to the given parent. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return \Illuminate\Database\Eloquent\Model - */ - public function associate(Model $model) - { - $this->parent->setAttribute($this->foreignKey, $model->getKey()); - - $this->parent->setAttribute($this->morphType, $model->getMorphClass()); - - return $this->parent->setRelation($this->relation, $model); - } - - /** - * Dissociate previously associated model from the given parent. - * - * @return \Illuminate\Database\Eloquent\Model - */ - public function dissociate() - { - $this->parent->setAttribute($this->foreignKey, null); - - $this->parent->setAttribute($this->morphType, null); - - return $this->parent->setRelation($this->relation, null); - } - - /** - * Get the results of the relationship. - * - * Called via eager load method of Eloquent query builder. - * - * @return mixed - */ - public function getEager() - { - foreach (array_keys($this->dictionary) as $type) - { - $this->matchToMorphParents($type, $this->getResultsByType($type)); - } - - return $this->models; - } - - /** - * Match the results for a given type to their parents. - * - * @param string $type - * @param \Illuminate\Database\Eloquent\Collection $results - * @return void - */ - protected function matchToMorphParents($type, Collection $results) - { - foreach ($results as $result) - { - if (isset($this->dictionary[$type][$result->getKey()])) - { - foreach ($this->dictionary[$type][$result->getKey()] as $model) - { - $model->setRelation($this->relation, $result); - } - } - } - } - - /** - * Get all of the relation results for a type. - * - * @param string $type - * @return \Illuminate\Database\Eloquent\Collection - */ - protected function getResultsByType($type) - { - $instance = $this->createModelByType($type); - - $key = $instance->getKeyName(); - - $query = $instance->newQuery(); - - $query = $this->useWithTrashed($query); - - return $query->whereIn($key, $this->gatherKeysByType($type)->all())->get(); - } - - /** - * Gather all of the foreign keys for a given type. - * - * @param string $type - * @return array - */ - protected function gatherKeysByType($type) - { - $foreign = $this->foreignKey; - - return BaseCollection::make($this->dictionary[$type])->map(function($models) use ($foreign) - { - return head($models)->{$foreign}; - - })->unique(); - } - - /** - * Create a new model instance by type. - * - * @param string $type - * @return \Illuminate\Database\Eloquent\Model - */ - public function createModelByType($type) - { - return new $type; - } - - /** - * Get the foreign key "type" name. - * - * @return string - */ - public function getMorphType() - { - return $this->morphType; - } - - /** - * Get the dictionary used by the relationship. - * - * @return array - */ - public function getDictionary() - { - return $this->dictionary; - } - - /** - * Fetch soft-deleted model instances with query. - * - * @return $this - */ - public function withTrashed() - { - $this->withTrashed = true; - - $this->query = $this->useWithTrashed($this->query); - - return $this; - } - - /** - * Return trashed models with query if told so. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function useWithTrashed(Builder $query) - { - if ($this->withTrashed && $query->getMacro('withTrashed') !== null) - { - return $query->withTrashed(); - } - - return $query; - } +class MorphTo extends BelongsTo +{ + /** + * The type of the polymorphic relation. + * + * @var string + */ + protected $morphType; + + /** + * The models whose relations are being eager loaded. + * + * @var \Illuminate\Database\Eloquent\Collection + */ + protected $models; + + /** + * All of the models keyed by ID. + * + * @var array + */ + protected $dictionary = []; + + /* + * Indicates if soft-deleted model instances should be fetched. + * + * @var bool + */ + protected $withTrashed = false; + + /** + * Create a new morph to relationship instance. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $foreignKey + * @param string $otherKey + * @param string $type + * @param string $relation + * @return void + */ + public function __construct(Builder $query, Model $parent, $foreignKey, $otherKey, $type, $relation) + { + $this->morphType = $type; + + parent::__construct($query, $parent, $foreignKey, $otherKey, $relation); + } + + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + if (! $this->otherKey) { + return; + } + + return $this->query->first(); + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + $this->buildDictionary($this->models = Collection::make($models)); + } + + /** + * Build a dictionary with the models. + * + * @param \Illuminate\Database\Eloquent\Collection $models + * @return void + */ + protected function buildDictionary(Collection $models) + { + foreach ($models as $model) { + if ($model->{$this->morphType}) { + $this->dictionary[$model->{$this->morphType}][$model->{$this->foreignKey}][] = $model; + } + } + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $models; + } + + /** + * Associate the model instance to the given parent. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return \Illuminate\Database\Eloquent\Model + */ + public function associate($model) + { + $this->parent->setAttribute($this->foreignKey, $model->getKey()); + + $this->parent->setAttribute($this->morphType, $model->getMorphClass()); + + return $this->parent->setRelation($this->relation, $model); + } + + /** + * Dissociate previously associated model from the given parent. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function dissociate() + { + $this->parent->setAttribute($this->foreignKey, null); + + $this->parent->setAttribute($this->morphType, null); + + return $this->parent->setRelation($this->relation, null); + } + + /** + * Get the results of the relationship. + * + * Called via eager load method of Eloquent query builder. + * + * @return mixed + */ + public function getEager() + { + foreach (array_keys($this->dictionary) as $type) { + $this->matchToMorphParents($type, $this->getResultsByType($type)); + } + + return $this->models; + } + + /** + * Match the results for a given type to their parents. + * + * @param string $type + * @param \Illuminate\Database\Eloquent\Collection $results + * @return void + */ + protected function matchToMorphParents($type, Collection $results) + { + foreach ($results as $result) { + if (isset($this->dictionary[$type][$result->getKey()])) { + foreach ($this->dictionary[$type][$result->getKey()] as $model) { + $model->setRelation($this->relation, $result); + } + } + } + } + + /** + * Get all of the relation results for a type. + * + * @param string $type + * @return \Illuminate\Database\Eloquent\Collection + */ + protected function getResultsByType($type) + { + $instance = $this->createModelByType($type); + + $key = $instance->getTable().'.'.$instance->getKeyName(); + + $query = $instance->newQuery()->with($this->getQuery()->getEagerLoads()); + + $query = $this->useWithTrashed($query); + + return $query->whereIn($key, $this->gatherKeysByType($type)->all())->get(); + } + + /** + * Gather all of the foreign keys for a given type. + * + * @param string $type + * @return array + */ + protected function gatherKeysByType($type) + { + $foreign = $this->foreignKey; + + return collect($this->dictionary[$type])->map(function ($models) use ($foreign) { + return head($models)->{$foreign}; + })->values()->unique(); + } + + /** + * Create a new model instance by type. + * + * @param string $type + * @return \Illuminate\Database\Eloquent\Model + */ + public function createModelByType($type) + { + $class = $this->parent->getActualClassNameForMorph($type); + + return new $class; + } + + /** + * Get the foreign key "type" name. + * + * @return string + */ + public function getMorphType() + { + return $this->morphType; + } + + /** + * Get the dictionary used by the relationship. + * + * @return array + */ + public function getDictionary() + { + return $this->dictionary; + } + + /** + * Fetch soft-deleted model instances with query. + * + * @return $this + */ + public function withTrashed() + { + $this->withTrashed = true; + + $this->query = $this->useWithTrashed($this->query); + + return $this; + } + + /** + * Return trashed models with query if told so. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function useWithTrashed(Builder $query) + { + if ($this->withTrashed && $query->getMacro('withTrashed') !== null) { + return $query->withTrashed(); + } + + return $query; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php index 18d970d..373005d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php @@ -1,158 +1,160 @@ -inverse = $inverse; - $this->morphType = $name.'_type'; - $this->morphClass = $inverse ? $query->getModel()->getMorphClass() : $parent->getMorphClass(); - - parent::__construct($query, $parent, $table, $foreignKey, $otherKey, $relationName); - } - - /** - * Set the where clause for the relation query. - * - * @return $this - */ - protected function setWhere() - { - parent::setWhere(); - - $this->query->where($this->table.'.'.$this->morphType, $this->morphClass); - - return $this; - } - - /** - * Add the constraints for a relationship count query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parent - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationCountQuery(Builder $query, Builder $parent) - { - $query = parent::getRelationCountQuery($query, $parent); - - return $query->where($this->table.'.'.$this->morphType, $this->morphClass); - } - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - public function addEagerConstraints(array $models) - { - parent::addEagerConstraints($models); - - $this->query->where($this->table.'.'.$this->morphType, $this->morphClass); - } - - /** - * Create a new pivot attachment record. - * - * @param int $id - * @param bool $timed - * @return array - */ - protected function createAttachRecord($id, $timed) - { - $record = parent::createAttachRecord($id, $timed); - - return array_add($record, $this->morphType, $this->morphClass); - } - - /** - * Create a new query builder for the pivot table. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function newPivotQuery() - { - $query = parent::newPivotQuery(); - - return $query->where($this->morphType, $this->morphClass); - } - - /** - * Create a new pivot model instance. - * - * @param array $attributes - * @param bool $exists - * @return \Illuminate\Database\Eloquent\Relations\Pivot - */ - public function newPivot(array $attributes = array(), $exists = false) - { - $pivot = new MorphPivot($this->parent, $attributes, $this->table, $exists); - - $pivot->setPivotKeys($this->foreignKey, $this->otherKey) - ->setMorphType($this->morphType) - ->setMorphClass($this->morphClass); - - return $pivot; - } - - /** - * Get the foreign key "type" name. - * - * @return string - */ - public function getMorphType() - { - return $this->morphType; - } - - /** - * Get the class name of the parent model. - * - * @return string - */ - public function getMorphClass() - { - return $this->morphClass; - } - +class MorphToMany extends BelongsToMany +{ + /** + * The type of the polymorphic relation. + * + * @var string + */ + protected $morphType; + + /** + * The class name of the morph type constraint. + * + * @var string + */ + protected $morphClass; + + /** + * Indicates if we are connecting the inverse of the relation. + * + * This primarily affects the morphClass constraint. + * + * @var bool + */ + protected $inverse; + + /** + * Create a new morph to many relationship instance. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $name + * @param string $table + * @param string $foreignKey + * @param string $otherKey + * @param string $relationName + * @param bool $inverse + * @return void + */ + public function __construct(Builder $query, Model $parent, $name, $table, $foreignKey, $otherKey, $relationName = null, $inverse = false) + { + $this->inverse = $inverse; + $this->morphType = $name.'_type'; + $this->morphClass = $inverse ? $query->getModel()->getMorphClass() : $parent->getMorphClass(); + + parent::__construct($query, $parent, $table, $foreignKey, $otherKey, $relationName); + } + + /** + * Set the where clause for the relation query. + * + * @return $this + */ + protected function setWhere() + { + parent::setWhere(); + + $this->query->where($this->table.'.'.$this->morphType, $this->morphClass); + + return $this; + } + + /** + * Add the constraints for a relationship count query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parent + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationCountQuery(Builder $query, Builder $parent) + { + $query = parent::getRelationCountQuery($query, $parent); + + return $query->where($this->table.'.'.$this->morphType, $this->morphClass); + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + parent::addEagerConstraints($models); + + $this->query->where($this->table.'.'.$this->morphType, $this->morphClass); + } + + /** + * Create a new pivot attachment record. + * + * @param int $id + * @param bool $timed + * @return array + */ + protected function createAttachRecord($id, $timed) + { + $record = parent::createAttachRecord($id, $timed); + + return Arr::add($record, $this->morphType, $this->morphClass); + } + + /** + * Create a new query builder for the pivot table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function newPivotQuery() + { + $query = parent::newPivotQuery(); + + return $query->where($this->morphType, $this->morphClass); + } + + /** + * Create a new pivot model instance. + * + * @param array $attributes + * @param bool $exists + * @return \Illuminate\Database\Eloquent\Relations\Pivot + */ + public function newPivot(array $attributes = [], $exists = false) + { + $pivot = new MorphPivot($this->parent, $attributes, $this->table, $exists); + + $pivot->setPivotKeys($this->foreignKey, $this->otherKey) + ->setMorphType($this->morphType) + ->setMorphClass($this->morphClass); + + return $pivot; + } + + /** + * Get the foreign key "type" name. + * + * @return string + */ + public function getMorphType() + { + return $this->morphType; + } + + /** + * Get the class name of the parent model. + * + * @return string + */ + public function getMorphClass() + { + return $this->morphClass; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Pivot.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Pivot.php index da1e28d..4d80279 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Pivot.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Pivot.php @@ -1,173 +1,174 @@ -forceFill($attributes); - - $this->syncOriginal(); - - $this->setTable($table); - - $this->setConnection($parent->getConnectionName()); - - // We store off the parent instance so we will access the timestamp column names - // for the model, since the pivot model timestamps aren't easily configurable - // from the developer's point of view. We can use the parents to get these. - $this->parent = $parent; - - $this->exists = $exists; - - $this->timestamps = $this->hasTimestampAttributes(); - } - - /** - * Set the keys for a save update query. - * - * @param \Illuminate\Database\Eloquent\Builder - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function setKeysForSaveQuery(Builder $query) - { - $query->where($this->foreignKey, $this->getAttribute($this->foreignKey)); - - return $query->where($this->otherKey, $this->getAttribute($this->otherKey)); - } - - /** - * Delete the pivot model record from the database. - * - * @return int - */ - public function delete() - { - return $this->getDeleteQuery()->delete(); - } - - /** - * Get the query builder for a delete operation on the pivot. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function getDeleteQuery() - { - $foreign = $this->getAttribute($this->foreignKey); - - $query = $this->newQuery()->where($this->foreignKey, $foreign); - - return $query->where($this->otherKey, $this->getAttribute($this->otherKey)); - } - - /** - * Get the foreign key column name. - * - * @return string - */ - public function getForeignKey() - { - return $this->foreignKey; - } - - /** - * Get the "other key" column name. - * - * @return string - */ - public function getOtherKey() - { - return $this->otherKey; - } - - /** - * Set the key names for the pivot model instance. - * - * @param string $foreignKey - * @param string $otherKey - * @return $this - */ - public function setPivotKeys($foreignKey, $otherKey) - { - $this->foreignKey = $foreignKey; - - $this->otherKey = $otherKey; - - return $this; - } - - /** - * Determine if the pivot model has timestamp attributes. - * - * @return bool - */ - public function hasTimestampAttributes() - { - return array_key_exists($this->getCreatedAtColumn(), $this->attributes); - } - - /** - * Get the name of the "created at" column. - * - * @return string - */ - public function getCreatedAtColumn() - { - return $this->parent->getCreatedAtColumn(); - } - - /** - * Get the name of the "updated at" column. - * - * @return string - */ - public function getUpdatedAtColumn() - { - return $this->parent->getUpdatedAtColumn(); - } - +class Pivot extends Model +{ + /** + * The parent model of the relationship. + * + * @var \Illuminate\Database\Eloquent\Model + */ + protected $parent; + + /** + * The name of the foreign key column. + * + * @var string + */ + protected $foreignKey; + + /** + * The name of the "other key" column. + * + * @var string + */ + protected $otherKey; + + /** + * The attributes that aren't mass assignable. + * + * @var array + */ + protected $guarded = []; + + /** + * Create a new pivot model instance. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @param array $attributes + * @param string $table + * @param bool $exists + * @return void + */ + public function __construct(Model $parent, $attributes, $table, $exists = false) + { + parent::__construct(); + + // The pivot model is a "dynamic" model since we will set the tables dynamically + // for the instance. This allows it work for any intermediate tables for the + // many to many relationship that are defined by this developer's classes. + $this->setTable($table); + + $this->setConnection($parent->getConnectionName()); + + $this->forceFill($attributes); + + $this->syncOriginal(); + + // We store off the parent instance so we will access the timestamp column names + // for the model, since the pivot model timestamps aren't easily configurable + // from the developer's point of view. We can use the parents to get these. + $this->parent = $parent; + + $this->exists = $exists; + + $this->timestamps = $this->hasTimestampAttributes(); + } + + /** + * Set the keys for a save update query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function setKeysForSaveQuery(Builder $query) + { + $query->where($this->foreignKey, $this->getAttribute($this->foreignKey)); + + return $query->where($this->otherKey, $this->getAttribute($this->otherKey)); + } + + /** + * Delete the pivot model record from the database. + * + * @return int + */ + public function delete() + { + return $this->getDeleteQuery()->delete(); + } + + /** + * Get the query builder for a delete operation on the pivot. + * + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function getDeleteQuery() + { + $foreign = $this->getAttribute($this->foreignKey); + + $query = $this->newQuery()->where($this->foreignKey, $foreign); + + return $query->where($this->otherKey, $this->getAttribute($this->otherKey)); + } + + /** + * Get the foreign key column name. + * + * @return string + */ + public function getForeignKey() + { + return $this->foreignKey; + } + + /** + * Get the "other key" column name. + * + * @return string + */ + public function getOtherKey() + { + return $this->otherKey; + } + + /** + * Set the key names for the pivot model instance. + * + * @param string $foreignKey + * @param string $otherKey + * @return $this + */ + public function setPivotKeys($foreignKey, $otherKey) + { + $this->foreignKey = $foreignKey; + + $this->otherKey = $otherKey; + + return $this; + } + + /** + * Determine if the pivot model has timestamp attributes. + * + * @return bool + */ + public function hasTimestampAttributes() + { + return array_key_exists($this->getCreatedAtColumn(), $this->attributes); + } + + /** + * Get the name of the "created at" column. + * + * @return string + */ + public function getCreatedAtColumn() + { + return $this->parent->getCreatedAtColumn(); + } + + /** + * Get the name of the "updated at" column. + * + * @return string + */ + public function getUpdatedAtColumn() + { + return $this->parent->getUpdatedAtColumn(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php index 9525af0..739cd37 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php @@ -1,290 +1,348 @@ -query = $query; - $this->parent = $parent; - $this->related = $query->getModel(); - - $this->addConstraints(); - } - - /** - * Set the base constraints on the relation query. - * - * @return void - */ - abstract public function addConstraints(); - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - abstract public function addEagerConstraints(array $models); - - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - abstract public function initRelation(array $models, $relation); - - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - abstract public function match(array $models, Collection $results, $relation); - - /** - * Get the results of the relationship. - * - * @return mixed - */ - abstract public function getResults(); - - /** - * Get the relationship for eager loading. - * - * @return \Illuminate\Database\Eloquent\Collection - */ - public function getEager() - { - return $this->get(); - } - - /** - * Touch all of the related models for the relationship. - * - * @return void - */ - public function touch() - { - $column = $this->getRelated()->getUpdatedAtColumn(); - - $this->rawUpdate(array($column => $this->getRelated()->freshTimestampString())); - } - - /** - * Run a raw update against the base query. - * - * @param array $attributes - * @return int - */ - public function rawUpdate(array $attributes = array()) - { - return $this->query->update($attributes); - } - - /** - * Add the constraints for a relationship count query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parent - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationCountQuery(Builder $query, Builder $parent) - { - $query->select(new Expression('count(*)')); - - $key = $this->wrap($this->getQualifiedParentKeyName()); - - return $query->where($this->getHasCompareKey(), '=', new Expression($key)); - } - - /** - * Run a callback with constraints disabled on the relation. - * - * @param \Closure $callback - * @return mixed - */ - public static function noConstraints(Closure $callback) - { - $previous = static::$constraints; - - static::$constraints = false; - - // When resetting the relation where clause, we want to shift the first element - // off of the bindings, leaving only the constraints that the developers put - // as "extra" on the relationships, and not original relation constraints. - $results = call_user_func($callback); - - static::$constraints = $previous; - - return $results; - } - - /** - * Get all of the primary keys for an array of models. - * - * @param array $models - * @param string $key - * @return array - */ - protected function getKeys(array $models, $key = null) - { - return array_unique(array_values(array_map(function($value) use ($key) - { - return $key ? $value->getAttribute($key) : $value->getKey(); - - }, $models))); - } - - /** - * Get the underlying query for the relation. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getQuery() - { - return $this->query; - } - - /** - * Get the base query builder driving the Eloquent builder. - * - * @return \Illuminate\Database\Query\Builder - */ - public function getBaseQuery() - { - return $this->query->getQuery(); - } - - /** - * Get the parent model of the relation. - * - * @return \Illuminate\Database\Eloquent\Model - */ - public function getParent() - { - return $this->parent; - } - - /** - * Get the fully qualified parent key name. - * - * @return string - */ - public function getQualifiedParentKeyName() - { - return $this->parent->getQualifiedKeyName(); - } - - /** - * Get the related model of the relation. - * - * @return \Illuminate\Database\Eloquent\Model - */ - public function getRelated() - { - return $this->related; - } - - /** - * Get the name of the "created at" column. - * - * @return string - */ - public function createdAt() - { - return $this->parent->getCreatedAtColumn(); - } - - /** - * Get the name of the "updated at" column. - * - * @return string - */ - public function updatedAt() - { - return $this->parent->getUpdatedAtColumn(); - } - - /** - * Get the name of the related model's "updated at" column. - * - * @return string - */ - public function relatedUpdatedAt() - { - return $this->related->getUpdatedAtColumn(); - } - - /** - * Wrap the given value with the parent query's grammar. - * - * @param string $value - * @return string - */ - public function wrap($value) - { - return $this->parent->newQueryWithoutScopes()->getQuery()->getGrammar()->wrap($value); - } - - /** - * Handle dynamic method calls to the relationship. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - $result = call_user_func_array(array($this->query, $method), $parameters); - - if ($result === $this->query) return $this; - - return $result; - } - +abstract class Relation +{ + /** + * The Eloquent query builder instance. + * + * @var \Illuminate\Database\Eloquent\Builder + */ + protected $query; + + /** + * The parent model instance. + * + * @var \Illuminate\Database\Eloquent\Model + */ + protected $parent; + + /** + * The related model instance. + * + * @var \Illuminate\Database\Eloquent\Model + */ + protected $related; + + /** + * Indicates if the relation is adding constraints. + * + * @var bool + */ + protected static $constraints = true; + + /** + * An array to map class names to their morph names in database. + * + * @var array + */ + protected static $morphMap = []; + + /** + * Create a new relation instance. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @return void + */ + public function __construct(Builder $query, Model $parent) + { + $this->query = $query; + $this->parent = $parent; + $this->related = $query->getModel(); + + $this->addConstraints(); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + abstract public function addConstraints(); + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + abstract public function addEagerConstraints(array $models); + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + abstract public function initRelation(array $models, $relation); + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + abstract public function match(array $models, Collection $results, $relation); + + /** + * Get the results of the relationship. + * + * @return mixed + */ + abstract public function getResults(); + + /** + * Get the relationship for eager loading. + * + * @return \Illuminate\Database\Eloquent\Collection + */ + public function getEager() + { + return $this->get(); + } + + /** + * Touch all of the related models for the relationship. + * + * @return void + */ + public function touch() + { + $column = $this->getRelated()->getUpdatedAtColumn(); + + $this->rawUpdate([$column => $this->getRelated()->freshTimestampString()]); + } + + /** + * Run a raw update against the base query. + * + * @param array $attributes + * @return int + */ + public function rawUpdate(array $attributes = []) + { + return $this->query->update($attributes); + } + + /** + * Add the constraints for a relationship count query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parent + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationCountQuery(Builder $query, Builder $parent) + { + $query->select(new Expression('count(*)')); + + $key = $this->wrap($this->getQualifiedParentKeyName()); + + return $query->where($this->getHasCompareKey(), '=', new Expression($key)); + } + + /** + * Run a callback with constraints disabled on the relation. + * + * @param \Closure $callback + * @return mixed + */ + public static function noConstraints(Closure $callback) + { + $previous = static::$constraints; + + static::$constraints = false; + + // When resetting the relation where clause, we want to shift the first element + // off of the bindings, leaving only the constraints that the developers put + // as "extra" on the relationships, and not original relation constraints. + try { + $results = call_user_func($callback); + } finally { + static::$constraints = $previous; + } + + return $results; + } + + /** + * Get all of the primary keys for an array of models. + * + * @param array $models + * @param string $key + * @return array + */ + protected function getKeys(array $models, $key = null) + { + return array_unique(array_values(array_map(function ($value) use ($key) { + return $key ? $value->getAttribute($key) : $value->getKey(); + }, $models))); + } + + /** + * Get the underlying query for the relation. + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getQuery() + { + return $this->query; + } + + /** + * Get the base query builder driving the Eloquent builder. + * + * @return \Illuminate\Database\Query\Builder + */ + public function getBaseQuery() + { + return $this->query->getQuery(); + } + + /** + * Get the parent model of the relation. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function getParent() + { + return $this->parent; + } + + /** + * Get the fully qualified parent key name. + * + * @return string + */ + public function getQualifiedParentKeyName() + { + return $this->parent->getQualifiedKeyName(); + } + + /** + * Get the related model of the relation. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function getRelated() + { + return $this->related; + } + + /** + * Get the name of the "created at" column. + * + * @return string + */ + public function createdAt() + { + return $this->parent->getCreatedAtColumn(); + } + + /** + * Get the name of the "updated at" column. + * + * @return string + */ + public function updatedAt() + { + return $this->parent->getUpdatedAtColumn(); + } + + /** + * Get the name of the related model's "updated at" column. + * + * @return string + */ + public function relatedUpdatedAt() + { + return $this->related->getUpdatedAtColumn(); + } + + /** + * Wrap the given value with the parent query's grammar. + * + * @param string $value + * @return string + */ + public function wrap($value) + { + return $this->parent->newQueryWithoutScopes()->getQuery()->getGrammar()->wrap($value); + } + + /** + * Set or get the morph map for polymorphic relations. + * + * @param array|null $map + * @param bool $merge + * @return array + */ + public static function morphMap(array $map = null, $merge = true) + { + $map = static::buildMorphMapFromModels($map); + + if (is_array($map)) { + static::$morphMap = $merge ? array_merge(static::$morphMap, $map) : $map; + } + + return static::$morphMap; + } + + /** + * Builds a table-keyed array from model class names. + * + * @param string[]|null $models + * @return array|null + */ + protected static function buildMorphMapFromModels(array $models = null) + { + if (is_null($models) || Arr::isAssoc($models)) { + return $models; + } + + $tables = array_map(function ($model) { + return (new $model)->getTable(); + }, $models); + + return array_combine($tables, $models); + } + + /** + * Handle dynamic method calls to the relationship. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + $result = call_user_func_array([$this->query, $method], $parameters); + + if ($result === $this->query) { + return $this; + } + + return $result; + } + + /** + * Force a clone of the underlying query builder when cloning. + * + * @return void + */ + public function __clone() + { + $this->query = clone $this->query; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/ScopeInterface.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/ScopeInterface.php index 7cc1349..fac2ca2 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/ScopeInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/ScopeInterface.php @@ -1,24 +1,25 @@ -forceDeleting = true; - - $this->delete(); - - $this->forceDeleting = false; - } - - /** - * Perform the actual delete query on this model instance. - * - * @return void - */ - protected function performDeleteOnModel() - { - if ($this->forceDeleting) - { - return $this->withTrashed()->where($this->getKeyName(), $this->getKey())->forceDelete(); - } - - return $this->runSoftDelete(); - } - - /** - * Perform the actual delete query on this model instance. - * - * @return void - */ - protected function runSoftDelete() - { - $query = $this->newQuery()->where($this->getKeyName(), $this->getKey()); - - $this->{$this->getDeletedAtColumn()} = $time = $this->freshTimestamp(); - - $query->update(array($this->getDeletedAtColumn() => $this->fromDateTime($time))); - } - - /** - * Restore a soft-deleted model instance. - * - * @return bool|null - */ - public function restore() - { - // If the restoring event does not return false, we will proceed with this - // restore operation. Otherwise, we bail out so the developer will stop - // the restore totally. We will clear the deleted timestamp and save. - if ($this->fireModelEvent('restoring') === false) - { - return false; - } - - $this->{$this->getDeletedAtColumn()} = null; - - // Once we have saved the model, we will fire the "restored" event so this - // developer will do anything they need to after a restore operation is - // totally finished. Then we will return the result of the save call. - $this->exists = true; - - $result = $this->save(); - - $this->fireModelEvent('restored', false); - - return $result; - } - - /** - * Determine if the model instance has been soft-deleted. - * - * @return bool - */ - public function trashed() - { - return ! is_null($this->{$this->getDeletedAtColumn()}); - } - - /** - * Get a new query builder that includes soft deletes. - * - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public static function withTrashed() - { - return (new static)->newQueryWithoutScope(new SoftDeletingScope); - } - - /** - * Get a new query builder that only includes soft deletes. - * - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public static function onlyTrashed() - { - $instance = new static; - - $column = $instance->getQualifiedDeletedAtColumn(); - - return $instance->newQueryWithoutScope(new SoftDeletingScope)->whereNotNull($column); - } - - /** - * Register a restoring model event with the dispatcher. - * - * @param \Closure|string $callback - * @return void - */ - public static function restoring($callback) - { - static::registerModelEvent('restoring', $callback); - } - - /** - * Register a restored model event with the dispatcher. - * - * @param \Closure|string $callback - * @return void - */ - public static function restored($callback) - { - static::registerModelEvent('restored', $callback); - } - - /** - * Get the name of the "deleted at" column. - * - * @return string - */ - public function getDeletedAtColumn() - { - return defined('static::DELETED_AT') ? static::DELETED_AT : 'deleted_at'; - } - - /** - * Get the fully qualified "deleted at" column. - * - * @return string - */ - public function getQualifiedDeletedAtColumn() - { - return $this->getTable().'.'.$this->getDeletedAtColumn(); - } - +forceDeleting = true; + + $this->delete(); + + $this->forceDeleting = false; + } + + /** + * Perform the actual delete query on this model instance. + * + * @return mixed + */ + protected function performDeleteOnModel() + { + if ($this->forceDeleting) { + return $this->newQueryWithoutScopes()->where($this->getKeyName(), $this->getKey())->forceDelete(); + } + + return $this->runSoftDelete(); + } + + /** + * Perform the actual delete query on this model instance. + * + * @return void + */ + protected function runSoftDelete() + { + $query = $this->newQueryWithoutScopes()->where($this->getKeyName(), $this->getKey()); + + $this->{$this->getDeletedAtColumn()} = $time = $this->freshTimestamp(); + + $query->update([$this->getDeletedAtColumn() => $this->fromDateTime($time)]); + } + + /** + * Restore a soft-deleted model instance. + * + * @return bool|null + */ + public function restore() + { + // If the restoring event does not return false, we will proceed with this + // restore operation. Otherwise, we bail out so the developer will stop + // the restore totally. We will clear the deleted timestamp and save. + if ($this->fireModelEvent('restoring') === false) { + return false; + } + + $this->{$this->getDeletedAtColumn()} = null; + + // Once we have saved the model, we will fire the "restored" event so this + // developer will do anything they need to after a restore operation is + // totally finished. Then we will return the result of the save call. + $this->exists = true; + + $result = $this->save(); + + $this->fireModelEvent('restored', false); + + return $result; + } + + /** + * Determine if the model instance has been soft-deleted. + * + * @return bool + */ + public function trashed() + { + return ! is_null($this->{$this->getDeletedAtColumn()}); + } + + /** + * Get a new query builder that includes soft deletes. + * + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public static function withTrashed() + { + return (new static)->newQueryWithoutScope(new SoftDeletingScope); + } + + /** + * Get a new query builder that only includes soft deletes. + * + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public static function onlyTrashed() + { + $instance = new static; + + $column = $instance->getQualifiedDeletedAtColumn(); + + return $instance->newQueryWithoutScope(new SoftDeletingScope)->whereNotNull($column); + } + + /** + * Register a restoring model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function restoring($callback) + { + static::registerModelEvent('restoring', $callback); + } + + /** + * Register a restored model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function restored($callback) + { + static::registerModelEvent('restored', $callback); + } + + /** + * Get the name of the "deleted at" column. + * + * @return string + */ + public function getDeletedAtColumn() + { + return defined('static::DELETED_AT') ? static::DELETED_AT : 'deleted_at'; + } + + /** + * Get the fully qualified "deleted at" column. + * + * @return string + */ + public function getQualifiedDeletedAtColumn() + { + return $this->getTable().'.'.$this->getDeletedAtColumn(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php index ea6d46e..f8786cf 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php @@ -1,164 +1,155 @@ -whereNull($model->getQualifiedDeletedAtColumn()); - - $this->extend($builder); - } - - /** - * Remove the scope from the given Eloquent query builder. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @param \Illuminate\Database\Eloquent\Model $model - * @return void - */ - public function remove(Builder $builder, Model $model) - { - $column = $model->getQualifiedDeletedAtColumn(); - - $query = $builder->getQuery(); - - $query->wheres = collect($query->wheres)->reject(function($where) use ($column) - { - return $this->isSoftDeleteConstraint($where, $column); - })->values()->all(); - } - - /** - * Extend the query builder with the needed functions. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return void - */ - public function extend(Builder $builder) - { - foreach ($this->extensions as $extension) - { - $this->{"add{$extension}"}($builder); - } - - $builder->onDelete(function(Builder $builder) - { - $column = $this->getDeletedAtColumn($builder); - - return $builder->update(array( - $column => $builder->getModel()->freshTimestampString(), - )); - }); - } - - /** - * Get the "deleted at" column for the builder. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return string - */ - protected function getDeletedAtColumn(Builder $builder) - { - if (count($builder->getQuery()->joins) > 0) - { - return $builder->getModel()->getQualifiedDeletedAtColumn(); - } - else - { - return $builder->getModel()->getDeletedAtColumn(); - } - } - - /** - * Add the force delete extension to the builder. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return void - */ - protected function addForceDelete(Builder $builder) - { - $builder->macro('forceDelete', function(Builder $builder) - { - return $builder->getQuery()->delete(); - }); - } - - /** - * Add the restore extension to the builder. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return void - */ - protected function addRestore(Builder $builder) - { - $builder->macro('restore', function(Builder $builder) - { - $builder->withTrashed(); - - return $builder->update(array($builder->getModel()->getDeletedAtColumn() => null)); - }); - } - - /** - * Add the with-trashed extension to the builder. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return void - */ - protected function addWithTrashed(Builder $builder) - { - $builder->macro('withTrashed', function(Builder $builder) - { - $this->remove($builder, $builder->getModel()); - - return $builder; - }); - } - - /** - * Add the only-trashed extension to the builder. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return void - */ - protected function addOnlyTrashed(Builder $builder) - { - $builder->macro('onlyTrashed', function(Builder $builder) - { - $model = $builder->getModel(); - - $this->remove($builder, $model); - - $builder->getQuery()->whereNotNull($model->getQualifiedDeletedAtColumn()); - - return $builder; - }); - } - - /** - * Determine if the given where clause is a soft delete constraint. - * - * @param array $where - * @param string $column - * @return bool - */ - protected function isSoftDeleteConstraint(array $where, $column) - { - return $where['type'] == 'Null' && $where['column'] == $column; - } - +whereNull($model->getQualifiedDeletedAtColumn()); + + $this->extend($builder); + } + + /** + * Remove the scope from the given Eloquent query builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @param \Illuminate\Database\Eloquent\Model $model + * @return void + */ + public function remove(Builder $builder, Model $model) + { + $column = $model->getQualifiedDeletedAtColumn(); + + $query = $builder->getQuery(); + + $query->wheres = collect($query->wheres)->reject(function ($where) use ($column) { + return $this->isSoftDeleteConstraint($where, $column); + })->values()->all(); + } + + /** + * Extend the query builder with the needed functions. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + public function extend(Builder $builder) + { + foreach ($this->extensions as $extension) { + $this->{"add{$extension}"}($builder); + } + + $builder->onDelete(function (Builder $builder) { + $column = $this->getDeletedAtColumn($builder); + + return $builder->update([ + $column => $builder->getModel()->freshTimestampString(), + ]); + }); + } + + /** + * Get the "deleted at" column for the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return string + */ + protected function getDeletedAtColumn(Builder $builder) + { + if (count($builder->getQuery()->joins) > 0) { + return $builder->getModel()->getQualifiedDeletedAtColumn(); + } else { + return $builder->getModel()->getDeletedAtColumn(); + } + } + + /** + * Add the force delete extension to the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + protected function addForceDelete(Builder $builder) + { + $builder->macro('forceDelete', function (Builder $builder) { + return $builder->getQuery()->delete(); + }); + } + + /** + * Add the restore extension to the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + protected function addRestore(Builder $builder) + { + $builder->macro('restore', function (Builder $builder) { + $builder->withTrashed(); + + return $builder->update([$builder->getModel()->getDeletedAtColumn() => null]); + }); + } + + /** + * Add the with-trashed extension to the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + protected function addWithTrashed(Builder $builder) + { + $builder->macro('withTrashed', function (Builder $builder) { + $this->remove($builder, $builder->getModel()); + + return $builder; + }); + } + + /** + * Add the only-trashed extension to the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + protected function addOnlyTrashed(Builder $builder) + { + $builder->macro('onlyTrashed', function (Builder $builder) { + $model = $builder->getModel(); + + $this->remove($builder, $model); + + $builder->getQuery()->whereNotNull($model->getQualifiedDeletedAtColumn()); + + return $builder; + }); + } + + /** + * Determine if the given where clause is a soft delete constraint. + * + * @param array $where + * @param string $column + * @return bool + */ + protected function isSoftDeleteConstraint(array $where, $column) + { + return $where['type'] == 'Null' && $where['column'] == $column; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Grammar.php b/application/vendor/laravel/framework/src/Illuminate/Database/Grammar.php index c3db236..71645d8 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Grammar.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Grammar.php @@ -1,184 +1,188 @@ -isExpression($table)) return $this->getValue($table); - - return $this->wrap($this->tablePrefix.$table, true); - } - - /** - * Wrap a value in keyword identifiers. - * - * @param string $value - * @param bool $prefixAlias - * @return string - */ - public function wrap($value, $prefixAlias = false) - { - if ($this->isExpression($value)) return $this->getValue($value); - - // If the value being wrapped has a column alias we will need to separate out - // the pieces so we can wrap each of the segments of the expression on it - // own, and then joins them both back together with the "as" connector. - if (strpos(strtolower($value), ' as ') !== false) - { - $segments = explode(' ', $value); - - if ($prefixAlias) $segments[2] = $this->tablePrefix.$segments[2]; - - return $this->wrap($segments[0]).' as '.$this->wrapValue($segments[2]); - } - - $wrapped = array(); - - $segments = explode('.', $value); - - // If the value is not an aliased table expression, we'll just wrap it like - // normal, so if there is more than one segment, we will wrap the first - // segments as if it was a table and the rest as just regular values. - foreach ($segments as $key => $segment) - { - if ($key == 0 && count($segments) > 1) - { - $wrapped[] = $this->wrapTable($segment); - } - else - { - $wrapped[] = $this->wrapValue($segment); - } - } - - return implode('.', $wrapped); - } - - /** - * Wrap a single string in keyword identifiers. - * - * @param string $value - * @return string - */ - protected function wrapValue($value) - { - if ($value === '*') return $value; - - return '"'.str_replace('"', '""', $value).'"'; - } - - /** - * Convert an array of column names into a delimited string. - * - * @param array $columns - * @return string - */ - public function columnize(array $columns) - { - return implode(', ', array_map(array($this, 'wrap'), $columns)); - } - - /** - * Create query parameter place-holders for an array. - * - * @param array $values - * @return string - */ - public function parameterize(array $values) - { - return implode(', ', array_map(array($this, 'parameter'), $values)); - } - - /** - * Get the appropriate query parameter place-holder for a value. - * - * @param mixed $value - * @return string - */ - public function parameter($value) - { - return $this->isExpression($value) ? $this->getValue($value) : '?'; - } - - /** - * Get the value of a raw expression. - * - * @param \Illuminate\Database\Query\Expression $expression - * @return string - */ - public function getValue($expression) - { - return $expression->getValue(); - } - - /** - * Determine if the given value is a raw expression. - * - * @param mixed $value - * @return bool - */ - public function isExpression($value) - { - return $value instanceof Expression; - } - - /** - * Get the format for database stored dates. - * - * @return string - */ - public function getDateFormat() - { - return 'Y-m-d H:i:s'; - } - - /** - * Get the grammar's table prefix. - * - * @return string - */ - public function getTablePrefix() - { - return $this->tablePrefix; - } - - /** - * Set the grammar's table prefix. - * - * @param string $prefix - * @return $this - */ - public function setTablePrefix($prefix) - { - $this->tablePrefix = $prefix; - - return $this; - } +use Illuminate\Database\Query\Expression; +abstract class Grammar +{ + /** + * The grammar table prefix. + * + * @var string + */ + protected $tablePrefix = ''; + + /** + * Wrap an array of values. + * + * @param array $values + * @return array + */ + public function wrapArray(array $values) + { + return array_map([$this, 'wrap'], $values); + } + + /** + * Wrap a table in keyword identifiers. + * + * @param \Illuminate\Database\Query\Expression|string $table + * @return string + */ + public function wrapTable($table) + { + if ($this->isExpression($table)) { + return $this->getValue($table); + } + + return $this->wrap($this->tablePrefix.$table, true); + } + + /** + * Wrap a value in keyword identifiers. + * + * @param \Illuminate\Database\Query\Expression|string $value + * @param bool $prefixAlias + * @return string + */ + public function wrap($value, $prefixAlias = false) + { + if ($this->isExpression($value)) { + return $this->getValue($value); + } + + // If the value being wrapped has a column alias we will need to separate out + // the pieces so we can wrap each of the segments of the expression on it + // own, and then joins them both back together with the "as" connector. + if (strpos(strtolower($value), ' as ') !== false) { + $segments = explode(' ', $value); + + if ($prefixAlias) { + $segments[2] = $this->tablePrefix.$segments[2]; + } + + return $this->wrap($segments[0]).' as '.$this->wrapValue($segments[2]); + } + + $wrapped = []; + + $segments = explode('.', $value); + + // If the value is not an aliased table expression, we'll just wrap it like + // normal, so if there is more than one segment, we will wrap the first + // segments as if it was a table and the rest as just regular values. + foreach ($segments as $key => $segment) { + if ($key == 0 && count($segments) > 1) { + $wrapped[] = $this->wrapTable($segment); + } else { + $wrapped[] = $this->wrapValue($segment); + } + } + + return implode('.', $wrapped); + } + + /** + * Wrap a single string in keyword identifiers. + * + * @param string $value + * @return string + */ + protected function wrapValue($value) + { + if ($value === '*') { + return $value; + } + + return '"'.str_replace('"', '""', $value).'"'; + } + + /** + * Convert an array of column names into a delimited string. + * + * @param array $columns + * @return string + */ + public function columnize(array $columns) + { + return implode(', ', array_map([$this, 'wrap'], $columns)); + } + + /** + * Create query parameter place-holders for an array. + * + * @param array $values + * @return string + */ + public function parameterize(array $values) + { + return implode(', ', array_map([$this, 'parameter'], $values)); + } + + /** + * Get the appropriate query parameter place-holder for a value. + * + * @param mixed $value + * @return string + */ + public function parameter($value) + { + return $this->isExpression($value) ? $this->getValue($value) : '?'; + } + + /** + * Get the value of a raw expression. + * + * @param \Illuminate\Database\Query\Expression $expression + * @return string + */ + public function getValue($expression) + { + return $expression->getValue(); + } + + /** + * Determine if the given value is a raw expression. + * + * @param mixed $value + * @return bool + */ + public function isExpression($value) + { + return $value instanceof Expression; + } + + /** + * Get the format for database stored dates. + * + * @return string + */ + public function getDateFormat() + { + return 'Y-m-d H:i:s'; + } + + /** + * Get the grammar's table prefix. + * + * @return string + */ + public function getTablePrefix() + { + return $this->tablePrefix; + } + + /** + * Set the grammar's table prefix. + * + * @param string $prefix + * @return $this + */ + public function setTablePrefix($prefix) + { + $this->tablePrefix = $prefix; + + return $this; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php index aeca8c5..ffcea49 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php @@ -1,226 +1,221 @@ -registerRepository(); - - // Once we have registered the migrator instance we will go ahead and register - // all of the migration related commands that are used by the "Artisan" CLI - // so that they may be easily accessed for registering with the consoles. - $this->registerMigrator(); - - $this->registerCommands(); - } - - /** - * Register the migration repository service. - * - * @return void - */ - protected function registerRepository() - { - $this->app->singleton('migration.repository', function($app) - { - $table = $app['config']['database.migrations']; - - return new DatabaseMigrationRepository($app['db'], $table); - }); - } - - /** - * Register the migrator service. - * - * @return void - */ - protected function registerMigrator() - { - // The migrator is responsible for actually running and rollback the migration - // files in the application. We'll pass in our database connection resolver - // so the migrator can resolve any of these connections when it needs to. - $this->app->singleton('migrator', function($app) - { - $repository = $app['migration.repository']; - - return new Migrator($repository, $app['db'], $app['files']); - }); - } - - /** - * Register all of the migration commands. - * - * @return void - */ - protected function registerCommands() - { - $commands = array('Migrate', 'Rollback', 'Reset', 'Refresh', 'Install', 'Make', 'Status'); - - // We'll simply spin through the list of commands that are migration related - // and register each one of them with an application container. They will - // be resolved in the Artisan start file and registered on the console. - foreach ($commands as $command) - { - $this->{'register'.$command.'Command'}(); - } - - // Once the commands are registered in the application IoC container we will - // register them with the Artisan start event so that these are available - // when the Artisan application actually starts up and is getting used. - $this->commands( - 'command.migrate', 'command.migrate.make', - 'command.migrate.install', 'command.migrate.rollback', - 'command.migrate.reset', 'command.migrate.refresh', - 'command.migrate.status' - ); - } - - /** - * Register the "migrate" migration command. - * - * @return void - */ - protected function registerMigrateCommand() - { - $this->app->singleton('command.migrate', function($app) - { - return new MigrateCommand($app['migrator']); - }); - } - - /** - * Register the "rollback" migration command. - * - * @return void - */ - protected function registerRollbackCommand() - { - $this->app->singleton('command.migrate.rollback', function($app) - { - return new RollbackCommand($app['migrator']); - }); - } - - /** - * Register the "reset" migration command. - * - * @return void - */ - protected function registerResetCommand() - { - $this->app->singleton('command.migrate.reset', function($app) - { - return new ResetCommand($app['migrator']); - }); - } - - /** - * Register the "refresh" migration command. - * - * @return void - */ - protected function registerRefreshCommand() - { - $this->app->singleton('command.migrate.refresh', function() - { - return new RefreshCommand; - }); - } - - protected function registerStatusCommand() - { - $this->app->singleton('command.migrate.status', function($app) - { - return new StatusCommand($app['migrator']); - }); - } - - /** - * Register the "install" migration command. - * - * @return void - */ - protected function registerInstallCommand() - { - $this->app->singleton('command.migrate.install', function($app) - { - return new InstallCommand($app['migration.repository']); - }); - } - - /** - * Register the "make" migration command. - * - * @return void - */ - protected function registerMakeCommand() - { - $this->registerCreator(); - - $this->app->singleton('command.migrate.make', function($app) - { - // Once we have the migration creator registered, we will create the command - // and inject the creator. The creator is responsible for the actual file - // creation of the migrations, and may be extended by these developers. - $creator = $app['migration.creator']; - - $composer = $app['composer']; - - return new MigrateMakeCommand($creator, $composer); - }); - } - - /** - * Register the migration creator. - * - * @return void - */ - protected function registerCreator() - { - $this->app->singleton('migration.creator', function($app) - { - return new MigrationCreator($app['files']); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array( - 'migrator', 'migration.repository', 'command.migrate', - 'command.migrate.rollback', 'command.migrate.reset', - 'command.migrate.refresh', 'command.migrate.install', - 'command.migrate.status', 'migration.creator', - 'command.migrate.make', - ); - } - +class MigrationServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerRepository(); + + // Once we have registered the migrator instance we will go ahead and register + // all of the migration related commands that are used by the "Artisan" CLI + // so that they may be easily accessed for registering with the consoles. + $this->registerMigrator(); + + $this->registerCommands(); + } + + /** + * Register the migration repository service. + * + * @return void + */ + protected function registerRepository() + { + $this->app->singleton('migration.repository', function ($app) { + $table = $app['config']['database.migrations']; + + return new DatabaseMigrationRepository($app['db'], $table); + }); + } + + /** + * Register the migrator service. + * + * @return void + */ + protected function registerMigrator() + { + // The migrator is responsible for actually running and rollback the migration + // files in the application. We'll pass in our database connection resolver + // so the migrator can resolve any of these connections when it needs to. + $this->app->singleton('migrator', function ($app) { + $repository = $app['migration.repository']; + + return new Migrator($repository, $app['db'], $app['files']); + }); + } + + /** + * Register all of the migration commands. + * + * @return void + */ + protected function registerCommands() + { + $commands = ['Migrate', 'Rollback', 'Reset', 'Refresh', 'Install', 'Make', 'Status']; + + // We'll simply spin through the list of commands that are migration related + // and register each one of them with an application container. They will + // be resolved in the Artisan start file and registered on the console. + foreach ($commands as $command) { + $this->{'register'.$command.'Command'}(); + } + + // Once the commands are registered in the application IoC container we will + // register them with the Artisan start event so that these are available + // when the Artisan application actually starts up and is getting used. + $this->commands( + 'command.migrate', 'command.migrate.make', + 'command.migrate.install', 'command.migrate.rollback', + 'command.migrate.reset', 'command.migrate.refresh', + 'command.migrate.status' + ); + } + + /** + * Register the "migrate" migration command. + * + * @return void + */ + protected function registerMigrateCommand() + { + $this->app->singleton('command.migrate', function ($app) { + return new MigrateCommand($app['migrator']); + }); + } + + /** + * Register the "rollback" migration command. + * + * @return void + */ + protected function registerRollbackCommand() + { + $this->app->singleton('command.migrate.rollback', function ($app) { + return new RollbackCommand($app['migrator']); + }); + } + + /** + * Register the "reset" migration command. + * + * @return void + */ + protected function registerResetCommand() + { + $this->app->singleton('command.migrate.reset', function ($app) { + return new ResetCommand($app['migrator']); + }); + } + + /** + * Register the "refresh" migration command. + * + * @return void + */ + protected function registerRefreshCommand() + { + $this->app->singleton('command.migrate.refresh', function () { + return new RefreshCommand; + }); + } + + /** + * Register the "status" migration command. + * + * @return void + */ + protected function registerStatusCommand() + { + $this->app->singleton('command.migrate.status', function ($app) { + return new StatusCommand($app['migrator']); + }); + } + + /** + * Register the "install" migration command. + * + * @return void + */ + protected function registerInstallCommand() + { + $this->app->singleton('command.migrate.install', function ($app) { + return new InstallCommand($app['migration.repository']); + }); + } + + /** + * Register the "make" migration command. + * + * @return void + */ + protected function registerMakeCommand() + { + $this->registerCreator(); + + $this->app->singleton('command.migrate.make', function ($app) { + // Once we have the migration creator registered, we will create the command + // and inject the creator. The creator is responsible for the actual file + // creation of the migrations, and may be extended by these developers. + $creator = $app['migration.creator']; + + $composer = $app['composer']; + + return new MigrateMakeCommand($creator, $composer); + }); + } + + /** + * Register the migration creator. + * + * @return void + */ + protected function registerCreator() + { + $this->app->singleton('migration.creator', function ($app) { + return new MigrationCreator($app['files']); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'migrator', 'migration.repository', 'command.migrate', + 'command.migrate.rollback', 'command.migrate.reset', + 'command.migrate.refresh', 'command.migrate.install', + 'command.migrate.status', 'migration.creator', + 'command.migrate.make', + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php b/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php index 8894710..13f3da4 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php @@ -1,181 +1,184 @@ -table = $table; - $this->resolver = $resolver; - } - - /** - * Get the ran migrations. - * - * @return array - */ - public function getRan() - { - return $this->table()->lists('migration'); - } - - /** - * Get the last migration batch. - * - * @return array - */ - public function getLast() - { - $query = $this->table()->where('batch', $this->getLastBatchNumber()); - - return $query->orderBy('migration', 'desc')->get(); - } - - /** - * Log that a migration was run. - * - * @param string $file - * @param int $batch - * @return void - */ - public function log($file, $batch) - { - $record = array('migration' => $file, 'batch' => $batch); - - $this->table()->insert($record); - } - - /** - * Remove a migration from the log. - * - * @param object $migration - * @return void - */ - public function delete($migration) - { - $this->table()->where('migration', $migration->migration)->delete(); - } - - /** - * Get the next migration batch number. - * - * @return int - */ - public function getNextBatchNumber() - { - return $this->getLastBatchNumber() + 1; - } - - /** - * Get the last migration batch number. - * - * @return int - */ - public function getLastBatchNumber() - { - return $this->table()->max('batch'); - } - - /** - * Create the migration repository data store. - * - * @return void - */ - public function createRepository() - { - $schema = $this->getConnection()->getSchemaBuilder(); - - $schema->create($this->table, function($table) - { - // The migrations table is responsible for keeping track of which of the - // migrations have actually run for the application. We'll create the - // table to hold the migration file's path as well as the batch ID. - $table->string('migration'); - - $table->integer('batch'); - }); - } - - /** - * Determine if the migration repository exists. - * - * @return bool - */ - public function repositoryExists() - { - $schema = $this->getConnection()->getSchemaBuilder(); - - return $schema->hasTable($this->table); - } - - /** - * Get a query builder for the migration table. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function table() - { - return $this->getConnection()->table($this->table); - } - - /** - * Get the connection resolver instance. - * - * @return \Illuminate\Database\ConnectionResolverInterface - */ - public function getConnectionResolver() - { - return $this->resolver; - } - - /** - * Resolve the database connection instance. - * - * @return \Illuminate\Database\Connection - */ - public function getConnection() - { - return $this->resolver->connection($this->connection); - } - - /** - * Set the information source to gather data. - * - * @param string $name - * @return void - */ - public function setSource($name) - { - $this->connection = $name; - } +use Illuminate\Database\ConnectionResolverInterface as Resolver; +class DatabaseMigrationRepository implements MigrationRepositoryInterface +{ + /** + * The database connection resolver instance. + * + * @var \Illuminate\Database\ConnectionResolverInterface + */ + protected $resolver; + + /** + * The name of the migration table. + * + * @var string + */ + protected $table; + + /** + * The name of the database connection to use. + * + * @var string + */ + protected $connection; + + /** + * Create a new database migration repository instance. + * + * @param \Illuminate\Database\ConnectionResolverInterface $resolver + * @param string $table + * @return void + */ + public function __construct(Resolver $resolver, $table) + { + $this->table = $table; + $this->resolver = $resolver; + } + + /** + * Get the ran migrations. + * + * @return array + */ + public function getRan() + { + return $this->table() + ->orderBy('batch', 'asc') + ->orderBy('migration', 'asc') + ->lists('migration'); + } + + /** + * Get the last migration batch. + * + * @return array + */ + public function getLast() + { + $query = $this->table()->where('batch', $this->getLastBatchNumber()); + + return $query->orderBy('migration', 'desc')->get(); + } + + /** + * Log that a migration was run. + * + * @param string $file + * @param int $batch + * @return void + */ + public function log($file, $batch) + { + $record = ['migration' => $file, 'batch' => $batch]; + + $this->table()->insert($record); + } + + /** + * Remove a migration from the log. + * + * @param object $migration + * @return void + */ + public function delete($migration) + { + $this->table()->where('migration', $migration->migration)->delete(); + } + + /** + * Get the next migration batch number. + * + * @return int + */ + public function getNextBatchNumber() + { + return $this->getLastBatchNumber() + 1; + } + + /** + * Get the last migration batch number. + * + * @return int + */ + public function getLastBatchNumber() + { + return $this->table()->max('batch'); + } + + /** + * Create the migration repository data store. + * + * @return void + */ + public function createRepository() + { + $schema = $this->getConnection()->getSchemaBuilder(); + + $schema->create($this->table, function ($table) { + // The migrations table is responsible for keeping track of which of the + // migrations have actually run for the application. We'll create the + // table to hold the migration file's path as well as the batch ID. + $table->string('migration'); + + $table->integer('batch'); + }); + } + + /** + * Determine if the migration repository exists. + * + * @return bool + */ + public function repositoryExists() + { + $schema = $this->getConnection()->getSchemaBuilder(); + + return $schema->hasTable($this->table); + } + + /** + * Get a query builder for the migration table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function table() + { + return $this->getConnection()->table($this->table); + } + + /** + * Get the connection resolver instance. + * + * @return \Illuminate\Database\ConnectionResolverInterface + */ + public function getConnectionResolver() + { + return $this->resolver; + } + + /** + * Resolve the database connection instance. + * + * @return \Illuminate\Database\Connection + */ + public function getConnection() + { + return $this->resolver->connection($this->connection); + } + + /** + * Set the information source to gather data. + * + * @param string $name + * @return void + */ + public function setSource($name) + { + $this->connection = $name; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migration.php b/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migration.php index eb75d14..699154c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migration.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migration.php @@ -1,22 +1,23 @@ -connection; - } +abstract class Migration +{ + /** + * The name of the database connection to use. + * + * @var string + */ + protected $connection; + /** + * Get the migration connection name. + * + * @return string + */ + public function getConnection() + { + return $this->connection; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationCreator.php b/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationCreator.php index e70b627..beacfe1 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationCreator.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationCreator.php @@ -1,183 +1,181 @@ -files = $files; - } - - /** - * Create a new migration at the given path. - * - * @param string $name - * @param string $path - * @param string $table - * @param bool $create - * @return string - */ - public function create($name, $path, $table = null, $create = false) - { - $path = $this->getPath($name, $path); - - // First we will get the stub file for the migration, which serves as a type - // of template for the migration. Once we have those we will populate the - // various place-holders, save the file, and run the post create event. - $stub = $this->getStub($table, $create); - - $this->files->put($path, $this->populateStub($name, $stub, $table)); - - $this->firePostCreateHooks(); - - return $path; - } - - /** - * Get the migration stub file. - * - * @param string $table - * @param bool $create - * @return string - */ - protected function getStub($table, $create) - { - if (is_null($table)) - { - return $this->files->get($this->getStubPath().'/blank.stub'); - } - - // We also have stubs for creating new tables and modifying existing tables - // to save the developer some typing when they are creating a new tables - // or modifying existing tables. We'll grab the appropriate stub here. - else - { - $stub = $create ? 'create.stub' : 'update.stub'; - - return $this->files->get($this->getStubPath()."/{$stub}"); - } - } - - /** - * Populate the place-holders in the migration stub. - * - * @param string $name - * @param string $stub - * @param string $table - * @return string - */ - protected function populateStub($name, $stub, $table) - { - $stub = str_replace('{{class}}', $this->getClassName($name), $stub); - - // Here we will replace the table place-holders with the table specified by - // the developer, which is useful for quickly creating a tables creation - // or update migration from the console instead of typing it manually. - if ( ! is_null($table)) - { - $stub = str_replace('{{table}}', $table, $stub); - } - - return $stub; - } - - /** - * Get the class name of a migration name. - * - * @param string $name - * @return string - */ - protected function getClassName($name) - { - return studly_case($name); - } - - /** - * Fire the registered post create hooks. - * - * @return void - */ - protected function firePostCreateHooks() - { - foreach ($this->postCreate as $callback) - { - call_user_func($callback); - } - } - - /** - * Register a post migration create hook. - * - * @param \Closure $callback - * @return void - */ - public function afterCreate(Closure $callback) - { - $this->postCreate[] = $callback; - } - - /** - * Get the full path name to the migration. - * - * @param string $name - * @param string $path - * @return string - */ - protected function getPath($name, $path) - { - return $path.'/'.$this->getDatePrefix().'_'.$name.'.php'; - } - - /** - * Get the date prefix for the migration. - * - * @return string - */ - protected function getDatePrefix() - { - return date('Y_m_d_His'); - } - - /** - * Get the path to the stubs. - * - * @return string - */ - public function getStubPath() - { - return __DIR__.'/stubs'; - } - - /** - * Get the filesystem instance. - * - * @return \Illuminate\Filesystem\Filesystem - */ - public function getFilesystem() - { - return $this->files; - } - +class MigrationCreator +{ + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * The registered post create hooks. + * + * @var array + */ + protected $postCreate = []; + + /** + * Create a new migration creator instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @return void + */ + public function __construct(Filesystem $files) + { + $this->files = $files; + } + + /** + * Create a new migration at the given path. + * + * @param string $name + * @param string $path + * @param string $table + * @param bool $create + * @return string + */ + public function create($name, $path, $table = null, $create = false) + { + $path = $this->getPath($name, $path); + + // First we will get the stub file for the migration, which serves as a type + // of template for the migration. Once we have those we will populate the + // various place-holders, save the file, and run the post create event. + $stub = $this->getStub($table, $create); + + $this->files->put($path, $this->populateStub($name, $stub, $table)); + + $this->firePostCreateHooks(); + + return $path; + } + + /** + * Get the migration stub file. + * + * @param string $table + * @param bool $create + * @return string + */ + protected function getStub($table, $create) + { + if (is_null($table)) { + return $this->files->get($this->getStubPath().'/blank.stub'); + } + + // We also have stubs for creating new tables and modifying existing tables + // to save the developer some typing when they are creating a new tables + // or modifying existing tables. We'll grab the appropriate stub here. + else { + $stub = $create ? 'create.stub' : 'update.stub'; + + return $this->files->get($this->getStubPath()."/{$stub}"); + } + } + + /** + * Populate the place-holders in the migration stub. + * + * @param string $name + * @param string $stub + * @param string $table + * @return string + */ + protected function populateStub($name, $stub, $table) + { + $stub = str_replace('DummyClass', $this->getClassName($name), $stub); + + // Here we will replace the table place-holders with the table specified by + // the developer, which is useful for quickly creating a tables creation + // or update migration from the console instead of typing it manually. + if (! is_null($table)) { + $stub = str_replace('DummyTable', $table, $stub); + } + + return $stub; + } + + /** + * Get the class name of a migration name. + * + * @param string $name + * @return string + */ + protected function getClassName($name) + { + return Str::studly($name); + } + + /** + * Fire the registered post create hooks. + * + * @return void + */ + protected function firePostCreateHooks() + { + foreach ($this->postCreate as $callback) { + call_user_func($callback); + } + } + + /** + * Register a post migration create hook. + * + * @param \Closure $callback + * @return void + */ + public function afterCreate(Closure $callback) + { + $this->postCreate[] = $callback; + } + + /** + * Get the full path name to the migration. + * + * @param string $name + * @param string $path + * @return string + */ + protected function getPath($name, $path) + { + return $path.'/'.$this->getDatePrefix().'_'.$name.'.php'; + } + + /** + * Get the date prefix for the migration. + * + * @return string + */ + protected function getDatePrefix() + { + return date('Y_m_d_His'); + } + + /** + * Get the path to the stubs. + * + * @return string + */ + public function getStubPath() + { + return __DIR__.'/stubs'; + } + + /** + * Get the filesystem instance. + * + * @return \Illuminate\Filesystem\Filesystem + */ + public function getFilesystem() + { + return $this->files; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php b/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php index dfafa15..5450a7a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php @@ -1,65 +1,66 @@ -files = $files; - $this->resolver = $resolver; - $this->repository = $repository; - } - - /** - * Run the outstanding migrations at a given path. - * - * @param string $path - * @param bool $pretend - * @return void - */ - public function run($path, $pretend = false) - { - $this->notes = array(); - - $files = $this->getMigrationFiles($path); - - // Once we grab all of the migration files for the path, we will compare them - // against the migrations that have already been run for this package then - // run each of the outstanding migrations against a database connection. - $ran = $this->repository->getRan(); - - $migrations = array_diff($files, $ran); - - $this->requireFiles($path, $migrations); - - $this->runMigrationList($migrations, $pretend); - } - - /** - * Run an array of migrations. - * - * @param array $migrations - * @param bool $pretend - * @return void - */ - public function runMigrationList($migrations, $pretend = false) - { - // First we will just make sure that there are any migrations to run. If there - // aren't, we will just make a note of it to the developer so they're aware - // that all of the migrations have been run against this database system. - if (count($migrations) == 0) - { - $this->note('Nothing to migrate.'); - - return; - } - - $batch = $this->repository->getNextBatchNumber(); - - // Once we have the array of migrations, we will spin through them and run the - // migrations "up" so the changes are made to the databases. We'll then log - // that the migration was run so we don't repeat it next time we execute. - foreach ($migrations as $file) - { - $this->runUp($file, $batch, $pretend); - } - } - - /** - * Run "up" a migration instance. - * - * @param string $file - * @param int $batch - * @param bool $pretend - * @return void - */ - protected function runUp($file, $batch, $pretend) - { - // First we will resolve a "real" instance of the migration class from this - // migration file name. Once we have the instances we can run the actual - // command such as "up" or "down", or we can just simulate the action. - $migration = $this->resolve($file); - - if ($pretend) - { - return $this->pretendToRun($migration, 'up'); - } - - $migration->up(); - - // Once we have run a migrations class, we will log that it was run in this - // repository so that we don't try to run it next time we do a migration - // in the application. A migration repository keeps the migrate order. - $this->repository->log($file, $batch); - - $this->note("Migrated: $file"); - } - - /** - * Rollback the last migration operation. - * - * @param bool $pretend - * @return int - */ - public function rollback($pretend = false) - { - $this->notes = array(); - - // We want to pull in the last batch of migrations that ran on the previous - // migration operation. We'll then reverse those migrations and run each - // of them "down" to reverse the last migration "operation" which ran. - $migrations = $this->repository->getLast(); - - if (count($migrations) == 0) - { - $this->note('Nothing to rollback.'); - - return count($migrations); - } - - // We need to reverse these migrations so that they are "downed" in reverse - // to what they run on "up". It lets us backtrack through the migrations - // and properly reverse the entire database schema operation that ran. - foreach ($migrations as $migration) - { - $this->runDown((object) $migration, $pretend); - } - - return count($migrations); - } - - /** - * Rolls all of the currently applied migrations back. - * - * @param bool $pretend - * @return int - */ - public function reset($pretend = false) - { - $this->notes = []; - - $migrations = array_reverse($this->repository->getRan()); - - if (count($migrations) == 0) - { - $this->note('Nothing to rollback.'); - - return count($migrations); - } - - foreach ($migrations as $migration) - { - $this->runDown((object) ['migration' => $migration], $pretend); - } - - return count($migrations); - } - - /** - * Run "down" a migration instance. - * - * @param object $migration - * @param bool $pretend - * @return void - */ - protected function runDown($migration, $pretend) - { - $file = $migration->migration; - - // First we will get the file name of the migration so we can resolve out an - // instance of the migration. Once we get an instance we can either run a - // pretend execution of the migration or we can run the real migration. - $instance = $this->resolve($file); - - if ($pretend) - { - return $this->pretendToRun($instance, 'down'); - } - - $instance->down(); - - // Once we have successfully run the migration "down" we will remove it from - // the migration repository so it will be considered to have not been run - // by the application then will be able to fire by any later operation. - $this->repository->delete($migration); - - $this->note("Rolled back: $file"); - } - - /** - * Get all of the migration files in a given path. - * - * @param string $path - * @return array - */ - public function getMigrationFiles($path) - { - $files = $this->files->glob($path.'/*_*.php'); - - // Once we have the array of files in the directory we will just remove the - // extension and take the basename of the file which is all we need when - // finding the migrations that haven't been run against the databases. - if ($files === false) return array(); - - $files = array_map(function($file) - { - return str_replace('.php', '', basename($file)); - - }, $files); - - // Once we have all of the formatted file names we will sort them and since - // they all start with a timestamp this should give us the migrations in - // the order they were actually created by the application developers. - sort($files); - - return $files; - } - - /** - * Require in all the migration files in a given path. - * - * @param string $path - * @param array $files - * @return void - */ - public function requireFiles($path, array $files) - { - foreach ($files as $file) $this->files->requireOnce($path.'/'.$file.'.php'); - } - - /** - * Pretend to run the migrations. - * - * @param object $migration - * @param string $method - * @return void - */ - protected function pretendToRun($migration, $method) - { - foreach ($this->getQueries($migration, $method) as $query) - { - $name = get_class($migration); - - $this->note("{$name}: {$query['query']}"); - } - } - - /** - * Get all of the queries that would be run for a migration. - * - * @param object $migration - * @param string $method - * @return array - */ - protected function getQueries($migration, $method) - { - $connection = $migration->getConnection(); - - // Now that we have the connections we can resolve it and pretend to run the - // queries against the database returning the array of raw SQL statements - // that would get fired against the database system for this migration. - $db = $this->resolveConnection($connection); - - return $db->pretend(function() use ($migration, $method) - { - $migration->$method(); - }); - } - - /** - * Resolve a migration instance from a file. - * - * @param string $file - * @return object - */ - public function resolve($file) - { - $file = implode('_', array_slice(explode('_', $file), 4)); - - $class = studly_case($file); - - return new $class; - } - - /** - * Raise a note event for the migrator. - * - * @param string $message - * @return void - */ - protected function note($message) - { - $this->notes[] = $message; - } - - /** - * Get the notes for the last operation. - * - * @return array - */ - public function getNotes() - { - return $this->notes; - } - - /** - * Resolve the database connection instance. - * - * @param string $connection - * @return \Illuminate\Database\Connection - */ - public function resolveConnection($connection) - { - return $this->resolver->connection($connection); - } - - /** - * Set the default connection name. - * - * @param string $name - * @return void - */ - public function setConnection($name) - { - if ( ! is_null($name)) - { - $this->resolver->setDefaultConnection($name); - } - - $this->repository->setSource($name); - - $this->connection = $name; - } - - /** - * Get the migration repository instance. - * - * @return \Illuminate\Database\Migrations\MigrationRepositoryInterface - */ - public function getRepository() - { - return $this->repository; - } - - /** - * Determine if the migration repository exists. - * - * @return bool - */ - public function repositoryExists() - { - return $this->repository->repositoryExists(); - } - - /** - * Get the file system instance. - * - * @return \Illuminate\Filesystem\Filesystem - */ - public function getFilesystem() - { - return $this->files; - } - + { + $this->files = $files; + $this->resolver = $resolver; + $this->repository = $repository; + } + + /** + * Run the outstanding migrations at a given path. + * + * @param string $path + * @param bool $pretend + * @return void + */ + public function run($path, $pretend = false) + { + $this->notes = []; + + $files = $this->getMigrationFiles($path); + + // Once we grab all of the migration files for the path, we will compare them + // against the migrations that have already been run for this package then + // run each of the outstanding migrations against a database connection. + $ran = $this->repository->getRan(); + + $migrations = array_diff($files, $ran); + + $this->requireFiles($path, $migrations); + + $this->runMigrationList($migrations, $pretend); + } + + /** + * Run an array of migrations. + * + * @param array $migrations + * @param bool $pretend + * @return void + */ + public function runMigrationList($migrations, $pretend = false) + { + // First we will just make sure that there are any migrations to run. If there + // aren't, we will just make a note of it to the developer so they're aware + // that all of the migrations have been run against this database system. + if (count($migrations) == 0) { + $this->note('Nothing to migrate.'); + + return; + } + + $batch = $this->repository->getNextBatchNumber(); + + // Once we have the array of migrations, we will spin through them and run the + // migrations "up" so the changes are made to the databases. We'll then log + // that the migration was run so we don't repeat it next time we execute. + foreach ($migrations as $file) { + $this->runUp($file, $batch, $pretend); + } + } + + /** + * Run "up" a migration instance. + * + * @param string $file + * @param int $batch + * @param bool $pretend + * @return void + */ + protected function runUp($file, $batch, $pretend) + { + // First we will resolve a "real" instance of the migration class from this + // migration file name. Once we have the instances we can run the actual + // command such as "up" or "down", or we can just simulate the action. + $migration = $this->resolve($file); + + if ($pretend) { + return $this->pretendToRun($migration, 'up'); + } + + $migration->up(); + + // Once we have run a migrations class, we will log that it was run in this + // repository so that we don't try to run it next time we do a migration + // in the application. A migration repository keeps the migrate order. + $this->repository->log($file, $batch); + + $this->note("Migrated: $file"); + } + + /** + * Rollback the last migration operation. + * + * @param bool $pretend + * @return int + */ + public function rollback($pretend = false) + { + $this->notes = []; + + // We want to pull in the last batch of migrations that ran on the previous + // migration operation. We'll then reverse those migrations and run each + // of them "down" to reverse the last migration "operation" which ran. + $migrations = $this->repository->getLast(); + + $count = count($migrations); + + if ($count === 0) { + $this->note('Nothing to rollback.'); + } else { + // We need to reverse these migrations so that they are "downed" in reverse + // to what they run on "up". It lets us backtrack through the migrations + // and properly reverse the entire database schema operation that ran. + foreach ($migrations as $migration) { + $this->runDown((object) $migration, $pretend); + } + } + + return $count; + } + + /** + * Rolls all of the currently applied migrations back. + * + * @param bool $pretend + * @return int + */ + public function reset($pretend = false) + { + $this->notes = []; + + $migrations = array_reverse($this->repository->getRan()); + + $count = count($migrations); + + if ($count === 0) { + $this->note('Nothing to rollback.'); + } else { + foreach ($migrations as $migration) { + $this->runDown((object) ['migration' => $migration], $pretend); + } + } + + return $count; + } + + /** + * Run "down" a migration instance. + * + * @param object $migration + * @param bool $pretend + * @return void + */ + protected function runDown($migration, $pretend) + { + $file = $migration->migration; + + // First we will get the file name of the migration so we can resolve out an + // instance of the migration. Once we get an instance we can either run a + // pretend execution of the migration or we can run the real migration. + $instance = $this->resolve($file); + + if ($pretend) { + return $this->pretendToRun($instance, 'down'); + } + + $instance->down(); + + // Once we have successfully run the migration "down" we will remove it from + // the migration repository so it will be considered to have not been run + // by the application then will be able to fire by any later operation. + $this->repository->delete($migration); + + $this->note("Rolled back: $file"); + } + + /** + * Get all of the migration files in a given path. + * + * @param string $path + * @return array + */ + public function getMigrationFiles($path) + { + $files = $this->files->glob($path.'/*_*.php'); + + // Once we have the array of files in the directory we will just remove the + // extension and take the basename of the file which is all we need when + // finding the migrations that haven't been run against the databases. + if ($files === false) { + return []; + } + + $files = array_map(function ($file) { + return str_replace('.php', '', basename($file)); + }, $files); + + // Once we have all of the formatted file names we will sort them and since + // they all start with a timestamp this should give us the migrations in + // the order they were actually created by the application developers. + sort($files); + + return $files; + } + + /** + * Require in all the migration files in a given path. + * + * @param string $path + * @param array $files + * @return void + */ + public function requireFiles($path, array $files) + { + foreach ($files as $file) { + $this->files->requireOnce($path.'/'.$file.'.php'); + } + } + + /** + * Pretend to run the migrations. + * + * @param object $migration + * @param string $method + * @return void + */ + protected function pretendToRun($migration, $method) + { + foreach ($this->getQueries($migration, $method) as $query) { + $name = get_class($migration); + + $this->note("{$name}: {$query['query']}"); + } + } + + /** + * Get all of the queries that would be run for a migration. + * + * @param object $migration + * @param string $method + * @return array + */ + protected function getQueries($migration, $method) + { + $connection = $migration->getConnection(); + + // Now that we have the connections we can resolve it and pretend to run the + // queries against the database returning the array of raw SQL statements + // that would get fired against the database system for this migration. + $db = $this->resolveConnection($connection); + + return $db->pretend(function () use ($migration, $method) { + $migration->$method(); + }); + } + + /** + * Resolve a migration instance from a file. + * + * @param string $file + * @return object + */ + public function resolve($file) + { + $file = implode('_', array_slice(explode('_', $file), 4)); + + $class = Str::studly($file); + + return new $class; + } + + /** + * Raise a note event for the migrator. + * + * @param string $message + * @return void + */ + protected function note($message) + { + $this->notes[] = $message; + } + + /** + * Get the notes for the last operation. + * + * @return array + */ + public function getNotes() + { + return $this->notes; + } + + /** + * Resolve the database connection instance. + * + * @param string $connection + * @return \Illuminate\Database\Connection + */ + public function resolveConnection($connection) + { + return $this->resolver->connection($connection); + } + + /** + * Set the default connection name. + * + * @param string $name + * @return void + */ + public function setConnection($name) + { + if (! is_null($name)) { + $this->resolver->setDefaultConnection($name); + } + + $this->repository->setSource($name); + + $this->connection = $name; + } + + /** + * Get the migration repository instance. + * + * @return \Illuminate\Database\Migrations\MigrationRepositoryInterface + */ + public function getRepository() + { + return $this->repository; + } + + /** + * Determine if the migration repository exists. + * + * @return bool + */ + public function repositoryExists() + { + return $this->repository->repositoryExists(); + } + + /** + * Get the file system instance. + * + * @return \Illuminate\Filesystem\Filesystem + */ + public function getFilesystem() + { + return $this->files; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/blank.stub b/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/blank.stub index a711201..4ff5ee5 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/blank.stub +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/blank.stub @@ -3,26 +3,25 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class {{class}} extends Migration { - - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - // - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - // - } +class DummyClass extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + // + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/create.stub b/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/create.stub index 0f15b3e..d7320ea 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/create.stub +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/create.stub @@ -3,30 +3,28 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class {{class}} extends Migration { - - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('{{table}}', function(Blueprint $table) - { - $table->increments('id'); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('{{table}}'); - } +class DummyClass extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('DummyTable', function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('DummyTable'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/update.stub b/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/update.stub index cc2c904..8114a81 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/update.stub +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/update.stub @@ -3,32 +3,29 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class {{class}} extends Migration { - - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::table('{{table}}', function(Blueprint $table) - { - // - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('{{table}}', function(Blueprint $table) - { - // - }); - } +class DummyClass extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::table('DummyTable', function (Blueprint $table) { + // + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('DummyTable', function (Blueprint $table) { + // + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/MySqlConnection.php b/application/vendor/laravel/framework/src/Illuminate/Database/MySqlConnection.php index 77e6863..446426d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/MySqlConnection.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/MySqlConnection.php @@ -1,4 +1,6 @@ -schemaGrammar)) { $this->useDefaultSchemaGrammar(); } - - return new MySqlBuilder($this); - } - - /** - * Get the default query grammar instance. - * - * @return \Illuminate\Database\Query\Grammars\MySqlGrammar - */ - protected function getDefaultQueryGrammar() - { - return $this->withTablePrefix(new QueryGrammar); - } - - /** - * Get the default schema grammar instance. - * - * @return \Illuminate\Database\Schema\Grammars\MySqlGrammar - */ - protected function getDefaultSchemaGrammar() - { - return $this->withTablePrefix(new SchemaGrammar); - } - - /** - * Get the default post processor instance. - * - * @return \Illuminate\Database\Query\Processors\Processor - */ - protected function getDefaultPostProcessor() - { - return new MySqlProcessor; - } - - /** - * Get the Doctrine DBAL driver. - * - * @return \Doctrine\DBAL\Driver\PDOMySql\Driver - */ - protected function getDoctrineDriver() - { - return new DoctrineDriver; - } +class MySqlConnection extends Connection +{ + /** + * Get a schema builder instance for the connection. + * + * @return \Illuminate\Database\Schema\MySqlBuilder + */ + public function getSchemaBuilder() + { + if (is_null($this->schemaGrammar)) { + $this->useDefaultSchemaGrammar(); + } + + return new MySqlBuilder($this); + } + + /** + * Get the default query grammar instance. + * + * @return \Illuminate\Database\Query\Grammars\MySqlGrammar + */ + protected function getDefaultQueryGrammar() + { + return $this->withTablePrefix(new QueryGrammar); + } + + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\MySqlGrammar + */ + protected function getDefaultSchemaGrammar() + { + return $this->withTablePrefix(new SchemaGrammar); + } + + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\MySqlProcessor + */ + protected function getDefaultPostProcessor() + { + return new MySqlProcessor; + } + /** + * Get the Doctrine DBAL driver. + * + * @return \Doctrine\DBAL\Driver\PDOMySql\Driver + */ + protected function getDoctrineDriver() + { + return new DoctrineDriver; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php b/application/vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php index 56b6c4e..779888d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php @@ -1,50 +1,66 @@ -withTablePrefix(new QueryGrammar); - } - - /** - * Get the default schema grammar instance. - * - * @return \Illuminate\Database\Schema\Grammars\PostgresGrammar - */ - protected function getDefaultSchemaGrammar() - { - return $this->withTablePrefix(new SchemaGrammar); - } - - /** - * Get the default post processor instance. - * - * @return \Illuminate\Database\Query\Processors\PostgresProcessor - */ - protected function getDefaultPostProcessor() - { - return new PostgresProcessor; - } - - /** - * Get the Doctrine DBAL driver. - * - * @return \Doctrine\DBAL\Driver\PDOPgSql\Driver - */ - protected function getDoctrineDriver() - { - return new DoctrineDriver; - } +class PostgresConnection extends Connection +{ + /** + * Get a schema builder instance for the connection. + * + * @return \Illuminate\Database\Schema\PostgresBuilder + */ + public function getSchemaBuilder() + { + if (is_null($this->schemaGrammar)) { + $this->useDefaultSchemaGrammar(); + } + + return new PostgresBuilder($this); + } + + /** + * Get the default query grammar instance. + * + * @return \Illuminate\Database\Query\Grammars\PostgresGrammar + */ + protected function getDefaultQueryGrammar() + { + return $this->withTablePrefix(new QueryGrammar); + } + + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\PostgresGrammar + */ + protected function getDefaultSchemaGrammar() + { + return $this->withTablePrefix(new SchemaGrammar); + } + + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\PostgresProcessor + */ + protected function getDefaultPostProcessor() + { + return new PostgresProcessor; + } + /** + * Get the Doctrine DBAL driver. + * + * @return \Doctrine\DBAL\Driver\PDOPgSql\Driver + */ + protected function getDoctrineDriver() + { + return new DoctrineDriver; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php index 84190c5..929ec01 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php @@ -1,2002 +1,2125 @@ - [], - 'join' => [], - 'where' => [], - 'having' => [], - 'order' => [], - ); - - /** - * An aggregate function and column to be run. - * - * @var array - */ - public $aggregate; - - /** - * The columns that should be returned. - * - * @var array - */ - public $columns; - - /** - * Indicates if the query returns distinct results. - * - * @var bool - */ - public $distinct = false; - - /** - * The table which the query is targeting. - * - * @var string - */ - public $from; - - /** - * The table joins for the query. - * - * @var array - */ - public $joins; - - /** - * The where constraints for the query. - * - * @var array - */ - public $wheres; - - /** - * The groupings for the query. - * - * @var array - */ - public $groups; - - /** - * The having constraints for the query. - * - * @var array - */ - public $havings; - - /** - * The orderings for the query. - * - * @var array - */ - public $orders; - - /** - * The maximum number of records to return. - * - * @var int - */ - public $limit; - - /** - * The number of records to skip. - * - * @var int - */ - public $offset; - - /** - * The query union statements. - * - * @var array - */ - public $unions; - - /** - * The maximum number of union records to return. - * - * @var int - */ - public $unionLimit; - - /** - * The number of union records to skip. - * - * @var int - */ - public $unionOffset; - - /** - * The orderings for the union query. - * - * @var array - */ - public $unionOrders; - - /** - * Indicates whether row locking is being used. - * - * @var string|bool - */ - public $lock; - - /** - * The field backups currently in use. - * - * @var array - */ - protected $backups = []; - - /** - * All of the available clause operators. - * - * @var array - */ - protected $operators = array( - '=', '<', '>', '<=', '>=', '<>', '!=', - 'like', 'like binary', 'not like', 'between', 'ilike', - '&', '|', '^', '<<', '>>', - 'rlike', 'regexp', 'not regexp', - '~', '~*', '!~', '!~*', 'similar to', - 'not similar to', - ); - - /** - * Whether use write pdo for select. - * - * @var bool - */ - protected $useWritePdo = false; - - /** - * Create a new query builder instance. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Illuminate\Database\Query\Grammars\Grammar $grammar - * @param \Illuminate\Database\Query\Processors\Processor $processor - * @return void - */ - public function __construct(ConnectionInterface $connection, +class Builder +{ + use Macroable { + __call as macroCall; + } + + /** + * The database connection instance. + * + * @var \Illuminate\Database\Connection + */ + protected $connection; + + /** + * The database query grammar instance. + * + * @var \Illuminate\Database\Query\Grammars\Grammar + */ + protected $grammar; + + /** + * The database query post processor instance. + * + * @var \Illuminate\Database\Query\Processors\Processor + */ + protected $processor; + + /** + * The current query value bindings. + * + * @var array + */ + protected $bindings = [ + 'select' => [], + 'join' => [], + 'where' => [], + 'having' => [], + 'order' => [], + 'union' => [], + ]; + + /** + * An aggregate function and column to be run. + * + * @var array + */ + public $aggregate; + + /** + * The columns that should be returned. + * + * @var array + */ + public $columns; + + /** + * Indicates if the query returns distinct results. + * + * @var bool + */ + public $distinct = false; + + /** + * The table which the query is targeting. + * + * @var string + */ + public $from; + + /** + * The table joins for the query. + * + * @var array + */ + public $joins; + + /** + * The where constraints for the query. + * + * @var array + */ + public $wheres; + + /** + * The groupings for the query. + * + * @var array + */ + public $groups; + + /** + * The having constraints for the query. + * + * @var array + */ + public $havings; + + /** + * The orderings for the query. + * + * @var array + */ + public $orders; + + /** + * The maximum number of records to return. + * + * @var int + */ + public $limit; + + /** + * The number of records to skip. + * + * @var int + */ + public $offset; + + /** + * The query union statements. + * + * @var array + */ + public $unions; + + /** + * The maximum number of union records to return. + * + * @var int + */ + public $unionLimit; + + /** + * The number of union records to skip. + * + * @var int + */ + public $unionOffset; + + /** + * The orderings for the union query. + * + * @var array + */ + public $unionOrders; + + /** + * Indicates whether row locking is being used. + * + * @var string|bool + */ + public $lock; + + /** + * The field backups currently in use. + * + * @var array + */ + protected $backups = []; + + /** + * The binding backups currently in use. + * + * @var array + */ + protected $bindingBackups = []; + + /** + * All of the available clause operators. + * + * @var array + */ + protected $operators = [ + '=', '<', '>', '<=', '>=', '<>', '!=', + 'like', 'like binary', 'not like', 'between', 'ilike', + '&', '|', '^', '<<', '>>', + 'rlike', 'regexp', 'not regexp', + '~', '~*', '!~', '!~*', 'similar to', + 'not similar to', + ]; + + /** + * Whether use write pdo for select. + * + * @var bool + */ + protected $useWritePdo = false; + + /** + * Create a new query builder instance. + * + * @param \Illuminate\Database\ConnectionInterface $connection + * @param \Illuminate\Database\Query\Grammars\Grammar $grammar + * @param \Illuminate\Database\Query\Processors\Processor $processor + * @return void + */ + public function __construct(ConnectionInterface $connection, Grammar $grammar, Processor $processor) - { - $this->grammar = $grammar; - $this->processor = $processor; - $this->connection = $connection; - } - - /** - * Set the columns to be selected. - * - * @param array $columns - * @return $this - */ - public function select($columns = array('*')) - { - $this->columns = is_array($columns) ? $columns : func_get_args(); - - return $this; - } - - /** - * Add a new "raw" select expression to the query. - * - * @param string $expression - * @param array $bindings - * @return \Illuminate\Database\Query\Builder|static - */ - public function selectRaw($expression, array $bindings = array()) - { - $this->addSelect(new Expression($expression)); - - if ($bindings) - { - $this->addBinding($bindings, 'select'); - } - - return $this; - } - - /** - * Add a subselect expression to the query. - * - * @param \Closure|\Illuminate\Database\Query\Builder|string $query - * @param string $as - * @return \Illuminate\Database\Query\Builder|static - */ - public function selectSub($query, $as) - { - if ($query instanceof Closure) - { - $callback = $query; - - $callback($query = $this->newQuery()); - } - - if ($query instanceof Builder) - { - $bindings = $query->getBindings(); - - $query = $query->toSql(); - } - elseif (is_string($query)) - { - $bindings = []; - } - else - { - throw new InvalidArgumentException; - } - - return $this->selectRaw('('.$query.') as '.$this->grammar->wrap($as), $bindings); - } - - /** - * Add a new select column to the query. - * - * @param mixed $column - * @return $this - */ - public function addSelect($column) - { - $column = is_array($column) ? $column : func_get_args(); - - $this->columns = array_merge((array) $this->columns, $column); - - return $this; - } - - /** - * Force the query to only return distinct results. - * - * @return $this - */ - public function distinct() - { - $this->distinct = true; - - return $this; - } - - /** - * Set the table which the query is targeting. - * - * @param string $table - * @return $this - */ - public function from($table) - { - $this->from = $table; - - return $this; - } - - /** - * Add a join clause to the query. - * - * @param string $table - * @param string $one - * @param string $operator - * @param string $two - * @param string $type - * @param bool $where - * @return $this - */ - public function join($table, $one, $operator = null, $two = null, $type = 'inner', $where = false) - { - // If the first "column" of the join is really a Closure instance the developer - // is trying to build a join with a complex "on" clause containing more than - // one condition, so we'll add the join and call a Closure with the query. - if ($one instanceof Closure) - { - $this->joins[] = new JoinClause($type, $table); - - call_user_func($one, end($this->joins)); - } - - // If the column is simply a string, we can assume the join simply has a basic - // "on" clause with a single condition. So we will just build the join with - // this simple join clauses attached to it. There is not a join callback. - else - { - $join = new JoinClause($type, $table); - - $this->joins[] = $join->on( - $one, $operator, $two, 'and', $where - ); - } - - return $this; - } - - /** - * Add a "join where" clause to the query. - * - * @param string $table - * @param string $one - * @param string $operator - * @param string $two - * @param string $type - * @return \Illuminate\Database\Query\Builder|static - */ - public function joinWhere($table, $one, $operator, $two, $type = 'inner') - { - return $this->join($table, $one, $operator, $two, $type, true); - } - - /** - * Add a left join to the query. - * - * @param string $table - * @param string $first - * @param string $operator - * @param string $second - * @return \Illuminate\Database\Query\Builder|static - */ - public function leftJoin($table, $first, $operator = null, $second = null) - { - return $this->join($table, $first, $operator, $second, 'left'); - } - - /** - * Add a "join where" clause to the query. - * - * @param string $table - * @param string $one - * @param string $operator - * @param string $two - * @return \Illuminate\Database\Query\Builder|static - */ - public function leftJoinWhere($table, $one, $operator, $two) - { - return $this->joinWhere($table, $one, $operator, $two, 'left'); - } - - /** - * Add a right join to the query. - * - * @param string $table - * @param string $first - * @param string $operator - * @param string $second - * @return \Illuminate\Database\Query\Builder|static - */ - public function rightJoin($table, $first, $operator = null, $second = null) - { - return $this->join($table, $first, $operator, $second, 'right'); - } - - /** - * Add a "right join where" clause to the query. - * - * @param string $table - * @param string $one - * @param string $operator - * @param string $two - * @return \Illuminate\Database\Query\Builder|static - */ - public function rightJoinWhere($table, $one, $operator, $two) - { - return $this->joinWhere($table, $one, $operator, $two, 'right'); - } - - /** - * Add a basic where clause to the query. - * - * @param string|array|\Closure $column - * @param string $operator - * @param mixed $value - * @param string $boolean - * @return $this - * - * @throws \InvalidArgumentException - */ - public function where($column, $operator = null, $value = null, $boolean = 'and') - { - // If the column is an array, we will assume it is an array of key-value pairs - // and can add them each as a where clause. We will maintain the boolean we - // received when the method was called and pass it into the nested where. - if (is_array($column)) - { - return $this->whereNested(function($query) use ($column) - { - foreach ($column as $key => $value) - { - $query->where($key, '=', $value); - } - }, $boolean); - } - - // Here we will make some assumptions about the operator. If only 2 values are - // passed to the method, we will assume that the operator is an equals sign - // and keep going. Otherwise, we'll require the operator to be passed in. - if (func_num_args() == 2) - { - list($value, $operator) = array($operator, '='); - } - elseif ($this->invalidOperatorAndValue($operator, $value)) - { - throw new InvalidArgumentException("Illegal operator and value combination."); - } - - // If the columns is actually a Closure instance, we will assume the developer - // wants to begin a nested where statement which is wrapped in parenthesis. - // We'll add that Closure to the query then return back out immediately. - if ($column instanceof Closure) - { - return $this->whereNested($column, $boolean); - } - - // If the given operator is not found in the list of valid operators we will - // assume that the developer is just short-cutting the '=' operators and - // we will set the operators to '=' and set the values appropriately. - if ( ! in_array(strtolower($operator), $this->operators, true)) - { - list($value, $operator) = array($operator, '='); - } - - // If the value is a Closure, it means the developer is performing an entire - // sub-select within the query and we will need to compile the sub-select - // within the where clause to get the appropriate query record results. - if ($value instanceof Closure) - { - return $this->whereSub($column, $operator, $value, $boolean); - } - - // If the value is "null", we will just assume the developer wants to add a - // where null clause to the query. So, we will allow a short-cut here to - // that method for convenience so the developer doesn't have to check. - if (is_null($value)) - { - return $this->whereNull($column, $boolean, $operator != '='); - } - - // Now that we are working with just a simple query we can put the elements - // in our array and add the query binding to our array of bindings that - // will be bound to each SQL statements when it is finally executed. - $type = 'Basic'; - - $this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean'); - - if ( ! $value instanceof Expression) - { - $this->addBinding($value, 'where'); - } - - return $this; - } - - /** - * Add an "or where" clause to the query. - * - * @param string $column - * @param string $operator - * @param mixed $value - * @return \Illuminate\Database\Query\Builder|static - */ - public function orWhere($column, $operator = null, $value = null) - { - return $this->where($column, $operator, $value, 'or'); - } - - /** - * Determine if the given operator and value combination is legal. - * - * @param string $operator - * @param mixed $value - * @return bool - */ - protected function invalidOperatorAndValue($operator, $value) - { - $isOperator = in_array($operator, $this->operators); - - return $isOperator && $operator != '=' && is_null($value); - } - - /** - * Add a raw where clause to the query. - * - * @param string $sql - * @param array $bindings - * @param string $boolean - * @return $this - */ - public function whereRaw($sql, array $bindings = array(), $boolean = 'and') - { - $type = 'raw'; - - $this->wheres[] = compact('type', 'sql', 'boolean'); - - $this->addBinding($bindings, 'where'); - - return $this; - } - - /** - * Add a raw or where clause to the query. - * - * @param string $sql - * @param array $bindings - * @return \Illuminate\Database\Query\Builder|static - */ - public function orWhereRaw($sql, array $bindings = array()) - { - return $this->whereRaw($sql, $bindings, 'or'); - } - - /** - * Add a where between statement to the query. - * - * @param string $column - * @param array $values - * @param string $boolean - * @param bool $not - * @return $this - */ - public function whereBetween($column, array $values, $boolean = 'and', $not = false) - { - $type = 'between'; - - $this->wheres[] = compact('column', 'type', 'boolean', 'not'); - - $this->addBinding($values, 'where'); - - return $this; - } - - /** - * Add an or where between statement to the query. - * - * @param string $column - * @param array $values - * @return \Illuminate\Database\Query\Builder|static - */ - public function orWhereBetween($column, array $values) - { - return $this->whereBetween($column, $values, 'or'); - } - - /** - * Add a where not between statement to the query. - * - * @param string $column - * @param array $values - * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static - */ - public function whereNotBetween($column, array $values, $boolean = 'and') - { - return $this->whereBetween($column, $values, $boolean, true); - } - - /** - * Add an or where not between statement to the query. - * - * @param string $column - * @param array $values - * @return \Illuminate\Database\Query\Builder|static - */ - public function orWhereNotBetween($column, array $values) - { - return $this->whereNotBetween($column, $values, 'or'); - } - - /** - * Add a nested where statement to the query. - * - * @param \Closure $callback - * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static - */ - public function whereNested(Closure $callback, $boolean = 'and') - { - // To handle nested queries we'll actually create a brand new query instance - // and pass it off to the Closure that we have. The Closure can simply do - // do whatever it wants to a query then we will store it for compiling. - $query = $this->newQuery(); - - $query->from($this->from); - - call_user_func($callback, $query); - - return $this->addNestedWhereQuery($query, $boolean); - } - - /** - * Add another query builder as a nested where to the query builder. - * - * @param \Illuminate\Database\Query\Builder|static $query - * @param string $boolean - * @return $this - */ - public function addNestedWhereQuery($query, $boolean = 'and') - { - if (count($query->wheres)) - { - $type = 'Nested'; - - $this->wheres[] = compact('type', 'query', 'boolean'); - - $this->mergeBindings($query); - } - - return $this; - } - - /** - * Add a full sub-select to the query. - * - * @param string $column - * @param string $operator - * @param \Closure $callback - * @param string $boolean - * @return $this - */ - protected function whereSub($column, $operator, Closure $callback, $boolean) - { - $type = 'Sub'; - - $query = $this->newQuery(); - - // Once we have the query instance we can simply execute it so it can add all - // of the sub-select's conditions to itself, and then we can cache it off - // in the array of where clauses for the "main" parent query instance. - call_user_func($callback, $query); - - $this->wheres[] = compact('type', 'column', 'operator', 'query', 'boolean'); - - $this->mergeBindings($query); - - return $this; - } - - /** - * Add an exists clause to the query. - * - * @param \Closure $callback - * @param string $boolean - * @param bool $not - * @return $this - */ - public function whereExists(Closure $callback, $boolean = 'and', $not = false) - { - $type = $not ? 'NotExists' : 'Exists'; - - $query = $this->newQuery(); - - // Similar to the sub-select clause, we will create a new query instance so - // the developer may cleanly specify the entire exists query and we will - // compile the whole thing in the grammar and insert it into the SQL. - call_user_func($callback, $query); - - $this->wheres[] = compact('type', 'operator', 'query', 'boolean'); - - $this->mergeBindings($query); - - return $this; - } - - /** - * Add an or exists clause to the query. - * - * @param \Closure $callback - * @param bool $not - * @return \Illuminate\Database\Query\Builder|static - */ - public function orWhereExists(Closure $callback, $not = false) - { - return $this->whereExists($callback, 'or', $not); - } - - /** - * Add a where not exists clause to the query. - * - * @param \Closure $callback - * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static - */ - public function whereNotExists(Closure $callback, $boolean = 'and') - { - return $this->whereExists($callback, $boolean, true); - } - - /** - * Add a where not exists clause to the query. - * - * @param \Closure $callback - * @return \Illuminate\Database\Query\Builder|static - */ - public function orWhereNotExists(Closure $callback) - { - return $this->orWhereExists($callback, true); - } - - /** - * Add a "where in" clause to the query. - * - * @param string $column - * @param mixed $values - * @param string $boolean - * @param bool $not - * @return $this - */ - public function whereIn($column, $values, $boolean = 'and', $not = false) - { - $type = $not ? 'NotIn' : 'In'; - - // If the value of the where in clause is actually a Closure, we will assume that - // the developer is using a full sub-select for this "in" statement, and will - // execute those Closures, then we can re-construct the entire sub-selects. - if ($values instanceof Closure) - { - return $this->whereInSub($column, $values, $boolean, $not); - } - - $this->wheres[] = compact('type', 'column', 'values', 'boolean'); - - $this->addBinding($values, 'where'); - - return $this; - } - - /** - * Add an "or where in" clause to the query. - * - * @param string $column - * @param mixed $values - * @return \Illuminate\Database\Query\Builder|static - */ - public function orWhereIn($column, $values) - { - return $this->whereIn($column, $values, 'or'); - } - - /** - * Add a "where not in" clause to the query. - * - * @param string $column - * @param mixed $values - * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static - */ - public function whereNotIn($column, $values, $boolean = 'and') - { - return $this->whereIn($column, $values, $boolean, true); - } - - /** - * Add an "or where not in" clause to the query. - * - * @param string $column - * @param mixed $values - * @return \Illuminate\Database\Query\Builder|static - */ - public function orWhereNotIn($column, $values) - { - return $this->whereNotIn($column, $values, 'or'); - } - - /** - * Add a where in with a sub-select to the query. - * - * @param string $column - * @param \Closure $callback - * @param string $boolean - * @param bool $not - * @return $this - */ - protected function whereInSub($column, Closure $callback, $boolean, $not) - { - $type = $not ? 'NotInSub' : 'InSub'; - - // To create the exists sub-select, we will actually create a query and call the - // provided callback with the query so the developer may set any of the query - // conditions they want for the in clause, then we'll put it in this array. - call_user_func($callback, $query = $this->newQuery()); - - $this->wheres[] = compact('type', 'column', 'query', 'boolean'); - - $this->mergeBindings($query); - - return $this; - } - - /** - * Add a "where null" clause to the query. - * - * @param string $column - * @param string $boolean - * @param bool $not - * @return $this - */ - public function whereNull($column, $boolean = 'and', $not = false) - { - $type = $not ? 'NotNull' : 'Null'; - - $this->wheres[] = compact('type', 'column', 'boolean'); - - return $this; - } - - /** - * Add an "or where null" clause to the query. - * - * @param string $column - * @return \Illuminate\Database\Query\Builder|static - */ - public function orWhereNull($column) - { - return $this->whereNull($column, 'or'); - } - - /** - * Add a "where not null" clause to the query. - * - * @param string $column - * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static - */ - public function whereNotNull($column, $boolean = 'and') - { - return $this->whereNull($column, $boolean, true); - } - - /** - * Add an "or where not null" clause to the query. - * - * @param string $column - * @return \Illuminate\Database\Query\Builder|static - */ - public function orWhereNotNull($column) - { - return $this->whereNotNull($column, 'or'); - } - - /** - * Add a "where date" statement to the query. - * - * @param string $column - * @param string $operator - * @param int $value - * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static - */ - public function whereDate($column, $operator, $value, $boolean = 'and') - { - return $this->addDateBasedWhere('Date', $column, $operator, $value, $boolean); - } - - /** - * Add a "where day" statement to the query. - * - * @param string $column - * @param string $operator - * @param int $value - * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static - */ - public function whereDay($column, $operator, $value, $boolean = 'and') - { - return $this->addDateBasedWhere('Day', $column, $operator, $value, $boolean); - } - - /** - * Add a "where month" statement to the query. - * - * @param string $column - * @param string $operator - * @param int $value - * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static - */ - public function whereMonth($column, $operator, $value, $boolean = 'and') - { - return $this->addDateBasedWhere('Month', $column, $operator, $value, $boolean); - } - - /** - * Add a "where year" statement to the query. - * - * @param string $column - * @param string $operator - * @param int $value - * @param string $boolean - * @return \Illuminate\Database\Query\Builder|static - */ - public function whereYear($column, $operator, $value, $boolean = 'and') - { - return $this->addDateBasedWhere('Year', $column, $operator, $value, $boolean); - } - - /** - * Add a date based (year, month, day) statement to the query. - * - * @param string $type - * @param string $column - * @param string $operator - * @param int $value - * @param string $boolean - * @return $this - */ - protected function addDateBasedWhere($type, $column, $operator, $value, $boolean = 'and') - { - $this->wheres[] = compact('column', 'type', 'boolean', 'operator', 'value'); - - $this->addBinding($value, 'where'); - - return $this; - } - - /** - * Handles dynamic "where" clauses to the query. - * - * @param string $method - * @param string $parameters - * @return $this - */ - public function dynamicWhere($method, $parameters) - { - $finder = substr($method, 5); - - $segments = preg_split('/(And|Or)(?=[A-Z])/', $finder, -1, PREG_SPLIT_DELIM_CAPTURE); - - // The connector variable will determine which connector will be used for the - // query condition. We will change it as we come across new boolean values - // in the dynamic method strings, which could contain a number of these. - $connector = 'and'; - - $index = 0; - - foreach ($segments as $segment) - { - // If the segment is not a boolean connector, we can assume it is a column's name - // and we will add it to the query as a new constraint as a where clause, then - // we can keep iterating through the dynamic method string's segments again. - if ($segment != 'And' && $segment != 'Or') - { - $this->addDynamic($segment, $connector, $parameters, $index); - - $index++; - } - - // Otherwise, we will store the connector so we know how the next where clause we - // find in the query should be connected to the previous ones, meaning we will - // have the proper boolean connector to connect the next where clause found. - else - { - $connector = $segment; - } - } - - return $this; - } - - /** - * Add a single dynamic where clause statement to the query. - * - * @param string $segment - * @param string $connector - * @param array $parameters - * @param int $index - * @return void - */ - protected function addDynamic($segment, $connector, $parameters, $index) - { - // Once we have parsed out the columns and formatted the boolean operators we - // are ready to add it to this query as a where clause just like any other - // clause on the query. Then we'll increment the parameter index values. - $bool = strtolower($connector); - - $this->where(snake_case($segment), '=', $parameters[$index], $bool); - } - - /** - * Add a "group by" clause to the query. - * - * @param array|string $column,... - * @return $this - */ - public function groupBy() - { - foreach (func_get_args() as $arg) - { - $this->groups = array_merge((array) $this->groups, is_array($arg) ? $arg : [$arg]); - } - - return $this; - } - - /** - * Add a "having" clause to the query. - * - * @param string $column - * @param string $operator - * @param string $value - * @param string $boolean - * @return $this - */ - public function having($column, $operator = null, $value = null, $boolean = 'and') - { - $type = 'basic'; - - $this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean'); - - if ( ! $value instanceof Expression) - { - $this->addBinding($value, 'having'); - } - - return $this; - } - - /** - * Add a "or having" clause to the query. - * - * @param string $column - * @param string $operator - * @param string $value - * @return \Illuminate\Database\Query\Builder|static - */ - public function orHaving($column, $operator = null, $value = null) - { - return $this->having($column, $operator, $value, 'or'); - } - - /** - * Add a raw having clause to the query. - * - * @param string $sql - * @param array $bindings - * @param string $boolean - * @return $this - */ - public function havingRaw($sql, array $bindings = array(), $boolean = 'and') - { - $type = 'raw'; - - $this->havings[] = compact('type', 'sql', 'boolean'); - - $this->addBinding($bindings, 'having'); - - return $this; - } - - /** - * Add a raw or having clause to the query. - * - * @param string $sql - * @param array $bindings - * @return \Illuminate\Database\Query\Builder|static - */ - public function orHavingRaw($sql, array $bindings = array()) - { - return $this->havingRaw($sql, $bindings, 'or'); - } - - /** - * Add an "order by" clause to the query. - * - * @param string $column - * @param string $direction - * @return $this - */ - public function orderBy($column, $direction = 'asc') - { - $property = $this->unions ? 'unionOrders' : 'orders'; - $direction = strtolower($direction) == 'asc' ? 'asc' : 'desc'; - - $this->{$property}[] = compact('column', 'direction'); - - return $this; - } - - /** - * Add an "order by" clause for a timestamp to the query. - * - * @param string $column - * @return \Illuminate\Database\Query\Builder|static - */ - public function latest($column = 'created_at') - { - return $this->orderBy($column, 'desc'); - } - - /** - * Add an "order by" clause for a timestamp to the query. - * - * @param string $column - * @return \Illuminate\Database\Query\Builder|static - */ - public function oldest($column = 'created_at') - { - return $this->orderBy($column, 'asc'); - } - - /** - * Add a raw "order by" clause to the query. - * - * @param string $sql - * @param array $bindings - * @return $this - */ - public function orderByRaw($sql, $bindings = array()) - { - $type = 'raw'; - - $this->orders[] = compact('type', 'sql'); - - $this->addBinding($bindings, 'order'); - - return $this; - } - - /** - * Set the "offset" value of the query. - * - * @param int $value - * @return $this - */ - public function offset($value) - { - $property = $this->unions ? 'unionOffset' : 'offset'; - - $this->$property = max(0, $value); - - return $this; - } - - /** - * Alias to set the "offset" value of the query. - * - * @param int $value - * @return \Illuminate\Database\Query\Builder|static - */ - public function skip($value) - { - return $this->offset($value); - } - - /** - * Set the "limit" value of the query. - * - * @param int $value - * @return $this - */ - public function limit($value) - { - $property = $this->unions ? 'unionLimit' : 'limit'; - - if ($value > 0) $this->$property = $value; - - return $this; - } - - /** - * Alias to set the "limit" value of the query. - * - * @param int $value - * @return \Illuminate\Database\Query\Builder|static - */ - public function take($value) - { - return $this->limit($value); - } - - /** - * Set the limit and offset for a given page. - * - * @param int $page - * @param int $perPage - * @return \Illuminate\Database\Query\Builder|static - */ - public function forPage($page, $perPage = 15) - { - return $this->skip(($page - 1) * $perPage)->take($perPage); - } - - /** - * Add a union statement to the query. - * - * @param \Illuminate\Database\Query\Builder|\Closure $query - * @param bool $all - * @return \Illuminate\Database\Query\Builder|static - */ - public function union($query, $all = false) - { - if ($query instanceof Closure) - { - call_user_func($query, $query = $this->newQuery()); - } - - $this->unions[] = compact('query', 'all'); - - return $this->mergeBindings($query); - } - - /** - * Add a union all statement to the query. - * - * @param \Illuminate\Database\Query\Builder|\Closure $query - * @return \Illuminate\Database\Query\Builder|static - */ - public function unionAll($query) - { - return $this->union($query, true); - } - - /** - * Lock the selected rows in the table. - * - * @param bool $value - * @return $this - */ - public function lock($value = true) - { - $this->lock = $value; - - return $this; - } - - /** - * Lock the selected rows in the table for updating. - * - * @return \Illuminate\Database\Query\Builder - */ - public function lockForUpdate() - { - return $this->lock(true); - } - - /** - * Share lock the selected rows in the table. - * - * @return \Illuminate\Database\Query\Builder - */ - public function sharedLock() - { - return $this->lock(false); - } - - /** - * Get the SQL representation of the query. - * - * @return string - */ - public function toSql() - { - return $this->grammar->compileSelect($this); - } - - /** - * Execute a query for a single record by ID. - * - * @param int $id - * @param array $columns - * @return mixed|static - */ - public function find($id, $columns = array('*')) - { - return $this->where('id', '=', $id)->first($columns); - } - - /** - * Pluck a single column's value from the first result of a query. - * - * @param string $column - * @return mixed - */ - public function pluck($column) - { - $result = (array) $this->first(array($column)); - - return count($result) > 0 ? reset($result) : null; - } - - /** - * Execute the query and get the first result. - * - * @param array $columns - * @return mixed|static - */ - public function first($columns = array('*')) - { - $results = $this->take(1)->get($columns); - - return count($results) > 0 ? reset($results) : null; - } - - /** - * Execute the query as a "select" statement. - * - * @param array $columns - * @return array|static[] - */ - public function get($columns = array('*')) - { - return $this->getFresh($columns); - } - - /** - * Execute the query as a fresh "select" statement. - * - * @param array $columns - * @return array|static[] - */ - public function getFresh($columns = array('*')) - { - if (is_null($this->columns)) $this->columns = $columns; - - return $this->processor->processSelect($this, $this->runSelect()); - } - - /** - * Run the query as a "select" statement against the connection. - * - * @return array - */ - protected function runSelect() - { - return $this->connection->select($this->toSql(), $this->getBindings(), ! $this->useWritePdo); - } - - /** - * Paginate the given query into a simple paginator. - * - * @param int $perPage - * @param array $columns - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator - */ - public function paginate($perPage = 15, $columns = ['*']) - { - $page = Paginator::resolveCurrentPage(); - - $total = $this->getCountForPagination($columns); - - $results = $this->forPage($page, $perPage)->get($columns); - - return new LengthAwarePaginator($results, $total, $perPage, $page, [ - 'path' => Paginator::resolveCurrentPath(), - ]); - } - - /** - * Get a paginator only supporting simple next and previous links. - * - * This is more efficient on larger data-sets, etc. - * - * @param int $perPage - * @param array $columns - * @return \Illuminate\Contracts\Pagination\Paginator - */ - public function simplePaginate($perPage = 15, $columns = ['*']) - { - $page = Paginator::resolveCurrentPage(); - - $this->skip(($page - 1) * $perPage)->take($perPage + 1); - - return new Paginator($this->get($columns), $perPage, $page, [ - 'path' => Paginator::resolveCurrentPath(), - ]); - } - - /** - * Get the count of the total records for the paginator. - * - * @param array $columns - * @return int - */ - public function getCountForPagination($columns = ['*']) - { - $this->backupFieldsForCount(); - - $this->aggregate = ['function' => 'count', 'columns' => $columns]; - - $results = $this->get(); - - $this->aggregate = null; - - $this->restoreFieldsForCount(); - - if (isset($this->groups)) return count($results); - - return isset($results[0]) ? (int) array_change_key_case((array) $results[0])['aggregate'] : 0; - } - - /** - * Backup some fields for the pagination count. - * - * @return void - */ - protected function backupFieldsForCount() - { - foreach (['orders', 'limit', 'offset', 'columns'] as $field) - { - $this->backups[$field] = $this->{$field}; - - $this->{$field} = null; - } - } - - /** - * Restore some fields after the pagination count. - * - * @return void - */ - protected function restoreFieldsForCount() - { - foreach (['orders', 'limit', 'offset', 'columns'] as $field) - { - $this->{$field} = $this->backups[$field]; - } - - $this->backups = []; - } - - /** - * Chunk the results of the query. - * - * @param int $count - * @param callable $callback - * @return void - */ - public function chunk($count, callable $callback) - { - $results = $this->forPage($page = 1, $count)->get(); - - while (count($results) > 0) - { - // On each chunk result set, we will pass them to the callback and then let the - // developer take care of everything within the callback, which allows us to - // keep the memory low for spinning through large result sets for working. - if (call_user_func($callback, $results) === false) - { - break; - } - - $page++; - - $results = $this->forPage($page, $count)->get(); - } - } - - /** - * Get an array with the values of a given column. - * - * @param string $column - * @param string $key - * @return array - */ - public function lists($column, $key = null) - { - $columns = $this->getListSelect($column, $key); - - $results = new Collection($this->get($columns)); - - return $results->lists($columns[0], array_get($columns, 1)); - } - - /** - * Get the columns that should be used in a list array. - * - * @param string $column - * @param string $key - * @return array - */ - protected function getListSelect($column, $key) - { - $select = is_null($key) ? array($column) : array($column, $key); - - // If the selected column contains a "dot", we will remove it so that the list - // operation can run normally. Specifying the table is not needed, since we - // really want the names of the columns as it is in this resulting array. - return array_map(function($column) - { - $dot = strpos($column, '.'); - - return $dot === false ? $column : substr($column, $dot + 1); - }, $select); - } - - /** - * Concatenate values of a given column as a string. - * - * @param string $column - * @param string $glue - * @return string - */ - public function implode($column, $glue = null) - { - if (is_null($glue)) return implode($this->lists($column)); - - return implode($glue, $this->lists($column)); - } - - /** - * Determine if any rows exist for the current query. - * - * @return bool - */ - public function exists() - { - $limit = $this->limit; - - $result = $this->limit(1)->count() > 0; - - $this->limit($limit); - - return $result; - } - - /** - * Retrieve the "count" result of the query. - * - * @param string $columns - * @return int - */ - public function count($columns = '*') - { - if ( ! is_array($columns)) - { - $columns = array($columns); - } - - return (int) $this->aggregate(__FUNCTION__, $columns); - } - - /** - * Retrieve the minimum value of a given column. - * - * @param string $column - * @return float|int - */ - public function min($column) - { - return $this->aggregate(__FUNCTION__, array($column)); - } - - /** - * Retrieve the maximum value of a given column. - * - * @param string $column - * @return float|int - */ - public function max($column) - { - return $this->aggregate(__FUNCTION__, array($column)); - } - - /** - * Retrieve the sum of the values of a given column. - * - * @param string $column - * @return float|int - */ - public function sum($column) - { - $result = $this->aggregate(__FUNCTION__, array($column)); - - return $result ?: 0; - } - - /** - * Retrieve the average of the values of a given column. - * - * @param string $column - * @return float|int - */ - public function avg($column) - { - return $this->aggregate(__FUNCTION__, array($column)); - } - - /** - * Execute an aggregate function on the database. - * - * @param string $function - * @param array $columns - * @return float|int - */ - public function aggregate($function, $columns = array('*')) - { - $this->aggregate = compact('function', 'columns'); - - $previousColumns = $this->columns; - - $results = $this->get($columns); - - // Once we have executed the query, we will reset the aggregate property so - // that more select queries can be executed against the database without - // the aggregate value getting in the way when the grammar builds it. - $this->aggregate = null; - - $this->columns = $previousColumns; - - if (isset($results[0])) - { - $result = array_change_key_case((array) $results[0]); - - return $result['aggregate']; - } - } - - /** - * Insert a new record into the database. - * - * @param array $values - * @return bool - */ - public function insert(array $values) - { - if (empty($values)) return true; - - // Since every insert gets treated like a batch insert, we will make sure the - // bindings are structured in a way that is convenient for building these - // inserts statements by verifying the elements are actually an array. - if ( ! is_array(reset($values))) - { - $values = array($values); - } - - // Since every insert gets treated like a batch insert, we will make sure the - // bindings are structured in a way that is convenient for building these - // inserts statements by verifying the elements are actually an array. - else - { - foreach ($values as $key => $value) - { - ksort($value); $values[$key] = $value; - } - } - - // We'll treat every insert like a batch insert so we can easily insert each - // of the records into the database consistently. This will make it much - // easier on the grammars to just handle one type of record insertion. - $bindings = array(); - - foreach ($values as $record) - { - foreach ($record as $value) - { - $bindings[] = $value; - } - } - - $sql = $this->grammar->compileInsert($this, $values); - - // Once we have compiled the insert statement's SQL we can execute it on the - // connection and return a result as a boolean success indicator as that - // is the same type of result returned by the raw connection instance. - $bindings = $this->cleanBindings($bindings); - - return $this->connection->insert($sql, $bindings); - } - - /** - * Insert a new record and get the value of the primary key. - * - * @param array $values - * @param string $sequence - * @return int - */ - public function insertGetId(array $values, $sequence = null) - { - $sql = $this->grammar->compileInsertGetId($this, $values, $sequence); - - $values = $this->cleanBindings($values); - - return $this->processor->processInsertGetId($this, $sql, $values, $sequence); - } - - /** - * Update a record in the database. - * - * @param array $values - * @return int - */ - public function update(array $values) - { - $bindings = array_values(array_merge($values, $this->getBindings())); - - $sql = $this->grammar->compileUpdate($this, $values); - - return $this->connection->update($sql, $this->cleanBindings($bindings)); - } - - /** - * Increment a column's value by a given amount. - * - * @param string $column - * @param int $amount - * @param array $extra - * @return int - */ - public function increment($column, $amount = 1, array $extra = array()) - { - $wrapped = $this->grammar->wrap($column); - - $columns = array_merge(array($column => $this->raw("$wrapped + $amount")), $extra); - - return $this->update($columns); - } - - /** - * Decrement a column's value by a given amount. - * - * @param string $column - * @param int $amount - * @param array $extra - * @return int - */ - public function decrement($column, $amount = 1, array $extra = array()) - { - $wrapped = $this->grammar->wrap($column); - - $columns = array_merge(array($column => $this->raw("$wrapped - $amount")), $extra); - - return $this->update($columns); - } - - /** - * Delete a record from the database. - * - * @param mixed $id - * @return int - */ - public function delete($id = null) - { - // If an ID is passed to the method, we will set the where clause to check - // the ID to allow developers to simply and quickly remove a single row - // from their database without manually specifying the where clauses. - if ( ! is_null($id)) $this->where('id', '=', $id); - - $sql = $this->grammar->compileDelete($this); - - return $this->connection->delete($sql, $this->getBindings()); - } - - /** - * Run a truncate statement on the table. - * - * @return void - */ - public function truncate() - { - foreach ($this->grammar->compileTruncate($this) as $sql => $bindings) - { - $this->connection->statement($sql, $bindings); - } - } - - /** - * Get a new instance of the query builder. - * - * @return \Illuminate\Database\Query\Builder - */ - public function newQuery() - { - return new Builder($this->connection, $this->grammar, $this->processor); - } - - /** - * Merge an array of where clauses and bindings. - * - * @param array $wheres - * @param array $bindings - * @return void - */ - public function mergeWheres($wheres, $bindings) - { - $this->wheres = array_merge((array) $this->wheres, (array) $wheres); - - $this->bindings['where'] = array_values(array_merge($this->bindings['where'], (array) $bindings)); - } - - /** - * Remove all of the expressions from a list of bindings. - * - * @param array $bindings - * @return array - */ - protected function cleanBindings(array $bindings) - { - return array_values(array_filter($bindings, function($binding) - { - return ! $binding instanceof Expression; - })); - } - - /** - * Create a raw database expression. - * - * @param mixed $value - * @return \Illuminate\Database\Query\Expression - */ - public function raw($value) - { - return $this->connection->raw($value); - } - - /** - * Get the current query value bindings in a flattened array. - * - * @return array - */ - public function getBindings() - { - return array_flatten($this->bindings); - } - - /** - * Get the raw array of bindings. - * - * @return array - */ - public function getRawBindings() - { - return $this->bindings; - } - - /** - * Set the bindings on the query builder. - * - * @param array $bindings - * @param string $type - * @return $this - * - * @throws \InvalidArgumentException - */ - public function setBindings(array $bindings, $type = 'where') - { - if ( ! array_key_exists($type, $this->bindings)) - { - throw new InvalidArgumentException("Invalid binding type: {$type}."); - } - - $this->bindings[$type] = $bindings; - - return $this; - } - - /** - * Add a binding to the query. - * - * @param mixed $value - * @param string $type - * @return $this - * - * @throws \InvalidArgumentException - */ - public function addBinding($value, $type = 'where') - { - if ( ! array_key_exists($type, $this->bindings)) - { - throw new InvalidArgumentException("Invalid binding type: {$type}."); - } - - if (is_array($value)) - { - $this->bindings[$type] = array_values(array_merge($this->bindings[$type], $value)); - } - else - { - $this->bindings[$type][] = $value; - } - - return $this; - } - - /** - * Merge an array of bindings into our bindings. - * - * @param \Illuminate\Database\Query\Builder $query - * @return $this - */ - public function mergeBindings(Builder $query) - { - $this->bindings = array_merge_recursive($this->bindings, $query->bindings); - - return $this; - } - - /** - * Get the database connection instance. - * - * @return \Illuminate\Database\ConnectionInterface - */ - public function getConnection() - { - return $this->connection; - } - - /** - * Get the database query processor instance. - * - * @return \Illuminate\Database\Query\Processors\Processor - */ - public function getProcessor() - { - return $this->processor; - } - - /** - * Get the query grammar instance. - * - * @return \Illuminate\Database\Grammar - */ - public function getGrammar() - { - return $this->grammar; - } - - /** - * Use the write pdo for query. - * - * @return $this - */ - public function useWritePdo() - { - $this->useWritePdo = true; - - return $this; - } - - /** - * Handle dynamic method calls into the method. - * - * @param string $method - * @param array $parameters - * @return mixed - * - * @throws \BadMethodCallException - */ - public function __call($method, $parameters) - { - if (starts_with($method, 'where')) - { - return $this->dynamicWhere($method, $parameters); - } - - $className = get_class($this); - - throw new BadMethodCallException("Call to undefined method {$className}::{$method}()"); - } - + { + $this->grammar = $grammar; + $this->processor = $processor; + $this->connection = $connection; + } + + /** + * Set the columns to be selected. + * + * @param array|mixed $columns + * @return $this + */ + public function select($columns = ['*']) + { + $this->columns = is_array($columns) ? $columns : func_get_args(); + + return $this; + } + + /** + * Add a new "raw" select expression to the query. + * + * @param string $expression + * @param array $bindings + * @return \Illuminate\Database\Query\Builder|static + */ + public function selectRaw($expression, array $bindings = []) + { + $this->addSelect(new Expression($expression)); + + if ($bindings) { + $this->addBinding($bindings, 'select'); + } + + return $this; + } + + /** + * Add a subselect expression to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @return \Illuminate\Database\Query\Builder|static + */ + public function selectSub($query, $as) + { + if ($query instanceof Closure) { + $callback = $query; + + $callback($query = $this->newQuery()); + } + + if ($query instanceof self) { + $bindings = $query->getBindings(); + + $query = $query->toSql(); + } elseif (is_string($query)) { + $bindings = []; + } else { + throw new InvalidArgumentException; + } + + return $this->selectRaw('('.$query.') as '.$this->grammar->wrap($as), $bindings); + } + + /** + * Add a new select column to the query. + * + * @param array|mixed $column + * @return $this + */ + public function addSelect($column) + { + $column = is_array($column) ? $column : func_get_args(); + + $this->columns = array_merge((array) $this->columns, $column); + + return $this; + } + + /** + * Force the query to only return distinct results. + * + * @return $this + */ + public function distinct() + { + $this->distinct = true; + + return $this; + } + + /** + * Set the table which the query is targeting. + * + * @param string $table + * @return $this + */ + public function from($table) + { + $this->from = $table; + + return $this; + } + + /** + * Add a join clause to the query. + * + * @param string $table + * @param string $one + * @param string $operator + * @param string $two + * @param string $type + * @param bool $where + * @return $this + */ + public function join($table, $one, $operator = null, $two = null, $type = 'inner', $where = false) + { + // If the first "column" of the join is really a Closure instance the developer + // is trying to build a join with a complex "on" clause containing more than + // one condition, so we'll add the join and call a Closure with the query. + if ($one instanceof Closure) { + $join = new JoinClause($type, $table); + + call_user_func($one, $join); + + $this->joins[] = $join; + + $this->addBinding($join->bindings, 'join'); + } + + // If the column is simply a string, we can assume the join simply has a basic + // "on" clause with a single condition. So we will just build the join with + // this simple join clauses attached to it. There is not a join callback. + else { + $join = new JoinClause($type, $table); + + $this->joins[] = $join->on( + $one, $operator, $two, 'and', $where + ); + + $this->addBinding($join->bindings, 'join'); + } + + return $this; + } + + /** + * Add a "join where" clause to the query. + * + * @param string $table + * @param string $one + * @param string $operator + * @param string $two + * @param string $type + * @return \Illuminate\Database\Query\Builder|static + */ + public function joinWhere($table, $one, $operator, $two, $type = 'inner') + { + return $this->join($table, $one, $operator, $two, $type, true); + } + + /** + * Add a left join to the query. + * + * @param string $table + * @param string $first + * @param string $operator + * @param string $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function leftJoin($table, $first, $operator = null, $second = null) + { + return $this->join($table, $first, $operator, $second, 'left'); + } + + /** + * Add a "join where" clause to the query. + * + * @param string $table + * @param string $one + * @param string $operator + * @param string $two + * @return \Illuminate\Database\Query\Builder|static + */ + public function leftJoinWhere($table, $one, $operator, $two) + { + return $this->joinWhere($table, $one, $operator, $two, 'left'); + } + + /** + * Add a right join to the query. + * + * @param string $table + * @param string $first + * @param string $operator + * @param string $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function rightJoin($table, $first, $operator = null, $second = null) + { + return $this->join($table, $first, $operator, $second, 'right'); + } + + /** + * Add a "right join where" clause to the query. + * + * @param string $table + * @param string $one + * @param string $operator + * @param string $two + * @return \Illuminate\Database\Query\Builder|static + */ + public function rightJoinWhere($table, $one, $operator, $two) + { + return $this->joinWhere($table, $one, $operator, $two, 'right'); + } + + /** + * Add a basic where clause to the query. + * + * @param string|array|\Closure $column + * @param string $operator + * @param mixed $value + * @param string $boolean + * @return $this + * + * @throws \InvalidArgumentException + */ + public function where($column, $operator = null, $value = null, $boolean = 'and') + { + // If the column is an array, we will assume it is an array of key-value pairs + // and can add them each as a where clause. We will maintain the boolean we + // received when the method was called and pass it into the nested where. + if (is_array($column)) { + return $this->whereNested(function ($query) use ($column) { + foreach ($column as $key => $value) { + $query->where($key, '=', $value); + } + }, $boolean); + } + + // Here we will make some assumptions about the operator. If only 2 values are + // passed to the method, we will assume that the operator is an equals sign + // and keep going. Otherwise, we'll require the operator to be passed in. + if (func_num_args() == 2) { + list($value, $operator) = [$operator, '=']; + } elseif ($this->invalidOperatorAndValue($operator, $value)) { + throw new InvalidArgumentException('Illegal operator and value combination.'); + } + + // If the columns is actually a Closure instance, we will assume the developer + // wants to begin a nested where statement which is wrapped in parenthesis. + // We'll add that Closure to the query then return back out immediately. + if ($column instanceof Closure) { + return $this->whereNested($column, $boolean); + } + + // If the given operator is not found in the list of valid operators we will + // assume that the developer is just short-cutting the '=' operators and + // we will set the operators to '=' and set the values appropriately. + if (! in_array(strtolower($operator), $this->operators, true)) { + list($value, $operator) = [$operator, '=']; + } + + // If the value is a Closure, it means the developer is performing an entire + // sub-select within the query and we will need to compile the sub-select + // within the where clause to get the appropriate query record results. + if ($value instanceof Closure) { + return $this->whereSub($column, $operator, $value, $boolean); + } + + // If the value is "null", we will just assume the developer wants to add a + // where null clause to the query. So, we will allow a short-cut here to + // that method for convenience so the developer doesn't have to check. + if (is_null($value)) { + return $this->whereNull($column, $boolean, $operator != '='); + } + + // Now that we are working with just a simple query we can put the elements + // in our array and add the query binding to our array of bindings that + // will be bound to each SQL statements when it is finally executed. + $type = 'Basic'; + + $this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean'); + + if (! $value instanceof Expression) { + $this->addBinding($value, 'where'); + } + + return $this; + } + + /** + * Add an "or where" clause to the query. + * + * @param string $column + * @param string $operator + * @param mixed $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhere($column, $operator = null, $value = null) + { + return $this->where($column, $operator, $value, 'or'); + } + + /** + * Determine if the given operator and value combination is legal. + * + * @param string $operator + * @param mixed $value + * @return bool + */ + protected function invalidOperatorAndValue($operator, $value) + { + $isOperator = in_array($operator, $this->operators); + + return $isOperator && $operator != '=' && is_null($value); + } + + /** + * Add a raw where clause to the query. + * + * @param string $sql + * @param array $bindings + * @param string $boolean + * @return $this + */ + public function whereRaw($sql, array $bindings = [], $boolean = 'and') + { + $type = 'raw'; + + $this->wheres[] = compact('type', 'sql', 'boolean'); + + $this->addBinding($bindings, 'where'); + + return $this; + } + + /** + * Add a raw or where clause to the query. + * + * @param string $sql + * @param array $bindings + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereRaw($sql, array $bindings = []) + { + return $this->whereRaw($sql, $bindings, 'or'); + } + + /** + * Add a where between statement to the query. + * + * @param string $column + * @param array $values + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereBetween($column, array $values, $boolean = 'and', $not = false) + { + $type = 'between'; + + $this->wheres[] = compact('column', 'type', 'boolean', 'not'); + + $this->addBinding($values, 'where'); + + return $this; + } + + /** + * Add an or where between statement to the query. + * + * @param string $column + * @param array $values + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereBetween($column, array $values) + { + return $this->whereBetween($column, $values, 'or'); + } + + /** + * Add a where not between statement to the query. + * + * @param string $column + * @param array $values + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNotBetween($column, array $values, $boolean = 'and') + { + return $this->whereBetween($column, $values, $boolean, true); + } + + /** + * Add an or where not between statement to the query. + * + * @param string $column + * @param array $values + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNotBetween($column, array $values) + { + return $this->whereNotBetween($column, $values, 'or'); + } + + /** + * Add a nested where statement to the query. + * + * @param \Closure $callback + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNested(Closure $callback, $boolean = 'and') + { + // To handle nested queries we'll actually create a brand new query instance + // and pass it off to the Closure that we have. The Closure can simply do + // do whatever it wants to a query then we will store it for compiling. + $query = $this->newQuery(); + + $query->from($this->from); + + call_user_func($callback, $query); + + return $this->addNestedWhereQuery($query, $boolean); + } + + /** + * Add another query builder as a nested where to the query builder. + * + * @param \Illuminate\Database\Query\Builder|static $query + * @param string $boolean + * @return $this + */ + public function addNestedWhereQuery($query, $boolean = 'and') + { + if (count($query->wheres)) { + $type = 'Nested'; + + $this->wheres[] = compact('type', 'query', 'boolean'); + + $this->addBinding($query->getBindings(), 'where'); + } + + return $this; + } + + /** + * Add a full sub-select to the query. + * + * @param string $column + * @param string $operator + * @param \Closure $callback + * @param string $boolean + * @return $this + */ + protected function whereSub($column, $operator, Closure $callback, $boolean) + { + $type = 'Sub'; + + $query = $this->newQuery(); + + // Once we have the query instance we can simply execute it so it can add all + // of the sub-select's conditions to itself, and then we can cache it off + // in the array of where clauses for the "main" parent query instance. + call_user_func($callback, $query); + + $this->wheres[] = compact('type', 'column', 'operator', 'query', 'boolean'); + + $this->addBinding($query->getBindings(), 'where'); + + return $this; + } + + /** + * Add an exists clause to the query. + * + * @param \Closure $callback + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereExists(Closure $callback, $boolean = 'and', $not = false) + { + $type = $not ? 'NotExists' : 'Exists'; + + $query = $this->newQuery(); + + // Similar to the sub-select clause, we will create a new query instance so + // the developer may cleanly specify the entire exists query and we will + // compile the whole thing in the grammar and insert it into the SQL. + call_user_func($callback, $query); + + $this->wheres[] = compact('type', 'operator', 'query', 'boolean'); + + $this->addBinding($query->getBindings(), 'where'); + + return $this; + } + + /** + * Add an or exists clause to the query. + * + * @param \Closure $callback + * @param bool $not + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereExists(Closure $callback, $not = false) + { + return $this->whereExists($callback, 'or', $not); + } + + /** + * Add a where not exists clause to the query. + * + * @param \Closure $callback + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNotExists(Closure $callback, $boolean = 'and') + { + return $this->whereExists($callback, $boolean, true); + } + + /** + * Add a where not exists clause to the query. + * + * @param \Closure $callback + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNotExists(Closure $callback) + { + return $this->orWhereExists($callback, true); + } + + /** + * Add a "where in" clause to the query. + * + * @param string $column + * @param mixed $values + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereIn($column, $values, $boolean = 'and', $not = false) + { + $type = $not ? 'NotIn' : 'In'; + + if ($values instanceof static) { + return $this->whereInExistingQuery( + $column, $values, $boolean, $not + ); + } + + // If the value of the where in clause is actually a Closure, we will assume that + // the developer is using a full sub-select for this "in" statement, and will + // execute those Closures, then we can re-construct the entire sub-selects. + if ($values instanceof Closure) { + return $this->whereInSub($column, $values, $boolean, $not); + } + + if ($values instanceof Arrayable) { + $values = $values->toArray(); + } + + $this->wheres[] = compact('type', 'column', 'values', 'boolean'); + + $this->addBinding($values, 'where'); + + return $this; + } + + /** + * Add an "or where in" clause to the query. + * + * @param string $column + * @param mixed $values + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereIn($column, $values) + { + return $this->whereIn($column, $values, 'or'); + } + + /** + * Add a "where not in" clause to the query. + * + * @param string $column + * @param mixed $values + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNotIn($column, $values, $boolean = 'and') + { + return $this->whereIn($column, $values, $boolean, true); + } + + /** + * Add an "or where not in" clause to the query. + * + * @param string $column + * @param mixed $values + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNotIn($column, $values) + { + return $this->whereNotIn($column, $values, 'or'); + } + + /** + * Add a where in with a sub-select to the query. + * + * @param string $column + * @param \Closure $callback + * @param string $boolean + * @param bool $not + * @return $this + */ + protected function whereInSub($column, Closure $callback, $boolean, $not) + { + $type = $not ? 'NotInSub' : 'InSub'; + + // To create the exists sub-select, we will actually create a query and call the + // provided callback with the query so the developer may set any of the query + // conditions they want for the in clause, then we'll put it in this array. + call_user_func($callback, $query = $this->newQuery()); + + $this->wheres[] = compact('type', 'column', 'query', 'boolean'); + + $this->addBinding($query->getBindings(), 'where'); + + return $this; + } + + /** + * Add a external sub-select to the query. + * + * @param string $column + * @param \Illuminate\Database\Query\Builder|static $query + * @param string $boolean + * @param bool $not + * @return $this + */ + protected function whereInExistingQuery($column, $query, $boolean, $not) + { + $type = $not ? 'NotInSub' : 'InSub'; + + $this->wheres[] = compact('type', 'column', 'query', 'boolean'); + + $this->addBinding($query->getBindings(), 'where'); + + return $this; + } + + /** + * Add a "where null" clause to the query. + * + * @param string $column + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereNull($column, $boolean = 'and', $not = false) + { + $type = $not ? 'NotNull' : 'Null'; + + $this->wheres[] = compact('type', 'column', 'boolean'); + + return $this; + } + + /** + * Add an "or where null" clause to the query. + * + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNull($column) + { + return $this->whereNull($column, 'or'); + } + + /** + * Add a "where not null" clause to the query. + * + * @param string $column + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNotNull($column, $boolean = 'and') + { + return $this->whereNull($column, $boolean, true); + } + + /** + * Add an "or where not null" clause to the query. + * + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNotNull($column) + { + return $this->whereNotNull($column, 'or'); + } + + /** + * Add a "where date" statement to the query. + * + * @param string $column + * @param string $operator + * @param int $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereDate($column, $operator, $value, $boolean = 'and') + { + return $this->addDateBasedWhere('Date', $column, $operator, $value, $boolean); + } + + /** + * Add a "where day" statement to the query. + * + * @param string $column + * @param string $operator + * @param int $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereDay($column, $operator, $value, $boolean = 'and') + { + return $this->addDateBasedWhere('Day', $column, $operator, $value, $boolean); + } + + /** + * Add a "where month" statement to the query. + * + * @param string $column + * @param string $operator + * @param int $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereMonth($column, $operator, $value, $boolean = 'and') + { + return $this->addDateBasedWhere('Month', $column, $operator, $value, $boolean); + } + + /** + * Add a "where year" statement to the query. + * + * @param string $column + * @param string $operator + * @param int $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereYear($column, $operator, $value, $boolean = 'and') + { + return $this->addDateBasedWhere('Year', $column, $operator, $value, $boolean); + } + + /** + * Add a date based (year, month, day) statement to the query. + * + * @param string $type + * @param string $column + * @param string $operator + * @param int $value + * @param string $boolean + * @return $this + */ + protected function addDateBasedWhere($type, $column, $operator, $value, $boolean = 'and') + { + $this->wheres[] = compact('column', 'type', 'boolean', 'operator', 'value'); + + $this->addBinding($value, 'where'); + + return $this; + } + + /** + * Handles dynamic "where" clauses to the query. + * + * @param string $method + * @param string $parameters + * @return $this + */ + public function dynamicWhere($method, $parameters) + { + $finder = substr($method, 5); + + $segments = preg_split('/(And|Or)(?=[A-Z])/', $finder, -1, PREG_SPLIT_DELIM_CAPTURE); + + // The connector variable will determine which connector will be used for the + // query condition. We will change it as we come across new boolean values + // in the dynamic method strings, which could contain a number of these. + $connector = 'and'; + + $index = 0; + + foreach ($segments as $segment) { + // If the segment is not a boolean connector, we can assume it is a column's name + // and we will add it to the query as a new constraint as a where clause, then + // we can keep iterating through the dynamic method string's segments again. + if ($segment != 'And' && $segment != 'Or') { + $this->addDynamic($segment, $connector, $parameters, $index); + + $index++; + } + + // Otherwise, we will store the connector so we know how the next where clause we + // find in the query should be connected to the previous ones, meaning we will + // have the proper boolean connector to connect the next where clause found. + else { + $connector = $segment; + } + } + + return $this; + } + + /** + * Add a single dynamic where clause statement to the query. + * + * @param string $segment + * @param string $connector + * @param array $parameters + * @param int $index + * @return void + */ + protected function addDynamic($segment, $connector, $parameters, $index) + { + // Once we have parsed out the columns and formatted the boolean operators we + // are ready to add it to this query as a where clause just like any other + // clause on the query. Then we'll increment the parameter index values. + $bool = strtolower($connector); + + $this->where(Str::snake($segment), '=', $parameters[$index], $bool); + } + + /** + * Add a "group by" clause to the query. + * + * @param array|string $column,... + * @return $this + */ + public function groupBy() + { + foreach (func_get_args() as $arg) { + $this->groups = array_merge((array) $this->groups, is_array($arg) ? $arg : [$arg]); + } + + return $this; + } + + /** + * Add a "having" clause to the query. + * + * @param string $column + * @param string $operator + * @param string $value + * @param string $boolean + * @return $this + */ + public function having($column, $operator = null, $value = null, $boolean = 'and') + { + $type = 'basic'; + + $this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean'); + + if (! $value instanceof Expression) { + $this->addBinding($value, 'having'); + } + + return $this; + } + + /** + * Add a "or having" clause to the query. + * + * @param string $column + * @param string $operator + * @param string $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orHaving($column, $operator = null, $value = null) + { + return $this->having($column, $operator, $value, 'or'); + } + + /** + * Add a raw having clause to the query. + * + * @param string $sql + * @param array $bindings + * @param string $boolean + * @return $this + */ + public function havingRaw($sql, array $bindings = [], $boolean = 'and') + { + $type = 'raw'; + + $this->havings[] = compact('type', 'sql', 'boolean'); + + $this->addBinding($bindings, 'having'); + + return $this; + } + + /** + * Add a raw or having clause to the query. + * + * @param string $sql + * @param array $bindings + * @return \Illuminate\Database\Query\Builder|static + */ + public function orHavingRaw($sql, array $bindings = []) + { + return $this->havingRaw($sql, $bindings, 'or'); + } + + /** + * Add an "order by" clause to the query. + * + * @param string $column + * @param string $direction + * @return $this + */ + public function orderBy($column, $direction = 'asc') + { + $property = $this->unions ? 'unionOrders' : 'orders'; + $direction = strtolower($direction) == 'asc' ? 'asc' : 'desc'; + + $this->{$property}[] = compact('column', 'direction'); + + return $this; + } + + /** + * Add an "order by" clause for a timestamp to the query. + * + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function latest($column = 'created_at') + { + return $this->orderBy($column, 'desc'); + } + + /** + * Add an "order by" clause for a timestamp to the query. + * + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function oldest($column = 'created_at') + { + return $this->orderBy($column, 'asc'); + } + + /** + * Add a raw "order by" clause to the query. + * + * @param string $sql + * @param array $bindings + * @return $this + */ + public function orderByRaw($sql, $bindings = []) + { + $property = $this->unions ? 'unionOrders' : 'orders'; + + $type = 'raw'; + + $this->{$property}[] = compact('type', 'sql'); + + $this->addBinding($bindings, 'order'); + + return $this; + } + + /** + * Set the "offset" value of the query. + * + * @param int $value + * @return $this + */ + public function offset($value) + { + $property = $this->unions ? 'unionOffset' : 'offset'; + + $this->$property = max(0, $value); + + return $this; + } + + /** + * Alias to set the "offset" value of the query. + * + * @param int $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function skip($value) + { + return $this->offset($value); + } + + /** + * Set the "limit" value of the query. + * + * @param int $value + * @return $this + */ + public function limit($value) + { + $property = $this->unions ? 'unionLimit' : 'limit'; + + if ($value >= 0) { + $this->$property = $value; + } + + return $this; + } + + /** + * Alias to set the "limit" value of the query. + * + * @param int $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function take($value) + { + return $this->limit($value); + } + + /** + * Set the limit and offset for a given page. + * + * @param int $page + * @param int $perPage + * @return \Illuminate\Database\Query\Builder|static + */ + public function forPage($page, $perPage = 15) + { + return $this->skip(($page - 1) * $perPage)->take($perPage); + } + + /** + * Add a union statement to the query. + * + * @param \Illuminate\Database\Query\Builder|\Closure $query + * @param bool $all + * @return \Illuminate\Database\Query\Builder|static + */ + public function union($query, $all = false) + { + if ($query instanceof Closure) { + call_user_func($query, $query = $this->newQuery()); + } + + $this->unions[] = compact('query', 'all'); + + $this->addBinding($query->getBindings(), 'union'); + + return $this; + } + + /** + * Add a union all statement to the query. + * + * @param \Illuminate\Database\Query\Builder|\Closure $query + * @return \Illuminate\Database\Query\Builder|static + */ + public function unionAll($query) + { + return $this->union($query, true); + } + + /** + * Lock the selected rows in the table. + * + * @param bool $value + * @return $this + */ + public function lock($value = true) + { + $this->lock = $value; + + if ($this->lock) { + $this->useWritePdo(); + } + + return $this; + } + + /** + * Lock the selected rows in the table for updating. + * + * @return \Illuminate\Database\Query\Builder + */ + public function lockForUpdate() + { + return $this->lock(true); + } + + /** + * Share lock the selected rows in the table. + * + * @return \Illuminate\Database\Query\Builder + */ + public function sharedLock() + { + return $this->lock(false); + } + + /** + * Get the SQL representation of the query. + * + * @return string + */ + public function toSql() + { + return $this->grammar->compileSelect($this); + } + + /** + * Execute a query for a single record by ID. + * + * @param int $id + * @param array $columns + * @return mixed|static + */ + public function find($id, $columns = ['*']) + { + return $this->where('id', '=', $id)->first($columns); + } + + /** + * Get a single column's value from the first result of a query. + * + * @param string $column + * @return mixed + */ + public function value($column) + { + $result = (array) $this->first([$column]); + + return count($result) > 0 ? reset($result) : null; + } + + /** + * Get a single column's value from the first result of a query. + * + * This is an alias for the "value" method. + * + * @param string $column + * @return mixed + * + * @deprecated since version 5.1. + */ + public function pluck($column) + { + return $this->value($column); + } + + /** + * Execute the query and get the first result. + * + * @param array $columns + * @return mixed|static + */ + public function first($columns = ['*']) + { + $results = $this->take(1)->get($columns); + + return count($results) > 0 ? reset($results) : null; + } + + /** + * Execute the query as a "select" statement. + * + * @param array $columns + * @return array|static[] + */ + public function get($columns = ['*']) + { + if (is_null($this->columns)) { + $this->columns = $columns; + } + + return $this->processor->processSelect($this, $this->runSelect()); + } + + /** + * Execute the query as a fresh "select" statement. + * + * @param array $columns + * @return array|static[] + * + * @deprecated since version 5.1. Use get instead. + */ + public function getFresh($columns = ['*']) + { + return $this->get($columns); + } + + /** + * Run the query as a "select" statement against the connection. + * + * @return array + */ + protected function runSelect() + { + return $this->connection->select($this->toSql(), $this->getBindings(), ! $this->useWritePdo); + } + + /** + * Paginate the given query into a simple paginator. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + */ + public function paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null) + { + $page = $page ?: Paginator::resolveCurrentPage($pageName); + + $total = $this->getCountForPagination($columns); + + $results = $this->forPage($page, $perPage)->get($columns); + + return new LengthAwarePaginator($results, $total, $perPage, $page, [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ]); + } + + /** + * Get a paginator only supporting simple next and previous links. + * + * This is more efficient on larger data-sets, etc. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @return \Illuminate\Contracts\Pagination\Paginator + */ + public function simplePaginate($perPage = 15, $columns = ['*'], $pageName = 'page') + { + $page = Paginator::resolveCurrentPage($pageName); + + $this->skip(($page - 1) * $perPage)->take($perPage + 1); + + return new Paginator($this->get($columns), $perPage, $page, [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ]); + } + + /** + * Get the count of the total records for the paginator. + * + * @param array $columns + * @return int + */ + public function getCountForPagination($columns = ['*']) + { + $this->backupFieldsForCount(); + + $this->aggregate = ['function' => 'count', 'columns' => $this->clearSelectAliases($columns)]; + + $results = $this->get(); + + $this->aggregate = null; + + $this->restoreFieldsForCount(); + + if (isset($this->groups)) { + return count($results); + } + + return isset($results[0]) ? (int) array_change_key_case((array) $results[0])['aggregate'] : 0; + } + + /** + * Backup some fields for the pagination count. + * + * @return void + */ + protected function backupFieldsForCount() + { + foreach (['orders', 'limit', 'offset', 'columns'] as $field) { + $this->backups[$field] = $this->{$field}; + + $this->{$field} = null; + } + + foreach (['order', 'select'] as $key) { + $this->bindingBackups[$key] = $this->bindings[$key]; + + $this->bindings[$key] = []; + } + } + + /** + * Remove the column aliases since they will break count queries. + * + * @param array $columns + * @return array + */ + protected function clearSelectAliases(array $columns) + { + return array_map(function ($column) { + return is_string($column) && ($aliasPosition = strpos(strtolower($column), ' as ')) !== false + ? substr($column, 0, $aliasPosition) : $column; + }, $columns); + } + + /** + * Restore some fields after the pagination count. + * + * @return void + */ + protected function restoreFieldsForCount() + { + foreach (['orders', 'limit', 'offset', 'columns'] as $field) { + $this->{$field} = $this->backups[$field]; + } + + foreach (['order', 'select'] as $key) { + $this->bindings[$key] = $this->bindingBackups[$key]; + } + + $this->backups = []; + $this->bindingBackups = []; + } + + /** + * Chunk the results of the query. + * + * @param int $count + * @param callable $callback + * @return bool + */ + public function chunk($count, callable $callback) + { + $results = $this->forPage($page = 1, $count)->get(); + + while (count($results) > 0) { + // On each chunk result set, we will pass them to the callback and then let the + // developer take care of everything within the callback, which allows us to + // keep the memory low for spinning through large result sets for working. + if (call_user_func($callback, $results) === false) { + return false; + } + + $page++; + + $results = $this->forPage($page, $count)->get(); + } + + return true; + } + + /** + * Get an array with the values of a given column. + * + * @param string $column + * @param string|null $key + * @return array + */ + public function lists($column, $key = null) + { + $results = $this->get(is_null($key) ? [$column] : [$column, $key]); + + // If the columns are qualified with a table or have an alias, we cannot use + // those directly in the "pluck" operations since the results from the DB + // are only keyed by the column itself. We'll strip the table out here. + return Arr::pluck( + $results, + $this->stripTableForPluck($column), + $this->stripTableForPluck($key) + ); + } + + /** + * Strip off the table name or alias from a column identifier. + * + * @param string $column + * @return string|null + */ + protected function stripTableForPluck($column) + { + return is_null($column) ? $column : last(preg_split('~\.| ~', $column)); + } + + /** + * Concatenate values of a given column as a string. + * + * @param string $column + * @param string $glue + * @return string + */ + public function implode($column, $glue = '') + { + return implode($glue, $this->lists($column)); + } + + /** + * Determine if any rows exist for the current query. + * + * @return bool + */ + public function exists() + { + $sql = $this->grammar->compileExists($this); + + $results = $this->connection->select($sql, $this->getBindings(), ! $this->useWritePdo); + + if (isset($results[0])) { + $results = (array) $results[0]; + + return (bool) $results['exists']; + } + + return false; + } + + /** + * Retrieve the "count" result of the query. + * + * @param string $columns + * @return int + */ + public function count($columns = '*') + { + if (! is_array($columns)) { + $columns = [$columns]; + } + + return (int) $this->aggregate(__FUNCTION__, $columns); + } + + /** + * Retrieve the minimum value of a given column. + * + * @param string $column + * @return mixed + */ + public function min($column) + { + return $this->aggregate(__FUNCTION__, [$column]); + } + + /** + * Retrieve the maximum value of a given column. + * + * @param string $column + * @return mixed + */ + public function max($column) + { + return $this->aggregate(__FUNCTION__, [$column]); + } + + /** + * Retrieve the sum of the values of a given column. + * + * @param string $column + * @return mixed + */ + public function sum($column) + { + return $this->aggregate(__FUNCTION__, [$column]); + } + + /** + * Retrieve the average of the values of a given column. + * + * @param string $column + * @return mixed + */ + public function avg($column) + { + return $this->aggregate(__FUNCTION__, [$column]); + } + + /** + * Alias for the "avg" method. + * + * @param string $column + * @return mixed + */ + public function average($column) + { + return $this->avg($column); + } + + /** + * Execute an aggregate function on the database. + * + * @param string $function + * @param array $columns + * @return mixed + */ + public function aggregate($function, $columns = ['*']) + { + $this->aggregate = compact('function', 'columns'); + + $previousColumns = $this->columns; + + // We will also back up the select bindings since the select clause will be + // removed when performing the aggregate function. Once the query is run + // we will add the bindings back onto this query so they can get used. + $previousSelectBindings = $this->bindings['select']; + + $this->bindings['select'] = []; + + $results = $this->get($columns); + + // Once we have executed the query, we will reset the aggregate property so + // that more select queries can be executed against the database without + // the aggregate value getting in the way when the grammar builds it. + $this->aggregate = null; + + $this->columns = $previousColumns; + + $this->bindings['select'] = $previousSelectBindings; + + if (isset($results[0])) { + return array_change_key_case((array) $results[0])['aggregate']; + } + } + + /** + * Execute a numeric aggregate function on the database. + * + * @param string $function + * @param array $columns + * @return float|int + */ + public function numericAggregate($function, $columns = ['*']) + { + $result = $this->aggregate($function, $columns); + + if (! $result) { + return 0; + } + + if (is_int($result) || is_float($result)) { + return $result; + } + + if (strpos((string) $result, '.') === false) { + return (int) $result; + } + + return (float) $result; + } + + /** + * Insert a new record into the database. + * + * @param array $values + * @return bool + */ + public function insert(array $values) + { + if (empty($values)) { + return true; + } + + // Since every insert gets treated like a batch insert, we will make sure the + // bindings are structured in a way that is convenient for building these + // inserts statements by verifying the elements are actually an array. + if (! is_array(reset($values))) { + $values = [$values]; + } + + // Since every insert gets treated like a batch insert, we will make sure the + // bindings are structured in a way that is convenient for building these + // inserts statements by verifying the elements are actually an array. + else { + foreach ($values as $key => $value) { + ksort($value); + $values[$key] = $value; + } + } + + // We'll treat every insert like a batch insert so we can easily insert each + // of the records into the database consistently. This will make it much + // easier on the grammars to just handle one type of record insertion. + $bindings = []; + + foreach ($values as $record) { + foreach ($record as $value) { + $bindings[] = $value; + } + } + + $sql = $this->grammar->compileInsert($this, $values); + + // Once we have compiled the insert statement's SQL we can execute it on the + // connection and return a result as a boolean success indicator as that + // is the same type of result returned by the raw connection instance. + $bindings = $this->cleanBindings($bindings); + + return $this->connection->insert($sql, $bindings); + } + + /** + * Insert a new record and get the value of the primary key. + * + * @param array $values + * @param string $sequence + * @return int + */ + public function insertGetId(array $values, $sequence = null) + { + $sql = $this->grammar->compileInsertGetId($this, $values, $sequence); + + $values = $this->cleanBindings($values); + + return $this->processor->processInsertGetId($this, $sql, $values, $sequence); + } + + /** + * Update a record in the database. + * + * @param array $values + * @return int + */ + public function update(array $values) + { + $bindings = array_values(array_merge($values, $this->getBindings())); + + $sql = $this->grammar->compileUpdate($this, $values); + + return $this->connection->update($sql, $this->cleanBindings($bindings)); + } + + /** + * Increment a column's value by a given amount. + * + * @param string $column + * @param int $amount + * @param array $extra + * @return int + */ + public function increment($column, $amount = 1, array $extra = []) + { + if (! is_numeric($amount)) { + throw new InvalidArgumentException('Non-numeric value passed to increment method.'); + } + + $wrapped = $this->grammar->wrap($column); + + $columns = array_merge([$column => $this->raw("$wrapped + $amount")], $extra); + + return $this->update($columns); + } + + /** + * Decrement a column's value by a given amount. + * + * @param string $column + * @param int $amount + * @param array $extra + * @return int + */ + public function decrement($column, $amount = 1, array $extra = []) + { + if (! is_numeric($amount)) { + throw new InvalidArgumentException('Non-numeric value passed to decrement method.'); + } + + $wrapped = $this->grammar->wrap($column); + + $columns = array_merge([$column => $this->raw("$wrapped - $amount")], $extra); + + return $this->update($columns); + } + + /** + * Delete a record from the database. + * + * @param mixed $id + * @return int + */ + public function delete($id = null) + { + // If an ID is passed to the method, we will set the where clause to check + // the ID to allow developers to simply and quickly remove a single row + // from their database without manually specifying the where clauses. + if (! is_null($id)) { + $this->where('id', '=', $id); + } + + $sql = $this->grammar->compileDelete($this); + + return $this->connection->delete($sql, $this->getBindings()); + } + + /** + * Run a truncate statement on the table. + * + * @return void + */ + public function truncate() + { + foreach ($this->grammar->compileTruncate($this) as $sql => $bindings) { + $this->connection->statement($sql, $bindings); + } + } + + /** + * Get a new instance of the query builder. + * + * @return \Illuminate\Database\Query\Builder + */ + public function newQuery() + { + return new static($this->connection, $this->grammar, $this->processor); + } + + /** + * Merge an array of where clauses and bindings. + * + * @param array $wheres + * @param array $bindings + * @return void + */ + public function mergeWheres($wheres, $bindings) + { + $this->wheres = array_merge((array) $this->wheres, (array) $wheres); + + $this->bindings['where'] = array_values(array_merge($this->bindings['where'], (array) $bindings)); + } + + /** + * Remove all of the expressions from a list of bindings. + * + * @param array $bindings + * @return array + */ + protected function cleanBindings(array $bindings) + { + return array_values(array_filter($bindings, function ($binding) { + return ! $binding instanceof Expression; + })); + } + + /** + * Create a raw database expression. + * + * @param mixed $value + * @return \Illuminate\Database\Query\Expression + */ + public function raw($value) + { + return $this->connection->raw($value); + } + + /** + * Get the current query value bindings in a flattened array. + * + * @return array + */ + public function getBindings() + { + return Arr::flatten($this->bindings); + } + + /** + * Get the raw array of bindings. + * + * @return array + */ + public function getRawBindings() + { + return $this->bindings; + } + + /** + * Set the bindings on the query builder. + * + * @param array $bindings + * @param string $type + * @return $this + * + * @throws \InvalidArgumentException + */ + public function setBindings(array $bindings, $type = 'where') + { + if (! array_key_exists($type, $this->bindings)) { + throw new InvalidArgumentException("Invalid binding type: {$type}."); + } + + $this->bindings[$type] = $bindings; + + return $this; + } + + /** + * Add a binding to the query. + * + * @param mixed $value + * @param string $type + * @return $this + * + * @throws \InvalidArgumentException + */ + public function addBinding($value, $type = 'where') + { + if (! array_key_exists($type, $this->bindings)) { + throw new InvalidArgumentException("Invalid binding type: {$type}."); + } + + if (is_array($value)) { + $this->bindings[$type] = array_values(array_merge($this->bindings[$type], $value)); + } else { + $this->bindings[$type][] = $value; + } + + return $this; + } + + /** + * Merge an array of bindings into our bindings. + * + * @param \Illuminate\Database\Query\Builder $query + * @return $this + */ + public function mergeBindings(Builder $query) + { + $this->bindings = array_merge_recursive($this->bindings, $query->bindings); + + return $this; + } + + /** + * Get the database connection instance. + * + * @return \Illuminate\Database\ConnectionInterface + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Get the database query processor instance. + * + * @return \Illuminate\Database\Query\Processors\Processor + */ + public function getProcessor() + { + return $this->processor; + } + + /** + * Get the query grammar instance. + * + * @return \Illuminate\Database\Query\Grammars\Grammar + */ + public function getGrammar() + { + return $this->grammar; + } + + /** + * Use the write pdo for query. + * + * @return $this + */ + public function useWritePdo() + { + $this->useWritePdo = true; + + return $this; + } + + /** + * Handle dynamic method calls into the method. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + if (Str::startsWith($method, 'where')) { + return $this->dynamicWhere($method, $parameters); + } + + $className = get_class($this); + + throw new BadMethodCallException("Call to undefined method {$className}::{$method}()"); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Expression.php b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Expression.php index 68d2236..de69029 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Expression.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Expression.php @@ -1,43 +1,44 @@ -value = $value; - } + /** + * Create a new raw query expression. + * + * @param mixed $value + * @return void + */ + public function __construct($value) + { + $this->value = $value; + } - /** - * Get the value of the expression. - * - * @return mixed - */ - public function getValue() - { - return $this->value; - } - - /** - * Get the value of the expression. - * - * @return string - */ - public function __toString() - { - return (string) $this->getValue(); - } + /** + * Get the value of the expression. + * + * @return mixed + */ + public function getValue() + { + return $this->value; + } + /** + * Get the value of the expression. + * + * @return string + */ + public function __toString() + { + return (string) $this->getValue(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php index 36a8c42..5a871ad 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php @@ -1,761 +1,825 @@ -columns)) $query->columns = array('*'); - - return trim($this->concatenate($this->compileComponents($query))); - } - - /** - * Compile the components necessary for a select clause. - * - * @param \Illuminate\Database\Query\Builder - * @return array - */ - protected function compileComponents(Builder $query) - { - $sql = array(); - - foreach ($this->selectComponents as $component) - { - // To compile the query, we'll spin through each component of the query and - // see if that component exists. If it does we'll just call the compiler - // function for the component which is responsible for making the SQL. - if ( ! is_null($query->$component)) - { - $method = 'compile'.ucfirst($component); - - $sql[$component] = $this->$method($query, $query->$component); - } - } - - return $sql; - } - - /** - * Compile an aggregated select clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $aggregate - * @return string - */ - protected function compileAggregate(Builder $query, $aggregate) - { - $column = $this->columnize($aggregate['columns']); - - // If the query has a "distinct" constraint and we're not asking for all columns - // we need to prepend "distinct" onto the column name so that the query takes - // it into account when it performs the aggregating operations on the data. - if ($query->distinct && $column !== '*') - { - $column = 'distinct '.$column; - } - - return 'select '.$aggregate['function'].'('.$column.') as aggregate'; - } - - /** - * Compile the "select *" portion of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $columns - * @return string - */ - protected function compileColumns(Builder $query, $columns) - { - // If the query is actually performing an aggregating select, we will let that - // compiler handle the building of the select clauses, as it will need some - // more syntax that is best handled by that function to keep things neat. - if ( ! is_null($query->aggregate)) return; - - $select = $query->distinct ? 'select distinct ' : 'select '; - - return $select.$this->columnize($columns); - } - - /** - * Compile the "from" portion of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $table - * @return string - */ - protected function compileFrom(Builder $query, $table) - { - return 'from '.$this->wrapTable($table); - } - - /** - * Compile the "join" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $joins - * @return string - */ - protected function compileJoins(Builder $query, $joins) - { - $sql = array(); - - $query->setBindings(array(), 'join'); - - foreach ($joins as $join) - { - $table = $this->wrapTable($join->table); - - // First we need to build all of the "on" clauses for the join. There may be many - // of these clauses so we will need to iterate through each one and build them - // separately, then we'll join them up into a single string when we're done. - $clauses = array(); - - foreach ($join->clauses as $clause) - { - $clauses[] = $this->compileJoinConstraint($clause); - } - - foreach ($join->bindings as $binding) - { - $query->addBinding($binding, 'join'); - } - - // Once we have constructed the clauses, we'll need to take the boolean connector - // off of the first clause as it obviously will not be required on that clause - // because it leads the rest of the clauses, thus not requiring any boolean. - $clauses[0] = $this->removeLeadingBoolean($clauses[0]); - - $clauses = implode(' ', $clauses); - - $type = $join->type; - - // Once we have everything ready to go, we will just concatenate all the parts to - // build the final join statement SQL for the query and we can then return the - // final clause back to the callers as a single, stringified join statement. - $sql[] = "$type join $table on $clauses"; - } - - return implode(' ', $sql); - } - - /** - * Create a join clause constraint segment. - * - * @param array $clause - * @return string - */ - protected function compileJoinConstraint(array $clause) - { - $first = $this->wrap($clause['first']); - - $second = $clause['where'] ? '?' : $this->wrap($clause['second']); - - return "{$clause['boolean']} $first {$clause['operator']} $second"; - } - - /** - * Compile the "where" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileWheres(Builder $query) - { - $sql = array(); - - if (is_null($query->wheres)) return ''; - - // Each type of where clauses has its own compiler function which is responsible - // for actually creating the where clauses SQL. This helps keep the code nice - // and maintainable since each clause has a very small method that it uses. - foreach ($query->wheres as $where) - { - $method = "where{$where['type']}"; - - $sql[] = $where['boolean'].' '.$this->$method($query, $where); - } - - // If we actually have some where clauses, we will strip off the first boolean - // operator, which is added by the query builders for convenience so we can - // avoid checking for the first clauses in each of the compilers methods. - if (count($sql) > 0) - { - $sql = implode(' ', $sql); - - return 'where '.$this->removeLeadingBoolean($sql); - } - - return ''; - } - - /** - * Compile a nested where clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereNested(Builder $query, $where) - { - $nested = $where['query']; - - return '('.substr($this->compileWheres($nested), 6).')'; - } - - /** - * Compile a where condition with a sub-select. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereSub(Builder $query, $where) - { - $select = $this->compileSelect($where['query']); - - return $this->wrap($where['column']).' '.$where['operator']." ($select)"; - } - - /** - * Compile a basic where clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereBasic(Builder $query, $where) - { - $value = $this->parameter($where['value']); - - return $this->wrap($where['column']).' '.$where['operator'].' '.$value; - } - - /** - * Compile a "between" where clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereBetween(Builder $query, $where) - { - $between = $where['not'] ? 'not between' : 'between'; - - return $this->wrap($where['column']).' '.$between.' ? and ?'; - } - - /** - * Compile a where exists clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereExists(Builder $query, $where) - { - return 'exists ('.$this->compileSelect($where['query']).')'; - } - - /** - * Compile a where exists clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereNotExists(Builder $query, $where) - { - return 'not exists ('.$this->compileSelect($where['query']).')'; - } - - /** - * Compile a "where in" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereIn(Builder $query, $where) - { - if (empty($where['values'])) return '0 = 1'; - - $values = $this->parameterize($where['values']); - - return $this->wrap($where['column']).' in ('.$values.')'; - } - - /** - * Compile a "where not in" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereNotIn(Builder $query, $where) - { - if (empty($where['values'])) return '1 = 1'; - - $values = $this->parameterize($where['values']); - - return $this->wrap($where['column']).' not in ('.$values.')'; - } - - /** - * Compile a where in sub-select clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereInSub(Builder $query, $where) - { - $select = $this->compileSelect($where['query']); - - return $this->wrap($where['column']).' in ('.$select.')'; - } - - /** - * Compile a where not in sub-select clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereNotInSub(Builder $query, $where) - { - $select = $this->compileSelect($where['query']); - - return $this->wrap($where['column']).' not in ('.$select.')'; - } - - /** - * Compile a "where null" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereNull(Builder $query, $where) - { - return $this->wrap($where['column']).' is null'; - } - - /** - * Compile a "where not null" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereNotNull(Builder $query, $where) - { - return $this->wrap($where['column']).' is not null'; - } - - /** - * Compile a "where date" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereDate(Builder $query, $where) - { - return $this->dateBasedWhere('date', $query, $where); - } - - /** - * Compile a "where day" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereDay(Builder $query, $where) - { - return $this->dateBasedWhere('day', $query, $where); - } - - /** - * Compile a "where month" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereMonth(Builder $query, $where) - { - return $this->dateBasedWhere('month', $query, $where); - } - - /** - * Compile a "where year" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereYear(Builder $query, $where) - { - return $this->dateBasedWhere('year', $query, $where); - } - - /** - * Compile a date based where clause. - * - * @param string $type - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function dateBasedWhere($type, Builder $query, $where) - { - $value = $this->parameter($where['value']); - - return $type.'('.$this->wrap($where['column']).') '.$where['operator'].' '.$value; - } - - /** - * Compile a raw where clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereRaw(Builder $query, $where) - { - return $where['sql']; - } - - /** - * Compile the "group by" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $groups - * @return string - */ - protected function compileGroups(Builder $query, $groups) - { - return 'group by '.$this->columnize($groups); - } - - /** - * Compile the "having" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $havings - * @return string - */ - protected function compileHavings(Builder $query, $havings) - { - $sql = implode(' ', array_map(array($this, 'compileHaving'), $havings)); - - return 'having '.$this->removeLeadingBoolean($sql); - } - - /** - * Compile a single having clause. - * - * @param array $having - * @return string - */ - protected function compileHaving(array $having) - { - // If the having clause is "raw", we can just return the clause straight away - // without doing any more processing on it. Otherwise, we will compile the - // clause into SQL based on the components that make it up from builder. - if ($having['type'] === 'raw') - { - return $having['boolean'].' '.$having['sql']; - } - - return $this->compileBasicHaving($having); - } - - /** - * Compile a basic having clause. - * - * @param array $having - * @return string - */ - protected function compileBasicHaving($having) - { - $column = $this->wrap($having['column']); - - $parameter = $this->parameter($having['value']); - - return $having['boolean'].' '.$column.' '.$having['operator'].' '.$parameter; - } - - /** - * Compile the "order by" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $orders - * @return string - */ - protected function compileOrders(Builder $query, $orders) - { - return 'order by '.implode(', ', array_map(function($order) - { - if (isset($order['sql'])) return $order['sql']; - - return $this->wrap($order['column']).' '.$order['direction']; - }, $orders)); - } - - /** - * Compile the "limit" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param int $limit - * @return string - */ - protected function compileLimit(Builder $query, $limit) - { - return 'limit '.(int) $limit; - } - - /** - * Compile the "offset" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param int $offset - * @return string - */ - protected function compileOffset(Builder $query, $offset) - { - return 'offset '.(int) $offset; - } - - /** - * Compile the "union" queries attached to the main query. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileUnions(Builder $query) - { - $sql = ''; - - foreach ($query->unions as $union) - { - $sql .= $this->compileUnion($union); - } - - if (isset($query->unionOrders)) - { - $sql .= ' '.$this->compileOrders($query, $query->unionOrders); - } - - if (isset($query->unionLimit)) - { - $sql .= ' '.$this->compileLimit($query, $query->unionLimit); - } - - if (isset($query->unionOffset)) - { - $sql .= ' '.$this->compileOffset($query, $query->unionOffset); - } - - return ltrim($sql); - } - - /** - * Compile a single union statement. - * - * @param array $union - * @return string - */ - protected function compileUnion(array $union) - { - $joiner = $union['all'] ? ' union all ' : ' union '; - - return $joiner.$union['query']->toSql(); - } - - /** - * Compile an insert statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileInsert(Builder $query, array $values) - { - // Essentially we will force every insert to be treated as a batch insert which - // simply makes creating the SQL easier for us since we can utilize the same - // basic routine regardless of an amount of records given to us to insert. - $table = $this->wrapTable($query->from); - - if ( ! is_array(reset($values))) - { - $values = array($values); - } - - $columns = $this->columnize(array_keys(reset($values))); - - // We need to build a list of parameter place-holders of values that are bound - // to the query. Each insert should have the exact same amount of parameter - // bindings so we will loop through the record and parameterize them all. - $parameters = array(); - - foreach($values as $record) - { - $parameters[] = '('.$this->parameterize($record).')'; - } - - $parameters = implode(', ', $parameters); - - return "insert into $table ($columns) values $parameters"; - } - - /** - * Compile an insert and get ID statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @param string $sequence - * @return string - */ - public function compileInsertGetId(Builder $query, $values, $sequence) - { - return $this->compileInsert($query, $values); - } - - /** - * Compile an update statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileUpdate(Builder $query, $values) - { - $table = $this->wrapTable($query->from); - - // Each one of the columns in the update statements needs to be wrapped in the - // keyword identifiers, also a place-holder needs to be created for each of - // the values in the list of bindings so we can make the sets statements. - $columns = array(); - - foreach ($values as $key => $value) - { - $columns[] = $this->wrap($key).' = '.$this->parameter($value); - } - - $columns = implode(', ', $columns); - - // If the query has any "join" clauses, we will setup the joins on the builder - // and compile them so we can attach them to this update, as update queries - // can get join statements to attach to other tables when they're needed. - if (isset($query->joins)) - { - $joins = ' '.$this->compileJoins($query, $query->joins); - } - else - { - $joins = ''; - } - - // Of course, update queries may also be constrained by where clauses so we'll - // need to compile the where clauses and attach it to the query so only the - // intended records are updated by the SQL statements we generate to run. - $where = $this->compileWheres($query); - - return trim("update {$table}{$joins} set $columns $where"); - } - - /** - * Compile a delete statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - public function compileDelete(Builder $query) - { - $table = $this->wrapTable($query->from); - - $where = is_array($query->wheres) ? $this->compileWheres($query) : ''; - - return trim("delete from $table ".$where); - } - - /** - * Compile a truncate table statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return array - */ - public function compileTruncate(Builder $query) - { - return array('truncate '.$this->wrapTable($query->from) => array()); - } - - /** - * Compile the lock into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param bool|string $value - * @return string - */ - protected function compileLock(Builder $query, $value) - { - return is_string($value) ? $value : ''; - } - - /** - * Concatenate an array of segments, removing empties. - * - * @param array $segments - * @return string - */ - protected function concatenate($segments) - { - return implode(' ', array_filter($segments, function($value) - { - return (string) $value !== ''; - })); - } - - /** - * Remove the leading boolean from a statement. - * - * @param string $value - * @return string - */ - protected function removeLeadingBoolean($value) - { - return preg_replace('/and |or /', '', $value, 1); - } - +class Grammar extends BaseGrammar +{ + /** + * The components that make up a select clause. + * + * @var array + */ + protected $selectComponents = [ + 'aggregate', + 'columns', + 'from', + 'joins', + 'wheres', + 'groups', + 'havings', + 'orders', + 'limit', + 'offset', + 'unions', + 'lock', + ]; + + /** + * Compile a select query into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileSelect(Builder $query) + { + if (is_null($query->columns)) { + $query->columns = ['*']; + } + + return trim($this->concatenate($this->compileComponents($query))); + } + + /** + * Compile the components necessary for a select clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + protected function compileComponents(Builder $query) + { + $sql = []; + + foreach ($this->selectComponents as $component) { + // To compile the query, we'll spin through each component of the query and + // see if that component exists. If it does we'll just call the compiler + // function for the component which is responsible for making the SQL. + if (! is_null($query->$component)) { + $method = 'compile'.ucfirst($component); + + $sql[$component] = $this->$method($query, $query->$component); + } + } + + return $sql; + } + + /** + * Compile an aggregated select clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $aggregate + * @return string + */ + protected function compileAggregate(Builder $query, $aggregate) + { + $column = $this->columnize($aggregate['columns']); + + // If the query has a "distinct" constraint and we're not asking for all columns + // we need to prepend "distinct" onto the column name so that the query takes + // it into account when it performs the aggregating operations on the data. + if ($query->distinct && $column !== '*') { + $column = 'distinct '.$column; + } + + return 'select '.$aggregate['function'].'('.$column.') as aggregate'; + } + + /** + * Compile the "select *" portion of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $columns + * @return string|null + */ + protected function compileColumns(Builder $query, $columns) + { + // If the query is actually performing an aggregating select, we will let that + // compiler handle the building of the select clauses, as it will need some + // more syntax that is best handled by that function to keep things neat. + if (! is_null($query->aggregate)) { + return; + } + + $select = $query->distinct ? 'select distinct ' : 'select '; + + return $select.$this->columnize($columns); + } + + /** + * Compile the "from" portion of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @return string + */ + protected function compileFrom(Builder $query, $table) + { + return 'from '.$this->wrapTable($table); + } + + /** + * Compile the "join" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $joins + * @return string + */ + protected function compileJoins(Builder $query, $joins) + { + $sql = []; + + foreach ($joins as $join) { + $table = $this->wrapTable($join->table); + + // First we need to build all of the "on" clauses for the join. There may be many + // of these clauses so we will need to iterate through each one and build them + // separately, then we'll join them up into a single string when we're done. + $clauses = []; + + foreach ($join->clauses as $clause) { + $clauses[] = $this->compileJoinConstraint($clause); + } + + // Once we have constructed the clauses, we'll need to take the boolean connector + // off of the first clause as it obviously will not be required on that clause + // because it leads the rest of the clauses, thus not requiring any boolean. + $clauses[0] = $this->removeLeadingBoolean($clauses[0]); + + $clauses = implode(' ', $clauses); + + $type = $join->type; + + // Once we have everything ready to go, we will just concatenate all the parts to + // build the final join statement SQL for the query and we can then return the + // final clause back to the callers as a single, stringified join statement. + $sql[] = "$type join $table on $clauses"; + } + + return implode(' ', $sql); + } + + /** + * Create a join clause constraint segment. + * + * @param array $clause + * @return string + */ + protected function compileJoinConstraint(array $clause) + { + if ($clause['nested']) { + return $this->compileNestedJoinConstraint($clause); + } + + $first = $this->wrap($clause['first']); + + if ($clause['where']) { + if ($clause['operator'] === 'in' || $clause['operator'] === 'not in') { + $second = '('.implode(', ', array_fill(0, $clause['second'], '?')).')'; + } else { + $second = '?'; + } + } else { + $second = $this->wrap($clause['second']); + } + + return "{$clause['boolean']} $first {$clause['operator']} $second"; + } + + /** + * Create a nested join clause constraint segment. + * + * @param array $clause + * @return string + */ + protected function compileNestedJoinConstraint(array $clause) + { + $clauses = []; + + foreach ($clause['join']->clauses as $nestedClause) { + $clauses[] = $this->compileJoinConstraint($nestedClause); + } + + $clauses[0] = $this->removeLeadingBoolean($clauses[0]); + + $clauses = implode(' ', $clauses); + + return "{$clause['boolean']} ({$clauses})"; + } + + /** + * Compile the "where" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileWheres(Builder $query) + { + $sql = []; + + if (is_null($query->wheres)) { + return ''; + } + + // Each type of where clauses has its own compiler function which is responsible + // for actually creating the where clauses SQL. This helps keep the code nice + // and maintainable since each clause has a very small method that it uses. + foreach ($query->wheres as $where) { + $method = "where{$where['type']}"; + + $sql[] = $where['boolean'].' '.$this->$method($query, $where); + } + + // If we actually have some where clauses, we will strip off the first boolean + // operator, which is added by the query builders for convenience so we can + // avoid checking for the first clauses in each of the compilers methods. + if (count($sql) > 0) { + $sql = implode(' ', $sql); + + return 'where '.$this->removeLeadingBoolean($sql); + } + + return ''; + } + + /** + * Compile a nested where clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNested(Builder $query, $where) + { + $nested = $where['query']; + + return '('.substr($this->compileWheres($nested), 6).')'; + } + + /** + * Compile a where condition with a sub-select. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereSub(Builder $query, $where) + { + $select = $this->compileSelect($where['query']); + + return $this->wrap($where['column']).' '.$where['operator']." ($select)"; + } + + /** + * Compile a basic where clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereBasic(Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return $this->wrap($where['column']).' '.$where['operator'].' '.$value; + } + + /** + * Compile a "between" where clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereBetween(Builder $query, $where) + { + $between = $where['not'] ? 'not between' : 'between'; + + return $this->wrap($where['column']).' '.$between.' ? and ?'; + } + + /** + * Compile a where exists clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereExists(Builder $query, $where) + { + return 'exists ('.$this->compileSelect($where['query']).')'; + } + + /** + * Compile a where exists clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNotExists(Builder $query, $where) + { + return 'not exists ('.$this->compileSelect($where['query']).')'; + } + + /** + * Compile a "where in" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereIn(Builder $query, $where) + { + if (empty($where['values'])) { + return '0 = 1'; + } + + $values = $this->parameterize($where['values']); + + return $this->wrap($where['column']).' in ('.$values.')'; + } + + /** + * Compile a "where not in" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNotIn(Builder $query, $where) + { + if (empty($where['values'])) { + return '1 = 1'; + } + + $values = $this->parameterize($where['values']); + + return $this->wrap($where['column']).' not in ('.$values.')'; + } + + /** + * Compile a where in sub-select clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereInSub(Builder $query, $where) + { + $select = $this->compileSelect($where['query']); + + return $this->wrap($where['column']).' in ('.$select.')'; + } + + /** + * Compile a where not in sub-select clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNotInSub(Builder $query, $where) + { + $select = $this->compileSelect($where['query']); + + return $this->wrap($where['column']).' not in ('.$select.')'; + } + + /** + * Compile a "where null" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNull(Builder $query, $where) + { + return $this->wrap($where['column']).' is null'; + } + + /** + * Compile a "where not null" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNotNull(Builder $query, $where) + { + return $this->wrap($where['column']).' is not null'; + } + + /** + * Compile a "where date" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDate(Builder $query, $where) + { + return $this->dateBasedWhere('date', $query, $where); + } + + /** + * Compile a "where day" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDay(Builder $query, $where) + { + return $this->dateBasedWhere('day', $query, $where); + } + + /** + * Compile a "where month" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereMonth(Builder $query, $where) + { + return $this->dateBasedWhere('month', $query, $where); + } + + /** + * Compile a "where year" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereYear(Builder $query, $where) + { + return $this->dateBasedWhere('year', $query, $where); + } + + /** + * Compile a date based where clause. + * + * @param string $type + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function dateBasedWhere($type, Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return $type.'('.$this->wrap($where['column']).') '.$where['operator'].' '.$value; + } + + /** + * Compile a raw where clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereRaw(Builder $query, $where) + { + return $where['sql']; + } + + /** + * Compile the "group by" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $groups + * @return string + */ + protected function compileGroups(Builder $query, $groups) + { + return 'group by '.$this->columnize($groups); + } + + /** + * Compile the "having" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $havings + * @return string + */ + protected function compileHavings(Builder $query, $havings) + { + $sql = implode(' ', array_map([$this, 'compileHaving'], $havings)); + + return 'having '.$this->removeLeadingBoolean($sql); + } + + /** + * Compile a single having clause. + * + * @param array $having + * @return string + */ + protected function compileHaving(array $having) + { + // If the having clause is "raw", we can just return the clause straight away + // without doing any more processing on it. Otherwise, we will compile the + // clause into SQL based on the components that make it up from builder. + if ($having['type'] === 'raw') { + return $having['boolean'].' '.$having['sql']; + } + + return $this->compileBasicHaving($having); + } + + /** + * Compile a basic having clause. + * + * @param array $having + * @return string + */ + protected function compileBasicHaving($having) + { + $column = $this->wrap($having['column']); + + $parameter = $this->parameter($having['value']); + + return $having['boolean'].' '.$column.' '.$having['operator'].' '.$parameter; + } + + /** + * Compile the "order by" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $orders + * @return string + */ + protected function compileOrders(Builder $query, $orders) + { + return 'order by '.implode(', ', array_map(function ($order) { + if (isset($order['sql'])) { + return $order['sql']; + } + + return $this->wrap($order['column']).' '.$order['direction']; + }, $orders)); + } + + /** + * Compile the "limit" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param int $limit + * @return string + */ + protected function compileLimit(Builder $query, $limit) + { + return 'limit '.(int) $limit; + } + + /** + * Compile the "offset" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param int $offset + * @return string + */ + protected function compileOffset(Builder $query, $offset) + { + return 'offset '.(int) $offset; + } + + /** + * Compile the "union" queries attached to the main query. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileUnions(Builder $query) + { + $sql = ''; + + foreach ($query->unions as $union) { + $sql .= $this->compileUnion($union); + } + + if (isset($query->unionOrders)) { + $sql .= ' '.$this->compileOrders($query, $query->unionOrders); + } + + if (isset($query->unionLimit)) { + $sql .= ' '.$this->compileLimit($query, $query->unionLimit); + } + + if (isset($query->unionOffset)) { + $sql .= ' '.$this->compileOffset($query, $query->unionOffset); + } + + return ltrim($sql); + } + + /** + * Compile a single union statement. + * + * @param array $union + * @return string + */ + protected function compileUnion(array $union) + { + $joiner = $union['all'] ? ' union all ' : ' union '; + + return $joiner.$union['query']->toSql(); + } + + /** + * Compile an exists statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileExists(Builder $query) + { + $select = $this->compileSelect($query); + + return "select exists($select) as {$this->wrap('exists')}"; + } + + /** + * Compile an insert statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileInsert(Builder $query, array $values) + { + // Essentially we will force every insert to be treated as a batch insert which + // simply makes creating the SQL easier for us since we can utilize the same + // basic routine regardless of an amount of records given to us to insert. + $table = $this->wrapTable($query->from); + + if (! is_array(reset($values))) { + $values = [$values]; + } + + $columns = $this->columnize(array_keys(reset($values))); + + // We need to build a list of parameter place-holders of values that are bound + // to the query. Each insert should have the exact same amount of parameter + // bindings so we will loop through the record and parameterize them all. + $parameters = []; + + foreach ($values as $record) { + $parameters[] = '('.$this->parameterize($record).')'; + } + + $parameters = implode(', ', $parameters); + + return "insert into $table ($columns) values $parameters"; + } + + /** + * Compile an insert and get ID statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @param string $sequence + * @return string + */ + public function compileInsertGetId(Builder $query, $values, $sequence) + { + return $this->compileInsert($query, $values); + } + + /** + * Compile an update statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileUpdate(Builder $query, $values) + { + $table = $this->wrapTable($query->from); + + // Each one of the columns in the update statements needs to be wrapped in the + // keyword identifiers, also a place-holder needs to be created for each of + // the values in the list of bindings so we can make the sets statements. + $columns = []; + + foreach ($values as $key => $value) { + $columns[] = $this->wrap($key).' = '.$this->parameter($value); + } + + $columns = implode(', ', $columns); + + // If the query has any "join" clauses, we will setup the joins on the builder + // and compile them so we can attach them to this update, as update queries + // can get join statements to attach to other tables when they're needed. + if (isset($query->joins)) { + $joins = ' '.$this->compileJoins($query, $query->joins); + } else { + $joins = ''; + } + + // Of course, update queries may also be constrained by where clauses so we'll + // need to compile the where clauses and attach it to the query so only the + // intended records are updated by the SQL statements we generate to run. + $where = $this->compileWheres($query); + + return trim("update {$table}{$joins} set $columns $where"); + } + + /** + * Compile a delete statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileDelete(Builder $query) + { + $table = $this->wrapTable($query->from); + + $where = is_array($query->wheres) ? $this->compileWheres($query) : ''; + + return trim("delete from $table ".$where); + } + + /** + * Compile a truncate table statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + public function compileTruncate(Builder $query) + { + return ['truncate '.$this->wrapTable($query->from) => []]; + } + + /** + * Compile the lock into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param bool|string $value + * @return string + */ + protected function compileLock(Builder $query, $value) + { + return is_string($value) ? $value : ''; + } + + /** + * Determine if the grammar supports savepoints. + * + * @return bool + */ + public function supportsSavepoints() + { + return true; + } + + /** + * Compile the SQL statement to define a savepoint. + * + * @param string $name + * @return string + */ + public function compileSavepoint($name) + { + return 'SAVEPOINT '.$name; + } + + /** + * Compile the SQL statement to execute a savepoint rollback. + * + * @param string $name + * @return string + */ + public function compileSavepointRollBack($name) + { + return 'ROLLBACK TO SAVEPOINT '.$name; + } + + /** + * Concatenate an array of segments, removing empties. + * + * @param array $segments + * @return string + */ + protected function concatenate($segments) + { + return implode(' ', array_filter($segments, function ($value) { + return (string) $value !== ''; + })); + } + + /** + * Remove the leading boolean from a statement. + * + * @param string $value + * @return string + */ + protected function removeLeadingBoolean($value) + { + return preg_replace('/and |or /i', '', $value, 1); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php index b6a1dbd..e48221c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php @@ -1,144 +1,141 @@ -unions) - { - $sql = '('.$sql.') '.$this->compileUnions($query); - } - - return $sql; - } - - /** - * Compile a single union statement. - * - * @param array $union - * @return string - */ - protected function compileUnion(array $union) - { - $joiner = $union['all'] ? ' union all ' : ' union '; - - return $joiner.'('.$union['query']->toSql().')'; - } - - /** - * Compile the lock into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param bool|string $value - * @return string - */ - protected function compileLock(Builder $query, $value) - { - if (is_string($value)) return $value; - - return $value ? 'for update' : 'lock in share mode'; - } - - /** - * Compile an update statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileUpdate(Builder $query, $values) - { - $sql = parent::compileUpdate($query, $values); - - if (isset($query->orders)) - { - $sql .= ' '.$this->compileOrders($query, $query->orders); - } - - if (isset($query->limit)) - { - $sql .= ' '.$this->compileLimit($query, $query->limit); - } - - return rtrim($sql); - } - - /** - * Compile a delete statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - public function compileDelete(Builder $query) - { - $table = $this->wrapTable($query->from); - - $where = is_array($query->wheres) ? $this->compileWheres($query) : ''; - - if (isset($query->joins)) - { - $joins = ' '.$this->compileJoins($query, $query->joins); - - $sql = trim("delete $table from {$table}{$joins} $where"); - } - else - { - $sql = trim("delete from $table $where"); - } - - if (isset($query->orders)) - { - $sql .= ' '.$this->compileOrders($query, $query->orders); - } - - if (isset($query->limit)) - { - $sql .= ' '.$this->compileLimit($query, $query->limit); - } - - return $sql; - } - - /** - * Wrap a single string in keyword identifiers. - * - * @param string $value - * @return string - */ - protected function wrapValue($value) - { - if ($value === '*') return $value; - - return '`'.str_replace('`', '``', $value).'`'; - } +use Illuminate\Database\Query\Builder; +class MySqlGrammar extends Grammar +{ + /** + * The components that make up a select clause. + * + * @var array + */ + protected $selectComponents = [ + 'aggregate', + 'columns', + 'from', + 'joins', + 'wheres', + 'groups', + 'havings', + 'orders', + 'limit', + 'offset', + 'lock', + ]; + + /** + * Compile a select query into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileSelect(Builder $query) + { + $sql = parent::compileSelect($query); + + if ($query->unions) { + $sql = '('.$sql.') '.$this->compileUnions($query); + } + + return $sql; + } + + /** + * Compile a single union statement. + * + * @param array $union + * @return string + */ + protected function compileUnion(array $union) + { + $joiner = $union['all'] ? ' union all ' : ' union '; + + return $joiner.'('.$union['query']->toSql().')'; + } + + /** + * Compile the lock into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param bool|string $value + * @return string + */ + protected function compileLock(Builder $query, $value) + { + if (is_string($value)) { + return $value; + } + + return $value ? 'for update' : 'lock in share mode'; + } + + /** + * Compile an update statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileUpdate(Builder $query, $values) + { + $sql = parent::compileUpdate($query, $values); + + if (isset($query->orders)) { + $sql .= ' '.$this->compileOrders($query, $query->orders); + } + + if (isset($query->limit)) { + $sql .= ' '.$this->compileLimit($query, $query->limit); + } + + return rtrim($sql); + } + + /** + * Compile a delete statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileDelete(Builder $query) + { + $table = $this->wrapTable($query->from); + + $where = is_array($query->wheres) ? $this->compileWheres($query) : ''; + + if (isset($query->joins)) { + $joins = ' '.$this->compileJoins($query, $query->joins); + + $sql = trim("delete $table from {$table}{$joins} $where"); + } else { + $sql = trim("delete from $table $where"); + + if (isset($query->orders)) { + $sql .= ' '.$this->compileOrders($query, $query->orders); + } + + if (isset($query->limit)) { + $sql .= ' '.$this->compileLimit($query, $query->limit); + } + } + + return $sql; + } + + /** + * Wrap a single string in keyword identifiers. + * + * @param string $value + * @return string + */ + protected function wrapValue($value) + { + if ($value === '*') { + return $value; + } + + return '`'.str_replace('`', '``', $value).'`'; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php index 7a8df9c..5582649 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php @@ -1,174 +1,245 @@ -', '<=', '>=', '<>', '!=', - 'like', 'not like', 'between', 'ilike', - '&', '|', '#', '<<', '>>', - ); - - /** - * Compile the lock into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param bool|string $value - * @return string - */ - protected function compileLock(Builder $query, $value) - { - if (is_string($value)) return $value; - - return $value ? 'for update' : 'for share'; - } - - /** - * Compile an update statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileUpdate(Builder $query, $values) - { - $table = $this->wrapTable($query->from); - - // Each one of the columns in the update statements needs to be wrapped in the - // keyword identifiers, also a place-holder needs to be created for each of - // the values in the list of bindings so we can make the sets statements. - $columns = $this->compileUpdateColumns($values); - - $from = $this->compileUpdateFrom($query); - - $where = $this->compileUpdateWheres($query); - - return trim("update {$table} set {$columns}{$from} $where"); - } - - /** - * Compile the columns for the update statement. - * - * @param array $values - * @return string - */ - protected function compileUpdateColumns($values) - { - $columns = array(); - - // When gathering the columns for an update statement, we'll wrap each of the - // columns and convert it to a parameter value. Then we will concatenate a - // list of the columns that can be added into this update query clauses. - foreach ($values as $key => $value) - { - $columns[] = $this->wrap($key).' = '.$this->parameter($value); - } - - return implode(', ', $columns); - } - - /** - * Compile the "from" clause for an update with a join. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileUpdateFrom(Builder $query) - { - if ( ! isset($query->joins)) return ''; - - $froms = array(); - - // When using Postgres, updates with joins list the joined tables in the from - // clause, which is different than other systems like MySQL. Here, we will - // compile out the tables that are joined and add them to a from clause. - foreach ($query->joins as $join) - { - $froms[] = $this->wrapTable($join->table); - } - - if (count($froms) > 0) return ' from '.implode(', ', $froms); - } - - /** - * Compile the additional where clauses for updates with joins. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileUpdateWheres(Builder $query) - { - $baseWhere = $this->compileWheres($query); - - if ( ! isset($query->joins)) return $baseWhere; - - // Once we compile the join constraints, we will either use them as the where - // clause or append them to the existing base where clauses. If we need to - // strip the leading boolean we will do so when using as the only where. - $joinWhere = $this->compileUpdateJoinWheres($query); - - if (trim($baseWhere) == '') - { - return 'where '.$this->removeLeadingBoolean($joinWhere); - } - - return $baseWhere.' '.$joinWhere; - } - - /** - * Compile the "join" clauses for an update. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileUpdateJoinWheres(Builder $query) - { - $joinWheres = array(); - - // Here we will just loop through all of the join constraints and compile them - // all out then implode them. This should give us "where" like syntax after - // everything has been built and then we will join it to the real wheres. - foreach ($query->joins as $join) - { - foreach ($join->clauses as $clause) - { - $joinWheres[] = $this->compileJoinConstraint($clause); - } - } - - return implode(' ', $joinWheres); - } - - /** - * Compile an insert and get ID statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @param string $sequence - * @return string - */ - public function compileInsertGetId(Builder $query, $values, $sequence) - { - if (is_null($sequence)) $sequence = 'id'; - - return $this->compileInsert($query, $values).' returning '.$this->wrap($sequence); - } - - /** - * Compile a truncate table statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return array - */ - public function compileTruncate(Builder $query) - { - return array('truncate '.$this->wrapTable($query->from).' restart identity' => array()); - } +use Illuminate\Database\Query\Builder; +class PostgresGrammar extends Grammar +{ + /** + * All of the available clause operators. + * + * @var array + */ + protected $operators = [ + '=', '<', '>', '<=', '>=', '<>', '!=', + 'like', 'not like', 'between', 'ilike', + '&', '|', '#', '<<', '>>', + ]; + + /** + * Compile the lock into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param bool|string $value + * @return string + */ + protected function compileLock(Builder $query, $value) + { + if (is_string($value)) { + return $value; + } + + return $value ? 'for update' : 'for share'; + } + + /** + * Compile a "where date" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDate(Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return $this->wrap($where['column']).' '.$where['operator'].' '.$value.'::date'; + } + + /** + * Compile a "where day" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDay(Builder $query, $where) + { + return $this->dateBasedWhere('day', $query, $where); + } + + /** + * Compile a "where month" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereMonth(Builder $query, $where) + { + return $this->dateBasedWhere('month', $query, $where); + } + + /** + * Compile a "where year" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereYear(Builder $query, $where) + { + return $this->dateBasedWhere('year', $query, $where); + } + + /** + * Compile a date based where clause. + * + * @param string $type + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function dateBasedWhere($type, Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return 'extract('.$type.' from '.$this->wrap($where['column']).') '.$where['operator'].' '.$value; + } + + /** + * Compile an update statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileUpdate(Builder $query, $values) + { + $table = $this->wrapTable($query->from); + + // Each one of the columns in the update statements needs to be wrapped in the + // keyword identifiers, also a place-holder needs to be created for each of + // the values in the list of bindings so we can make the sets statements. + $columns = $this->compileUpdateColumns($values); + + $from = $this->compileUpdateFrom($query); + + $where = $this->compileUpdateWheres($query); + + return trim("update {$table} set {$columns}{$from} $where"); + } + + /** + * Compile the columns for the update statement. + * + * @param array $values + * @return string + */ + protected function compileUpdateColumns($values) + { + $columns = []; + + // When gathering the columns for an update statement, we'll wrap each of the + // columns and convert it to a parameter value. Then we will concatenate a + // list of the columns that can be added into this update query clauses. + foreach ($values as $key => $value) { + $columns[] = $this->wrap($key).' = '.$this->parameter($value); + } + + return implode(', ', $columns); + } + + /** + * Compile the "from" clause for an update with a join. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string|null + */ + protected function compileUpdateFrom(Builder $query) + { + if (! isset($query->joins)) { + return ''; + } + + $froms = []; + + // When using Postgres, updates with joins list the joined tables in the from + // clause, which is different than other systems like MySQL. Here, we will + // compile out the tables that are joined and add them to a from clause. + foreach ($query->joins as $join) { + $froms[] = $this->wrapTable($join->table); + } + + if (count($froms) > 0) { + return ' from '.implode(', ', $froms); + } + } + + /** + * Compile the additional where clauses for updates with joins. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileUpdateWheres(Builder $query) + { + $baseWhere = $this->compileWheres($query); + + if (! isset($query->joins)) { + return $baseWhere; + } + + // Once we compile the join constraints, we will either use them as the where + // clause or append them to the existing base where clauses. If we need to + // strip the leading boolean we will do so when using as the only where. + $joinWhere = $this->compileUpdateJoinWheres($query); + + if (trim($baseWhere) == '') { + return 'where '.$this->removeLeadingBoolean($joinWhere); + } + + return $baseWhere.' '.$joinWhere; + } + + /** + * Compile the "join" clauses for an update. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileUpdateJoinWheres(Builder $query) + { + $joinWheres = []; + + // Here we will just loop through all of the join constraints and compile them + // all out then implode them. This should give us "where" like syntax after + // everything has been built and then we will join it to the real wheres. + foreach ($query->joins as $join) { + foreach ($join->clauses as $clause) { + $joinWheres[] = $this->compileJoinConstraint($clause); + } + } + + return implode(' ', $joinWheres); + } + + /** + * Compile an insert and get ID statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @param string $sequence + * @return string + */ + public function compileInsertGetId(Builder $query, $values, $sequence) + { + if (is_null($sequence)) { + $sequence = 'id'; + } + + return $this->compileInsert($query, $values).' returning '.$this->wrap($sequence); + } + + /** + * Compile a truncate table statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + public function compileTruncate(Builder $query) + { + return ['truncate '.$this->wrapTable($query->from).' restart identity' => []]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php index 9e47042..dd1f9c0 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php @@ -1,130 +1,140 @@ -', '<=', '>=', '<>', '!=', - 'like', 'not like', 'between', 'ilike', - '&', '|', '<<', '>>', - ); - - /** - * Compile an insert statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileInsert(Builder $query, array $values) - { - // Essentially we will force every insert to be treated as a batch insert which - // simply makes creating the SQL easier for us since we can utilize the same - // basic routine regardless of an amount of records given to us to insert. - $table = $this->wrapTable($query->from); - - if ( ! is_array(reset($values))) - { - $values = array($values); - } - - // If there is only one record being inserted, we will just use the usual query - // grammar insert builder because no special syntax is needed for the single - // row inserts in SQLite. However, if there are multiples, we'll continue. - if (count($values) == 1) - { - return parent::compileInsert($query, reset($values)); - } - - $names = $this->columnize(array_keys(reset($values))); - - $columns = array(); - - // SQLite requires us to build the multi-row insert as a listing of select with - // unions joining them together. So we'll build out this list of columns and - // then join them all together with select unions to complete the queries. - foreach (array_keys(reset($values)) as $column) - { - $columns[] = '? as '.$this->wrap($column); - } - - $columns = array_fill(0, count($values), implode(', ', $columns)); - - return "insert into $table ($names) select ".implode(' union all select ', $columns); - } - - /** - * Compile a truncate table statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return array - */ - public function compileTruncate(Builder $query) - { - $sql = array('delete from sqlite_sequence where name = ?' => array($query->from)); - - $sql['delete from '.$this->wrapTable($query->from)] = array(); - - return $sql; - } - - /** - * Compile a "where day" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereDay(Builder $query, $where) - { - return $this->dateBasedWhere('%d', $query, $where); - } - - /** - * Compile a "where month" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereMonth(Builder $query, $where) - { - return $this->dateBasedWhere('%m', $query, $where); - } - - /** - * Compile a "where year" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereYear(Builder $query, $where) - { - return $this->dateBasedWhere('%Y', $query, $where); - } - - /** - * Compile a date based where clause. - * - * @param string $type - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function dateBasedWhere($type, Builder $query, $where) - { - $value = str_pad($where['value'], 2, '0', STR_PAD_LEFT); - - $value = $this->parameter($value); - - return 'strftime(\''.$type.'\', '.$this->wrap($where['column']).') '.$where['operator'].' '.$value; - } +use Illuminate\Database\Query\Builder; +class SQLiteGrammar extends Grammar +{ + /** + * All of the available clause operators. + * + * @var array + */ + protected $operators = [ + '=', '<', '>', '<=', '>=', '<>', '!=', + 'like', 'not like', 'between', 'ilike', + '&', '|', '<<', '>>', + ]; + + /** + * Compile an insert statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileInsert(Builder $query, array $values) + { + // Essentially we will force every insert to be treated as a batch insert which + // simply makes creating the SQL easier for us since we can utilize the same + // basic routine regardless of an amount of records given to us to insert. + $table = $this->wrapTable($query->from); + + if (! is_array(reset($values))) { + $values = [$values]; + } + + // If there is only one record being inserted, we will just use the usual query + // grammar insert builder because no special syntax is needed for the single + // row inserts in SQLite. However, if there are multiples, we'll continue. + if (count($values) == 1) { + return parent::compileInsert($query, reset($values)); + } + + $names = $this->columnize(array_keys(reset($values))); + + $columns = []; + + // SQLite requires us to build the multi-row insert as a listing of select with + // unions joining them together. So we'll build out this list of columns and + // then join them all together with select unions to complete the queries. + foreach (array_keys(reset($values)) as $column) { + $columns[] = '? as '.$this->wrap($column); + } + + $columns = array_fill(0, count($values), implode(', ', $columns)); + + return "insert into $table ($names) select ".implode(' union all select ', $columns); + } + + /** + * Compile a truncate table statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + public function compileTruncate(Builder $query) + { + $sql = ['delete from sqlite_sequence where name = ?' => [$query->from]]; + + $sql['delete from '.$this->wrapTable($query->from)] = []; + + return $sql; + } + + /** + * Compile a "where date" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDate(Builder $query, $where) + { + return $this->dateBasedWhere('%Y-%m-%d', $query, $where); + } + + /** + * Compile a "where day" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDay(Builder $query, $where) + { + return $this->dateBasedWhere('%d', $query, $where); + } + + /** + * Compile a "where month" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereMonth(Builder $query, $where) + { + return $this->dateBasedWhere('%m', $query, $where); + } + + /** + * Compile a "where year" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereYear(Builder $query, $where) + { + return $this->dateBasedWhere('%Y', $query, $where); + } + + /** + * Compile a date based where clause. + * + * @param string $type + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function dateBasedWhere($type, Builder $query, $where) + { + $value = str_pad($where['value'], 2, '0', STR_PAD_LEFT); + + $value = $this->parameter($value); + + return 'strftime(\''.$type.'\', '.$this->wrap($where['column']).') '.$where['operator'].' '.$value; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php index 24fd428..b36e94c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php @@ -1,224 +1,344 @@ -', '<=', '>=', '!<', '!>', '<>', '!=', - 'like', 'not like', 'between', 'ilike', - '&', '&=', '|', '|=', '^', '^=', - ); - - /** - * Compile a select query into SQL. - * - * @param \Illuminate\Database\Query\Builder - * @return string - */ - public function compileSelect(Builder $query) - { - $components = $this->compileComponents($query); - - // If an offset is present on the query, we will need to wrap the query in - // a big "ANSI" offset syntax block. This is very nasty compared to the - // other database systems but is necessary for implementing features. - if ($query->offset > 0) - { - return $this->compileAnsiOffset($query, $components); - } - - return $this->concatenate($components); - } - - /** - * Compile the "select *" portion of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $columns - * @return string - */ - protected function compileColumns(Builder $query, $columns) - { - if ( ! is_null($query->aggregate)) return; - - $select = $query->distinct ? 'select distinct ' : 'select '; - - // If there is a limit on the query, but not an offset, we will add the top - // clause to the query, which serves as a "limit" type clause within the - // SQL Server system similar to the limit keywords available in MySQL. - if ($query->limit > 0 && $query->offset <= 0) - { - $select .= 'top '.$query->limit.' '; - } - - return $select.$this->columnize($columns); - } - - /** - * Compile the "from" portion of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $table - * @return string - */ - protected function compileFrom(Builder $query, $table) - { - $from = parent::compileFrom($query, $table); - - if (is_string($query->lock)) return $from.' '.$query->lock; - - if ( ! is_null($query->lock)) - { - return $from.' with(rowlock,'.($query->lock ? 'updlock,' : '').'holdlock)'; - } - - return $from; - } - - /** - * Create a full ANSI offset clause for the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $components - * @return string - */ - protected function compileAnsiOffset(Builder $query, $components) - { - // An ORDER BY clause is required to make this offset query work, so if one does - // not exist we'll just create a dummy clause to trick the database and so it - // does not complain about the queries for not having an "order by" clause. - if ( ! isset($components['orders'])) - { - $components['orders'] = 'order by (select 0)'; - } - - // We need to add the row number to the query so we can compare it to the offset - // and limit values given for the statements. So we will add an expression to - // the "select" that will give back the row numbers on each of the records. - $orderings = $components['orders']; - - $components['columns'] .= $this->compileOver($orderings); - - unset($components['orders']); - - // Next we need to calculate the constraints that should be placed on the query - // to get the right offset and limit from our query but if there is no limit - // set we will just handle the offset only since that is all that matters. - $constraint = $this->compileRowConstraint($query); - - $sql = $this->concatenate($components); - - // We are now ready to build the final SQL query so we'll create a common table - // expression from the query and get the records with row numbers within our - // given limit and offset value that we just put on as a query constraint. - return $this->compileTableExpression($sql, $constraint); - } - - /** - * Compile the over statement for a table expression. - * - * @param string $orderings - * @return string - */ - protected function compileOver($orderings) - { - return ", row_number() over ({$orderings}) as row_num"; - } - - /** - * Compile the limit / offset row constraint for a query. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileRowConstraint($query) - { - $start = $query->offset + 1; - - if ($query->limit > 0) - { - $finish = $query->offset + $query->limit; - - return "between {$start} and {$finish}"; - } - - return ">= {$start}"; - } - - /** - * Compile a common table expression for a query. - * - * @param string $sql - * @param string $constraint - * @return string - */ - protected function compileTableExpression($sql, $constraint) - { - return "select * from ({$sql}) as temp_table where row_num {$constraint}"; - } - - /** - * Compile the "limit" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param int $limit - * @return string - */ - protected function compileLimit(Builder $query, $limit) - { - return ''; - } - - /** - * Compile the "offset" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param int $offset - * @return string - */ - protected function compileOffset(Builder $query, $offset) - { - return ''; - } - - /** - * Compile a truncate table statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return array - */ - public function compileTruncate(Builder $query) - { - return array('truncate table '.$this->wrapTable($query->from) => array()); - } - - /** - * Get the format for database stored dates. - * - * @return string - */ - public function getDateFormat() - { - return 'Y-m-d H:i:s.000'; - } - - /** - * Wrap a single string in keyword identifiers. - * - * @param string $value - * @return string - */ - protected function wrapValue($value) - { - if ($value === '*') return $value; - - return '['.str_replace(']', ']]', $value).']'; - } +use Illuminate\Database\Query\Builder; +class SqlServerGrammar extends Grammar +{ + /** + * All of the available clause operators. + * + * @var array + */ + protected $operators = [ + '=', '<', '>', '<=', '>=', '!<', '!>', '<>', '!=', + 'like', 'not like', 'between', 'ilike', + '&', '&=', '|', '|=', '^', '^=', + ]; + + /** + * Compile a select query into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileSelect(Builder $query) + { + if (is_null($query->columns)) { + $query->columns = ['*']; + } + + $components = $this->compileComponents($query); + + // If an offset is present on the query, we will need to wrap the query in + // a big "ANSI" offset syntax block. This is very nasty compared to the + // other database systems but is necessary for implementing features. + if ($query->offset > 0) { + return $this->compileAnsiOffset($query, $components); + } + + return $this->concatenate($components); + } + + /** + * Compile the "select *" portion of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $columns + * @return string|null + */ + protected function compileColumns(Builder $query, $columns) + { + if (! is_null($query->aggregate)) { + return; + } + + $select = $query->distinct ? 'select distinct ' : 'select '; + + // If there is a limit on the query, but not an offset, we will add the top + // clause to the query, which serves as a "limit" type clause within the + // SQL Server system similar to the limit keywords available in MySQL. + if ($query->limit > 0 && $query->offset <= 0) { + $select .= 'top '.$query->limit.' '; + } + + return $select.$this->columnize($columns); + } + + /** + * Compile the "from" portion of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @return string + */ + protected function compileFrom(Builder $query, $table) + { + $from = parent::compileFrom($query, $table); + + if (is_string($query->lock)) { + return $from.' '.$query->lock; + } + + if (! is_null($query->lock)) { + return $from.' with(rowlock,'.($query->lock ? 'updlock,' : '').'holdlock)'; + } + + return $from; + } + + /** + * Create a full ANSI offset clause for the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $components + * @return string + */ + protected function compileAnsiOffset(Builder $query, $components) + { + // An ORDER BY clause is required to make this offset query work, so if one does + // not exist we'll just create a dummy clause to trick the database and so it + // does not complain about the queries for not having an "order by" clause. + if (! isset($components['orders'])) { + $components['orders'] = 'order by (select 0)'; + } + + // We need to add the row number to the query so we can compare it to the offset + // and limit values given for the statements. So we will add an expression to + // the "select" that will give back the row numbers on each of the records. + $orderings = $components['orders']; + + $components['columns'] .= $this->compileOver($orderings); + + unset($components['orders']); + + // Next we need to calculate the constraints that should be placed on the query + // to get the right offset and limit from our query but if there is no limit + // set we will just handle the offset only since that is all that matters. + $constraint = $this->compileRowConstraint($query); + + $sql = $this->concatenate($components); + + // We are now ready to build the final SQL query so we'll create a common table + // expression from the query and get the records with row numbers within our + // given limit and offset value that we just put on as a query constraint. + return $this->compileTableExpression($sql, $constraint); + } + + /** + * Compile the over statement for a table expression. + * + * @param string $orderings + * @return string + */ + protected function compileOver($orderings) + { + return ", row_number() over ({$orderings}) as row_num"; + } + + /** + * Compile the limit / offset row constraint for a query. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileRowConstraint($query) + { + $start = $query->offset + 1; + + if ($query->limit > 0) { + $finish = $query->offset + $query->limit; + + return "between {$start} and {$finish}"; + } + + return ">= {$start}"; + } + + /** + * Compile a common table expression for a query. + * + * @param string $sql + * @param string $constraint + * @return string + */ + protected function compileTableExpression($sql, $constraint) + { + return "select * from ({$sql}) as temp_table where row_num {$constraint}"; + } + + /** + * Compile the "limit" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param int $limit + * @return string + */ + protected function compileLimit(Builder $query, $limit) + { + return ''; + } + + /** + * Compile the "offset" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param int $offset + * @return string + */ + protected function compileOffset(Builder $query, $offset) + { + return ''; + } + + /** + * Compile a truncate table statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + public function compileTruncate(Builder $query) + { + return ['truncate table '.$this->wrapTable($query->from) => []]; + } + + /** + * Compile an exists statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileExists(Builder $query) + { + $existsQuery = clone $query; + + $existsQuery->columns = []; + + return $this->compileSelect($existsQuery->selectRaw('1 [exists]')->limit(1)); + } + + /** + * Compile a "where date" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDate(Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return 'cast('.$this->wrap($where['column']).' as date) '.$where['operator'].' '.$value; + } + + /** + * Determine if the grammar supports savepoints. + * + * @return bool + */ + public function supportsSavepoints() + { + return false; + } + + /** + * Get the format for database stored dates. + * + * @return string + */ + public function getDateFormat() + { + return 'Y-m-d H:i:s.000'; + } + + /** + * Wrap a single string in keyword identifiers. + * + * @param string $value + * @return string + */ + protected function wrapValue($value) + { + if ($value === '*') { + return $value; + } + + return '['.str_replace(']', ']]', $value).']'; + } + + /** + * Compile an update statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileUpdate(Builder $query, $values) + { + $table = $alias = $this->wrapTable($query->from); + + if (strpos(strtolower($table), '] as [') !== false) { + $segments = explode('] as [', $table); + + $alias = '['.$segments[1]; + } + + // Each one of the columns in the update statements needs to be wrapped in the + // keyword identifiers, also a place-holder needs to be created for each of + // the values in the list of bindings so we can make the sets statements. + $columns = []; + + foreach ($values as $key => $value) { + $columns[] = $this->wrap($key).' = '.$this->parameter($value); + } + + $columns = implode(', ', $columns); + + // If the query has any "join" clauses, we will setup the joins on the builder + // and compile them so we can attach them to this update, as update queries + // can get join statements to attach to other tables when they're needed. + if (isset($query->joins)) { + $joins = ' '.$this->compileJoins($query, $query->joins); + } else { + $joins = ''; + } + + // Of course, update queries may also be constrained by where clauses so we'll + // need to compile the where clauses and attach it to the query so only the + // intended records are updated by the SQL statements we generate to run. + $where = $this->compileWheres($query); + + if (! empty($joins)) { + return trim("update {$alias} set {$columns} from {$table}{$joins} {$where}"); + } + + return trim("update {$table}{$joins} set $columns $where"); + } + + /** + * Wrap a table in keyword identifiers. + * + * @param \Illuminate\Database\Query\Expression|string $table + * @return string + */ + public function wrapTable($table) + { + return $this->wrapTableValuedFunction(parent::wrapTable($table)); + } + + /** + * Wrap a table in keyword identifiers. + * + * @param string $table + * @return string + */ + protected function wrapTableValuedFunction($table) + { + if (preg_match('/^(.+?)(\(.*?\))]$/', $table, $matches) === 1) { + $table = $matches[1].']'.$matches[2]; + } + + return $table; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Query/JoinClause.php b/application/vendor/laravel/framework/src/Illuminate/Database/Query/JoinClause.php index ea571d3..29ce036 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Query/JoinClause.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Query/JoinClause.php @@ -1,151 +1,253 @@ -type = $type; - $this->table = $table; - } - - /** - * Add an "on" clause to the join. - * - * @param string $first - * @param string $operator - * @param string $second - * @param string $boolean - * @param bool $where - * @return $this - */ - public function on($first, $operator, $second, $boolean = 'and', $where = false) - { - $this->clauses[] = compact('first', 'operator', 'second', 'boolean', 'where'); - - if ($where) $this->bindings[] = $second; - - return $this; - } - - /** - * Add an "or on" clause to the join. - * - * @param string $first - * @param string $operator - * @param string $second - * @return \Illuminate\Database\Query\JoinClause - */ - public function orOn($first, $operator, $second) - { - return $this->on($first, $operator, $second, 'or'); - } - - /** - * Add an "on where" clause to the join. - * - * @param string $first - * @param string $operator - * @param string $second - * @param string $boolean - * @return \Illuminate\Database\Query\JoinClause - */ - public function where($first, $operator, $second, $boolean = 'and') - { - return $this->on($first, $operator, $second, $boolean, true); - } - - /** - * Add an "or on where" clause to the join. - * - * @param string $first - * @param string $operator - * @param string $second - * @return \Illuminate\Database\Query\JoinClause - */ - public function orWhere($first, $operator, $second) - { - return $this->on($first, $operator, $second, 'or', true); - } - - /** - * Add an "on where is null" clause to the join. - * - * @param string $column - * @param string $boolean - * @return \Illuminate\Database\Query\JoinClause - */ - public function whereNull($column, $boolean = 'and') - { - return $this->on($column, 'is', new Expression('null'), $boolean, false); - } - - /** - * Add an "or on where is null" clause to the join. - * - * @param string $column - * @return \Illuminate\Database\Query\JoinClause - */ - public function orWhereNull($column) - { - return $this->whereNull($column, 'or'); - } - - /** - * Add an "on where is not null" clause to the join. - * - * @param string $column - * @param string $boolean - * @return \Illuminate\Database\Query\JoinClause - */ - public function whereNotNull($column, $boolean = 'and') - { - return $this->on($column, 'is', new Expression('not null'), $boolean, false); - } - - /** - * Add an "or on where is not null" clause to the join. - * - * @param string $column - * @return \Illuminate\Database\Query\JoinClause - */ - public function orWhereNotNull($column) - { - return $this->whereNotNull($column, 'or'); - } - +type = $type; + $this->table = $table; + } + + /** + * Add an "on" clause to the join. + * + * On clauses can be chained, e.g. + * + * $join->on('contacts.user_id', '=', 'users.id') + * ->on('contacts.info_id', '=', 'info.id') + * + * will produce the following SQL: + * + * on `contacts`.`user_id` = `users`.`id` and `contacts`.`info_id` = `info`.`id` + * + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @param string $boolean + * @param bool $where + * @return $this + * + * @throws \InvalidArgumentException + */ + public function on($first, $operator = null, $second = null, $boolean = 'and', $where = false) + { + if ($first instanceof Closure) { + return $this->nest($first, $boolean); + } + + if (func_num_args() < 3) { + throw new InvalidArgumentException('Not enough arguments for the on clause.'); + } + + if ($where) { + $this->bindings[] = $second; + } + + if ($where && ($operator === 'in' || $operator === 'not in') && is_array($second)) { + $second = count($second); + } + + $nested = false; + + $this->clauses[] = compact('first', 'operator', 'second', 'boolean', 'where', 'nested'); + + return $this; + } + + /** + * Add an "or on" clause to the join. + * + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\JoinClause + */ + public function orOn($first, $operator = null, $second = null) + { + return $this->on($first, $operator, $second, 'or'); + } + + /** + * Add an "on where" clause to the join. + * + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @param string $boolean + * @return \Illuminate\Database\Query\JoinClause + */ + public function where($first, $operator = null, $second = null, $boolean = 'and') + { + return $this->on($first, $operator, $second, $boolean, true); + } + + /** + * Add an "or on where" clause to the join. + * + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\JoinClause + */ + public function orWhere($first, $operator = null, $second = null) + { + return $this->on($first, $operator, $second, 'or', true); + } + + /** + * Add an "on where is null" clause to the join. + * + * @param string $column + * @param string $boolean + * @return \Illuminate\Database\Query\JoinClause + */ + public function whereNull($column, $boolean = 'and') + { + return $this->on($column, 'is', new Expression('null'), $boolean, false); + } + + /** + * Add an "or on where is null" clause to the join. + * + * @param string $column + * @return \Illuminate\Database\Query\JoinClause + */ + public function orWhereNull($column) + { + return $this->whereNull($column, 'or'); + } + + /** + * Add an "on where is not null" clause to the join. + * + * @param string $column + * @param string $boolean + * @return \Illuminate\Database\Query\JoinClause + */ + public function whereNotNull($column, $boolean = 'and') + { + return $this->on($column, 'is', new Expression('not null'), $boolean, false); + } + + /** + * Add an "or on where is not null" clause to the join. + * + * @param string $column + * @return \Illuminate\Database\Query\JoinClause + */ + public function orWhereNotNull($column) + { + return $this->whereNotNull($column, 'or'); + } + + /** + * Add an "on where in (...)" clause to the join. + * + * @param string $column + * @param array $values + * @return \Illuminate\Database\Query\JoinClause + */ + public function whereIn($column, array $values) + { + return $this->on($column, 'in', $values, 'and', true); + } + + /** + * Add an "on where not in (...)" clause to the join. + * + * @param string $column + * @param array $values + * @return \Illuminate\Database\Query\JoinClause + */ + public function whereNotIn($column, array $values) + { + return $this->on($column, 'not in', $values, 'and', true); + } + + /** + * Add an "or on where in (...)" clause to the join. + * + * @param string $column + * @param array $values + * @return \Illuminate\Database\Query\JoinClause + */ + public function orWhereIn($column, array $values) + { + return $this->on($column, 'in', $values, 'or', true); + } + + /** + * Add an "or on where not in (...)" clause to the join. + * + * @param string $column + * @param array $values + * @return \Illuminate\Database\Query\JoinClause + */ + public function orWhereNotIn($column, array $values) + { + return $this->on($column, 'not in', $values, 'or', true); + } + + /** + * Add a nested where statement to the query. + * + * @param \Closure $callback + * @param string $boolean + * @return \Illuminate\Database\Query\JoinClause + */ + public function nest(Closure $callback, $boolean = 'and') + { + $join = new static($this->type, $this->table); + + $callback($join); + + if (count($join->clauses)) { + $nested = true; + + $this->clauses[] = compact('nested', 'join', 'boolean'); + $this->bindings = array_merge($this->bindings, $join->bindings); + } + + return $this; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/MySqlProcessor.php b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/MySqlProcessor.php index 1e45ce7..a8a9a6c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/MySqlProcessor.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/MySqlProcessor.php @@ -1,23 +1,23 @@ -column_name; - }; - - return array_map($mapping, $results); - } + return $r->column_name; + }; + return array_map($mapping, $results); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/PostgresProcessor.php b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/PostgresProcessor.php index 775dc8e..ab350cb 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/PostgresProcessor.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/PostgresProcessor.php @@ -1,47 +1,47 @@ -getConnection()->selectFromWriteConnection($sql, $values); - - $sequence = $sequence ?: 'id'; - - $result = (array) $results[0]; +namespace Illuminate\Database\Query\Processors; - $id = $result[$sequence]; - - return is_numeric($id) ? (int) $id : $id; - } - - /** - * Process the results of a column listing query. - * - * @param array $results - * @return array - */ - public function processColumnListing($results) - { - $mapping = function($r) - { - $r = (object) $r; - - return $r->column_name; - }; - - return array_map($mapping, $results); - } +use Illuminate\Database\Query\Builder; +class PostgresProcessor extends Processor +{ + /** + * Process an "insert get ID" query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $sql + * @param array $values + * @param string $sequence + * @return int + */ + public function processInsertGetId(Builder $query, $sql, $values, $sequence = null) + { + $results = $query->getConnection()->selectFromWriteConnection($sql, $values); + + $sequence = $sequence ?: 'id'; + + $result = (array) $results[0]; + + $id = $result[$sequence]; + + return is_numeric($id) ? (int) $id : $id; + } + + /** + * Process the results of a column listing query. + * + * @param array $results + * @return array + */ + public function processColumnListing($results) + { + $mapping = function ($r) { + $r = (object) $r; + + return $r->column_name; + }; + + return array_map($mapping, $results); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php index b960092..f78429f 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php @@ -1,48 +1,49 @@ -getConnection()->insert($sql, $values); +namespace Illuminate\Database\Query\Processors; - $id = $query->getConnection()->getPdo()->lastInsertId($sequence); - - return is_numeric($id) ? (int) $id : $id; - } - - /** - * Process the results of a column listing query. - * - * @param array $results - * @return array - */ - public function processColumnListing($results) - { - return $results; - } +use Illuminate\Database\Query\Builder; +class Processor +{ + /** + * Process the results of a "select" query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $results + * @return array + */ + public function processSelect(Builder $query, $results) + { + return $results; + } + + /** + * Process an "insert get ID" query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $sql + * @param array $values + * @param string $sequence + * @return int + */ + public function processInsertGetId(Builder $query, $sql, $values, $sequence = null) + { + $query->getConnection()->insert($sql, $values); + + $id = $query->getConnection()->getPdo()->lastInsertId($sequence); + + return is_numeric($id) ? (int) $id : $id; + } + + /** + * Process the results of a column listing query. + * + * @param array $results + * @return array + */ + public function processColumnListing($results) + { + return $results; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php index b1d8e0a..e4a8950 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php @@ -1,23 +1,23 @@ -name; - }; - - return array_map($mapping, $results); - } + return $r->name; + }; + return array_map($mapping, $results); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php index 38bc25c..447a9c6 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php @@ -1,41 +1,43 @@ -getConnection()->insert($sql, $values); - - $id = $query->getConnection()->getPdo()->lastInsertId(); - - return is_numeric($id) ? (int) $id : $id; - } - - /** - * Process the results of a column listing query. - * - * @param array $results - * @return array - */ - public function processColumnListing($results) - { - $mapping = function($r) - { - return $r->name; - }; - - return array_map($mapping, $results); - } +use Illuminate\Database\Query\Builder; +class SqlServerProcessor extends Processor +{ + /** + * Process an "insert get ID" query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $sql + * @param array $values + * @param string $sequence + * @return int + */ + public function processInsertGetId(Builder $query, $sql, $values, $sequence = null) + { + $query->getConnection()->insert($sql, $values); + + $id = $query->getConnection()->getPdo()->lastInsertId(); + + return is_numeric($id) ? (int) $id : $id; + } + + /** + * Process the results of a column listing query. + * + * @param array $results + * @return array + */ + public function processColumnListing($results) + { + $mapping = function ($r) { + $r = (object) $r; + + return $r->name; + }; + + return array_map($mapping, $results); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/QueryException.php b/application/vendor/laravel/framework/src/Illuminate/Database/QueryException.php index e3f9cf2..922570b 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/QueryException.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/QueryException.php @@ -1,78 +1,78 @@ -sql = $sql; - $this->bindings = $bindings; - $this->previous = $previous; - $this->code = $previous->getCode(); - $this->message = $this->formatMessage($sql, $bindings, $previous); + /** + * Create a new query exception instance. + * + * @param string $sql + * @param array $bindings + * @param \Exception $previous + * @return void + */ + public function __construct($sql, array $bindings, $previous) + { + parent::__construct('', 0, $previous); - if ($previous instanceof PDOException) - { - $this->errorInfo = $previous->errorInfo; - } - } + $this->sql = $sql; + $this->bindings = $bindings; + $this->previous = $previous; + $this->code = $previous->getCode(); + $this->message = $this->formatMessage($sql, $bindings, $previous); - /** - * Format the SQL error message. - * - * @param string $sql - * @param array $bindings - * @param \Exception $previous - * @return string - */ - protected function formatMessage($sql, $bindings, $previous) - { - return $previous->getMessage().' (SQL: '.str_replace_array('\?', $bindings, $sql).')'; - } + if ($previous instanceof PDOException) { + $this->errorInfo = $previous->errorInfo; + } + } - /** - * Get the SQL for the query. - * - * @return string - */ - public function getSql() - { - return $this->sql; - } + /** + * Format the SQL error message. + * + * @param string $sql + * @param array $bindings + * @param \Exception $previous + * @return string + */ + protected function formatMessage($sql, $bindings, $previous) + { + return $previous->getMessage().' (SQL: '.str_replace_array('\?', $bindings, $sql).')'; + } - /** - * Get the bindings for the query. - * - * @return array - */ - public function getBindings() - { - return $this->bindings; - } + /** + * Get the SQL for the query. + * + * @return string + */ + public function getSql() + { + return $this->sql; + } + /** + * Get the bindings for the query. + * + * @return array + */ + public function getBindings() + { + return $this->bindings; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/README.md b/application/vendor/laravel/framework/src/Illuminate/Database/README.md index 315c51a..1675a93 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/README.md +++ b/application/vendor/laravel/framework/src/Illuminate/Database/README.md @@ -12,14 +12,14 @@ use Illuminate\Database\Capsule\Manager as Capsule; $capsule = new Capsule; $capsule->addConnection([ - 'driver' => 'mysql', - 'host' => 'localhost', - 'database' => 'database', - 'username' => 'root', - 'password' => 'password', - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', + 'driver' => 'mysql', + 'host' => 'localhost', + 'database' => 'database', + 'username' => 'root', + 'password' => 'password', + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', ]); // Set the event dispatcher used by Eloquent models... (optional) @@ -53,9 +53,9 @@ $results = Capsule::select('select * from users where id = ?', array(1)); ```PHP Capsule::schema()->create('users', function($table) { - $table->increments('id'); - $table->string('email')->unique(); - $table->timestamps(); + $table->increments('id'); + $table->string('email')->unique(); + $table->timestamps(); }); ``` diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php b/application/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php index 37978ab..b32786c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php @@ -1,50 +1,51 @@ -withTablePrefix(new QueryGrammar); - } - - /** - * Get the default schema grammar instance. - * - * @return \Illuminate\Database\Schema\Grammars\SQLiteGrammar - */ - protected function getDefaultSchemaGrammar() - { - return $this->withTablePrefix(new SchemaGrammar); - } +class SQLiteConnection extends Connection +{ + /** + * Get the default query grammar instance. + * + * @return \Illuminate\Database\Query\Grammars\SQLiteGrammar + */ + protected function getDefaultQueryGrammar() + { + return $this->withTablePrefix(new QueryGrammar); + } - /** - * Get the default post processor instance. - * - * @return \Illuminate\Database\Query\Processors\Processor - */ - protected function getDefaultPostProcessor() - { - return new SQLiteProcessor; - } + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\SQLiteGrammar + */ + protected function getDefaultSchemaGrammar() + { + return $this->withTablePrefix(new SchemaGrammar); + } - /** - * Get the Doctrine DBAL driver. - * - * @return \Doctrine\DBAL\Driver\PDOSqlite\Driver - */ - protected function getDoctrineDriver() - { - return new DoctrineDriver; - } + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\SQLiteProcessor + */ + protected function getDefaultPostProcessor() + { + return new SQLiteProcessor; + } + /** + * Get the Doctrine DBAL driver. + * + * @return \Doctrine\DBAL\Driver\PDOSqlite\Driver + */ + protected function getDoctrineDriver() + { + return new DoctrineDriver; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php index 4968406..9786fcb 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php @@ -1,923 +1,1040 @@ -table = $table; - - if ( ! is_null($callback)) $callback($this); - } - - /** - * Execute the blueprint against the database. - * - * @param \Illuminate\Database\Connection $connection - * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar - * @return void - */ - public function build(Connection $connection, Grammar $grammar) - { - foreach ($this->toSql($connection, $grammar) as $statement) - { - $connection->statement($statement); - } - } - - /** - * Get the raw SQL statements for the blueprint. - * - * @param \Illuminate\Database\Connection $connection - * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar - * @return array - */ - public function toSql(Connection $connection, Grammar $grammar) - { - $this->addImpliedCommands(); - - $statements = array(); - - // Each type of command has a corresponding compiler function on the schema - // grammar which is used to build the necessary SQL statements to build - // the blueprint element, so we'll just call that compilers function. - foreach ($this->commands as $command) - { - $method = 'compile'.ucfirst($command->name); - - if (method_exists($grammar, $method)) - { - if ( ! is_null($sql = $grammar->$method($this, $command, $connection))) - { - $statements = array_merge($statements, (array) $sql); - } - } - } - - return $statements; - } - - /** - * Add the commands that are implied by the blueprint. - * - * @return void - */ - protected function addImpliedCommands() - { - if (count($this->getAddedColumns()) > 0 && ! $this->creating()) - { - array_unshift($this->commands, $this->createCommand('add')); - } - - if (count($this->getChangedColumns()) > 0 && ! $this->creating()) - { - array_unshift($this->commands, $this->createCommand('change')); - } - - $this->addFluentIndexes(); - } - - /** - * Add the index commands fluently specified on columns. - * - * @return void - */ - protected function addFluentIndexes() - { - foreach ($this->columns as $column) - { - foreach (array('primary', 'unique', 'index') as $index) - { - // If the index has been specified on the given column, but is simply - // equal to "true" (boolean), no name has been specified for this - // index, so we will simply call the index methods without one. - if ($column->$index === true) - { - $this->$index($column->name); - - continue 2; - } - - // If the index has been specified on the column and it is something - // other than boolean true, we will assume a name was provided on - // the index specification, and pass in the name to the method. - elseif (isset($column->$index)) - { - $this->$index($column->name, $column->$index); - - continue 2; - } - } - } - } - - /** - * Determine if the blueprint has a create command. - * - * @return bool - */ - protected function creating() - { - foreach ($this->commands as $command) - { - if ($command->name == 'create') return true; - } - - return false; - } - - /** - * Indicate that the table needs to be created. - * - * @return \Illuminate\Support\Fluent - */ - public function create() - { - return $this->addCommand('create'); - } - - /** - * Indicate that the table should be dropped. - * - * @return \Illuminate\Support\Fluent - */ - public function drop() - { - return $this->addCommand('drop'); - } - - /** - * Indicate that the table should be dropped if it exists. - * - * @return \Illuminate\Support\Fluent - */ - public function dropIfExists() - { - return $this->addCommand('dropIfExists'); - } - - /** - * Indicate that the given columns should be dropped. - * - * @param string|array $columns - * @return \Illuminate\Support\Fluent - */ - public function dropColumn($columns) - { - $columns = is_array($columns) ? $columns : (array) func_get_args(); - - return $this->addCommand('dropColumn', compact('columns')); - } - - /** - * Indicate that the given columns should be renamed. - * - * @param string $from - * @param string $to - * @return \Illuminate\Support\Fluent - */ - public function renameColumn($from, $to) - { - return $this->addCommand('renameColumn', compact('from', 'to')); - } - - /** - * Indicate that the given primary key should be dropped. - * - * @param string|array $index - * @return \Illuminate\Support\Fluent - */ - public function dropPrimary($index = null) - { - return $this->dropIndexCommand('dropPrimary', 'primary', $index); - } - - /** - * Indicate that the given unique key should be dropped. - * - * @param string|array $index - * @return \Illuminate\Support\Fluent - */ - public function dropUnique($index) - { - return $this->dropIndexCommand('dropUnique', 'unique', $index); - } - - /** - * Indicate that the given index should be dropped. - * - * @param string|array $index - * @return \Illuminate\Support\Fluent - */ - public function dropIndex($index) - { - return $this->dropIndexCommand('dropIndex', 'index', $index); - } - - /** - * Indicate that the given foreign key should be dropped. - * - * @param string $index - * @return \Illuminate\Support\Fluent - */ - public function dropForeign($index) - { - return $this->dropIndexCommand('dropForeign', 'foreign', $index); - } - - /** - * Indicate that the timestamp columns should be dropped. - * - * @return void - */ - public function dropTimestamps() - { - $this->dropColumn('created_at', 'updated_at'); - } - - /** - * Indicate that the soft delete column should be dropped. - * - * @return void - */ - public function dropSoftDeletes() - { - $this->dropColumn('deleted_at'); - } - - /** - * Rename the table to a given name. - * - * @param string $to - * @return \Illuminate\Support\Fluent - */ - public function rename($to) - { - return $this->addCommand('rename', compact('to')); - } - - /** - * Specify the primary key(s) for the table. - * - * @param string|array $columns - * @param string $name - * @return \Illuminate\Support\Fluent - */ - public function primary($columns, $name = null) - { - return $this->indexCommand('primary', $columns, $name); - } - - /** - * Specify a unique index for the table. - * - * @param string|array $columns - * @param string $name - * @return \Illuminate\Support\Fluent - */ - public function unique($columns, $name = null) - { - return $this->indexCommand('unique', $columns, $name); - } - - /** - * Specify an index for the table. - * - * @param string|array $columns - * @param string $name - * @return \Illuminate\Support\Fluent - */ - public function index($columns, $name = null) - { - return $this->indexCommand('index', $columns, $name); - } - - /** - * Specify a foreign key for the table. - * - * @param string|array $columns - * @param string $name - * @return \Illuminate\Support\Fluent - */ - public function foreign($columns, $name = null) - { - return $this->indexCommand('foreign', $columns, $name); - } - - /** - * Create a new auto-incrementing integer column on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function increments($column) - { - return $this->unsignedInteger($column, true); - } - - /** - * Create a new auto-incrementing big integer column on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function bigIncrements($column) - { - return $this->unsignedBigInteger($column, true); - } - - /** - * Create a new char column on the table. - * - * @param string $column - * @param int $length - * @return \Illuminate\Support\Fluent - */ - public function char($column, $length = 255) - { - return $this->addColumn('char', $column, compact('length')); - } - - /** - * Create a new string column on the table. - * - * @param string $column - * @param int $length - * @return \Illuminate\Support\Fluent - */ - public function string($column, $length = 255) - { - return $this->addColumn('string', $column, compact('length')); - } - - /** - * Create a new text column on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function text($column) - { - return $this->addColumn('text', $column); - } - - /** - * Create a new medium text column on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function mediumText($column) - { - return $this->addColumn('mediumText', $column); - } - - /** - * Create a new long text column on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function longText($column) - { - return $this->addColumn('longText', $column); - } - - /** - * Create a new integer column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @param bool $unsigned - * @return \Illuminate\Support\Fluent - */ - public function integer($column, $autoIncrement = false, $unsigned = false) - { - return $this->addColumn('integer', $column, compact('autoIncrement', 'unsigned')); - } - - /** - * Create a new big integer column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @param bool $unsigned - * @return \Illuminate\Support\Fluent - */ - public function bigInteger($column, $autoIncrement = false, $unsigned = false) - { - return $this->addColumn('bigInteger', $column, compact('autoIncrement', 'unsigned')); - } - - /** - * Create a new medium integer column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @param bool $unsigned - * @return \Illuminate\Support\Fluent - */ - public function mediumInteger($column, $autoIncrement = false, $unsigned = false) - { - return $this->addColumn('mediumInteger', $column, compact('autoIncrement', 'unsigned')); - } - - /** - * Create a new tiny integer column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @param bool $unsigned - * @return \Illuminate\Support\Fluent - */ - public function tinyInteger($column, $autoIncrement = false, $unsigned = false) - { - return $this->addColumn('tinyInteger', $column, compact('autoIncrement', 'unsigned')); - } - - /** - * Create a new small integer column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @param bool $unsigned - * @return \Illuminate\Support\Fluent - */ - public function smallInteger($column, $autoIncrement = false, $unsigned = false) - { - return $this->addColumn('smallInteger', $column, compact('autoIncrement', 'unsigned')); - } - - /** - * Create a new unsigned integer column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @return \Illuminate\Support\Fluent - */ - public function unsignedInteger($column, $autoIncrement = false) - { - return $this->integer($column, $autoIncrement, true); - } - - /** - * Create a new unsigned big integer column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @return \Illuminate\Support\Fluent - */ - public function unsignedBigInteger($column, $autoIncrement = false) - { - return $this->bigInteger($column, $autoIncrement, true); - } - - /** - * Create a new float column on the table. - * - * @param string $column - * @param int $total - * @param int $places - * @return \Illuminate\Support\Fluent - */ - public function float($column, $total = 8, $places = 2) - { - return $this->addColumn('float', $column, compact('total', 'places')); - } - - /** - * Create a new double column on the table. - * - * @param string $column - * @param int|null $total - * @param int|null $places - * @return \Illuminate\Support\Fluent - */ - public function double($column, $total = null, $places = null) - { - return $this->addColumn('double', $column, compact('total', 'places')); - } - - /** - * Create a new decimal column on the table. - * - * @param string $column - * @param int $total - * @param int $places - * @return \Illuminate\Support\Fluent - */ - public function decimal($column, $total = 8, $places = 2) - { - return $this->addColumn('decimal', $column, compact('total', 'places')); - } - - /** - * Create a new boolean column on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function boolean($column) - { - return $this->addColumn('boolean', $column); - } - - /** - * Create a new enum column on the table. - * - * @param string $column - * @param array $allowed - * @return \Illuminate\Support\Fluent - */ - public function enum($column, array $allowed) - { - return $this->addColumn('enum', $column, compact('allowed')); - } - - /** - * Create a new json column on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function json($column) - { - return $this->addColumn('json', $column); - } - - /** - * Create a new jsonb column on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function jsonb($column) - { - return $this->addColumn('jsonb', $column); - } - - /** - * Create a new date column on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function date($column) - { - return $this->addColumn('date', $column); - } - - /** - * Create a new date-time column on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function dateTime($column) - { - return $this->addColumn('dateTime', $column); - } - - /** - * Create a new date-time column (with time zone) on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function dateTimeTz($column) - { - return $this->addColumn('dateTimeTz', $column); - } - - /** - * Create a new time column on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function time($column) - { - return $this->addColumn('time', $column); - } - - /** - * Create a new time column (with time zone) on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function timeTz($column) - { - return $this->addColumn('timeTz', $column); - } - - /** - * Create a new timestamp column on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function timestamp($column) - { - return $this->addColumn('timestamp', $column); - } - - /** - * Create a new timestamp (with time zone) column on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function timestampTz($column) - { - return $this->addColumn('timestampTz', $column); - } - - /** - * Add nullable creation and update timestamps to the table. - * - * @return void - */ - public function nullableTimestamps() - { - $this->timestamp('created_at')->nullable(); - - $this->timestamp('updated_at')->nullable(); - } - - /** - * Add creation and update timestamps to the table. - * - * @return void - */ - public function timestamps() - { - $this->timestamp('created_at'); - - $this->timestamp('updated_at'); - } - - /** - * Add a "deleted at" timestamp for the table. - * - * @return \Illuminate\Support\Fluent - */ - public function softDeletes() - { - return $this->timestamp('deleted_at')->nullable(); - } - - /** - * Create a new binary column on the table. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function binary($column) - { - return $this->addColumn('binary', $column); - } - - /** - * Add the proper columns for a polymorphic table. - * - * @param string $name - * @param string|null $indexName - * @return void - */ - public function morphs($name, $indexName = null) - { - $this->unsignedInteger("{$name}_id"); - - $this->string("{$name}_type"); - - $this->index(array("{$name}_id", "{$name}_type"), $indexName); - } - - /** - * Adds the `remember_token` column to the table. - * - * @return \Illuminate\Support\Fluent - */ - public function rememberToken() - { - return $this->string('remember_token', 100)->nullable(); - } - - /** - * Create a new drop index command on the blueprint. - * - * @param string $command - * @param string $type - * @param string|array $index - * @return \Illuminate\Support\Fluent - */ - protected function dropIndexCommand($command, $type, $index) - { - $columns = array(); - - // If the given "index" is actually an array of columns, the developer means - // to drop an index merely by specifying the columns involved without the - // conventional name, so we will build the index name from the columns. - if (is_array($index)) - { - $columns = $index; - - $index = $this->createIndexName($type, $columns); - } - - return $this->indexCommand($command, $columns, $index); - } - - /** - * Add a new index command to the blueprint. - * - * @param string $type - * @param string|array $columns - * @param string $index - * @return \Illuminate\Support\Fluent - */ - protected function indexCommand($type, $columns, $index) - { - $columns = (array) $columns; - - // If no name was specified for this index, we will create one using a basic - // convention of the table name, followed by the columns, followed by an - // index type, such as primary or index, which makes the index unique. - if (is_null($index)) - { - $index = $this->createIndexName($type, $columns); - } - - return $this->addCommand($type, compact('index', 'columns')); - } - - /** - * Create a default index name for the table. - * - * @param string $type - * @param array $columns - * @return string - */ - protected function createIndexName($type, array $columns) - { - $index = strtolower($this->table.'_'.implode('_', $columns).'_'.$type); - - return str_replace(array('-', '.'), '_', $index); - } - - /** - * Add a new column to the blueprint. - * - * @param string $type - * @param string $name - * @param array $parameters - * @return \Illuminate\Support\Fluent - */ - protected function addColumn($type, $name, array $parameters = array()) - { - $attributes = array_merge(compact('type', 'name'), $parameters); - - $this->columns[] = $column = new Fluent($attributes); - - return $column; - } - - /** - * Remove a column from the schema blueprint. - * - * @param string $name - * @return $this - */ - public function removeColumn($name) - { - $this->columns = array_values(array_filter($this->columns, function($c) use ($name) - { - return $c['attributes']['name'] != $name; - })); - - return $this; - } - - /** - * Add a new command to the blueprint. - * - * @param string $name - * @param array $parameters - * @return \Illuminate\Support\Fluent - */ - protected function addCommand($name, array $parameters = array()) - { - $this->commands[] = $command = $this->createCommand($name, $parameters); - - return $command; - } - - /** - * Create a new Fluent command. - * - * @param string $name - * @param array $parameters - * @return \Illuminate\Support\Fluent - */ - protected function createCommand($name, array $parameters = array()) - { - return new Fluent(array_merge(compact('name'), $parameters)); - } - - /** - * Get the table the blueprint describes. - * - * @return string - */ - public function getTable() - { - return $this->table; - } - - /** - * Get the columns on the blueprint. - * - * @return array - */ - public function getColumns() - { - return $this->columns; - } - - /** - * Get the commands on the blueprint. - * - * @return array - */ - public function getCommands() - { - return $this->commands; - } - - /** - * Get the columns on the blueprint that should be added. - * - * @return array - */ - public function getAddedColumns() - { - return array_filter($this->columns, function($column) - { - return !$column->change; - }); - } - - /** - * Get the columns on the blueprint that should be changed. - * - * @return array - */ - public function getChangedColumns() - { - return array_filter($this->columns, function($column) - { - return !!$column->change; - }); - } - +class Blueprint +{ + /** + * The table the blueprint describes. + * + * @var string + */ + protected $table; + + /** + * The columns that should be added to the table. + * + * @var array + */ + protected $columns = []; + + /** + * The commands that should be run for the table. + * + * @var array + */ + protected $commands = []; + + /** + * The storage engine that should be used for the table. + * + * @var string + */ + public $engine; + + /** + * The default character set that should be used for the table. + */ + public $charset; + + /** + * The collation that should be used for the table. + */ + public $collation; + + /** + * Whether to make the table temporary. + * + * @var bool + */ + public $temporary = false; + + /** + * Create a new schema blueprint. + * + * @param string $table + * @param \Closure|null $callback + * @return void + */ + public function __construct($table, Closure $callback = null) + { + $this->table = $table; + + if (! is_null($callback)) { + $callback($this); + } + } + + /** + * Execute the blueprint against the database. + * + * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @return void + */ + public function build(Connection $connection, Grammar $grammar) + { + foreach ($this->toSql($connection, $grammar) as $statement) { + $connection->statement($statement); + } + } + + /** + * Get the raw SQL statements for the blueprint. + * + * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @return array + */ + public function toSql(Connection $connection, Grammar $grammar) + { + $this->addImpliedCommands(); + + $statements = []; + + // Each type of command has a corresponding compiler function on the schema + // grammar which is used to build the necessary SQL statements to build + // the blueprint element, so we'll just call that compilers function. + foreach ($this->commands as $command) { + $method = 'compile'.ucfirst($command->name); + + if (method_exists($grammar, $method)) { + if (! is_null($sql = $grammar->$method($this, $command, $connection))) { + $statements = array_merge($statements, (array) $sql); + } + } + } + + return $statements; + } + + /** + * Add the commands that are implied by the blueprint. + * + * @return void + */ + protected function addImpliedCommands() + { + if (count($this->getAddedColumns()) > 0 && ! $this->creating()) { + array_unshift($this->commands, $this->createCommand('add')); + } + + if (count($this->getChangedColumns()) > 0 && ! $this->creating()) { + array_unshift($this->commands, $this->createCommand('change')); + } + + $this->addFluentIndexes(); + } + + /** + * Add the index commands fluently specified on columns. + * + * @return void + */ + protected function addFluentIndexes() + { + foreach ($this->columns as $column) { + foreach (['primary', 'unique', 'index'] as $index) { + // If the index has been specified on the given column, but is simply + // equal to "true" (boolean), no name has been specified for this + // index, so we will simply call the index methods without one. + if ($column->$index === true) { + $this->$index($column->name); + + continue 2; + } + + // If the index has been specified on the column and it is something + // other than boolean true, we will assume a name was provided on + // the index specification, and pass in the name to the method. + elseif (isset($column->$index)) { + $this->$index($column->name, $column->$index); + + continue 2; + } + } + } + } + + /** + * Determine if the blueprint has a create command. + * + * @return bool + */ + protected function creating() + { + foreach ($this->commands as $command) { + if ($command->name == 'create') { + return true; + } + } + + return false; + } + + /** + * Indicate that the table needs to be created. + * + * @return \Illuminate\Support\Fluent + */ + public function create() + { + return $this->addCommand('create'); + } + + /** + * Indicate that the table needs to be temporary. + * + * @return void + */ + public function temporary() + { + $this->temporary = true; + } + + /** + * Indicate that the table should be dropped. + * + * @return \Illuminate\Support\Fluent + */ + public function drop() + { + return $this->addCommand('drop'); + } + + /** + * Indicate that the table should be dropped if it exists. + * + * @return \Illuminate\Support\Fluent + */ + public function dropIfExists() + { + return $this->addCommand('dropIfExists'); + } + + /** + * Indicate that the given columns should be dropped. + * + * @param array|mixed $columns + * @return \Illuminate\Support\Fluent + */ + public function dropColumn($columns) + { + $columns = is_array($columns) ? $columns : (array) func_get_args(); + + return $this->addCommand('dropColumn', compact('columns')); + } + + /** + * Indicate that the given columns should be renamed. + * + * @param string $from + * @param string $to + * @return \Illuminate\Support\Fluent + */ + public function renameColumn($from, $to) + { + return $this->addCommand('renameColumn', compact('from', 'to')); + } + + /** + * Indicate that the given primary key should be dropped. + * + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + public function dropPrimary($index = null) + { + return $this->dropIndexCommand('dropPrimary', 'primary', $index); + } + + /** + * Indicate that the given unique key should be dropped. + * + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + public function dropUnique($index) + { + return $this->dropIndexCommand('dropUnique', 'unique', $index); + } + + /** + * Indicate that the given index should be dropped. + * + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + public function dropIndex($index) + { + return $this->dropIndexCommand('dropIndex', 'index', $index); + } + + /** + * Indicate that the given foreign key should be dropped. + * + * @param string $index + * @return \Illuminate\Support\Fluent + */ + public function dropForeign($index) + { + return $this->dropIndexCommand('dropForeign', 'foreign', $index); + } + + /** + * Indicate that the timestamp columns should be dropped. + * + * @return void + */ + public function dropTimestamps() + { + $this->dropColumn('created_at', 'updated_at'); + } + + /** + * Indicate that the timestamp columns should be dropped. + * + * @return void + */ + public function dropTimestampsTz() + { + $this->dropTimestamps(); + } + + /** + * Indicate that the soft delete column should be dropped. + * + * @return void + */ + public function dropSoftDeletes() + { + $this->dropColumn('deleted_at'); + } + + /** + * Indicate that the remember token column should be dropped. + * + * @return void + */ + public function dropRememberToken() + { + $this->dropColumn('remember_token'); + } + + /** + * Rename the table to a given name. + * + * @param string $to + * @return \Illuminate\Support\Fluent + */ + public function rename($to) + { + return $this->addCommand('rename', compact('to')); + } + + /** + * Specify the primary key(s) for the table. + * + * @param string|array $columns + * @param string $name + * @return \Illuminate\Support\Fluent + */ + public function primary($columns, $name = null) + { + return $this->indexCommand('primary', $columns, $name); + } + + /** + * Specify a unique index for the table. + * + * @param string|array $columns + * @param string $name + * @return \Illuminate\Support\Fluent + */ + public function unique($columns, $name = null) + { + return $this->indexCommand('unique', $columns, $name); + } + + /** + * Specify an index for the table. + * + * @param string|array $columns + * @param string $name + * @return \Illuminate\Support\Fluent + */ + public function index($columns, $name = null) + { + return $this->indexCommand('index', $columns, $name); + } + + /** + * Specify a foreign key for the table. + * + * @param string|array $columns + * @param string $name + * @return \Illuminate\Support\Fluent + */ + public function foreign($columns, $name = null) + { + return $this->indexCommand('foreign', $columns, $name); + } + + /** + * Create a new auto-incrementing integer (4-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function increments($column) + { + return $this->unsignedInteger($column, true); + } + + /** + * Create a new auto-incrementing small integer (2-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function smallIncrements($column) + { + return $this->unsignedSmallInteger($column, true); + } + + /** + * Create a new auto-incrementing medium integer (3-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function mediumIncrements($column) + { + return $this->unsignedMediumInteger($column, true); + } + + /** + * Create a new auto-incrementing big integer (8-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function bigIncrements($column) + { + return $this->unsignedBigInteger($column, true); + } + + /** + * Create a new char column on the table. + * + * @param string $column + * @param int $length + * @return \Illuminate\Support\Fluent + */ + public function char($column, $length = 255) + { + return $this->addColumn('char', $column, compact('length')); + } + + /** + * Create a new string column on the table. + * + * @param string $column + * @param int $length + * @return \Illuminate\Support\Fluent + */ + public function string($column, $length = 255) + { + return $this->addColumn('string', $column, compact('length')); + } + + /** + * Create a new text column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function text($column) + { + return $this->addColumn('text', $column); + } + + /** + * Create a new medium text column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function mediumText($column) + { + return $this->addColumn('mediumText', $column); + } + + /** + * Create a new long text column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function longText($column) + { + return $this->addColumn('longText', $column); + } + + /** + * Create a new integer (4-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Support\Fluent + */ + public function integer($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('integer', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new tiny integer (1-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Support\Fluent + */ + public function tinyInteger($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('tinyInteger', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new small integer (2-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Support\Fluent + */ + public function smallInteger($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('smallInteger', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new medium integer (3-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Support\Fluent + */ + public function mediumInteger($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('mediumInteger', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new big integer (8-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Support\Fluent + */ + public function bigInteger($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('bigInteger', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new unsigned tiny integer (1-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Support\Fluent + */ + public function unsignedTinyInteger($column, $autoIncrement = false) + { + return $this->tinyInteger($column, $autoIncrement, true); + } + + /** + * Create a new unsigned small integer (2-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Support\Fluent + */ + public function unsignedSmallInteger($column, $autoIncrement = false) + { + return $this->smallInteger($column, $autoIncrement, true); + } + + /** + * Create a new unsigned medium integer (3-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Support\Fluent + */ + public function unsignedMediumInteger($column, $autoIncrement = false) + { + return $this->mediumInteger($column, $autoIncrement, true); + } + + /** + * Create a new unsigned integer (4-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Support\Fluent + */ + public function unsignedInteger($column, $autoIncrement = false) + { + return $this->integer($column, $autoIncrement, true); + } + + /** + * Create a new unsigned big integer (8-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Support\Fluent + */ + public function unsignedBigInteger($column, $autoIncrement = false) + { + return $this->bigInteger($column, $autoIncrement, true); + } + + /** + * Create a new float column on the table. + * + * @param string $column + * @param int $total + * @param int $places + * @return \Illuminate\Support\Fluent + */ + public function float($column, $total = 8, $places = 2) + { + return $this->addColumn('float', $column, compact('total', 'places')); + } + + /** + * Create a new double column on the table. + * + * @param string $column + * @param int|null $total + * @param int|null $places + * @return \Illuminate\Support\Fluent + */ + public function double($column, $total = null, $places = null) + { + return $this->addColumn('double', $column, compact('total', 'places')); + } + + /** + * Create a new decimal column on the table. + * + * @param string $column + * @param int $total + * @param int $places + * @return \Illuminate\Support\Fluent + */ + public function decimal($column, $total = 8, $places = 2) + { + return $this->addColumn('decimal', $column, compact('total', 'places')); + } + + /** + * Create a new boolean column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function boolean($column) + { + return $this->addColumn('boolean', $column); + } + + /** + * Create a new enum column on the table. + * + * @param string $column + * @param array $allowed + * @return \Illuminate\Support\Fluent + */ + public function enum($column, array $allowed) + { + return $this->addColumn('enum', $column, compact('allowed')); + } + + /** + * Create a new json column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function json($column) + { + return $this->addColumn('json', $column); + } + + /** + * Create a new jsonb column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function jsonb($column) + { + return $this->addColumn('jsonb', $column); + } + + /** + * Create a new date column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function date($column) + { + return $this->addColumn('date', $column); + } + + /** + * Create a new date-time column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function dateTime($column) + { + return $this->addColumn('dateTime', $column); + } + + /** + * Create a new date-time column (with time zone) on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function dateTimeTz($column) + { + return $this->addColumn('dateTimeTz', $column); + } + + /** + * Create a new time column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function time($column) + { + return $this->addColumn('time', $column); + } + + /** + * Create a new time column (with time zone) on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function timeTz($column) + { + return $this->addColumn('timeTz', $column); + } + + /** + * Create a new timestamp column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function timestamp($column) + { + return $this->addColumn('timestamp', $column); + } + + /** + * Create a new timestamp (with time zone) column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function timestampTz($column) + { + return $this->addColumn('timestampTz', $column); + } + + /** + * Add nullable creation and update timestamps to the table. + * + * @return void + */ + public function nullableTimestamps() + { + $this->timestamp('created_at')->nullable(); + + $this->timestamp('updated_at')->nullable(); + } + + /** + * Add creation and update timestamps to the table. + * + * @return void + */ + public function timestamps() + { + $this->timestamp('created_at'); + + $this->timestamp('updated_at'); + } + + /** + * Add creation and update timestampTz columns to the table. + * + * @return void + */ + public function timestampsTz() + { + $this->timestampTz('created_at'); + + $this->timestampTz('updated_at'); + } + + /** + * Add a "deleted at" timestamp for the table. + * + * @return \Illuminate\Support\Fluent + */ + public function softDeletes() + { + return $this->timestamp('deleted_at')->nullable(); + } + + /** + * Create a new binary column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function binary($column) + { + return $this->addColumn('binary', $column); + } + + /** + * Create a new uuid column on the table. + * + * @param string $column + * @return \Illuminate\Support\Fluent + */ + public function uuid($column) + { + return $this->addColumn('uuid', $column); + } + + /** + * Add the proper columns for a polymorphic table. + * + * @param string $name + * @param string|null $indexName + * @return void + */ + public function morphs($name, $indexName = null) + { + $this->unsignedInteger("{$name}_id"); + + $this->string("{$name}_type"); + + $this->index(["{$name}_id", "{$name}_type"], $indexName); + } + + /** + * Adds the `remember_token` column to the table. + * + * @return \Illuminate\Support\Fluent + */ + public function rememberToken() + { + return $this->string('remember_token', 100)->nullable(); + } + + /** + * Create a new drop index command on the blueprint. + * + * @param string $command + * @param string $type + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + protected function dropIndexCommand($command, $type, $index) + { + $columns = []; + + // If the given "index" is actually an array of columns, the developer means + // to drop an index merely by specifying the columns involved without the + // conventional name, so we will build the index name from the columns. + if (is_array($index)) { + $columns = $index; + + $index = $this->createIndexName($type, $columns); + } + + return $this->indexCommand($command, $columns, $index); + } + + /** + * Add a new index command to the blueprint. + * + * @param string $type + * @param string|array $columns + * @param string $index + * @return \Illuminate\Support\Fluent + */ + protected function indexCommand($type, $columns, $index) + { + $columns = (array) $columns; + + // If no name was specified for this index, we will create one using a basic + // convention of the table name, followed by the columns, followed by an + // index type, such as primary or index, which makes the index unique. + if (is_null($index)) { + $index = $this->createIndexName($type, $columns); + } + + return $this->addCommand($type, compact('index', 'columns')); + } + + /** + * Create a default index name for the table. + * + * @param string $type + * @param array $columns + * @return string + */ + protected function createIndexName($type, array $columns) + { + $index = strtolower($this->table.'_'.implode('_', $columns).'_'.$type); + + return str_replace(['-', '.'], '_', $index); + } + + /** + * Add a new column to the blueprint. + * + * @param string $type + * @param string $name + * @param array $parameters + * @return \Illuminate\Support\Fluent + */ + public function addColumn($type, $name, array $parameters = []) + { + $attributes = array_merge(compact('type', 'name'), $parameters); + + $this->columns[] = $column = new Fluent($attributes); + + return $column; + } + + /** + * Remove a column from the schema blueprint. + * + * @param string $name + * @return $this + */ + public function removeColumn($name) + { + $this->columns = array_values(array_filter($this->columns, function ($c) use ($name) { + return $c['attributes']['name'] != $name; + })); + + return $this; + } + + /** + * Add a new command to the blueprint. + * + * @param string $name + * @param array $parameters + * @return \Illuminate\Support\Fluent + */ + protected function addCommand($name, array $parameters = []) + { + $this->commands[] = $command = $this->createCommand($name, $parameters); + + return $command; + } + + /** + * Create a new Fluent command. + * + * @param string $name + * @param array $parameters + * @return \Illuminate\Support\Fluent + */ + protected function createCommand($name, array $parameters = []) + { + return new Fluent(array_merge(compact('name'), $parameters)); + } + + /** + * Get the table the blueprint describes. + * + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * Get the columns on the blueprint. + * + * @return array + */ + public function getColumns() + { + return $this->columns; + } + + /** + * Get the commands on the blueprint. + * + * @return array + */ + public function getCommands() + { + return $this->commands; + } + + /** + * Get the columns on the blueprint that should be added. + * + * @return array + */ + public function getAddedColumns() + { + return array_filter($this->columns, function ($column) { + return ! $column->change; + }); + } + + /** + * Get the columns on the blueprint that should be changed. + * + * @return array + */ + public function getChangedColumns() + { + return array_filter($this->columns, function ($column) { + return (bool) $column->change; + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php index cd7521d..5e10b42 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php @@ -1,242 +1,243 @@ -connection = $connection; - $this->grammar = $connection->getSchemaGrammar(); - } - - /** - * Determine if the given table exists. - * - * @param string $table - * @return bool - */ - public function hasTable($table) - { - $sql = $this->grammar->compileTableExists(); - - $table = $this->connection->getTablePrefix().$table; - - return count($this->connection->select($sql, array($table))) > 0; - } - - /** - * Determine if the given table has a given column. - * - * @param string $table - * @param string $column - * @return bool - */ - public function hasColumn($table, $column) - { - $column = strtolower($column); - - return in_array($column, array_map('strtolower', $this->getColumnListing($table))); - } - - /** - * Determine if the given table has given columns. - * - * @param string $table - * @param array $columns - * @return bool - */ - public function hasColumns($table, array $columns) - { - $tableColumns = array_map('strtolower', $this->getColumnListing($table)); - - foreach ($columns as $column) - { - if ( ! in_array(strtolower($column), $tableColumns)) return false; - } - - return true; - } - - /** - * Get the column listing for a given table. - * - * @param string $table - * @return array - */ - public function getColumnListing($table) - { - $table = $this->connection->getTablePrefix().$table; - - $results = $this->connection->select($this->grammar->compileColumnExists($table)); - - return $this->connection->getPostProcessor()->processColumnListing($results); - } - - /** - * Modify a table on the schema. - * - * @param string $table - * @param \Closure $callback - * @return \Illuminate\Database\Schema\Blueprint - */ - public function table($table, Closure $callback) - { - $this->build($this->createBlueprint($table, $callback)); - } - - /** - * Create a new table on the schema. - * - * @param string $table - * @param \Closure $callback - * @return \Illuminate\Database\Schema\Blueprint - */ - public function create($table, Closure $callback) - { - $blueprint = $this->createBlueprint($table); - - $blueprint->create(); - - $callback($blueprint); - - $this->build($blueprint); - } - - /** - * Drop a table from the schema. - * - * @param string $table - * @return \Illuminate\Database\Schema\Blueprint - */ - public function drop($table) - { - $blueprint = $this->createBlueprint($table); - - $blueprint->drop(); - - $this->build($blueprint); - } - - /** - * Drop a table from the schema if it exists. - * - * @param string $table - * @return \Illuminate\Database\Schema\Blueprint - */ - public function dropIfExists($table) - { - $blueprint = $this->createBlueprint($table); - - $blueprint->dropIfExists(); - - $this->build($blueprint); - } - - /** - * Rename a table on the schema. - * - * @param string $from - * @param string $to - * @return \Illuminate\Database\Schema\Blueprint - */ - public function rename($from, $to) - { - $blueprint = $this->createBlueprint($from); - - $blueprint->rename($to); - - $this->build($blueprint); - } - - /** - * Execute the blueprint to build / modify the table. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @return void - */ - protected function build(Blueprint $blueprint) - { - $blueprint->build($this->connection, $this->grammar); - } - - /** - * Create a new command set with a Closure. - * - * @param string $table - * @param \Closure|null $callback - * @return \Illuminate\Database\Schema\Blueprint - */ - protected function createBlueprint($table, Closure $callback = null) - { - if (isset($this->resolver)) - { - return call_user_func($this->resolver, $table, $callback); - } - - return new Blueprint($table, $callback); - } - - /** - * Get the database connection instance. - * - * @return \Illuminate\Database\Connection - */ - public function getConnection() - { - return $this->connection; - } - - /** - * Set the database connection instance. - * - * @param \Illuminate\Database\Connection - * @return $this - */ - public function setConnection(Connection $connection) - { - $this->connection = $connection; - - return $this; - } - - /** - * Set the Schema Blueprint resolver callback. - * - * @param \Closure $resolver - * @return void - */ - public function blueprintResolver(Closure $resolver) - { - $this->resolver = $resolver; - } - +class Builder +{ + /** + * The database connection instance. + * + * @var \Illuminate\Database\Connection + */ + protected $connection; + + /** + * The schema grammar instance. + * + * @var \Illuminate\Database\Schema\Grammars\Grammar + */ + protected $grammar; + + /** + * The Blueprint resolver callback. + * + * @var \Closure + */ + protected $resolver; + + /** + * Create a new database Schema manager. + * + * @param \Illuminate\Database\Connection $connection + * @return void + */ + public function __construct(Connection $connection) + { + $this->connection = $connection; + $this->grammar = $connection->getSchemaGrammar(); + } + + /** + * Determine if the given table exists. + * + * @param string $table + * @return bool + */ + public function hasTable($table) + { + $sql = $this->grammar->compileTableExists(); + + $table = $this->connection->getTablePrefix().$table; + + return count($this->connection->select($sql, [$table])) > 0; + } + + /** + * Determine if the given table has a given column. + * + * @param string $table + * @param string $column + * @return bool + */ + public function hasColumn($table, $column) + { + $column = strtolower($column); + + return in_array($column, array_map('strtolower', $this->getColumnListing($table))); + } + + /** + * Determine if the given table has given columns. + * + * @param string $table + * @param array $columns + * @return bool + */ + public function hasColumns($table, array $columns) + { + $tableColumns = array_map('strtolower', $this->getColumnListing($table)); + + foreach ($columns as $column) { + if (! in_array(strtolower($column), $tableColumns)) { + return false; + } + } + + return true; + } + + /** + * Get the column listing for a given table. + * + * @param string $table + * @return array + */ + public function getColumnListing($table) + { + $table = $this->connection->getTablePrefix().$table; + + $results = $this->connection->select($this->grammar->compileColumnExists($table)); + + return $this->connection->getPostProcessor()->processColumnListing($results); + } + + /** + * Modify a table on the schema. + * + * @param string $table + * @param \Closure $callback + * @return \Illuminate\Database\Schema\Blueprint + */ + public function table($table, Closure $callback) + { + $this->build($this->createBlueprint($table, $callback)); + } + + /** + * Create a new table on the schema. + * + * @param string $table + * @param \Closure $callback + * @return \Illuminate\Database\Schema\Blueprint + */ + public function create($table, Closure $callback) + { + $blueprint = $this->createBlueprint($table); + + $blueprint->create(); + + $callback($blueprint); + + $this->build($blueprint); + } + + /** + * Drop a table from the schema. + * + * @param string $table + * @return \Illuminate\Database\Schema\Blueprint + */ + public function drop($table) + { + $blueprint = $this->createBlueprint($table); + + $blueprint->drop(); + + $this->build($blueprint); + } + + /** + * Drop a table from the schema if it exists. + * + * @param string $table + * @return \Illuminate\Database\Schema\Blueprint + */ + public function dropIfExists($table) + { + $blueprint = $this->createBlueprint($table); + + $blueprint->dropIfExists(); + + $this->build($blueprint); + } + + /** + * Rename a table on the schema. + * + * @param string $from + * @param string $to + * @return \Illuminate\Database\Schema\Blueprint + */ + public function rename($from, $to) + { + $blueprint = $this->createBlueprint($from); + + $blueprint->rename($to); + + $this->build($blueprint); + } + + /** + * Execute the blueprint to build / modify the table. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return void + */ + protected function build(Blueprint $blueprint) + { + $blueprint->build($this->connection, $this->grammar); + } + + /** + * Create a new command set with a Closure. + * + * @param string $table + * @param \Closure|null $callback + * @return \Illuminate\Database\Schema\Blueprint + */ + protected function createBlueprint($table, Closure $callback = null) + { + if (isset($this->resolver)) { + return call_user_func($this->resolver, $table, $callback); + } + + return new Blueprint($table, $callback); + } + + /** + * Get the database connection instance. + * + * @return \Illuminate\Database\Connection + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Set the database connection instance. + * + * @param \Illuminate\Database\Connection $connection + * @return $this + */ + public function setConnection(Connection $connection) + { + $this->connection = $connection; + + return $this; + } + + /** + * Set the Schema Blueprint resolver callback. + * + * @param \Closure $resolver + * @return void + */ + public function blueprintResolver(Closure $resolver) + { + $this->resolver = $resolver; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php index 5857daa..9dbc170 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php @@ -1,5 +1,8 @@ -getDoctrineSchemaManager(); - - $table = $this->getTablePrefix().$blueprint->getTable(); - - $column = $connection->getDoctrineColumn($table, $command->from); - - $tableDiff = $this->getRenamedDiff($blueprint, $command, $column, $schema); - - return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff); - } - - /** - * Get a new column instance with the new column name. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @param \Doctrine\DBAL\Schema\Column $column - * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema - * @return \Doctrine\DBAL\Schema\TableDiff - */ - protected function getRenamedDiff(Blueprint $blueprint, Fluent $command, Column $column, SchemaManager $schema) - { - $tableDiff = $this->getDoctrineTableDiff($blueprint, $schema); - - return $this->setRenamedColumns($tableDiff, $command, $column); - } - - /** - * Set the renamed columns on the table diff. - * - * @param \Doctrine\DBAL\Schema\TableDiff $tableDiff - * @param \Illuminate\Support\Fluent $command - * @param \Doctrine\DBAL\Schema\Column $column - * @return \Doctrine\DBAL\Schema\TableDiff - */ - protected function setRenamedColumns(TableDiff $tableDiff, Fluent $command, Column $column) - { - $newColumn = new Column($command->to, $column->getType(), $column->toArray()); - - $tableDiff->renamedColumns = array($command->from => $newColumn); - - return $tableDiff; - } - - /** - * Compile a foreign key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileForeign(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - $on = $this->wrapTable($command->on); - - // We need to prepare several of the elements of the foreign key definition - // before we can create the SQL, such as wrapping the tables and convert - // an array of columns to comma-delimited strings for the SQL queries. - $columns = $this->columnize($command->columns); - - $onColumns = $this->columnize((array) $command->references); - - $sql = "alter table {$table} add constraint {$command->index} "; - - $sql .= "foreign key ({$columns}) references {$on} ({$onColumns})"; - - // Once we have the basic foreign key creation statement constructed we can - // build out the syntax for what should happen on an update or delete of - // the affected columns, which will get something like "cascade", etc. - if ( ! is_null($command->onDelete)) - { - $sql .= " on delete {$command->onDelete}"; - } - - if ( ! is_null($command->onUpdate)) - { - $sql .= " on update {$command->onUpdate}"; - } - - return $sql; - } - - /** - * Compile the blueprint's column definitions. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @return array - */ - protected function getColumns(Blueprint $blueprint) - { - $columns = array(); - - foreach ($blueprint->getAddedColumns() as $column) - { - // Each of the column types have their own compiler functions which are tasked - // with turning the column definition into its SQL format for this platform - // used by the connection. The column's modifiers are compiled and added. - $sql = $this->wrap($column).' '.$this->getType($column); - - $columns[] = $this->addModifiers($sql, $blueprint, $column); - } - - return $columns; - } - - /** - * Add the column modifiers to the definition. - * - * @param string $sql - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function addModifiers($sql, Blueprint $blueprint, Fluent $column) - { - foreach ($this->modifiers as $modifier) - { - if (method_exists($this, $method = "modify{$modifier}")) - { - $sql .= $this->{$method}($blueprint, $column); - } - } - - return $sql; - } - - /** - * Get the primary key command if it exists on the blueprint. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param string $name - * @return \Illuminate\Support\Fluent|null - */ - protected function getCommandByName(Blueprint $blueprint, $name) - { - $commands = $this->getCommandsByName($blueprint, $name); - - if (count($commands) > 0) - { - return reset($commands); - } - } - - /** - * Get all of the commands with a given name. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param string $name - * @return array - */ - protected function getCommandsByName(Blueprint $blueprint, $name) - { - return array_filter($blueprint->getCommands(), function($value) use ($name) - { - return $value->name == $name; - }); - } - - /** - * Get the SQL for the column data type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function getType(Fluent $column) - { - return $this->{"type".ucfirst($column->type)}($column); - } - - /** - * Add a prefix to an array of values. - * - * @param string $prefix - * @param array $values - * @return array - */ - public function prefixArray($prefix, array $values) - { - return array_map(function($value) use ($prefix) - { - return $prefix.' '.$value; - - }, $values); - } - - /** - * Wrap a table in keyword identifiers. - * - * @param mixed $table - * @return string - */ - public function wrapTable($table) - { - if ($table instanceof Blueprint) $table = $table->getTable(); - - return parent::wrapTable($table); - } - - /** - * {@inheritdoc} - */ - public function wrap($value, $prefixAlias = false) - { - if ($value instanceof Fluent) $value = $value->name; - - return parent::wrap($value, $prefixAlias); - } - - /** - * Format a value so that it can be used in "default" clauses. - * - * @param mixed $value - * @return string - */ - protected function getDefaultValue($value) - { - if ($value instanceof Expression) return $value; - - if (is_bool($value)) return "'".(int) $value."'"; - - return "'".strval($value)."'"; - } - - /** - * Create an empty Doctrine DBAL TableDiff from the Blueprint. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema - * @return \Doctrine\DBAL\Schema\TableDiff - */ - protected function getDoctrineTableDiff(Blueprint $blueprint, SchemaManager $schema) - { - $table = $this->getTablePrefix().$blueprint->getTable(); - - $tableDiff = new TableDiff($table); - - $tableDiff->fromTable = $schema->listTableDetails($table); - - return $tableDiff; - } - - /** - * Compile a change column command into a series of SQL statements. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @param \Illuminate\Database\Connection $connection - * @return array - */ - public function compileChange(Blueprint $blueprint, Fluent $command, Connection $connection) - { - $schema = $connection->getDoctrineSchemaManager(); - - $tableDiff = $this->getChangedDiff($blueprint, $schema); - - if ($tableDiff !== false) - { - return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff); - } - - return []; - } - - /** - * Get the Doctrine table difference for the given changes. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema - * @return \Doctrine\DBAL\Schema\TableDiff|bool - */ - protected function getChangedDiff(Blueprint $blueprint, SchemaManager $schema) - { - $table = $schema->listTableDetails($this->getTablePrefix().$blueprint->getTable()); - - return (new Comparator)->diffTable($table, $this->getTableWithColumnChanges($blueprint, $table)); - } - - /** - * Get a copy of the given Doctrine table after making the column changes. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Doctrine\DBAL\Schema\Table $table - * @return \Doctrine\DBAL\Schema\TableDiff - */ - protected function getTableWithColumnChanges(Blueprint $blueprint, Table $table) - { - $table = clone $table; - - foreach($blueprint->getChangedColumns() as $fluent) - { - $column = $this->getDoctrineColumnForChange($table, $fluent); - - // Here we will spin through each fluent column definition and map it to the proper - // Doctrine column definitions, which is necessasry because Laravel and Doctrine - // use some different terminology for various column attributes on the tables. - foreach ($fluent->getAttributes() as $key => $value) - { - if ( ! is_null($option = $this->mapFluentOptionToDoctrine($key))) - { - if (method_exists($column, $method = 'set'.ucfirst($option))) - { - $column->{$method}($this->mapFluentValueToDoctrine($option, $value)); - } - } - } - } - - return $table; - } - - /** - * Get the Doctrine column instance for a column change. - * - * @param \Doctrine\DBAL\Schema\Table $table - * @param \Illuminate\Support\Fluent $fluent - * @return \Doctrine\DBAL\Schema\Column - */ - protected function getDoctrineColumnForChange(Table $table, Fluent $fluent) - { - return $table->changeColumn( - $fluent['name'], $this->getDoctrineColumnChangeOptions($fluent) - )->getColumn($fluent['name']); - } - - /** - * Get the Doctrine column change options. - * - * @param \Illuminate\Support\Fluent $fluent - * @return array - */ - protected function getDoctrineColumnChangeOptions(Fluent $fluent) - { - $options = ['type' => $this->getDoctrineColumnType($fluent['type'])]; - - if (in_array($fluent['type'], ['text', 'mediumText', 'longText'])) - { - $options['length'] = $this->calculateDoctrineTextLength($fluent['type']); - } - - return $options; - } - - /** - * Get the doctrine column type. - * - * @param string $type - * @return \Doctrine\DBAL\Types\Type - */ - protected function getDoctrineColumnType($type) - { - $type = strtolower($type); - - switch ($type) { - case 'biginteger': - $type = 'bigint'; - break; - case 'smallinteger': - $type = 'smallint'; - break; - case 'mediumtext': - case 'longtext': - $type = 'text'; - break; - } - - return Type::getType($type); - } - - /** - * Calculate the proper column length to force the Doctrine text type. - * - * @param string $type - * @return int - */ - protected function calculateDoctrineTextLength($type) - { - switch ($type) - { - case 'mediumText': - return 65535 + 1; - - case 'longText': - return 16777215 + 1; - - default: - return 255 + 1; - } - } - - /** - * Get the matching Doctrine option for a given Fluent attribute name. - * - * @param string $attribute - * @return string - */ - protected function mapFluentOptionToDoctrine($attribute) - { - switch($attribute) - { - case 'type': - case 'name': - return; - - case 'nullable': - return 'notnull'; - - case 'total': - return 'precision'; - - case 'places': - return 'scale'; - - default: - return $attribute; - } - } - - /** - * Get the matching Doctrine value for a given Fluent attribute. - * - * @param string $option - * @param mixed $value - * @return mixed - */ - protected function mapFluentValueToDoctrine($option, $value) - { - return $option == 'notnull' ? ! $value : $value; - } - +abstract class Grammar extends BaseGrammar +{ + /** + * Compile a rename column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param \Illuminate\Database\Connection $connection + * @return array + */ + public function compileRenameColumn(Blueprint $blueprint, Fluent $command, Connection $connection) + { + $schema = $connection->getDoctrineSchemaManager(); + + $table = $this->getTablePrefix().$blueprint->getTable(); + + $column = $connection->getDoctrineColumn($table, $command->from); + + $tableDiff = $this->getRenamedDiff($blueprint, $command, $column, $schema); + + return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff); + } + + /** + * Get a new column instance with the new column name. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param \Doctrine\DBAL\Schema\Column $column + * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema + * @return \Doctrine\DBAL\Schema\TableDiff + */ + protected function getRenamedDiff(Blueprint $blueprint, Fluent $command, Column $column, SchemaManager $schema) + { + $tableDiff = $this->getDoctrineTableDiff($blueprint, $schema); + + return $this->setRenamedColumns($tableDiff, $command, $column); + } + + /** + * Set the renamed columns on the table diff. + * + * @param \Doctrine\DBAL\Schema\TableDiff $tableDiff + * @param \Illuminate\Support\Fluent $command + * @param \Doctrine\DBAL\Schema\Column $column + * @return \Doctrine\DBAL\Schema\TableDiff + */ + protected function setRenamedColumns(TableDiff $tableDiff, Fluent $command, Column $column) + { + $newColumn = new Column($command->to, $column->getType(), $column->toArray()); + + $tableDiff->renamedColumns = [$command->from => $newColumn]; + + return $tableDiff; + } + + /** + * Compile a foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileForeign(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + $on = $this->wrapTable($command->on); + + // We need to prepare several of the elements of the foreign key definition + // before we can create the SQL, such as wrapping the tables and convert + // an array of columns to comma-delimited strings for the SQL queries. + $columns = $this->columnize($command->columns); + + $onColumns = $this->columnize((array) $command->references); + + $sql = "alter table {$table} add constraint {$command->index} "; + + $sql .= "foreign key ({$columns}) references {$on} ({$onColumns})"; + + // Once we have the basic foreign key creation statement constructed we can + // build out the syntax for what should happen on an update or delete of + // the affected columns, which will get something like "cascade", etc. + if (! is_null($command->onDelete)) { + $sql .= " on delete {$command->onDelete}"; + } + + if (! is_null($command->onUpdate)) { + $sql .= " on update {$command->onUpdate}"; + } + + return $sql; + } + + /** + * Compile the blueprint's column definitions. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return array + */ + protected function getColumns(Blueprint $blueprint) + { + $columns = []; + + foreach ($blueprint->getAddedColumns() as $column) { + // Each of the column types have their own compiler functions which are tasked + // with turning the column definition into its SQL format for this platform + // used by the connection. The column's modifiers are compiled and added. + $sql = $this->wrap($column).' '.$this->getType($column); + + $columns[] = $this->addModifiers($sql, $blueprint, $column); + } + + return $columns; + } + + /** + * Add the column modifiers to the definition. + * + * @param string $sql + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function addModifiers($sql, Blueprint $blueprint, Fluent $column) + { + foreach ($this->modifiers as $modifier) { + if (method_exists($this, $method = "modify{$modifier}")) { + $sql .= $this->{$method}($blueprint, $column); + } + } + + return $sql; + } + + /** + * Get the primary key command if it exists on the blueprint. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param string $name + * @return \Illuminate\Support\Fluent|null + */ + protected function getCommandByName(Blueprint $blueprint, $name) + { + $commands = $this->getCommandsByName($blueprint, $name); + + if (count($commands) > 0) { + return reset($commands); + } + } + + /** + * Get all of the commands with a given name. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param string $name + * @return array + */ + protected function getCommandsByName(Blueprint $blueprint, $name) + { + return array_filter($blueprint->getCommands(), function ($value) use ($name) { + return $value->name == $name; + }); + } + + /** + * Get the SQL for the column data type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function getType(Fluent $column) + { + return $this->{'type'.ucfirst($column->type)}($column); + } + + /** + * Add a prefix to an array of values. + * + * @param string $prefix + * @param array $values + * @return array + */ + public function prefixArray($prefix, array $values) + { + return array_map(function ($value) use ($prefix) { + return $prefix.' '.$value; + }, $values); + } + + /** + * Wrap a table in keyword identifiers. + * + * @param mixed $table + * @return string + */ + public function wrapTable($table) + { + if ($table instanceof Blueprint) { + $table = $table->getTable(); + } + + return parent::wrapTable($table); + } + + /** + * {@inheritdoc} + */ + public function wrap($value, $prefixAlias = false) + { + if ($value instanceof Fluent) { + $value = $value->name; + } + + return parent::wrap($value, $prefixAlias); + } + + /** + * Format a value so that it can be used in "default" clauses. + * + * @param mixed $value + * @return string + */ + protected function getDefaultValue($value) + { + if ($value instanceof Expression) { + return $value; + } + + if (is_bool($value)) { + return "'".(int) $value."'"; + } + + return "'".strval($value)."'"; + } + + /** + * Create an empty Doctrine DBAL TableDiff from the Blueprint. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema + * @return \Doctrine\DBAL\Schema\TableDiff + */ + protected function getDoctrineTableDiff(Blueprint $blueprint, SchemaManager $schema) + { + $table = $this->getTablePrefix().$blueprint->getTable(); + + $tableDiff = new TableDiff($table); + + $tableDiff->fromTable = $schema->listTableDetails($table); + + return $tableDiff; + } + + /** + * Compile a change column command into a series of SQL statements. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param \Illuminate\Database\Connection $connection + * @return array + */ + public function compileChange(Blueprint $blueprint, Fluent $command, Connection $connection) + { + if (! $connection->isDoctrineAvailable()) { + throw new RuntimeException(sprintf( + 'Changing columns for table "%s" requires Doctrine DBAL; install "doctrine/dbal".', + $blueprint->getTable() + )); + } + + $schema = $connection->getDoctrineSchemaManager(); + + $tableDiff = $this->getChangedDiff($blueprint, $schema); + + if ($tableDiff !== false) { + return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff); + } + + return []; + } + + /** + * Get the Doctrine table difference for the given changes. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema + * @return \Doctrine\DBAL\Schema\TableDiff|bool + */ + protected function getChangedDiff(Blueprint $blueprint, SchemaManager $schema) + { + $table = $schema->listTableDetails($this->getTablePrefix().$blueprint->getTable()); + + return (new Comparator)->diffTable($table, $this->getTableWithColumnChanges($blueprint, $table)); + } + + /** + * Get a copy of the given Doctrine table after making the column changes. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Doctrine\DBAL\Schema\Table $table + * @return \Doctrine\DBAL\Schema\TableDiff + */ + protected function getTableWithColumnChanges(Blueprint $blueprint, Table $table) + { + $table = clone $table; + + foreach ($blueprint->getChangedColumns() as $fluent) { + $column = $this->getDoctrineColumnForChange($table, $fluent); + + // Here we will spin through each fluent column definition and map it to the proper + // Doctrine column definitions - which is necessary because Laravel and Doctrine + // use some different terminology for various column attributes on the tables. + foreach ($fluent->getAttributes() as $key => $value) { + if (! is_null($option = $this->mapFluentOptionToDoctrine($key))) { + if (method_exists($column, $method = 'set'.ucfirst($option))) { + $column->{$method}($this->mapFluentValueToDoctrine($option, $value)); + } + } + } + } + + return $table; + } + + /** + * Get the Doctrine column instance for a column change. + * + * @param \Doctrine\DBAL\Schema\Table $table + * @param \Illuminate\Support\Fluent $fluent + * @return \Doctrine\DBAL\Schema\Column + */ + protected function getDoctrineColumnForChange(Table $table, Fluent $fluent) + { + return $table->changeColumn( + $fluent['name'], $this->getDoctrineColumnChangeOptions($fluent) + )->getColumn($fluent['name']); + } + + /** + * Get the Doctrine column change options. + * + * @param \Illuminate\Support\Fluent $fluent + * @return array + */ + protected function getDoctrineColumnChangeOptions(Fluent $fluent) + { + $options = ['type' => $this->getDoctrineColumnType($fluent['type'])]; + + if (in_array($fluent['type'], ['text', 'mediumText', 'longText'])) { + $options['length'] = $this->calculateDoctrineTextLength($fluent['type']); + } + + return $options; + } + + /** + * Get the doctrine column type. + * + * @param string $type + * @return \Doctrine\DBAL\Types\Type + */ + protected function getDoctrineColumnType($type) + { + $type = strtolower($type); + + switch ($type) { + case 'biginteger': + $type = 'bigint'; + break; + case 'smallinteger': + $type = 'smallint'; + break; + case 'mediumtext': + case 'longtext': + $type = 'text'; + break; + } + + return Type::getType($type); + } + + /** + * Calculate the proper column length to force the Doctrine text type. + * + * @param string $type + * @return int + */ + protected function calculateDoctrineTextLength($type) + { + switch ($type) { + case 'mediumText': + return 65535 + 1; + case 'longText': + return 16777215 + 1; + default: + return 255 + 1; + } + } + + /** + * Get the matching Doctrine option for a given Fluent attribute name. + * + * @param string $attribute + * @return string|null + */ + protected function mapFluentOptionToDoctrine($attribute) + { + switch ($attribute) { + case 'type': + case 'name': + return; + case 'nullable': + return 'notnull'; + case 'total': + return 'precision'; + case 'places': + return 'scale'; + default: + return $attribute; + } + } + + /** + * Get the matching Doctrine value for a given Fluent attribute. + * + * @param string $option + * @param mixed $value + * @return mixed + */ + protected function mapFluentValueToDoctrine($option, $value) + { + return $option == 'notnull' ? ! $value : $value; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php index 014dd8a..3687882 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php @@ -1,652 +1,721 @@ -getColumns($blueprint)); - - $sql = 'create table '.$this->wrapTable($blueprint)." ($columns)"; - - // Once we have the primary SQL, we can add the encoding option to the SQL for - // the table. Then, we can check if a storage engine has been supplied for - // the table. If so, we will add the engine declaration to the SQL query. - $sql = $this->compileCreateEncoding($sql, $connection); - - if (isset($blueprint->engine)) - { - $sql .= ' engine = '.$blueprint->engine; - } - - return $sql; - } - - /** - * Append the character set specifications to a command. - * - * @param string $sql - * @param \Illuminate\Database\Connection $connection - * @return string - */ - protected function compileCreateEncoding($sql, Connection $connection) - { - if ( ! is_null($charset = $connection->getConfig('charset'))) - { - $sql .= ' default character set '.$charset; - } - - if ( ! is_null($collation = $connection->getConfig('collation'))) - { - $sql .= ' collate '.$collation; - } - - return $sql; - } - - /** - * Compile an add column command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileAdd(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - $columns = $this->prefixArray('add', $this->getColumns($blueprint)); - - return 'alter table '.$table.' '.implode(', ', $columns); - } - - /** - * Compile a primary key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compilePrimary(Blueprint $blueprint, Fluent $command) - { - $command->name(null); - - return $this->compileKey($blueprint, $command, 'primary key'); - } - - /** - * Compile a unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileUnique(Blueprint $blueprint, Fluent $command) - { - return $this->compileKey($blueprint, $command, 'unique'); - } - - /** - * Compile a plain index key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileIndex(Blueprint $blueprint, Fluent $command) - { - return $this->compileKey($blueprint, $command, 'index'); - } - - /** - * Compile an index creation command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @param string $type - * @return string - */ - protected function compileKey(Blueprint $blueprint, Fluent $command, $type) - { - $columns = $this->columnize($command->columns); - - $table = $this->wrapTable($blueprint); - - return "alter table {$table} add {$type} {$command->index}($columns)"; - } - - /** - * Compile a drop table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDrop(Blueprint $blueprint, Fluent $command) - { - return 'drop table '.$this->wrapTable($blueprint); - } - - /** - * Compile a drop table (if exists) command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIfExists(Blueprint $blueprint, Fluent $command) - { - return 'drop table if exists '.$this->wrapTable($blueprint); - } - - /** - * Compile a drop column command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropColumn(Blueprint $blueprint, Fluent $command) - { - $columns = $this->prefixArray('drop', $this->wrapArray($command->columns)); - - $table = $this->wrapTable($blueprint); - - return 'alter table '.$table.' '.implode(', ', $columns); - } - - /** - * Compile a drop primary key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropPrimary(Blueprint $blueprint, Fluent $command) - { - return 'alter table '.$this->wrapTable($blueprint).' drop primary key'; - } - - /** - * Compile a drop unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropUnique(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - return "alter table {$table} drop index {$command->index}"; - } - - /** - * Compile a drop index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIndex(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - return "alter table {$table} drop index {$command->index}"; - } - - /** - * Compile a drop foreign key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropForeign(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - return "alter table {$table} drop foreign key {$command->index}"; - } - - /** - * Compile a rename table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileRename(Blueprint $blueprint, Fluent $command) - { - $from = $this->wrapTable($blueprint); - - return "rename table {$from} to ".$this->wrapTable($command->to); - } - - /** - * Create the column definition for a char type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeChar(Fluent $column) - { - return "char({$column->length})"; - } - - /** - * Create the column definition for a string type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeString(Fluent $column) - { - return "varchar({$column->length})"; - } - - /** - * Create the column definition for a text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a medium text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumText(Fluent $column) - { - return 'mediumtext'; - } - - /** - * Create the column definition for a long text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeLongText(Fluent $column) - { - return 'longtext'; - } - - /** - * Create the column definition for a big integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBigInteger(Fluent $column) - { - return 'bigint'; - } - - /** - * Create the column definition for a integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeInteger(Fluent $column) - { - return 'int'; - } - - /** - * Create the column definition for a medium integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumInteger(Fluent $column) - { - return 'mediumint'; - } - - /** - * Create the column definition for a tiny integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTinyInteger(Fluent $column) - { - return 'tinyint'; - } - - /** - * Create the column definition for a small integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeSmallInteger(Fluent $column) - { - return 'smallint'; - } - - /** - * Create the column definition for a float type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeFloat(Fluent $column) - { - return $this->typeDouble($column); - } - - /** - * Create the column definition for a double type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDouble(Fluent $column) - { - if ($column->total && $column->places) - { - return "double({$column->total}, {$column->places})"; - } - - return 'double'; - } - - /** - * Create the column definition for a decimal type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDecimal(Fluent $column) - { - return "decimal({$column->total}, {$column->places})"; - } - - /** - * Create the column definition for a boolean type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBoolean(Fluent $column) - { - return 'tinyint(1)'; - } - - /** - * Create the column definition for an enum type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeEnum(Fluent $column) - { - return "enum('".implode("', '", $column->allowed)."')"; - } - - /** - * Create the column definition for a json type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJson(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a jsonb type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJsonb(Fluent $column) - { - return "text"; - } - - /** - * Create the column definition for a date type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDate(Fluent $column) - { - return 'date'; - } - - /** - * Create the column definition for a date-time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTime(Fluent $column) - { - return 'datetime'; - } - - /** - * Create the column definition for a date-time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTimeTz(Fluent $column) - { - return 'datetime'; - } - - /** - * Create the column definition for a time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTime(Fluent $column) - { - return 'time'; - } - - /** - * Create the column definition for a time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimeTz(Fluent $column) - { - return 'time'; - } - - /** - * Create the column definition for a timestamp type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestamp(Fluent $column) - { - if ( ! $column->nullable) return 'timestamp default 0'; - - return 'timestamp'; - } - - /** - * Create the column definition for a timestamp type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestampTz(Fluent $column) - { - if ( ! $column->nullable) return 'timestamp default 0'; - - return 'timestamp'; - } - - /** - * Create the column definition for a binary type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBinary(Fluent $column) - { - return 'blob'; - } - - /** - * Get the SQL for an unsigned column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyUnsigned(Blueprint $blueprint, Fluent $column) - { - if ($column->unsigned) return ' unsigned'; - } - - /** - * Get the SQL for a nullable column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyNullable(Blueprint $blueprint, Fluent $column) - { - return $column->nullable ? ' null' : ' not null'; - } - - /** - * Get the SQL for a default column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyDefault(Blueprint $blueprint, Fluent $column) - { - if ( ! is_null($column->default)) - { - return " default ".$this->getDefaultValue($column->default); - } - } - - /** - * Get the SQL for an auto-increment column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyIncrement(Blueprint $blueprint, Fluent $column) - { - if (in_array($column->type, $this->serials) && $column->autoIncrement) - { - return ' auto_increment primary key'; - } - } - - /** - * Get the SQL for an "after" column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyAfter(Blueprint $blueprint, Fluent $column) - { - if ( ! is_null($column->after)) - { - return ' after '.$this->wrap($column->after); - } - } - - /** - * Get the SQL for an "comment" column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyComment(Blueprint $blueprint, Fluent $column) - { - if ( ! is_null($column->comment)) - { - return ' comment "'.$column->comment.'"'; - } - } - - /** - * Wrap a single string in keyword identifiers. - * - * @param string $value - * @return string - */ - protected function wrapValue($value) - { - if ($value === '*') return $value; - - return '`'.str_replace('`', '``', $value).'`'; - } - +class MySqlGrammar extends Grammar +{ + /** + * The possible column modifiers. + * + * @var array + */ + protected $modifiers = ['Unsigned', 'Charset', 'Collate', 'Nullable', 'Default', 'Increment', 'Comment', 'After', 'First']; + + /** + * The possible column serials. + * + * @var array + */ + protected $serials = ['bigInteger', 'integer', 'mediumInteger', 'smallInteger', 'tinyInteger']; + + /** + * Compile the query to determine the list of tables. + * + * @return string + */ + public function compileTableExists() + { + return 'select * from information_schema.tables where table_schema = ? and table_name = ?'; + } + + /** + * Compile the query to determine the list of columns. + * + * @return string + */ + public function compileColumnExists() + { + return 'select column_name from information_schema.columns where table_schema = ? and table_name = ?'; + } + + /** + * Compile a create table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param \Illuminate\Database\Connection $connection + * @return string + */ + public function compileCreate(Blueprint $blueprint, Fluent $command, Connection $connection) + { + $columns = implode(', ', $this->getColumns($blueprint)); + + $sql = $blueprint->temporary ? 'create temporary' : 'create'; + + $sql .= ' table '.$this->wrapTable($blueprint)." ($columns)"; + + // Once we have the primary SQL, we can add the encoding option to the SQL for + // the table. Then, we can check if a storage engine has been supplied for + // the table. If so, we will add the engine declaration to the SQL query. + $sql = $this->compileCreateEncoding($sql, $connection, $blueprint); + + if (isset($blueprint->engine)) { + $sql .= ' engine = '.$blueprint->engine; + } + + return $sql; + } + + /** + * Append the character set specifications to a command. + * + * @param string $sql + * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return string + */ + protected function compileCreateEncoding($sql, Connection $connection, Blueprint $blueprint) + { + if (isset($blueprint->charset)) { + $sql .= ' default character set '.$blueprint->charset; + } elseif (! is_null($charset = $connection->getConfig('charset'))) { + $sql .= ' default character set '.$charset; + } + + if (isset($blueprint->collation)) { + $sql .= ' collate '.$blueprint->collation; + } elseif (! is_null($collation = $connection->getConfig('collation'))) { + $sql .= ' collate '.$collation; + } + + return $sql; + } + + /** + * Compile an add column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileAdd(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + $columns = $this->prefixArray('add', $this->getColumns($blueprint)); + + return 'alter table '.$table.' '.implode(', ', $columns); + } + + /** + * Compile a primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compilePrimary(Blueprint $blueprint, Fluent $command) + { + $command->name(null); + + return $this->compileKey($blueprint, $command, 'primary key'); + } + + /** + * Compile a unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileUnique(Blueprint $blueprint, Fluent $command) + { + return $this->compileKey($blueprint, $command, 'unique'); + } + + /** + * Compile a plain index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileIndex(Blueprint $blueprint, Fluent $command) + { + return $this->compileKey($blueprint, $command, 'index'); + } + + /** + * Compile an index creation command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param string $type + * @return string + */ + protected function compileKey(Blueprint $blueprint, Fluent $command, $type) + { + $columns = $this->columnize($command->columns); + + $table = $this->wrapTable($blueprint); + + return "alter table {$table} add {$type} `{$command->index}`($columns)"; + } + + /** + * Compile a drop table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDrop(Blueprint $blueprint, Fluent $command) + { + return 'drop table '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop table (if exists) command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIfExists(Blueprint $blueprint, Fluent $command) + { + return 'drop table if exists '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropColumn(Blueprint $blueprint, Fluent $command) + { + $columns = $this->prefixArray('drop', $this->wrapArray($command->columns)); + + $table = $this->wrapTable($blueprint); + + return 'alter table '.$table.' '.implode(', ', $columns); + } + + /** + * Compile a drop primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropPrimary(Blueprint $blueprint, Fluent $command) + { + return 'alter table '.$this->wrapTable($blueprint).' drop primary key'; + } + + /** + * Compile a drop unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropUnique(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + return "alter table {$table} drop index `{$command->index}`"; + } + + /** + * Compile a drop index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIndex(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + return "alter table {$table} drop index `{$command->index}`"; + } + + /** + * Compile a drop foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropForeign(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + return "alter table {$table} drop foreign key `{$command->index}`"; + } + + /** + * Compile a rename table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRename(Blueprint $blueprint, Fluent $command) + { + $from = $this->wrapTable($blueprint); + + return "rename table {$from} to ".$this->wrapTable($command->to); + } + + /** + * Create the column definition for a char type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeChar(Fluent $column) + { + return "char({$column->length})"; + } + + /** + * Create the column definition for a string type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeString(Fluent $column) + { + return "varchar({$column->length})"; + } + + /** + * Create the column definition for a text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a medium text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumText(Fluent $column) + { + return 'mediumtext'; + } + + /** + * Create the column definition for a long text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeLongText(Fluent $column) + { + return 'longtext'; + } + + /** + * Create the column definition for a big integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBigInteger(Fluent $column) + { + return 'bigint'; + } + + /** + * Create the column definition for a integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeInteger(Fluent $column) + { + return 'int'; + } + + /** + * Create the column definition for a medium integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumInteger(Fluent $column) + { + return 'mediumint'; + } + + /** + * Create the column definition for a tiny integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTinyInteger(Fluent $column) + { + return 'tinyint'; + } + + /** + * Create the column definition for a small integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeSmallInteger(Fluent $column) + { + return 'smallint'; + } + + /** + * Create the column definition for a float type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeFloat(Fluent $column) + { + return $this->typeDouble($column); + } + + /** + * Create the column definition for a double type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDouble(Fluent $column) + { + if ($column->total && $column->places) { + return "double({$column->total}, {$column->places})"; + } + + return 'double'; + } + + /** + * Create the column definition for a decimal type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDecimal(Fluent $column) + { + return "decimal({$column->total}, {$column->places})"; + } + + /** + * Create the column definition for a boolean type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBoolean(Fluent $column) + { + return 'tinyint(1)'; + } + + /** + * Create the column definition for an enum type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeEnum(Fluent $column) + { + return "enum('".implode("', '", $column->allowed)."')"; + } + + /** + * Create the column definition for a json type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJson(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a jsonb type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJsonb(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a date type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDate(Fluent $column) + { + return 'date'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTime(Fluent $column) + { + return 'datetime'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTimeTz(Fluent $column) + { + return 'datetime'; + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTime(Fluent $column) + { + return 'time'; + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimeTz(Fluent $column) + { + return 'time'; + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestamp(Fluent $column) + { + if ($column->useCurrent) { + return 'timestamp default CURRENT_TIMESTAMP'; + } + + if (! $column->nullable && $column->default === null) { + return 'timestamp default 0'; + } + + return 'timestamp'; + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestampTz(Fluent $column) + { + if ($column->useCurrent) { + return 'timestamp default CURRENT_TIMESTAMP'; + } + + if (! $column->nullable && $column->default === null) { + return 'timestamp default 0'; + } + + return 'timestamp'; + } + + /** + * Create the column definition for a binary type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBinary(Fluent $column) + { + return 'blob'; + } + + /** + * Create the column definition for a uuid type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeUuid(Fluent $column) + { + return 'char(36)'; + } + + /** + * Get the SQL for an unsigned column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyUnsigned(Blueprint $blueprint, Fluent $column) + { + if ($column->unsigned) { + return ' unsigned'; + } + } + + /** + * Get the SQL for a character set column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyCharset(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->charset)) { + return ' character set '.$column->charset; + } + } + + /** + * Get the SQL for a collation column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyCollate(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->collation)) { + return ' collate '.$column->collation; + } + } + + /** + * Get the SQL for a nullable column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyNullable(Blueprint $blueprint, Fluent $column) + { + return $column->nullable ? ' null' : ' not null'; + } + + /** + * Get the SQL for a default column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyDefault(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->default)) { + return ' default '.$this->getDefaultValue($column->default); + } + } + + /** + * Get the SQL for an auto-increment column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyIncrement(Blueprint $blueprint, Fluent $column) + { + if (in_array($column->type, $this->serials) && $column->autoIncrement) { + return ' auto_increment primary key'; + } + } + + /** + * Get the SQL for a "first" column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyFirst(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->first)) { + return ' first'; + } + } + + /** + * Get the SQL for an "after" column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyAfter(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->after)) { + return ' after '.$this->wrap($column->after); + } + } + + /** + * Get the SQL for a "comment" column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyComment(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->comment)) { + return ' comment "'.$column->comment.'"'; + } + } + + /** + * Wrap a single string in keyword identifiers. + * + * @param string $value + * @return string + */ + protected function wrapValue($value) + { + if ($value === '*') { + return $value; + } + + return '`'.str_replace('`', '``', $value).'`'; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php index b24d99d..aad33f1 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php @@ -1,544 +1,568 @@ -getColumns($blueprint)); - - return 'create table '.$this->wrapTable($blueprint)." ($columns)"; - } - - /** - * Compile a create table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileAdd(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - $columns = $this->prefixArray('add column', $this->getColumns($blueprint)); - - return 'alter table '.$table.' '.implode(', ', $columns); - } - - /** - * Compile a primary key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compilePrimary(Blueprint $blueprint, Fluent $command) - { - $columns = $this->columnize($command->columns); - - return 'alter table '.$this->wrapTable($blueprint)." add primary key ({$columns})"; - } - - /** - * Compile a unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileUnique(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - $columns = $this->columnize($command->columns); - - return "alter table $table add constraint {$command->index} unique ($columns)"; - } - - /** - * Compile a plain index key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileIndex(Blueprint $blueprint, Fluent $command) - { - $columns = $this->columnize($command->columns); - - return "create index {$command->index} on ".$this->wrapTable($blueprint)." ({$columns})"; - } - - /** - * Compile a drop table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDrop(Blueprint $blueprint, Fluent $command) - { - return 'drop table '.$this->wrapTable($blueprint); - } - - /** - * Compile a drop table (if exists) command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIfExists(Blueprint $blueprint, Fluent $command) - { - return 'drop table if exists '.$this->wrapTable($blueprint); - } - - /** - * Compile a drop column command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropColumn(Blueprint $blueprint, Fluent $command) - { - $columns = $this->prefixArray('drop column', $this->wrapArray($command->columns)); - - $table = $this->wrapTable($blueprint); - - return 'alter table '.$table.' '.implode(', ', $columns); - } - - /** - * Compile a drop primary key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropPrimary(Blueprint $blueprint, Fluent $command) - { - $table = $blueprint->getTable(); - - return 'alter table '.$this->wrapTable($blueprint)." drop constraint {$table}_pkey"; - } - - /** - * Compile a drop unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropUnique(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - return "alter table {$table} drop constraint {$command->index}"; - } - - /** - * Compile a drop index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIndex(Blueprint $blueprint, Fluent $command) - { - return "drop index {$command->index}"; - } - - /** - * Compile a drop foreign key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropForeign(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - return "alter table {$table} drop constraint {$command->index}"; - } - - /** - * Compile a rename table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileRename(Blueprint $blueprint, Fluent $command) - { - $from = $this->wrapTable($blueprint); - - return "alter table {$from} rename to ".$this->wrapTable($command->to); - } - - /** - * Create the column definition for a char type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeChar(Fluent $column) - { - return "char({$column->length})"; - } - - /** - * Create the column definition for a string type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeString(Fluent $column) - { - return "varchar({$column->length})"; - } - - /** - * Create the column definition for a text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a medium text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a long text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeLongText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeInteger(Fluent $column) - { - return $column->autoIncrement ? 'serial' : 'integer'; - } - - /** - * Create the column definition for a big integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBigInteger(Fluent $column) - { - return $column->autoIncrement ? 'bigserial' : 'bigint'; - } - - /** - * Create the column definition for a medium integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumInteger(Fluent $column) - { - return $column->autoIncrement ? 'serial' : 'integer'; - } - - /** - * Create the column definition for a tiny integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTinyInteger(Fluent $column) - { - return $column->autoIncrement ? 'smallserial' : 'smallint'; - } - - /** - * Create the column definition for a small integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeSmallInteger(Fluent $column) - { - return $column->autoIncrement ? 'smallserial' : 'smallint'; - } - - /** - * Create the column definition for a float type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeFloat(Fluent $column) - { - return $this->typeDouble($column); - } - - /** - * Create the column definition for a double type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDouble(Fluent $column) - { - return 'double precision'; - } - - /** - * Create the column definition for a decimal type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDecimal(Fluent $column) - { - return "decimal({$column->total}, {$column->places})"; - } - - /** - * Create the column definition for a boolean type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBoolean(Fluent $column) - { - return 'boolean'; - } - - /** - * Create the column definition for an enum type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeEnum(Fluent $column) - { - $allowed = array_map(function($a) { return "'".$a."'"; }, $column->allowed); - - return "varchar(255) check (\"{$column->name}\" in (".implode(', ', $allowed)."))"; - } - - /** - * Create the column definition for a json type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJson(Fluent $column) - { - return "json"; - } - - /** - * Create the column definition for a jsonb type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJsonb(Fluent $column) - { - return "jsonb"; - } - - /** - * Create the column definition for a date type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDate(Fluent $column) - { - return 'date'; - } - - /** - * Create the column definition for a date-time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTime(Fluent $column) - { - return 'timestamp(0) without time zone'; - } - - /** - * Create the column definition for a date-time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTimeTz(Fluent $column) - { - return 'timestamp(0) with time zone'; - } - - /** - * Create the column definition for a time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTime(Fluent $column) - { - return 'time(0) without time zone'; - } - - /** - * Create the column definition for a time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimeTz(Fluent $column) - { - return 'time(0) with time zone'; - } - - /** - * Create the column definition for a timestamp type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestamp(Fluent $column) - { - return 'timestamp(0) without time zone'; - } - - /** - * Create the column definition for a timestamp type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestampTz(Fluent $column) - { - return 'timestamp(0) with time zone'; - } - - /** - * Create the column definition for a binary type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBinary(Fluent $column) - { - return 'bytea'; - } - - /** - * Get the SQL for a nullable column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyNullable(Blueprint $blueprint, Fluent $column) - { - return $column->nullable ? ' null' : ' not null'; - } - - /** - * Get the SQL for a default column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyDefault(Blueprint $blueprint, Fluent $column) - { - if ( ! is_null($column->default)) - { - return " default ".$this->getDefaultValue($column->default); - } - } - - /** - * Get the SQL for an auto-increment column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyIncrement(Blueprint $blueprint, Fluent $column) - { - if (in_array($column->type, $this->serials) && $column->autoIncrement) - { - return ' primary key'; - } - } - +class PostgresGrammar extends Grammar +{ + /** + * The possible column modifiers. + * + * @var array + */ + protected $modifiers = ['Increment', 'Nullable', 'Default']; + + /** + * The columns available as serials. + * + * @var array + */ + protected $serials = ['bigInteger', 'integer', 'mediumInteger', 'smallInteger', 'tinyInteger']; + + /** + * Compile the query to determine if a table exists. + * + * @return string + */ + public function compileTableExists() + { + return 'select * from information_schema.tables where table_schema = ? and table_name = ?'; + } + + /** + * Compile the query to determine the list of columns. + * + * @param string $table + * @return string + */ + public function compileColumnExists($table) + { + return "select column_name from information_schema.columns where table_name = '$table'"; + } + + /** + * Compile a create table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileCreate(Blueprint $blueprint, Fluent $command) + { + $columns = implode(', ', $this->getColumns($blueprint)); + + $sql = $blueprint->temporary ? 'create temporary' : 'create'; + + $sql .= ' table '.$this->wrapTable($blueprint)." ($columns)"; + + return $sql; + } + + /** + * Compile a create table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileAdd(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + $columns = $this->prefixArray('add column', $this->getColumns($blueprint)); + + return 'alter table '.$table.' '.implode(', ', $columns); + } + + /** + * Compile a primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compilePrimary(Blueprint $blueprint, Fluent $command) + { + $columns = $this->columnize($command->columns); + + return 'alter table '.$this->wrapTable($blueprint)." add primary key ({$columns})"; + } + + /** + * Compile a unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileUnique(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + $columns = $this->columnize($command->columns); + + return "alter table $table add constraint {$command->index} unique ($columns)"; + } + + /** + * Compile a plain index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileIndex(Blueprint $blueprint, Fluent $command) + { + $columns = $this->columnize($command->columns); + + return "create index {$command->index} on ".$this->wrapTable($blueprint)." ({$columns})"; + } + + /** + * Compile a drop table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDrop(Blueprint $blueprint, Fluent $command) + { + return 'drop table '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop table (if exists) command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIfExists(Blueprint $blueprint, Fluent $command) + { + return 'drop table if exists '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropColumn(Blueprint $blueprint, Fluent $command) + { + $columns = $this->prefixArray('drop column', $this->wrapArray($command->columns)); + + $table = $this->wrapTable($blueprint); + + return 'alter table '.$table.' '.implode(', ', $columns); + } + + /** + * Compile a drop primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropPrimary(Blueprint $blueprint, Fluent $command) + { + $table = $blueprint->getTable(); + + return 'alter table '.$this->wrapTable($blueprint)." drop constraint {$table}_pkey"; + } + + /** + * Compile a drop unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropUnique(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + return "alter table {$table} drop constraint {$command->index}"; + } + + /** + * Compile a drop index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIndex(Blueprint $blueprint, Fluent $command) + { + return "drop index {$command->index}"; + } + + /** + * Compile a drop foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropForeign(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + return "alter table {$table} drop constraint {$command->index}"; + } + + /** + * Compile a rename table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRename(Blueprint $blueprint, Fluent $command) + { + $from = $this->wrapTable($blueprint); + + return "alter table {$from} rename to ".$this->wrapTable($command->to); + } + + /** + * Create the column definition for a char type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeChar(Fluent $column) + { + return "char({$column->length})"; + } + + /** + * Create the column definition for a string type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeString(Fluent $column) + { + return "varchar({$column->length})"; + } + + /** + * Create the column definition for a text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a medium text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a long text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeLongText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeInteger(Fluent $column) + { + return $column->autoIncrement ? 'serial' : 'integer'; + } + + /** + * Create the column definition for a big integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBigInteger(Fluent $column) + { + return $column->autoIncrement ? 'bigserial' : 'bigint'; + } + + /** + * Create the column definition for a medium integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumInteger(Fluent $column) + { + return $column->autoIncrement ? 'serial' : 'integer'; + } + + /** + * Create the column definition for a tiny integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTinyInteger(Fluent $column) + { + return $column->autoIncrement ? 'smallserial' : 'smallint'; + } + + /** + * Create the column definition for a small integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeSmallInteger(Fluent $column) + { + return $column->autoIncrement ? 'smallserial' : 'smallint'; + } + + /** + * Create the column definition for a float type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeFloat(Fluent $column) + { + return $this->typeDouble($column); + } + + /** + * Create the column definition for a double type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDouble(Fluent $column) + { + return 'double precision'; + } + + /** + * Create the column definition for a decimal type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDecimal(Fluent $column) + { + return "decimal({$column->total}, {$column->places})"; + } + + /** + * Create the column definition for a boolean type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBoolean(Fluent $column) + { + return 'boolean'; + } + + /** + * Create the column definition for an enum type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeEnum(Fluent $column) + { + $allowed = array_map(function ($a) { + return "'".$a."'"; + }, $column->allowed); + + return "varchar(255) check (\"{$column->name}\" in (".implode(', ', $allowed).'))'; + } + + /** + * Create the column definition for a json type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJson(Fluent $column) + { + return 'json'; + } + + /** + * Create the column definition for a jsonb type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJsonb(Fluent $column) + { + return 'jsonb'; + } + + /** + * Create the column definition for a date type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDate(Fluent $column) + { + return 'date'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTime(Fluent $column) + { + return 'timestamp(0) without time zone'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTimeTz(Fluent $column) + { + return 'timestamp(0) with time zone'; + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTime(Fluent $column) + { + return 'time(0) without time zone'; + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimeTz(Fluent $column) + { + return 'time(0) with time zone'; + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestamp(Fluent $column) + { + if ($column->useCurrent) { + return 'timestamp(0) without time zone default CURRENT_TIMESTAMP(0)'; + } + + return 'timestamp(0) without time zone'; + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestampTz(Fluent $column) + { + if ($column->useCurrent) { + return 'timestamp(0) with time zone default CURRENT_TIMESTAMP(0)'; + } + + return 'timestamp(0) with time zone'; + } + + /** + * Create the column definition for a binary type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBinary(Fluent $column) + { + return 'bytea'; + } + + /** + * Create the column definition for a uuid type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeUuid(Fluent $column) + { + return 'uuid'; + } + + /** + * Get the SQL for a nullable column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyNullable(Blueprint $blueprint, Fluent $column) + { + return $column->nullable ? ' null' : ' not null'; + } + + /** + * Get the SQL for a default column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyDefault(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->default)) { + return ' default '.$this->getDefaultValue($column->default); + } + } + + /** + * Get the SQL for an auto-increment column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyIncrement(Blueprint $blueprint, Fluent $column) + { + if (in_array($column->type, $this->serials) && $column->autoIncrement) { + return ' primary key'; + } + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php index 25daa74..a257de7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php @@ -1,611 +1,625 @@ -getColumns($blueprint)); - - $sql = 'create table '.$this->wrapTable($blueprint)." ($columns"; - - // SQLite forces primary keys to be added when the table is initially created - // so we will need to check for a primary key commands and add the columns - // to the table's declaration here so they can be created on the tables. - $sql .= (string) $this->addForeignKeys($blueprint); - - $sql .= (string) $this->addPrimaryKeys($blueprint); - - return $sql.')'; - } - - /** - * Get the foreign key syntax for a table creation statement. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @return string|null - */ - protected function addForeignKeys(Blueprint $blueprint) - { - $sql = ''; - - $foreigns = $this->getCommandsByName($blueprint, 'foreign'); - - // Once we have all the foreign key commands for the table creation statement - // we'll loop through each of them and add them to the create table SQL we - // are building, since SQLite needs foreign keys on the tables creation. - foreach ($foreigns as $foreign) - { - $sql .= $this->getForeignKey($foreign); - - if ( ! is_null($foreign->onDelete)) - { - $sql .= " on delete {$foreign->onDelete}"; - } - - if ( ! is_null($foreign->onUpdate)) - { - $sql .= " on update {$foreign->onUpdate}"; - } - } - - return $sql; - } - - /** - * Get the SQL for the foreign key. - * - * @param \Illuminate\Support\Fluent $foreign - * @return string - */ - protected function getForeignKey($foreign) - { - $on = $this->wrapTable($foreign->on); - - // We need to columnize the columns that the foreign key is being defined for - // so that it is a properly formatted list. Once we have done this, we can - // return the foreign key SQL declaration to the calling method for use. - $columns = $this->columnize($foreign->columns); - - $onColumns = $this->columnize((array) $foreign->references); - - return ", foreign key($columns) references $on($onColumns)"; - } - - /** - * Get the primary key syntax for a table creation statement. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @return string|null - */ - protected function addPrimaryKeys(Blueprint $blueprint) - { - $primary = $this->getCommandByName($blueprint, 'primary'); - - if ( ! is_null($primary)) - { - $columns = $this->columnize($primary->columns); - - return ", primary key ({$columns})"; - } - } - - /** - * Compile alter table commands for adding columns. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return array - */ - public function compileAdd(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - $columns = $this->prefixArray('add column', $this->getColumns($blueprint)); - - $statements = array(); - - foreach ($columns as $column) - { - $statements[] = 'alter table '.$table.' '.$column; - } - - return $statements; - } - - /** - * Compile a unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileUnique(Blueprint $blueprint, Fluent $command) - { - $columns = $this->columnize($command->columns); - - $table = $this->wrapTable($blueprint); - - return "create unique index {$command->index} on {$table} ({$columns})"; - } - - /** - * Compile a plain index key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileIndex(Blueprint $blueprint, Fluent $command) - { - $columns = $this->columnize($command->columns); - - $table = $this->wrapTable($blueprint); - - return "create index {$command->index} on {$table} ({$columns})"; - } - - /** - * Compile a foreign key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileForeign(Blueprint $blueprint, Fluent $command) - { - // Handled on table creation... - } - - /** - * Compile a drop table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDrop(Blueprint $blueprint, Fluent $command) - { - return 'drop table '.$this->wrapTable($blueprint); - } - - /** - * Compile a drop table (if exists) command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIfExists(Blueprint $blueprint, Fluent $command) - { - return 'drop table if exists '.$this->wrapTable($blueprint); - } - - /** - * Compile a drop column command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @param \Illuminate\Database\Connection $connection - * @return array - */ - public function compileDropColumn(Blueprint $blueprint, Fluent $command, Connection $connection) - { - $schema = $connection->getDoctrineSchemaManager(); - - $tableDiff = $this->getDoctrineTableDiff($blueprint, $schema); - - foreach ($command->columns as $name) - { - $column = $connection->getDoctrineColumn($blueprint->getTable(), $name); - - $tableDiff->removedColumns[$name] = $column; - } - - return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff); - } - - /** - * Compile a drop unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropUnique(Blueprint $blueprint, Fluent $command) - { - return "drop index {$command->index}"; - } - - /** - * Compile a drop index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIndex(Blueprint $blueprint, Fluent $command) - { - return "drop index {$command->index}"; - } - - /** - * Compile a rename table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileRename(Blueprint $blueprint, Fluent $command) - { - $from = $this->wrapTable($blueprint); - - return "alter table {$from} rename to ".$this->wrapTable($command->to); - } - - /** - * Create the column definition for a char type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeChar(Fluent $column) - { - return 'varchar'; - } - - /** - * Create the column definition for a string type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeString(Fluent $column) - { - return 'varchar'; - } - - /** - * Create the column definition for a text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a medium text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a long text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeLongText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeInteger(Fluent $column) - { - return 'integer'; - } - - /** - * Create the column definition for a big integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBigInteger(Fluent $column) - { - return 'integer'; - } - - /** - * Create the column definition for a medium integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumInteger(Fluent $column) - { - return 'integer'; - } - - /** - * Create the column definition for a tiny integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTinyInteger(Fluent $column) - { - return 'integer'; - } - - /** - * Create the column definition for a small integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeSmallInteger(Fluent $column) - { - return 'integer'; - } - - /** - * Create the column definition for a float type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeFloat(Fluent $column) - { - return 'float'; - } - - /** - * Create the column definition for a double type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDouble(Fluent $column) - { - return 'float'; - } - - /** - * Create the column definition for a decimal type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDecimal(Fluent $column) - { - return 'numeric'; - } - - /** - * Create the column definition for a boolean type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBoolean(Fluent $column) - { - return 'tinyint'; - } - - /** - * Create the column definition for an enum type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeEnum(Fluent $column) - { - return 'varchar'; - } - - /** - * Create the column definition for a json type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJson(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a jsonb type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJsonb(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a date type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDate(Fluent $column) - { - return 'date'; - } - - /** - * Create the column definition for a date-time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTime(Fluent $column) - { - return 'datetime'; - } - - /** - * Create the column definition for a date-time type. - * - * Note: "SQLite does not have a storage class set aside for storing dates and/or times." - * @link https://www.sqlite.org/datatype3.html - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTimeTz(Fluent $column) - { - return 'datetime'; - } - - /** - * Create the column definition for a time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTime(Fluent $column) - { - return 'time'; - } - - /** - * Create the column definition for a time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimeTz(Fluent $column) - { - return 'time'; - } - - /** - * Create the column definition for a timestamp type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestamp(Fluent $column) - { - return 'datetime'; - } - - /** - * Create the column definition for a timestamp type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestampTz(Fluent $column) - { - return 'datetime'; - } - - /** - * Create the column definition for a binary type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBinary(Fluent $column) - { - return 'blob'; - } - - /** - * Get the SQL for a nullable column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyNullable(Blueprint $blueprint, Fluent $column) - { - return $column->nullable ? ' null' : ' not null'; - } - - /** - * Get the SQL for a default column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyDefault(Blueprint $blueprint, Fluent $column) - { - if ( ! is_null($column->default)) - { - return " default ".$this->getDefaultValue($column->default); - } - } - - /** - * Get the SQL for an auto-increment column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyIncrement(Blueprint $blueprint, Fluent $column) - { - if (in_array($column->type, $this->serials) && $column->autoIncrement) - { - return ' primary key autoincrement'; - } - } - +class SQLiteGrammar extends Grammar +{ + /** + * The possible column modifiers. + * + * @var array + */ + protected $modifiers = ['Nullable', 'Default', 'Increment']; + + /** + * The columns available as serials. + * + * @var array + */ + protected $serials = ['bigInteger', 'integer', 'mediumInteger', 'smallInteger', 'tinyInteger']; + + /** + * Compile the query to determine if a table exists. + * + * @return string + */ + public function compileTableExists() + { + return "select * from sqlite_master where type = 'table' and name = ?"; + } + + /** + * Compile the query to determine the list of columns. + * + * @param string $table + * @return string + */ + public function compileColumnExists($table) + { + return 'pragma table_info('.str_replace('.', '__', $table).')'; + } + + /** + * Compile a create table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileCreate(Blueprint $blueprint, Fluent $command) + { + $columns = implode(', ', $this->getColumns($blueprint)); + + $sql = $blueprint->temporary ? 'create temporary' : 'create'; + + $sql .= ' table '.$this->wrapTable($blueprint)." ($columns"; + + // SQLite forces primary keys to be added when the table is initially created + // so we will need to check for a primary key commands and add the columns + // to the table's declaration here so they can be created on the tables. + $sql .= (string) $this->addForeignKeys($blueprint); + + $sql .= (string) $this->addPrimaryKeys($blueprint); + + return $sql.')'; + } + + /** + * Get the foreign key syntax for a table creation statement. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return string|null + */ + protected function addForeignKeys(Blueprint $blueprint) + { + $sql = ''; + + $foreigns = $this->getCommandsByName($blueprint, 'foreign'); + + // Once we have all the foreign key commands for the table creation statement + // we'll loop through each of them and add them to the create table SQL we + // are building, since SQLite needs foreign keys on the tables creation. + foreach ($foreigns as $foreign) { + $sql .= $this->getForeignKey($foreign); + + if (! is_null($foreign->onDelete)) { + $sql .= " on delete {$foreign->onDelete}"; + } + + if (! is_null($foreign->onUpdate)) { + $sql .= " on update {$foreign->onUpdate}"; + } + } + + return $sql; + } + + /** + * Get the SQL for the foreign key. + * + * @param \Illuminate\Support\Fluent $foreign + * @return string + */ + protected function getForeignKey($foreign) + { + $on = $this->wrapTable($foreign->on); + + // We need to columnize the columns that the foreign key is being defined for + // so that it is a properly formatted list. Once we have done this, we can + // return the foreign key SQL declaration to the calling method for use. + $columns = $this->columnize($foreign->columns); + + $onColumns = $this->columnize((array) $foreign->references); + + return ", foreign key($columns) references $on($onColumns)"; + } + + /** + * Get the primary key syntax for a table creation statement. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return string|null + */ + protected function addPrimaryKeys(Blueprint $blueprint) + { + $primary = $this->getCommandByName($blueprint, 'primary'); + + if (! is_null($primary)) { + $columns = $this->columnize($primary->columns); + + return ", primary key ({$columns})"; + } + } + + /** + * Compile alter table commands for adding columns. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return array + */ + public function compileAdd(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + $columns = $this->prefixArray('add column', $this->getColumns($blueprint)); + + $statements = []; + + foreach ($columns as $column) { + $statements[] = 'alter table '.$table.' '.$column; + } + + return $statements; + } + + /** + * Compile a unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileUnique(Blueprint $blueprint, Fluent $command) + { + $columns = $this->columnize($command->columns); + + $table = $this->wrapTable($blueprint); + + return "create unique index {$command->index} on {$table} ({$columns})"; + } + + /** + * Compile a plain index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileIndex(Blueprint $blueprint, Fluent $command) + { + $columns = $this->columnize($command->columns); + + $table = $this->wrapTable($blueprint); + + return "create index {$command->index} on {$table} ({$columns})"; + } + + /** + * Compile a foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileForeign(Blueprint $blueprint, Fluent $command) + { + // Handled on table creation... + } + + /** + * Compile a drop table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDrop(Blueprint $blueprint, Fluent $command) + { + return 'drop table '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop table (if exists) command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIfExists(Blueprint $blueprint, Fluent $command) + { + return 'drop table if exists '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param \Illuminate\Database\Connection $connection + * @return array + */ + public function compileDropColumn(Blueprint $blueprint, Fluent $command, Connection $connection) + { + $schema = $connection->getDoctrineSchemaManager(); + + $tableDiff = $this->getDoctrineTableDiff($blueprint, $schema); + + foreach ($command->columns as $name) { + $column = $connection->getDoctrineColumn($blueprint->getTable(), $name); + + $tableDiff->removedColumns[$name] = $column; + } + + return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff); + } + + /** + * Compile a drop unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropUnique(Blueprint $blueprint, Fluent $command) + { + return "drop index {$command->index}"; + } + + /** + * Compile a drop index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIndex(Blueprint $blueprint, Fluent $command) + { + return "drop index {$command->index}"; + } + + /** + * Compile a rename table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRename(Blueprint $blueprint, Fluent $command) + { + $from = $this->wrapTable($blueprint); + + return "alter table {$from} rename to ".$this->wrapTable($command->to); + } + + /** + * Create the column definition for a char type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeChar(Fluent $column) + { + return 'varchar'; + } + + /** + * Create the column definition for a string type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeString(Fluent $column) + { + return 'varchar'; + } + + /** + * Create the column definition for a text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a medium text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a long text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeLongText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a big integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBigInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a medium integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a tiny integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTinyInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a small integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeSmallInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a float type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeFloat(Fluent $column) + { + return 'float'; + } + + /** + * Create the column definition for a double type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDouble(Fluent $column) + { + return 'float'; + } + + /** + * Create the column definition for a decimal type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDecimal(Fluent $column) + { + return 'numeric'; + } + + /** + * Create the column definition for a boolean type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBoolean(Fluent $column) + { + return 'tinyint(1)'; + } + + /** + * Create the column definition for an enum type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeEnum(Fluent $column) + { + return 'varchar'; + } + + /** + * Create the column definition for a json type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJson(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a jsonb type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJsonb(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a date type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDate(Fluent $column) + { + return 'date'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTime(Fluent $column) + { + return 'datetime'; + } + + /** + * Create the column definition for a date-time type. + * + * Note: "SQLite does not have a storage class set aside for storing dates and/or times." + * @link https://www.sqlite.org/datatype3.html + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTimeTz(Fluent $column) + { + return 'datetime'; + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTime(Fluent $column) + { + return 'time'; + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimeTz(Fluent $column) + { + return 'time'; + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestamp(Fluent $column) + { + if ($column->useCurrent) { + return 'datetime default CURRENT_TIMESTAMP'; + } + + return 'datetime'; + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestampTz(Fluent $column) + { + if ($column->useCurrent) { + return 'datetime default CURRENT_TIMESTAMP'; + } + + return 'datetime'; + } + + /** + * Create the column definition for a binary type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBinary(Fluent $column) + { + return 'blob'; + } + + /** + * Create the column definition for a uuid type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeUuid(Fluent $column) + { + return 'varchar'; + } + + /** + * Get the SQL for a nullable column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyNullable(Blueprint $blueprint, Fluent $column) + { + return $column->nullable ? ' null' : ' not null'; + } + + /** + * Get the SQL for a default column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyDefault(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->default)) { + return ' default '.$this->getDefaultValue($column->default); + } + } + + /** + * Get the SQL for an auto-increment column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyIncrement(Blueprint $blueprint, Fluent $column) + { + if (in_array($column->type, $this->serials) && $column->autoIncrement) { + return ' primary key autoincrement'; + } + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php index 49f94f1..ba5d245 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php @@ -1,552 +1,570 @@ -getColumns($blueprint)); - - return 'create table '.$this->wrapTable($blueprint)." ($columns)"; - } - - /** - * Compile a create table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileAdd(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - $columns = $this->getColumns($blueprint); - - return 'alter table '.$table.' add '.implode(', ', $columns); - } - - /** - * Compile a primary key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compilePrimary(Blueprint $blueprint, Fluent $command) - { - $columns = $this->columnize($command->columns); - - $table = $this->wrapTable($blueprint); - - return "alter table {$table} add constraint {$command->index} primary key ({$columns})"; - } - - /** - * Compile a unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileUnique(Blueprint $blueprint, Fluent $command) - { - $columns = $this->columnize($command->columns); - - $table = $this->wrapTable($blueprint); - - return "create unique index {$command->index} on {$table} ({$columns})"; - } - - /** - * Compile a plain index key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileIndex(Blueprint $blueprint, Fluent $command) - { - $columns = $this->columnize($command->columns); - - $table = $this->wrapTable($blueprint); - - return "create index {$command->index} on {$table} ({$columns})"; - } - - /** - * Compile a drop table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDrop(Blueprint $blueprint, Fluent $command) - { - return 'drop table '.$this->wrapTable($blueprint); - } - - /** - * Compile a drop table (if exists) command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIfExists(Blueprint $blueprint, Fluent $command) - { - return 'if exists (select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = \''.$blueprint->getTable().'\') drop table '.$blueprint->getTable(); - } - - /** - * Compile a drop column command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropColumn(Blueprint $blueprint, Fluent $command) - { - $columns = $this->wrapArray($command->columns); - - $table = $this->wrapTable($blueprint); - - return 'alter table '.$table.' drop column '.implode(', ', $columns); - } - - /** - * Compile a drop primary key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropPrimary(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - return "alter table {$table} drop constraint {$command->index}"; - } - - /** - * Compile a drop unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropUnique(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - return "drop index {$command->index} on {$table}"; - } - - /** - * Compile a drop index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIndex(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - return "drop index {$command->index} on {$table}"; - } - - /** - * Compile a drop foreign key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropForeign(Blueprint $blueprint, Fluent $command) - { - $table = $this->wrapTable($blueprint); - - return "alter table {$table} drop constraint {$command->index}"; - } - - /** - * Compile a rename table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileRename(Blueprint $blueprint, Fluent $command) - { - $from = $this->wrapTable($blueprint); - - return "sp_rename {$from}, ".$this->wrapTable($command->to); - } - - /** - * Create the column definition for a char type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeChar(Fluent $column) - { - return "nchar({$column->length})"; - } - - /** - * Create the column definition for a string type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeString(Fluent $column) - { - return "nvarchar({$column->length})"; - } - - /** - * Create the column definition for a text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeText(Fluent $column) - { - return 'nvarchar(max)'; - } - - /** - * Create the column definition for a medium text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumText(Fluent $column) - { - return 'nvarchar(max)'; - } - - /** - * Create the column definition for a long text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeLongText(Fluent $column) - { - return 'nvarchar(max)'; - } - - /** - * Create the column definition for a integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeInteger(Fluent $column) - { - return 'int'; - } - - /** - * Create the column definition for a big integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBigInteger(Fluent $column) - { - return 'bigint'; - } - - /** - * Create the column definition for a medium integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumInteger(Fluent $column) - { - return 'int'; - } - - /** - * Create the column definition for a tiny integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTinyInteger(Fluent $column) - { - return 'tinyint'; - } - - /** - * Create the column definition for a small integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeSmallInteger(Fluent $column) - { - return 'smallint'; - } - - /** - * Create the column definition for a float type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeFloat(Fluent $column) - { - return 'float'; - } - - /** - * Create the column definition for a double type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDouble(Fluent $column) - { - return 'float'; - } - - /** - * Create the column definition for a decimal type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDecimal(Fluent $column) - { - return "decimal({$column->total}, {$column->places})"; - } - - /** - * Create the column definition for a boolean type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBoolean(Fluent $column) - { - return 'bit'; - } - - /** - * Create the column definition for an enum type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeEnum(Fluent $column) - { - return 'nvarchar(255)'; - } - - /** - * Create the column definition for a json type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJson(Fluent $column) - { - return 'nvarchar(max)'; - } - - /** - * Create the column definition for a jsonb type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJsonb(Fluent $column) - { - return 'nvarchar(max)'; - } - - /** - * Create the column definition for a date type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDate(Fluent $column) - { - return 'date'; - } - - /** - * Create the column definition for a date-time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTime(Fluent $column) - { - return 'datetime'; - } - - /** - * Create the column definition for a date-time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTimeTz(Fluent $column) - { - return 'datetimeoffset(0)'; - } - - /** - * Create the column definition for a time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTime(Fluent $column) - { - return 'time'; - } - - /** - * Create the column definition for a time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimeTz(Fluent $column) - { - return 'time'; - } - - /** - * Create the column definition for a timestamp type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestamp(Fluent $column) - { - return 'datetime'; - } - - /** - * Create the column definition for a timestamp type. - * - * @link https://msdn.microsoft.com/en-us/library/bb630289(v=sql.120).aspx - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestampTz(Fluent $column) - { - return 'datetimeoffset(0)'; - } - - /** - * Create the column definition for a binary type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBinary(Fluent $column) - { - return 'varbinary(max)'; - } - - /** - * Get the SQL for a nullable column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyNullable(Blueprint $blueprint, Fluent $column) - { - return $column->nullable ? ' null' : ' not null'; - } - - /** - * Get the SQL for a default column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyDefault(Blueprint $blueprint, Fluent $column) - { - if ( ! is_null($column->default)) - { - return " default ".$this->getDefaultValue($column->default); - } - } - - /** - * Get the SQL for an auto-increment column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyIncrement(Blueprint $blueprint, Fluent $column) - { - if (in_array($column->type, $this->serials) && $column->autoIncrement) - { - return ' identity primary key'; - } - } - + } + + /** + * Compile a create table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileCreate(Blueprint $blueprint, Fluent $command) + { + $columns = implode(', ', $this->getColumns($blueprint)); + + return 'create table '.$this->wrapTable($blueprint)." ($columns)"; + } + + /** + * Compile a create table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileAdd(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + $columns = $this->getColumns($blueprint); + + return 'alter table '.$table.' add '.implode(', ', $columns); + } + + /** + * Compile a primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compilePrimary(Blueprint $blueprint, Fluent $command) + { + $columns = $this->columnize($command->columns); + + $table = $this->wrapTable($blueprint); + + return "alter table {$table} add constraint {$command->index} primary key ({$columns})"; + } + + /** + * Compile a unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileUnique(Blueprint $blueprint, Fluent $command) + { + $columns = $this->columnize($command->columns); + + $table = $this->wrapTable($blueprint); + + return "create unique index {$command->index} on {$table} ({$columns})"; + } + + /** + * Compile a plain index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileIndex(Blueprint $blueprint, Fluent $command) + { + $columns = $this->columnize($command->columns); + + $table = $this->wrapTable($blueprint); + + return "create index {$command->index} on {$table} ({$columns})"; + } + + /** + * Compile a drop table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDrop(Blueprint $blueprint, Fluent $command) + { + return 'drop table '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop table (if exists) command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIfExists(Blueprint $blueprint, Fluent $command) + { + return 'if exists (select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = \''.$blueprint->getTable().'\') drop table '.$blueprint->getTable(); + } + + /** + * Compile a drop column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropColumn(Blueprint $blueprint, Fluent $command) + { + $columns = $this->wrapArray($command->columns); + + $table = $this->wrapTable($blueprint); + + return 'alter table '.$table.' drop column '.implode(', ', $columns); + } + + /** + * Compile a drop primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropPrimary(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + return "alter table {$table} drop constraint {$command->index}"; + } + + /** + * Compile a drop unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropUnique(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + return "drop index {$command->index} on {$table}"; + } + + /** + * Compile a drop index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIndex(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + return "drop index {$command->index} on {$table}"; + } + + /** + * Compile a drop foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropForeign(Blueprint $blueprint, Fluent $command) + { + $table = $this->wrapTable($blueprint); + + return "alter table {$table} drop constraint {$command->index}"; + } + + /** + * Compile a rename table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRename(Blueprint $blueprint, Fluent $command) + { + $from = $this->wrapTable($blueprint); + + return "sp_rename {$from}, ".$this->wrapTable($command->to); + } + + /** + * Create the column definition for a char type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeChar(Fluent $column) + { + return "nchar({$column->length})"; + } + + /** + * Create the column definition for a string type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeString(Fluent $column) + { + return "nvarchar({$column->length})"; + } + + /** + * Create the column definition for a text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeText(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for a medium text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumText(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for a long text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeLongText(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for a integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeInteger(Fluent $column) + { + return 'int'; + } + + /** + * Create the column definition for a big integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBigInteger(Fluent $column) + { + return 'bigint'; + } + + /** + * Create the column definition for a medium integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumInteger(Fluent $column) + { + return 'int'; + } + + /** + * Create the column definition for a tiny integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTinyInteger(Fluent $column) + { + return 'tinyint'; + } + + /** + * Create the column definition for a small integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeSmallInteger(Fluent $column) + { + return 'smallint'; + } + + /** + * Create the column definition for a float type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeFloat(Fluent $column) + { + return 'float'; + } + + /** + * Create the column definition for a double type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDouble(Fluent $column) + { + return 'float'; + } + + /** + * Create the column definition for a decimal type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDecimal(Fluent $column) + { + return "decimal({$column->total}, {$column->places})"; + } + + /** + * Create the column definition for a boolean type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBoolean(Fluent $column) + { + return 'bit'; + } + + /** + * Create the column definition for an enum type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeEnum(Fluent $column) + { + return 'nvarchar(255)'; + } + + /** + * Create the column definition for a json type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJson(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for a jsonb type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJsonb(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for a date type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDate(Fluent $column) + { + return 'date'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTime(Fluent $column) + { + return 'datetime'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTimeTz(Fluent $column) + { + return 'datetimeoffset(0)'; + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTime(Fluent $column) + { + return 'time'; + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimeTz(Fluent $column) + { + return 'time'; + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestamp(Fluent $column) + { + if ($column->useCurrent) { + return 'datetime default CURRENT_TIMESTAMP'; + } + + return 'datetime'; + } + + /** + * Create the column definition for a timestamp type. + * + * @link https://msdn.microsoft.com/en-us/library/bb630289(v=sql.120).aspx + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestampTz(Fluent $column) + { + if ($column->useCurrent) { + return 'datetimeoffset(0) default CURRENT_TIMESTAMP'; + } + + return 'datetimeoffset(0)'; + } + + /** + * Create the column definition for a binary type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBinary(Fluent $column) + { + return 'varbinary(max)'; + } + + /** + * Create the column definition for a uuid type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeUuid(Fluent $column) + { + return 'uniqueidentifier'; + } + + /** + * Get the SQL for a nullable column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyNullable(Blueprint $blueprint, Fluent $column) + { + return $column->nullable ? ' null' : ' not null'; + } + + /** + * Get the SQL for a default column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyDefault(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->default)) { + return ' default '.$this->getDefaultValue($column->default); + } + } + + /** + * Get the SQL for an auto-increment column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyIncrement(Blueprint $blueprint, Fluent $column) + { + if (in_array($column->type, $this->serials) && $column->autoIncrement) { + return ' identity primary key'; + } + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php index 7472681..e0b0ade 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php @@ -1,41 +1,42 @@ -grammar->compileTableExists(); +class MySqlBuilder extends Builder +{ + /** + * Determine if the given table exists. + * + * @param string $table + * @return bool + */ + public function hasTable($table) + { + $sql = $this->grammar->compileTableExists(); - $database = $this->connection->getDatabaseName(); + $database = $this->connection->getDatabaseName(); - $table = $this->connection->getTablePrefix().$table; + $table = $this->connection->getTablePrefix().$table; - return count($this->connection->select($sql, array($database, $table))) > 0; - } + return count($this->connection->select($sql, [$database, $table])) > 0; + } - /** - * Get the column listing for a given table. - * - * @param string $table - * @return array - */ - public function getColumnListing($table) - { - $sql = $this->grammar->compileColumnExists(); + /** + * Get the column listing for a given table. + * + * @param string $table + * @return array + */ + public function getColumnListing($table) + { + $sql = $this->grammar->compileColumnExists(); - $database = $this->connection->getDatabaseName(); + $database = $this->connection->getDatabaseName(); - $table = $this->connection->getTablePrefix().$table; + $table = $this->connection->getTablePrefix().$table; - $results = $this->connection->select($sql, array($database, $table)); - - return $this->connection->getPostProcessor()->processColumnListing($results); - } + $results = $this->connection->select($sql, [$database, $table]); + return $this->connection->getPostProcessor()->processColumnListing($results); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Schema/PostgresBuilder.php b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/PostgresBuilder.php new file mode 100644 index 0000000..da3fd60 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Schema/PostgresBuilder.php @@ -0,0 +1,25 @@ +grammar->compileTableExists(); + + $schema = $this->connection->getConfig('schema'); + + $schema = $schema ? $schema : 'public'; + + $table = $this->connection->getTablePrefix().$table; + + return count($this->connection->select($sql, [$schema, $table])) > 0; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/SeedServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Database/SeedServiceProvider.php index 26fe80c..3a97cde 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/SeedServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/SeedServiceProvider.php @@ -1,55 +1,69 @@ -registerSeedCommand(); - - $this->app->singleton('seeder', function() - { - return new Seeder; - }); - - $this->commands('command.seed'); - } - - /** - * Register the seed console command. - * - * @return void - */ - protected function registerSeedCommand() - { - $this->app->singleton('command.seed', function($app) - { - return new SeedCommand($app['db']); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array('seeder', 'command.seed'); - } +use Illuminate\Database\Console\Seeds\SeedCommand; +use Illuminate\Database\Console\Seeds\SeederMakeCommand; + +class SeedServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerSeedCommand(); + + $this->registerMakeCommand(); + + $this->app->singleton('seeder', function () { + return new Seeder; + }); + + $this->commands('command.seed', 'command.seeder.make'); + } + + /** + * Register the seed console command. + * + * @return void + */ + protected function registerSeedCommand() + { + $this->app->singleton('command.seed', function ($app) { + return new SeedCommand($app['db']); + }); + } + + /** + * Register the seeder generator command. + * + * @return void + */ + protected function registerMakeCommand() + { + $this->app->singleton('command.seeder.make', function ($app) { + return new SeederMakeCommand($app['files'], $app['composer']); + }); + } + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['seeder', 'command.seed', 'command.seeder.make']; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/Seeder.php b/application/vendor/laravel/framework/src/Illuminate/Database/Seeder.php index 7fe4c6b..4e29c16 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/Seeder.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/Seeder.php @@ -1,101 +1,97 @@ -resolve($class)->run(); - - if (isset($this->command)) - { - $this->command->getOutput()->writeln("Seeded: $class"); - } - } - - /** - * Resolve an instance of the given seeder class. - * - * @param string $class - * @return \Illuminate\Database\Seeder - */ - protected function resolve($class) - { - if (isset($this->container)) - { - $instance = $this->container->make($class); - - $instance->setContainer($this->container); - } - else - { - $instance = new $class; - } - - if (isset($this->command)) - { - $instance->setCommand($this->command); - } - - return $instance; - } - - /** - * Set the IoC container instance. - * - * @param \Illuminate\Container\Container $container - * @return $this - */ - public function setContainer(Container $container) - { - $this->container = $container; - - return $this; - } - - /** - * Set the console command instance. - * - * @param \Illuminate\Console\Command $command - * @return $this - */ - public function setCommand(Command $command) - { - $this->command = $command; - - return $this; - } - +class Seeder +{ + /** + * The container instance. + * + * @var \Illuminate\Container\Container + */ + protected $container; + + /** + * The console command instance. + * + * @var \Illuminate\Console\Command + */ + protected $command; + + /** + * Run the database seeds. + * + * @return void + */ + public function run() + { + // + } + + /** + * Seed the given connection from the given path. + * + * @param string $class + * @return void + */ + public function call($class) + { + $this->resolve($class)->run(); + + if (isset($this->command)) { + $this->command->getOutput()->writeln("Seeded: $class"); + } + } + + /** + * Resolve an instance of the given seeder class. + * + * @param string $class + * @return \Illuminate\Database\Seeder + */ + protected function resolve($class) + { + if (isset($this->container)) { + $instance = $this->container->make($class); + + $instance->setContainer($this->container); + } else { + $instance = new $class; + } + + if (isset($this->command)) { + $instance->setCommand($this->command); + } + + return $instance; + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Container\Container $container + * @return $this + */ + public function setContainer(Container $container) + { + $this->container = $container; + + return $this; + } + + /** + * Set the console command instance. + * + * @param \Illuminate\Console\Command $command + * @return $this + */ + public function setCommand(Command $command) + { + $this->command = $command; + + return $this; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php b/application/vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php index 523f759..fa097e2 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php +++ b/application/vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php @@ -1,92 +1,95 @@ -getDriverName() == 'sqlsrv') - { - return parent::transaction($callback); - } +class SqlServerConnection extends Connection +{ + /** + * Execute a Closure within a transaction. + * + * @param \Closure $callback + * @return mixed + * + * @throws \Throwable + */ + public function transaction(Closure $callback) + { + if ($this->getDriverName() == 'sqlsrv') { + return parent::transaction($callback); + } - $this->pdo->exec('BEGIN TRAN'); + $this->pdo->exec('BEGIN TRAN'); - // We'll simply execute the given callback within a try / catch block - // and if we catch any exception we can rollback the transaction - // so that none of the changes are persisted to the database. - try - { - $result = $callback($this); + // We'll simply execute the given callback within a try / catch block + // and if we catch any exception we can rollback the transaction + // so that none of the changes are persisted to the database. + try { + $result = $callback($this); - $this->pdo->exec('COMMIT TRAN'); - } + $this->pdo->exec('COMMIT TRAN'); + } - // If we catch an exception, we will roll back so nothing gets messed - // up in the database. Then we'll re-throw the exception so it can - // be handled how the developer sees fit for their applications. - catch (Exception $e) - { - $this->pdo->exec('ROLLBACK TRAN'); + // If we catch an exception, we will roll back so nothing gets messed + // up in the database. Then we'll re-throw the exception so it can + // be handled how the developer sees fit for their applications. + catch (Exception $e) { + $this->pdo->exec('ROLLBACK TRAN'); - throw $e; - } + throw $e; + } catch (Throwable $e) { + $this->pdo->exec('ROLLBACK TRAN'); - return $result; - } + throw $e; + } - /** - * Get the default query grammar instance. - * - * @return \Illuminate\Database\Query\Grammars\SqlServerGrammar - */ - protected function getDefaultQueryGrammar() - { - return $this->withTablePrefix(new QueryGrammar); - } + return $result; + } - /** - * Get the default schema grammar instance. - * - * @return \Illuminate\Database\Schema\Grammars\SqlServerGrammar - */ - protected function getDefaultSchemaGrammar() - { - return $this->withTablePrefix(new SchemaGrammar); - } + /** + * Get the default query grammar instance. + * + * @return \Illuminate\Database\Query\Grammars\SqlServerGrammar + */ + protected function getDefaultQueryGrammar() + { + return $this->withTablePrefix(new QueryGrammar); + } - /** - * Get the default post processor instance. - * - * @return \Illuminate\Database\Query\Processors\Processor - */ - protected function getDefaultPostProcessor() - { - return new SqlServerProcessor; - } + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\SqlServerGrammar + */ + protected function getDefaultSchemaGrammar() + { + return $this->withTablePrefix(new SchemaGrammar); + } - /** - * Get the Doctrine DBAL Driver. - * - * @return \Doctrine\DBAL\Driver\PDOSqlsrv\Driver - */ - protected function getDoctrineDriver() - { - return new DoctrineDriver; - } + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\SqlServerProcessor + */ + protected function getDefaultPostProcessor() + { + return new SqlServerProcessor; + } + /** + * Get the Doctrine DBAL driver. + * + * @return \Doctrine\DBAL\Driver\PDOSqlsrv\Driver + */ + protected function getDoctrineDriver() + { + return new DoctrineDriver; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Database/composer.json b/application/vendor/laravel/framework/src/Illuminate/Database/composer.json index ac8320c..26c462a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Database/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Database/composer.json @@ -15,11 +15,11 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/container": "5.0.*", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*", - "nesbot/carbon": "~1.0" + "php": ">=5.5.9", + "illuminate/container": "5.1.*", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*", + "nesbot/carbon": "~1.19" }, "autoload": { "psr-4": { @@ -28,14 +28,16 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "suggest": { "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).", - "illuminate/console": "Required to use the database commands (5.0.*).", - "illuminate/events": "Required to use the observers with Eloquent (5.0.*).", - "illuminate/filesystem": "Required to use the migrations (5.0.*)." + "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", + "illuminate/console": "Required to use the database commands (5.1.*).", + "illuminate/events": "Required to use the observers with Eloquent (5.1.*).", + "illuminate/filesystem": "Required to use the migrations (5.1.*).", + "illuminate/pagination": "Required to paginate the result set (5.1.*)." }, "minimum-stability": "dev" } diff --git a/application/vendor/laravel/framework/src/Illuminate/Encryption/BaseEncrypter.php b/application/vendor/laravel/framework/src/Illuminate/Encryption/BaseEncrypter.php new file mode 100644 index 0000000..1d427af --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Encryption/BaseEncrypter.php @@ -0,0 +1,82 @@ +key); + } + + /** + * Get the JSON array from the given payload. + * + * @param string $payload + * @return array + * + * @throws \Illuminate\Contracts\Encryption\DecryptException + */ + protected function getJsonPayload($payload) + { + $payload = json_decode(base64_decode($payload), true); + + // If the payload is not valid JSON or does not have the proper keys set we will + // assume it is invalid and bail out of the routine since we will not be able + // to decrypt the given value. We'll also check the MAC for this encryption. + if (! $payload || $this->invalidPayload($payload)) { + throw new DecryptException('The payload is invalid.'); + } + + if (! $this->validMac($payload)) { + throw new DecryptException('The MAC is invalid.'); + } + + return $payload; + } + + /** + * Verify that the encryption payload is valid. + * + * @param array|mixed $data + * @return bool + */ + protected function invalidPayload($data) + { + return ! is_array($data) || ! isset($data['iv']) || ! isset($data['value']) || ! isset($data['mac']); + } + + /** + * Determine if the MAC for the given payload is valid. + * + * @param array $payload + * @return bool + * + * @throws \RuntimeException + */ + protected function validMac(array $payload) + { + $bytes = Str::randomBytes(16); + + $calcMac = hash_hmac('sha256', $this->hash($payload['iv'], $payload['value']), $bytes, true); + + return Str::equals(hash_hmac('sha256', $payload['mac'], $bytes, true), $calcMac); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php b/application/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php index 7d5544c..71a0ddc 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php +++ b/application/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php @@ -1,306 +1,119 @@ -key = (string) $key; - } - - /** - * Encrypt the given value. - * - * @param string $value - * @return string - */ - public function encrypt($value) - { - $iv = mcrypt_create_iv($this->getIvSize(), $this->getRandomizer()); - - $value = base64_encode($this->padAndMcrypt($value, $iv)); - - // Once we have the encrypted value we will go ahead base64_encode the input - // vector and create the MAC for the encrypted value so we can verify its - // authenticity. Then, we'll JSON encode the data in a "payload" array. - $mac = $this->hash($iv = base64_encode($iv), $value); - - return base64_encode(json_encode(compact('iv', 'value', 'mac'))); - } - - /** - * Pad and use mcrypt on the given value and input vector. - * - * @param string $value - * @param string $iv - * @return string - */ - protected function padAndMcrypt($value, $iv) - { - $value = $this->addPadding(serialize($value)); - - return mcrypt_encrypt($this->cipher, $this->key, $value, $this->mode, $iv); - } - - /** - * Decrypt the given value. - * - * @param string $payload - * @return string - */ - public function decrypt($payload) - { - $payload = $this->getJsonPayload($payload); - - // We'll go ahead and remove the PKCS7 padding from the encrypted value before - // we decrypt it. Once we have the de-padded value, we will grab the vector - // and decrypt the data, passing back the unserialized from of the value. - $value = base64_decode($payload['value']); - - $iv = base64_decode($payload['iv']); - - return unserialize($this->stripPadding($this->mcryptDecrypt($value, $iv))); - } - - /** - * Run the mcrypt decryption routine for the value. - * - * @param string $value - * @param string $iv - * @return string - * - * @throws \Exception - */ - protected function mcryptDecrypt($value, $iv) - { - try - { - return mcrypt_decrypt($this->cipher, $this->key, $value, $this->mode, $iv); - } - catch (Exception $e) - { - throw new DecryptException($e->getMessage()); - } - } - - /** - * Get the JSON array from the given payload. - * - * @param string $payload - * @return array - * - * @throws \Illuminate\Contracts\Encryption\DecryptException - */ - protected function getJsonPayload($payload) - { - $payload = json_decode(base64_decode($payload), true); - - // If the payload is not valid JSON or does not have the proper keys set we will - // assume it is invalid and bail out of the routine since we will not be able - // to decrypt the given value. We'll also check the MAC for this encryption. - if ( ! $payload || $this->invalidPayload($payload)) - { - throw new DecryptException('Invalid data.'); - } - - if ( ! $this->validMac($payload)) - { - throw new DecryptException('MAC is invalid.'); - } - - return $payload; - } - - /** - * Determine if the MAC for the given payload is valid. - * - * @param array $payload - * @return bool - * - * @throws \RuntimeException - */ - protected function validMac(array $payload) - { - $bytes = (new SecureRandom)->nextBytes(16); - - $calcMac = hash_hmac('sha256', $this->hash($payload['iv'], $payload['value']), $bytes, true); - - return StringUtils::equals(hash_hmac('sha256', $payload['mac'], $bytes, true), $calcMac); - } - - /** - * Create a MAC for the given value. - * - * @param string $iv - * @param string $value - * @return string - */ - protected function hash($iv, $value) - { - return hash_hmac('sha256', $iv.$value, $this->key); - } - - /** - * Add PKCS7 padding to a given value. - * - * @param string $value - * @return string - */ - protected function addPadding($value) - { - $pad = $this->block - (strlen($value) % $this->block); - - return $value.str_repeat(chr($pad), $pad); - } - - /** - * Remove the padding from the given value. - * - * @param string $value - * @return string - */ - protected function stripPadding($value) - { - $pad = ord($value[($len = strlen($value)) - 1]); - - return $this->paddingIsValid($pad, $value) ? substr($value, 0, $len - $pad) : $value; - } - - /** - * Determine if the given padding for a value is valid. - * - * @param string $pad - * @param string $value - * @return bool - */ - protected function paddingIsValid($pad, $value) - { - $beforePad = strlen($value) - $pad; - - return substr($value, $beforePad) == str_repeat(substr($value, -1), $pad); - } - - /** - * Verify that the encryption payload is valid. - * - * @param array|mixed $data - * @return bool - */ - protected function invalidPayload($data) - { - return ! is_array($data) || ! isset($data['iv']) || ! isset($data['value']) || ! isset($data['mac']); - } - - /** - * Get the IV size for the cipher. - * - * @return int - */ - protected function getIvSize() - { - return mcrypt_get_iv_size($this->cipher, $this->mode); - } - - /** - * Get the random data source available for the OS. - * - * @return int - */ - protected function getRandomizer() - { - if (defined('MCRYPT_DEV_URANDOM')) return MCRYPT_DEV_URANDOM; - - if (defined('MCRYPT_DEV_RANDOM')) return MCRYPT_DEV_RANDOM; - - mt_srand(); - - return MCRYPT_RAND; - } - - /** - * Set the encryption key. - * - * @param string $key - * @return void - */ - public function setKey($key) - { - $this->key = (string) $key; - } - - /** - * Set the encryption cipher. - * - * @param string $cipher - * @return void - */ - public function setCipher($cipher) - { - $this->cipher = $cipher; - - $this->updateBlockSize(); - } - - /** - * Set the encryption mode. - * - * @param string $mode - * @return void - */ - public function setMode($mode) - { - $this->mode = $mode; - - $this->updateBlockSize(); - } - - /** - * Update the block size for the current cipher and mode. - * - * @return void - */ - protected function updateBlockSize() - { - $this->block = mcrypt_get_iv_size($this->cipher, $this->mode); - } - +class Encrypter extends BaseEncrypter implements EncrypterContract +{ + /** + * The algorithm used for encryption. + * + * @var string + */ + protected $cipher; + + /** + * Create a new encrypter instance. + * + * @param string $key + * @param string $cipher + * @return void + * + * @throws \RuntimeException + */ + public function __construct($key, $cipher = 'AES-128-CBC') + { + $key = (string) $key; + + if (static::supported($key, $cipher)) { + $this->key = $key; + $this->cipher = $cipher; + } else { + throw new RuntimeException('The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.'); + } + } + + /** + * Determine if the given key and cipher combination is valid. + * + * @param string $key + * @param string $cipher + * @return bool + */ + public static function supported($key, $cipher) + { + $length = mb_strlen($key, '8bit'); + + return ($cipher === 'AES-128-CBC' && $length === 16) || ($cipher === 'AES-256-CBC' && $length === 32); + } + + /** + * Encrypt the given value. + * + * @param string $value + * @return string + * + * @throws \Illuminate\Contracts\Encryption\EncryptException + */ + public function encrypt($value) + { + $iv = Str::randomBytes($this->getIvSize()); + + $value = \openssl_encrypt(serialize($value), $this->cipher, $this->key, 0, $iv); + + if ($value === false) { + throw new EncryptException('Could not encrypt the data.'); + } + + // Once we have the encrypted value we will go ahead base64_encode the input + // vector and create the MAC for the encrypted value so we can verify its + // authenticity. Then, we'll JSON encode the data in a "payload" array. + $mac = $this->hash($iv = base64_encode($iv), $value); + + $json = json_encode(compact('iv', 'value', 'mac')); + + if (! is_string($json)) { + throw new EncryptException('Could not encrypt the data.'); + } + + return base64_encode($json); + } + + /** + * Decrypt the given value. + * + * @param string $payload + * @return string + * + * @throws \Illuminate\Contracts\Encryption\DecryptException + */ + public function decrypt($payload) + { + $payload = $this->getJsonPayload($payload); + + $iv = base64_decode($payload['iv']); + + $decrypted = \openssl_decrypt($payload['value'], $this->cipher, $this->key, 0, $iv); + + if ($decrypted === false) { + throw new DecryptException('Could not decrypt the data.'); + } + + return unserialize($decrypted); + } + + /** + * Get the IV size for the cipher. + * + * @return int + */ + protected function getIvSize() + { + return 16; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php index 7ceb86c..a0b9491 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php @@ -1,27 +1,33 @@ -app->singleton('encrypter', function($app) - { - $encrypter = new Encrypter($app['config']['app.key']); +class EncryptionServiceProvider extends ServiceProvider +{ + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton('encrypter', function ($app) { + $config = $app->make('config')->get('app'); - if ($app['config']->has('app.cipher')) - { - $encrypter->setCipher($app['config']['app.cipher']); - } + $key = $config['key']; - return $encrypter; - }); - } + $cipher = $config['cipher']; + if (Encrypter::supported($key, $cipher)) { + return new Encrypter($key, $cipher); + } elseif (McryptEncrypter::supported($key, $cipher)) { + return new McryptEncrypter($key, $cipher); + } else { + throw new RuntimeException('No supported encrypter found. The cipher and / or key length are invalid.'); + } + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Encryption/InvalidKeyException.php b/application/vendor/laravel/framework/src/Illuminate/Encryption/InvalidKeyException.php deleted file mode 100644 index 1f1ef0c..0000000 --- a/application/vendor/laravel/framework/src/Illuminate/Encryption/InvalidKeyException.php +++ /dev/null @@ -1,5 +0,0 @@ -key = $key; + $this->cipher = $cipher; + $this->block = mcrypt_get_iv_size($this->cipher, MCRYPT_MODE_CBC); + } else { + throw new RuntimeException('The only supported ciphers are MCRYPT_RIJNDAEL_128 and MCRYPT_RIJNDAEL_256.'); + } + } + + /** + * Determine if the given key and cipher combination is valid. + * + * @param string $key + * @param string $cipher + * @return bool + */ + public static function supported($key, $cipher) + { + return defined('MCRYPT_RIJNDAEL_128') && + ($cipher === MCRYPT_RIJNDAEL_128 || $cipher === MCRYPT_RIJNDAEL_256); + } + + /** + * Encrypt the given value. + * + * @param string $value + * @return string + * + * @throws \Illuminate\Contracts\Encryption\EncryptException + */ + public function encrypt($value) + { + $iv = mcrypt_create_iv($this->getIvSize(), $this->getRandomizer()); + + $value = base64_encode($this->padAndMcrypt($value, $iv)); + + // Once we have the encrypted value we will go ahead base64_encode the input + // vector and create the MAC for the encrypted value so we can verify its + // authenticity. Then, we'll JSON encode the data in a "payload" array. + $mac = $this->hash($iv = base64_encode($iv), $value); + + $json = json_encode(compact('iv', 'value', 'mac')); + + if (! is_string($json)) { + throw new EncryptException('Could not encrypt the data.'); + } + + return base64_encode($json); + } + + /** + * Pad and use mcrypt on the given value and input vector. + * + * @param string $value + * @param string $iv + * @return string + */ + protected function padAndMcrypt($value, $iv) + { + $value = $this->addPadding(serialize($value)); + + return mcrypt_encrypt($this->cipher, $this->key, $value, MCRYPT_MODE_CBC, $iv); + } + + /** + * Decrypt the given value. + * + * @param string $payload + * @return string + */ + public function decrypt($payload) + { + $payload = $this->getJsonPayload($payload); + + // We'll go ahead and remove the PKCS7 padding from the encrypted value before + // we decrypt it. Once we have the de-padded value, we will grab the vector + // and decrypt the data, passing back the unserialized from of the value. + $value = base64_decode($payload['value']); + + $iv = base64_decode($payload['iv']); + + return unserialize($this->stripPadding($this->mcryptDecrypt($value, $iv))); + } + + /** + * Run the mcrypt decryption routine for the value. + * + * @param string $value + * @param string $iv + * @return string + * + * @throws \Illuminate\Contracts\Encryption\DecryptException + */ + protected function mcryptDecrypt($value, $iv) + { + try { + return mcrypt_decrypt($this->cipher, $this->key, $value, MCRYPT_MODE_CBC, $iv); + } catch (Exception $e) { + throw new DecryptException($e->getMessage()); + } + } + + /** + * Add PKCS7 padding to a given value. + * + * @param string $value + * @return string + */ + protected function addPadding($value) + { + $pad = $this->block - (strlen($value) % $this->block); + + return $value.str_repeat(chr($pad), $pad); + } + + /** + * Remove the padding from the given value. + * + * @param string $value + * @return string + */ + protected function stripPadding($value) + { + $pad = ord($value[($len = strlen($value)) - 1]); + + return $this->paddingIsValid($pad, $value) ? substr($value, 0, $len - $pad) : $value; + } + + /** + * Determine if the given padding for a value is valid. + * + * @param string $pad + * @param string $value + * @return bool + */ + protected function paddingIsValid($pad, $value) + { + $beforePad = strlen($value) - $pad; + + return substr($value, $beforePad) == str_repeat(substr($value, -1), $pad); + } + + /** + * Get the IV size for the cipher. + * + * @return int + */ + protected function getIvSize() + { + return mcrypt_get_iv_size($this->cipher, MCRYPT_MODE_CBC); + } + + /** + * Get the random data source available for the OS. + * + * @return int + */ + protected function getRandomizer() + { + if (defined('MCRYPT_DEV_URANDOM')) { + return MCRYPT_DEV_URANDOM; + } + + if (defined('MCRYPT_DEV_RANDOM')) { + return MCRYPT_DEV_RANDOM; + } + + mt_srand(); + + return MCRYPT_RAND; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Encryption/composer.json b/application/vendor/laravel/framework/src/Illuminate/Encryption/composer.json index 08f4320..0b52c2a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Encryption/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Encryption/composer.json @@ -14,11 +14,12 @@ } ], "require": { - "php": ">=5.4.0", + "php": ">=5.5.9", + "ext-mbstring": "*", "ext-openssl": "*", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*", - "symfony/security-core": "2.6.*" + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*", + "paragonie/random_compat": "~1.4" }, "autoload": { "psr-4": { @@ -27,7 +28,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Events/CallQueuedHandler.php b/application/vendor/laravel/framework/src/Illuminate/Events/CallQueuedHandler.php index 105baf8..b182cd8 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Events/CallQueuedHandler.php +++ b/application/vendor/laravel/framework/src/Illuminate/Events/CallQueuedHandler.php @@ -1,82 +1,80 @@ -container = $container; - } +class CallQueuedHandler +{ + /** + * The container instance. + * + * @var \Illuminate\Contracts\Container\Container + */ + protected $container; - /** - * Handle the queued job. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param array $data - * @return void - */ - public function call(Job $job, array $data) - { - $handler = $this->setJobInstanceIfNecessary( - $job, $this->container->make($data['class']) - ); + /** + * Create a new job instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function __construct(Container $container) + { + $this->container = $container; + } - call_user_func_array( - [$handler, $data['method']], unserialize($data['data']) - ); + /** + * Handle the queued job. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param array $data + * @return void + */ + public function call(Job $job, array $data) + { + $handler = $this->setJobInstanceIfNecessary( + $job, $this->container->make($data['class']) + ); - if ( ! $job->isDeletedOrReleased()) - { - $job->delete(); - } - } + call_user_func_array( + [$handler, $data['method']], unserialize($data['data']) + ); - /** - * Set the job instance of the given class if necessary. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param mixed $instance - * @return mixed - */ - protected function setJobInstanceIfNecessary(Job $job, $instance) - { - if (in_array('Illuminate\Queue\InteractsWithQueue', class_uses_recursive(get_class($instance)))) - { - $instance->setJob($job); - } + if (! $job->isDeletedOrReleased()) { + $job->delete(); + } + } - return $instance; - } + /** + * Set the job instance of the given class if necessary. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param mixed $instance + * @return mixed + */ + protected function setJobInstanceIfNecessary(Job $job, $instance) + { + if (in_array('Illuminate\Queue\InteractsWithQueue', class_uses_recursive(get_class($instance)))) { + $instance->setJob($job); + } - /** - * Call the failed method on the job instance. - * - * @param array $data - * @return void - */ - public function failed(array $data) - { - $handler = $this->container->make($data['class']); + return $instance; + } - if (method_exists($handler, 'failed')) - { - call_user_func_array([$handler, 'failed'], unserialize($data['data'])); - } - } + /** + * Call the failed method on the job instance. + * + * @param array $data + * @return void + */ + public function failed(array $data) + { + $handler = $this->container->make($data['class']); + if (method_exists($handler, 'failed')) { + call_user_func_array([$handler, 'failed'], unserialize($data['data'])); + } + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php b/application/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php index bccbd3a..63dc899 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php +++ b/application/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php @@ -1,486 +1,503 @@ -container = $container ?: new Container; - } - - /** - * Register an event listener with the dispatcher. - * - * @param string|array $events - * @param mixed $listener - * @param int $priority - * @return void - */ - public function listen($events, $listener, $priority = 0) - { - foreach ((array) $events as $event) - { - if (str_contains($event, '*')) - { - $this->setupWildcardListen($event, $listener); - } - else - { - $this->listeners[$event][$priority][] = $this->makeListener($listener); - - unset($this->sorted[$event]); - } - } - } - - /** - * Setup a wildcard listener callback. - * - * @param string $event - * @param mixed $listener - * @return void - */ - protected function setupWildcardListen($event, $listener) - { - $this->wildcards[$event][] = $this->makeListener($listener); - } - - /** - * Determine if a given event has listeners. - * - * @param string $eventName - * @return bool - */ - public function hasListeners($eventName) - { - return isset($this->listeners[$eventName]); - } - - /** - * Register an event and payload to be fired later. - * - * @param string $event - * @param array $payload - * @return void - */ - public function push($event, $payload = array()) - { - $this->listen($event.'_pushed', function() use ($event, $payload) - { - $this->fire($event, $payload); - }); - } - - /** - * Register an event subscriber with the dispatcher. - * - * @param object|string $subscriber - * @return void - */ - public function subscribe($subscriber) - { - $subscriber = $this->resolveSubscriber($subscriber); - - $subscriber->subscribe($this); - } - - /** - * Resolve the subscriber instance. - * - * @param object|string $subscriber - * @return mixed - */ - protected function resolveSubscriber($subscriber) - { - if (is_string($subscriber)) - { - return $this->container->make($subscriber); - } - - return $subscriber; - } - - /** - * Fire an event until the first non-null response is returned. - * - * @param string $event - * @param array $payload - * @return mixed - */ - public function until($event, $payload = array()) - { - return $this->fire($event, $payload, true); - } - - /** - * Flush a set of pushed events. - * - * @param string $event - * @return void - */ - public function flush($event) - { - $this->fire($event.'_pushed'); - } - - /** - * Get the event that is currently firing. - * - * @return string - */ - public function firing() - { - return last($this->firing); - } - - /** - * Fire an event and call the listeners. - * - * @param string|object $event - * @param mixed $payload - * @param bool $halt - * @return array|null - */ - public function fire($event, $payload = array(), $halt = false) - { - // When the given "event" is actually an object we will assume it is an event - // object and use the class as the event name and this event itself as the - // payload to the handler, which makes object based events quite simple. - if (is_object($event)) - { - list($payload, $event) = [[$event], get_class($event)]; - } - - $responses = array(); - - // If an array is not given to us as the payload, we will turn it into one so - // we can easily use call_user_func_array on the listeners, passing in the - // payload to each of them so that they receive each of these arguments. - if ( ! is_array($payload)) $payload = array($payload); - - $this->firing[] = $event; - - foreach ($this->getListeners($event) as $listener) - { - $response = call_user_func_array($listener, $payload); - - // If a response is returned from the listener and event halting is enabled - // we will just return this response, and not call the rest of the event - // listeners. Otherwise we will add the response on the response list. - if ( ! is_null($response) && $halt) - { - array_pop($this->firing); - - return $response; - } - - // If a boolean false is returned from a listener, we will stop propagating - // the event to any further listeners down in the chain, else we keep on - // looping through the listeners and firing every one in our sequence. - if ($response === false) break; - - $responses[] = $response; - } - - array_pop($this->firing); - - return $halt ? null : $responses; - } - - /** - * Get all of the listeners for a given event name. - * - * @param string $eventName - * @return array - */ - public function getListeners($eventName) - { - $wildcards = $this->getWildcardListeners($eventName); - - if ( ! isset($this->sorted[$eventName])) - { - $this->sortListeners($eventName); - } - - return array_merge($this->sorted[$eventName], $wildcards); - } - - /** - * Get the wildcard listeners for the event. - * - * @param string $eventName - * @return array - */ - protected function getWildcardListeners($eventName) - { - $wildcards = array(); - - foreach ($this->wildcards as $key => $listeners) - { - if (str_is($key, $eventName)) $wildcards = array_merge($wildcards, $listeners); - } - - return $wildcards; - } - - /** - * Sort the listeners for a given event by priority. - * - * @param string $eventName - * @return array - */ - protected function sortListeners($eventName) - { - $this->sorted[$eventName] = array(); - - // If listeners exist for the given event, we will sort them by the priority - // so that we can call them in the correct order. We will cache off these - // sorted event listeners so we do not have to re-sort on every events. - if (isset($this->listeners[$eventName])) - { - krsort($this->listeners[$eventName]); - - $this->sorted[$eventName] = call_user_func_array( - 'array_merge', $this->listeners[$eventName] - ); - } - } - - /** - * Register an event listener with the dispatcher. - * - * @param mixed $listener - * @return mixed - */ - public function makeListener($listener) - { - return is_string($listener) ? $this->createClassListener($listener) : $listener; - } - - /** - * Create a class based listener using the IoC container. - * - * @param mixed $listener - * @return \Closure - */ - public function createClassListener($listener) - { - $container = $this->container; - - return function() use ($listener, $container) - { - return call_user_func_array( - $this->createClassCallable($listener, $container), func_get_args() - ); - }; - } - - /** - * Create the class based event callable. - * - * @param string $listener - * @param \Illuminate\Container\Container $container - * @return callable - */ - protected function createClassCallable($listener, $container) - { - list($class, $method) = $this->parseClassCallable($listener); - - if ($this->handlerShouldBeQueued($class)) - { - return $this->createQueuedHandlerCallable($class, $method); - } - else - { - return array($container->make($class), $method); - } - } - - /** - * Parse the class listener into class and method. - * - * @param string $listener - * @return array - */ - protected function parseClassCallable($listener) - { - $segments = explode('@', $listener); - - return [$segments[0], count($segments) == 2 ? $segments[1] : 'handle']; - } - - /** - * Determine if the event handler class should be queued. - * - * @param string $class - * @return bool - */ - protected function handlerShouldBeQueued($class) - { - try - { - return (new ReflectionClass($class))->implementsInterface( - 'Illuminate\Contracts\Queue\ShouldBeQueued' - ); - } - catch (Exception $e) - { - return false; - } - } - - /** - * Create a callable for putting an event handler on the queue. - * - * @param string $class - * @param string $method - * @return \Closure - */ - protected function createQueuedHandlerCallable($class, $method) - { - return function() use ($class, $method) - { - $arguments = $this->cloneArgumentsForQueueing(func_get_args()); - - if (method_exists($class, 'queue')) - { - $this->callQueueMethodOnHandler($class, $method, $arguments); - } - else - { - $this->resolveQueue()->push('Illuminate\Events\CallQueuedHandler@call', [ - 'class' => $class, 'method' => $method, 'data' => serialize($arguments), - ]); - } - }; - } - - /** - * Clone the given arguments for queueing. - * - * @param array $arguments - * @return array - */ - protected function cloneArgumentsForQueueing(array $arguments) - { - return array_map(function($a) { return is_object($a) ? clone $a : $a; }, $arguments); - } - - /** - * Call the queue method on the handler class. - * - * @param string $class - * @param string $method - * @param array $arguments - * @return void - */ - protected function callQueueMethodOnHandler($class, $method, $arguments) - { - $handler = (new ReflectionClass($class))->newInstanceWithoutConstructor(); - - $handler->queue($this->resolveQueue(), 'Illuminate\Events\CallQueuedHandler@call', [ - 'class' => $class, 'method' => $method, 'data' => serialize($arguments), - ]); - } - - /** - * Remove a set of listeners from the dispatcher. - * - * @param string $event - * @return void - */ - public function forget($event) - { - unset($this->listeners[$event], $this->sorted[$event]); - } - - /** - * Forget all of the pushed listeners. - * - * @return void - */ - public function forgetPushed() - { - foreach ($this->listeners as $key => $value) - { - if (ends_with($key, '_pushed')) $this->forget($key); - } - } - - /** - * Get the queue implementation from the resolver. - * - * @return \Illuminate\Contracts\Queue\Queue - */ - protected function resolveQueue() - { - return call_user_func($this->queueResolver); - } - - /** - * Set the queue resolver implementation. - * - * @param callable $resolver - * @return $this - */ - public function setQueueResolver(callable $resolver) - { - $this->queueResolver = $resolver; - - return $this; - } - +class Dispatcher implements DispatcherContract +{ + /** + * The IoC container instance. + * + * @var \Illuminate\Contracts\Container\Container + */ + protected $container; + + /** + * The registered event listeners. + * + * @var array + */ + protected $listeners = []; + + /** + * The wildcard listeners. + * + * @var array + */ + protected $wildcards = []; + + /** + * The sorted event listeners. + * + * @var array + */ + protected $sorted = []; + + /** + * The event firing stack. + * + * @var array + */ + protected $firing = []; + + /** + * The queue resolver instance. + * + * @var callable + */ + protected $queueResolver; + + /** + * Create a new event dispatcher instance. + * + * @param \Illuminate\Contracts\Container\Container|null $container + * @return void + */ + public function __construct(ContainerContract $container = null) + { + $this->container = $container ?: new Container; + } + + /** + * Register an event listener with the dispatcher. + * + * @param string|array $events + * @param mixed $listener + * @param int $priority + * @return void + */ + public function listen($events, $listener, $priority = 0) + { + foreach ((array) $events as $event) { + if (Str::contains($event, '*')) { + $this->setupWildcardListen($event, $listener); + } else { + $this->listeners[$event][$priority][] = $this->makeListener($listener); + + unset($this->sorted[$event]); + } + } + } + + /** + * Setup a wildcard listener callback. + * + * @param string $event + * @param mixed $listener + * @return void + */ + protected function setupWildcardListen($event, $listener) + { + $this->wildcards[$event][] = $this->makeListener($listener); + } + + /** + * Determine if a given event has listeners. + * + * @param string $eventName + * @return bool + */ + public function hasListeners($eventName) + { + return isset($this->listeners[$eventName]) || isset($this->wildcards[$eventName]); + } + + /** + * Register an event and payload to be fired later. + * + * @param string $event + * @param array $payload + * @return void + */ + public function push($event, $payload = []) + { + $this->listen($event.'_pushed', function () use ($event, $payload) { + $this->fire($event, $payload); + }); + } + + /** + * Register an event subscriber with the dispatcher. + * + * @param object|string $subscriber + * @return void + */ + public function subscribe($subscriber) + { + $subscriber = $this->resolveSubscriber($subscriber); + + $subscriber->subscribe($this); + } + + /** + * Resolve the subscriber instance. + * + * @param object|string $subscriber + * @return mixed + */ + protected function resolveSubscriber($subscriber) + { + if (is_string($subscriber)) { + return $this->container->make($subscriber); + } + + return $subscriber; + } + + /** + * Fire an event until the first non-null response is returned. + * + * @param string|object $event + * @param array $payload + * @return mixed + */ + public function until($event, $payload = []) + { + return $this->fire($event, $payload, true); + } + + /** + * Flush a set of pushed events. + * + * @param string $event + * @return void + */ + public function flush($event) + { + $this->fire($event.'_pushed'); + } + + /** + * Get the event that is currently firing. + * + * @return string + */ + public function firing() + { + return last($this->firing); + } + + /** + * Fire an event and call the listeners. + * + * @param string|object $event + * @param mixed $payload + * @param bool $halt + * @return array|null + */ + public function fire($event, $payload = [], $halt = false) + { + // When the given "event" is actually an object we will assume it is an event + // object and use the class as the event name and this event itself as the + // payload to the handler, which makes object based events quite simple. + if (is_object($event)) { + list($payload, $event) = [[$event], get_class($event)]; + } + + $responses = []; + + // If an array is not given to us as the payload, we will turn it into one so + // we can easily use call_user_func_array on the listeners, passing in the + // payload to each of them so that they receive each of these arguments. + if (! is_array($payload)) { + $payload = [$payload]; + } + + $this->firing[] = $event; + + if (isset($payload[0]) && $payload[0] instanceof ShouldBroadcast) { + $this->broadcastEvent($payload[0]); + } + + foreach ($this->getListeners($event) as $listener) { + $response = call_user_func_array($listener, $payload); + + // If a response is returned from the listener and event halting is enabled + // we will just return this response, and not call the rest of the event + // listeners. Otherwise we will add the response on the response list. + if (! is_null($response) && $halt) { + array_pop($this->firing); + + return $response; + } + + // If a boolean false is returned from a listener, we will stop propagating + // the event to any further listeners down in the chain, else we keep on + // looping through the listeners and firing every one in our sequence. + if ($response === false) { + break; + } + + $responses[] = $response; + } + + array_pop($this->firing); + + return $halt ? null : $responses; + } + + /** + * Broadcast the given event class. + * + * @param \Illuminate\Contracts\Broadcasting\ShouldBroadcast $event + * @return void + */ + protected function broadcastEvent($event) + { + if ($this->queueResolver) { + $connection = $event instanceof ShouldBroadcastNow ? 'sync' : null; + + $queue = method_exists($event, 'onQueue') ? $event->onQueue() : null; + + $this->resolveQueue()->connection($connection)->pushOn($queue, 'Illuminate\Broadcasting\BroadcastEvent', [ + 'event' => serialize(clone $event), + ]); + } + } + + /** + * Get all of the listeners for a given event name. + * + * @param string $eventName + * @return array + */ + public function getListeners($eventName) + { + $wildcards = $this->getWildcardListeners($eventName); + + if (! isset($this->sorted[$eventName])) { + $this->sortListeners($eventName); + } + + return array_merge($this->sorted[$eventName], $wildcards); + } + + /** + * Get the wildcard listeners for the event. + * + * @param string $eventName + * @return array + */ + protected function getWildcardListeners($eventName) + { + $wildcards = []; + + foreach ($this->wildcards as $key => $listeners) { + if (Str::is($key, $eventName)) { + $wildcards = array_merge($wildcards, $listeners); + } + } + + return $wildcards; + } + + /** + * Sort the listeners for a given event by priority. + * + * @param string $eventName + * @return array + */ + protected function sortListeners($eventName) + { + $this->sorted[$eventName] = []; + + // If listeners exist for the given event, we will sort them by the priority + // so that we can call them in the correct order. We will cache off these + // sorted event listeners so we do not have to re-sort on every events. + if (isset($this->listeners[$eventName])) { + krsort($this->listeners[$eventName]); + + $this->sorted[$eventName] = call_user_func_array( + 'array_merge', $this->listeners[$eventName] + ); + } + } + + /** + * Register an event listener with the dispatcher. + * + * @param mixed $listener + * @return mixed + */ + public function makeListener($listener) + { + return is_string($listener) ? $this->createClassListener($listener) : $listener; + } + + /** + * Create a class based listener using the IoC container. + * + * @param mixed $listener + * @return \Closure + */ + public function createClassListener($listener) + { + $container = $this->container; + + return function () use ($listener, $container) { + return call_user_func_array( + $this->createClassCallable($listener, $container), func_get_args() + ); + }; + } + + /** + * Create the class based event callable. + * + * @param string $listener + * @param \Illuminate\Container\Container $container + * @return callable + */ + protected function createClassCallable($listener, $container) + { + list($class, $method) = $this->parseClassCallable($listener); + + if ($this->handlerShouldBeQueued($class)) { + return $this->createQueuedHandlerCallable($class, $method); + } else { + return [$container->make($class), $method]; + } + } + + /** + * Parse the class listener into class and method. + * + * @param string $listener + * @return array + */ + protected function parseClassCallable($listener) + { + $segments = explode('@', $listener); + + return [$segments[0], count($segments) == 2 ? $segments[1] : 'handle']; + } + + /** + * Determine if the event handler class should be queued. + * + * @param string $class + * @return bool + */ + protected function handlerShouldBeQueued($class) + { + try { + return (new ReflectionClass($class))->implementsInterface( + 'Illuminate\Contracts\Queue\ShouldQueue' + ); + } catch (Exception $e) { + return false; + } + } + + /** + * Create a callable for putting an event handler on the queue. + * + * @param string $class + * @param string $method + * @return \Closure + */ + protected function createQueuedHandlerCallable($class, $method) + { + return function () use ($class, $method) { + $arguments = $this->cloneArgumentsForQueueing(func_get_args()); + + if (method_exists($class, 'queue')) { + $this->callQueueMethodOnHandler($class, $method, $arguments); + } else { + $this->resolveQueue()->push('Illuminate\Events\CallQueuedHandler@call', [ + 'class' => $class, 'method' => $method, 'data' => serialize($arguments), + ]); + } + }; + } + + /** + * Clone the given arguments for queueing. + * + * @param array $arguments + * @return array + */ + protected function cloneArgumentsForQueueing(array $arguments) + { + return array_map(function ($a) { + return is_object($a) ? clone $a : $a; + }, $arguments); + } + + /** + * Call the queue method on the handler class. + * + * @param string $class + * @param string $method + * @param array $arguments + * @return void + */ + protected function callQueueMethodOnHandler($class, $method, $arguments) + { + $handler = (new ReflectionClass($class))->newInstanceWithoutConstructor(); + + $handler->queue($this->resolveQueue(), 'Illuminate\Events\CallQueuedHandler@call', [ + 'class' => $class, 'method' => $method, 'data' => serialize($arguments), + ]); + } + + /** + * Remove a set of listeners from the dispatcher. + * + * @param string $event + * @return void + */ + public function forget($event) + { + if (Str::contains($event, '*')) { + unset($this->wildcards[$event]); + } else { + unset($this->listeners[$event], $this->sorted[$event]); + } + } + + /** + * Forget all of the pushed listeners. + * + * @return void + */ + public function forgetPushed() + { + foreach ($this->listeners as $key => $value) { + if (Str::endsWith($key, '_pushed')) { + $this->forget($key); + } + } + } + + /** + * Get the queue implementation from the resolver. + * + * @return \Illuminate\Contracts\Queue\Queue + */ + protected function resolveQueue() + { + return call_user_func($this->queueResolver); + } + + /** + * Set the queue resolver implementation. + * + * @param callable $resolver + * @return $this + */ + public function setQueueResolver(callable $resolver) + { + $this->queueResolver = $resolver; + + return $this; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Events/EventServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Events/EventServiceProvider.php index 4d80c5a..54c24cd 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Events/EventServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Events/EventServiceProvider.php @@ -1,23 +1,22 @@ -app->singleton('events', function($app) - { - return (new Dispatcher($app))->setQueueResolver(function() use ($app) - { - return $app->make('Illuminate\Contracts\Queue\Queue'); - }); - }); - } +use Illuminate\Support\ServiceProvider; +class EventServiceProvider extends ServiceProvider +{ + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton('events', function ($app) { + return (new Dispatcher($app))->setQueueResolver(function () use ($app) { + return $app->make('Illuminate\Contracts\Queue\Factory'); + }); + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Events/composer.json b/application/vendor/laravel/framework/src/Illuminate/Events/composer.json index 3c1bfe2..4cbe705 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Events/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Events/composer.json @@ -14,10 +14,10 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/container": "5.0.*", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*" + "php": ">=5.5.9", + "illuminate/container": "5.1.*", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*" }, "autoload": { "psr-4": { @@ -26,7 +26,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Filesystem/ClassFinder.php b/application/vendor/laravel/framework/src/Illuminate/Filesystem/ClassFinder.php index d8076b7..84f2c24 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Filesystem/ClassFinder.php +++ b/application/vendor/laravel/framework/src/Illuminate/Filesystem/ClassFinder.php @@ -1,157 +1,145 @@ -in($directory)->name('*.php') as $file) - { - $classes[] = $this->findClass($file->getRealPath()); - } - - return array_filter($classes); - } - - /** - * Extract the class name from the file at the given path. - * - * @param string $path - * @return string|null - */ - public function findClass($path) - { - $namespace = null; - - $tokens = token_get_all(file_get_contents($path)); - - foreach ($tokens as $key => $token) - { - if ($this->tokenIsNamespace($token)) - { - $namespace = $this->getNamespace($key + 2, $tokens); - } - elseif ($this->tokenIsClassOrInterface($token)) - { - return ltrim($namespace.'\\'.$this->getClass($key + 2, $tokens), '\\'); - } - } - } - - /** - * Find the namespace in the tokens starting at a given key. - * - * @param int $key - * @param array $tokens - * @return string - */ - protected function getNamespace($key, array $tokens) - { - $namespace = null; - - $tokenCount = count($tokens); - - for ($i = $key; $i < $tokenCount; $i++) - { - if ($this->isPartOfNamespace($tokens[$i])) - { - $namespace .= $tokens[$i][1]; - } - elseif ($tokens[$i] == ';') - { - return $namespace; - } - } - } - - /** - * Find the class in the tokens starting at a given key. - * - * @param int $key - * @param array $tokens - * @return string - */ - protected function getClass($key, array $tokens) - { - $class = null; - - $tokenCount = count($tokens); - - for ($i = $key; $i < $tokenCount; $i++) - { - if ($this->isPartOfClass($tokens[$i])) - { - $class .= $tokens[$i][1]; - } - elseif ($this->isWhitespace($tokens[$i])) - { - return $class; - } - } - } - - /** - * Determine if the given token is a namespace keyword. - * - * @param array|string $token - * @return bool - */ - protected function tokenIsNamespace($token) - { - return is_array($token) && $token[0] == T_NAMESPACE; - } - - /** - * Determine if the given token is a class or interface keyword. - * - * @param array|string $token - * @return bool - */ - protected function tokenIsClassOrInterface($token) - { - return is_array($token) && ($token[0] == T_CLASS || $token[0] == T_INTERFACE); - } - - /** - * Determine if the given token is part of the namespace. - * - * @param array|string $token - * @return bool - */ - protected function isPartOfNamespace($token) - { - return is_array($token) && ($token[0] == T_STRING || $token[0] == T_NS_SEPARATOR); - } - - /** - * Determine if the given token is part of the class. - * - * @param array|string $token - * @return bool - */ - protected function isPartOfClass($token) - { - return is_array($token) && $token[0] == T_STRING; - } - - /** - * Determine if the given token is whitespace. - * - * @param array|string $token - * @return bool - */ - protected function isWhitespace($token) - { - return is_array($token) && $token[0] == T_WHITESPACE; - } +use Symfony\Component\Finder\Finder; +class ClassFinder +{ + /** + * Find all the class and interface names in a given directory. + * + * @param string $directory + * @return array + */ + public function findClasses($directory) + { + $classes = []; + + foreach (Finder::create()->in($directory)->name('*.php') as $file) { + $classes[] = $this->findClass($file->getRealPath()); + } + + return array_filter($classes); + } + + /** + * Extract the class name from the file at the given path. + * + * @param string $path + * @return string|null + */ + public function findClass($path) + { + $namespace = null; + + $tokens = token_get_all(file_get_contents($path)); + + foreach ($tokens as $key => $token) { + if ($this->tokenIsNamespace($token)) { + $namespace = $this->getNamespace($key + 2, $tokens); + } elseif ($this->tokenIsClassOrInterface($token)) { + return ltrim($namespace.'\\'.$this->getClass($key + 2, $tokens), '\\'); + } + } + } + + /** + * Find the namespace in the tokens starting at a given key. + * + * @param int $key + * @param array $tokens + * @return string|null + */ + protected function getNamespace($key, array $tokens) + { + $namespace = null; + + $tokenCount = count($tokens); + + for ($i = $key; $i < $tokenCount; $i++) { + if ($this->isPartOfNamespace($tokens[$i])) { + $namespace .= $tokens[$i][1]; + } elseif ($tokens[$i] == ';') { + return $namespace; + } + } + } + + /** + * Find the class in the tokens starting at a given key. + * + * @param int $key + * @param array $tokens + * @return string|null + */ + protected function getClass($key, array $tokens) + { + $class = null; + + $tokenCount = count($tokens); + + for ($i = $key; $i < $tokenCount; $i++) { + if ($this->isPartOfClass($tokens[$i])) { + $class .= $tokens[$i][1]; + } elseif ($this->isWhitespace($tokens[$i])) { + return $class; + } + } + } + + /** + * Determine if the given token is a namespace keyword. + * + * @param array|string $token + * @return bool + */ + protected function tokenIsNamespace($token) + { + return is_array($token) && $token[0] == T_NAMESPACE; + } + + /** + * Determine if the given token is a class or interface keyword. + * + * @param array|string $token + * @return bool + */ + protected function tokenIsClassOrInterface($token) + { + return is_array($token) && ($token[0] == T_CLASS || $token[0] == T_INTERFACE); + } + + /** + * Determine if the given token is part of the namespace. + * + * @param array|string $token + * @return bool + */ + protected function isPartOfNamespace($token) + { + return is_array($token) && ($token[0] == T_STRING || $token[0] == T_NS_SEPARATOR); + } + + /** + * Determine if the given token is part of the class. + * + * @param array|string $token + * @return bool + */ + protected function isPartOfClass($token) + { + return is_array($token) && $token[0] == T_STRING; + } + + /** + * Determine if the given token is whitespace. + * + * @param array|string $token + * @return bool + */ + protected function isWhitespace($token) + { + return is_array($token) && $token[0] == T_WHITESPACE; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php b/application/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php index b04bc9c..11eb46c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php +++ b/application/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php @@ -1,4 +1,6 @@ -isFile($path)) return file_get_contents($path); - - throw new FileNotFoundException("File does not exist at path {$path}"); - } - - /** - * Get the returned value of a file. - * - * @param string $path - * @return mixed - * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException - */ - public function getRequire($path) - { - if ($this->isFile($path)) return require $path; - - throw new FileNotFoundException("File does not exist at path {$path}"); - } - - /** - * Require the given file once. - * - * @param string $file - * @return mixed - */ - public function requireOnce($file) - { - require_once $file; - } - - /** - * Write the contents of a file. - * - * @param string $path - * @param string $contents - * @param bool $lock - * @return int - */ - public function put($path, $contents, $lock = false) - { - return file_put_contents($path, $contents, $lock ? LOCK_EX : 0); - } - - /** - * Prepend to a file. - * - * @param string $path - * @param string $data - * @return int - */ - public function prepend($path, $data) - { - if ($this->exists($path)) - { - return $this->put($path, $data.$this->get($path)); - } - - return $this->put($path, $data); - } - - /** - * Append to a file. - * - * @param string $path - * @param string $data - * @return int - */ - public function append($path, $data) - { - return file_put_contents($path, $data, FILE_APPEND); - } - - /** - * Delete the file at a given path. - * - * @param string|array $paths - * @return bool - */ - public function delete($paths) - { - $paths = is_array($paths) ? $paths : func_get_args(); - - $success = true; - - foreach ($paths as $path) - { - try - { - if ( ! @unlink($path)) - { - $success = false; - } - } - catch (ErrorException $e) - { - $success = false; - } - } - - return $success; - } - - /** - * Move a file to a new location. - * - * @param string $path - * @param string $target - * @return bool - */ - public function move($path, $target) - { - return rename($path, $target); - } - - /** - * Copy a file to a new location. - * - * @param string $path - * @param string $target - * @return bool - */ - public function copy($path, $target) - { - return copy($path, $target); - } - - /** - * Extract the file name from a file path. - * - * @param string $path - * @return string - */ - public function name($path) - { - return pathinfo($path, PATHINFO_FILENAME); - } - - /** - * Extract the file extension from a file path. - * - * @param string $path - * @return string - */ - public function extension($path) - { - return pathinfo($path, PATHINFO_EXTENSION); - } - - /** - * Get the file type of a given file. - * - * @param string $path - * @return string - */ - public function type($path) - { - return filetype($path); - } - - /** - * Get the mime-type of a given file. - * - * @param string $path - * @return string|false - */ - public function mimeType($path) - { - return finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path); - } - - /** - * Get the file size of a given file. - * - * @param string $path - * @return int - */ - public function size($path) - { - return filesize($path); - } - - /** - * Get the file's last modification time. - * - * @param string $path - * @return int - */ - public function lastModified($path) - { - return filemtime($path); - } - - /** - * Determine if the given path is a directory. - * - * @param string $directory - * @return bool - */ - public function isDirectory($directory) - { - return is_dir($directory); - } - - /** - * Determine if the given path is writable. - * - * @param string $path - * @return bool - */ - public function isWritable($path) - { - return is_writable($path); - } - - /** - * Determine if the given path is a file. - * - * @param string $file - * @return bool - */ - public function isFile($file) - { - return is_file($file); - } - - /** - * Find path names matching a given pattern. - * - * @param string $pattern - * @param int $flags - * @return array - */ - public function glob($pattern, $flags = 0) - { - return glob($pattern, $flags); - } - - /** - * Get an array of all files in a directory. - * - * @param string $directory - * @return array - */ - public function files($directory) - { - $glob = glob($directory.'/*'); - - if ($glob === false) return array(); - - // To get the appropriate files, we'll simply glob the directory and filter - // out any "files" that are not truly files so we do not end up with any - // directories in our list, but only true files within the directory. - return array_filter($glob, function($file) - { - return filetype($file) == 'file'; - }); - } - - /** - * Get all of the files from the given directory (recursive). - * - * @param string $directory - * @return array - */ - public function allFiles($directory) - { - return iterator_to_array(Finder::create()->files()->in($directory), false); - } - - /** - * Get all of the directories within a given directory. - * - * @param string $directory - * @return array - */ - public function directories($directory) - { - $directories = array(); - - foreach (Finder::create()->in($directory)->directories()->depth(0) as $dir) - { - $directories[] = $dir->getPathname(); - } - - return $directories; - } - - /** - * Create a directory. - * - * @param string $path - * @param int $mode - * @param bool $recursive - * @param bool $force - * @return bool - */ - public function makeDirectory($path, $mode = 0755, $recursive = false, $force = false) - { - if ($force) - { - return @mkdir($path, $mode, $recursive); - } - - return mkdir($path, $mode, $recursive); - } - - /** - * Copy a directory from one location to another. - * - * @param string $directory - * @param string $destination - * @param int $options - * @return bool - */ - public function copyDirectory($directory, $destination, $options = null) - { - if ( ! $this->isDirectory($directory)) return false; - - $options = $options ?: FilesystemIterator::SKIP_DOTS; - - // If the destination directory does not actually exist, we will go ahead and - // create it recursively, which just gets the destination prepared to copy - // the files over. Once we make the directory we'll proceed the copying. - if ( ! $this->isDirectory($destination)) - { - $this->makeDirectory($destination, 0777, true); - } - - $items = new FilesystemIterator($directory, $options); - - foreach ($items as $item) - { - // As we spin through items, we will check to see if the current file is actually - // a directory or a file. When it is actually a directory we will need to call - // back into this function recursively to keep copying these nested folders. - $target = $destination.'/'.$item->getBasename(); - - if ($item->isDir()) - { - $path = $item->getPathname(); - - if ( ! $this->copyDirectory($path, $target, $options)) return false; - } - - // If the current items is just a regular file, we will just copy this to the new - // location and keep looping. If for some reason the copy fails we'll bail out - // and return false, so the developer is aware that the copy process failed. - else - { - if ( ! $this->copy($item->getPathname(), $target)) return false; - } - } - - return true; - } - - /** - * Recursively delete a directory. - * - * The directory itself may be optionally preserved. - * - * @param string $directory - * @param bool $preserve - * @return bool - */ - public function deleteDirectory($directory, $preserve = false) - { - if ( ! $this->isDirectory($directory)) return false; - - $items = new FilesystemIterator($directory); - - foreach ($items as $item) - { - // If the item is a directory, we can just recurse into the function and - // delete that sub-directory otherwise we'll just delete the file and - // keep iterating through each file until the directory is cleaned. - if ($item->isDir() && ! $item->isLink()) - { - $this->deleteDirectory($item->getPathname()); - } - - // If the item is just a file, we can go ahead and delete it since we're - // just looping through and waxing all of the files in this directory - // and calling directories recursively, so we delete the real path. - else - { - $this->delete($item->getPathname()); - } - } - - if ( ! $preserve) @rmdir($directory); - - return true; - } - - /** - * Empty the specified directory of all files and folders. - * - * @param string $directory - * @return bool - */ - public function cleanDirectory($directory) - { - return $this->deleteDirectory($directory, true); - } - +class Filesystem +{ + use Macroable; + + /** + * Determine if a file or directory exists. + * + * @param string $path + * @return bool + */ + public function exists($path) + { + return file_exists($path); + } + + /** + * Get the contents of a file. + * + * @param string $path + * @return string + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + public function get($path) + { + if ($this->isFile($path)) { + return file_get_contents($path); + } + + throw new FileNotFoundException("File does not exist at path {$path}"); + } + + /** + * Get the returned value of a file. + * + * @param string $path + * @return mixed + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + public function getRequire($path) + { + if ($this->isFile($path)) { + return require $path; + } + + throw new FileNotFoundException("File does not exist at path {$path}"); + } + + /** + * Require the given file once. + * + * @param string $file + * @return mixed + */ + public function requireOnce($file) + { + require_once $file; + } + + /** + * Write the contents of a file. + * + * @param string $path + * @param string $contents + * @param bool $lock + * @return int + */ + public function put($path, $contents, $lock = false) + { + return file_put_contents($path, $contents, $lock ? LOCK_EX : 0); + } + + /** + * Prepend to a file. + * + * @param string $path + * @param string $data + * @return int + */ + public function prepend($path, $data) + { + if ($this->exists($path)) { + return $this->put($path, $data.$this->get($path)); + } + + return $this->put($path, $data); + } + + /** + * Append to a file. + * + * @param string $path + * @param string $data + * @return int + */ + public function append($path, $data) + { + return file_put_contents($path, $data, FILE_APPEND); + } + + /** + * Delete the file at a given path. + * + * @param string|array $paths + * @return bool + */ + public function delete($paths) + { + $paths = is_array($paths) ? $paths : func_get_args(); + + $success = true; + + foreach ($paths as $path) { + try { + if (! @unlink($path)) { + $success = false; + } + } catch (ErrorException $e) { + $success = false; + } + } + + return $success; + } + + /** + * Move a file to a new location. + * + * @param string $path + * @param string $target + * @return bool + */ + public function move($path, $target) + { + return rename($path, $target); + } + + /** + * Copy a file to a new location. + * + * @param string $path + * @param string $target + * @return bool + */ + public function copy($path, $target) + { + return copy($path, $target); + } + + /** + * Extract the file name from a file path. + * + * @param string $path + * @return string + */ + public function name($path) + { + return pathinfo($path, PATHINFO_FILENAME); + } + + /** + * Extract the file extension from a file path. + * + * @param string $path + * @return string + */ + public function extension($path) + { + return pathinfo($path, PATHINFO_EXTENSION); + } + + /** + * Get the file type of a given file. + * + * @param string $path + * @return string + */ + public function type($path) + { + return filetype($path); + } + + /** + * Get the mime-type of a given file. + * + * @param string $path + * @return string|false + */ + public function mimeType($path) + { + return finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path); + } + + /** + * Get the file size of a given file. + * + * @param string $path + * @return int + */ + public function size($path) + { + return filesize($path); + } + + /** + * Get the file's last modification time. + * + * @param string $path + * @return int + */ + public function lastModified($path) + { + return filemtime($path); + } + + /** + * Determine if the given path is a directory. + * + * @param string $directory + * @return bool + */ + public function isDirectory($directory) + { + return is_dir($directory); + } + + /** + * Determine if the given path is writable. + * + * @param string $path + * @return bool + */ + public function isWritable($path) + { + return is_writable($path); + } + + /** + * Determine if the given path is a file. + * + * @param string $file + * @return bool + */ + public function isFile($file) + { + return is_file($file); + } + + /** + * Find path names matching a given pattern. + * + * @param string $pattern + * @param int $flags + * @return array + */ + public function glob($pattern, $flags = 0) + { + return glob($pattern, $flags); + } + + /** + * Get an array of all files in a directory. + * + * @param string $directory + * @return array + */ + public function files($directory) + { + $glob = glob($directory.'/*'); + + if ($glob === false) { + return []; + } + + // To get the appropriate files, we'll simply glob the directory and filter + // out any "files" that are not truly files so we do not end up with any + // directories in our list, but only true files within the directory. + return array_filter($glob, function ($file) { + return filetype($file) == 'file'; + }); + } + + /** + * Get all of the files from the given directory (recursive). + * + * @param string $directory + * @return array + */ + public function allFiles($directory) + { + return iterator_to_array(Finder::create()->files()->in($directory), false); + } + + /** + * Get all of the directories within a given directory. + * + * @param string $directory + * @return array + */ + public function directories($directory) + { + $directories = []; + + foreach (Finder::create()->in($directory)->directories()->depth(0) as $dir) { + $directories[] = $dir->getPathname(); + } + + return $directories; + } + + /** + * Create a directory. + * + * @param string $path + * @param int $mode + * @param bool $recursive + * @param bool $force + * @return bool + */ + public function makeDirectory($path, $mode = 0755, $recursive = false, $force = false) + { + if ($force) { + return @mkdir($path, $mode, $recursive); + } + + return mkdir($path, $mode, $recursive); + } + + /** + * Copy a directory from one location to another. + * + * @param string $directory + * @param string $destination + * @param int $options + * @return bool + */ + public function copyDirectory($directory, $destination, $options = null) + { + if (! $this->isDirectory($directory)) { + return false; + } + + $options = $options ?: FilesystemIterator::SKIP_DOTS; + + // If the destination directory does not actually exist, we will go ahead and + // create it recursively, which just gets the destination prepared to copy + // the files over. Once we make the directory we'll proceed the copying. + if (! $this->isDirectory($destination)) { + $this->makeDirectory($destination, 0777, true); + } + + $items = new FilesystemIterator($directory, $options); + + foreach ($items as $item) { + // As we spin through items, we will check to see if the current file is actually + // a directory or a file. When it is actually a directory we will need to call + // back into this function recursively to keep copying these nested folders. + $target = $destination.'/'.$item->getBasename(); + + if ($item->isDir()) { + $path = $item->getPathname(); + + if (! $this->copyDirectory($path, $target, $options)) { + return false; + } + } + + // If the current items is just a regular file, we will just copy this to the new + // location and keep looping. If for some reason the copy fails we'll bail out + // and return false, so the developer is aware that the copy process failed. + else { + if (! $this->copy($item->getPathname(), $target)) { + return false; + } + } + } + + return true; + } + + /** + * Recursively delete a directory. + * + * The directory itself may be optionally preserved. + * + * @param string $directory + * @param bool $preserve + * @return bool + */ + public function deleteDirectory($directory, $preserve = false) + { + if (! $this->isDirectory($directory)) { + return false; + } + + $items = new FilesystemIterator($directory); + + foreach ($items as $item) { + // If the item is a directory, we can just recurse into the function and + // delete that sub-directory otherwise we'll just delete the file and + // keep iterating through each file until the directory is cleaned. + if ($item->isDir() && ! $item->isLink()) { + $this->deleteDirectory($item->getPathname()); + } + + // If the item is just a file, we can go ahead and delete it since we're + // just looping through and waxing all of the files in this directory + // and calling directories recursively, so we delete the real path. + else { + $this->delete($item->getPathname()); + } + } + + if (! $preserve) { + @rmdir($directory); + } + + return true; + } + + /** + * Empty the specified directory of all files and folders. + * + * @param string $directory + * @return bool + */ + public function cleanDirectory($directory) + { + return $this->deleteDirectory($directory, true); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php b/application/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php index cf10ced..bb92370 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php +++ b/application/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php @@ -1,332 +1,352 @@ -driver = $driver; - } - - /** - * Determine if a file exists. - * - * @param string $path - * @return bool - */ - public function exists($path) - { - return $this->driver->has($path); - } - - /** - * Get the contents of a file. - * - * @param string $path - * @return string - * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException - */ - public function get($path) - { - try - { - return $this->driver->read($path); - } - catch (FileNotFoundException $e) - { - throw new ContractFileNotFoundException($path, $e->getCode(), $e); - } - } - - /** - * Write the contents of a file. - * - * @param string $path - * @param string|resource $contents - * @param string $visibility - * @return bool - */ - public function put($path, $contents, $visibility = null) - { - $config = ['visibility' => $this->parseVisibility($visibility)]; - - if (is_resource($contents)) - { - return $this->driver->putStream($path, $contents, $config); - } - else - { - return $this->driver->put($path, $contents, $config); - } - } - - /** - * Get the visibility for the given path. - * - * @param string $path - * @return string - */ - public function getVisibility($path) - { - if ($this->driver->getVisibility($path) == AdapterInterface::VISIBILITY_PUBLIC) - { - return FilesystemContract::VISIBILITY_PUBLIC; - } - - return FilesystemContract::VISIBILITY_PRIVATE; - } - - /** - * Set the visibility for the given path. - * - * @param string $path - * @param string $visibility - * @return void - */ - public function setVisibility($path, $visibility) - { - return $this->driver->setVisibility($path, $this->parseVisibility($visibility)); - } - - /** - * Prepend to a file. - * - * @param string $path - * @param string $data - * @return int - */ - public function prepend($path, $data) - { - return $this->put($path, $data.PHP_EOL.$this->get($path)); - } - - /** - * Append to a file. - * - * @param string $path - * @param string $data - * @return int - */ - public function append($path, $data) - { - return $this->put($path, $this->get($path).PHP_EOL.$data); - } - - /** - * Delete the file at a given path. - * - * @param string|array $paths - * @return bool - */ - public function delete($paths) - { - $paths = is_array($paths) ? $paths : func_get_args(); - - foreach ($paths as $path) - { - $this->driver->delete($path); - } - - return true; - } - - /** - * Copy a file to a new location. - * - * @param string $from - * @param string $to - * @return bool - */ - public function copy($from, $to) - { - return $this->driver->copy($from, $to); - } - - /** - * Move a file to a new location. - * - * @param string $from - * @param string $to - * @return bool - */ - public function move($from, $to) - { - return $this->driver->rename($from, $to); - } - - /** - * Get the file size of a given file. - * - * @param string $path - * @return int - */ - public function size($path) - { - return $this->driver->getSize($path); - } - - /** - * Get the mime-type of a given file. - * - * @param string $path - * @return string|false - */ - public function mimeType($path) - { - return $this->driver->getMimetype($path); - } - - /** - * Get the file's last modification time. - * - * @param string $path - * @return int - */ - public function lastModified($path) - { - return $this->driver->getTimestamp($path); - } - - /** - * Get an array of all files in a directory. - * - * @param string|null $directory - * @param bool $recursive - * @return array - */ - public function files($directory = null, $recursive = false) - { - $contents = $this->driver->listContents($directory, $recursive); - - return $this->filterContentsByType($contents, 'file'); - } - - /** - * Get all of the files from the given directory (recursive). - * - * @param string|null $directory - * @return array - */ - public function allFiles($directory = null) - { - return $this->files($directory, true); - } - - /** - * Get all of the directories within a given directory. - * - * @param string|null $directory - * @param bool $recursive - * @return array - */ - public function directories($directory = null, $recursive = false) - { - $contents = $this->driver->listContents($directory, $recursive); - - return $this->filterContentsByType($contents, 'dir'); - } - - /** - * Get all (recursive) of the directories within a given directory. - * - * @param string|null $directory - * @return array - */ - public function allDirectories($directory = null) - { - return $this->directories($directory, true); - } - - /** - * Create a directory. - * - * @param string $path - * @return bool - */ - public function makeDirectory($path) - { - return $this->driver->createDir($path); - } - - /** - * Recursively delete a directory. - * - * @param string $directory - * @return bool - */ - public function deleteDirectory($directory) - { - return $this->driver->deleteDir($directory); - } - - /** - * Get the Flysystem driver. - * - * @return \League\Flysystem\FilesystemInterface - */ - public function getDriver() - { - return $this->driver; - } - - /** - * Filter directory contents by type. - * - * @param array $contents - * @param string $type - * @return array - */ - protected function filterContentsByType($contents, $type) - { - return Collection::make($contents) - ->where('type', $type) - ->fetch('path') - ->values()->all(); - } - - /** - * Parse the given visibility value. - * - * @param string|null $visibility - * @return string - * @throws \InvalidArgumentException - */ - protected function parseVisibility($visibility) - { - if (is_null($visibility)) return; - - switch ($visibility) - { - case FilesystemContract::VISIBILITY_PUBLIC: - return AdapterInterface::VISIBILITY_PUBLIC; - - case FilesystemContract::VISIBILITY_PRIVATE: - return AdapterInterface::VISIBILITY_PRIVATE; - } - - throw new InvalidArgumentException('Unknown visibility: '.$visibility); - } - +class FilesystemAdapter implements FilesystemContract, CloudFilesystemContract +{ + /** + * The Flysystem filesystem implementation. + * + * @var \League\Flysystem\FilesystemInterface + */ + protected $driver; + + /** + * Create a new filesystem adapter instance. + * + * @param \League\Flysystem\FilesystemInterface $driver + * @return void + */ + public function __construct(FilesystemInterface $driver) + { + $this->driver = $driver; + } + + /** + * Determine if a file exists. + * + * @param string $path + * @return bool + */ + public function exists($path) + { + return $this->driver->has($path); + } + + /** + * Get the contents of a file. + * + * @param string $path + * @return string + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + public function get($path) + { + try { + return $this->driver->read($path); + } catch (FileNotFoundException $e) { + throw new ContractFileNotFoundException($path, $e->getCode(), $e); + } + } + + /** + * Write the contents of a file. + * + * @param string $path + * @param string|resource $contents + * @param string $visibility + * @return bool + */ + public function put($path, $contents, $visibility = null) + { + if ($visibility = $this->parseVisibility($visibility)) { + $config = ['visibility' => $visibility]; + } else { + $config = []; + } + + if (is_resource($contents)) { + return $this->driver->putStream($path, $contents, $config); + } else { + return $this->driver->put($path, $contents, $config); + } + } + + /** + * Get the visibility for the given path. + * + * @param string $path + * @return string + */ + public function getVisibility($path) + { + if ($this->driver->getVisibility($path) == AdapterInterface::VISIBILITY_PUBLIC) { + return FilesystemContract::VISIBILITY_PUBLIC; + } + + return FilesystemContract::VISIBILITY_PRIVATE; + } + + /** + * Set the visibility for the given path. + * + * @param string $path + * @param string $visibility + * @return void + */ + public function setVisibility($path, $visibility) + { + return $this->driver->setVisibility($path, $this->parseVisibility($visibility)); + } + + /** + * Prepend to a file. + * + * @param string $path + * @param string $data + * @return int + */ + public function prepend($path, $data) + { + if ($this->exists($path)) { + return $this->put($path, $data.PHP_EOL.$this->get($path)); + } + + return $this->put($path, $data); + } + + /** + * Append to a file. + * + * @param string $path + * @param string $data + * @return int + */ + public function append($path, $data) + { + if ($this->exists($path)) { + return $this->put($path, $this->get($path).PHP_EOL.$data); + } + + return $this->put($path, $data); + } + + /** + * Delete the file at a given path. + * + * @param string|array $paths + * @return bool + */ + public function delete($paths) + { + $paths = is_array($paths) ? $paths : func_get_args(); + + foreach ($paths as $path) { + $this->driver->delete($path); + } + + return true; + } + + /** + * Copy a file to a new location. + * + * @param string $from + * @param string $to + * @return bool + */ + public function copy($from, $to) + { + return $this->driver->copy($from, $to); + } + + /** + * Move a file to a new location. + * + * @param string $from + * @param string $to + * @return bool + */ + public function move($from, $to) + { + return $this->driver->rename($from, $to); + } + + /** + * Get the file size of a given file. + * + * @param string $path + * @return int + */ + public function size($path) + { + return $this->driver->getSize($path); + } + + /** + * Get the mime-type of a given file. + * + * @param string $path + * @return string|false + */ + public function mimeType($path) + { + return $this->driver->getMimetype($path); + } + + /** + * Get the file's last modification time. + * + * @param string $path + * @return int + */ + public function lastModified($path) + { + return $this->driver->getTimestamp($path); + } + + /** + * Get an array of all files in a directory. + * + * @param string|null $directory + * @param bool $recursive + * @return array + */ + public function files($directory = null, $recursive = false) + { + $contents = $this->driver->listContents($directory, $recursive); + + return $this->filterContentsByType($contents, 'file'); + } + + /** + * Get all of the files from the given directory (recursive). + * + * @param string|null $directory + * @return array + */ + public function allFiles($directory = null) + { + return $this->files($directory, true); + } + + /** + * Get all of the directories within a given directory. + * + * @param string|null $directory + * @param bool $recursive + * @return array + */ + public function directories($directory = null, $recursive = false) + { + $contents = $this->driver->listContents($directory, $recursive); + + return $this->filterContentsByType($contents, 'dir'); + } + + /** + * Get all (recursive) of the directories within a given directory. + * + * @param string|null $directory + * @return array + */ + public function allDirectories($directory = null) + { + return $this->directories($directory, true); + } + + /** + * Create a directory. + * + * @param string $path + * @return bool + */ + public function makeDirectory($path) + { + return $this->driver->createDir($path); + } + + /** + * Recursively delete a directory. + * + * @param string $directory + * @return bool + */ + public function deleteDirectory($directory) + { + return $this->driver->deleteDir($directory); + } + + /** + * Get the Flysystem driver. + * + * @return \League\Flysystem\FilesystemInterface + */ + public function getDriver() + { + return $this->driver; + } + + /** + * Filter directory contents by type. + * + * @param array $contents + * @param string $type + * @return array + */ + protected function filterContentsByType($contents, $type) + { + return Collection::make($contents) + ->where('type', $type) + ->pluck('path') + ->values() + ->all(); + } + + /** + * Parse the given visibility value. + * + * @param string|null $visibility + * @return string|null + * @throws \InvalidArgumentException + */ + protected function parseVisibility($visibility) + { + if (is_null($visibility)) { + return; + } + + switch ($visibility) { + case FilesystemContract::VISIBILITY_PUBLIC: + return AdapterInterface::VISIBILITY_PUBLIC; + case FilesystemContract::VISIBILITY_PRIVATE: + return AdapterInterface::VISIBILITY_PRIVATE; + } + + throw new InvalidArgumentException('Unknown visibility: '.$visibility); + } + + /** + * Pass dynamic methods call onto Flysystem. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, array $parameters) + { + return call_user_func_array([$this->driver, $method], $parameters); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php b/application/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php index be6aa4a..961c624 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php +++ b/application/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php @@ -1,235 +1,304 @@ -app = $app; - } - - /** - * Get a filesystem instance. - * - * @param string $name - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - public function drive($name = null) - { - return $this->disk($name); - } - - /** - * Get a filesystem instance. - * - * @param string $name - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - public function disk($name = null) - { - $name = $name ?: $this->getDefaultDriver(); - - return $this->disks[$name] = $this->get($name); - } - - /** - * Attempt to get the disk from the local cache. - * - * @param string $name - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - protected function get($name) - { - return isset($this->disks[$name]) ? $this->disks[$name] : $this->resolve($name); - } - - /** - * Resolve the given disk. - * - * @param string $name - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - protected function resolve($name) - { - $config = $this->getConfig($name); - - if (isset($this->customCreators[$config['driver']])) - { - return $this->callCustomCreator($config); - } - - return $this->{"create".ucfirst($config['driver'])."Driver"}($config); - } - - /** - * Call a custom driver creator. - * - * @param array $config - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - protected function callCustomCreator(array $config) - { - $driver = $this->customCreators[$config['driver']]($this->app, $config); - - if ($driver instanceof FilesystemInterface) - { - return $this->adapt($driver); - } - - return $driver; - } - - /** - * Create an instance of the local driver. - * - * @param array $config - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - public function createLocalDriver(array $config) - { - return $this->adapt(new Flysystem(new LocalAdapter($config['root']))); - } - - /** - * Create an instance of the Amazon S3 driver. - * - * @param array $config - * @return \Illuminate\Contracts\Filesystem\Cloud - */ - public function createS3Driver(array $config) - { - $s3Config = array_only($config, ['key', 'region', 'secret', 'signature', 'base_url']); - - return $this->adapt( - new Flysystem(new S3Adapter(S3Client::factory($s3Config), $config['bucket'])) - ); - } - - /** - * Create an instance of the Rackspace driver. - * - * @param array $config - * @return \Illuminate\Contracts\Filesystem\Cloud - */ - public function createRackspaceDriver(array $config) - { - $client = new Rackspace($config['endpoint'], [ - 'username' => $config['username'], 'apiKey' => $config['key'], - ]); - - return $this->adapt(new Flysystem( - new RackspaceAdapter($this->getRackspaceContainer($client, $config)) - )); - } - - /** - * Get the Rackspace Cloud Files container. - * - * @param Rackspace $client - * @param array $config - * @return \OpenCloud\ObjectStore\Resource\Container - */ - protected function getRackspaceContainer(Rackspace $client, array $config) - { - $urlType = array_get($config, 'url_type'); - - $store = $client->objectStoreService('cloudFiles', $config['region'], $urlType); - - return $store->getContainer($config['container']); - } - - /** - * Adapt the filesystem implementation. - * - * @param \League\Flysystem\FilesystemInterface $filesystem - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - protected function adapt(FilesystemInterface $filesystem) - { - return new FilesystemAdapter($filesystem); - } - - /** - * Get the filesystem connection configuration. - * - * @param string $name - * @return array - */ - protected function getConfig($name) - { - return $this->app['config']["filesystems.disks.{$name}"]; - } - - /** - * Get the default driver name. - * - * @return string - */ - public function getDefaultDriver() - { - return $this->app['config']['filesystems.default']; - } - - /** - * Register a custom driver creator Closure. - * - * @param string $driver - * @param \Closure $callback - * @return $this - */ - public function extend($driver, Closure $callback) - { - $this->customCreators[$driver] = $callback; - - return $this; - } - - /** - * Dynamically call the default driver instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return call_user_func_array(array($this->disk(), $method), $parameters); - } +class FilesystemManager implements FactoryContract +{ + /** + * The application instance. + * + * @var \Illuminate\Contracts\Foundation\Application + */ + protected $app; + + /** + * The array of resolved filesystem drivers. + * + * @var array + */ + protected $disks = []; + + /** + * The registered custom driver creators. + * + * @var array + */ + protected $customCreators = []; + + /** + * Create a new filesystem manager instance. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + public function __construct($app) + { + $this->app = $app; + } + + /** + * Get a filesystem instance. + * + * @param string $name + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function drive($name = null) + { + return $this->disk($name); + } + + /** + * Get a filesystem instance. + * + * @param string $name + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function disk($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + return $this->disks[$name] = $this->get($name); + } + + /** + * Attempt to get the disk from the local cache. + * + * @param string $name + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + protected function get($name) + { + return isset($this->disks[$name]) ? $this->disks[$name] : $this->resolve($name); + } + + /** + * Resolve the given disk. + * + * @param string $name + * @return \Illuminate\Contracts\Filesystem\Filesystem + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + if (isset($this->customCreators[$config['driver']])) { + return $this->callCustomCreator($config); + } + + $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; + + if (method_exists($this, $driverMethod)) { + return $this->{$driverMethod}($config); + } else { + throw new InvalidArgumentException("Driver [{$config['driver']}] not supported."); + } + } + + /** + * Call a custom driver creator. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + protected function callCustomCreator(array $config) + { + $driver = $this->customCreators[$config['driver']]($this->app, $config); + + if ($driver instanceof FilesystemInterface) { + return $this->adapt($driver); + } + + return $driver; + } + + /** + * Create an instance of the local driver. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function createLocalDriver(array $config) + { + $permissions = isset($config['permissions']) ? $config['permissions'] : []; + + $links = Arr::get($config, 'links') === 'skip' + ? LocalAdapter::SKIP_LINKS + : LocalAdapter::DISALLOW_LINKS; + + return $this->adapt($this->createFlysystem(new LocalAdapter( + $config['root'], LOCK_EX, $links, $permissions + ), $config)); + } + + /** + * Create an instance of the ftp driver. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function createFtpDriver(array $config) + { + $ftpConfig = Arr::only($config, [ + 'host', 'username', 'password', 'port', 'root', 'passive', 'ssl', 'timeout', + ]); + + return $this->adapt($this->createFlysystem( + new FtpAdapter($ftpConfig), $config + )); + } + + /** + * Create an instance of the Amazon S3 driver. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Cloud + */ + public function createS3Driver(array $config) + { + $s3Config = $this->formatS3Config($config); + + $root = isset($s3Config['root']) ? $s3Config['root'] : null; + + return $this->adapt($this->createFlysystem( + new S3Adapter(new S3Client($s3Config), $s3Config['bucket'], $root), $config + )); + } + + /** + * Format the given S3 configuration with the default options. + * + * @param array $config + * @return array + */ + protected function formatS3Config(array $config) + { + $config += ['version' => 'latest']; + + if ($config['key'] && $config['secret']) { + $config['credentials'] = Arr::only($config, ['key', 'secret']); + } + + return $config; + } + + /** + * Create an instance of the Rackspace driver. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Cloud + */ + public function createRackspaceDriver(array $config) + { + $client = new Rackspace($config['endpoint'], [ + 'username' => $config['username'], 'apiKey' => $config['key'], + ]); + + return $this->adapt($this->createFlysystem( + new RackspaceAdapter($this->getRackspaceContainer($client, $config)), $config + )); + } + + /** + * Get the Rackspace Cloud Files container. + * + * @param \OpenCloud\Rackspace $client + * @param array $config + * @return \OpenCloud\ObjectStore\Resource\Container + */ + protected function getRackspaceContainer(Rackspace $client, array $config) + { + $urlType = Arr::get($config, 'url_type'); + + $store = $client->objectStoreService('cloudFiles', $config['region'], $urlType); + + return $store->getContainer($config['container']); + } + + /** + * Create a Flysystem instance with the given adapter. + * + * @param \League\Flysystem\AdapterInterface $adapter + * @param array $config + * @return \League\Flysystem\FlysystemInterface + */ + protected function createFlysystem(AdapterInterface $adapter, array $config) + { + $config = Arr::only($config, ['visibility', 'disable_asserts']); + + return new Flysystem($adapter, count($config) > 0 ? $config : null); + } + + /** + * Adapt the filesystem implementation. + * + * @param \League\Flysystem\FilesystemInterface $filesystem + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + protected function adapt(FilesystemInterface $filesystem) + { + return new FilesystemAdapter($filesystem); + } + + /** + * Get the filesystem connection configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + return $this->app['config']["filesystems.disks.{$name}"]; + } + + /** + * Get the default driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['filesystems.default']; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback; + + return $this; + } + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return call_user_func_array([$this->disk(), $method], $parameters); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php index c2170b0..6932270 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php @@ -1,82 +1,82 @@ -registerNativeFilesystem(); +use Illuminate\Support\ServiceProvider; - $this->registerFlysystem(); - } +class FilesystemServiceProvider extends ServiceProvider +{ + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerNativeFilesystem(); - /** - * Register the native filesystem implementation. - * - * @return void - */ - protected function registerNativeFilesystem() - { - $this->app->singleton('files', function() { return new Filesystem; }); - } + $this->registerFlysystem(); + } - /** - * Register the driver based filesystem. - * - * @return void - */ - protected function registerFlysystem() - { - $this->registerManager(); + /** + * Register the native filesystem implementation. + * + * @return void + */ + protected function registerNativeFilesystem() + { + $this->app->singleton('files', function () { + return new Filesystem; + }); + } - $this->app->singleton('filesystem.disk', function() - { - return $this->app['filesystem']->disk($this->getDefaultDriver()); - }); + /** + * Register the driver based filesystem. + * + * @return void + */ + protected function registerFlysystem() + { + $this->registerManager(); - $this->app->singleton('filesystem.cloud', function() - { - return $this->app['filesystem']->disk($this->getCloudDriver()); - }); - } + $this->app->singleton('filesystem.disk', function () { + return $this->app['filesystem']->disk($this->getDefaultDriver()); + }); - /** - * Register the filesystem manager. - * - * @return void - */ - protected function registerManager() - { - $this->app->singleton('filesystem', function() - { - return new FilesystemManager($this->app); - }); - } + $this->app->singleton('filesystem.cloud', function () { + return $this->app['filesystem']->disk($this->getCloudDriver()); + }); + } - /** - * Get the default file driver. - * - * @return string - */ - protected function getDefaultDriver() - { - return $this->app['config']['filesystems.default']; - } + /** + * Register the filesystem manager. + * + * @return void + */ + protected function registerManager() + { + $this->app->singleton('filesystem', function () { + return new FilesystemManager($this->app); + }); + } - /** - * Get the default cloud based file driver. - * - * @return string - */ - protected function getCloudDriver() - { - return $this->app['config']['filesystems.cloud']; - } + /** + * Get the default file driver. + * + * @return string + */ + protected function getDefaultDriver() + { + return $this->app['config']['filesystems.default']; + } + /** + * Get the default cloud based file driver. + * + * @return string + */ + protected function getCloudDriver() + { + return $this->app['config']['filesystems.cloud']; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Filesystem/composer.json b/application/vendor/laravel/framework/src/Illuminate/Filesystem/composer.json index fa07dca..a00fa40 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Filesystem/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Filesystem/composer.json @@ -14,11 +14,10 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*", - "symfony/finder": "2.6.*", - "league/flysystem": "~1.0" + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*", + "symfony/finder": "2.7.*" }, "autoload": { "psr-4": { @@ -27,11 +26,12 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "suggest": { - "league/flysystem-aws-s3-v2": "Required to use the Flysystem S3 driver (~1.0).", + "league/flysystem": "Required to use the Flysystem local and FTP drivers (~1.0).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).", "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0)." }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php index bd08417..c0fabc7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php @@ -1,167 +1,168 @@ -aliases = $aliases; - } - - /** - * Get or create the singleton alias loader instance. - * - * @param array $aliases - * @return \Illuminate\Foundation\AliasLoader - */ - public static function getInstance(array $aliases = array()) - { - if (is_null(static::$instance)) return static::$instance = new static($aliases); - - $aliases = array_merge(static::$instance->getAliases(), $aliases); - - static::$instance->setAliases($aliases); - - return static::$instance; - } - - /** - * Load a class alias if it is registered. - * - * @param string $alias - * @return void - */ - public function load($alias) - { - if (isset($this->aliases[$alias])) - { - return class_alias($this->aliases[$alias], $alias); - } - } - - /** - * Add an alias to the loader. - * - * @param string $class - * @param string $alias - * @return void - */ - public function alias($class, $alias) - { - $this->aliases[$class] = $alias; - } - - /** - * Register the loader on the auto-loader stack. - * - * @return void - */ - public function register() - { - if ( ! $this->registered) - { - $this->prependToLoaderStack(); - - $this->registered = true; - } - } - - /** - * Prepend the load method to the auto-loader stack. - * - * @return void - */ - protected function prependToLoaderStack() - { - spl_autoload_register(array($this, 'load'), true, true); - } - - /** - * Get the registered aliases. - * - * @return array - */ - public function getAliases() - { - return $this->aliases; - } - - /** - * Set the registered aliases. - * - * @param array $aliases - * @return void - */ - public function setAliases(array $aliases) - { - $this->aliases = $aliases; - } - - /** - * Indicates if the loader has been registered. - * - * @return bool - */ - public function isRegistered() - { - return $this->registered; - } - - /** - * Set the "registered" state of the loader. - * - * @param bool $value - * @return void - */ - public function setRegistered($value) - { - $this->registered = $value; - } - - /** - * Set the value of the singleton alias loader. - * - * @param \Illuminate\Foundation\AliasLoader $loader - * @return void - */ - public static function setInstance($loader) - { - static::$instance = $loader; - } - - /** - * Clone method. - * - * @return void - */ - private function __clone() - { - // - } - +aliases = $aliases; + } + + /** + * Get or create the singleton alias loader instance. + * + * @param array $aliases + * @return \Illuminate\Foundation\AliasLoader + */ + public static function getInstance(array $aliases = []) + { + if (is_null(static::$instance)) { + return static::$instance = new static($aliases); + } + + $aliases = array_merge(static::$instance->getAliases(), $aliases); + + static::$instance->setAliases($aliases); + + return static::$instance; + } + + /** + * Load a class alias if it is registered. + * + * @param string $alias + * @return bool|null + */ + public function load($alias) + { + if (isset($this->aliases[$alias])) { + return class_alias($this->aliases[$alias], $alias); + } + } + + /** + * Add an alias to the loader. + * + * @param string $class + * @param string $alias + * @return void + */ + public function alias($class, $alias) + { + $this->aliases[$class] = $alias; + } + + /** + * Register the loader on the auto-loader stack. + * + * @return void + */ + public function register() + { + if (! $this->registered) { + $this->prependToLoaderStack(); + + $this->registered = true; + } + } + + /** + * Prepend the load method to the auto-loader stack. + * + * @return void + */ + protected function prependToLoaderStack() + { + spl_autoload_register([$this, 'load'], true, true); + } + + /** + * Get the registered aliases. + * + * @return array + */ + public function getAliases() + { + return $this->aliases; + } + + /** + * Set the registered aliases. + * + * @param array $aliases + * @return void + */ + public function setAliases(array $aliases) + { + $this->aliases = $aliases; + } + + /** + * Indicates if the loader has been registered. + * + * @return bool + */ + public function isRegistered() + { + return $this->registered; + } + + /** + * Set the "registered" state of the loader. + * + * @param bool $value + * @return void + */ + public function setRegistered($value) + { + $this->registered = $value; + } + + /** + * Set the value of the singleton alias loader. + * + * @param \Illuminate\Foundation\AliasLoader $loader + * @return void + */ + public static function setInstance($loader) + { + static::$instance = $loader; + } + + /** + * Clone method. + * + * @return void + */ + private function __clone() + { + // + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Application.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Application.php index 502a73f..b890434 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Application.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Application.php @@ -1,6 +1,11 @@ -registerBaseBindings(); - - $this->registerBaseServiceProviders(); - - $this->registerCoreContainerAliases(); - - if ($basePath) $this->setBasePath($basePath); - } - - /** - * Get the version number of the application. - * - * @return string - */ - public function version() - { - return static::VERSION; - } - - /** - * Register the basic bindings into the container. - * - * @return void - */ - protected function registerBaseBindings() - { - static::setInstance($this); - - $this->instance('app', $this); - - $this->instance('Illuminate\Container\Container', $this); - } - - /** - * Register all of the base service providers. - * - * @return void - */ - protected function registerBaseServiceProviders() - { - $this->register(new EventServiceProvider($this)); - - $this->register(new RoutingServiceProvider($this)); - } - - /** - * Run the given array of bootstrap classes. - * - * @param array $bootstrappers - * @return void - */ - public function bootstrapWith(array $bootstrappers) - { - $this->hasBeenBootstrapped = true; - - foreach ($bootstrappers as $bootstrapper) - { - $this['events']->fire('bootstrapping: '.$bootstrapper, [$this]); - - $this->make($bootstrapper)->bootstrap($this); - - $this['events']->fire('bootstrapped: '.$bootstrapper, [$this]); - } - } - - /** - * Register a callback to run after loading the environment. - * - * @param \Closure $callback - * @return void - */ - public function afterLoadingEnvironment(Closure $callback) - { - return $this->afterBootstrapping( - 'Illuminate\Foundation\Bootstrap\DetectEnvironment', $callback - ); - } - - /** - * Register a callback to run before a bootstrapper. - * - * @param string $bootstrapper - * @param Closure $callback - * @return void - */ - public function beforeBootstrapping($bootstrapper, Closure $callback) - { - $this['events']->listen('bootstrapping: '.$bootstrapper, $callback); - } - - /** - * Register a callback to run after a bootstrapper. - * - * @param string $bootstrapper - * @param Closure $callback - * @return void - */ - public function afterBootstrapping($bootstrapper, Closure $callback) - { - $this['events']->listen('bootstrapped: '.$bootstrapper, $callback); - } - - /** - * Determine if the application has been bootstrapped before. - * - * @return bool - */ - public function hasBeenBootstrapped() - { - return $this->hasBeenBootstrapped; - } - - /** - * Set the base path for the application. - * - * @param string $basePath - * @return $this - */ - public function setBasePath($basePath) - { - $this->basePath = $basePath; - - $this->bindPathsInContainer(); - - return $this; - } - - /** - * Bind all of the application paths in the container. - * - * @return void - */ - protected function bindPathsInContainer() - { - $this->instance('path', $this->path()); - - foreach (['base', 'config', 'database', 'lang', 'public', 'storage'] as $path) - { - $this->instance('path.'.$path, $this->{$path.'Path'}()); - } - } - - /** - * Get the path to the application "app" directory. - * - * @return string - */ - public function path() - { - return $this->basePath.DIRECTORY_SEPARATOR.'app'; - } - - /** - * Get the base path of the Laravel installation. - * - * @return string - */ - public function basePath() - { - return $this->basePath; - } - - /** - * Get the path to the application configuration files. - * - * @return string - */ - public function configPath() - { - return $this->basePath.DIRECTORY_SEPARATOR.'config'; - } - - /** - * Get the path to the database directory. - * - * @return string - */ - public function databasePath() - { - return $this->databasePath ?: $this->basePath.DIRECTORY_SEPARATOR.'database'; - } - - /** - * Set the database directory. - * - * @param string $path - * @return $this - */ - public function useDatabasePath($path) - { - $this->databasePath = $path; - - $this->instance('path.database', $path); - - return $this; - } - - /** - * Get the path to the language files. - * - * @return string - */ - public function langPath() - { - return $this->basePath.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'lang'; - } - - /** - * Get the path to the public / web directory. - * - * @return string - */ - public function publicPath() - { - return $this->basePath.DIRECTORY_SEPARATOR.'public'; - } - - /** - * Get the path to the storage directory. - * - * @return string - */ - public function storagePath() - { - return $this->storagePath ?: $this->basePath.DIRECTORY_SEPARATOR.'storage'; - } - - /** - * Set the storage directory. - * - * @param string $path - * @return $this - */ - public function useStoragePath($path) - { - $this->storagePath = $path; - - $this->instance('path.storage', $path); - - return $this; - } - - /** - * Set the environment file to be loaded during bootstrapping. - * - * @param string $file - * @return $this - */ - public function loadEnvironmentFrom($file) - { - $this->environmentFile = $file; - - return $this; - } - - /** - * Get the environment file the application is using. - * - * @return string - */ - public function environmentFile() - { - return $this->environmentFile ?: '.env'; - } - - /** - * Get or check the current application environment. - * - * @param mixed - * @return string - */ - public function environment() - { - if (func_num_args() > 0) - { - $patterns = is_array(func_get_arg(0)) ? func_get_arg(0) : func_get_args(); - - foreach ($patterns as $pattern) - { - if (str_is($pattern, $this['env'])) - { - return true; - } - } - - return false; - } - - return $this['env']; - } - - /** - * Determine if application is in local environment. - * - * @return bool - */ - public function isLocal() - { - return $this['env'] == 'local'; - } - - /** - * Detect the application's current environment. - * - * @param \Closure $callback - * @return string - */ - public function detectEnvironment(Closure $callback) - { - $args = isset($_SERVER['argv']) ? $_SERVER['argv'] : null; - - return $this['env'] = (new EnvironmentDetector())->detect($callback, $args); - } - - /** - * Determine if we are running in the console. - * - * @return bool - */ - public function runningInConsole() - { - return php_sapi_name() == 'cli'; - } - - /** - * Determine if we are running unit tests. - * - * @return bool - */ - public function runningUnitTests() - { - return $this['env'] == 'testing'; - } - - /** - * Register all of the configured providers. - * - * @return void - */ - public function registerConfiguredProviders() - { - $manifestPath = $this->getCachedServicesPath(); - - (new ProviderRepository($this, new Filesystem, $manifestPath)) - ->load($this->config['app.providers']); - } - - /** - * Register a service provider with the application. - * - * @param \Illuminate\Support\ServiceProvider|string $provider - * @param array $options - * @param bool $force - * @return \Illuminate\Support\ServiceProvider - */ - public function register($provider, $options = array(), $force = false) - { - if ($registered = $this->getProvider($provider) && ! $force) - { - return $registered; - } - - // If the given "provider" is a string, we will resolve it, passing in the - // application instance automatically for the developer. This is simply - // a more convenient way of specifying your service provider classes. - if (is_string($provider)) - { - $provider = $this->resolveProviderClass($provider); - } - - $provider->register(); - - // Once we have registered the service we will iterate through the options - // and set each of them on the application so they will be available on - // the actual loading of the service objects and for developer usage. - foreach ($options as $key => $value) - { - $this[$key] = $value; - } - - $this->markAsRegistered($provider); - - // If the application has already booted, we will call this boot method on - // the provider class so it has an opportunity to do its boot logic and - // will be ready for any usage by the developer's application logics. - if ($this->booted) - { - $this->bootProvider($provider); - } - - return $provider; - } - - /** - * Get the registered service provider instance if it exists. - * - * @param \Illuminate\Support\ServiceProvider|string $provider - * @return \Illuminate\Support\ServiceProvider|null - */ - public function getProvider($provider) - { - $name = is_string($provider) ? $provider : get_class($provider); - - return array_first($this->serviceProviders, function($key, $value) use ($name) - { - return $value instanceof $name; - }); - } - - /** - * Resolve a service provider instance from the class name. - * - * @param string $provider - * @return \Illuminate\Support\ServiceProvider - */ - public function resolveProviderClass($provider) - { - return new $provider($this); - } - - /** - * Mark the given provider as registered. - * - * @param \Illuminate\Support\ServiceProvider - * @return void - */ - protected function markAsRegistered($provider) - { - $this['events']->fire($class = get_class($provider), array($provider)); - - $this->serviceProviders[] = $provider; - - $this->loadedProviders[$class] = true; - } - - /** - * Load and boot all of the remaining deferred providers. - * - * @return void - */ - public function loadDeferredProviders() - { - // We will simply spin through each of the deferred providers and register each - // one and boot them if the application has booted. This should make each of - // the remaining services available to this application for immediate use. - foreach ($this->deferredServices as $service => $provider) - { - $this->loadDeferredProvider($service); - } - - $this->deferredServices = array(); - } - - /** - * Load the provider for a deferred service. - * - * @param string $service - * @return void - */ - public function loadDeferredProvider($service) - { - if ( ! isset($this->deferredServices[$service])) - { - return; - } - - $provider = $this->deferredServices[$service]; - - // If the service provider has not already been loaded and registered we can - // register it with the application and remove the service from this list - // of deferred services, since it will already be loaded on subsequent. - if ( ! isset($this->loadedProviders[$provider])) - { - $this->registerDeferredProvider($provider, $service); - } - } - - /** - * Register a deferred provider and service. - * - * @param string $provider - * @param string $service - * @return void - */ - public function registerDeferredProvider($provider, $service = null) - { - // Once the provider that provides the deferred service has been registered we - // will remove it from our local list of the deferred services with related - // providers so that this container does not try to resolve it out again. - if ($service) unset($this->deferredServices[$service]); - - $this->register($instance = new $provider($this)); - - if ( ! $this->booted) - { - $this->booting(function() use ($instance) - { - $this->bootProvider($instance); - }); - } - } - - /** - * Resolve the given type from the container. - * - * (Overriding Container::make) - * - * @param string $abstract - * @param array $parameters - * @return mixed - */ - public function make($abstract, $parameters = array()) - { - $abstract = $this->getAlias($abstract); - - if (isset($this->deferredServices[$abstract])) - { - $this->loadDeferredProvider($abstract); - } - - return parent::make($abstract, $parameters); - } - - /** - * Determine if the given abstract type has been bound. - * - * (Overriding Container::bound) - * - * @param string $abstract - * @return bool - */ - public function bound($abstract) - { - return isset($this->deferredServices[$abstract]) || parent::bound($abstract); - } - - /** - * Determine if the application has booted. - * - * @return bool - */ - public function isBooted() - { - return $this->booted; - } - - /** - * Boot the application's service providers. - * - * @return void - */ - public function boot() - { - if ($this->booted) return; - - // Once the application has booted we will also fire some "booted" callbacks - // for any listeners that need to do work after this initial booting gets - // finished. This is useful when ordering the boot-up processes we run. - $this->fireAppCallbacks($this->bootingCallbacks); - - array_walk($this->serviceProviders, function($p) { - $this->bootProvider($p); - }); - - $this->booted = true; - - $this->fireAppCallbacks($this->bootedCallbacks); - } - - /** - * Boot the given service provider. - * - * @param \Illuminate\Support\ServiceProvider $provider - * @return void - */ - protected function bootProvider(ServiceProvider $provider) - { - if (method_exists($provider, 'boot')) - { - return $this->call([$provider, 'boot']); - } - } - - /** - * Register a new boot listener. - * - * @param mixed $callback - * @return void - */ - public function booting($callback) - { - $this->bootingCallbacks[] = $callback; - } - - /** - * Register a new "booted" listener. - * - * @param mixed $callback - * @return void - */ - public function booted($callback) - { - $this->bootedCallbacks[] = $callback; - - if ($this->isBooted()) $this->fireAppCallbacks(array($callback)); - } - - /** - * {@inheritdoc} - */ - public function handle(SymfonyRequest $request, $type = self::MASTER_REQUEST, $catch = true) - { - return $this['Illuminate\Contracts\Http\Kernel']->handle(Request::createFromBase($request)); - } - - /** - * Determine if the application configuration is cached. - * - * @return bool - */ - public function configurationIsCached() - { - return $this['files']->exists($this->getCachedConfigPath()); - } - - /** - * Get the path to the configuration cache file. - * - * @return string - */ - public function getCachedConfigPath() - { - if ($this->vendorIsWritableForOptimizations()) - { - return $this->basePath().'/vendor/config.php'; - } - else - { - return $this['path.storage'].'/framework/config.php'; - } - } - - /** - * Determine if the application routes are cached. - * - * @return bool - */ - public function routesAreCached() - { - return $this['files']->exists($this->getCachedRoutesPath()); - } - - /** - * Get the path to the routes cache file. - * - * @return string - */ - public function getCachedRoutesPath() - { - if ($this->vendorIsWritableForOptimizations()) - { - return $this->basePath().'/vendor/routes.php'; - } - else - { - return $this['path.storage'].'/framework/routes.php'; - } - } - - /** - * Get the path to the cached "compiled.php" file. - * - * @return string - */ - public function getCachedCompilePath() - { - if ($this->vendorIsWritableForOptimizations()) - { - return $this->basePath().'/vendor/compiled.php'; - } - else - { - return $this->storagePath().'/framework/compiled.php'; - } - } - - /** - * Get the path to the cached services.json file. - * - * @return string - */ - public function getCachedServicesPath() - { - if ($this->vendorIsWritableForOptimizations()) - { - return $this->basePath().'/vendor/services.json'; - } - else - { - return $this->storagePath().'/framework/services.json'; - } - } - - /** - * Determine if vendor path is writable. - * - * @return bool - */ - public function vendorIsWritableForOptimizations() - { - if ($this->useStoragePathForOptimizations) return false; - - return is_writable($this->basePath().'/vendor'); - } - - /** - * Determines if storage directory should be used for optimizations. - * - * @param bool $value - * @return $this - */ - public function useStoragePathForOptimizations($value = true) - { - $this->useStoragePathForOptimizations = $value; - - return $this; - } - - /** - * Call the booting callbacks for the application. - * - * @param array $callbacks - * @return void - */ - protected function fireAppCallbacks(array $callbacks) - { - foreach ($callbacks as $callback) - { - call_user_func($callback, $this); - } - } - - /** - * Determine if the application is currently down for maintenance. - * - * @return bool - */ - public function isDownForMaintenance() - { - return file_exists($this->storagePath().DIRECTORY_SEPARATOR.'framework'.DIRECTORY_SEPARATOR.'down'); - } - - /** - * Register a maintenance mode event listener. - * - * @param \Closure $callback - * @return void - */ - public function down(Closure $callback) - { - $this['events']->listen('illuminate.app.down', $callback); - } - - /** - * Throw an HttpException with the given data. - * - * @param int $code - * @param string $message - * @param array $headers - * @return void - * - * @throws \Symfony\Component\HttpKernel\Exception\HttpException - */ - public function abort($code, $message = '', array $headers = array()) - { - if ($code == 404) - { - throw new NotFoundHttpException($message); - } - - throw new HttpException($code, $message, null, $headers); - } - - /** - * Register a terminating callback with the application. - * - * @param \Closure $callback - * @return $this - */ - public function terminating(Closure $callback) - { - $this->terminatingCallbacks[] = $callback; - - return $this; - } - - /** - * Terminate the application. - * - * @return void - */ - public function terminate() - { - foreach ($this->terminatingCallbacks as $terminating) - { - $this->call($terminating); - } - } - - /** - * Get the service providers that have been loaded. - * - * @return array - */ - public function getLoadedProviders() - { - return $this->loadedProviders; - } - - /** - * Get the application's deferred services. - * - * @return array - */ - public function getDeferredServices() - { - return $this->deferredServices; - } - - /** - * Set the application's deferred services. - * - * @param array $services - * @return void - */ - public function setDeferredServices(array $services) - { - $this->deferredServices = $services; - } - - /** - * Add an array of services to the application's deferred services. - * - * @param array $services - * @return void - */ - public function addDeferredServices(array $services) - { - $this->deferredServices = array_merge($this->deferredServices, $services); - } - - /** - * Determine if the given service is a deferred service. - * - * @param string $service - * @return bool - */ - public function isDeferredService($service) - { - return isset($this->deferredServices[$service]); - } - - /** - * Get the current application locale. - * - * @return string - */ - public function getLocale() - { - return $this['config']->get('app.locale'); - } - - /** - * Set the current application locale. - * - * @param string $locale - * @return void - */ - public function setLocale($locale) - { - $this['config']->set('app.locale', $locale); - - $this['translator']->setLocale($locale); - - $this['events']->fire('locale.changed', array($locale)); - } - - /** - * Register the core class aliases in the container. - * - * @return void - */ - public function registerCoreContainerAliases() - { - $aliases = array( - 'app' => ['Illuminate\Foundation\Application', 'Illuminate\Contracts\Container\Container', 'Illuminate\Contracts\Foundation\Application'], - 'artisan' => ['Illuminate\Console\Application', 'Illuminate\Contracts\Console\Application'], - 'auth' => 'Illuminate\Auth\AuthManager', - 'auth.driver' => ['Illuminate\Auth\Guard', 'Illuminate\Contracts\Auth\Guard'], - 'auth.password.tokens' => 'Illuminate\Auth\Passwords\TokenRepositoryInterface', - 'blade.compiler' => 'Illuminate\View\Compilers\BladeCompiler', - 'cache' => ['Illuminate\Cache\CacheManager', 'Illuminate\Contracts\Cache\Factory'], - 'cache.store' => ['Illuminate\Cache\Repository', 'Illuminate\Contracts\Cache\Repository'], - 'config' => ['Illuminate\Config\Repository', 'Illuminate\Contracts\Config\Repository'], - 'cookie' => ['Illuminate\Cookie\CookieJar', 'Illuminate\Contracts\Cookie\Factory', 'Illuminate\Contracts\Cookie\QueueingFactory'], - 'encrypter' => ['Illuminate\Encryption\Encrypter', 'Illuminate\Contracts\Encryption\Encrypter'], - 'db' => 'Illuminate\Database\DatabaseManager', - 'events' => ['Illuminate\Events\Dispatcher', 'Illuminate\Contracts\Events\Dispatcher'], - 'files' => 'Illuminate\Filesystem\Filesystem', - 'filesystem' => ['Illuminate\Filesystem\FilesystemManager', 'Illuminate\Contracts\Filesystem\Factory'], - 'filesystem.disk' => 'Illuminate\Contracts\Filesystem\Filesystem', - 'filesystem.cloud' => 'Illuminate\Contracts\Filesystem\Cloud', - 'hash' => 'Illuminate\Contracts\Hashing\Hasher', - 'translator' => ['Illuminate\Translation\Translator', 'Symfony\Component\Translation\TranslatorInterface'], - 'log' => ['Illuminate\Log\Writer', 'Illuminate\Contracts\Logging\Log', 'Psr\Log\LoggerInterface'], - 'mailer' => ['Illuminate\Mail\Mailer', 'Illuminate\Contracts\Mail\Mailer', 'Illuminate\Contracts\Mail\MailQueue'], - 'paginator' => 'Illuminate\Pagination\Factory', - 'auth.password' => ['Illuminate\Auth\Passwords\PasswordBroker', 'Illuminate\Contracts\Auth\PasswordBroker'], - 'queue' => ['Illuminate\Queue\QueueManager', 'Illuminate\Contracts\Queue\Factory', 'Illuminate\Contracts\Queue\Monitor'], - 'queue.connection' => 'Illuminate\Contracts\Queue\Queue', - 'redirect' => 'Illuminate\Routing\Redirector', - 'redis' => ['Illuminate\Redis\Database', 'Illuminate\Contracts\Redis\Database'], - 'request' => 'Illuminate\Http\Request', - 'router' => ['Illuminate\Routing\Router', 'Illuminate\Contracts\Routing\Registrar'], - 'session' => 'Illuminate\Session\SessionManager', - 'session.store' => ['Illuminate\Session\Store', 'Symfony\Component\HttpFoundation\Session\SessionInterface'], - 'url' => ['Illuminate\Routing\UrlGenerator', 'Illuminate\Contracts\Routing\UrlGenerator'], - 'validator' => ['Illuminate\Validation\Factory', 'Illuminate\Contracts\Validation\Factory'], - 'view' => ['Illuminate\View\Factory', 'Illuminate\Contracts\View\Factory'], - ); - - foreach ($aliases as $key => $aliases) - { - foreach ((array) $aliases as $alias) - { - $this->alias($key, $alias); - } - } - } - - /** - * Flush the container of all bindings and resolved instances. - * - * @return void - */ - public function flush() - { - parent::flush(); - - $this->loadedProviders = []; - } - +class Application extends Container implements ApplicationContract, HttpKernelInterface +{ + /** + * The Laravel framework version. + * + * @var string + */ + const VERSION = '5.1.46 (LTS)'; + + /** + * The base path for the Laravel installation. + * + * @var string + */ + protected $basePath; + + /** + * Indicates if the application has been bootstrapped before. + * + * @var bool + */ + protected $hasBeenBootstrapped = false; + + /** + * Indicates if the application has "booted". + * + * @var bool + */ + protected $booted = false; + + /** + * The array of booting callbacks. + * + * @var array + */ + protected $bootingCallbacks = []; + + /** + * The array of booted callbacks. + * + * @var array + */ + protected $bootedCallbacks = []; + + /** + * The array of terminating callbacks. + * + * @var array + */ + protected $terminatingCallbacks = []; + + /** + * All of the registered service providers. + * + * @var array + */ + protected $serviceProviders = []; + + /** + * The names of the loaded service providers. + * + * @var array + */ + protected $loadedProviders = []; + + /** + * The deferred services and their providers. + * + * @var array + */ + protected $deferredServices = []; + + /** + * A custom callback used to configure Monolog. + * + * @var callable|null + */ + protected $monologConfigurator; + + /** + * The custom database path defined by the developer. + * + * @var string + */ + protected $databasePath; + + /** + * The custom storage path defined by the developer. + * + * @var string + */ + protected $storagePath; + + /** + * The custom environment path defined by the developer. + * + * @var string + */ + protected $environmentPath; + + /** + * The environment file to load during bootstrapping. + * + * @var string + */ + protected $environmentFile = '.env'; + + /** + * The application namespace. + * + * @var string + */ + protected $namespace = null; + + /** + * Create a new Illuminate application instance. + * + * @param string|null $basePath + * @return void + */ + public function __construct($basePath = null) + { + $this->registerBaseBindings(); + + $this->registerBaseServiceProviders(); + + $this->registerCoreContainerAliases(); + + if ($basePath) { + $this->setBasePath($basePath); + } + } + + /** + * Get the version number of the application. + * + * @return string + */ + public function version() + { + return static::VERSION; + } + + /** + * Register the basic bindings into the container. + * + * @return void + */ + protected function registerBaseBindings() + { + static::setInstance($this); + + $this->instance('app', $this); + + $this->instance('Illuminate\Container\Container', $this); + } + + /** + * Register all of the base service providers. + * + * @return void + */ + protected function registerBaseServiceProviders() + { + $this->register(new EventServiceProvider($this)); + + $this->register(new RoutingServiceProvider($this)); + } + + /** + * Run the given array of bootstrap classes. + * + * @param array $bootstrappers + * @return void + */ + public function bootstrapWith(array $bootstrappers) + { + $this->hasBeenBootstrapped = true; + + foreach ($bootstrappers as $bootstrapper) { + $this['events']->fire('bootstrapping: '.$bootstrapper, [$this]); + + $this->make($bootstrapper)->bootstrap($this); + + $this['events']->fire('bootstrapped: '.$bootstrapper, [$this]); + } + } + + /** + * Register a callback to run after loading the environment. + * + * @param \Closure $callback + * @return void + */ + public function afterLoadingEnvironment(Closure $callback) + { + return $this->afterBootstrapping( + 'Illuminate\Foundation\Bootstrap\DetectEnvironment', $callback + ); + } + + /** + * Register a callback to run before a bootstrapper. + * + * @param string $bootstrapper + * @param Closure $callback + * @return void + */ + public function beforeBootstrapping($bootstrapper, Closure $callback) + { + $this['events']->listen('bootstrapping: '.$bootstrapper, $callback); + } + + /** + * Register a callback to run after a bootstrapper. + * + * @param string $bootstrapper + * @param Closure $callback + * @return void + */ + public function afterBootstrapping($bootstrapper, Closure $callback) + { + $this['events']->listen('bootstrapped: '.$bootstrapper, $callback); + } + + /** + * Determine if the application has been bootstrapped before. + * + * @return bool + */ + public function hasBeenBootstrapped() + { + return $this->hasBeenBootstrapped; + } + + /** + * Set the base path for the application. + * + * @param string $basePath + * @return $this + */ + public function setBasePath($basePath) + { + $this->basePath = rtrim($basePath, '\/'); + + $this->bindPathsInContainer(); + + return $this; + } + + /** + * Bind all of the application paths in the container. + * + * @return void + */ + protected function bindPathsInContainer() + { + $this->instance('path', $this->path()); + + foreach (['base', 'config', 'database', 'lang', 'public', 'storage'] as $path) { + $this->instance('path.'.$path, $this->{$path.'Path'}()); + } + } + + /** + * Get the path to the application "app" directory. + * + * @return string + */ + public function path() + { + return $this->basePath.DIRECTORY_SEPARATOR.'app'; + } + + /** + * Get the base path of the Laravel installation. + * + * @return string + */ + public function basePath() + { + return $this->basePath; + } + + /** + * Get the path to the application configuration files. + * + * @return string + */ + public function configPath() + { + return $this->basePath.DIRECTORY_SEPARATOR.'config'; + } + + /** + * Get the path to the database directory. + * + * @return string + */ + public function databasePath() + { + return $this->databasePath ?: $this->basePath.DIRECTORY_SEPARATOR.'database'; + } + + /** + * Set the database directory. + * + * @param string $path + * @return $this + */ + public function useDatabasePath($path) + { + $this->databasePath = $path; + + $this->instance('path.database', $path); + + return $this; + } + + /** + * Get the path to the language files. + * + * @return string + */ + public function langPath() + { + return $this->basePath.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'lang'; + } + + /** + * Get the path to the public / web directory. + * + * @return string + */ + public function publicPath() + { + return $this->basePath.DIRECTORY_SEPARATOR.'public'; + } + + /** + * Get the path to the storage directory. + * + * @return string + */ + public function storagePath() + { + return $this->storagePath ?: $this->basePath.DIRECTORY_SEPARATOR.'storage'; + } + + /** + * Set the storage directory. + * + * @param string $path + * @return $this + */ + public function useStoragePath($path) + { + $this->storagePath = $path; + + $this->instance('path.storage', $path); + + return $this; + } + + /** + * Get the path to the environment file directory. + * + * @return string + */ + public function environmentPath() + { + return $this->environmentPath ?: $this->basePath; + } + + /** + * Set the directory for the environment file. + * + * @param string $path + * @return $this + */ + public function useEnvironmentPath($path) + { + $this->environmentPath = $path; + + return $this; + } + + /** + * Set the environment file to be loaded during bootstrapping. + * + * @param string $file + * @return $this + */ + public function loadEnvironmentFrom($file) + { + $this->environmentFile = $file; + + return $this; + } + + /** + * Get the environment file the application is using. + * + * @return string + */ + public function environmentFile() + { + return $this->environmentFile ?: '.env'; + } + + /** + * Get or check the current application environment. + * + * @param mixed + * @return string + */ + public function environment() + { + if (func_num_args() > 0) { + $patterns = is_array(func_get_arg(0)) ? func_get_arg(0) : func_get_args(); + + foreach ($patterns as $pattern) { + if (Str::is($pattern, $this['env'])) { + return true; + } + } + + return false; + } + + return $this['env']; + } + + /** + * Determine if application is in local environment. + * + * @return bool + */ + public function isLocal() + { + return $this['env'] == 'local'; + } + + /** + * Detect the application's current environment. + * + * @param \Closure $callback + * @return string + */ + public function detectEnvironment(Closure $callback) + { + $args = isset($_SERVER['argv']) ? $_SERVER['argv'] : null; + + return $this['env'] = (new EnvironmentDetector())->detect($callback, $args); + } + + /** + * Determine if we are running in the console. + * + * @return bool + */ + public function runningInConsole() + { + return php_sapi_name() == 'cli'; + } + + /** + * Determine if we are running unit tests. + * + * @return bool + */ + public function runningUnitTests() + { + return $this['env'] == 'testing'; + } + + /** + * Register all of the configured providers. + * + * @return void + */ + public function registerConfiguredProviders() + { + $manifestPath = $this->getCachedServicesPath(); + + (new ProviderRepository($this, new Filesystem, $manifestPath)) + ->load($this->config['app.providers']); + } + + /** + * Register a service provider with the application. + * + * @param \Illuminate\Support\ServiceProvider|string $provider + * @param array $options + * @param bool $force + * @return \Illuminate\Support\ServiceProvider + */ + public function register($provider, $options = [], $force = false) + { + if (($registered = $this->getProvider($provider)) && ! $force) { + return $registered; + } + + // If the given "provider" is a string, we will resolve it, passing in the + // application instance automatically for the developer. This is simply + // a more convenient way of specifying your service provider classes. + if (is_string($provider)) { + $provider = $this->resolveProviderClass($provider); + } + + $provider->register(); + + // Once we have registered the service we will iterate through the options + // and set each of them on the application so they will be available on + // the actual loading of the service objects and for developer usage. + foreach ($options as $key => $value) { + $this[$key] = $value; + } + + $this->markAsRegistered($provider); + + // If the application has already booted, we will call this boot method on + // the provider class so it has an opportunity to do its boot logic and + // will be ready for any usage by the developer's application logics. + if ($this->booted) { + $this->bootProvider($provider); + } + + return $provider; + } + + /** + * Get the registered service provider instance if it exists. + * + * @param \Illuminate\Support\ServiceProvider|string $provider + * @return \Illuminate\Support\ServiceProvider|null + */ + public function getProvider($provider) + { + $name = is_string($provider) ? $provider : get_class($provider); + + return Arr::first($this->serviceProviders, function ($key, $value) use ($name) { + return $value instanceof $name; + }); + } + + /** + * Resolve a service provider instance from the class name. + * + * @param string $provider + * @return \Illuminate\Support\ServiceProvider + */ + public function resolveProviderClass($provider) + { + return new $provider($this); + } + + /** + * Mark the given provider as registered. + * + * @param \Illuminate\Support\ServiceProvider $provider + * @return void + */ + protected function markAsRegistered($provider) + { + $this['events']->fire($class = get_class($provider), [$provider]); + + $this->serviceProviders[] = $provider; + + $this->loadedProviders[$class] = true; + } + + /** + * Load and boot all of the remaining deferred providers. + * + * @return void + */ + public function loadDeferredProviders() + { + // We will simply spin through each of the deferred providers and register each + // one and boot them if the application has booted. This should make each of + // the remaining services available to this application for immediate use. + foreach ($this->deferredServices as $service => $provider) { + $this->loadDeferredProvider($service); + } + + $this->deferredServices = []; + } + + /** + * Load the provider for a deferred service. + * + * @param string $service + * @return void + */ + public function loadDeferredProvider($service) + { + if (! isset($this->deferredServices[$service])) { + return; + } + + $provider = $this->deferredServices[$service]; + + // If the service provider has not already been loaded and registered we can + // register it with the application and remove the service from this list + // of deferred services, since it will already be loaded on subsequent. + if (! isset($this->loadedProviders[$provider])) { + $this->registerDeferredProvider($provider, $service); + } + } + + /** + * Register a deferred provider and service. + * + * @param string $provider + * @param string $service + * @return void + */ + public function registerDeferredProvider($provider, $service = null) + { + // Once the provider that provides the deferred service has been registered we + // will remove it from our local list of the deferred services with related + // providers so that this container does not try to resolve it out again. + if ($service) { + unset($this->deferredServices[$service]); + } + + $this->register($instance = new $provider($this)); + + if (! $this->booted) { + $this->booting(function () use ($instance) { + $this->bootProvider($instance); + }); + } + } + + /** + * Resolve the given type from the container. + * + * (Overriding Container::make) + * + * @param string $abstract + * @param array $parameters + * @return mixed + */ + public function make($abstract, array $parameters = []) + { + $abstract = $this->getAlias($abstract); + + if (isset($this->deferredServices[$abstract])) { + $this->loadDeferredProvider($abstract); + } + + return parent::make($abstract, $parameters); + } + + /** + * Determine if the given abstract type has been bound. + * + * (Overriding Container::bound) + * + * @param string $abstract + * @return bool + */ + public function bound($abstract) + { + return isset($this->deferredServices[$abstract]) || parent::bound($abstract); + } + + /** + * Determine if the application has booted. + * + * @return bool + */ + public function isBooted() + { + return $this->booted; + } + + /** + * Boot the application's service providers. + * + * @return void + */ + public function boot() + { + if ($this->booted) { + return; + } + + // Once the application has booted we will also fire some "booted" callbacks + // for any listeners that need to do work after this initial booting gets + // finished. This is useful when ordering the boot-up processes we run. + $this->fireAppCallbacks($this->bootingCallbacks); + + array_walk($this->serviceProviders, function ($p) { + $this->bootProvider($p); + }); + + $this->booted = true; + + $this->fireAppCallbacks($this->bootedCallbacks); + } + + /** + * Boot the given service provider. + * + * @param \Illuminate\Support\ServiceProvider $provider + * @return mixed + */ + protected function bootProvider(ServiceProvider $provider) + { + if (method_exists($provider, 'boot')) { + return $this->call([$provider, 'boot']); + } + } + + /** + * Register a new boot listener. + * + * @param mixed $callback + * @return void + */ + public function booting($callback) + { + $this->bootingCallbacks[] = $callback; + } + + /** + * Register a new "booted" listener. + * + * @param mixed $callback + * @return void + */ + public function booted($callback) + { + $this->bootedCallbacks[] = $callback; + + if ($this->isBooted()) { + $this->fireAppCallbacks([$callback]); + } + } + + /** + * Call the booting callbacks for the application. + * + * @param array $callbacks + * @return void + */ + protected function fireAppCallbacks(array $callbacks) + { + foreach ($callbacks as $callback) { + call_user_func($callback, $this); + } + } + + /** + * {@inheritdoc} + */ + public function handle(SymfonyRequest $request, $type = self::MASTER_REQUEST, $catch = true) + { + return $this['Illuminate\Contracts\Http\Kernel']->handle(Request::createFromBase($request)); + } + + /** + * Determine if middleware has been disabled for the application. + * + * @return bool + */ + public function shouldSkipMiddleware() + { + return $this->bound('middleware.disable') && + $this->make('middleware.disable') === true; + } + + /** + * Determine if the application configuration is cached. + * + * @return bool + */ + public function configurationIsCached() + { + return $this['files']->exists($this->getCachedConfigPath()); + } + + /** + * Get the path to the configuration cache file. + * + * @return string + */ + public function getCachedConfigPath() + { + return $this->basePath().'/bootstrap/cache/config.php'; + } + + /** + * Determine if the application routes are cached. + * + * @return bool + */ + public function routesAreCached() + { + return $this['files']->exists($this->getCachedRoutesPath()); + } + + /** + * Get the path to the routes cache file. + * + * @return string + */ + public function getCachedRoutesPath() + { + return $this->basePath().'/bootstrap/cache/routes.php'; + } + + /** + * Get the path to the cached "compiled.php" file. + * + * @return string + */ + public function getCachedCompilePath() + { + return $this->basePath().'/bootstrap/cache/compiled.php'; + } + + /** + * Get the path to the cached services.json file. + * + * @return string + */ + public function getCachedServicesPath() + { + return $this->basePath().'/bootstrap/cache/services.json'; + } + + /** + * Determine if the application is currently down for maintenance. + * + * @return bool + */ + public function isDownForMaintenance() + { + return file_exists($this->storagePath().'/framework/down'); + } + + /** + * Throw an HttpException with the given data. + * + * @param int $code + * @param string $message + * @param array $headers + * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + */ + public function abort($code, $message = '', array $headers = []) + { + if ($code == 404) { + throw new NotFoundHttpException($message); + } + + throw new HttpException($code, $message, null, $headers); + } + + /** + * Register a terminating callback with the application. + * + * @param \Closure $callback + * @return $this + */ + public function terminating(Closure $callback) + { + $this->terminatingCallbacks[] = $callback; + + return $this; + } + + /** + * Terminate the application. + * + * @return void + */ + public function terminate() + { + foreach ($this->terminatingCallbacks as $terminating) { + $this->call($terminating); + } + } + + /** + * Get the service providers that have been loaded. + * + * @return array + */ + public function getLoadedProviders() + { + return $this->loadedProviders; + } + + /** + * Get the application's deferred services. + * + * @return array + */ + public function getDeferredServices() + { + return $this->deferredServices; + } + + /** + * Set the application's deferred services. + * + * @param array $services + * @return void + */ + public function setDeferredServices(array $services) + { + $this->deferredServices = $services; + } + + /** + * Add an array of services to the application's deferred services. + * + * @param array $services + * @return void + */ + public function addDeferredServices(array $services) + { + $this->deferredServices = array_merge($this->deferredServices, $services); + } + + /** + * Determine if the given service is a deferred service. + * + * @param string $service + * @return bool + */ + public function isDeferredService($service) + { + return isset($this->deferredServices[$service]); + } + + /** + * Define a callback to be used to configure Monolog. + * + * @param callable $callback + * @return $this + */ + public function configureMonologUsing(callable $callback) + { + $this->monologConfigurator = $callback; + + return $this; + } + + /** + * Determine if the application has a custom Monolog configurator. + * + * @return bool + */ + public function hasMonologConfigurator() + { + return ! is_null($this->monologConfigurator); + } + + /** + * Get the custom Monolog configurator for the application. + * + * @return callable + */ + public function getMonologConfigurator() + { + return $this->monologConfigurator; + } + + /** + * Get the current application locale. + * + * @return string + */ + public function getLocale() + { + return $this['config']->get('app.locale'); + } + + /** + * Set the current application locale. + * + * @param string $locale + * @return void + */ + public function setLocale($locale) + { + $this['config']->set('app.locale', $locale); + + $this['translator']->setLocale($locale); + + $this['events']->fire('locale.changed', [$locale]); + } + + /** + * Register the core class aliases in the container. + * + * @return void + */ + public function registerCoreContainerAliases() + { + $aliases = [ + 'app' => ['Illuminate\Foundation\Application', 'Illuminate\Contracts\Container\Container', 'Illuminate\Contracts\Foundation\Application'], + 'auth' => 'Illuminate\Auth\AuthManager', + 'auth.driver' => ['Illuminate\Auth\Guard', 'Illuminate\Contracts\Auth\Guard'], + 'auth.password.tokens' => 'Illuminate\Auth\Passwords\TokenRepositoryInterface', + 'blade.compiler' => 'Illuminate\View\Compilers\BladeCompiler', + 'cache' => ['Illuminate\Cache\CacheManager', 'Illuminate\Contracts\Cache\Factory'], + 'cache.store' => ['Illuminate\Cache\Repository', 'Illuminate\Contracts\Cache\Repository'], + 'config' => ['Illuminate\Config\Repository', 'Illuminate\Contracts\Config\Repository'], + 'cookie' => ['Illuminate\Cookie\CookieJar', 'Illuminate\Contracts\Cookie\Factory', 'Illuminate\Contracts\Cookie\QueueingFactory'], + 'encrypter' => ['Illuminate\Encryption\Encrypter', 'Illuminate\Contracts\Encryption\Encrypter'], + 'db' => 'Illuminate\Database\DatabaseManager', + 'db.connection' => ['Illuminate\Database\Connection', 'Illuminate\Database\ConnectionInterface'], + 'events' => ['Illuminate\Events\Dispatcher', 'Illuminate\Contracts\Events\Dispatcher'], + 'files' => 'Illuminate\Filesystem\Filesystem', + 'filesystem' => ['Illuminate\Filesystem\FilesystemManager', 'Illuminate\Contracts\Filesystem\Factory'], + 'filesystem.disk' => 'Illuminate\Contracts\Filesystem\Filesystem', + 'filesystem.cloud' => 'Illuminate\Contracts\Filesystem\Cloud', + 'hash' => 'Illuminate\Contracts\Hashing\Hasher', + 'translator' => ['Illuminate\Translation\Translator', 'Symfony\Component\Translation\TranslatorInterface'], + 'log' => ['Illuminate\Log\Writer', 'Illuminate\Contracts\Logging\Log', 'Psr\Log\LoggerInterface'], + 'mailer' => ['Illuminate\Mail\Mailer', 'Illuminate\Contracts\Mail\Mailer', 'Illuminate\Contracts\Mail\MailQueue'], + 'auth.password' => ['Illuminate\Auth\Passwords\PasswordBroker', 'Illuminate\Contracts\Auth\PasswordBroker'], + 'queue' => ['Illuminate\Queue\QueueManager', 'Illuminate\Contracts\Queue\Factory', 'Illuminate\Contracts\Queue\Monitor'], + 'queue.connection' => 'Illuminate\Contracts\Queue\Queue', + 'redirect' => 'Illuminate\Routing\Redirector', + 'redis' => ['Illuminate\Redis\Database', 'Illuminate\Contracts\Redis\Database'], + 'request' => 'Illuminate\Http\Request', + 'router' => ['Illuminate\Routing\Router', 'Illuminate\Contracts\Routing\Registrar'], + 'session' => 'Illuminate\Session\SessionManager', + 'session.store' => ['Illuminate\Session\Store', 'Symfony\Component\HttpFoundation\Session\SessionInterface'], + 'url' => ['Illuminate\Routing\UrlGenerator', 'Illuminate\Contracts\Routing\UrlGenerator'], + 'validator' => ['Illuminate\Validation\Factory', 'Illuminate\Contracts\Validation\Factory'], + 'view' => ['Illuminate\View\Factory', 'Illuminate\Contracts\View\Factory'], + ]; + + foreach ($aliases as $key => $aliases) { + foreach ((array) $aliases as $alias) { + $this->alias($key, $alias); + } + } + } + + /** + * Flush the container of all bindings and resolved instances. + * + * @return void + */ + public function flush() + { + parent::flush(); + + $this->loadedProviders = []; + } + + /** + * Get the used kernel object. + * + * @return \Illuminate\Contracts\Console\Kernel|\Illuminate\Contracts\Http\Kernel + */ + protected function getKernel() + { + $kernelContract = $this->runningInConsole() + ? 'Illuminate\Contracts\Console\Kernel' + : 'Illuminate\Contracts\Http\Kernel'; + + return $this->make($kernelContract); + } + + /** + * Get the application namespace. + * + * @return string + * + * @throws \RuntimeException + */ + public function getNamespace() + { + if (! is_null($this->namespace)) { + return $this->namespace; + } + + $composer = json_decode(file_get_contents(base_path('composer.json')), true); + + foreach ((array) data_get($composer, 'autoload.psr-4') as $namespace => $path) { + foreach ((array) $path as $pathChoice) { + if (realpath(app_path()) == realpath(base_path().'/'.$pathChoice)) { + return $this->namespace = $namespace; + } + } + } + + throw new RuntimeException('Unable to detect application namespace.'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/Authorizable.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/Authorizable.php new file mode 100644 index 0000000..9e8e33b --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/Authorizable.php @@ -0,0 +1,44 @@ +forUser($this)->check($ability, $arguments); + } + + /** + * Determine if the entity does not have a given ability. + * + * @param string $ability + * @param array|mixed $arguments + * @return bool + */ + public function cant($ability, $arguments = []) + { + return ! $this->can($ability, $arguments); + } + + /** + * Determine if the entity does not have a given ability. + * + * @param string $ability + * @param array|mixed $arguments + * @return bool + */ + public function cannot($ability, $arguments = []) + { + return $this->cant($ability, $arguments); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php new file mode 100644 index 0000000..e3908f2 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php @@ -0,0 +1,96 @@ +parseAbilityAndArguments($ability, $arguments); + + return $this->authorizeAtGate(app(Gate::class), $ability, $arguments); + } + + /** + * Authorize a given action for a user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user + * @param mixed $ability + * @param mixed|array $arguments + * @return \Illuminate\Auth\Access\Response + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + */ + public function authorizeForUser($user, $ability, $arguments = []) + { + list($ability, $arguments) = $this->parseAbilityAndArguments($ability, $arguments); + + $gate = app(Gate::class)->forUser($user); + + return $this->authorizeAtGate($gate, $ability, $arguments); + } + + /** + * Authorize the request at the given gate. + * + * @param \Illuminate\Contracts\Auth\Access\Gate $gate + * @param mixed $ability + * @param mixed|array $arguments + * @return \Illuminate\Auth\Access\Response + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + */ + public function authorizeAtGate(Gate $gate, $ability, $arguments) + { + try { + return $gate->authorize($ability, $arguments); + } catch (UnauthorizedException $e) { + throw $this->createGateUnauthorizedException( + $ability, $arguments, $e->getMessage(), $e + ); + } + } + + /** + * Guesses the ability's name if it wasn't provided. + * + * @param mixed $ability + * @param mixed|array $arguments + * @return array + */ + protected function parseAbilityAndArguments($ability, $arguments) + { + if (is_string($ability)) { + return [$ability, $arguments]; + } + + return [debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3)[2]['function'], $ability]; + } + + /** + * Throw an unauthorized exception based on gate results. + * + * @param string $ability + * @param mixed|array $arguments + * @param string $message + * @param \Exception $previousException + * @return \Symfony\Component\HttpKernel\Exception\HttpException + */ + protected function createGateUnauthorizedException($ability, $arguments, $message = 'This action is unauthorized.', $previousException = null) + { + return new HttpException(403, $message, $previousException); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php index 6320c69..32ce2c7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php @@ -1,138 +1,10 @@ -registrar->validator($request->all()); - - if ($validator->fails()) - { - $this->throwValidationException( - $request, $validator - ); - } - - $this->auth->login($this->registrar->create($request->all())); - - return redirect($this->redirectPath()); - } - - /** - * Show the application login form. - * - * @return \Illuminate\Http\Response - */ - public function getLogin() - { - return view('auth.login'); - } - - /** - * Handle a login request to the application. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function postLogin(Request $request) - { - $this->validate($request, [ - 'email' => 'required|email', 'password' => 'required', - ]); - - $credentials = $request->only('email', 'password'); - - if ($this->auth->attempt($credentials, $request->has('remember'))) - { - return redirect()->intended($this->redirectPath()); - } - - return redirect($this->loginPath()) - ->withInput($request->only('email', 'remember')) - ->withErrors([ - 'email' => $this->getFailedLoginMessage(), - ]); - } - - /** - * Get the failed login message. - * - * @return string - */ - protected function getFailedLoginMessage() - { - return 'These credentials do not match our records.'; - } - - /** - * Log the user out of the application. - * - * @return \Illuminate\Http\Response - */ - public function getLogout() - { - $this->auth->logout(); - - return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/'); - } - - /** - * Get the post register / login redirect path. - * - * @return string - */ - public function redirectPath() - { - if (property_exists($this, 'redirectPath')) - { - return $this->redirectPath; - } - - return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home'; - } - - /** - * Get the path to the login route. - * - * @return string - */ - public function loginPath() - { - return property_exists($this, 'loginPath') ? $this->loginPath : '/auth/login'; - } +namespace Illuminate\Foundation\Auth; +trait AuthenticatesAndRegistersUsers +{ + use AuthenticatesUsers, RegistersUsers { + AuthenticatesUsers::redirectPath insteadof RegistersUsers; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php new file mode 100644 index 0000000..2d1bc8c --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php @@ -0,0 +1,154 @@ +exists('auth.authenticate')) { + return view('auth.authenticate'); + } + + return view('auth.login'); + } + + /** + * Handle a login request to the application. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function postLogin(Request $request) + { + $this->validate($request, [ + $this->loginUsername() => 'required', 'password' => 'required', + ]); + + // If the class is using the ThrottlesLogins trait, we can automatically throttle + // the login attempts for this application. We'll key this by the username and + // the IP address of the client making these requests into this application. + $throttles = $this->isUsingThrottlesLoginsTrait(); + + if ($throttles && $this->hasTooManyLoginAttempts($request)) { + return $this->sendLockoutResponse($request); + } + + $credentials = $this->getCredentials($request); + + if (Auth::attempt($credentials, $request->has('remember'))) { + return $this->handleUserWasAuthenticated($request, $throttles); + } + + // If the login attempt was unsuccessful we will increment the number of attempts + // to login and redirect the user back to the login form. Of course, when this + // user surpasses their maximum number of attempts they will get locked out. + if ($throttles) { + $this->incrementLoginAttempts($request); + } + + return redirect($this->loginPath()) + ->withInput($request->only($this->loginUsername(), 'remember')) + ->withErrors([ + $this->loginUsername() => $this->getFailedLoginMessage(), + ]); + } + + /** + * Send the response after the user was authenticated. + * + * @param \Illuminate\Http\Request $request + * @param bool $throttles + * @return \Illuminate\Http\Response + */ + protected function handleUserWasAuthenticated(Request $request, $throttles) + { + if ($throttles) { + $this->clearLoginAttempts($request); + } + + if (method_exists($this, 'authenticated')) { + return $this->authenticated($request, Auth::user()); + } + + return redirect()->intended($this->redirectPath()); + } + + /** + * Get the needed authorization credentials from the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function getCredentials(Request $request) + { + return $request->only($this->loginUsername(), 'password'); + } + + /** + * Get the failed login message. + * + * @return string + */ + protected function getFailedLoginMessage() + { + return Lang::has('auth.failed') + ? Lang::get('auth.failed') + : 'These credentials do not match our records.'; + } + + /** + * Log the user out of the application. + * + * @return \Illuminate\Http\Response + */ + public function getLogout() + { + Auth::logout(); + + return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/'); + } + + /** + * Get the path to the login route. + * + * @return string + */ + public function loginPath() + { + return property_exists($this, 'loginPath') ? $this->loginPath : '/auth/login'; + } + + /** + * Get the login username to be used by the controller. + * + * @return string + */ + public function loginUsername() + { + return property_exists($this, 'username') ? $this->username : 'email'; + } + + /** + * Determine if the class is using the ThrottlesLogins trait. + * + * @return bool + */ + protected function isUsingThrottlesLoginsTrait() + { + return in_array( + ThrottlesLogins::class, class_uses_recursive(get_class($this)) + ); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php new file mode 100644 index 0000000..99646a2 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php @@ -0,0 +1,20 @@ +redirectPath; + } + + return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home'; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php new file mode 100644 index 0000000..496abd6 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php @@ -0,0 +1,42 @@ +validator($request->all()); + + if ($validator->fails()) { + $this->throwValidationException( + $request, $validator + ); + } + + Auth::login($this->create($request->all())); + + return redirect($this->redirectPath()); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php index 52fec73..55d784d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php @@ -1,139 +1,119 @@ -validate($request, ['email' => 'required|email']); - - $response = $this->passwords->sendResetLink($request->only('email'), function($m) - { - $m->subject($this->getEmailSubject()); - }); - - switch ($response) - { - case PasswordBroker::RESET_LINK_SENT: - return redirect()->back()->with('status', trans($response)); - - case PasswordBroker::INVALID_USER: - return redirect()->back()->withErrors(['email' => trans($response)]); - } - } - - /** - * Get the e-mail subject line to be used for the reset link email. - * - * @return string - */ - protected function getEmailSubject() - { - return isset($this->subject) ? $this->subject : 'Your Password Reset Link'; - } - - /** - * Display the password reset view for the given token. - * - * @param string $token - * @return Response - */ - public function getReset($token = null) - { - if (is_null($token)) - { - throw new NotFoundHttpException; - } - - return view('auth.reset')->with('token', $token); - } - - /** - * Reset the given user's password. - * - * @param Request $request - * @return Response - */ - public function postReset(Request $request) - { - $this->validate($request, [ - 'token' => 'required', - 'email' => 'required|email', - 'password' => 'required|confirmed', - ]); - - $credentials = $request->only( - 'email', 'password', 'password_confirmation', 'token' - ); - - $response = $this->passwords->reset($credentials, function($user, $password) - { - $user->password = bcrypt($password); - - $user->save(); - - $this->auth->login($user); - }); - - switch ($response) - { - case PasswordBroker::PASSWORD_RESET: - return redirect($this->redirectPath()); - - default: - return redirect()->back() - ->withInput($request->only('email')) - ->withErrors(['email' => trans($response)]); - } - } - - /** - * Get the post register / login redirect path. - * - * @return string - */ - public function redirectPath() - { - if (property_exists($this, 'redirectPath')) - { - return $this->redirectPath; - } - - return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home'; - } - +trait ResetsPasswords +{ + use RedirectsUsers; + + /** + * Display the form to request a password reset link. + * + * @return \Illuminate\Http\Response + */ + public function getEmail() + { + return view('auth.password'); + } + + /** + * Send a reset link to the given user. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function postEmail(Request $request) + { + $this->validate($request, ['email' => 'required|email']); + + $response = Password::sendResetLink($request->only('email'), function (Message $message) { + $message->subject($this->getEmailSubject()); + }); + + switch ($response) { + case Password::RESET_LINK_SENT: + return redirect()->back()->with('status', trans($response)); + case Password::INVALID_USER: + return redirect()->back()->withErrors(['email' => trans($response)]); + } + } + + /** + * Get the e-mail subject line to be used for the reset link email. + * + * @return string + */ + protected function getEmailSubject() + { + return property_exists($this, 'subject') ? $this->subject : 'Your Password Reset Link'; + } + + /** + * Display the password reset view for the given token. + * + * @param string $token + * @return \Illuminate\Http\Response + */ + public function getReset($token = null) + { + if (is_null($token)) { + throw new NotFoundHttpException; + } + + return view('auth.reset')->with('token', $token); + } + + /** + * Reset the given user's password. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function postReset(Request $request) + { + $this->validate($request, [ + 'token' => 'required', + 'email' => 'required|email', + 'password' => 'required|confirmed|min:6', + ]); + + $credentials = $request->only( + 'email', 'password', 'password_confirmation', 'token' + ); + + $response = Password::reset($credentials, function ($user, $password) { + $this->resetPassword($user, $password); + }); + + switch ($response) { + case Password::PASSWORD_RESET: + return redirect($this->redirectPath())->with('status', trans($response)); + default: + return redirect()->back() + ->withInput($request->only('email')) + ->withErrors(['email' => trans($response)]); + } + } + + /** + * Reset the given user's password. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @param string $password + * @return void + */ + protected function resetPassword($user, $password) + { + $user->password = bcrypt($password); + + $user->save(); + + Auth::login($user); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php new file mode 100644 index 0000000..c382ce2 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php @@ -0,0 +1,128 @@ +tooManyAttempts( + $this->getThrottleKey($request), + $this->maxLoginAttempts(), $this->lockoutTime() / 60 + ); + } + + /** + * Increment the login attempts for the user. + * + * @param \Illuminate\Http\Request $request + * @return int + */ + protected function incrementLoginAttempts(Request $request) + { + app(RateLimiter::class)->hit( + $this->getThrottleKey($request) + ); + } + + /** + * Determine how many retries are left for the user. + * + * @param \Illuminate\Http\Request $request + * @return int + */ + protected function retriesLeft(Request $request) + { + $attempts = app(RateLimiter::class)->attempts( + $this->getThrottleKey($request) + ); + + return $this->maxLoginAttempts() - $attempts + 1; + } + + /** + * Redirect the user after determining they are locked out. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\RedirectResponse + */ + protected function sendLockoutResponse(Request $request) + { + $seconds = app(RateLimiter::class)->availableIn( + $this->getThrottleKey($request) + ); + + return redirect()->back() + ->withInput($request->only($this->loginUsername(), 'remember')) + ->withErrors([ + $this->loginUsername() => $this->getLockoutErrorMessage($seconds), + ]); + } + + /** + * Get the login lockout error message. + * + * @param int $seconds + * @return string + */ + protected function getLockoutErrorMessage($seconds) + { + return Lang::has('auth.throttle') + ? Lang::get('auth.throttle', ['seconds' => $seconds]) + : 'Too many login attempts. Please try again in '.$seconds.' seconds.'; + } + + /** + * Clear the login locks for the given user credentials. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function clearLoginAttempts(Request $request) + { + app(RateLimiter::class)->clear( + $this->getThrottleKey($request) + ); + } + + /** + * Get the throttle key for the given request. + * + * @param \Illuminate\Http\Request $request + * @return string + */ + protected function getThrottleKey(Request $request) + { + return mb_strtolower($request->input($this->loginUsername())).'|'.$request->ip(); + } + + /** + * Get the maximum number of login attempts for delaying further attempts. + * + * @return int + */ + protected function maxLoginAttempts() + { + return property_exists($this, 'maxLoginAttempts') ? $this->maxLoginAttempts : 5; + } + + /** + * The number of seconds to delay further login attempts. + * + * @return int + */ + protected function lockoutTime() + { + return property_exists($this, 'lockoutTime') ? $this->lockoutTime : 60; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php index 58f8dc7..2c0bcb0 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php @@ -1,18 +1,19 @@ -boot(); - } +use Illuminate\Contracts\Foundation\Application; +class BootProviders +{ + /** + * Bootstrap the given application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + public function bootstrap(Application $app) + { + $app->boot(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php index 5da9808..8c75520 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php @@ -1,108 +1,112 @@ -configureHandlers($app, $this->registerLogger($app)); - - // Next, we will bind a Closure that resolves the PSR logger implementation - // as this will grant us the ability to be interoperable with many other - // libraries which are able to utilize the PSR standardized interface. - $app->bind('Psr\Log\LoggerInterface', function($app) - { - return $app['log']->getMonolog(); - }); - } +class ConfigureLogging +{ + /** + * Bootstrap the given application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + public function bootstrap(Application $app) + { + $log = $this->registerLogger($app); - /** - * Register the logger instance in the container. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return \Illuminate\Log\Writer - */ - protected function registerLogger(Application $app) - { - $app->instance('log', $log = new Writer( - new Monolog($app->environment()), $app['events']) - ); + // If a custom Monolog configurator has been registered for the application + // we will call that, passing Monolog along. Otherwise, we will grab the + // the configurations for the log system and use it for configuration. + if ($app->hasMonologConfigurator()) { + call_user_func( + $app->getMonologConfigurator(), $log->getMonolog() + ); + } else { + $this->configureHandlers($app, $log); + } + } - return $log; - } + /** + * Register the logger instance in the container. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return \Illuminate\Log\Writer + */ + protected function registerLogger(Application $app) + { + $app->instance('log', $log = new Writer( + new Monolog($app->environment()), $app['events']) + ); - /** - * Configure the Monolog handlers for the application. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @param \Illuminate\Log\Writer $log - * @return void - */ - protected function configureHandlers(Application $app, Writer $log) - { - $method = "configure".ucfirst($app['config']['app.log'])."Handler"; + return $log; + } - $this->{$method}($app, $log); - } + /** + * Configure the Monolog handlers for the application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param \Illuminate\Log\Writer $log + * @return void + */ + protected function configureHandlers(Application $app, Writer $log) + { + $method = 'configure'.ucfirst($app['config']['app.log']).'Handler'; - /** - * Configure the Monolog handlers for the application. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @param \Illuminate\Log\Writer $log - * @return void - */ - protected function configureSingleHandler(Application $app, Writer $log) - { - $log->useFiles($app->storagePath().'/logs/laravel.log'); - } + $this->{$method}($app, $log); + } - /** - * Configure the Monolog handlers for the application. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @param \Illuminate\Log\Writer $log - * @return void - */ - protected function configureDailyHandler(Application $app, Writer $log) - { - $log->useDailyFiles( - $app->storagePath().'/logs/laravel.log', - $app->make('config')->get('app.log_max_files', 5) - ); - } + /** + * Configure the Monolog handlers for the application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param \Illuminate\Log\Writer $log + * @return void + */ + protected function configureSingleHandler(Application $app, Writer $log) + { + $log->useFiles($app->storagePath().'/logs/laravel.log'); + } - /** - * Configure the Monolog handlers for the application. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @param \Illuminate\Log\Writer $log - * @return void - */ - protected function configureSyslogHandler(Application $app, Writer $log) - { - $log->useSyslog('laravel'); - } + /** + * Configure the Monolog handlers for the application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param \Illuminate\Log\Writer $log + * @return void + */ + protected function configureDailyHandler(Application $app, Writer $log) + { + $log->useDailyFiles( + $app->storagePath().'/logs/laravel.log', + $app->make('config')->get('app.log_max_files', 5) + ); + } - /** - * Configure the Monolog handlers for the application. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @param \Illuminate\Log\Writer $log - * @return void - */ - protected function configureErrorlogHandler(Application $app, Writer $log) - { - $log->useErrorLog(); - } + /** + * Configure the Monolog handlers for the application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param \Illuminate\Log\Writer $log + * @return void + */ + protected function configureSyslogHandler(Application $app, Writer $log) + { + $log->useSyslog('laravel'); + } + /** + * Configure the Monolog handlers for the application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param \Illuminate\Log\Writer $log + * @return void + */ + protected function configureErrorlogHandler(Application $app, Writer $log) + { + $log->useErrorLog(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php index 600d7c5..4b44440 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php @@ -1,32 +1,29 @@ -basePath(), $app->environmentFile()); - } - catch (InvalidArgumentException $e) - { - // - } - - $app->detectEnvironment(function() - { - return env('APP_ENV', 'production'); - }); - } +class DetectEnvironment +{ + /** + * Bootstrap the given application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + public function bootstrap(Application $app) + { + try { + Dotenv::load($app->environmentPath(), $app->environmentFile()); + } catch (InvalidArgumentException $e) { + // + } + $app->detectEnvironment(function () { + return env('APP_ENV', 'production'); + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php index f4625f9..4974e5c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php @@ -1,155 +1,156 @@ -app = $app; - - error_reporting(-1); - - set_error_handler([$this, 'handleError']); - - set_exception_handler([$this, 'handleException']); - - register_shutdown_function([$this, 'handleShutdown']); - - if ( ! $app->environment('testing')) - { - ini_set('display_errors', 'Off'); - } - } - - /** - * Convert a PHP error to an ErrorException. - * - * @param int $level - * @param string $message - * @param string $file - * @param int $line - * @param array $context - * @return void - * - * @throws \ErrorException - */ - public function handleError($level, $message, $file = '', $line = 0, $context = array()) - { - if (error_reporting() & $level) - { - throw new ErrorException($message, 0, $level, $file, $line); - } - } - - /** - * Handle an uncaught exception from the application. - * - * Note: Most exceptions can be handled via the try / catch block in - * the HTTP and Console kernels. But, fatal error exceptions must - * be handled differently since they are not normal exceptions. - * - * @param \Exception $e - * @return void - */ - public function handleException($e) - { - $this->getExceptionHandler()->report($e); - - if ($this->app->runningInConsole()) - { - $this->renderForConsole($e); - } - else - { - $this->renderHttpResponse($e); - } - } - - /** - * Render an exception to the console. - * - * @param \Exception $e - * @return void - */ - protected function renderForConsole($e) - { - $this->getExceptionHandler()->renderForConsole(new ConsoleOutput, $e); - } - - /** - * Render an exception as an HTTP response and send it. - * - * @param \Exception $e - * @return void - */ - protected function renderHttpResponse($e) - { - $this->getExceptionHandler()->render($this->app['request'], $e)->send(); - } - - /** - * Handle the PHP shutdown event. - * - * @return void - */ - public function handleShutdown() - { - if ( ! is_null($error = error_get_last()) && $this->isFatal($error['type'])) - { - $this->handleException($this->fatalExceptionFromError($error, 0)); - } - } - - /** - * Create a new fatal exception instance from an error array. - * - * @param array $error - * @param int|null $traceOffset - * @return \Symfony\Component\Debug\Exception\FatalErrorException - */ - protected function fatalExceptionFromError(array $error, $traceOffset = null) - { - return new FatalErrorException( - $error['message'], $error['type'], 0, $error['file'], $error['line'], $traceOffset - ); - } - - /** - * Determine if the error type is fatal. - * - * @param int $type - * @return bool - */ - protected function isFatal($type) - { - return in_array($type, [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE]); - } - - /** - * Get an instance of the exception handler. - * - * @return \Illuminate\Contracts\Debug\ExceptionHandler - */ - protected function getExceptionHandler() - { - return $this->app->make('Illuminate\Contracts\Debug\ExceptionHandler'); - } - +use Symfony\Component\Debug\Exception\FatalThrowableError; + +class HandleExceptions +{ + /** + * The application instance. + * + * @var \Illuminate\Contracts\Foundation\Application + */ + protected $app; + + /** + * Bootstrap the given application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + public function bootstrap(Application $app) + { + $this->app = $app; + + error_reporting(-1); + + set_error_handler([$this, 'handleError']); + + set_exception_handler([$this, 'handleException']); + + register_shutdown_function([$this, 'handleShutdown']); + + if (! $app->environment('testing')) { + ini_set('display_errors', 'Off'); + } + } + + /** + * Convert a PHP error to an ErrorException. + * + * @param int $level + * @param string $message + * @param string $file + * @param int $line + * @param array $context + * @return void + * + * @throws \ErrorException + */ + public function handleError($level, $message, $file = '', $line = 0, $context = []) + { + if (error_reporting() & $level) { + throw new ErrorException($message, 0, $level, $file, $line); + } + } + + /** + * Handle an uncaught exception from the application. + * + * Note: Most exceptions can be handled via the try / catch block in + * the HTTP and Console kernels. But, fatal error exceptions must + * be handled differently since they are not normal exceptions. + * + * @param \Throwable $e + * @return void + */ + public function handleException($e) + { + if (! $e instanceof Exception) { + $e = new FatalThrowableError($e); + } + + $this->getExceptionHandler()->report($e); + + if ($this->app->runningInConsole()) { + $this->renderForConsole($e); + } else { + $this->renderHttpResponse($e); + } + } + + /** + * Render an exception to the console. + * + * @param \Exception $e + * @return void + */ + protected function renderForConsole($e) + { + $this->getExceptionHandler()->renderForConsole(new ConsoleOutput, $e); + } + + /** + * Render an exception as an HTTP response and send it. + * + * @param \Exception $e + * @return void + */ + protected function renderHttpResponse($e) + { + $this->getExceptionHandler()->render($this->app['request'], $e)->send(); + } + + /** + * Handle the PHP shutdown event. + * + * @return void + */ + public function handleShutdown() + { + if (! is_null($error = error_get_last()) && $this->isFatal($error['type'])) { + $this->handleException($this->fatalExceptionFromError($error, 0)); + } + } + + /** + * Create a new fatal exception instance from an error array. + * + * @param array $error + * @param int|null $traceOffset + * @return \Symfony\Component\Debug\Exception\FatalErrorException + */ + protected function fatalExceptionFromError(array $error, $traceOffset = null) + { + return new FatalErrorException( + $error['message'], $error['type'], 0, $error['file'], $error['line'], $traceOffset + ); + } + + /** + * Determine if the error type is fatal. + * + * @param int $type + * @return bool + */ + protected function isFatal($type) + { + return in_array($type, [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE]); + } + + /** + * Get an instance of the exception handler. + * + * @return \Illuminate\Contracts\Debug\ExceptionHandler + */ + protected function getExceptionHandler() + { + return $this->app->make('Illuminate\Contracts\Debug\ExceptionHandler'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php index 3cd8ca6..9f1c731 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php @@ -1,4 +1,6 @@ -getCachedConfigPath())) - { - $items = require $cached; - - $loadedFromCache = true; - } - - $app->instance('config', $config = new Repository($items)); - - // Next we will spin through all of the configuration files in the configuration - // directory and load each one into the repository. This will make all of the - // options available to the developer for use in various parts of this app. - if ( ! isset($loadedFromCache)) - { - $this->loadConfigurationFiles($app, $config); - } - - date_default_timezone_set($config['app.timezone']); - - mb_internal_encoding('UTF-8'); - } - - /** - * Load the configuration items from all of the files. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @param \Illuminate\Contracts\Config\Repository $config - * @return void - */ - protected function loadConfigurationFiles(Application $app, RepositoryContract $config) - { - foreach ($this->getConfigurationFiles($app) as $key => $path) - { - $config->set($key, require $path); - } - } - - /** - * Get all of the configuration files for the application. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return array - */ - protected function getConfigurationFiles(Application $app) - { - $files = []; - - foreach (Finder::create()->files()->name('*.php')->in($app->configPath()) as $file) - { - $nesting = $this->getConfigurationNesting($file); - - $files[$nesting.basename($file->getRealPath(), '.php')] = $file->getRealPath(); - } - - return $files; - } - - /** - * Get the configuration file nesting path. - * - * @param \Symfony\Component\Finder\SplFileInfo $file - * @return string - */ - private function getConfigurationNesting(SplFileInfo $file) - { - $directory = dirname($file->getRealPath()); - - if ($tree = trim(str_replace(config_path(), '', $directory), DIRECTORY_SEPARATOR)) - { - $tree = str_replace(DIRECTORY_SEPARATOR, '.', $tree).'.'; - } - - return $tree; - } - +class LoadConfiguration +{ + /** + * Bootstrap the given application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + public function bootstrap(Application $app) + { + $items = []; + + // First we will see if we have a cache configuration file. If we do, we'll load + // the configuration items from that file so that it is very quick. Otherwise + // we will need to spin through every configuration file and load them all. + if (file_exists($cached = $app->getCachedConfigPath())) { + $items = require $cached; + + $loadedFromCache = true; + } + + $app->instance('config', $config = new Repository($items)); + + // Next we will spin through all of the configuration files in the configuration + // directory and load each one into the repository. This will make all of the + // options available to the developer for use in various parts of this app. + if (! isset($loadedFromCache)) { + $this->loadConfigurationFiles($app, $config); + } + + date_default_timezone_set($config['app.timezone']); + + mb_internal_encoding('UTF-8'); + } + + /** + * Load the configuration items from all of the files. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param \Illuminate\Contracts\Config\Repository $repository + * @return void + */ + protected function loadConfigurationFiles(Application $app, RepositoryContract $repository) + { + foreach ($this->getConfigurationFiles($app) as $key => $path) { + $repository->set($key, require $path); + } + } + + /** + * Get all of the configuration files for the application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return array + */ + protected function getConfigurationFiles(Application $app) + { + $files = []; + + $configPath = realpath($app->configPath()); + + foreach (Finder::create()->files()->name('*.php')->in($configPath) as $file) { + $nesting = $this->getConfigurationNesting($file, $configPath); + + $files[$nesting.basename($file->getRealPath(), '.php')] = $file->getRealPath(); + } + + return $files; + } + + /** + * Get the configuration file nesting path. + * + * @param \Symfony\Component\Finder\SplFileInfo $file + * @param string $configPath + * @return string + */ + protected function getConfigurationNesting(SplFileInfo $file, $configPath) + { + $directory = dirname($file->getRealPath()); + + if ($tree = trim(str_replace($configPath, '', $directory), DIRECTORY_SEPARATOR)) { + $tree = str_replace(DIRECTORY_SEPARATOR, '.', $tree).'.'; + } + + return $tree; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php index e626bab..7db2174 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php @@ -1,24 +1,25 @@ -register(); - } + Facade::setFacadeApplication($app); + AliasLoader::getInstance($app->make('config')->get('app.aliases'))->register(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php index 350e117..f18375c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php @@ -1,18 +1,19 @@ -registerConfiguredProviders(); - } +use Illuminate\Contracts\Foundation\Application; +class RegisterProviders +{ + /** + * Bootstrap the given application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + public function bootstrap(Application $app) + { + $app->registerConfiguredProviders(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php index 3ec6fab..ea9ef10 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php @@ -1,21 +1,22 @@ -get('app.url', 'http://localhost'); - - $app->instance('request', Request::create($url, 'GET', [], [], [], $_SERVER)); - } +class SetRequestForConsole +{ + /** + * Bootstrap the given application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + public function bootstrap(Application $app) + { + $url = $app->make('config')->get('app.url', 'http://localhost'); + $app->instance('request', Request::create($url, 'GET', [], [], [], $_SERVER)); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesCommands.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesCommands.php index d22a5d5..cc6678c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesCommands.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesCommands.php @@ -1,43 +1,11 @@ -dispatch($command); - } - - /** - * Marshal a command and dispatch it to its appropriate handler. - * - * @param mixed $command - * @param array $array - * @return mixed - */ - protected function dispatchFromArray($command, array $array) - { - return app('Illuminate\Contracts\Bus\Dispatcher')->dispatchFromArray($command, $array); - } - - /** - * Marshal a command and dispatch it to its appropriate handler. - * - * @param mixed $command - * @param \ArrayAccess $source - * @param array $extras - * @return mixed - */ - protected function dispatchFrom($command, ArrayAccess $source, $extras = []) - { - return app('Illuminate\Contracts\Bus\Dispatcher')->dispatchFrom($command, $source, $extras); - } +namespace Illuminate\Foundation\Bus; +/** + * @deprecated since version 5.1. Use the DispatchesJobs trait directly. + */ +trait DispatchesCommands +{ + use DispatchesJobs; } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php new file mode 100644 index 0000000..7b486c1 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php @@ -0,0 +1,44 @@ +dispatch($job); + } + + /** + * Marshal a job and dispatch it to its appropriate handler. + * + * @param mixed $job + * @param array $array + * @return mixed + */ + protected function dispatchFromArray($job, array $array) + { + return app('Illuminate\Contracts\Bus\Dispatcher')->dispatchFromArray($job, $array); + } + + /** + * Marshal a job and dispatch it to its appropriate handler. + * + * @param mixed $job + * @param \ArrayAccess $source + * @param array $extras + * @return mixed + */ + protected function dispatchFrom($job, ArrayAccess $source, $extras = []) + { + return app('Illuminate\Contracts\Bus\Dispatcher')->dispatchFrom($job, $source, $extras); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Composer.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Composer.php index abe7102..1027394 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Composer.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Composer.php @@ -1,98 +1,106 @@ -files = $files; + $this->workingPath = $workingPath; + } + + /** + * Regenerate the Composer autoloader files. + * + * @param string $extra + * @return void + */ + public function dumpAutoloads($extra = '') + { + $process = $this->getProcess(); + + $process->setCommandLine(trim($this->findComposer().' dump-autoload '.$extra)); + + $process->run(); + } + + /** + * Regenerate the optimized Composer autoloader files. + * + * @return void + */ + public function dumpOptimized() + { + $this->dumpAutoloads('--optimize'); + } + + /** + * Get the composer command for the environment. + * + * @return string + */ + protected function findComposer() + { + if (! $this->files->exists($this->workingPath.'/composer.phar')) { + return 'composer'; + } + + $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); + + if (defined('HHVM_VERSION')) { + $binary .= ' --php'; + } + + return "{$binary} composer.phar"; + } + + /** + * Get a new Symfony process instance. + * + * @return \Symfony\Component\Process\Process + */ + protected function getProcess() + { + return (new Process('', $this->workingPath))->setTimeout(null); + } -class Composer { - - /** - * The filesystem instance. - * - * @var \Illuminate\Filesystem\Filesystem - */ - protected $files; - - /** - * The working path to regenerate from. - * - * @var string - */ - protected $workingPath; - - /** - * Create a new Composer manager instance. - * - * @param \Illuminate\Filesystem\Filesystem $files - * @param string $workingPath - * @return void - */ - public function __construct(Filesystem $files, $workingPath = null) - { - $this->files = $files; - $this->workingPath = $workingPath; - } - - /** - * Regenerate the Composer autoloader files. - * - * @param string $extra - * @return void - */ - public function dumpAutoloads($extra = '') - { - $process = $this->getProcess(); - - $process->setCommandLine(trim($this->findComposer().' dump-autoload '.$extra)); - - $process->run(); - } - - /** - * Regenerate the optimized Composer autoloader files. - * - * @return void - */ - public function dumpOptimized() - { - $this->dumpAutoloads('--optimize'); - } - - /** - * Get the composer command for the environment. - * - * @return string - */ - protected function findComposer() - { - if ($this->files->exists($this->workingPath.'/composer.phar')) - { - return '"'.PHP_BINARY.'" composer.phar'; - } - - return 'composer'; - } - - /** - * Get a new Symfony process instance. - * - * @return \Symfony\Component\Process\Process - */ - protected function getProcess() - { - return (new Process('', $this->workingPath))->setTimeout(null); - } - - /** - * Set the working path used by the class. - * - * @param string $path - * @return $this - */ - public function setWorkingPath($path) - { - $this->workingPath = realpath($path); - - return $this; - } + /** + * Set the working path used by the class. + * + * @param string $path + * @return $this + */ + public function setWorkingPath($path) + { + $this->workingPath = realpath($path); + return $this; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php new file mode 100644 index 0000000..604a0f8 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php @@ -0,0 +1,52 @@ +getComposer()->getConfig()->get('vendor-dir').'/autoload.php'; + + static::clearCompiled(); + } + + /** + * Handle the post-update Composer event. + * + * @param \Composer\Script\Event $event + * @return void + */ + public static function postUpdate(Event $event) + { + require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php'; + + static::clearCompiled(); + } + + /** + * Clear the cached Laravel bootstrapping files. + * + * @return void + */ + protected static function clearCompiled() + { + $laravel = new Application(getcwd()); + + if (file_exists($compiledPath = $laravel->getCachedCompilePath())) { + @unlink($compiledPath); + } + + if (file_exists($servicesPath = $laravel->getCachedServicesPath())) { + @unlink($servicesPath); + } + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/AppNameCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/AppNameCommand.php index d6cf550..99a2798 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/AppNameCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/AppNameCommand.php @@ -1,328 +1,329 @@ -files = $files; - $this->composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->currentRoot = trim($this->getAppNamespace(), '\\'); - - $this->setBootstrapNamespaces(); - - $this->setAppDirectoryNamespace(); - - $this->setConfigNamespaces(); - - $this->setComposerNamespace(); - - $this->setPhpSpecNamespace(); - - $this->info('Application namespace set!'); - - $this->composer->dumpAutoloads(); - - $this->call('clear-compiled'); - } - - /** - * Set the namespace on the files in the app directory. - * - * @return void - */ - protected function setAppDirectoryNamespace() - { - $files = Finder::create() +class AppNameCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'app:name'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Set the application namespace'; + + /** + * The Composer class instance. + * + * @var \Illuminate\Foundation\Composer + */ + protected $composer; + + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * Current root application namespace. + * + * @var string + */ + protected $currentRoot; + + /** + * Create a new key generator command. + * + * @param \Illuminate\Foundation\Composer $composer + * @param \Illuminate\Filesystem\Filesystem $files + * @return void + */ + public function __construct(Composer $composer, Filesystem $files) + { + parent::__construct(); + + $this->files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $this->currentRoot = trim($this->laravel->getNamespace(), '\\'); + + $this->setBootstrapNamespaces(); + + $this->setAppDirectoryNamespace(); + + $this->setConfigNamespaces(); + + $this->setComposerNamespace(); + + $this->setDatabaseFactoryNamespaces(); + + $this->setPhpSpecNamespace(); + + $this->info('Application namespace set!'); + + $this->composer->dumpAutoloads(); + + $this->call('clear-compiled'); + } + + /** + * Set the namespace on the files in the app directory. + * + * @return void + */ + protected function setAppDirectoryNamespace() + { + $files = Finder::create() ->in($this->laravel['path']) ->name('*.php'); - foreach ($files as $file) - { - $this->replaceNamespace($file->getRealPath()); - } - } - - /** - * Replace the App namespace at the given path. - * - * @param string $path - */ - protected function replaceNamespace($path) - { - $search = [ - 'namespace '.$this->currentRoot.';', - $this->currentRoot.'\\', - ]; - - $replace = [ - 'namespace '.$this->argument('name').';', - $this->argument('name').'\\', - ]; - - $this->replaceIn($path, $search, $replace); - } - - /** - * Set the bootstrap namespaces. - * - * @return void - */ - protected function setBootstrapNamespaces() - { - $search = [ - $this->currentRoot.'\\Http', - $this->currentRoot.'\\Console', - $this->currentRoot.'\\Exceptions', - ]; - - $replace = [ - $this->argument('name').'\\Http', - $this->argument('name').'\\Console', - $this->argument('name').'\\Exceptions', - ]; - - $this->replaceIn($this->getBootstrapPath(), $search, $replace); - } - - /** - * Set the PSR-4 namespace in the Composer file. - * - * @return void - */ - protected function setComposerNamespace() - { - $this->replaceIn( - $this->getComposerPath(), $this->currentRoot.'\\\\', str_replace('\\', '\\\\', $this->argument('name')).'\\\\' - ); - } - - /** - * Set the namespace in the appropriate configuration files. - * - * @return void - */ - protected function setConfigNamespaces() - { - $this->setAppConfigNamespaces(); - - $this->setAuthConfigNamespace(); - - $this->setServicesConfigNamespace(); - } - - /** - * Set the application provider namespaces. - * - * @return void - */ - protected function setAppConfigNamespaces() - { - $search = [ - $this->currentRoot.'\\Providers', - $this->currentRoot.'\\Http\\Controllers\\', - ]; - - $replace = [ - $this->argument('name').'\\Providers', - $this->argument('name').'\\Http\\Controllers\\', - ]; - - $this->replaceIn($this->getConfigPath('app'), $search, $replace); - } - - /** - * Set the authentication User namespace. - * - * @return void - */ - protected function setAuthConfigNamespace() - { - $this->replaceIn( - $this->getAuthConfigPath(), $this->currentRoot.'\\User', $this->argument('name').'\\User' - ); - } - - /** - * Set the services User namespace. - * - * @return void - */ - protected function setServicesConfigNamespace() - { - $this->replaceIn( - $this->getServicesConfigPath(), $this->currentRoot.'\\User', $this->argument('name').'\\User' - ); - } - - /** - * Set the PHPSpec configuration namespace. - * - * @return void - */ - protected function setPhpSpecNamespace() - { - if ($this->files->exists($path = $this->getPhpSpecConfigPath())) - { - $this->replaceIn($path, $this->currentRoot, $this->argument('name')); - } - } - - /** - * Replace the given string in the given file. - * - * @param string $path - * @param string|array $search - * @param string|array $replace - * @return void - */ - protected function replaceIn($path, $search, $replace) - { - $this->files->put($path, str_replace($search, $replace, $this->files->get($path))); - } - - /** - * Get the path to the Core User class. - * - * @return string - */ - protected function getUserClassPath() - { - return $this->laravel['path'].'/Core/User.php'; - } - - /** - * Get the path to the bootstrap/app.php file. - * - * @return string - */ - protected function getBootstrapPath() - { - return $this->laravel->basePath().'/bootstrap/app.php'; - } - - /** - * Get the path to the Composer.json file. - * - * @return string - */ - protected function getComposerPath() - { - return $this->laravel->basePath().'/composer.json'; - } - - /** - * Get the path to the given configuration file. - * - * @param string $name - * @return string - */ - protected function getConfigPath($name) - { - return $this->laravel['path.config'].'/'.$name.'.php'; - } - - /** - * Get the path to the authentication configuration file. - * - * @return string - */ - protected function getAuthConfigPath() - { - return $this->getConfigPath('auth'); - } - - /** - * Get the path to the services configuration file. - * - * @return string - */ - protected function getServicesConfigPath() - { - return $this->getConfigPath('services'); - } - - /** - * Get the path to the PHPSpec configuration file. - * - * @return string - */ - protected function getPhpSpecConfigPath() - { - return $this->laravel->basePath().'/phpspec.yml'; - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return array( - array('name', InputArgument::REQUIRED, 'The desired namespace.'), - ); - } - + foreach ($files as $file) { + $this->replaceNamespace($file->getRealPath()); + } + } + + /** + * Replace the App namespace at the given path. + * + * @param string $path + * @return void + */ + protected function replaceNamespace($path) + { + $search = [ + 'namespace '.$this->currentRoot.';', + $this->currentRoot.'\\', + ]; + + $replace = [ + 'namespace '.$this->argument('name').';', + $this->argument('name').'\\', + ]; + + $this->replaceIn($path, $search, $replace); + } + + /** + * Set the bootstrap namespaces. + * + * @return void + */ + protected function setBootstrapNamespaces() + { + $search = [ + $this->currentRoot.'\\Http', + $this->currentRoot.'\\Console', + $this->currentRoot.'\\Exceptions', + ]; + + $replace = [ + $this->argument('name').'\\Http', + $this->argument('name').'\\Console', + $this->argument('name').'\\Exceptions', + ]; + + $this->replaceIn($this->getBootstrapPath(), $search, $replace); + } + + /** + * Set the PSR-4 namespace in the Composer file. + * + * @return void + */ + protected function setComposerNamespace() + { + $this->replaceIn( + $this->getComposerPath(), str_replace('\\', '\\\\', $this->currentRoot).'\\\\', str_replace('\\', '\\\\', $this->argument('name')).'\\\\' + ); + } + + /** + * Set the namespace in the appropriate configuration files. + * + * @return void + */ + protected function setConfigNamespaces() + { + $this->setAppConfigNamespaces(); + + $this->setAuthConfigNamespace(); + + $this->setServicesConfigNamespace(); + } + + /** + * Set the application provider namespaces. + * + * @return void + */ + protected function setAppConfigNamespaces() + { + $search = [ + $this->currentRoot.'\\Providers', + $this->currentRoot.'\\Http\\Controllers\\', + ]; + + $replace = [ + $this->argument('name').'\\Providers', + $this->argument('name').'\\Http\\Controllers\\', + ]; + + $this->replaceIn($this->getConfigPath('app'), $search, $replace); + } + + /** + * Set the authentication User namespace. + * + * @return void + */ + protected function setAuthConfigNamespace() + { + $this->replaceIn( + $this->getAuthConfigPath(), $this->currentRoot.'\\User', $this->argument('name').'\\User' + ); + } + + /** + * Set the services User namespace. + * + * @return void + */ + protected function setServicesConfigNamespace() + { + $this->replaceIn( + $this->getServicesConfigPath(), $this->currentRoot.'\\User', $this->argument('name').'\\User' + ); + } + + /** + * Set the PHPSpec configuration namespace. + * + * @return void + */ + protected function setPhpSpecNamespace() + { + if ($this->files->exists($path = $this->getPhpSpecConfigPath())) { + $this->replaceIn($path, $this->currentRoot, $this->argument('name')); + } + } + + /** + * Set the namespace in database factory files. + * + * @return void + */ + protected function setDatabaseFactoryNamespaces() + { + $this->replaceIn( + $this->laravel->databasePath().'/factories/ModelFactory.php', $this->currentRoot, $this->argument('name') + ); + } + + /** + * Replace the given string in the given file. + * + * @param string $path + * @param string|array $search + * @param string|array $replace + * @return void + */ + protected function replaceIn($path, $search, $replace) + { + $this->files->put($path, str_replace($search, $replace, $this->files->get($path))); + } + + /** + * Get the path to the bootstrap/app.php file. + * + * @return string + */ + protected function getBootstrapPath() + { + return $this->laravel->basePath().'/bootstrap/app.php'; + } + + /** + * Get the path to the Composer.json file. + * + * @return string + */ + protected function getComposerPath() + { + return $this->laravel->basePath().'/composer.json'; + } + + /** + * Get the path to the given configuration file. + * + * @param string $name + * @return string + */ + protected function getConfigPath($name) + { + return $this->laravel['path.config'].'/'.$name.'.php'; + } + + /** + * Get the path to the authentication configuration file. + * + * @return string + */ + protected function getAuthConfigPath() + { + return $this->getConfigPath('auth'); + } + + /** + * Get the path to the services configuration file. + * + * @return string + */ + protected function getServicesConfigPath() + { + return $this->getConfigPath('services'); + } + + /** + * Get the path to the PHPSpec configuration file. + * + * @return string + */ + protected function getPhpSpecConfigPath() + { + return $this->laravel->basePath().'/phpspec.yml'; + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['name', InputArgument::REQUIRED, 'The desired namespace.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php index fa78540..a2f3c34 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php @@ -1,42 +1,41 @@ -laravel->getCachedCompilePath(); - $servicesPath = $this->laravel->getCachedServicesPath(); - - if (file_exists($compiledPath)) - { - @unlink($compiledPath); - } - - if (file_exists($servicesPath)) - { - @unlink($servicesPath); - } - } +use Illuminate\Console\Command; +class ClearCompiledCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'clear-compiled'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Remove the compiled class file'; + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $compiledPath = $this->laravel->getCachedCompilePath(); + $servicesPath = $this->laravel->getCachedServicesPath(); + + if (file_exists($compiledPath)) { + @unlink($compiledPath); + } + + if (file_exists($servicesPath)) { + @unlink($servicesPath); + } + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/CommandMakeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/CommandMakeCommand.php index d376007..d009dc2 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/CommandMakeCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/CommandMakeCommand.php @@ -1,97 +1,90 @@ -option('handler')) - { - $this->call('handler:command', [ - 'name' => $this->argument('name').'Handler', - '--command' => $this->parseName($this->argument('name')), - ]); - } - } + /** + * Execute the command. + * + * @return void + */ + public function fire() + { + parent::fire(); - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - if ($this->option('queued') && $this->option('handler')) - { - return __DIR__.'/stubs/command-queued-with-handler.stub'; - } - elseif ($this->option('queued')) - { - return __DIR__.'/stubs/command-queued.stub'; - } - elseif ($this->option('handler')) - { - return __DIR__.'/stubs/command-with-handler.stub'; - } - else - { - return __DIR__.'/stubs/command.stub'; - } - } + if ($this->option('handler')) { + $this->call('handler:command', [ + 'name' => $this->argument('name').'Handler', + '--command' => $this->parseName($this->argument('name')), + ]); + } + } - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Commands'; - } + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + if ($this->option('queued') && $this->option('handler')) { + return __DIR__.'/stubs/command-queued-with-handler.stub'; + } elseif ($this->option('queued')) { + return __DIR__.'/stubs/command-queued.stub'; + } elseif ($this->option('handler')) { + return __DIR__.'/stubs/command-with-handler.stub'; + } else { + return __DIR__.'/stubs/command.stub'; + } + } - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('handler', null, InputOption::VALUE_NONE, 'Indicates that handler class should be generated.'), + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Commands'; + } - array('queued', null, InputOption::VALUE_NONE, 'Indicates that command should be queued.'), - ); - } + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['handler', null, InputOption::VALUE_NONE, 'Indicates that handler class should be generated.'], + ['queued', null, InputOption::VALUE_NONE, 'Indicates that command should be queued.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php index 431d0c2..2152cfa 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php @@ -1,93 +1,75 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->call('config:clear'); - - $config = $this->setRealSessionDriver( - $this->getFreshConfiguration() - ); - - $this->files->put( - $this->laravel->getCachedConfigPath(), 'info('Configuration cached successfully!'); - } - - /** - * Boot a fresh copy of the application configuration. - * - * @return array - */ - protected function getFreshConfiguration() - { - $app = require $this->laravel->basePath().'/bootstrap/app.php'; - - $app->make('Illuminate\Contracts\Console\Kernel')->bootstrap(); - - return $app['config']->all(); - } - - /** - * Set the "real" session driver on the configuration array. - * - * Typically the SessionManager forces the driver to "array" in CLI environment. - * - * @param array $config - * @return array - */ - protected function setRealSessionDriver(array $config) - { - $session = require $this->laravel->configPath().'/session.php'; - - $config['session']['driver'] = $session['driver']; - - return $config; - } - +class ConfigCacheCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'config:cache'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Create a cache file for faster configuration loading'; + + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * Create a new config cache command instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @return void + */ + public function __construct(Filesystem $files) + { + parent::__construct(); + + $this->files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $this->call('config:clear'); + + $config = $this->getFreshConfiguration(); + + $this->files->put( + $this->laravel->getCachedConfigPath(), 'info('Configuration cached successfully!'); + } + + /** + * Boot a fresh copy of the application configuration. + * + * @return array + */ + protected function getFreshConfiguration() + { + $app = require $this->laravel->basePath().'/bootstrap/app.php'; + + $app->make('Illuminate\Contracts\Console\Kernel')->bootstrap(); + + return $app['config']->all(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigClearCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigClearCommand.php index 0365c62..bb25a8e 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigClearCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigClearCommand.php @@ -1,54 +1,55 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->files->delete($this->laravel->getCachedConfigPath()); - - $this->info('Configuration cache cleared!'); - } - +class ConfigClearCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'config:clear'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Remove the configuration cache file'; + + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * Create a new config clear command instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @return void + */ + public function __construct(Filesystem $files) + { + parent::__construct(); + + $this->files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $this->files->delete($this->laravel->getCachedConfigPath()); + + $this->info('Configuration cache cleared!'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php index da7e83b..f69a5d6 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php @@ -1,89 +1,90 @@ -option('command'), $stub); - } + /** + * Replace the class name for the given stub. + * + * @param string $stub + * @param string $name + * @return string + */ + protected function replaceClass($stub, $name) + { + $stub = parent::replaceClass($stub, $name); - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - return __DIR__.'/stubs/console.stub'; - } + return str_replace('dummy:command', $this->option('command'), $stub); + } - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Console\Commands'; - } + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return __DIR__.'/stubs/console.stub'; + } - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return array( - array('name', InputArgument::REQUIRED, 'The name of the command.'), - ); - } + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Console\Commands'; + } - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('command', null, InputOption::VALUE_OPTIONAL, 'The terminal command that should be assigned.', 'command:name'), - ); - } + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['name', InputArgument::REQUIRED, 'The name of the command.'], + ]; + } + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['command', null, InputOption::VALUE_OPTIONAL, 'The terminal command that should be assigned.', 'command:name'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/DownCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/DownCommand.php index 317eaf8..05ad35b 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/DownCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/DownCommand.php @@ -1,33 +1,34 @@ -laravel->storagePath().'/framework/down'); + /** + * The console command description. + * + * @var string + */ + protected $description = 'Put the application into maintenance mode'; - $this->comment('Application is now in maintenance mode.'); - } + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + touch($this->laravel->storagePath().'/framework/down'); + $this->comment('Application is now in maintenance mode.'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php index 5a12976..b227165 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php @@ -1,31 +1,32 @@ -line('Current application environment: '.$this->laravel['env'].''); - } + /** + * The console command description. + * + * @var string + */ + protected $description = 'Display the current framework environment'; + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $this->line('Current application environment: '.$this->laravel['env'].''); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php index b5ec2b3..f08ebdd 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php @@ -1,48 +1,51 @@ -laravel->getProvider( - 'Illuminate\Foundation\Support\Providers\EventServiceProvider' - ); - - foreach ($provider->listens() as $event => $handlers) - { - if ( ! str_contains($event, '\\')) - continue; - - $this->callSilent('make:event', ['name' => $event]); - - foreach ($handlers as $handler) - { - $this->callSilent('handler:event', ['name' => $handler, '--event' => $event]); - } - } - - $this->info('Events and handlers generated successfully!'); - } +use Illuminate\Support\Str; +use Illuminate\Console\Command; +class EventGenerateCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'event:generate'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Generate the missing events and listeners based on registration'; + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $provider = $this->laravel->getProvider( + 'Illuminate\Foundation\Support\Providers\EventServiceProvider' + ); + + foreach ($provider->listens() as $event => $listeners) { + if (! Str::contains($event, '\\')) { + continue; + } + + $this->callSilent('make:event', ['name' => $event]); + + foreach ($listeners as $listener) { + $listener = preg_replace('/@.+$/', '', $listener); + + $this->callSilent('make:listener', ['name' => $listener, '--event' => $event]); + } + } + + $this->info('Events and listeners generated successfully!'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php index 0730125..f18719a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php @@ -1,49 +1,61 @@ -confirmToProceed()) return; - - $files = new Filesystem; - - $files->deleteDirectory(app_path('Services')); - $files->delete(base_path('resources/views/app.blade.php')); - $files->delete(base_path('resources/views/home.blade.php')); - $files->deleteDirectory(app_path('Http/Controllers/Auth')); - $files->deleteDirectory(base_path('resources/views/auth')); - $files->deleteDirectory(base_path('resources/views/emails')); - $files->delete(app_path('Http/Controllers/HomeController.php')); - - $files->deleteDirectory(base_path('public/css')); - $files->deleteDirectory(base_path('public/fonts')); - $files->put(base_path('resources/assets/less/app.less'), ''.PHP_EOL); - $files->deleteDirectory(base_path('resources/assets/less/bootstrap')); - - $files->delete(base_path('database/migrations/2014_10_12_000000_create_users_table.php')); - $files->delete(base_path('database/migrations/2014_10_12_100000_create_password_resets_table.php')); - - $files->put(app_path('Http/routes.php'), $files->get(__DIR__.'/stubs/fresh-routes.stub')); - $files->put(app_path('Providers/AppServiceProvider.php'), $files->get(__DIR__.'/stubs/fresh-app-provider.stub')); - - $this->info('Scaffolding removed! Enjoy your fresh start.'); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'), - ); - } - -} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/HandlerCommandCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/HandlerCommandCommand.php index f1da67d..33de193 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/HandlerCommandCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/HandlerCommandCommand.php @@ -1,83 +1,84 @@ -option('command')), $stub - ); + /** + * Build the class with the given name. + * + * @param string $name + * @return string + */ + protected function buildClass($name) + { + $stub = parent::buildClass($name); - $stub = str_replace( - '{{fullCommand}}', $this->option('command'), $stub - ); + $stub = str_replace( + 'DummyCommand', class_basename($this->option('command')), $stub + ); - return $stub; - } + $stub = str_replace( + 'DummyFullCommand', $this->option('command'), $stub + ); - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - return __DIR__.'/stubs/command-handler.stub'; - } + return $stub; + } - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Handlers\Commands'; - } + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return __DIR__.'/stubs/command-handler.stub'; + } - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('command', null, InputOption::VALUE_REQUIRED, 'The command class the handler handles.'), - ); - } + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Handlers\Commands'; + } + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['command', null, InputOption::VALUE_REQUIRED, 'The command class the handler handles.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/HandlerEventCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/HandlerEventCommand.php index 7e30941..341ffe0 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/HandlerEventCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/HandlerEventCommand.php @@ -1,99 +1,97 @@ -option('event'); - - if ( ! starts_with($event, $this->getAppNamespace())) - { - $event = $this->getAppNamespace().'Events\\'.$event; - } - - $stub = str_replace( - '{{event}}', class_basename($event), $stub - ); - - $stub = str_replace( - '{{fullEvent}}', $event, $stub - ); - - return $stub; - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - if ($this->option('queued')) - { - return __DIR__.'/stubs/event-handler-queued.stub'; - } - else - { - return __DIR__.'/stubs/event-handler.stub'; - } - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Handlers\Events'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('event', null, InputOption::VALUE_REQUIRED, 'The event class the handler handles.'), - - array('queued', null, InputOption::VALUE_NONE, 'Indicates the event handler should be queued.'), - ); - } - +class HandlerEventCommand extends GeneratorCommand +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'handler:event'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Create a new event handler class'; + + /** + * The type of class being generated. + * + * @var string + */ + protected $type = 'Handler'; + + /** + * Build the class with the given name. + * + * @param string $name + * @return string + */ + protected function buildClass($name) + { + $stub = parent::buildClass($name); + + $event = $this->option('event'); + + if (! Str::startsWith($event, $this->laravel->getNamespace())) { + $event = $this->laravel->getNamespace().'Events\\'.$event; + } + + $stub = str_replace( + 'DummyEvent', class_basename($event), $stub + ); + + $stub = str_replace( + 'DummyFullEvent', $event, $stub + ); + + return $stub; + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + if ($this->option('queued')) { + return __DIR__.'/stubs/event-handler-queued.stub'; + } else { + return __DIR__.'/stubs/event-handler.stub'; + } + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Handlers\Events'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['event', null, InputOption::VALUE_REQUIRED, 'The event class the handler handles.'], + + ['queued', null, InputOption::VALUE_NONE, 'Indicates the event handler should be queued.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/IlluminateCaster.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/IlluminateCaster.php new file mode 100644 index 0000000..e555c82 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/IlluminateCaster.php @@ -0,0 +1,97 @@ +$property(); + + if (! is_null($val)) { + $results[Caster::PREFIX_VIRTUAL.$property] = $val; + } + } catch (Exception $e) { + // + } + } + + return $results; + } + + /** + * Get an array representing the properties of a collection. + * + * @param \Illuminate\Support\Collection $collection + * @return array + */ + public static function castCollection(Collection $collection) + { + return [ + Caster::PREFIX_VIRTUAL.'all' => $collection->all(), + ]; + } + + /** + * Get an array representing the properties of a model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return array + */ + public static function castModel(Model $model) + { + $attributes = array_merge( + $model->getAttributes(), $model->getRelations() + ); + + $visible = array_flip( + $model->getVisible() ?: array_diff(array_keys($attributes), $model->getHidden()) + ); + + $results = []; + + foreach (array_intersect_key($attributes, $visible) as $key => $value) { + $results[(isset($visible[$key]) ? Caster::PREFIX_VIRTUAL : Caster::PREFIX_PROTECTED).$key] = $value; + } + + return $results; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/JobMakeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/JobMakeCommand.php new file mode 100644 index 0000000..8e1aeee --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/JobMakeCommand.php @@ -0,0 +1,67 @@ +option('queued')) { + return __DIR__.'/stubs/job-queued.stub'; + } else { + return __DIR__.'/stubs/job.stub'; + } + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Jobs'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['queued', null, InputOption::VALUE_NONE, 'Indicates that job should be queued.'], + ]; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php index 3d2e280..991588f 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php @@ -1,250 +1,264 @@ -app = $app; - $this->events = $events; - - $this->app->booted(function() - { - $this->defineConsoleSchedule(); - }); - } - - /** - * Define the application's command schedule. - * - * @return void - */ - protected function defineConsoleSchedule() - { - $this->app->instance( - 'Illuminate\Console\Scheduling\Schedule', $schedule = new Schedule - ); - - $this->schedule($schedule); - } - - /** - * Run the console application. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return int - */ - public function handle($input, $output = null) - { - try - { - $this->bootstrap(); - - return $this->getArtisan()->run($input, $output); - } - catch (Exception $e) - { - $this->reportException($e); - - $this->renderException($output, $e); - - return 1; - } - } - - /** - * Terminate the application. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param int $status - * @return void - */ - public function terminate($input, $status) - { - $this->app->terminate(); - } - - /** - * Define the application's command schedule. - * - * @param \Illuminate\Console\Scheduling\Schedule $schedule - * @return void - */ - protected function schedule(Schedule $schedule) - { - // - } - - /** - * Run an Artisan console command by name. - * - * @param string $command - * @param array $parameters - * @return int - */ - public function call($command, array $parameters = array()) - { - $this->bootstrap(); - - // If we are calling a arbitary command from within the application, we will load - // all of the available deferred providers which will make all of the commands - // available to an application. Otherwise the command will not be available. - $this->app->loadDeferredProviders(); - - return $this->getArtisan()->call($command, $parameters); - } - - /** - * Queue the given console command. - * - * @param string $command - * @param array $parameters - * @return void - */ - public function queue($command, array $parameters = array()) - { - $this->app['Illuminate\Contracts\Queue\Queue']->push( - 'Illuminate\Foundation\Console\QueuedJob', func_get_args() - ); - } - - /** - * Get all of the commands registered with the console. - * - * @return array - */ - public function all() - { - $this->bootstrap(); - - return $this->getArtisan()->all(); - } - - /** - * Get the output for the last run command. - * - * @return string - */ - public function output() - { - $this->bootstrap(); - - return $this->getArtisan()->output(); - } - - /** - * Bootstrap the application for HTTP requests. - * - * @return void - */ - public function bootstrap() - { - if ( ! $this->app->hasBeenBootstrapped()) - { - $this->app->bootstrapWith($this->bootstrappers()); - } - - $this->app->loadDeferredProviders(); - } - - /** - * Get the Artisan application instance. - * - * @return \Illuminate\Console\Application - */ - protected function getArtisan() - { - if (is_null($this->artisan)) - { - return $this->artisan = (new Artisan($this->app, $this->events, $this->app->version())) - ->resolveCommands($this->commands); - } - - return $this->artisan; - } - - /** - * Get the bootstrap classes for the application. - * - * @return array - */ - protected function bootstrappers() - { - return $this->bootstrappers; - } - - /** - * Report the exception to the exception handler. - * - * @param \Exception $e - * @return void - */ - protected function reportException(Exception $e) - { - $this->app['Illuminate\Contracts\Debug\ExceptionHandler']->report($e); - } - - /** - * Report the exception to the exception handler. - * - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @param \Exception $e - * @return void - */ - protected function renderException($output, Exception $e) - { - $this->app['Illuminate\Contracts\Debug\ExceptionHandler']->renderForConsole($output, $e); - } - +use Symfony\Component\Debug\Exception\FatalThrowableError; + +class Kernel implements KernelContract +{ + /** + * The application implementation. + * + * @var \Illuminate\Contracts\Foundation\Application + */ + protected $app; + + /** + * The event dispatcher implementation. + * + * @var \Illuminate\Contracts\Events\Dispatcher + */ + protected $events; + + /** + * The Artisan application instance. + * + * @var \Illuminate\Console\Application + */ + protected $artisan; + + /** + * The Artisan commands provided by the application. + * + * @var array + */ + protected $commands = []; + + /** + * The bootstrap classes for the application. + * + * @var array + */ + protected $bootstrappers = [ + 'Illuminate\Foundation\Bootstrap\DetectEnvironment', + 'Illuminate\Foundation\Bootstrap\LoadConfiguration', + 'Illuminate\Foundation\Bootstrap\ConfigureLogging', + 'Illuminate\Foundation\Bootstrap\HandleExceptions', + 'Illuminate\Foundation\Bootstrap\RegisterFacades', + 'Illuminate\Foundation\Bootstrap\SetRequestForConsole', + 'Illuminate\Foundation\Bootstrap\RegisterProviders', + 'Illuminate\Foundation\Bootstrap\BootProviders', + ]; + + /** + * Create a new console kernel instance. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function __construct(Application $app, Dispatcher $events) + { + if (! defined('ARTISAN_BINARY')) { + define('ARTISAN_BINARY', 'artisan'); + } + + $this->app = $app; + $this->events = $events; + + $this->app->booted(function () { + $this->defineConsoleSchedule(); + }); + } + + /** + * Define the application's command schedule. + * + * @return void + */ + protected function defineConsoleSchedule() + { + $this->app->instance( + 'Illuminate\Console\Scheduling\Schedule', $schedule = new Schedule + ); + + $this->schedule($schedule); + } + + /** + * Run the console application. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @return int + */ + public function handle($input, $output = null) + { + try { + $this->bootstrap(); + + return $this->getArtisan()->run($input, $output); + } catch (Exception $e) { + $this->reportException($e); + + $this->renderException($output, $e); + + return 1; + } catch (Throwable $e) { + $e = new FatalThrowableError($e); + + $this->reportException($e); + + $this->renderException($output, $e); + + return 1; + } + } + + /** + * Terminate the application. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param int $status + * @return void + */ + public function terminate($input, $status) + { + $this->app->terminate(); + } + + /** + * Define the application's command schedule. + * + * @param \Illuminate\Console\Scheduling\Schedule $schedule + * @return void + */ + protected function schedule(Schedule $schedule) + { + // + } + + /** + * Run an Artisan console command by name. + * + * @param string $command + * @param array $parameters + * @return int + */ + public function call($command, array $parameters = []) + { + $this->bootstrap(); + + return $this->getArtisan()->call($command, $parameters); + } + + /** + * Queue the given console command. + * + * @param string $command + * @param array $parameters + * @return void + */ + public function queue($command, array $parameters = []) + { + $this->app['Illuminate\Contracts\Queue\Queue']->push( + 'Illuminate\Foundation\Console\QueuedJob', func_get_args() + ); + } + + /** + * Get all of the commands registered with the console. + * + * @return array + */ + public function all() + { + $this->bootstrap(); + + return $this->getArtisan()->all(); + } + + /** + * Get the output for the last run command. + * + * @return string + */ + public function output() + { + $this->bootstrap(); + + return $this->getArtisan()->output(); + } + + /** + * Bootstrap the application for artisan commands. + * + * @return void + */ + public function bootstrap() + { + if (! $this->app->hasBeenBootstrapped()) { + $this->app->bootstrapWith($this->bootstrappers()); + } + + // If we are calling an arbitrary command from within the application, we'll load + // all of the available deferred providers which will make all of the commands + // available to an application. Otherwise the command will not be available. + $this->app->loadDeferredProviders(); + } + + /** + * Get the Artisan application instance. + * + * @return \Illuminate\Console\Application + */ + protected function getArtisan() + { + if (is_null($this->artisan)) { + return $this->artisan = (new Artisan($this->app, $this->events, $this->app->version())) + ->resolveCommands($this->commands); + } + + return $this->artisan; + } + + /** + * Get the bootstrap classes for the application. + * + * @return array + */ + protected function bootstrappers() + { + return $this->bootstrappers; + } + + /** + * Report the exception to the exception handler. + * + * @param \Exception $e + * @return void + */ + protected function reportException(Exception $e) + { + $this->app['Illuminate\Contracts\Debug\ExceptionHandler']->report($e); + } + + /** + * Report the exception to the exception handler. + * + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @param \Exception $e + * @return void + */ + protected function renderException($output, Exception $e) + { + $this->app['Illuminate\Contracts\Debug\ExceptionHandler']->renderForConsole($output, $e); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php index 977a4ed..12d8bc9 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php @@ -1,73 +1,77 @@ -getRandomKey(); + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $key = $this->getRandomKey($this->laravel['config']['app.cipher']); - if ($this->option('show')) - { - return $this->line(''.$key.''); - } + if ($this->option('show')) { + return $this->line(''.$key.''); + } - $path = base_path('.env'); + $path = base_path('.env'); - if (file_exists($path)) - { - file_put_contents($path, str_replace( - $this->laravel['config']['app.key'], $key, file_get_contents($path) - )); - } + if (file_exists($path)) { + file_put_contents($path, str_replace( + 'APP_KEY='.$this->laravel['config']['app.key'], 'APP_KEY='.$key, file_get_contents($path) + )); + } - $this->laravel['config']['app.key'] = $key; + $this->laravel['config']['app.key'] = $key; - $this->info("Application key [$key] set successfully."); - } + $this->info("Application key [$key] set successfully."); + } - /** - * Generate a random key for the application. - * - * @return string - */ - protected function getRandomKey() - { - return Str::random(32); - } + /** + * Generate a random key for the application. + * + * @param string $cipher + * @return string + */ + protected function getRandomKey($cipher) + { + if ($cipher === 'AES-128-CBC') { + return Str::random(16); + } - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('show', null, InputOption::VALUE_NONE, 'Simply display the key instead of modifying files.'), - ); - } + return Str::random(32); + } + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['show', null, InputOption::VALUE_NONE, 'Simply display the key instead of modifying files.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ListenerMakeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ListenerMakeCommand.php new file mode 100644 index 0000000..62861df --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ListenerMakeCommand.php @@ -0,0 +1,111 @@ +option('event')) { + return $this->error('Missing required option: --event'); + } + + parent::fire(); + } + + /** + * Build the class with the given name. + * + * @param string $name + * @return string + */ + protected function buildClass($name) + { + $stub = parent::buildClass($name); + + $event = $this->option('event'); + + if (! Str::startsWith($event, $this->laravel->getNamespace())) { + $event = $this->laravel->getNamespace().'Events\\'.$event; + } + + $stub = str_replace( + 'DummyEvent', class_basename($event), $stub + ); + + $stub = str_replace( + 'DummyFullEvent', $event, $stub + ); + + return $stub; + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + if ($this->option('queued')) { + return __DIR__.'/stubs/listener-queued.stub'; + } else { + return __DIR__.'/stubs/listener.stub'; + } + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Listeners'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['event', null, InputOption::VALUE_REQUIRED, 'The event class being listened for.'], + + ['queued', null, InputOption::VALUE_NONE, 'Indicates the event listener should be queued.'], + ]; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php index caf3ea0..ea95a51 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php @@ -1,80 +1,80 @@ -option('no-migration')) - { - $table = str_plural(snake_case(class_basename($this->argument('name')))); + /** + * The type of class being generated. + * + * @var string + */ + protected $type = 'Model'; - $this->call('make:migration', ['name' => "create_{$table}_table", '--create' => $table]); - } - } - } + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + if (parent::fire() !== false) { + if ($this->option('migration')) { + $table = Str::plural(Str::snake(class_basename($this->argument('name')))); - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - return __DIR__.'/stubs/model.stub'; - } + $this->call('make:migration', ['name' => "create_{$table}_table", '--create' => $table]); + } + } + } - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace; - } + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return __DIR__.'/stubs/model.stub'; + } - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('no-migration', null, InputOption::VALUE_NONE, 'Do not create a new migration file.'), - ); - } + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace; + } + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Optimize/config.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Optimize/config.php index f2cec32..1f024e0 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Optimize/config.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Optimize/config.php @@ -2,7 +2,7 @@ $basePath = $app['path.base']; -return array_map('realpath', array( +return [ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Container/Container.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Container/ContextualBindingBuilder.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Foundation/Application.php', @@ -11,11 +11,9 @@ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Bus/HandlerResolver.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Pipeline/Pipeline.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/Renderable.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/ResponsePreparer.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Logging/Log.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Exception/Handler.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Config/Repository.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Url/Generator.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Events/Dispatcher.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/Arrayable.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/Jsonable.php', @@ -23,13 +21,10 @@ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Cookie/QueueingFactory.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Encryption/Encrypter.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Queue/QueueableEntity.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/HttpKernel.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/Registrar.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/ResponseFactory.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/UrlGenerator.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/UrlRoutable.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/Middleware.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/TerminableMiddleware.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Validation/ValidatesWhenResolved.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/View/Factory.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/MessageProvider.php', @@ -37,14 +32,16 @@ $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/View/View.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Http/Kernel.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Auth/Guard.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Auth/Access/Gate.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Hashing/Hasher.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Auth/Guard.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Auth/UserProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Container/Container.php', - $basePath.'/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php', - $basePath.'/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php', + $basePath.'/vendor/symfony/http-kernel/HttpKernelInterface.php', + $basePath.'/vendor/symfony/http-kernel/TerminableInterface.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Application.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php', @@ -55,25 +52,27 @@ $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Http/Request.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ServerBag.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionInterface.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/AcceptHeaderItem.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/AcceptHeader.php', - $basePath.'/vendor/symfony/debug/Symfony/Component/Debug/ExceptionHandler.php', + $basePath.'/vendor/symfony/http-foundation/Request.php', + $basePath.'/vendor/symfony/http-foundation/ParameterBag.php', + $basePath.'/vendor/symfony/http-foundation/FileBag.php', + $basePath.'/vendor/symfony/http-foundation/ServerBag.php', + $basePath.'/vendor/symfony/http-foundation/HeaderBag.php', + $basePath.'/vendor/symfony/http-foundation/Session/SessionInterface.php', + $basePath.'/vendor/symfony/http-foundation/Session/SessionBagInterface.php', + $basePath.'/vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php', + $basePath.'/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php', + $basePath.'/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php', + $basePath.'/vendor/symfony/http-foundation/AcceptHeaderItem.php', + $basePath.'/vendor/symfony/http-foundation/AcceptHeader.php', + $basePath.'/vendor/symfony/debug/ExceptionHandler.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Support/AggregateServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php', @@ -82,14 +81,14 @@ $basePath.'/vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesCommands.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Providers/EventServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/RouteServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php', @@ -101,12 +100,9 @@ $basePath.'/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Support/Arr.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Support/Str.php', - $basePath.'/vendor/symfony/debug/Symfony/Component/Debug/ErrorHandler.php', - $basePath.'/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php', + $basePath.'/vendor/symfony/debug/ErrorHandler.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Config/Repository.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Config/FileLoader.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Config/LoaderInterface.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php', @@ -120,10 +116,10 @@ $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Router.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Route.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php', - $basePath.'/vendor/symfony/routing/Symfony/Component/Routing/CompiledRoute.php', - $basePath.'/vendor/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php', - $basePath.'/vendor/symfony/routing/Symfony/Component/Routing/RouteCompiler.php', - $basePath.'/vendor/symfony/routing/Symfony/Component/Routing/Route.php', + $basePath.'/vendor/symfony/routing/CompiledRoute.php', + $basePath.'/vendor/symfony/routing/RouteCompilerInterface.php', + $basePath.'/vendor/symfony/routing/RouteCompiler.php', + $basePath.'/vendor/symfony/routing/Route.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Controller.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/ControllerInspector.php', @@ -150,9 +146,9 @@ $basePath.'/vendor/laravel/framework/src/Illuminate/Cookie/CookieJar.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php', + $basePath.'/vendor/laravel/framework/src/Illuminate/Encryption/BaseEncrypter.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Support/Facades/Log.php', - $basePath.'/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Log/Writer.php', $basePath.'/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php', $basePath.'/vendor/monolog/monolog/src/Monolog/Logger.php', @@ -181,31 +177,32 @@ $basePath.'/vendor/laravel/framework/src/Illuminate/View/Compilers/CompilerInterface.php', $basePath.'/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php', $basePath.'/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php', + $basePath.'/vendor/symfony/http-foundation/Response.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Http/Response.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php', - $basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php', - $basePath.'/vendor/symfony/security-core/Symfony/Component/Security/Core/Util/StringUtils.php', - $basePath.'/vendor/symfony/security-core/Symfony/Component/Security/Core/Util/SecureRandomInterface.php', - $basePath.'/vendor/symfony/security-core/Symfony/Component/Security/Core/Util/SecureRandom.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/SplFileInfo.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Expression/Regex.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Expression/ValueInterface.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Expression/Expression.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilterIterator.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Iterator/PathFilterIterator.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Shell/Shell.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Adapter/AdapterInterface.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Adapter/AbstractAdapter.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Adapter/GnuFindAdapter.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Adapter/PhpAdapter.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Adapter/BsdFindAdapter.php', - $basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Finder.php', + $basePath.'/vendor/symfony/http-foundation/ResponseHeaderBag.php', + $basePath.'/vendor/symfony/http-foundation/Cookie.php', + $basePath.'/vendor/symfony/finder/SplFileInfo.php', + $basePath.'/vendor/symfony/finder/Expression/Glob.php', + $basePath.'/vendor/symfony/finder/Expression/Regex.php', + $basePath.'/vendor/symfony/finder/Expression/ValueInterface.php', + $basePath.'/vendor/symfony/finder/Expression/Expression.php', + $basePath.'/vendor/symfony/finder/Iterator/FilterIterator.php', + $basePath.'/vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php', + $basePath.'/vendor/symfony/finder/Iterator/PathFilterIterator.php', + $basePath.'/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php', + $basePath.'/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php', + $basePath.'/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php', + $basePath.'/vendor/symfony/finder/Iterator/FilenameFilterIterator.php', + $basePath.'/vendor/symfony/finder/Shell/Shell.php', + $basePath.'/vendor/symfony/finder/Adapter/AdapterInterface.php', + $basePath.'/vendor/symfony/finder/Adapter/AbstractAdapter.php', + $basePath.'/vendor/symfony/finder/Adapter/AbstractFindAdapter.php', + $basePath.'/vendor/symfony/finder/Adapter/GnuFindAdapter.php', + $basePath.'/vendor/symfony/finder/Adapter/PhpAdapter.php', + $basePath.'/vendor/symfony/finder/Adapter/BsdFindAdapter.php', + $basePath.'/vendor/symfony/finder/Finder.php', + $basePath.'/vendor/symfony/finder/Glob.php', + $basePath.'/vendor/vlucas/phpdotenv/src/Dotenv.php', $basePath.'/vendor/nesbot/carbon/src/Carbon/Carbon.php', -)); +]; diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php index 949ef89..4c74313 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php @@ -1,135 +1,169 @@ -composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->info('Generating optimized class loader'); - - if ($this->option('psr')) - { - $this->composer->dumpAutoloads(); - } - else - { - $this->composer->dumpOptimized(); - } - - if ($this->option('force') || ! $this->laravel['config']['app.debug']) - { - $this->info('Compiling common classes'); - - $this->compileClasses(); - } - else - { - $this->call('clear-compiled'); - } - } - - /** - * Generate the compiled class file. - * - * @return void - */ - protected function compileClasses() - { - $this->registerClassPreloaderCommand(); - - $this->callSilent('compile', array( - '--config' => implode(',', $this->getClassFiles()), - '--output' => $this->laravel->getCachedCompilePath(), - '--strip_comments' => 1, - )); - } - - /** - * Get the classes that should be combined and compiled. - * - * @return array - */ - protected function getClassFiles() - { - $app = $this->laravel; - - $core = require __DIR__.'/Optimize/config.php'; - - $files = array_merge($core, $this->laravel['config']->get('compile.files', [])); - - foreach ($this->laravel['config']->get('compile.providers', []) as $provider) - { - $files = array_merge($files, forward_static_call([$provider, 'compiles'])); - } - - return $files; - } - - /** - * Register the pre-compiler command instance with Artisan. - * - * @return void - */ - protected function registerClassPreloaderCommand() - { - $this->getApplication()->add(new PreCompileCommand); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('force', null, InputOption::VALUE_NONE, 'Force the compiled class file to be written.'), - - array('psr', null, InputOption::VALUE_NONE, 'Do not optimize Composer dump-autoload.'), - ); - } - +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use ClassPreloader\Exceptions\VisitorExceptionInterface; + +class OptimizeCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'optimize'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Optimize the framework for better performance'; + + /** + * The composer instance. + * + * @var \Illuminate\Foundation\Composer + */ + protected $composer; + + /** + * Create a new optimize command instance. + * + * @param \Illuminate\Foundation\Composer $composer + * @return void + */ + public function __construct(Composer $composer) + { + parent::__construct(); + + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $this->info('Generating optimized class loader'); + + if ($this->option('psr')) { + $this->composer->dumpAutoloads(); + } else { + $this->composer->dumpOptimized(); + } + + if ($this->option('force') || ! $this->laravel['config']['app.debug']) { + $this->info('Compiling common classes'); + $this->compileClasses(); + } else { + $this->call('clear-compiled'); + } + } + + /** + * Generate the compiled class file. + * + * @return void + */ + protected function compileClasses() + { + $preloader = $this->getClassPreloader(); + + $handle = $preloader->prepareOutput($this->laravel->getCachedCompilePath()); + + foreach ($this->getClassFiles() as $file) { + try { + fwrite($handle, $preloader->getCode($file, false)."\n"); + } catch (SkipFileException $ex) { + // Class Preloader 2.x + } catch (VisitorExceptionInterface $e) { + // Class Preloader 3.x + } + } + + fclose($handle); + } + + /** + * Get the class preloader used by the command. + * + * @return \ClassPreloader\ClassPreloader + */ + protected function getClassPreloader() + { + // Class Preloader 3.x + if (class_exists(Factory::class)) { + return (new Factory)->create(['skip' => true]); + } + + // Class Preloader 2.x + return new ClassPreloader(new PrettyPrinter, new Parser(new Lexer), $this->getTraverser()); + } + + /** + * Get the node traverser used by the command. + * + * Note that this method is only called if we're using Class Preloader 2.x. + * + * @return \ClassPreloader\Parser\NodeTraverser + */ + protected function getTraverser() + { + $traverser = new NodeTraverser; + + $traverser->addVisitor(new DirVisitor(true)); + + $traverser->addVisitor(new FileVisitor(true)); + + return $traverser; + } + + /** + * Get the classes that should be combined and compiled. + * + * @return array + */ + protected function getClassFiles() + { + $app = $this->laravel; + + $core = require __DIR__.'/Optimize/config.php'; + + $files = array_merge($core, $app['config']->get('compile.files', [])); + + foreach ($app['config']->get('compile.providers', []) as $provider) { + $files = array_merge($files, forward_static_call([$provider, 'compiles'])); + } + + return array_map('realpath', $files); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['force', null, InputOption::VALUE_NONE, 'Force the compiled class file to be written.'], + + ['psr', null, InputOption::VALUE_NONE, 'Do not optimize Composer dump-autoload.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/PolicyMakeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/PolicyMakeCommand.php new file mode 100644 index 0000000..e071ca7 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/PolicyMakeCommand.php @@ -0,0 +1,50 @@ +kernel = $kernel; - } +class QueuedJob +{ + /** + * The kernel instance. + * + * @var \Illuminate\Contracts\Console\Kernel + */ + protected $kernel; - /** - * Fire the job. - * - * @param \Illuminate\Queue\Jobs\Job - * @param array $data - * @return void - */ - public function fire($job, $data) - { - call_user_func_array([$this->kernel, 'call'], $data); + /** + * Create a new job instance. + * + * @param \Illuminate\Contracts\Console\Kernel $kernel + * @return void + */ + public function __construct(KernelContract $kernel) + { + $this->kernel = $kernel; + } - $job->delete(); - } + /** + * Fire the job. + * + * @param \Illuminate\Queue\Jobs\Job $job + * @param array $data + * @return void + */ + public function fire($job, $data) + { + call_user_func_array([$this->kernel, 'call'], $data); + $job->delete(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php index 6d4e08c..95b7a87 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php @@ -1,49 +1,50 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->call('route:clear'); - - $routes = $this->getFreshApplicationRoutes(); - - if (count($routes) == 0) - { - return $this->error("Your application doesn't have any routes."); - } - - foreach ($routes as $route) - { - $route->prepareForSerialization(); - } - - $this->files->put( - $this->laravel->getCachedRoutesPath(), $this->buildRouteCacheFile($routes) - ); - - $this->info('Routes cached successfully!'); - } - - /** - * Boot a fresh copy of the application and get the routes. - * - * @return \Illuminate\Routing\RouteCollection - */ - protected function getFreshApplicationRoutes() - { - $app = require $this->laravel->basePath().'/bootstrap/app.php'; - - $app->make('Illuminate\Contracts\Console\Kernel')->bootstrap(); - - return $app['router']->getRoutes(); - } - - /** - * Build the route cache file. - * - * @param \Illuminate\Routing\RouteCollection $routes - * @return string - */ - protected function buildRouteCacheFile(RouteCollection $routes) - { - $stub = $this->files->get(__DIR__.'/stubs/routes.stub'); - - return str_replace('{{routes}}', base64_encode(serialize($routes)), $stub); - } - +class RouteCacheCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'route:cache'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Create a route cache file for faster route registration'; + + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * Create a new route command instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @return void + */ + public function __construct(Filesystem $files) + { + parent::__construct(); + + $this->files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $this->call('route:clear'); + + $routes = $this->getFreshApplicationRoutes(); + + if (count($routes) == 0) { + return $this->error("Your application doesn't have any routes."); + } + + foreach ($routes as $route) { + $route->prepareForSerialization(); + } + + $this->files->put( + $this->laravel->getCachedRoutesPath(), $this->buildRouteCacheFile($routes) + ); + + $this->info('Routes cached successfully!'); + } + + /** + * Boot a fresh copy of the application and get the routes. + * + * @return \Illuminate\Routing\RouteCollection + */ + protected function getFreshApplicationRoutes() + { + $app = require $this->laravel->basePath().'/bootstrap/app.php'; + + $app->make('Illuminate\Contracts\Console\Kernel')->bootstrap(); + + return $app['router']->getRoutes(); + } + + /** + * Build the route cache file. + * + * @param \Illuminate\Routing\RouteCollection $routes + * @return string + */ + protected function buildRouteCacheFile(RouteCollection $routes) + { + $stub = $this->files->get(__DIR__.'/stubs/routes.stub'); + + return str_replace('{{routes}}', base64_encode(serialize($routes)), $stub); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php index 2be727f..a14b280 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php @@ -1,54 +1,55 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->files->delete($this->laravel->getCachedRoutesPath()); - - $this->info('Route cache cleared!'); - } - +class RouteClearCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'route:clear'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Remove the route cache file'; + + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * Create a new route clear command instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @return void + */ + public function __construct(Filesystem $files) + { + parent::__construct(); + + $this->files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $this->files->delete($this->laravel->getCachedRoutesPath()); + + $this->info('Route cache cleared!'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php index 1b2b951..463f3ab 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php @@ -1,5 +1,9 @@ -router = $router; - $this->routes = $router->getRoutes(); - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - if (count($this->routes) == 0) - { - return $this->error("Your application doesn't have any routes."); - } - - $this->displayRoutes($this->getRoutes()); - } - - /** - * Compile the routes into a displayable format. - * - * @return array - */ - protected function getRoutes() - { - $results = array(); - - foreach ($this->routes as $route) - { - $results[] = $this->getRouteInformation($route); - } - - return array_filter($results); - } - - /** - * Get the route information for a given route. - * - * @param \Illuminate\Routing\Route $route - * @return array - */ - protected function getRouteInformation(Route $route) - { - return $this->filterRoute(array( - 'host' => $route->domain(), - 'method' => implode('|', $route->methods()), - 'uri' => $route->uri(), - 'name' => $route->getName(), - 'action' => $route->getActionName(), - 'middleware' => $this->getMiddleware($route), - )); - } - - /** - * Display the route information on the console. - * - * @param array $routes - * @return void - */ - protected function displayRoutes(array $routes) - { - $this->table($this->headers, $routes); - } - - /** - * Get before filters. - * - * @param \Illuminate\Routing\Route $route - * @return string - */ - protected function getMiddleware($route) - { - $middlewares = array_values($route->middleware()); - - $middlewares = array_unique( - array_merge($middlewares, $this->getPatternFilters($route)) - ); - - $actionName = $route->getActionName(); - - if ( ! empty($actionName) && $actionName !== 'Closure') - { - $middlewares = array_merge($middlewares, $this->getControllerMiddleware($actionName)); - } - - return implode(',', $middlewares); - } - - /** - * Get the middleware for the given Controller@action name. - * - * @param string $actionName - * @return array - */ - protected function getControllerMiddleware($actionName) - { - Controller::setRouter($this->laravel['router']); - - $segments = explode('@', $actionName); - - return $this->getControllerMiddlewareFromInstance( - $this->laravel->make($segments[0]), $segments[1] - ); - } - - /** - * Get the middlewares for the given controller instance and method. - * - * @param \Illuminate\Routing\Controller $controller - * @param string $method - * @return array - */ - protected function getControllerMiddlewareFromInstance($controller, $method) - { - $middleware = $this->router->getMiddleware(); - - $results = []; - - foreach ($controller->getMiddleware() as $name => $options) - { - if ( ! $this->methodExcludedByOptions($method, $options)) - { - $results[] = array_get($middleware, $name, $name); - } - } - - return $results; - } - - /** - * Determine if the given options exclude a particular method. - * - * @param string $method - * @param array $options - * @return bool - */ - protected function methodExcludedByOptions($method, array $options) - { - return ( ! empty($options['only']) && ! in_array($method, (array) $options['only'])) || - ( ! empty($options['except']) && in_array($method, (array) $options['except'])); - } - - /** - * Get all of the pattern filters matching the route. - * - * @param \Illuminate\Routing\Route $route - * @return array - */ - protected function getPatternFilters($route) - { - $patterns = array(); - - foreach ($route->methods() as $method) - { - // For each method supported by the route we will need to gather up the patterned - // filters for that method. We will then merge these in with the other filters - // we have already gathered up then return them back out to these consumers. - $inner = $this->getMethodPatterns($route->uri(), $method); - - $patterns = array_merge($patterns, array_keys($inner)); - } - - return $patterns; - } - - /** - * Get the pattern filters for a given URI and method. - * - * @param string $uri - * @param string $method - * @return array - */ - protected function getMethodPatterns($uri, $method) - { - return $this->router->findPatternFilters( - Request::create($uri, $method) - ); - } - - /** - * Filter the route by URI and / or name. - * - * @param array $route - * @return array|null - */ - protected function filterRoute(array $route) - { - if (($this->option('name') && ! str_contains($route['name'], $this->option('name'))) || - $this->option('path') && ! str_contains($route['uri'], $this->option('path'))) - { - return; - } - - return $route; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('name', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by name.'), - - array('path', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by path.'), - ); - } - +class RouteListCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'route:list'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'List all registered routes'; + + /** + * The router instance. + * + * @var \Illuminate\Routing\Router + */ + protected $router; + + /** + * An array of all the registered routes. + * + * @var \Illuminate\Routing\RouteCollection + */ + protected $routes; + + /** + * The table headers for the command. + * + * @var array + */ + protected $headers = ['Domain', 'Method', 'URI', 'Name', 'Action', 'Middleware']; + + /** + * Create a new route command instance. + * + * @param \Illuminate\Routing\Router $router + * @return void + */ + public function __construct(Router $router) + { + parent::__construct(); + + $this->router = $router; + $this->routes = $router->getRoutes(); + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + if (count($this->routes) == 0) { + return $this->error("Your application doesn't have any routes."); + } + + $this->displayRoutes($this->getRoutes()); + } + + /** + * Compile the routes into a displayable format. + * + * @return array + */ + protected function getRoutes() + { + $results = []; + + foreach ($this->routes as $route) { + $results[] = $this->getRouteInformation($route); + } + + if ($sort = $this->option('sort')) { + $results = Arr::sort($results, function ($value) use ($sort) { + return $value[$sort]; + }); + } + + if ($this->option('reverse')) { + $results = array_reverse($results); + } + + return array_filter($results); + } + + /** + * Get the route information for a given route. + * + * @param \Illuminate\Routing\Route $route + * @return array + */ + protected function getRouteInformation(Route $route) + { + return $this->filterRoute([ + 'host' => $route->domain(), + 'method' => implode('|', $route->methods()), + 'uri' => $route->uri(), + 'name' => $route->getName(), + 'action' => $route->getActionName(), + 'middleware' => $this->getMiddleware($route), + ]); + } + + /** + * Display the route information on the console. + * + * @param array $routes + * @return void + */ + protected function displayRoutes(array $routes) + { + $this->table($this->headers, $routes); + } + + /** + * Get before filters. + * + * @param \Illuminate\Routing\Route $route + * @return string + */ + protected function getMiddleware($route) + { + $middlewares = array_values($route->middleware()); + + $middlewares = array_unique( + array_merge($middlewares, $this->getPatternFilters($route)) + ); + + $actionName = $route->getActionName(); + + if (! empty($actionName) && $actionName !== 'Closure') { + $middlewares = array_merge($middlewares, $this->getControllerMiddleware($actionName)); + } + + return implode(',', $middlewares); + } + + /** + * Get the middleware for the given Controller@action name. + * + * @param string $actionName + * @return array + */ + protected function getControllerMiddleware($actionName) + { + Controller::setRouter($this->laravel['router']); + + $segments = explode('@', $actionName); + + return $this->getControllerMiddlewareFromInstance( + $this->laravel->make($segments[0]), $segments[1] + ); + } + + /** + * Get the middlewares for the given controller instance and method. + * + * @param \Illuminate\Routing\Controller $controller + * @param string $method + * @return array + */ + protected function getControllerMiddlewareFromInstance($controller, $method) + { + $middleware = $this->router->getMiddleware(); + + $results = []; + + foreach ($controller->getMiddleware() as $name => $options) { + if (! $this->methodExcludedByOptions($method, $options)) { + $results[] = Arr::get($middleware, $name, $name); + } + } + + return $results; + } + + /** + * Determine if the given options exclude a particular method. + * + * @param string $method + * @param array $options + * @return bool + */ + protected function methodExcludedByOptions($method, array $options) + { + return (! empty($options['only']) && ! in_array($method, (array) $options['only'])) || + (! empty($options['except']) && in_array($method, (array) $options['except'])); + } + + /** + * Get all of the pattern filters matching the route. + * + * @param \Illuminate\Routing\Route $route + * @return array + */ + protected function getPatternFilters($route) + { + $patterns = []; + + foreach ($route->methods() as $method) { + // For each method supported by the route we will need to gather up the patterned + // filters for that method. We will then merge these in with the other filters + // we have already gathered up then return them back out to these consumers. + $inner = $this->getMethodPatterns($route->uri(), $method); + + $patterns = array_merge($patterns, array_keys($inner)); + } + + return $patterns; + } + + /** + * Get the pattern filters for a given URI and method. + * + * @param string $uri + * @param string $method + * @return array + */ + protected function getMethodPatterns($uri, $method) + { + return $this->router->findPatternFilters( + Request::create($uri, $method) + ); + } + + /** + * Filter the route by URI and / or name. + * + * @param array $route + * @return array|null + */ + protected function filterRoute(array $route) + { + if (($this->option('name') && ! Str::contains($route['name'], $this->option('name'))) || + $this->option('path') && ! Str::contains($route['uri'], $this->option('path')) || + $this->option('method') && ! Str::contains($route['method'], $this->option('method'))) { + return; + } + + return $route; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['method', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by method.'], + + ['name', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by name.'], + + ['path', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by path.'], + + ['reverse', 'r', InputOption::VALUE_NONE, 'Reverse the ordering of the routes.'], + + ['sort', null, InputOption::VALUE_OPTIONAL, 'The column (host, method, uri, name, action, middleware) to sort by.', 'uri'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php index 5bbb949..90e596e 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php @@ -1,56 +1,72 @@ -laravel->publicPath()); + /** + * Execute the console command. + * + * @return void + * + * @throws \Exception + */ + public function fire() + { + chdir($this->laravel->publicPath()); - $host = $this->input->getOption('host'); + $host = $this->input->getOption('host'); - $port = $this->input->getOption('port'); + $port = $this->input->getOption('port'); - $base = $this->laravel->basePath(); + $base = ProcessUtils::escapeArgument($this->laravel->basePath()); - $this->info("Laravel development server started on http://{$host}:{$port}/"); + $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); - passthru('"'.PHP_BINARY.'"'." -S {$host}:{$port} \"{$base}\"/server.php"); - } + $this->info("Laravel development server started on http://{$host}:{$port}/"); - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on.', 'localhost'), + if (defined('HHVM_VERSION')) { + if (version_compare(HHVM_VERSION, '3.8.0') >= 0) { + passthru("{$binary} -m server -v Server.Type=proxygen -v Server.SourceRoot={$base}/ -v Server.IP={$host} -v Server.Port={$port} -v Server.DefaultDocument=server.php -v Server.ErrorDocument404=server.php"); + } else { + throw new Exception("HHVM's built-in server requires HHVM >= 3.8.0."); + } + } else { + passthru("{$binary} -S {$host}:{$port} {$base}/server.php"); + } + } - array('port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on.', 8000), - ); - } + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on.', 'localhost'], + ['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on.', 8000], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/TestMakeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/TestMakeCommand.php new file mode 100644 index 0000000..7f0efe8 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/TestMakeCommand.php @@ -0,0 +1,63 @@ +laravel->getNamespace(), '', $name); + + return $this->laravel['path.base'].'/tests/'.str_replace('\\', '/', $name).'.php'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Tinker/Presenters/EloquentModelPresenter.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Tinker/Presenters/EloquentModelPresenter.php deleted file mode 100644 index 6f68dc1..0000000 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Tinker/Presenters/EloquentModelPresenter.php +++ /dev/null @@ -1,71 +0,0 @@ -getAttributes(), $value->getRelations()); - - $visible = $value->getVisible(); - - if (count($visible) === 0) - { - $visible = array_diff(array_keys($attributes), $value->getHidden()); - } - - if ( ! $this->showHidden($propertyFilter)) - { - return array_intersect_key($attributes, array_flip($visible)); - } - - $properties = []; - - foreach ($attributes as $key => $value) - { - if ( ! in_array($key, $visible)) - { - $key = sprintf('%s', $key); - } - - $properties[$key] = $value; - } - - return $properties; - } - - /** - * Decide whether to show hidden properties, based on a ReflectionProperty filter. - * - * @param int $propertyFilter - * @return bool - */ - protected function showHidden($propertyFilter) - { - return $propertyFilter & (ReflectionProperty::IS_PROTECTED | ReflectionProperty::IS_PRIVATE); - } - -} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Tinker/Presenters/IlluminateApplicationPresenter.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Tinker/Presenters/IlluminateApplicationPresenter.php deleted file mode 100644 index 233a5aa..0000000 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Tinker/Presenters/IlluminateApplicationPresenter.php +++ /dev/null @@ -1,72 +0,0 @@ -$property(); - - if ( ! is_null($val)) $properties[$property] = $val; - } - catch (Exception $e) - { - // - } - } - - return $properties; - } - -} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Tinker/Presenters/IlluminateCollectionPresenter.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Tinker/Presenters/IlluminateCollectionPresenter.php deleted file mode 100644 index 58d3781..0000000 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Tinker/Presenters/IlluminateCollectionPresenter.php +++ /dev/null @@ -1,41 +0,0 @@ -all(); - } - -} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/TinkerCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/TinkerCommand.php index 13edebc..68c48ae 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/TinkerCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/TinkerCommand.php @@ -1,101 +1,100 @@ -getApplication()->setCatchExceptions(false); - - $config = new Configuration; - - $config->getPresenterManager()->addPresenters( - $this->getPresenters() - ); - - $shell = new Shell($config); - $shell->addCommands($this->getCommands()); - $shell->setIncludes($this->argument('include')); - - $shell->run(); - } - - /** - * Get artisan commands to pass through to PsySH. - * - * @return array - */ - protected function getCommands() - { - $commands = []; - - foreach ($this->getApplication()->all() as $name => $command) - { - if (in_array($name, $this->commandWhitelist)) $commands[] = $command; - } - - return $commands; - } - - /** - * Get an array of Laravel tailored Presenters. - * - * @return array - */ - protected function getPresenters() - { - return [ - new EloquentModelPresenter, - new IlluminateCollectionPresenter, - new IlluminateApplicationPresenter, - ]; - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return [ - ['include', InputArgument::IS_ARRAY, 'Include file(s) before starting tinker'], - ]; - } +class TinkerCommand extends Command +{ + /** + * artisan commands to include in the tinker shell. + * + * @var array + */ + protected $commandWhitelist = [ + 'clear-compiled', 'down', 'env', 'inspire', 'migrate', 'optimize', 'up', + ]; + + /** + * The console command name. + * + * @var string + */ + protected $name = 'tinker'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Interact with your application'; + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $this->getApplication()->setCatchExceptions(false); + + $config = new Configuration; + + $config->getPresenter()->addCasters( + $this->getCasters() + ); + + $shell = new Shell($config); + $shell->addCommands($this->getCommands()); + $shell->setIncludes($this->argument('include')); + + $shell->run(); + } + + /** + * Get artisan commands to pass through to PsySH. + * + * @return array + */ + protected function getCommands() + { + $commands = []; + + foreach ($this->getApplication()->all() as $name => $command) { + if (in_array($name, $this->commandWhitelist)) { + $commands[] = $command; + } + } + + return $commands; + } + + /** + * Get an array of Laravel tailored casters. + * + * @return array + */ + protected function getCasters() + { + return [ + 'Illuminate\Foundation\Application' => 'Illuminate\Foundation\Console\IlluminateCaster::castApplication', + 'Illuminate\Support\Collection' => 'Illuminate\Foundation\Console\IlluminateCaster::castCollection', + 'Illuminate\Database\Eloquent\Model' => 'Illuminate\Foundation\Console\IlluminateCaster::castModel', + ]; + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['include', InputArgument::IS_ARRAY, 'Include file(s) before starting tinker'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php index 2a2e10c..82d8385 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php @@ -1,33 +1,34 @@ -laravel->storagePath().'/framework/down'); + /** + * The console command description. + * + * @var string + */ + protected $description = 'Bring the application out of maintenance mode'; - $this->info('Application is now live.'); - } + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + @unlink($this->laravel->storagePath().'/framework/down'); + $this->info('Application is now live.'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php index 0dd4cf5..2bb2990 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php @@ -1,175 +1,167 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $paths = ServiceProvider::pathsToPublish( - $this->option('provider'), $this->option('tag') - ); - - if (empty($paths)) - { - return $this->comment("Nothing to publish."); - } - - foreach ($paths as $from => $to) - { - if ($this->files->isFile($from)) - { - $this->publishFile($from, $to); - } - elseif ($this->files->isDirectory($from)) - { - $this->publishDirectory($from, $to); - } - else - { - $this->error("Can't locate path: <{$from}>"); - } - } - - $this->info('Publishing Complete!'); - } - - /** - * Publish the file to the given path. - * - * @param string $from - * @param string $to - * @return void - */ - protected function publishFile($from, $to) - { - if ($this->files->exists($to) && ! $this->option('force')) - { - return; - } - - $this->createParentDirectory(dirname($to)); - - $this->files->copy($from, $to); - - $this->status($from, $to, 'File'); - } - - /** - * Publish the directory to the given directory. - * - * @param string $from - * @param string $to - * @return void - */ - protected function publishDirectory($from, $to) - { - $manager = new MountManager([ - 'from' => new Flysystem(new LocalAdapter($from)), - 'to' => new Flysystem(new LocalAdapter($to)), - ]); - - foreach ($manager->listContents('from://', true) as $file) - { - if ($file['type'] === 'file' && ( ! $manager->has('to://'.$file['path']) || $this->option('force'))) - { - $manager->put('to://'.$file['path'], $manager->read('from://'.$file['path'])); - } - } - - $this->status($from, $to, 'Directory'); - } - - /** - * Create the directory to house the published files if needed. - * - * @param string $directory - * @return void - */ - protected function createParentDirectory($directory) - { - if ( ! $this->files->isDirectory($directory)) - { - $this->files->makeDirectory($directory, 0755, true); - } - } - - /** - * Write a status message to the console. - * - * @param string $from - * @param string $to - * @param string $type - * @return void - */ - protected function status($from, $to, $type) - { - $from = str_replace(base_path(), '', realpath($from)); - - $to = str_replace(base_path(), '', realpath($to)); - - $this->line('Copied '.$type.' ['.$from.'] To ['.$to.']'); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('force', null, InputOption::VALUE_NONE, 'Overwrite any existing files.'), - - array('provider', null, InputOption::VALUE_OPTIONAL, 'The service provider that has assets you want to publish.'), - - array('tag', null, InputOption::VALUE_OPTIONAL, 'The tag that has assets you want to publish.'), - ); - } - +class VendorPublishCommand extends Command +{ + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * The console command signature. + * + * @var string + */ + protected $signature = 'vendor:publish {--force : Overwrite any existing files.} + {--provider= : The service provider that has assets you want to publish.} + {--tag=* : One or many tags that have assets you want to publish.}'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Publish any publishable assets from vendor packages'; + + /** + * Create a new command instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @return void + */ + public function __construct(Filesystem $files) + { + parent::__construct(); + + $this->files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $tags = $this->option('tag'); + + $tags = $tags ?: [null]; + + foreach ($tags as $tag) { + $this->publishTag($tag); + } + } + + /** + * Publishes the assets for a tag. + * + * @param string $tag + * @return mixed + */ + private function publishTag($tag) + { + $paths = ServiceProvider::pathsToPublish( + $this->option('provider'), $tag + ); + + if (empty($paths)) { + return $this->comment("Nothing to publish for tag [{$tag}]."); + } + + foreach ($paths as $from => $to) { + if ($this->files->isFile($from)) { + $this->publishFile($from, $to); + } elseif ($this->files->isDirectory($from)) { + $this->publishDirectory($from, $to); + } else { + $this->error("Can't locate path: <{$from}>"); + } + } + + $this->info("Publishing complete for tag [{$tag}]!"); + } + + /** + * Publish the file to the given path. + * + * @param string $from + * @param string $to + * @return void + */ + protected function publishFile($from, $to) + { + if ($this->files->exists($to) && ! $this->option('force')) { + return; + } + + $this->createParentDirectory(dirname($to)); + + $this->files->copy($from, $to); + + $this->status($from, $to, 'File'); + } + + /** + * Publish the directory to the given directory. + * + * @param string $from + * @param string $to + * @return void + */ + protected function publishDirectory($from, $to) + { + $manager = new MountManager([ + 'from' => new Flysystem(new LocalAdapter($from)), + 'to' => new Flysystem(new LocalAdapter($to)), + ]); + + foreach ($manager->listContents('from://', true) as $file) { + if ($file['type'] === 'file' && (! $manager->has('to://'.$file['path']) || $this->option('force'))) { + $manager->put('to://'.$file['path'], $manager->read('from://'.$file['path'])); + } + } + + $this->status($from, $to, 'Directory'); + } + + /** + * Create the directory to house the published files if needed. + * + * @param string $directory + * @return void + */ + protected function createParentDirectory($directory) + { + if (! $this->files->isDirectory($directory)) { + $this->files->makeDirectory($directory, 0755, true); + } + } + + /** + * Write a status message to the console. + * + * @param string $from + * @param string $to + * @param string $type + * @return void + */ + protected function status($from, $to, $type) + { + $from = str_replace(base_path(), '', realpath($from)); + + $to = str_replace(base_path(), '', realpath($to)); + + $this->line('Copied '.$type.' ['.$from.'] To ['.$to.']'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewClearCommand.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewClearCommand.php new file mode 100644 index 0000000..c7e443e --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewClearCommand.php @@ -0,0 +1,64 @@ +files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $path = $this->laravel['config']['view.compiled']; + + if (! $path) { + throw new RuntimeException('View path not found.'); + } + + foreach ($this->files->glob("{$path}/*") as $view) { + $this->files->delete($view); + } + + $this->info('Compiled views cleared!'); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/command-handler.stub b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/command-handler.stub index 888e1ab..8fdf3ee 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/command-handler.stub +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/command-handler.stub @@ -1,30 +1,30 @@ -setRoutes( - unserialize(base64_decode('{{routes}}')) + unserialize(base64_decode('{{routes}}')) ); diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/test.stub b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/test.stub new file mode 100644 index 0000000..4a2858d --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/test.stub @@ -0,0 +1,18 @@ +assertTrue(true); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php index a6e5aee..9acdca8 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php @@ -1,69 +1,69 @@ -detectConsoleEnvironment($callback, $consoleArgs); - } +use Closure; +use Illuminate\Support\Arr; +use Illuminate\Support\Str; - return $this->detectWebEnvironment($callback); - } +class EnvironmentDetector +{ + /** + * Detect the application's current environment. + * + * @param \Closure $callback + * @param array|null $consoleArgs + * @return string + */ + public function detect(Closure $callback, $consoleArgs = null) + { + if ($consoleArgs) { + return $this->detectConsoleEnvironment($callback, $consoleArgs); + } - /** - * Set the application environment for a web request. - * - * @param \Closure $callback - * @return string - */ - protected function detectWebEnvironment(Closure $callback) - { - return call_user_func($callback); - } + return $this->detectWebEnvironment($callback); + } - /** - * Set the application environment from command-line arguments. - * - * @param \Closure $callback - * @param array $args - * @return string - */ - protected function detectConsoleEnvironment(Closure $callback, array $args) - { - // First we will check if an environment argument was passed via console arguments - // and if it was that automatically overrides as the environment. Otherwise, we - // will check the environment as a "web" request like a typical HTTP request. - if ( ! is_null($value = $this->getEnvironmentArgument($args))) - { - return head(array_slice(explode('=', $value), 1)); - } + /** + * Set the application environment for a web request. + * + * @param \Closure $callback + * @return string + */ + protected function detectWebEnvironment(Closure $callback) + { + return call_user_func($callback); + } - return $this->detectWebEnvironment($callback); - } + /** + * Set the application environment from command-line arguments. + * + * @param \Closure $callback + * @param array $args + * @return string + */ + protected function detectConsoleEnvironment(Closure $callback, array $args) + { + // First we will check if an environment argument was passed via console arguments + // and if it was that automatically overrides as the environment. Otherwise, we + // will check the environment as a "web" request like a typical HTTP request. + if (! is_null($value = $this->getEnvironmentArgument($args))) { + return head(array_slice(explode('=', $value), 1)); + } - /** - * Get the environment argument from the console. - * - * @param array $args - * @return string|null - */ - protected function getEnvironmentArgument(array $args) - { - return array_first($args, function($k, $v) - { - return starts_with($v, '--env'); - }); - } + return $this->detectWebEnvironment($callback); + } + /** + * Get the environment argument from the console. + * + * @param array $args + * @return string|null + */ + protected function getEnvironmentArgument(array $args) + { + return Arr::first($args, function ($k, $v) { + return Str::startsWith($v, '--env'); + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php index 603a51a..6c87455 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php @@ -1,139 +1,179 @@ -log = $log; - } - - /** - * Report or log an exception. - * - * @param \Exception $e - * @return void - */ - public function report(Exception $e) - { - if ($this->shouldntReport($e)) return; - - $this->log->error((string) $e); - } - - /** - * Determine if the exception should be reported. - * - * @param \Exception $e - * @return bool - */ - public function shouldReport(Exception $e) - { - return ! $this->shouldntReport($e); - } - - /** - * Determine if the exception is in the "do not report" list. - * - * @param \Exception $e - * @return bool - */ - protected function shouldntReport(Exception $e) - { - foreach ($this->dontReport as $type) - { - if ($e instanceof $type) return true; - } - - return false; - } - - /** - * Render an exception into a response. - * - * @param \Illuminate\Http\Request $request - * @param \Exception $e - * @return \Illuminate\Http\Response - */ - public function render($request, Exception $e) - { - if ($this->isHttpException($e)) - { - return $this->renderHttpException($e); - } - else - { - return (new SymfonyDisplayer(config('app.debug')))->createResponse($e); - } - } - - /** - * Render an exception to the console. - * - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @param \Exception $e - * @return void - */ - public function renderForConsole($output, Exception $e) - { - (new ConsoleApplication)->renderException($e, $output); - } - - /** - * Render the given HttpException. - * - * @param \Symfony\Component\HttpKernel\Exception\HttpException $e - * @return \Symfony\Component\HttpFoundation\Response - */ - protected function renderHttpException(HttpException $e) - { - $status = $e->getStatusCode(); - - if (view()->exists("errors.{$status}")) - { - return response()->view("errors.{$status}", [], $status); - } - else - { - return (new SymfonyDisplayer(config('app.debug')))->createResponse($e); - } - } - - /** - * Determine if the given exception is an HTTP exception. - * - * @param \Exception $e - * @return bool - */ - protected function isHttpException(Exception $e) - { - return $e instanceof HttpException; - } - +class Handler implements ExceptionHandlerContract +{ + /** + * The log implementation. + * + * @var \Psr\Log\LoggerInterface + */ + protected $log; + + /** + * A list of the exception types that should not be reported. + * + * @var array + */ + protected $dontReport = []; + + /** + * Create a new exception handler instance. + * + * @param \Psr\Log\LoggerInterface $log + * @return void + */ + public function __construct(LoggerInterface $log) + { + $this->log = $log; + } + + /** + * Report or log an exception. + * + * @param \Exception $e + * @return void + */ + public function report(Exception $e) + { + if ($this->shouldReport($e)) { + $this->log->error($e); + } + } + + /** + * Determine if the exception should be reported. + * + * @param \Exception $e + * @return bool + */ + public function shouldReport(Exception $e) + { + return ! $this->shouldntReport($e); + } + + /** + * Determine if the exception is in the "do not report" list. + * + * @param \Exception $e + * @return bool + */ + protected function shouldntReport(Exception $e) + { + foreach ($this->dontReport as $type) { + if ($e instanceof $type) { + return true; + } + } + + return false; + } + + /** + * Render an exception into a response. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return \Illuminate\Http\Response + */ + public function render($request, Exception $e) + { + if ($this->isUnauthorizedException($e)) { + $e = new HttpException(403, $e->getMessage()); + } + + if ($this->isHttpException($e)) { + return $this->toIlluminateResponse($this->renderHttpException($e), $e); + } else { + return $this->toIlluminateResponse($this->convertExceptionToResponse($e), $e); + } + } + + /** + * Map exception into an illuminate response. + * + * @param \Symfony\Component\HttpFoundation\Response $response + * @param \Exception $e + * @return \Illuminate\Http\Response + */ + protected function toIlluminateResponse($response, Exception $e) + { + $response = new Response($response->getContent(), $response->getStatusCode(), $response->headers->all()); + + $response->exception = $e; + + return $response; + } + + /** + * Render an exception to the console. + * + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @param \Exception $e + * @return void + */ + public function renderForConsole($output, Exception $e) + { + (new ConsoleApplication)->renderException($e, $output); + } + + /** + * Render the given HttpException. + * + * @param \Symfony\Component\HttpKernel\Exception\HttpException $e + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function renderHttpException(HttpException $e) + { + $status = $e->getStatusCode(); + + if (view()->exists("errors.{$status}")) { + return response()->view("errors.{$status}", ['exception' => $e], $status); + } else { + return $this->convertExceptionToResponse($e); + } + } + + /** + * Convert the given exception into a Response instance. + * + * @param \Exception $e + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function convertExceptionToResponse(Exception $e) + { + return (new SymfonyDisplayer(config('app.debug')))->createResponse($e); + } + + /** + * Determine if the given exception is an access unauthorized exception. + * + * @param \Exception $e + * @return bool + */ + protected function isUnauthorizedException(Exception $e) + { + return $e instanceof UnauthorizedException; + } + + /** + * Determine if the given exception is an HTTP exception. + * + * @param \Exception $e + * @return bool + */ + protected function isHttpException(Exception $e) + { + return $e instanceof HttpException; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php index a364b3e..e390609 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php @@ -1,233 +1,227 @@ -container->make('Illuminate\Validation\Factory'); - - if (method_exists($this, 'validator')) - { - return $this->container->call([$this, 'validator'], compact('factory')); - } - - return $factory->make( - $this->all(), $this->container->call([$this, 'rules']), $this->messages(), $this->attributes() - ); - } - - /** - * Handle a failed validation attempt. - * - * @param \Illuminate\Validation\Validator $validator - * @return mixed - */ - protected function failedValidation(Validator $validator) - { - throw new HttpResponseException($this->response( - $this->formatErrors($validator) - )); - } - - /** - * Determine if the request passes the authorization check. - * - * @return bool - */ - protected function passesAuthorization() - { - if (method_exists($this, 'authorize')) - { - return $this->container->call([$this, 'authorize']); - } - - return false; - } - - /** - * Handle a failed authorization attempt. - * - * @return mixed - */ - protected function failedAuthorization() - { - throw new HttpResponseException($this->forbiddenResponse()); - } - - /** - * Get the proper failed validation response for the request. - * - * @param array $errors - * @return \Symfony\Component\HttpFoundation\Response - */ - public function response(array $errors) - { - if ($this->ajax() || $this->wantsJson()) - { - return new JsonResponse($errors, 422); - } - - return $this->redirector->to($this->getRedirectUrl()) +use Illuminate\Contracts\Validation\Factory as ValidationFactory; + +class FormRequest extends Request implements ValidatesWhenResolved +{ + use ValidatesWhenResolvedTrait; + + /** + * The container instance. + * + * @var \Illuminate\Container\Container + */ + protected $container; + + /** + * The redirector instance. + * + * @var \Illuminate\Routing\Redirector + */ + protected $redirector; + + /** + * The URI to redirect to if validation fails. + * + * @var string + */ + protected $redirect; + + /** + * The route to redirect to if validation fails. + * + * @var string + */ + protected $redirectRoute; + + /** + * The controller action to redirect to if validation fails. + * + * @var string + */ + protected $redirectAction; + + /** + * The key to be used for the view error bag. + * + * @var string + */ + protected $errorBag = 'default'; + + /** + * The input keys that should not be flashed on redirect. + * + * @var array + */ + protected $dontFlash = ['password', 'password_confirmation']; + + /** + * Get the validator instance for the request. + * + * @return \Illuminate\Contracts\Validation\Validator + */ + protected function getValidatorInstance() + { + $factory = $this->container->make(ValidationFactory::class); + + if (method_exists($this, 'validator')) { + return $this->container->call([$this, 'validator'], compact('factory')); + } + + return $factory->make( + $this->all(), $this->container->call([$this, 'rules']), $this->messages(), $this->attributes() + ); + } + + /** + * Handle a failed validation attempt. + * + * @param \Illuminate\Contracts\Validation\Validator $validator + * @return mixed + */ + protected function failedValidation(Validator $validator) + { + throw new HttpResponseException($this->response( + $this->formatErrors($validator) + )); + } + + /** + * Determine if the request passes the authorization check. + * + * @return bool + */ + protected function passesAuthorization() + { + if (method_exists($this, 'authorize')) { + return $this->container->call([$this, 'authorize']); + } + + return false; + } + + /** + * Handle a failed authorization attempt. + * + * @return mixed + */ + protected function failedAuthorization() + { + throw new HttpResponseException($this->forbiddenResponse()); + } + + /** + * Get the proper failed validation response for the request. + * + * @param array $errors + * @return \Symfony\Component\HttpFoundation\Response + */ + public function response(array $errors) + { + if ($this->ajax() || $this->wantsJson()) { + return new JsonResponse($errors, 422); + } + + return $this->redirector->to($this->getRedirectUrl()) ->withInput($this->except($this->dontFlash)) ->withErrors($errors, $this->errorBag); - } - - /** - * Get the response for a forbidden operation. - * - * @return \Illuminate\Http\Response - */ - public function forbiddenResponse() - { - return new Response('Forbidden', 403); - } - - /** - * Format the errors from the given Validator instance. - * - * @param \Illuminate\Validation\Validator $validator - * @return array - */ - protected function formatErrors(Validator $validator) - { - return $validator->errors()->getMessages(); - } - - /** - * Get the URL to redirect to on a validation error. - * - * @return string - */ - protected function getRedirectUrl() - { - $url = $this->redirector->getUrlGenerator(); - - if ($this->redirect) - { - return $url->to($this->redirect); - } - elseif ($this->redirectRoute) - { - return $url->route($this->redirectRoute); - } - elseif ($this->redirectAction) - { - return $url->action($this->redirectAction); - } - - return $url->previous(); - } - - /** - * Set the Redirector instance. - * - * @param \Illuminate\Routing\Redirector $redirector - * @return \Illuminate\Foundation\Http\FormRequest - */ - public function setRedirector(Redirector $redirector) - { - $this->redirector = $redirector; - - return $this; - } - - /** - * Set the container implementation. - * - * @param \Illuminate\Container\Container $container - * @return $this - */ - public function setContainer(Container $container) - { - $this->container = $container; - - return $this; - } - - /** - * Set custom messages for validator errors. - * - * @return array - */ - public function messages() - { - return []; - } - - /** - * Set custom attributes for validator errors. - * - * @return array - */ - public function attributes() - { - return []; - } - + } + + /** + * Get the response for a forbidden operation. + * + * @return \Illuminate\Http\Response + */ + public function forbiddenResponse() + { + return new Response('Forbidden', 403); + } + + /** + * Format the errors from the given Validator instance. + * + * @param \Illuminate\Contracts\Validation\Validator $validator + * @return array + */ + protected function formatErrors(Validator $validator) + { + return $validator->getMessageBag()->toArray(); + } + + /** + * Get the URL to redirect to on a validation error. + * + * @return string + */ + protected function getRedirectUrl() + { + $url = $this->redirector->getUrlGenerator(); + + if ($this->redirect) { + return $url->to($this->redirect); + } elseif ($this->redirectRoute) { + return $url->route($this->redirectRoute); + } elseif ($this->redirectAction) { + return $url->action($this->redirectAction); + } + + return $url->previous(); + } + + /** + * Set the Redirector instance. + * + * @param \Illuminate\Routing\Redirector $redirector + * @return \Illuminate\Foundation\Http\FormRequest + */ + public function setRedirector(Redirector $redirector) + { + $this->redirector = $redirector; + + return $this; + } + + /** + * Set the container implementation. + * + * @param \Illuminate\Container\Container $container + * @return $this + */ + public function setContainer(Container $container) + { + $this->container = $container; + + return $this; + } + + /** + * Set custom messages for validator errors. + * + * @return array + */ + public function messages() + { + return []; + } + + /** + * Set custom attributes for validator errors. + * + * @return array + */ + public function attributes() + { + return []; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php index 4a919c3..f18e020 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php @@ -1,261 +1,293 @@ -app = $app; - $this->router = $router; - - foreach ($this->routeMiddleware as $key => $middleware) - { - $router->middleware($key, $middleware); - } - } - - /** - * Handle an incoming HTTP request. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function handle($request) - { - try - { - $response = $this->sendRequestThroughRouter($request); - } - catch (Exception $e) - { - $this->reportException($e); - - $response = $this->renderException($request, $e); - } - - $this->app['events']->fire('kernel.handled', [$request, $response]); - - return $response; - } - - /** - * Send the given request through the middleware / router. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - protected function sendRequestThroughRouter($request) - { - $this->app->instance('request', $request); - - Facade::clearResolvedInstance('request'); - - $this->bootstrap(); - - return (new Pipeline($this->app)) - ->send($request) - ->through($this->middleware) - ->then($this->dispatchToRouter()); - } - - /** - * Call the terminate method on any terminable middleware. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Http\Response $response - * @return void - */ - public function terminate($request, $response) - { - $routeMiddlewares = $this->gatherRouteMiddlewares($request); - - foreach (array_merge($routeMiddlewares, $this->middleware) as $middleware) - { - $instance = $this->app->make($middleware); - - if ($instance instanceof TerminableMiddleware) - { - $instance->terminate($request, $response); - } - } - - $this->app->terminate(); - } - - /** - * Gather the route middleware for the given request. - * - * @param \Illuminate\Http\Request $request - * @return array - */ - protected function gatherRouteMiddlewares($request) - { - if ($request->route()) - { - return $this->router->gatherRouteMiddlewares($request->route()); - } - - return []; - } - - /** - * Add a new middleware to beginning of the stack if it does not already exist. - * - * @param string $middleware - * @return $this - */ - public function prependMiddleware($middleware) - { - if (array_search($middleware, $this->middleware) === false) - { - array_unshift($this->middleware, $middleware); - } - - return $this; - } - - /** - * Add a new middleware to end of the stack if it does not already exist. - * - * @param string $middleware - * @return $this - */ - public function pushMiddleware($middleware) - { - if (array_search($middleware, $this->middleware) === false) - { - $this->middleware[] = $middleware; - } - - return $this; - } - - /** - * Bootstrap the application for HTTP requests. - * - * @return void - */ - public function bootstrap() - { - if ( ! $this->app->hasBeenBootstrapped()) - { - $this->app->bootstrapWith($this->bootstrappers()); - } - } - - /** - * Get the route dispatcher callback. - * - * @return \Closure - */ - protected function dispatchToRouter() - { - return function($request) - { - $this->app->instance('request', $request); - - return $this->router->dispatch($request); - }; - } - - /** - * Get the bootstrap classes for the application. - * - * @return array - */ - protected function bootstrappers() - { - return $this->bootstrappers; - } - - /** - * Report the exception to the exception handler. - * - * @param \Exception $e - * @return void - */ - protected function reportException(Exception $e) - { - $this->app['Illuminate\Contracts\Debug\ExceptionHandler']->report($e); - } - - /** - * Render the exception to a response. - * - * @param \Illuminate\Http\Request $request - * @param \Exception $e - * @return \Symfony\Component\HttpFoundation\Response - */ - protected function renderException($request, Exception $e) - { - return $this->app['Illuminate\Contracts\Debug\ExceptionHandler']->render($request, $e); - } - - /** - * Get the Laravel application instance. - * - * @return \Illuminate\Contracts\Foundation\Application - */ - public function getApplication() - { - return $this->app; - } - +use Symfony\Component\Debug\Exception\FatalThrowableError; + +class Kernel implements KernelContract +{ + /** + * The application implementation. + * + * @var \Illuminate\Contracts\Foundation\Application + */ + protected $app; + + /** + * The router instance. + * + * @var \Illuminate\Routing\Router + */ + protected $router; + + /** + * The bootstrap classes for the application. + * + * @var array + */ + protected $bootstrappers = [ + 'Illuminate\Foundation\Bootstrap\DetectEnvironment', + 'Illuminate\Foundation\Bootstrap\LoadConfiguration', + 'Illuminate\Foundation\Bootstrap\ConfigureLogging', + 'Illuminate\Foundation\Bootstrap\HandleExceptions', + 'Illuminate\Foundation\Bootstrap\RegisterFacades', + 'Illuminate\Foundation\Bootstrap\RegisterProviders', + 'Illuminate\Foundation\Bootstrap\BootProviders', + ]; + + /** + * The application's middleware stack. + * + * @var array + */ + protected $middleware = []; + + /** + * The application's route middleware. + * + * @var array + */ + protected $routeMiddleware = []; + + /** + * Create a new HTTP kernel instance. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param \Illuminate\Routing\Router $router + * @return void + */ + public function __construct(Application $app, Router $router) + { + $this->app = $app; + $this->router = $router; + + foreach ($this->routeMiddleware as $key => $middleware) { + $router->middleware($key, $middleware); + } + } + + /** + * Handle an incoming HTTP request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function handle($request) + { + try { + $request->enableHttpMethodParameterOverride(); + + $response = $this->sendRequestThroughRouter($request); + } catch (Exception $e) { + $this->reportException($e); + + $response = $this->renderException($request, $e); + } catch (Throwable $e) { + $e = new FatalThrowableError($e); + + $this->reportException($e); + + $response = $this->renderException($request, $e); + } + + $this->app['events']->fire('kernel.handled', [$request, $response]); + + return $response; + } + + /** + * Send the given request through the middleware / router. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + protected function sendRequestThroughRouter($request) + { + $this->app->instance('request', $request); + + Facade::clearResolvedInstance('request'); + + $this->bootstrap(); + + return (new Pipeline($this->app)) + ->send($request) + ->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware) + ->then($this->dispatchToRouter()); + } + + /** + * Call the terminate method on any terminable middleware. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Response $response + * @return void + */ + public function terminate($request, $response) + { + $middlewares = $this->app->shouldSkipMiddleware() ? [] : array_merge( + $this->gatherRouteMiddlewares($request), + $this->middleware + ); + + foreach ($middlewares as $middleware) { + list($name, $parameters) = $this->parseMiddleware($middleware); + + $instance = $this->app->make($name); + + if (method_exists($instance, 'terminate')) { + $instance->terminate($request, $response); + } + } + + $this->app->terminate(); + } + + /** + * Gather the route middleware for the given request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function gatherRouteMiddlewares($request) + { + if ($route = $request->route()) { + return $this->router->gatherRouteMiddlewares($route); + } + + return []; + } + + /** + * Parse a middleware string to get the name and parameters. + * + * @param string $middleware + * @return array + */ + protected function parseMiddleware($middleware) + { + list($name, $parameters) = array_pad(explode(':', $middleware, 2), 2, []); + + if (is_string($parameters)) { + $parameters = explode(',', $parameters); + } + + return [$name, $parameters]; + } + + /** + * Add a new middleware to beginning of the stack if it does not already exist. + * + * @param string $middleware + * @return $this + */ + public function prependMiddleware($middleware) + { + if (array_search($middleware, $this->middleware) === false) { + array_unshift($this->middleware, $middleware); + } + + return $this; + } + + /** + * Add a new middleware to end of the stack if it does not already exist. + * + * @param string $middleware + * @return $this + */ + public function pushMiddleware($middleware) + { + if (array_search($middleware, $this->middleware) === false) { + $this->middleware[] = $middleware; + } + + return $this; + } + + /** + * Bootstrap the application for HTTP requests. + * + * @return void + */ + public function bootstrap() + { + if (! $this->app->hasBeenBootstrapped()) { + $this->app->bootstrapWith($this->bootstrappers()); + } + } + + /** + * Get the route dispatcher callback. + * + * @return \Closure + */ + protected function dispatchToRouter() + { + return function ($request) { + $this->app->instance('request', $request); + + return $this->router->dispatch($request); + }; + } + + /** + * Determine if the kernel has a given middleware. + * + * @param string $middleware + * @return bool + */ + public function hasMiddleware($middleware) + { + return in_array($middleware, $this->middleware); + } + + /** + * Get the bootstrap classes for the application. + * + * @return array + */ + protected function bootstrappers() + { + return $this->bootstrappers; + } + + /** + * Report the exception to the exception handler. + * + * @param \Exception $e + * @return void + */ + protected function reportException(Exception $e) + { + $this->app['Illuminate\Contracts\Debug\ExceptionHandler']->report($e); + } + + /** + * Render the exception to a response. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function renderException($request, Exception $e) + { + return $this->app['Illuminate\Contracts\Debug\ExceptionHandler']->render($request, $e); + } + + /** + * Get the Laravel application instance. + * + * @return \Illuminate\Contracts\Foundation\Application + */ + public function getApplication() + { + return $this->app; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php index 1253546..a5b0786 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php @@ -1,45 +1,46 @@ -app = $app; - } +class CheckForMaintenanceMode +{ + /** + * The application implementation. + * + * @var \Illuminate\Contracts\Foundation\Application + */ + protected $app; - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - if ($this->app->isDownForMaintenance()) - { - throw new HttpException(503); - } + /** + * Create a new middleware instance. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + public function __construct(Application $app) + { + $this->app = $app; + } - return $next($request); - } + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + */ + public function handle($request, Closure $next) + { + if ($this->app->isDownForMaintenance()) { + throw new HttpException(503); + } + return $next($request); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php index 81dff73..9caf7fc 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php @@ -1,94 +1,131 @@ -encrypter = $encrypter; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - * - * @throws \Illuminate\Session\TokenMismatchException - */ - public function handle($request, Closure $next) - { - if ($this->isReading($request) || $this->tokensMatch($request)) - { - return $this->addCookieToResponse($request, $next($request)); - } - - throw new TokenMismatchException; - } - - /** - * Determine if the session and input CSRF tokens match. - * - * @param \Illuminate\Http\Request $request - * @return bool - */ - protected function tokensMatch($request) - { - $token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN'); - - if ( ! $token && $header = $request->header('X-XSRF-TOKEN')) - { - $token = $this->encrypter->decrypt($header); - } - - return StringUtils::equals($request->session()->token(), $token); - } - - /** - * Add the CSRF token to the response cookies. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Http\Response $response - * @return \Illuminate\Http\Response - */ - protected function addCookieToResponse($request, $response) - { - $response->headers->setCookie( - new Cookie('XSRF-TOKEN', $request->session()->token(), time() + 60 * 120, '/', null, false, false) - ); - - return $response; - } - - /** - * Determine if the HTTP request uses a ‘read’ verb. - * - * @param \Illuminate\Http\Request $request - * @return bool - */ - protected function isReading($request) - { - return in_array($request->method(), ['HEAD', 'GET', 'OPTIONS']); - } +class VerifyCsrfToken +{ + /** + * The encrypter implementation. + * + * @var \Illuminate\Contracts\Encryption\Encrypter + */ + protected $encrypter; + + /** + * The URIs that should be excluded from CSRF verification. + * + * @var array + */ + protected $except = []; + + /** + * Create a new middleware instance. + * + * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter + * @return void + */ + public function __construct(Encrypter $encrypter) + { + $this->encrypter = $encrypter; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + * + * @throws \Illuminate\Session\TokenMismatchException + */ + public function handle($request, Closure $next) + { + if ($this->isReading($request) || $this->shouldPassThrough($request) || $this->tokensMatch($request)) { + return $this->addCookieToResponse($request, $next($request)); + } + + throw new TokenMismatchException; + } + + /** + * Determine if the request has a URI that should pass through CSRF verification. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + protected function shouldPassThrough($request) + { + foreach ($this->except as $except) { + if ($except !== '/') { + $except = trim($except, '/'); + } + + if ($request->is($except)) { + return true; + } + } + + return false; + } + + /** + * Determine if the session and input CSRF tokens match. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + protected function tokensMatch($request) + { + $sessionToken = $request->session()->token(); + + $token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN'); + + if (! $token && $header = $request->header('X-XSRF-TOKEN')) { + $token = $this->encrypter->decrypt($header); + } + + if (! is_string($sessionToken) || ! is_string($token)) { + return false; + } + + return Str::equals($sessionToken, $token); + } + + /** + * Add the CSRF token to the response cookies. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Response $response + * @return \Illuminate\Http\Response + */ + protected function addCookieToResponse($request, $response) + { + $config = config('session'); + + $response->headers->setCookie( + new Cookie( + 'XSRF-TOKEN', $request->session()->token(), time() + 60 * 120, + $config['path'], $config['domain'], $config['secure'], false + ) + ); + + return $response; + } + + /** + * Determine if the HTTP request uses a ‘read’ verb. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + protected function isReading($request) + { + return in_array($request->method(), ['HEAD', 'GET', 'OPTIONS']); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyPostSize.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyPostSize.php index 00a114d..a3e0f55 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyPostSize.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyPostSize.php @@ -1,53 +1,51 @@ -server('CONTENT_LENGTH') > $this->getPostMaxSize()) - { - throw new PostTooLargeException; - } - - return $next($request); - } - - /** - * Determine the server 'post_max_size' as bytes. - * - * @return int - */ - protected function getPostMaxSize() - { - $postMaxSize = ini_get('post_max_size'); - - switch (substr($postMaxSize, -1)) - { - case 'M': - case 'm': - return (int) $postMaxSize * 1048576; - case 'K': - case 'k': - return (int) $postMaxSize * 1024; - case 'G': - case 'g': - return (int) $postMaxSize * 1073741824; - } - - return (int) $postMaxSize; - } - +class VerifyPostSize +{ + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + * + * @throws \Illuminate\Http\Exception\PostTooLargeException + */ + public function handle($request, Closure $next) + { + if ($request->server('CONTENT_LENGTH') > $this->getPostMaxSize()) { + throw new PostTooLargeException; + } + + return $next($request); + } + + /** + * Determine the server 'post_max_size' as bytes. + * + * @return int + */ + protected function getPostMaxSize() + { + $postMaxSize = ini_get('post_max_size'); + + switch (substr($postMaxSize, -1)) { + case 'M': + case 'm': + return (int) $postMaxSize * 1048576; + case 'K': + case 'k': + return (int) $postMaxSize * 1024; + case 'G': + case 'g': + return (int) $postMaxSize * 1073741824; + } + + return (int) $postMaxSize; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Inspiring.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Inspiring.php index 7f10a81..7f56c4f 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Inspiring.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Inspiring.php @@ -1,28 +1,32 @@ -random(); - } +class Inspiring +{ + /** + * Get an inspiring quote. + * + * Taylor & Dayle made this commit from Jungfraujoch. (11,333 ft.) + * + * May McGinnis always control the board. #LaraconUS2015 + * + * @return string + */ + public static function quote() + { + return Collection::make([ + 'When there is no desire, all things are at peace. - Laozi', + 'Simplicity is the ultimate sophistication. - Leonardo da Vinci', + 'Simplicity is the essence of happiness. - Cedric Bledsoe', + 'Smile, breathe, and go slowly. - Thich Nhat Hanh', + 'Simplicity is an acquired taste. - Katharine Gerould', + 'Well begun is half done. - Aristotle', + 'He who is contented is rich. - Laozi', + 'Very little is needed to make a happy life. - Marcus Antoninus', + ])->random(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php index 6b14b98..6048de8 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php @@ -1,209 +1,205 @@ -app = $app; - $this->files = $files; - $this->manifestPath = $manifestPath; - } - - /** - * Register the application service providers. - * - * @param array $providers - * @return void - */ - public function load(array $providers) - { - $manifest = $this->loadManifest(); - - // First we will load the service manifest, which contains information on all - // service providers registered with the application and which services it - // provides. This is used to know which services are "deferred" loaders. - if ($this->shouldRecompile($manifest, $providers)) - { - $manifest = $this->compileManifest($providers); - } - - // Next, we will register events to load the providers for each of the events - // that it has requested. This allows the service provider to defer itself - // while still getting automatically loaded when a certain event occurs. - foreach ($manifest['when'] as $provider => $events) - { - $this->registerLoadEvents($provider, $events); - } - - // We will go ahead and register all of the eagerly loaded providers with the - // application so their services can be registered with the application as - // a provided service. Then we will set the deferred service list on it. - foreach ($manifest['eager'] as $provider) - { - $this->app->register($this->createProvider($provider)); - } - - $this->app->setDeferredServices($manifest['deferred']); - } - - /** - * Register the load events for the given provider. - * - * @param string $provider - * @param array $events - * @return void - */ - protected function registerLoadEvents($provider, array $events) - { - if (count($events) < 1) return; - - $app = $this->app; - - $app->make('events')->listen($events, function() use ($app, $provider) - { - $app->register($provider); - }); - } - - /** - * Compile the application manifest file. - * - * @param array $providers - * @return array - */ - protected function compileManifest($providers) - { - // The service manifest should contain a list of all of the providers for - // the application so we can compare it on each request to the service - // and determine if the manifest should be recompiled or is current. - $manifest = $this->freshManifest($providers); - - foreach ($providers as $provider) - { - $instance = $this->createProvider($provider); - - // When recompiling the service manifest, we will spin through each of the - // providers and check if it's a deferred provider or not. If so we'll - // add it's provided services to the manifest and note the provider. - if ($instance->isDeferred()) - { - foreach ($instance->provides() as $service) - { - $manifest['deferred'][$service] = $provider; - } - - $manifest['when'][$provider] = $instance->when(); - } - - // If the service providers are not deferred, we will simply add it to an - // array of eagerly loaded providers that will get registered on every - // request to this application instead of "lazy" loading every time. - else - { - $manifest['eager'][] = $provider; - } - } - - return $this->writeManifest($manifest); - } - - /** - * Create a new provider instance. - * - * @param string $provider - * @return \Illuminate\Support\ServiceProvider - */ - public function createProvider($provider) - { - return new $provider($this->app); - } - - /** - * Determine if the manifest should be compiled. - * - * @param array $manifest - * @param array $providers - * @return bool - */ - public function shouldRecompile($manifest, $providers) - { - return is_null($manifest) || $manifest['providers'] != $providers; - } - - /** - * Load the service provider manifest JSON file. - * - * @return array - */ - public function loadManifest() - { - // The service manifest is a file containing a JSON representation of every - // service provided by the application and whether its provider is using - // deferred loading or should be eagerly loaded on each request to us. - if ($this->files->exists($this->manifestPath)) - { - $manifest = json_decode($this->files->get($this->manifestPath), true); - - return array_merge(['when' => []], $manifest); - } - } - - /** - * Write the service manifest file to disk. - * - * @param array $manifest - * @return array - */ - public function writeManifest($manifest) - { - $this->files->put( - $this->manifestPath, json_encode($manifest, JSON_PRETTY_PRINT) - ); - - return $manifest; - } - - /** - * Create a fresh service manifest data structure. - * - * @param array $providers - * @return array - */ - protected function freshManifest(array $providers) - { - return ['providers' => $providers, 'eager' => [], 'deferred' => []]; - } - +class ProviderRepository +{ + /** + * The application implementation. + * + * @var \Illuminate\Contracts\Foundation\Application + */ + protected $app; + + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * The path to the manifest file. + * + * @var string + */ + protected $manifestPath; + + /** + * Create a new service repository instance. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param \Illuminate\Filesystem\Filesystem $files + * @param string $manifestPath + * @return void + */ + public function __construct(ApplicationContract $app, Filesystem $files, $manifestPath) + { + $this->app = $app; + $this->files = $files; + $this->manifestPath = $manifestPath; + } + + /** + * Register the application service providers. + * + * @param array $providers + * @return void + */ + public function load(array $providers) + { + $manifest = $this->loadManifest(); + + // First we will load the service manifest, which contains information on all + // service providers registered with the application and which services it + // provides. This is used to know which services are "deferred" loaders. + if ($this->shouldRecompile($manifest, $providers)) { + $manifest = $this->compileManifest($providers); + } + + // Next, we will register events to load the providers for each of the events + // that it has requested. This allows the service provider to defer itself + // while still getting automatically loaded when a certain event occurs. + foreach ($manifest['when'] as $provider => $events) { + $this->registerLoadEvents($provider, $events); + } + + // We will go ahead and register all of the eagerly loaded providers with the + // application so their services can be registered with the application as + // a provided service. Then we will set the deferred service list on it. + foreach ($manifest['eager'] as $provider) { + $this->app->register($this->createProvider($provider)); + } + + $this->app->addDeferredServices($manifest['deferred']); + } + + /** + * Register the load events for the given provider. + * + * @param string $provider + * @param array $events + * @return void + */ + protected function registerLoadEvents($provider, array $events) + { + if (count($events) < 1) { + return; + } + + $app = $this->app; + + $app->make('events')->listen($events, function () use ($app, $provider) { + $app->register($provider); + }); + } + + /** + * Compile the application manifest file. + * + * @param array $providers + * @return array + */ + protected function compileManifest($providers) + { + // The service manifest should contain a list of all of the providers for + // the application so we can compare it on each request to the service + // and determine if the manifest should be recompiled or is current. + $manifest = $this->freshManifest($providers); + + foreach ($providers as $provider) { + $instance = $this->createProvider($provider); + + // When recompiling the service manifest, we will spin through each of the + // providers and check if it's a deferred provider or not. If so we'll + // add it's provided services to the manifest and note the provider. + if ($instance->isDeferred()) { + foreach ($instance->provides() as $service) { + $manifest['deferred'][$service] = $provider; + } + + $manifest['when'][$provider] = $instance->when(); + } + + // If the service providers are not deferred, we will simply add it to an + // array of eagerly loaded providers that will get registered on every + // request to this application instead of "lazy" loading every time. + else { + $manifest['eager'][] = $provider; + } + } + + return $this->writeManifest($manifest); + } + + /** + * Create a new provider instance. + * + * @param string $provider + * @return \Illuminate\Support\ServiceProvider + */ + public function createProvider($provider) + { + return new $provider($this->app); + } + + /** + * Determine if the manifest should be compiled. + * + * @param array $manifest + * @param array $providers + * @return bool + */ + public function shouldRecompile($manifest, $providers) + { + return is_null($manifest) || $manifest['providers'] != $providers; + } + + /** + * Load the service provider manifest JSON file. + * + * @return array|null + */ + public function loadManifest() + { + // The service manifest is a file containing a JSON representation of every + // service provided by the application and whether its provider is using + // deferred loading or should be eagerly loaded on each request to us. + if ($this->files->exists($this->manifestPath)) { + $manifest = json_decode($this->files->get($this->manifestPath), true); + + if ($manifest) { + return array_merge(['when' => []], $manifest); + } + } + } + + /** + * Write the service manifest file to disk. + * + * @param array $manifest + * @return array + */ + public function writeManifest($manifest) + { + $this->files->put( + $this->manifestPath, json_encode($manifest, JSON_PRETTY_PRINT) + ); + + return array_merge(['when' => []], $manifest); + } + + /** + * Create a fresh service manifest data structure. + * + * @param array $providers + * @return array + */ + protected function freshManifest(array $providers) + { + return ['providers' => $providers, 'eager' => [], 'deferred' => []]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php index f0b1a49..f74448d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php @@ -1,16 +1,21 @@ - 'command.app.name', - 'ClearCompiled' => 'command.clear-compiled', - 'CommandMake' => 'command.command.make', - 'ConfigCache' => 'command.config.cache', - 'ConfigClear' => 'command.config.clear', - 'ConsoleMake' => 'command.console.make', - 'EventGenerate' => 'command.event.generate', - 'EventMake' => 'command.event.make', - 'Down' => 'command.down', - 'Environment' => 'command.environment', - 'Fresh' => 'command.fresh', - 'HandlerCommand' => 'command.handler.command', - 'HandlerEvent' => 'command.handler.event', - 'KeyGenerate' => 'command.key.generate', - 'ModelMake' => 'command.model.make', - 'Optimize' => 'command.optimize', - 'ProviderMake' => 'command.provider.make', - 'RequestMake' => 'command.request.make', - 'RouteCache' => 'command.route.cache', - 'RouteClear' => 'command.route.clear', - 'RouteList' => 'command.route.list', - 'Serve' => 'command.serve', - 'Tinker' => 'command.tinker', - 'Up' => 'command.up', - 'VendorPublish' => 'command.vendor.publish', - ]; - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - foreach (array_keys($this->commands) as $command) - { - $method = "register{$command}Command"; - - call_user_func_array([$this, $method], []); - } - - $this->commands(array_values($this->commands)); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerAppNameCommand() - { - $this->app->singleton('command.app.name', function($app) - { - return new AppNameCommand($app['composer'], $app['files']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerClearCompiledCommand() - { - $this->app->singleton('command.clear-compiled', function() - { - return new ClearCompiledCommand; - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerCommandMakeCommand() - { - $this->app->singleton('command.command.make', function($app) - { - return new CommandMakeCommand($app['files']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerConfigCacheCommand() - { - $this->app->singleton('command.config.cache', function($app) - { - return new ConfigCacheCommand($app['files']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerConfigClearCommand() - { - $this->app->singleton('command.config.clear', function($app) - { - return new ConfigClearCommand($app['files']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerConsoleMakeCommand() - { - $this->app->singleton('command.console.make', function($app) - { - return new ConsoleMakeCommand($app['files']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerEventGenerateCommand() - { - $this->app->singleton('command.event.generate', function() - { - return new EventGenerateCommand; - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerEventMakeCommand() - { - $this->app->singleton('command.event.make', function($app) - { - return new EventMakeCommand($app['files']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerDownCommand() - { - $this->app->singleton('command.down', function() - { - return new DownCommand; - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerEnvironmentCommand() - { - $this->app->singleton('command.environment', function() - { - return new EnvironmentCommand; - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerFreshCommand() - { - $this->app->singleton('command.fresh', function() - { - return new FreshCommand; - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerHandlerCommandCommand() - { - $this->app->singleton('command.handler.command', function($app) - { - return new HandlerCommandCommand($app['files']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerHandlerEventCommand() - { - $this->app->singleton('command.handler.event', function($app) - { - return new HandlerEventCommand($app['files']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerKeyGenerateCommand() - { - $this->app->singleton('command.key.generate', function() - { - return new KeyGenerateCommand; - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerModelMakeCommand() - { - $this->app->singleton('command.model.make', function($app) - { - return new ModelMakeCommand($app['files']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerOptimizeCommand() - { - $this->app->singleton('command.optimize', function($app) - { - return new OptimizeCommand($app['composer']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerProviderMakeCommand() - { - $this->app->singleton('command.provider.make', function($app) - { - return new ProviderMakeCommand($app['files']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerRequestMakeCommand() - { - $this->app->singleton('command.request.make', function($app) - { - return new RequestMakeCommand($app['files']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerRouteCacheCommand() - { - $this->app->singleton('command.route.cache', function($app) - { - return new RouteCacheCommand($app['files']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerRouteClearCommand() - { - $this->app->singleton('command.route.clear', function($app) - { - return new RouteClearCommand($app['files']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerRouteListCommand() - { - $this->app->singleton('command.route.list', function($app) - { - return new RouteListCommand($app['router']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerServeCommand() - { - $this->app->singleton('command.serve', function() - { - return new ServeCommand; - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerTinkerCommand() - { - $this->app->singleton('command.tinker', function() - { - return new TinkerCommand; - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerUpCommand() - { - $this->app->singleton('command.up', function() - { - return new UpCommand; - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerVendorPublishCommand() - { - $this->app->singleton('command.vendor.publish', function($app) - { - return new VendorPublishCommand($app['files']); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array_values($this->commands); - } - +class ArtisanServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; + + /** + * The commands to be registered. + * + * @var array + */ + protected $commands = [ + 'AppName' => 'command.app.name', + 'ClearCompiled' => 'command.clear-compiled', + 'CommandMake' => 'command.command.make', + 'ConfigCache' => 'command.config.cache', + 'ConfigClear' => 'command.config.clear', + 'ConsoleMake' => 'command.console.make', + 'EventGenerate' => 'command.event.generate', + 'EventMake' => 'command.event.make', + 'Down' => 'command.down', + 'Environment' => 'command.environment', + 'HandlerCommand' => 'command.handler.command', + 'HandlerEvent' => 'command.handler.event', + 'JobMake' => 'command.job.make', + 'KeyGenerate' => 'command.key.generate', + 'ListenerMake' => 'command.listener.make', + 'ModelMake' => 'command.model.make', + 'Optimize' => 'command.optimize', + 'PolicyMake' => 'command.policy.make', + 'ProviderMake' => 'command.provider.make', + 'RequestMake' => 'command.request.make', + 'RouteCache' => 'command.route.cache', + 'RouteClear' => 'command.route.clear', + 'RouteList' => 'command.route.list', + 'Serve' => 'command.serve', + 'TestMake' => 'command.test.make', + 'Tinker' => 'command.tinker', + 'Up' => 'command.up', + 'VendorPublish' => 'command.vendor.publish', + 'ViewClear' => 'command.view.clear', + ]; + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + foreach (array_keys($this->commands) as $command) { + $method = "register{$command}Command"; + + call_user_func_array([$this, $method], []); + } + + $this->commands(array_values($this->commands)); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerAppNameCommand() + { + $this->app->singleton('command.app.name', function ($app) { + return new AppNameCommand($app['composer'], $app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerClearCompiledCommand() + { + $this->app->singleton('command.clear-compiled', function () { + return new ClearCompiledCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerCommandMakeCommand() + { + $this->app->singleton('command.command.make', function ($app) { + return new CommandMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerConfigCacheCommand() + { + $this->app->singleton('command.config.cache', function ($app) { + return new ConfigCacheCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerConfigClearCommand() + { + $this->app->singleton('command.config.clear', function ($app) { + return new ConfigClearCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerConsoleMakeCommand() + { + $this->app->singleton('command.console.make', function ($app) { + return new ConsoleMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerEventGenerateCommand() + { + $this->app->singleton('command.event.generate', function () { + return new EventGenerateCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerEventMakeCommand() + { + $this->app->singleton('command.event.make', function ($app) { + return new EventMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerDownCommand() + { + $this->app->singleton('command.down', function () { + return new DownCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerEnvironmentCommand() + { + $this->app->singleton('command.environment', function () { + return new EnvironmentCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerHandlerCommandCommand() + { + $this->app->singleton('command.handler.command', function ($app) { + return new HandlerCommandCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerHandlerEventCommand() + { + $this->app->singleton('command.handler.event', function ($app) { + return new HandlerEventCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerJobMakeCommand() + { + $this->app->singleton('command.job.make', function ($app) { + return new JobMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerKeyGenerateCommand() + { + $this->app->singleton('command.key.generate', function () { + return new KeyGenerateCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerListenerMakeCommand() + { + $this->app->singleton('command.listener.make', function ($app) { + return new ListenerMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerModelMakeCommand() + { + $this->app->singleton('command.model.make', function ($app) { + return new ModelMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerOptimizeCommand() + { + $this->app->singleton('command.optimize', function ($app) { + return new OptimizeCommand($app['composer']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerProviderMakeCommand() + { + $this->app->singleton('command.provider.make', function ($app) { + return new ProviderMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerRequestMakeCommand() + { + $this->app->singleton('command.request.make', function ($app) { + return new RequestMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerRouteCacheCommand() + { + $this->app->singleton('command.route.cache', function ($app) { + return new RouteCacheCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerRouteClearCommand() + { + $this->app->singleton('command.route.clear', function ($app) { + return new RouteClearCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerRouteListCommand() + { + $this->app->singleton('command.route.list', function ($app) { + return new RouteListCommand($app['router']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerServeCommand() + { + $this->app->singleton('command.serve', function () { + return new ServeCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerTestMakeCommand() + { + $this->app->singleton('command.test.make', function ($app) { + return new TestMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerTinkerCommand() + { + $this->app->singleton('command.tinker', function () { + return new TinkerCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerUpCommand() + { + $this->app->singleton('command.up', function () { + return new UpCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerVendorPublishCommand() + { + $this->app->singleton('command.vendor.publish', function ($app) { + return new VendorPublishCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerViewClearCommand() + { + $this->app->singleton('command.view.clear', function ($app) { + return new ViewClearCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerPolicyMakeCommand() + { + $this->app->singleton('command.policy.make', function ($app) { + return new PolicyMakeCommand($app['files']); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return array_values($this->commands); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php index ae29f5f..df68d3c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php @@ -1,38 +1,38 @@ -app->singleton('composer', function($app) - { - return new Composer($app['files'], $app->basePath()); - }); - } +class ComposerServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array('composer'); - } + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton('composer', function ($app) { + return new Composer($app['files'], $app->basePath()); + }); + } + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['composer']; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php index 35dde9d..9dc4a20 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php @@ -1,30 +1,31 @@ -app['events']->listen('router.matched', function() - { - $this->app->resolving(function(FormRequest $request, $app) - { - $this->initializeRequest($request, $app['request']); +class FormRequestServiceProvider extends ServiceProvider +{ + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + // + } - $request->setContainer($app) - ->setRedirector($app['Illuminate\Routing\Redirector']); - }); - }); - } + /** + * Bootstrap the application events. + * + * @return void + */ + public function boot() + { + $this->app['events']->listen('router.matched', function () { + $this->app->resolving(function (FormRequest $request, $app) { + $this->initializeRequest($request, $app['request']); - /** - * Initialize the form request with data from the given request. - * - * @param \Illuminate\Foundation\Http\FormRequest $form - * @param \Symfony\Component\HttpFoundation\Request $current - * @return void - */ - protected function initializeRequest(FormRequest $form, Request $current) - { - $files = $current->files->all(); + $request->setContainer($app)->setRedirector($app->make(Redirector::class)); + }); + }); + } - $files = is_array($files) ? array_filter($files) : $files; + /** + * Initialize the form request with data from the given request. + * + * @param \Illuminate\Foundation\Http\FormRequest $form + * @param \Symfony\Component\HttpFoundation\Request $current + * @return void + */ + protected function initializeRequest(FormRequest $form, Request $current) + { + $files = $current->files->all(); - $form->initialize( - $current->query->all(), $current->request->all(), $current->attributes->all(), - $current->cookies->all(), $files, $current->server->all(), $current->getContent() - ); + $files = is_array($files) ? array_filter($files) : $files; - if ($session = $current->getSession()) - { - $form->setSession($session); - } + $form->initialize( + $current->query->all(), $current->request->all(), $current->attributes->all(), + $current->cookies->all(), $files, $current->server->all(), $current->getContent() + ); - $form->setUserResolver($current->getUserResolver()); + if ($session = $current->getSession()) { + $form->setSession($session); + } - $form->setRouteResolver($current->getRouteResolver()); - } + $form->setUserResolver($current->getUserResolver()); + $form->setRouteResolver($current->getRouteResolver()); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php index 51c783d..f1f4837 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php @@ -1,16 +1,17 @@ -policies as $key => $value) { + $gate->policy($key, $value); + } + } + + /** + * {@inheritdoc} + */ + public function register() + { + // + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php index 9d744ef..602a882 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php @@ -1,62 +1,60 @@ -listen as $event => $listeners) - { - foreach ($listeners as $listener) - { - $events->listen($event, $listener); - } - } - - foreach ($this->subscribe as $subscriber) - { - $events->subscribe($subscriber); - } - } - - /** - * {@inheritdoc} - */ - public function register() - { - // - } - - /** - * Get the events and handlers. - * - * @return array - */ - public function listens() - { - return $this->listen; - } - +class EventServiceProvider extends ServiceProvider +{ + /** + * The event handler mappings for the application. + * + * @var array + */ + protected $listen = []; + + /** + * The subscriber classes to register. + * + * @var array + */ + protected $subscribe = []; + + /** + * Register the application's event listeners. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function boot(DispatcherContract $events) + { + foreach ($this->listen as $event => $listeners) { + foreach ($listeners as $listener) { + $events->listen($event, $listener); + } + } + + foreach ($this->subscribe as $subscriber) { + $events->subscribe($subscriber); + } + } + + /** + * {@inheritdoc} + */ + public function register() + { + // + } + + /** + * Get the events and handlers. + * + * @return array + */ + public function listens() + { + return $this->listen; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php index 40d2ab4..21a69cb 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php @@ -1,111 +1,115 @@ -setRootControllerNamespace(); + /** + * Bootstrap any application services. + * + * @param \Illuminate\Routing\Router $router + * @return void + */ + public function boot(Router $router) + { + $this->setRootControllerNamespace(); - if ($this->app->routesAreCached()) - { - $this->loadCachedRoutes(); - } - else - { - $this->loadRoutes(); - } - } + if ($this->app->routesAreCached()) { + $this->loadCachedRoutes(); + } else { + $this->loadRoutes(); - /** - * Set the root controller namespace for the application. - * - * @return void - */ - protected function setRootControllerNamespace() - { - if (is_null($this->namespace)) return; + $this->app->booted(function () use ($router) { + $router->getRoutes()->refreshNameLookups(); + }); + } + } - $this->app['Illuminate\Contracts\Routing\UrlGenerator'] - ->setRootControllerNamespace($this->namespace); - } + /** + * Set the root controller namespace for the application. + * + * @return void + */ + protected function setRootControllerNamespace() + { + if (is_null($this->namespace)) { + return; + } - /** - * Load the cached routes for the application. - * - * @return void - */ - protected function loadCachedRoutes() - { - $this->app->booted(function() - { - require $this->app->getCachedRoutesPath(); - }); - } + $this->app[UrlGenerator::class]->setRootControllerNamespace($this->namespace); + } - /** - * Load the application routes. - * - * @return void - */ - protected function loadRoutes() - { - $this->app->call([$this, 'map']); - } + /** + * Load the cached routes for the application. + * + * @return void + */ + protected function loadCachedRoutes() + { + $this->app->booted(function () { + require $this->app->getCachedRoutesPath(); + }); + } - /** - * Load the standard routes file for the application. - * - * @param string $path - * @return void - */ - protected function loadRoutesFrom($path) - { - $router = $this->app['Illuminate\Routing\Router']; + /** + * Load the application routes. + * + * @return void + */ + protected function loadRoutes() + { + $this->app->call([$this, 'map']); + } - if (is_null($this->namespace)) return require $path; + /** + * Load the standard routes file for the application. + * + * @param string $path + * @return mixed + */ + protected function loadRoutesFrom($path) + { + $router = $this->app->make(Router::class); - $router->group(['namespace' => $this->namespace], function($router) use ($path) - { - require $path; - }); - } + if (is_null($this->namespace)) { + return require $path; + } - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - // - } + $router->group(['namespace' => $this->namespace], function (Router $router) use ($path) { + require $path; + }); + } - /** - * Pass dynamic methods onto the router instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return call_user_func_array([$this->app['router'], $method], $parameters); - } + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + // + } + /** + * Pass dynamic methods onto the router instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return call_user_func_array([$this->app->make(Router::class), $method], $parameters); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/ApplicationTrait.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/ApplicationTrait.php index 5a16e56..f8d4450 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/ApplicationTrait.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/ApplicationTrait.php @@ -1,195 +1,314 @@ -app = $this->createApplication(); - } - - /** - * Call the given URI and return the Response. - * - * @param string $method - * @param string $uri - * @param array $parameters - * @param array $cookies - * @param array $files - * @param array $server - * @param string $content - * @return \Illuminate\Http\Response - */ - public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null) - { - $request = Request::create($uri, $method, $parameters, $cookies, $files, $server, $content); - - return $this->response = $this->app->make('Illuminate\Contracts\Http\Kernel')->handle($request); - } - - /** - * Call the given HTTPS URI and return the Response. - * - * @param string $method - * @param string $uri - * @param array $parameters - * @param array $cookies - * @param array $files - * @param array $server - * @param string $content - * @return \Illuminate\Http\Response - */ - public function callSecure($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null) - { - $uri = 'https://localhost/'.ltrim($uri, '/'); - - return $this->response = $this->call($method, $uri, $parameters, $cookies, $files, $server, $content); - } - - /** - * Call a controller action and return the Response. - * - * @param string $method - * @param string $action - * @param array $wildcards - * @param array $parameters - * @param array $cookies - * @param array $files - * @param array $server - * @param string $content - * @return \Illuminate\Http\Response - */ - public function action($method, $action, $wildcards = [], $parameters = [], $cookies = [], $files = [], $server = [], $content = null) - { - $uri = $this->app['url']->action($action, $wildcards, true); - - return $this->response = $this->call($method, $uri, $parameters, $cookies, $files, $server, $content); - } - - /** - * Call a named route and return the Response. - * - * @param string $method - * @param string $name - * @param array $routeParameters - * @param array $parameters - * @param array $cookies - * @param array $files - * @param array $server - * @param string $content - * @return \Illuminate\Http\Response - */ - public function route($method, $name, $routeParameters = [], $parameters = [], $cookies = [], $files = [], $server = [], $content = null) - { - $uri = $this->app['url']->route($name, $routeParameters); - - return $this->response = $this->call($method, $uri, $parameters, $cookies, $files, $server, $content); - } - - /** - * Set the session to the given array. - * - * @param array $data - * @return void - */ - public function session(array $data) - { - $this->startSession(); - - foreach ($data as $key => $value) - { - $this->app['session']->put($key, $value); - } - } - - /** - * Flush all of the current session data. - * - * @return void - */ - public function flushSession() - { - $this->startSession(); - - $this->app['session']->flush(); - } - - /** - * Start the session for the application. - * - * @return void - */ - protected function startSession() - { - if ( ! $this->app['session']->isStarted()) - { - $this->app['session']->start(); - } - } - - /** - * Set the currently logged in user for the application. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @param string $driver - * @return void - */ - public function be(UserContract $user, $driver = null) - { - $this->app['auth']->driver($driver)->setUser($user); - } - - /** - * Seed a given database connection. - * - * @param string $class - * @return void - */ - public function seed($class = 'DatabaseSeeder') - { - $this->artisan('db:seed', ['--class' => $class]); - } - - /** - * Call artisan command and return code. - * - * @param string $command - * @param array $parameters - * @return int - */ - public function artisan($command, $parameters = []) - { - return $this->code = $this->app['Illuminate\Contracts\Console\Kernel']->call($command, $parameters); - } +trait ApplicationTrait +{ + /** + * The Illuminate application instance. + * + * @var \Illuminate\Foundation\Application + */ + protected $app; + + /** + * The last code returned by Artisan CLI. + * + * @var int + */ + protected $code; + + /** + * Refresh the application instance. + * + * @return void + */ + protected function refreshApplication() + { + putenv('APP_ENV=testing'); + + $this->app = $this->createApplication(); + } + + /** + * Register an instance of an object in the container. + * + * @param string $abstract + * @param object $instance + * @return object + */ + protected function instance($abstract, $instance) + { + $this->app->instance($abstract, $instance); + + return $instance; + } + + /** + * Specify a list of events that should be fired for the given operation. + * + * These events will be mocked, so that handlers will not actually be executed. + * + * @param array|mixed $events + * @return $this + */ + public function expectsEvents($events) + { + $events = is_array($events) ? $events : func_get_args(); + + $mock = Mockery::spy('Illuminate\Contracts\Events\Dispatcher'); + + $mock->shouldReceive('fire')->andReturnUsing(function ($called) use (&$events) { + foreach ($events as $key => $event) { + if ((is_string($called) && $called === $event) || + (is_string($called) && is_subclass_of($called, $event)) || + (is_object($called) && $called instanceof $event)) { + unset($events[$key]); + } + } + }); + + $this->beforeApplicationDestroyed(function () use (&$events) { + if ($events) { + throw new Exception( + 'The following events were not fired: ['.implode(', ', $events).']' + ); + } + }); + + $this->app->instance('events', $mock); + + return $this; + } + + /** + * Mock the event dispatcher so all events are silenced. + * + * @return $this + */ + protected function withoutEvents() + { + $mock = Mockery::mock('Illuminate\Contracts\Events\Dispatcher'); + + $mock->shouldReceive('fire'); + + $this->app->instance('events', $mock); + + return $this; + } + + /** + * Specify a list of jobs that should be dispatched for the given operation. + * + * These jobs will be mocked, so that handlers will not actually be executed. + * + * @param array|mixed $jobs + * @return $this + */ + protected function expectsJobs($jobs) + { + $jobs = is_array($jobs) ? $jobs : func_get_args(); + + $mock = Mockery::mock('Illuminate\Bus\Dispatcher[dispatch]', [$this->app]); + + foreach ($jobs as $job) { + $mock->shouldReceive('dispatch')->atLeast()->once() + ->with(Mockery::type($job)); + } + + $this->app->instance( + 'Illuminate\Contracts\Bus\Dispatcher', $mock + ); + + return $this; + } + + /** + * Set the session to the given array. + * + * @param array $data + * @return $this + */ + public function withSession(array $data) + { + $this->session($data); + + return $this; + } + + /** + * Set the session to the given array. + * + * @param array $data + * @return void + */ + public function session(array $data) + { + $this->startSession(); + + foreach ($data as $key => $value) { + $this->app['session']->put($key, $value); + } + } + + /** + * Start the session for the application. + * + * @return void + */ + protected function startSession() + { + if (! $this->app['session']->isStarted()) { + $this->app['session']->start(); + } + } + + /** + * Flush all of the current session data. + * + * @return void + */ + public function flushSession() + { + $this->startSession(); + + $this->app['session']->flush(); + } + + /** + * Disable middleware for the test. + * + * @return $this + */ + public function withoutMiddleware() + { + $this->app->instance('middleware.disable', true); + + return $this; + } + + /** + * Set the currently logged in user for the application. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string|null $driver + * @return $this + */ + public function actingAs(UserContract $user, $driver = null) + { + $this->be($user, $driver); + + return $this; + } + + /** + * Set the currently logged in user for the application. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string|null $driver + * @return void + */ + public function be(UserContract $user, $driver = null) + { + $this->app['auth']->driver($driver)->setUser($user); + } + + /** + * Assert that a given where condition exists in the database. + * + * @param string $table + * @param array $data + * @param string $connection + * @return $this + */ + protected function seeInDatabase($table, array $data, $connection = null) + { + $database = $this->app->make('db'); + + $connection = $connection ?: $database->getDefaultConnection(); + + $count = $database->connection($connection)->table($table)->where($data)->count(); + + $this->assertGreaterThan(0, $count, sprintf( + 'Unable to find row in database table [%s] that matched attributes [%s].', $table, json_encode($data) + )); + + return $this; + } + + /** + * Assert that a given where condition does not exist in the database. + * + * @param string $table + * @param array $data + * @param string $connection + * @return $this + */ + protected function missingFromDatabase($table, array $data, $connection = null) + { + return $this->notSeeInDatabase($table, $data, $connection); + } + + /** + * Assert that a given where condition does not exist in the database. + * + * @param string $table + * @param array $data + * @param string $connection + * @return $this + */ + protected function dontSeeInDatabase($table, array $data, $connection = null) + { + return $this->notSeeInDatabase($table, $data, $connection); + } + + /** + * Assert that a given where condition does not exist in the database. + * + * @param string $table + * @param array $data + * @param string $connection + * @return $this + */ + protected function notSeeInDatabase($table, array $data, $connection = null) + { + $database = $this->app->make('db'); + + $connection = $connection ?: $database->getDefaultConnection(); + + $count = $database->connection($connection)->table($table)->where($data)->count(); + + $this->assertEquals(0, $count, sprintf( + 'Found unexpected records in database table [%s] that matched attributes [%s].', $table, json_encode($data) + )); + + return $this; + } + + /** + * Seed a given database connection. + * + * @param string $class + * @return void + */ + public function seed($class = 'DatabaseSeeder') + { + $this->artisan('db:seed', ['--class' => $class]); + } + /** + * Call artisan command and return code. + * + * @param string $command + * @param array $parameters + * @return int + */ + public function artisan($command, $parameters = []) + { + return $this->code = $this->app['Illuminate\Contracts\Console\Kernel']->call($command, $parameters); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/AssertionsTrait.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/AssertionsTrait.php index d6687ab..26b288e 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/AssertionsTrait.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/AssertionsTrait.php @@ -1,218 +1,203 @@ -response->getStatusCode(); - - return PHPUnit::assertTrue($this->response->isOk(), "Expected status code 200, got {$actual}."); - } - - /** - * Assert that the client response has a given code. - * - * @param int $code - * @return void - */ - public function assertResponseStatus($code) - { - $actual = $this->response->getStatusCode(); - - return PHPUnit::assertEquals($code, $this->response->getStatusCode(), "Expected status code {$code}, got {$actual}."); - } - - /** - * Assert that the response view has a given piece of bound data. - * - * @param string|array $key - * @param mixed $value - * @return void - */ - public function assertViewHas($key, $value = null) - { - if (is_array($key)) return $this->assertViewHasAll($key); - - if ( ! isset($this->response->original) || ! $this->response->original instanceof View) - { - return PHPUnit::assertTrue(false, 'The response was not a view.'); - } - - if (is_null($value)) - { - PHPUnit::assertArrayHasKey($key, $this->response->original->getData()); - } - else - { - PHPUnit::assertEquals($value, $this->response->original->$key); - } - } - - /** - * Assert that the view has a given list of bound data. - * - * @param array $bindings - * @return void - */ - public function assertViewHasAll(array $bindings) - { - foreach ($bindings as $key => $value) - { - if (is_int($key)) - { - $this->assertViewHas($value); - } - else - { - $this->assertViewHas($key, $value); - } - } - } - - /** - * Assert that the response view is missing a piece of bound data. - * - * @param string $key - * @return void - */ - public function assertViewMissing($key) - { - if ( ! isset($this->response->original) || ! $this->response->original instanceof View) - { - return PHPUnit::assertTrue(false, 'The response was not a view.'); - } - - PHPUnit::assertArrayNotHasKey($key, $this->response->original->getData()); - } - - /** - * Assert whether the client was redirected to a given URI. - * - * @param string $uri - * @param array $with - * @return void - */ - public function assertRedirectedTo($uri, $with = array()) - { - PHPUnit::assertInstanceOf('Illuminate\Http\RedirectResponse', $this->response); - - PHPUnit::assertEquals($this->app['url']->to($uri), $this->response->headers->get('Location')); - - $this->assertSessionHasAll($with); - } - - /** - * Assert whether the client was redirected to a given route. - * - * @param string $name - * @param array $parameters - * @param array $with - * @return void - */ - public function assertRedirectedToRoute($name, $parameters = array(), $with = array()) - { - $this->assertRedirectedTo($this->app['url']->route($name, $parameters), $with); - } - - /** - * Assert whether the client was redirected to a given action. - * - * @param string $name - * @param array $parameters - * @param array $with - * @return void - */ - public function assertRedirectedToAction($name, $parameters = array(), $with = array()) - { - $this->assertRedirectedTo($this->app['url']->action($name, $parameters), $with); - } - - /** - * Assert that the session has a given list of values. - * - * @param string|array $key - * @param mixed $value - * @return void - */ - public function assertSessionHas($key, $value = null) - { - if (is_array($key)) return $this->assertSessionHasAll($key); - - if (is_null($value)) - { - PHPUnit::assertTrue($this->app['session.store']->has($key), "Session missing key: $key"); - } - else - { - PHPUnit::assertEquals($value, $this->app['session.store']->get($key)); - } - } - - /** - * Assert that the session has a given list of values. - * - * @param array $bindings - * @return void - */ - public function assertSessionHasAll(array $bindings) - { - foreach ($bindings as $key => $value) - { - if (is_int($key)) - { - $this->assertSessionHas($value); - } - else - { - $this->assertSessionHas($key, $value); - } - } - } - - /** - * Assert that the session has errors bound. - * - * @param string|array $bindings - * @param mixed $format - * @return void - */ - public function assertSessionHasErrors($bindings = array(), $format = null) - { - $this->assertSessionHas('errors'); - - $bindings = (array) $bindings; - - $errors = $this->app['session.store']->get('errors'); - - foreach ($bindings as $key => $value) - { - if (is_int($key)) - { - PHPUnit::assertTrue($errors->has($value), "Session missing error: $value"); - } - else - { - PHPUnit::assertContains($value, $errors->get($key, $format)); - } - } - } - - /** - * Assert that the session has old input. - * - * @return void - */ - public function assertHasOldInput() - { - $this->assertSessionHas('_old_input'); - } - +trait AssertionsTrait +{ + /** + * Assert that the client response has an OK status code. + * + * @return void + */ + public function assertResponseOk() + { + $actual = $this->response->getStatusCode(); + + return PHPUnit::assertTrue($this->response->isOk(), "Expected status code 200, got {$actual}."); + } + + /** + * Assert that the client response has a given code. + * + * @param int $code + * @return void + */ + public function assertResponseStatus($code) + { + $actual = $this->response->getStatusCode(); + + return PHPUnit::assertEquals($code, $this->response->getStatusCode(), "Expected status code {$code}, got {$actual}."); + } + + /** + * Assert that the response view has a given piece of bound data. + * + * @param string|array $key + * @param mixed $value + * @return void + */ + public function assertViewHas($key, $value = null) + { + if (is_array($key)) { + return $this->assertViewHasAll($key); + } + + if (! isset($this->response->original) || ! $this->response->original instanceof View) { + return PHPUnit::assertTrue(false, 'The response was not a view.'); + } + + if (is_null($value)) { + PHPUnit::assertArrayHasKey($key, $this->response->original->getData()); + } else { + PHPUnit::assertEquals($value, $this->response->original->$key); + } + } + + /** + * Assert that the view has a given list of bound data. + * + * @param array $bindings + * @return void + */ + public function assertViewHasAll(array $bindings) + { + foreach ($bindings as $key => $value) { + if (is_int($key)) { + $this->assertViewHas($value); + } else { + $this->assertViewHas($key, $value); + } + } + } + + /** + * Assert that the response view is missing a piece of bound data. + * + * @param string $key + * @return void + */ + public function assertViewMissing($key) + { + if (! isset($this->response->original) || ! $this->response->original instanceof View) { + return PHPUnit::assertTrue(false, 'The response was not a view.'); + } + + PHPUnit::assertArrayNotHasKey($key, $this->response->original->getData()); + } + + /** + * Assert whether the client was redirected to a given URI. + * + * @param string $uri + * @param array $with + * @return void + */ + public function assertRedirectedTo($uri, $with = []) + { + PHPUnit::assertInstanceOf('Illuminate\Http\RedirectResponse', $this->response); + + PHPUnit::assertEquals($this->app['url']->to($uri), $this->response->headers->get('Location')); + + $this->assertSessionHasAll($with); + } + + /** + * Assert whether the client was redirected to a given route. + * + * @param string $name + * @param array $parameters + * @param array $with + * @return void + */ + public function assertRedirectedToRoute($name, $parameters = [], $with = []) + { + $this->assertRedirectedTo($this->app['url']->route($name, $parameters), $with); + } + + /** + * Assert whether the client was redirected to a given action. + * + * @param string $name + * @param array $parameters + * @param array $with + * @return void + */ + public function assertRedirectedToAction($name, $parameters = [], $with = []) + { + $this->assertRedirectedTo($this->app['url']->action($name, $parameters), $with); + } + + /** + * Assert that the session has a given value. + * + * @param string|array $key + * @param mixed $value + * @return void + */ + public function assertSessionHas($key, $value = null) + { + if (is_array($key)) { + return $this->assertSessionHasAll($key); + } + + if (is_null($value)) { + PHPUnit::assertTrue($this->app['session.store']->has($key), "Session missing key: $key"); + } else { + PHPUnit::assertEquals($value, $this->app['session.store']->get($key)); + } + } + + /** + * Assert that the session has a given list of values. + * + * @param array $bindings + * @return void + */ + public function assertSessionHasAll(array $bindings) + { + foreach ($bindings as $key => $value) { + if (is_int($key)) { + $this->assertSessionHas($value); + } else { + $this->assertSessionHas($key, $value); + } + } + } + + /** + * Assert that the session has errors bound. + * + * @param string|array $bindings + * @param mixed $format + * @return void + */ + public function assertSessionHasErrors($bindings = [], $format = null) + { + $this->assertSessionHas('errors'); + + $bindings = (array) $bindings; + + $errors = $this->app['session.store']->get('errors'); + + foreach ($bindings as $key => $value) { + if (is_int($key)) { + PHPUnit::assertTrue($errors->has($value), "Session missing error: $value"); + } else { + PHPUnit::assertContains($value, $errors->get($key, $format)); + } + } + } + + /** + * Assert that the session has old input. + * + * @return void + */ + public function assertHasOldInput() + { + $this->assertSessionHas('_old_input'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/CrawlerTrait.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/CrawlerTrait.php new file mode 100644 index 0000000..c3c59dd --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/CrawlerTrait.php @@ -0,0 +1,520 @@ + mb_strlen($content, '8bit'), + 'CONTENT_TYPE' => 'application/json', + 'Accept' => 'application/json', + ], $headers); + + $this->call( + $method, $uri, [], [], [], $this->transformHeadersToServerVars($headers), $content + ); + + return $this; + } + + /** + * Visit the given URI with a GET request. + * + * @param string $uri + * @param array $headers + * @return $this + */ + public function get($uri, array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + + $this->call('GET', $uri, [], [], [], $server); + + return $this; + } + + /** + * Visit the given URI with a POST request. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return $this + */ + public function post($uri, array $data = [], array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + + $this->call('POST', $uri, $data, [], [], $server); + + return $this; + } + + /** + * Visit the given URI with a PUT request. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return $this + */ + public function put($uri, array $data = [], array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + + $this->call('PUT', $uri, $data, [], [], $server); + + return $this; + } + + /** + * Visit the given URI with a PATCH request. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return $this + */ + public function patch($uri, array $data = [], array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + + $this->call('PATCH', $uri, $data, [], [], $server); + + return $this; + } + + /** + * Visit the given URI with a DELETE request. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return $this + */ + public function delete($uri, array $data = [], array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + + $this->call('DELETE', $uri, $data, [], [], $server); + + return $this; + } + + /** + * Send the given request through the application. + * + * This method allows you to fully customize the entire Request object. + * + * @param \Illuminate\Http\Request $request + * @return $this + */ + public function handle(Request $request) + { + $this->currentUri = $request->fullUrl(); + + $this->response = $this->app->prepareResponse($this->app->handle($request)); + + return $this; + } + + /** + * Assert that the response contains JSON. + * + * @param array|null $data + * @return $this + */ + protected function shouldReturnJson(array $data = null) + { + return $this->receiveJson($data); + } + + /** + * Assert that the response contains JSON. + * + * @param array|null $data + * @return $this|null + */ + protected function receiveJson($data = null) + { + $this->seeJson(); + + if (! is_null($data)) { + return $this->seeJson($data); + } + } + + /** + * Assert that the response contains an exact JSON array. + * + * @param array $data + * @return $this + */ + public function seeJsonEquals(array $data) + { + $actual = json_encode(Arr::sortRecursive( + json_decode($this->response->getContent(), true) + )); + + $this->assertEquals(json_encode(Arr::sortRecursive($data)), $actual); + + return $this; + } + + /** + * Assert that the response contains JSON. + * + * @param array|null $data + * @param bool $negate + * @return $this + */ + public function seeJson(array $data = null, $negate = false) + { + if (is_null($data)) { + $this->assertJson( + $this->response->getContent(), "JSON was not returned from [{$this->currentUri}]." + ); + + return $this; + } + + return $this->seeJsonContains($data, $negate); + } + + /** + * Assert that the response doesn't contain JSON. + * + * @param array|null $data + * @return $this + */ + public function dontSeeJson(array $data = null) + { + return $this->seeJson($data, true); + } + + /** + * Assert that the response contains the given JSON. + * + * @param array $data + * @param bool $negate + * @return $this + */ + protected function seeJsonContains(array $data, $negate = false) + { + $method = $negate ? 'assertFalse' : 'assertTrue'; + + $actual = json_decode($this->response->getContent(), true); + + if (is_null($actual) || $actual === false) { + return $this->fail('Invalid JSON was returned from the route. Perhaps an exception was thrown?'); + } + + $actual = json_encode(Arr::sortRecursive( + (array) $actual + )); + + foreach (Arr::sortRecursive($data) as $key => $value) { + $expected = $this->formatToExpectedJson($key, $value); + + $this->{$method}( + Str::contains($actual, $expected), + ($negate ? 'Found unexpected' : 'Unable to find')." JSON fragment [{$expected}] within [{$actual}]." + ); + } + + return $this; + } + + /** + * Format the given key and value into a JSON string for expectation checks. + * + * @param string $key + * @param mixed $value + * @return string + */ + protected function formatToExpectedJson($key, $value) + { + $expected = json_encode([$key => $value]); + + if (Str::startsWith($expected, '{')) { + $expected = substr($expected, 1); + } + + if (Str::endsWith($expected, '}')) { + $expected = substr($expected, 0, -1); + } + + return $expected; + } + + /** + * Asserts that the status code of the response matches the given code. + * + * @param int $status + * @return $this + */ + protected function seeStatusCode($status) + { + $this->assertEquals($status, $this->response->getStatusCode()); + + return $this; + } + + /** + * Asserts that the response contains the given header and equals the optional value. + * + * @param string $headerName + * @param mixed $value + * @return $this + */ + protected function seeHeader($headerName, $value = null) + { + $headers = $this->response->headers; + + $this->assertTrue($headers->has($headerName), "Header [{$headerName}] not present on response."); + + if (! is_null($value)) { + $this->assertEquals( + $headers->get($headerName), $value, + "Header [{$headerName}] was found, but value [{$headers->get($headerName)}] does not match [{$value}]." + ); + } + + return $this; + } + + /** + * Asserts that the response contains the given cookie and equals the optional value. + * + * @param string $cookieName + * @param mixed $value + * @return $this + */ + protected function seeCookie($cookieName, $value = null) + { + $headers = $this->response->headers; + + $exist = false; + + foreach ($headers->getCookies() as $cookie) { + if ($cookie->getName() === $cookieName) { + $exist = true; + break; + } + } + + $this->assertTrue($exist, "Cookie [{$cookieName}] not present on response."); + + if (! is_null($value)) { + $this->assertEquals( + $cookie->getValue(), $value, + "Cookie [{$cookieName}] was found, but value [{$cookie->getValue()}] does not match [{$value}]." + ); + } + + return $this; + } + + /** + * Define a set of server variables to be sent with the requests. + * + * @param array $server + * @return $this + */ + protected function withServerVariables(array $server) + { + $this->serverVariables = $server; + + return $this; + } + + /** + * Call the given URI and return the Response. + * + * @param string $method + * @param string $uri + * @param array $parameters + * @param array $cookies + * @param array $files + * @param array $server + * @param string $content + * @return \Illuminate\Http\Response + */ + public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null) + { + $kernel = $this->app->make('Illuminate\Contracts\Http\Kernel'); + + $this->currentUri = $this->prepareUrlForRequest($uri); + + $request = Request::create( + $this->currentUri, $method, $parameters, + $cookies, $files, array_replace($this->serverVariables, $server), $content + ); + + $response = $kernel->handle($request); + + $kernel->terminate($request, $response); + + return $this->response = $response; + } + + /** + * Call the given HTTPS URI and return the Response. + * + * @param string $method + * @param string $uri + * @param array $parameters + * @param array $cookies + * @param array $files + * @param array $server + * @param string $content + * @return \Illuminate\Http\Response + */ + public function callSecure($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null) + { + $uri = $this->app['url']->secure(ltrim($uri, '/')); + + return $this->response = $this->call($method, $uri, $parameters, $cookies, $files, $server, $content); + } + + /** + * Call a controller action and return the Response. + * + * @param string $method + * @param string $action + * @param array $wildcards + * @param array $parameters + * @param array $cookies + * @param array $files + * @param array $server + * @param string $content + * @return \Illuminate\Http\Response + */ + public function action($method, $action, $wildcards = [], $parameters = [], $cookies = [], $files = [], $server = [], $content = null) + { + $uri = $this->app['url']->action($action, $wildcards, true); + + return $this->response = $this->call($method, $uri, $parameters, $cookies, $files, $server, $content); + } + + /** + * Call a named route and return the Response. + * + * @param string $method + * @param string $name + * @param array $routeParameters + * @param array $parameters + * @param array $cookies + * @param array $files + * @param array $server + * @param string $content + * @return \Illuminate\Http\Response + */ + public function route($method, $name, $routeParameters = [], $parameters = [], $cookies = [], $files = [], $server = [], $content = null) + { + $uri = $this->app['url']->route($name, $routeParameters); + + return $this->response = $this->call($method, $uri, $parameters, $cookies, $files, $server, $content); + } + + /** + * Turn the given URI into a fully qualified URL. + * + * @param string $uri + * @return string + */ + protected function prepareUrlForRequest($uri) + { + if (Str::startsWith($uri, '/')) { + $uri = substr($uri, 1); + } + + if (! Str::startsWith($uri, 'http')) { + $uri = $this->baseUrl.'/'.$uri; + } + + return trim($uri, '/'); + } + + /** + * Transform headers array to array of $_SERVER vars with HTTP_* format. + * + * @param array $headers + * @return array + */ + protected function transformHeadersToServerVars(array $headers) + { + $server = []; + $prefix = 'HTTP_'; + + foreach ($headers as $name => $value) { + $name = strtr(strtoupper($name), '-', '_'); + + if (! starts_with($name, $prefix) && $name != 'CONTENT_TYPE') { + $name = $prefix.$name; + } + + $server[$name] = $value; + } + + return $server; + } + + /** + * Dump the content from the last response. + * + * @return void + */ + public function dump() + { + $content = $this->response->getContent(); + + $json = json_decode($content); + + if (json_last_error() === JSON_ERROR_NONE) { + $content = $json; + } + + dd($content); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseMigrations.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseMigrations.php new file mode 100644 index 0000000..d53b34e --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseMigrations.php @@ -0,0 +1,18 @@ +artisan('migrate'); + + $this->beforeApplicationDestroyed(function () { + $this->artisan('migrate:rollback'); + }); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseTransactions.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseTransactions.php new file mode 100644 index 0000000..e580f5a --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseTransactions.php @@ -0,0 +1,18 @@ +app->make('db')->beginTransaction(); + + $this->beforeApplicationDestroyed(function () { + $this->app->make('db')->rollBack(); + }); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/HttpException.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/HttpException.php new file mode 100644 index 0000000..67d2b2f --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/HttpException.php @@ -0,0 +1,10 @@ +makeRequest('GET', $uri); + } + + /** + * Make a request to the application and create a Crawler instance. + * + * @param string $method + * @param string $uri + * @param array $parameters + * @param array $cookies + * @param array $files + * @return $this + */ + protected function makeRequest($method, $uri, $parameters = [], $cookies = [], $files = []) + { + $uri = $this->prepareUrlForRequest($uri); + + $this->call($method, $uri, $parameters, $cookies, $files); + + $this->clearInputs()->followRedirects()->assertPageLoaded($uri); + + $this->currentUri = $this->app->make('request')->fullUrl(); + + $this->crawler = new Crawler($this->response->getContent(), $this->currentUri); + + return $this; + } + + /** + * Make a request to the application using the given form. + * + * @param \Symfony\Component\DomCrawler\Form $form + * @param array $uploads + * @return $this + */ + protected function makeRequestUsingForm(Form $form, array $uploads = []) + { + $files = $this->convertUploadsForTesting($form, $uploads); + + return $this->makeRequest( + $form->getMethod(), $form->getUri(), $this->extractParametersFromForm($form), [], $files + ); + } + + /** + * Extract the parameters from the given form. + * + * @param \Symfony\Component\DomCrawler\Form $form + * @return array + */ + protected function extractParametersFromForm(Form $form) + { + parse_str(http_build_query($form->getValues()), $parameters); + + return $parameters; + } + + /** + * Follow redirects from the last response. + * + * @return $this + */ + protected function followRedirects() + { + while ($this->response->isRedirect()) { + $this->makeRequest('GET', $this->response->getTargetUrl()); + } + + return $this; + } + + /** + * Clear the inputs for the current page. + * + * @return $this + */ + protected function clearInputs() + { + $this->inputs = []; + + $this->uploads = []; + + return $this; + } + + /** + * Assert that the current page matches a given URI. + * + * @param string $uri + * @return $this + */ + protected function seePageIs($uri) + { + $this->assertPageLoaded($uri = $this->prepareUrlForRequest($uri)); + + $this->assertEquals( + $uri, $this->currentUri, "Did not land on expected page [{$uri}].\n" + ); + + return $this; + } + + /** + * Assert that a given page successfully loaded. + * + * @param string $uri + * @param string|null $message + * @return void + */ + protected function assertPageLoaded($uri, $message = null) + { + $status = $this->response->getStatusCode(); + + try { + $this->assertEquals(200, $status); + } catch (PHPUnitException $e) { + $message = $message ?: "A request to [{$uri}] failed. Received status code [{$status}]."; + + $responseException = isset($this->response->exception) + ? $this->response->exception : null; + + throw new HttpException($message, null, $responseException); + } + } + + /** + * Assert that a given string is seen on the page. + * + * @param string $text + * @param bool $negate + * @return $this + */ + protected function see($text, $negate = false) + { + $method = $negate ? 'assertNotRegExp' : 'assertRegExp'; + + $rawPattern = preg_quote($text, '/'); + + $escapedPattern = preg_quote(e($text), '/'); + + $pattern = $rawPattern == $escapedPattern + ? $rawPattern : "({$rawPattern}|{$escapedPattern})"; + + $this->$method("/$pattern/i", $this->response->getContent()); + + return $this; + } + + /** + * Assert that a given string is not seen on the page. + * + * @param string $text + * @return $this + */ + protected function dontSee($text) + { + return $this->see($text, true); + } + + /** + * Assert that a given string is seen inside an element. + * + * @param string $element + * @param string $text + * @param bool $negate + * @return $this + */ + public function seeInElement($element, $text, $negate = false) + { + if ($negate) { + return $this->dontSeeInElement($element, $text); + } + + $this->assertTrue( + $this->hasInElement($element, $text), + "Element [$element] should contain the expected text [{$text}]" + ); + + return $this; + } + + /** + * Assert that a given string is not seen inside an element. + * + * @param string $element + * @param string $text + * @return $this + */ + public function dontSeeInElement($element, $text) + { + $this->assertFalse( + $this->hasInElement($element, $text), + "Element [$element] should not contain the expected text [{$text}]" + ); + + return $this; + } + + /** + * Check if the page contains text within the given element. + * + * @param string $element + * @param string $text + * @return bool + */ + protected function hasInElement($element, $text) + { + $elements = $this->crawler->filter($element); + + $rawPattern = preg_quote($text, '/'); + + $escapedPattern = preg_quote(e($text), '/'); + + $pattern = $rawPattern == $escapedPattern + ? $rawPattern : "({$rawPattern}|{$escapedPattern})"; + + foreach ($elements as $element) { + $element = new Crawler($element); + + if (preg_match("/$pattern/i", $element->html())) { + return true; + } + } + + return false; + } + + /** + * Assert that a given link is seen on the page. + * + * @param string $text + * @param string|null $url + * @return $this + */ + public function seeLink($text, $url = null) + { + $message = "No links were found with expected text [{$text}]"; + + if ($url) { + $message .= " and URL [{$url}]"; + } + + $this->assertTrue($this->hasLink($text, $url), "{$message}."); + + return $this; + } + + /** + * Assert that a given link is not seen on the page. + * + * @param string $text + * @param string|null $url + * @return $this + */ + public function dontSeeLink($text, $url = null) + { + $message = "A link was found with expected text [{$text}]"; + + if ($url) { + $message .= " and URL [{$url}]"; + } + + $this->assertFalse($this->hasLink($text, $url), "{$message}."); + + return $this; + } + + /** + * Check if the page has a link with the given $text and optional $url. + * + * @param string $text + * @param string|null $url + * @return bool + */ + protected function hasLink($text, $url = null) + { + $links = $this->crawler->selectLink($text); + + if ($links->count() == 0) { + return false; + } + + // If the URL is null, we assume the developer only wants to find a link + // with the given text regardless of the URL. So, if we find the link + // we will return true now. Otherwise, we look for the given URL. + if ($url == null) { + return true; + } + + $url = $this->addRootToRelativeUrl($url); + + foreach ($links as $link) { + if ($link->getAttribute('href') == $url) { + return true; + } + } + + return false; + } + + /** + * Add a root if the URL is relative (helper method of the hasLink function). + * + * @param string $url + * @return string + */ + protected function addRootToRelativeUrl($url) + { + if (! Str::startsWith($url, ['http', 'https'])) { + return $this->app->make('url')->to($url); + } + + return $url; + } + + /** + * Assert that an input field contains the given value. + * + * @param string $selector + * @param string $expected + * @return $this + */ + public function seeInField($selector, $expected) + { + $this->assertSame( + $expected, $this->getInputOrTextAreaValue($selector), + "The field [{$selector}] does not contain the expected value [{$expected}]." + ); + + return $this; + } + + /** + * Assert that an input field does not contain the given value. + * + * @param string $selector + * @param string $value + * @return $this + */ + public function dontSeeInField($selector, $value) + { + $this->assertNotSame( + $this->getInputOrTextAreaValue($selector), $value, + "The input [{$selector}] should not contain the value [{$value}]." + ); + + return $this; + } + + /** + * Assert that the given checkbox is selected. + * + * @param string $selector + * @return $this + */ + public function seeIsChecked($selector) + { + $this->assertTrue( + $this->isChecked($selector), + "The checkbox [{$selector}] is not checked." + ); + + return $this; + } + + /** + * Assert that the given checkbox is not selected. + * + * @param string $selector + * @return $this + */ + public function dontSeeIsChecked($selector) + { + $this->assertFalse( + $this->isChecked($selector), + "The checkbox [{$selector}] is checked." + ); + + return $this; + } + + /** + * Assert that the expected value is selected. + * + * @param string $selector + * @param string $expected + * @return $this + */ + public function seeIsSelected($selector, $expected) + { + $this->assertEquals( + $expected, $this->getSelectedValue($selector), + "The field [{$selector}] does not contain the selected value [{$expected}]." + ); + + return $this; + } + + /** + * Assert that the given value is not selected. + * + * @param string $selector + * @param string $value + * @return $this + */ + public function dontSeeIsSelected($selector, $value) + { + $this->assertNotEquals( + $value, $this->getSelectedValue($selector), + "The field [{$selector}] contains the selected value [{$value}]." + ); + + return $this; + } + + /** + * Get the value of an input or textarea. + * + * @param string $selector + * @return string + * + * @throws \Exception + */ + protected function getInputOrTextAreaValue($selector) + { + $field = $this->filterByNameOrId($selector, ['input', 'textarea']); + + if ($field->count() == 0) { + throw new Exception("There are no elements with the name or ID [$selector]."); + } + + $element = $field->nodeName(); + + if ($element == 'input') { + return $field->attr('value'); + } + + if ($element == 'textarea') { + return $field->text(); + } + + throw new Exception("Given selector [$selector] is not an input or textarea."); + } + + /** + * Get the selected value of a select field or radio group. + * + * @param string $selector + * @return string|null + * + * @throws \Exception + */ + protected function getSelectedValue($selector) + { + $field = $this->filterByNameOrId($selector); + + if ($field->count() == 0) { + throw new Exception("There are no elements with the name or ID [$selector]."); + } + + $element = $field->nodeName(); + + if ($element == 'select') { + return $this->getSelectedValueFromSelect($field); + } + + if ($element == 'input') { + return $this->getCheckedValueFromRadioGroup($field); + } + + throw new Exception("Given selector [$selector] is not a select or radio group."); + } + + /** + * Get the selected value from a select field. + * + * @param \Symfony\Component\DomCrawler\Crawler $field + * @return string|null + * + * @throws \Exception + */ + protected function getSelectedValueFromSelect(Crawler $field) + { + if ($field->nodeName() !== 'select') { + throw new Exception('Given element is not a select element.'); + } + + foreach ($field->children() as $option) { + if ($option->hasAttribute('selected')) { + return $option->getAttribute('value'); + } + } + } + + /** + * Get the checked value from a radio group. + * + * @param \Symfony\Component\DomCrawler\Crawler $radioGroup + * @return string|null + * + * @throws \Exception + */ + protected function getCheckedValueFromRadioGroup(Crawler $radioGroup) + { + if ($radioGroup->nodeName() !== 'input' || $radioGroup->attr('type') !== 'radio') { + throw new Exception('Given element is not a radio button.'); + } + + foreach ($radioGroup as $radio) { + if ($radio->hasAttribute('checked')) { + return $radio->getAttribute('value'); + } + } + } + + /** + * Return true if the given checkbox is checked, false otherwise. + * + * @param string $selector + * @return bool + * + * @throws \Exception + */ + protected function isChecked($selector) + { + $checkbox = $this->filterByNameOrId($selector, "input[type='checkbox']"); + + if ($checkbox->count() == 0) { + throw new Exception("There are no checkbox elements with the name or ID [$selector]."); + } + + return $checkbox->attr('checked') !== null; + } + + /** + * Click a link with the given body, name, or ID attribute. + * + * @param string $name + * @return $this + */ + protected function click($name) + { + $link = $this->crawler->selectLink($name); + + if (! count($link)) { + $link = $this->filterByNameOrId($name, 'a'); + + if (! count($link)) { + throw new InvalidArgumentException( + "Could not find a link with a body, name, or ID attribute of [{$name}]." + ); + } + } + + $this->visit($link->link()->getUri()); + + return $this; + } + + /** + * Fill an input field with the given text. + * + * @param string $text + * @param string $element + * @return $this + */ + protected function type($text, $element) + { + return $this->storeInput($element, $text); + } + + /** + * Check a checkbox on the page. + * + * @param string $element + * @return $this + */ + protected function check($element) + { + return $this->storeInput($element, true); + } + + /** + * Uncheck a checkbox on the page. + * + * @param string $element + * @return $this + */ + protected function uncheck($element) + { + return $this->storeInput($element, false); + } + + /** + * Select an option from a drop-down. + * + * @param string $option + * @param string $element + * @return $this + */ + protected function select($option, $element) + { + return $this->storeInput($element, $option); + } + + /** + * Attach a file to a form field on the page. + * + * @param string $absolutePath + * @param string $element + * @return $this + */ + protected function attach($absolutePath, $element) + { + $this->uploads[$element] = $absolutePath; + + return $this->storeInput($element, $absolutePath); + } + + /** + * Submit a form using the button with the given text value. + * + * @param string $buttonText + * @return $this + */ + protected function press($buttonText) + { + return $this->submitForm($buttonText, $this->inputs, $this->uploads); + } + + /** + * Submit a form on the page with the given input. + * + * @param string $buttonText + * @param array $inputs + * @param array $uploads + * @return $this + */ + protected function submitForm($buttonText, $inputs = [], $uploads = []) + { + $this->makeRequestUsingForm($this->fillForm($buttonText, $inputs), $uploads); + + return $this; + } + + /** + * Fill the form with the given data. + * + * @param string $buttonText + * @param array $inputs + * @return \Symfony\Component\DomCrawler\Form + */ + protected function fillForm($buttonText, $inputs = []) + { + if (! is_string($buttonText)) { + $inputs = $buttonText; + + $buttonText = null; + } + + return $this->getForm($buttonText)->setValues($inputs); + } + + /** + * Get the form from the page with the given submit button text. + * + * @param string|null $buttonText + * @return \Symfony\Component\DomCrawler\Form + */ + protected function getForm($buttonText = null) + { + try { + if ($buttonText) { + return $this->crawler->selectButton($buttonText)->form(); + } + + return $this->crawler->filter('form')->form(); + } catch (InvalidArgumentException $e) { + throw new InvalidArgumentException( + "Could not find a form that has submit button [{$buttonText}]." + ); + } + } + + /** + * Store a form input in the local array. + * + * @param string $element + * @param string $text + * @return $this + */ + protected function storeInput($element, $text) + { + $this->assertFilterProducesResults($element); + + $element = str_replace('#', '', $element); + + $this->inputs[$element] = $text; + + return $this; + } + + /** + * Assert that a filtered Crawler returns nodes. + * + * @param string $filter + * @return void + */ + protected function assertFilterProducesResults($filter) + { + $crawler = $this->filterByNameOrId($filter); + + if (! count($crawler)) { + throw new InvalidArgumentException( + "Nothing matched the filter [{$filter}] CSS query provided for [{$this->currentUri}]." + ); + } + } + + /** + * Filter elements according to the given name or ID attribute. + * + * @param string $name + * @param array|string $elements + * @return \Symfony\Component\DomCrawler\Crawler + */ + protected function filterByNameOrId($name, $elements = '*') + { + $name = str_replace('#', '', $name); + + $id = str_replace(['[', ']'], ['\\[', '\\]'], $name); + + $elements = is_array($elements) ? $elements : [$elements]; + + array_walk($elements, function (&$element) use ($name, $id) { + $element = "{$element}#{$id}, {$element}[name='{$name}']"; + }); + + return $this->crawler->filter(implode(', ', $elements)); + } + + /** + * Convert the given uploads to UploadedFile instances. + * + * @param \Symfony\Component\DomCrawler\Form $form + * @param array $uploads + * @return array + */ + protected function convertUploadsForTesting(Form $form, array $uploads) + { + $files = $form->getFiles(); + + $names = array_keys($files); + + $files = array_map(function (array $file, $name) use ($uploads) { + return isset($uploads[$name]) + ? $this->getUploadedFileForTesting($file, $uploads, $name) + : $file; + }, $files, $names); + + return array_combine($names, $files); + } + + /** + * Create an UploadedFile instance for testing. + * + * @param array $file + * @param array $uploads + * @param string $name + * @return \Symfony\Component\HttpFoundation\File\UploadedFile + */ + protected function getUploadedFileForTesting($file, $uploads, $name) + { + return new UploadedFile( + $file['tmp_name'], basename($uploads[$name]), $file['type'], $file['size'], $file['error'], true + ); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php index 910ae9b..ffbbfae 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php @@ -1,44 +1,76 @@ -app) - { - $this->refreshApplication(); - } - } - - /** - * Clean up the testing environment before the next test. - * - * @return void - */ - public function tearDown() - { - if ($this->app) - { - $this->app->flush(); - } - } +abstract class TestCase extends PHPUnit_Framework_TestCase +{ + use ApplicationTrait, AssertionsTrait, CrawlerTrait; + + /** + * The callbacks that should be run before the application is destroyed. + * + * @var array + */ + protected $beforeApplicationDestroyedCallbacks = []; + + /** + * Creates the application. + * + * Needs to be implemented by subclasses. + * + * @return \Symfony\Component\HttpKernel\HttpKernelInterface + */ + abstract public function createApplication(); + + /** + * Setup the test environment. + * + * @return void + */ + public function setUp() + { + if (! $this->app) { + $this->refreshApplication(); + } + } + + /** + * Clean up the testing environment before the next test. + * + * @return void + */ + public function tearDown() + { + if ($this->app) { + foreach ($this->beforeApplicationDestroyedCallbacks as $callback) { + call_user_func($callback); + } + + $this->app->flush(); + + $this->app = null; + } + + if (property_exists($this, 'serverVariables')) { + $this->serverVariables = []; + } + + if (class_exists('Mockery')) { + Mockery::close(); + } + } + /** + * Register a callback to be run before the application is destroyed. + * + * @param callable $callback + * @return void + */ + protected function beforeApplicationDestroyed(callable $callback) + { + $this->beforeApplicationDestroyedCallbacks[] = $callback; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutEvents.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutEvents.php new file mode 100644 index 0000000..80bf471 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutEvents.php @@ -0,0 +1,20 @@ +withoutEvents(); + } else { + throw new Exception('Unable to disable middleware. ApplicationTrait not used.'); + } + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutMiddleware.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutMiddleware.php new file mode 100644 index 0000000..91d1bf5 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutMiddleware.php @@ -0,0 +1,20 @@ +withoutMiddleware(); + } else { + throw new Exception('Unable to disable middleware. CrawlerTrait not used.'); + } + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php index 372a000..c3f896b 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php @@ -1,102 +1,150 @@ -getValidationFactory()->make($request->all(), $rules, $messages); - - if ($validator->fails()) - { - $this->throwValidationException($request, $validator); - } - } - - /** - * Throw the failed validation exception. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Contracts\Validation\Validator $validator - * @return void - */ - protected function throwValidationException(Request $request, $validator) - { - throw new HttpResponseException($this->buildFailedValidationResponse( - $request, $this->formatValidationErrors($validator) - )); - } - - /** - * Create the response for when a request fails validation. - * - * @param \Illuminate\Http\Request $request - * @param array $errors - * @return \Illuminate\Http\Response - */ - protected function buildFailedValidationResponse(Request $request, array $errors) - { - if ($request->ajax() || $request->wantsJson()) - { - return new JsonResponse($errors, 422); - } - - return redirect()->to($this->getRedirectUrl()) - ->withInput($request->input()) - ->withErrors($errors, $this->errorBag()); - } - - /** - * Format the validation errors to be returned. - * - * @param \Illuminate\Validation\Validator $validator - * @return array - */ - protected function formatValidationErrors(Validator $validator) - { - return $validator->errors()->getMessages(); - } - - /** - * Get the URL we should redirect to. - * - * @return string - */ - protected function getRedirectUrl() - { - return app('Illuminate\Routing\UrlGenerator')->previous(); - } - - /** - * Get a validation factory instance. - * - * @return \Illuminate\Contracts\Validation\Factory - */ - protected function getValidationFactory() - { - return app('Illuminate\Contracts\Validation\Factory'); - } - - /** - * Get the key to be used for the view error bag. - * - * @return string - */ - protected function errorBag() - { - return 'default'; - } +trait ValidatesRequests +{ + /** + * The default error bag. + * + * @var string + */ + protected $validatesRequestErrorBag; + + /** + * Validate the given request with the given rules. + * + * @param \Illuminate\Http\Request $request + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return void + * + * @throws \Illuminate\Http\Exception\HttpResponseException + */ + public function validate(Request $request, array $rules, array $messages = [], array $customAttributes = []) + { + $validator = $this->getValidationFactory()->make($request->all(), $rules, $messages, $customAttributes); + + if ($validator->fails()) { + $this->throwValidationException($request, $validator); + } + } + + /** + * Validate the given request with the given rules. + * + * @param string $errorBag + * @param \Illuminate\Http\Request $request + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return void + * + * @throws \Illuminate\Http\Exception\HttpResponseException + */ + public function validateWithBag($errorBag, Request $request, array $rules, array $messages = [], array $customAttributes = []) + { + $this->withErrorBag($errorBag, function () use ($request, $rules, $messages, $customAttributes) { + $this->validate($request, $rules, $messages, $customAttributes); + }); + } + + /** + * Throw the failed validation exception. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Contracts\Validation\Validator $validator + * @return void + * + * @throws \Illuminate\Http\Exception\HttpResponseException + */ + protected function throwValidationException(Request $request, $validator) + { + throw new HttpResponseException($this->buildFailedValidationResponse( + $request, $this->formatValidationErrors($validator) + )); + } + + /** + * Create the response for when a request fails validation. + * + * @param \Illuminate\Http\Request $request + * @param array $errors + * @return \Illuminate\Http\Response + */ + protected function buildFailedValidationResponse(Request $request, array $errors) + { + if ($request->ajax() || $request->wantsJson()) { + return new JsonResponse($errors, 422); + } + + return redirect()->to($this->getRedirectUrl()) + ->withInput($request->input()) + ->withErrors($errors, $this->errorBag()); + } + + /** + * Format the validation errors to be returned. + * + * @param \Illuminate\Contracts\Validation\Validator $validator + * @return array + */ + protected function formatValidationErrors(Validator $validator) + { + return $validator->errors()->getMessages(); + } + + /** + * Get the URL we should redirect to. + * + * @return string + */ + protected function getRedirectUrl() + { + return app(UrlGenerator::class)->previous(); + } + + /** + * Get a validation factory instance. + * + * @return \Illuminate\Contracts\Validation\Factory + */ + protected function getValidationFactory() + { + return app(Factory::class); + } + + /** + * Execute a Closure within with a given error bag set as the default bag. + * + * @param string $errorBag + * @param callable $callback + * @return void + */ + protected function withErrorBag($errorBag, callable $callback) + { + $this->validatesRequestErrorBag = $errorBag; + + call_user_func($callback); + + $this->validatesRequestErrorBag = null; + } + /** + * Get the key to be used for the view error bag. + * + * @return string + */ + protected function errorBag() + { + return $this->validatesRequestErrorBag ?: 'default'; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php b/application/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php index 2f4e896..fa19a77 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php +++ b/application/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php @@ -1,679 +1,750 @@ abort($code, $message, $headers); - } -} - -if ( ! function_exists('action')) -{ - /** - * Generate a URL to a controller action. - * - * @param string $name - * @param array $parameters - * @param bool $absolute - * @return string - */ - function action($name, $parameters = array(), $absolute = true) - { - return app('url')->action($name, $parameters, $absolute); - } -} - -if ( ! function_exists('app')) -{ - /** - * Get the available container instance. - * - * @param string $make - * @param array $parameters - * @return mixed|\Illuminate\Foundation\Application - */ - function app($make = null, $parameters = []) - { - if (is_null($make)) return Container::getInstance(); - - return Container::getInstance()->make($make, $parameters); - } -} - -if ( ! function_exists('app_path')) -{ - /** - * Get the path to the application folder. - * - * @param string $path - * @return string - */ - function app_path($path = '') - { - return app('path').($path ? '/'.$path : $path); - } -} - -if ( ! function_exists('asset')) -{ - /** - * Generate an asset path for the application. - * - * @param string $path - * @param bool $secure - * @return string - */ - function asset($path, $secure = null) - { - return app('url')->asset($path, $secure); - } -} - -if ( ! function_exists('auth')) -{ - /** - * Get the available auth instance. - * - * @return \Illuminate\Contracts\Auth\Guard - */ - function auth() - { - return app('Illuminate\Contracts\Auth\Guard'); - } -} - -if ( ! function_exists('base_path')) -{ - /** - * Get the path to the base of the install. - * - * @param string $path - * @return string - */ - function base_path($path = '') - { - return app()->basePath().($path ? '/'.$path : $path); - } -} - -if ( ! function_exists('back')) -{ - /** - * Create a new redirect response to the previous location. - * - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - function back($status = 302, $headers = array()) - { - return app('redirect')->back($status, $headers); - } -} - -if ( ! function_exists('bcrypt')) -{ - /** - * Hash the given value. - * - * @param string $value - * @param array $options - * @return string - */ - function bcrypt($value, $options = array()) - { - return app('hash')->make($value, $options); - } -} - -if ( ! function_exists('config')) -{ - /** - * Get / set the specified configuration value. - * - * If an array is passed as the key, we will assume you want to set an array of values. - * - * @param array|string $key - * @param mixed $default - * @return mixed - */ - function config($key = null, $default = null) - { - if (is_null($key)) return app('config'); - - if (is_array($key)) - { - return app('config')->set($key); - } - - return app('config')->get($key, $default); - } -} - -if ( ! function_exists('config_path')) -{ - /** - * Get the configuration path. - * - * @param string $path - * @return string - */ - function config_path($path = '') - { - return app()->make('path.config').($path ? '/'.$path : $path); - } -} - -if ( ! function_exists('cookie')) -{ - /** - * Create a new cookie instance. - * - * @param string $name - * @param string $value - * @param int $minutes - * @param string $path - * @param string $domain - * @param bool $secure - * @param bool $httpOnly - * @return \Symfony\Component\HttpFoundation\Cookie - */ - function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true) - { - $cookie = app('Illuminate\Contracts\Cookie\Factory'); - - if (is_null($name)) - { - return $cookie; - } - - return $cookie->make($name, $value, $minutes, $path, $domain, $secure, $httpOnly); - } -} - -if ( ! function_exists('csrf_token')) -{ - /** - * Get the CSRF token value. - * - * @return string - * - * @throws RuntimeException - */ - function csrf_token() - { - $session = app('session'); - - if (isset($session)) - { - return $session->getToken(); - } - - throw new RuntimeException("Application session store not set."); - } -} - -if ( ! function_exists('database_path')) -{ - /** - * Get the database path. - * - * @param string $path - * @return string - */ - function database_path($path = '') - { - return app()->databasePath().($path ? '/'.$path : $path); - } -} - -if ( ! function_exists('delete')) -{ - /** - * Register a new DELETE route with the router. - * - * @param string $uri - * @param \Closure|array|string $action - * @return \Illuminate\Routing\Route - */ - function delete($uri, $action) - { - return app('router')->delete($uri, $action); - } -} - -if ( ! function_exists('get')) -{ - /** - * Register a new GET route with the router. - * - * @param string $uri - * @param \Closure|array|string $action - * @return \Illuminate\Routing\Route - */ - function get($uri, $action) - { - return app('router')->get($uri, $action); - } -} - -if ( ! function_exists('info')) -{ - /** - * Write some information to the log. - * - * @param string $message - * @param array $context - * @return void - */ - function info($message, $context = array()) - { - return app('log')->info($message, $context); - } -} - -if ( ! function_exists('logger')) -{ - /** - * Log a debug message to the logs. - * - * @param string $message - * @param array $context - * @return null|\Illuminate\Contracts\Logging\Log - */ - function logger($message = null, array $context = array()) - { - if (is_null($message)) return app('log'); - - return app('log')->debug($message, $context); - } -} - -if ( ! function_exists('old')) -{ - /** - * Retrieve an old input item. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - function old($key = null, $default = null) - { - return app('request')->old($key, $default); - } -} - -if ( ! function_exists('patch')) -{ - /** - * Register a new PATCH route with the router. - * - * @param string $uri - * @param \Closure|array|string $action - * @return \Illuminate\Routing\Route - */ - function patch($uri, $action) - { - return app('router')->patch($uri, $action); - } -} - -if ( ! function_exists('post')) -{ - /** - * Register a new POST route with the router. - * - * @param string $uri - * @param \Closure|array|string $action - * @return \Illuminate\Routing\Route - */ - function post($uri, $action) - { - return app('router')->post($uri, $action); - } -} - -if ( ! function_exists('put')) -{ - /** - * Register a new PUT route with the router. - * - * @param string $uri - * @param \Closure|array|string $action - * @return \Illuminate\Routing\Route - */ - function put($uri, $action) - { - return app('router')->put($uri, $action); - } -} - -if ( ! function_exists('public_path')) -{ - /** - * Get the path to the public folder. - * - * @param string $path - * @return string - */ - function public_path($path = '') - { - return app()->make('path.public').($path ? '/'.$path : $path); - } -} - -if ( ! function_exists('redirect')) -{ - /** - * Get an instance of the redirector. - * - * @param string|null $to - * @param int $status - * @param array $headers - * @param bool $secure - * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse - */ - function redirect($to = null, $status = 302, $headers = array(), $secure = null) - { - if (is_null($to)) return app('redirect'); - - return app('redirect')->to($to, $status, $headers, $secure); - } -} - -if ( ! function_exists('resource')) -{ - /** - * Route a resource to a controller. - * - * @param string $name - * @param string $controller - * @param array $options - * @return void - */ - function resource($name, $controller, array $options = []) - { - return app('router')->resource($name, $controller, $options); - } -} - -if ( ! function_exists('response')) -{ - /** - * Return a new response from the application. - * - * @param string $content - * @param int $status - * @param array $headers - * @return \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Routing\ResponseFactory - */ - function response($content = '', $status = 200, array $headers = array()) - { - $factory = app('Illuminate\Contracts\Routing\ResponseFactory'); - - if (func_num_args() === 0) - { - return $factory; - } - - return $factory->make($content, $status, $headers); - } -} - -if ( ! function_exists('route')) -{ - /** - * Generate a URL to a named route. - * - * @param string $name - * @param array $parameters - * @param bool $absolute - * @param \Illuminate\Routing\Route $route - * @return string - */ - function route($name, $parameters = array(), $absolute = true, $route = null) - { - return app('url')->route($name, $parameters, $absolute, $route); - } -} - -if ( ! function_exists('secure_asset')) -{ - /** - * Generate an asset path for the application. - * - * @param string $path - * @return string - */ - function secure_asset($path) - { - return asset($path, true); - } -} - -if ( ! function_exists('secure_url')) -{ - /** - * Generate a HTTPS url for the application. - * - * @param string $path - * @param mixed $parameters - * @return string - */ - function secure_url($path, $parameters = array()) - { - return url($path, $parameters, true); - } -} - -if ( ! function_exists('session')) -{ - /** - * Get / set the specified session value. - * - * If an array is passed as the key, we will assume you want to set an array of values. - * - * @param array|string $key - * @param mixed $default - * @return mixed - */ - function session($key = null, $default = null) - { - if (is_null($key)) return app('session'); - - if (is_array($key)) return app('session')->put($key); - - return app('session')->get($key, $default); - } -} - -if ( ! function_exists('storage_path')) -{ - /** - * Get the path to the storage folder. - * - * @param string $path - * @return string - */ - function storage_path($path = '') - { - return app('path.storage').($path ? '/'.$path : $path); - } -} - -if ( ! function_exists('trans')) -{ - /** - * Translate the given message. - * - * @param string $id - * @param array $parameters - * @param string $domain - * @param string $locale - * @return string - */ - function trans($id = null, $parameters = array(), $domain = 'messages', $locale = null) - { - if (is_null($id)) return app('translator'); - - return app('translator')->trans($id, $parameters, $domain, $locale); - } -} - -if ( ! function_exists('trans_choice')) -{ - /** - * Translates the given message based on a count. - * - * @param string $id - * @param int $number - * @param array $parameters - * @param string $domain - * @param string $locale - * @return string - */ - function trans_choice($id, $number, array $parameters = array(), $domain = 'messages', $locale = null) - { - return app('translator')->transChoice($id, $number, $parameters, $domain, $locale); - } -} - -if ( ! function_exists('url')) -{ - /** - * Generate a url for the application. - * - * @param string $path - * @param mixed $parameters - * @param bool $secure - * @return string - */ - function url($path = null, $parameters = array(), $secure = null) - { - return app('Illuminate\Contracts\Routing\UrlGenerator')->to($path, $parameters, $secure); - } -} - -if ( ! function_exists('view')) -{ - /** - * Get the evaluated view contents for the given view. - * - * @param string $view - * @param array $data - * @param array $mergeData - * @return \Illuminate\View\View - */ - function view($view = null, $data = array(), $mergeData = array()) - { - $factory = app('Illuminate\Contracts\View\Factory'); - - if (func_num_args() === 0) - { - return $factory; - } - - return $factory->make($view, $data, $mergeData); - } -} - -if ( ! function_exists('env')) -{ - /** - * Gets the value of an environment variable. Supports boolean, empty and null. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - function env($key, $default = null) - { - $value = getenv($key); - - if ($value === false) return value($default); - - switch (strtolower($value)) - { - case 'true': - case '(true)': - return true; - - case 'false': - case '(false)': - return false; - - case 'empty': - case '(empty)': - return ''; - - case 'null': - case '(null)': - return; - } - - if (Str::startsWith($value, '"') && Str::endsWith($value, '"')) - { - return substr($value, 1, -1); - } - - return $value; - } -} - -if ( ! function_exists('event')) -{ - /** - * Fire an event and call the listeners. - * - * @param string $event - * @param mixed $payload - * @param bool $halt - * @return array|null - */ - function event($event, $payload = array(), $halt = false) - { - return app('events')->fire($event, $payload, $halt); - } -} - -if ( ! function_exists('elixir')) -{ - /** - * Get the path to a versioned Elixir file. - * - * @param string $file - * @return string - */ - function elixir($file) - { - static $manifest = null; - - if (is_null($manifest)) - { - $manifest = json_decode(file_get_contents(public_path().'/build/rev-manifest.json'), true); - } - - if (isset($manifest[$file])) - { - return '/build/'.$manifest[$file]; - } - - throw new InvalidArgumentException("File {$file} not defined in asset manifest."); - } +use Illuminate\Contracts\Auth\Guard; +use Illuminate\Contracts\Bus\Dispatcher; +use Illuminate\Contracts\Auth\Access\Gate; +use Illuminate\Contracts\Routing\UrlGenerator; +use Illuminate\Contracts\Routing\ResponseFactory; +use Illuminate\Contracts\View\Factory as ViewFactory; +use Illuminate\Contracts\Cookie\Factory as CookieFactory; +use Illuminate\Database\Eloquent\Factory as EloquentFactory; + +if (! function_exists('abort')) { + /** + * Throw an HttpException with the given data. + * + * @param int $code + * @param string $message + * @param array $headers + * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + function abort($code, $message = '', array $headers = []) + { + return app()->abort($code, $message, $headers); + } +} + +if (! function_exists('action')) { + /** + * Generate a URL to a controller action. + * + * @param string $name + * @param array $parameters + * @param bool $absolute + * @return string + */ + function action($name, $parameters = [], $absolute = true) + { + return app('url')->action($name, $parameters, $absolute); + } +} + +if (! function_exists('app')) { + /** + * Get the available container instance. + * + * @param string $make + * @param array $parameters + * @return mixed|\Illuminate\Foundation\Application + */ + function app($make = null, $parameters = []) + { + if (is_null($make)) { + return Container::getInstance(); + } + + return Container::getInstance()->make($make, $parameters); + } +} + +if (! function_exists('app_path')) { + /** + * Get the path to the application folder. + * + * @param string $path + * @return string + */ + function app_path($path = '') + { + return app('path').($path ? DIRECTORY_SEPARATOR.$path : $path); + } +} + +if (! function_exists('asset')) { + /** + * Generate an asset path for the application. + * + * @param string $path + * @param bool $secure + * @return string + */ + function asset($path, $secure = null) + { + return app('url')->asset($path, $secure); + } +} + +if (! function_exists('auth')) { + /** + * Get the available auth instance. + * + * @return \Illuminate\Contracts\Auth\Guard + */ + function auth() + { + return app(Guard::class); + } +} + +if (! function_exists('back')) { + /** + * Create a new redirect response to the previous location. + * + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + function back($status = 302, $headers = []) + { + return app('redirect')->back($status, $headers); + } +} + +if (! function_exists('base_path')) { + /** + * Get the path to the base of the install. + * + * @param string $path + * @return string + */ + function base_path($path = '') + { + return app()->basePath().($path ? DIRECTORY_SEPARATOR.$path : $path); + } +} + +if (! function_exists('bcrypt')) { + /** + * Hash the given value. + * + * @param string $value + * @param array $options + * @return string + */ + function bcrypt($value, $options = []) + { + return app('hash')->make($value, $options); + } +} + +if (! function_exists('config')) { + /** + * Get / set the specified configuration value. + * + * If an array is passed as the key, we will assume you want to set an array of values. + * + * @param array|string $key + * @param mixed $default + * @return mixed + */ + function config($key = null, $default = null) + { + if (is_null($key)) { + return app('config'); + } + + if (is_array($key)) { + return app('config')->set($key); + } + + return app('config')->get($key, $default); + } +} + +if (! function_exists('config_path')) { + /** + * Get the configuration path. + * + * @param string $path + * @return string + */ + function config_path($path = '') + { + return app()->make('path.config').($path ? DIRECTORY_SEPARATOR.$path : $path); + } +} + +if (! function_exists('cookie')) { + /** + * Create a new cookie instance. + * + * @param string $name + * @param string $value + * @param int $minutes + * @param string $path + * @param string $domain + * @param bool $secure + * @param bool $httpOnly + * @return \Symfony\Component\HttpFoundation\Cookie + */ + function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true) + { + $cookie = app(CookieFactory::class); + + if (is_null($name)) { + return $cookie; + } + + return $cookie->make($name, $value, $minutes, $path, $domain, $secure, $httpOnly); + } +} + +if (! function_exists('csrf_field')) { + /** + * Generate a CSRF token form field. + * + * @return string + */ + function csrf_field() + { + return new Expression(''); + } +} + +if (! function_exists('csrf_token')) { + /** + * Get the CSRF token value. + * + * @return string + * + * @throws RuntimeException + */ + function csrf_token() + { + $session = app('session'); + + if (isset($session)) { + return $session->getToken(); + } + + throw new RuntimeException('Application session store not set.'); + } +} + +if (! function_exists('database_path')) { + /** + * Get the database path. + * + * @param string $path + * @return string + */ + function database_path($path = '') + { + return app()->databasePath().($path ? DIRECTORY_SEPARATOR.$path : $path); + } +} + +if (! function_exists('delete')) { + /** + * Register a new DELETE route with the router. + * + * @param string $uri + * @param \Closure|array|string $action + * @return \Illuminate\Routing\Route + */ + function delete($uri, $action) + { + return app('router')->delete($uri, $action); + } +} + +if (! function_exists('dispatch')) { + /** + * Dispatch a job to its appropriate handler. + * + * @param mixed $job + * @return mixed + */ + function dispatch($job) + { + return app(Dispatcher::class)->dispatch($job); + } +} + +if (! function_exists('elixir')) { + /** + * Get the path to a versioned Elixir file. + * + * @param string $file + * @return string + * + * @throws \InvalidArgumentException + */ + function elixir($file) + { + static $manifest = null; + + if (is_null($manifest)) { + $manifest = json_decode(file_get_contents(public_path('build/rev-manifest.json')), true); + } + + if (isset($manifest[$file])) { + return '/build/'.$manifest[$file]; + } + + throw new InvalidArgumentException("File {$file} not defined in asset manifest."); + } +} + +if (! function_exists('env')) { + /** + * Gets the value of an environment variable. Supports boolean, empty and null. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + function env($key, $default = null) + { + $value = getenv($key); + + if ($value === false) { + return value($default); + } + + switch (strtolower($value)) { + case 'true': + case '(true)': + return true; + case 'false': + case '(false)': + return false; + case 'empty': + case '(empty)': + return ''; + case 'null': + case '(null)': + return; + } + + if (strlen($value) > 1 && Str::startsWith($value, '"') && Str::endsWith($value, '"')) { + return substr($value, 1, -1); + } + + return $value; + } +} + +if (! function_exists('event')) { + /** + * Fire an event and call the listeners. + * + * @param string|object $event + * @param mixed $payload + * @param bool $halt + * @return array|null + */ + function event($event, $payload = [], $halt = false) + { + return app('events')->fire($event, $payload, $halt); + } +} + +if (! function_exists('factory')) { + /** + * Create a model factory builder for a given class, name, and amount. + * + * @param dynamic class|class,name|class,amount|class,name,amount + * @return \Illuminate\Database\Eloquent\FactoryBuilder + */ + function factory() + { + $factory = app(EloquentFactory::class); + + $arguments = func_get_args(); + + if (isset($arguments[1]) && is_string($arguments[1])) { + return $factory->of($arguments[0], $arguments[1])->times(isset($arguments[2]) ? $arguments[2] : 1); + } elseif (isset($arguments[1])) { + return $factory->of($arguments[0])->times($arguments[1]); + } else { + return $factory->of($arguments[0]); + } + } +} + +if (! function_exists('get')) { + /** + * Register a new GET route with the router. + * + * @param string $uri + * @param \Closure|array|string $action + * @return \Illuminate\Routing\Route + */ + function get($uri, $action) + { + return app('router')->get($uri, $action); + } +} + +if (! function_exists('info')) { + /** + * Write some information to the log. + * + * @param string $message + * @param array $context + * @return void + */ + function info($message, $context = []) + { + return app('log')->info($message, $context); + } +} + +if (! function_exists('logger')) { + /** + * Log a debug message to the logs. + * + * @param string $message + * @param array $context + * @return null|\Illuminate\Contracts\Logging\Log + */ + function logger($message = null, array $context = []) + { + if (is_null($message)) { + return app('log'); + } + + return app('log')->debug($message, $context); + } +} + +if (! function_exists('method_field')) { + /** + * Generate a form field to spoof the HTTP verb used by forms. + * + * @param string $method + * @return string + */ + function method_field($method) + { + return new Expression(''); + } +} + +if (! function_exists('old')) { + /** + * Retrieve an old input item. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + function old($key = null, $default = null) + { + return app('request')->old($key, $default); + } +} + +if (! function_exists('patch')) { + /** + * Register a new PATCH route with the router. + * + * @param string $uri + * @param \Closure|array|string $action + * @return \Illuminate\Routing\Route + */ + function patch($uri, $action) + { + return app('router')->patch($uri, $action); + } +} + +if (! function_exists('policy')) { + /** + * Get a policy instance for a given class. + * + * @param object|string $class + * @return mixed + * + * @throws \InvalidArgumentException + */ + function policy($class) + { + return app(Gate::class)->getPolicyFor($class); + } +} + +if (! function_exists('post')) { + /** + * Register a new POST route with the router. + * + * @param string $uri + * @param \Closure|array|string $action + * @return \Illuminate\Routing\Route + */ + function post($uri, $action) + { + return app('router')->post($uri, $action); + } +} + +if (! function_exists('public_path')) { + /** + * Get the path to the public folder. + * + * @param string $path + * @return string + */ + function public_path($path = '') + { + return app()->make('path.public').($path ? DIRECTORY_SEPARATOR.$path : $path); + } +} + +if (! function_exists('put')) { + /** + * Register a new PUT route with the router. + * + * @param string $uri + * @param \Closure|array|string $action + * @return \Illuminate\Routing\Route + */ + function put($uri, $action) + { + return app('router')->put($uri, $action); + } +} + +if (! function_exists('redirect')) { + /** + * Get an instance of the redirector. + * + * @param string|null $to + * @param int $status + * @param array $headers + * @param bool $secure + * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse + */ + function redirect($to = null, $status = 302, $headers = [], $secure = null) + { + if (is_null($to)) { + return app('redirect'); + } + + return app('redirect')->to($to, $status, $headers, $secure); + } +} + +if (! function_exists('request')) { + /** + * Get an instance of the current request or an input item from the request. + * + * @param string $key + * @param mixed $default + * @return \Illuminate\Http\Request|string|array + */ + function request($key = null, $default = null) + { + if (is_null($key)) { + return app('request'); + } + + return app('request')->input($key, $default); + } +} + +if (! function_exists('resource')) { + /** + * Route a resource to a controller. + * + * @param string $name + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + function resource($name, $controller, array $options = []) + { + return app('router')->resource($name, $controller, $options); + } +} + +if (! function_exists('response')) { + /** + * Return a new response from the application. + * + * @param string $content + * @param int $status + * @param array $headers + * @return \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Routing\ResponseFactory + */ + function response($content = '', $status = 200, array $headers = []) + { + $factory = app(ResponseFactory::class); + + if (func_num_args() === 0) { + return $factory; + } + + return $factory->make($content, $status, $headers); + } +} + +if (! function_exists('route')) { + /** + * Generate a URL to a named route. + * + * @param string $name + * @param array $parameters + * @param bool $absolute + * @param \Illuminate\Routing\Route $route + * @return string + */ + function route($name, $parameters = [], $absolute = true, $route = null) + { + return app('url')->route($name, $parameters, $absolute, $route); + } +} + +if (! function_exists('secure_asset')) { + /** + * Generate an asset path for the application. + * + * @param string $path + * @return string + */ + function secure_asset($path) + { + return asset($path, true); + } +} + +if (! function_exists('secure_url')) { + /** + * Generate a HTTPS url for the application. + * + * @param string $path + * @param mixed $parameters + * @return string + */ + function secure_url($path, $parameters = []) + { + return url($path, $parameters, true); + } +} + +if (! function_exists('session')) { + /** + * Get / set the specified session value. + * + * If an array is passed as the key, we will assume you want to set an array of values. + * + * @param array|string $key + * @param mixed $default + * @return mixed + */ + function session($key = null, $default = null) + { + if (is_null($key)) { + return app('session'); + } + + if (is_array($key)) { + return app('session')->put($key); + } + + return app('session')->get($key, $default); + } +} + +if (! function_exists('storage_path')) { + /** + * Get the path to the storage folder. + * + * @param string $path + * @return string + */ + function storage_path($path = '') + { + return app('path.storage').($path ? DIRECTORY_SEPARATOR.$path : $path); + } +} + +if (! function_exists('trans')) { + /** + * Translate the given message. + * + * @param string $id + * @param array $parameters + * @param string $domain + * @param string $locale + * @return string + */ + function trans($id = null, $parameters = [], $domain = 'messages', $locale = null) + { + if (is_null($id)) { + return app('translator'); + } + + return app('translator')->trans($id, $parameters, $domain, $locale); + } +} + +if (! function_exists('trans_choice')) { + /** + * Translates the given message based on a count. + * + * @param string $id + * @param int $number + * @param array $parameters + * @param string $domain + * @param string $locale + * @return string + */ + function trans_choice($id, $number, array $parameters = [], $domain = 'messages', $locale = null) + { + return app('translator')->transChoice($id, $number, $parameters, $domain, $locale); + } +} + +if (! function_exists('url')) { + /** + * Generate a url for the application. + * + * @param string $path + * @param mixed $parameters + * @param bool $secure + * @return string + */ + function url($path = null, $parameters = [], $secure = null) + { + return app(UrlGenerator::class)->to($path, $parameters, $secure); + } +} + +if (! function_exists('view')) { + /** + * Get the evaluated view contents for the given view. + * + * @param string $view + * @param array $data + * @param array $mergeData + * @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory + */ + function view($view = null, $data = [], $mergeData = []) + { + $factory = app(ViewFactory::class); + + if (func_num_args() === 0) { + return $factory; + } + + return $factory->make($view, $data, $mergeData); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php b/application/vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php index 2d38757..39acc88 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php +++ b/application/vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php @@ -1,78 +1,82 @@ -rounds; + /** + * Hash the given value. + * + * @param string $value + * @param array $options + * @return string + * + * @throws \RuntimeException + */ + public function make($value, array $options = []) + { + $cost = isset($options['rounds']) ? $options['rounds'] : $this->rounds; - $hash = password_hash($value, PASSWORD_BCRYPT, array('cost' => $cost)); + $hash = password_hash($value, PASSWORD_BCRYPT, ['cost' => $cost]); - if ($hash === false) - { - throw new RuntimeException("Bcrypt hashing not supported."); - } + if ($hash === false) { + throw new RuntimeException('Bcrypt hashing not supported.'); + } - return $hash; - } + return $hash; + } - /** - * Check the given plain value against a hash. - * - * @param string $value - * @param string $hashedValue - * @param array $options - * @return bool - */ - public function check($value, $hashedValue, array $options = array()) - { - return password_verify($value, $hashedValue); - } + /** + * Check the given plain value against a hash. + * + * @param string $value + * @param string $hashedValue + * @param array $options + * @return bool + */ + public function check($value, $hashedValue, array $options = []) + { + if (strlen($hashedValue) === 0) { + return false; + } - /** - * Check if the given hash has been hashed using the given options. - * - * @param string $hashedValue - * @param array $options - * @return bool - */ - public function needsRehash($hashedValue, array $options = array()) - { - $cost = isset($options['rounds']) ? $options['rounds'] : $this->rounds; + return password_verify($value, $hashedValue); + } - return password_needs_rehash($hashedValue, PASSWORD_BCRYPT, array('cost' => $cost)); - } + /** + * Check if the given hash has been hashed using the given options. + * + * @param string $hashedValue + * @param array $options + * @return bool + */ + public function needsRehash($hashedValue, array $options = []) + { + $cost = isset($options['rounds']) ? $options['rounds'] : $this->rounds; - /** - * Set the default password work factor. - * - * @param int $rounds - * @return $this - */ - public function setRounds($rounds) - { - $this->rounds = (int) $rounds; + return password_needs_rehash($hashedValue, PASSWORD_BCRYPT, ['cost' => $cost]); + } - return $this; - } + /** + * Set the default password work factor. + * + * @param int $rounds + * @return $this + */ + public function setRounds($rounds) + { + $this->rounds = (int) $rounds; + return $this; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php index 289b0ad..85581f4 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php @@ -1,34 +1,37 @@ -app->singleton('hash', function() { return new BcryptHasher; }); - } +class HashServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array('hash'); - } + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton('hash', function () { + return new BcryptHasher; + }); + } + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['hash']; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Hashing/composer.json b/application/vendor/laravel/framework/src/Illuminate/Hashing/composer.json index 95b4101..d2ccf86 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Hashing/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Hashing/composer.json @@ -14,10 +14,9 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*", - "ircmaxell/password-compat": "~1.0" + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*" }, "autoload": { "psr-4": { @@ -26,7 +25,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Http/Exception/HttpResponseException.php b/application/vendor/laravel/framework/src/Illuminate/Http/Exception/HttpResponseException.php index 379aa0c..0dcf48a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Http/Exception/HttpResponseException.php +++ b/application/vendor/laravel/framework/src/Illuminate/Http/Exception/HttpResponseException.php @@ -1,36 +1,37 @@ -response = $response; - } +class HttpResponseException extends RuntimeException +{ + /** + * The underlying response instance. + * + * @var \Symfony\Component\HttpFoundation\Response + */ + protected $response; - /** - * Get the underlying response instance. - * - * @return \Symfony\Component\HttpFoundation\Response - */ - public function getResponse() - { - return $this->response; - } + /** + * Create a new HTTP response exception instance. + * + * @param \Symfony\Component\HttpFoundation\Response $response + * @return void + */ + public function __construct(Response $response) + { + $this->response = $response; + } + /** + * Get the underlying response instance. + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function getResponse() + { + return $this->response; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Http/Exception/PostTooLargeException.php b/application/vendor/laravel/framework/src/Illuminate/Http/Exception/PostTooLargeException.php index 94db3f1..f0b7a67 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Http/Exception/PostTooLargeException.php +++ b/application/vendor/laravel/framework/src/Illuminate/Http/Exception/PostTooLargeException.php @@ -1,5 +1,10 @@ -jsonOptions = $options; + /** + * The json encoding options. + * + * @var int + */ + protected $jsonOptions; - parent::__construct($data, $status, $headers); - } + /** + * Constructor. + * + * @param mixed $data + * @param int $status + * @param array $headers + * @param int $options + */ + public function __construct($data = null, $status = 200, $headers = [], $options = 0) + { + $this->jsonOptions = $options; - /** - * Get the json_decoded data from the response. - * - * @param bool $assoc - * @param int $depth - * @return mixed - */ - public function getData($assoc = false, $depth = 512) - { - return json_decode($this->data, $assoc, $depth); - } + parent::__construct($data, $status, $headers); + } - /** - * {@inheritdoc} - */ - public function setData($data = array()) - { - $this->data = $data instanceof Jsonable - ? $data->toJson($this->jsonOptions) - : json_encode($data, $this->jsonOptions); + /** + * Get the json_decoded data from the response. + * + * @param bool $assoc + * @param int $depth + * @return mixed + */ + public function getData($assoc = false, $depth = 512) + { + return json_decode($this->data, $assoc, $depth); + } - return $this->update(); - } + /** + * {@inheritdoc} + */ + public function setData($data = []) + { + $this->data = $data instanceof Jsonable + ? $data->toJson($this->jsonOptions) + : json_encode($data, $this->jsonOptions); - /** - * Get the JSON encoding options. - * - * @return int - */ - public function getJsonOptions() - { - return $this->jsonOptions; - } + return $this->update(); + } - /** - * Set the JSON encoding options. - * - * @param int $options - * @return mixed - */ - public function setJsonOptions($options) - { - $this->jsonOptions = $options; + /** + * Get the JSON encoding options. + * + * @return int + */ + public function getJsonOptions() + { + return $this->jsonOptions; + } - return $this->setData($this->getData()); - } + /** + * Set the JSON encoding options. + * + * @param int $options + * @return mixed + */ + public function setJsonOptions($options) + { + $this->jsonOptions = $options; + return $this->setData($this->getData()); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Http/Middleware/CheckResponseForModifications.php b/application/vendor/laravel/framework/src/Illuminate/Http/Middleware/CheckResponseForModifications.php new file mode 100644 index 0000000..2a93e21 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Http/Middleware/CheckResponseForModifications.php @@ -0,0 +1,27 @@ +isNotModified($request); + } + + return $response; + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php b/application/vendor/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php index b62a598..b5d3f3c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php +++ b/application/vendor/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php @@ -1,24 +1,24 @@ -headers->set('X-Frame-Options', 'SAMEORIGIN', false); +class FrameGuard +{ + /** + * Handle the given request and get the response. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return \Illuminate\Http\Response + */ + public function handle($request, Closure $next) + { + $response = $next($request); - return $response; - } + $response->headers->set('X-Frame-Options', 'SAMEORIGIN', false); + return $response; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Http/RedirectResponse.php b/application/vendor/laravel/framework/src/Illuminate/Http/RedirectResponse.php index db2e752..419314a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Http/RedirectResponse.php +++ b/application/vendor/laravel/framework/src/Illuminate/Http/RedirectResponse.php @@ -1,204 +1,215 @@ - $value]; - - foreach ($key as $k => $v) - { - $this->session->flash($k, $v); - } - - return $this; - } - - /** - * Add multiple cookies to the response. - * - * @param array $cookies - * @return $this - */ - public function withCookies(array $cookies) - { - foreach ($cookies as $cookie) - { - $this->headers->setCookie($cookie); - } - - return $this; - } - - /** - * Flash an array of input to the session. - * - * @param array $input - * @return $this - */ - public function withInput(array $input = null) - { - $input = $input ?: $this->request->input(); - - $this->session->flashInput($data = array_filter($input, $callback = function (&$value) use (&$callback) - { - if (is_array($value)) - { - $value = array_filter($value, $callback); - } - - return ! $value instanceof UploadedFile; - })); - - return $this; - } - - /** - * Flash an array of input to the session. - * - * @param mixed string - * @return $this - */ - public function onlyInput() - { - return $this->withInput($this->request->only(func_get_args())); - } - - /** - * Flash an array of input to the session. - * - * @param mixed string - * @return \Illuminate\Http\RedirectResponse - */ - public function exceptInput() - { - return $this->withInput($this->request->except(func_get_args())); - } - - /** - * Flash a container of errors to the session. - * - * @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider - * @param string $key - * @return $this - */ - public function withErrors($provider, $key = 'default') - { - $value = $this->parseErrors($provider); - - $this->session->flash( - 'errors', $this->session->get('errors', new ViewErrorBag)->put($key, $value) - ); - - return $this; - } - - /** - * Parse the given errors into an appropriate value. - * - * @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider - * @return \Illuminate\Support\MessageBag - */ - protected function parseErrors($provider) - { - if ($provider instanceof MessageProvider) - { - return $provider->getMessageBag(); - } - - return new MessageBag((array) $provider); - } - - /** - * Get the request instance. - * - * @return \Illuminate\Http\Request - */ - public function getRequest() - { - return $this->request; - } - - /** - * Set the request instance. - * - * @param \Illuminate\Http\Request $request - * @return void - */ - public function setRequest(Request $request) - { - $this->request = $request; - } - - /** - * Get the session store implementation. - * - * @return \Illuminate\Session\Store - */ - public function getSession() - { - return $this->session; - } - - /** - * Set the session store implementation. - * - * @param \Illuminate\Session\Store $session - * @return void - */ - public function setSession(SessionStore $session) - { - $this->session = $session; - } - - /** - * Dynamically bind flash data in the session. - * - * @param string $method - * @param array $parameters - * @return void - * - * @throws \BadMethodCallException - */ - public function __call($method, $parameters) - { - if (starts_with($method, 'with')) - { - return $this->with(snake_case(substr($method, 4)), $parameters[0]); - } - - throw new BadMethodCallException("Method [$method] does not exist on Redirect."); - } - +class RedirectResponse extends BaseRedirectResponse +{ + use ResponseTrait; + + /** + * The request instance. + * + * @var \Illuminate\Http\Request + */ + protected $request; + + /** + * The session store implementation. + * + * @var \Illuminate\Session\Store + */ + protected $session; + + /** + * Flash a piece of data to the session. + * + * @param string|array $key + * @param mixed $value + * @return \Illuminate\Http\RedirectResponse + */ + public function with($key, $value = null) + { + $key = is_array($key) ? $key : [$key => $value]; + + foreach ($key as $k => $v) { + $this->session->flash($k, $v); + } + + return $this; + } + + /** + * Add multiple cookies to the response. + * + * @param array $cookies + * @return $this + */ + public function withCookies(array $cookies) + { + foreach ($cookies as $cookie) { + $this->headers->setCookie($cookie); + } + + return $this; + } + + /** + * Flash an array of input to the session. + * + * @param array $input + * @return $this + */ + public function withInput(array $input = null) + { + $input = $input ?: $this->request->input(); + + $this->session->flashInput($this->removeFilesFromInput($input)); + + return $this; + } + + /** + * Remove all uploaded files form the given input array. + * + * @param array $input + * @return array + */ + protected function removeFilesFromInput(array $input) + { + foreach ($input as $key => $value) { + if (is_array($value)) { + $input[$key] = $this->removeFilesFromInput($value); + } + + if ($value instanceof SymfonyUploadedFile) { + unset($input[$key]); + } + } + + return $input; + } + + /** + * Flash an array of input to the session. + * + * @param mixed string + * @return $this + */ + public function onlyInput() + { + return $this->withInput($this->request->only(func_get_args())); + } + + /** + * Flash an array of input to the session. + * + * @param mixed string + * @return \Illuminate\Http\RedirectResponse + */ + public function exceptInput() + { + return $this->withInput($this->request->except(func_get_args())); + } + + /** + * Flash a container of errors to the session. + * + * @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider + * @param string $key + * @return $this + */ + public function withErrors($provider, $key = 'default') + { + $value = $this->parseErrors($provider); + + $this->session->flash( + 'errors', $this->session->get('errors', new ViewErrorBag)->put($key, $value) + ); + + return $this; + } + + /** + * Parse the given errors into an appropriate value. + * + * @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider + * @return \Illuminate\Support\MessageBag + */ + protected function parseErrors($provider) + { + if ($provider instanceof MessageProvider) { + return $provider->getMessageBag(); + } + + return new MessageBag((array) $provider); + } + + /** + * Get the request instance. + * + * @return \Illuminate\Http\Request|null + */ + public function getRequest() + { + return $this->request; + } + + /** + * Set the request instance. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + public function setRequest(Request $request) + { + $this->request = $request; + } + + /** + * Get the session store implementation. + * + * @return \Illuminate\Session\Store|null + */ + public function getSession() + { + return $this->session; + } + + /** + * Set the session store implementation. + * + * @param \Illuminate\Session\Store $session + * @return void + */ + public function setSession(SessionStore $session) + { + $this->session = $session; + } + + /** + * Dynamically bind flash data in the session. + * + * @param string $method + * @param array $parameters + * @return $this + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (Str::startsWith($method, 'with')) { + return $this->with(Str::snake(substr($method, 4)), $parameters[0]); + } + + throw new BadMethodCallException("Method [$method] does not exist on Redirect."); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Http/Request.php b/application/vendor/laravel/framework/src/Illuminate/Http/Request.php index e0211cf..eaa382b 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Http/Request.php +++ b/application/vendor/laravel/framework/src/Illuminate/Http/Request.php @@ -1,793 +1,912 @@ -getMethod(); - } - - /** - * Get the root URL for the application. - * - * @return string - */ - public function root() - { - return rtrim($this->getSchemeAndHttpHost().$this->getBaseUrl(), '/'); - } - - /** - * Get the URL (no query string) for the request. - * - * @return string - */ - public function url() - { - return rtrim(preg_replace('/\?.*/', '', $this->getUri()), '/'); - } - - /** - * Get the full URL for the request. - * - * @return string - */ - public function fullUrl() - { - $query = $this->getQueryString(); - - return $query ? $this->url().'?'.$query : $this->url(); - } - - /** - * Get the current path info for the request. - * - * @return string - */ - public function path() - { - $pattern = trim($this->getPathInfo(), '/'); - - return $pattern == '' ? '/' : $pattern; - } - - /** - * Get the current encoded path info for the request. - * - * @return string - */ - public function decodedPath() - { - return rawurldecode($this->path()); - } - - /** - * Get a segment from the URI (1 based index). - * - * @param int $index - * @param mixed $default - * @return string - */ - public function segment($index, $default = null) - { - return array_get($this->segments(), $index - 1, $default); - } - - /** - * Get all of the segments for the request path. - * - * @return array - */ - public function segments() - { - $segments = explode('/', $this->path()); - - return array_values(array_filter($segments, function($v) { return $v != ''; })); - } - - /** - * Determine if the current request URI matches a pattern. - * - * @param mixed string - * @return bool - */ - public function is() - { - foreach (func_get_args() as $pattern) - { - if (str_is($pattern, urldecode($this->path()))) - { - return true; - } - } - - return false; - } - - /** - * Determine if the request is the result of an AJAX call. - * - * @return bool - */ - public function ajax() - { - return $this->isXmlHttpRequest(); - } - - /** - * Determine if the request is the result of an PJAX call. - * - * @return bool - */ - public function pjax() - { - return $this->headers->get('X-PJAX') == true; - } - - /** - * Determine if the request is over HTTPS. - * - * @return bool - */ - public function secure() - { - return $this->isSecure(); - } - - /** - * Returns the client IP address. - * - * @return string - */ - public function ip() - { - return $this->getClientIp(); - } - - /** - * Returns the client IP addresses. - * - * @return array - */ - public function ips() - { - return $this->getClientIps(); - } - - /** - * Determine if the request contains a given input item key. - * - * @param string|array $key - * @return bool - */ - public function exists($key) - { - $keys = is_array($key) ? $key : func_get_args(); - - $input = $this->all(); - - foreach ($keys as $value) - { - if ( ! array_key_exists($value, $input)) return false; - } - - return true; - } - - /** - * Determine if the request contains a non-empty value for an input item. - * - * @param string|array $key - * @return bool - */ - public function has($key) - { - $keys = is_array($key) ? $key : func_get_args(); - - foreach ($keys as $value) - { - if ($this->isEmptyString($value)) return false; - } - - return true; - } - - /** - * Determine if the given input key is an empty string for "has". - * - * @param string $key - * @return bool - */ - protected function isEmptyString($key) - { - $boolOrArray = is_bool($this->input($key)) || is_array($this->input($key)); - - return ! $boolOrArray && trim((string) $this->input($key)) === ''; - } - - /** - * Get all of the input and files for the request. - * - * @return array - */ - public function all() - { - return array_replace_recursive($this->input(), $this->files->all()); - } - - /** - * Retrieve an input item from the request. - * - * @param string $key - * @param mixed $default - * @return string|array - */ - public function input($key = null, $default = null) - { - $input = $this->getInputSource()->all() + $this->query->all(); - - return array_get($input, $key, $default); - } - - /** - * Get a subset of the items from the input data. - * - * @param array $keys - * @return array - */ - public function only($keys) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - $results = []; - - $input = $this->all(); - - foreach ($keys as $key) - { - array_set($results, $key, array_get($input, $key)); - } - - return $results; - } - - /** - * Get all of the input except for a specified array of items. - * - * @param array $keys - * @return array - */ - public function except($keys) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - $results = $this->all(); - - array_forget($results, $keys); - - return $results; - } - - /** - * Retrieve a query string item from the request. - * - * @param string $key - * @param mixed $default - * @return string|array - */ - public function query($key = null, $default = null) - { - return $this->retrieveItem('query', $key, $default); - } - - /** - * Determine if a cookie is set on the request. - * - * @param string $key - * @return bool - */ - public function hasCookie($key) - { - return ! is_null($this->cookie($key)); - } - - /** - * Retrieve a cookie from the request. - * - * @param string $key - * @param mixed $default - * @return string|array - */ - public function cookie($key = null, $default = null) - { - return $this->retrieveItem('cookies', $key, $default); - } - - /** - * Retrieve a file from the request. - * - * @param string $key - * @param mixed $default - * @return \Symfony\Component\HttpFoundation\File\UploadedFile|array - */ - public function file($key = null, $default = null) - { - return array_get($this->files->all(), $key, $default); - } - - /** - * Determine if the uploaded data contains a file. - * - * @param string $key - * @return bool - */ - public function hasFile($key) - { - if ( ! is_array($files = $this->file($key))) $files = array($files); - - foreach ($files as $file) - { - if ($this->isValidFile($file)) return true; - } - - return false; - } - - /** - * Check that the given file is a valid file instance. - * - * @param mixed $file - * @return bool - */ - protected function isValidFile($file) - { - return $file instanceof SplFileInfo && $file->getPath() != ''; - } - - /** - * Retrieve a header from the request. - * - * @param string $key - * @param mixed $default - * @return string|array - */ - public function header($key = null, $default = null) - { - return $this->retrieveItem('headers', $key, $default); - } - - /** - * Retrieve a server variable from the request. - * - * @param string $key - * @param mixed $default - * @return string|array - */ - public function server($key = null, $default = null) - { - return $this->retrieveItem('server', $key, $default); - } - - /** - * Retrieve an old input item. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function old($key = null, $default = null) - { - return $this->session()->getOldInput($key, $default); - } - - /** - * Flash the input for the current request to the session. - * - * @param string $filter - * @param array $keys - * @return void - */ - public function flash($filter = null, $keys = array()) - { - $flash = ( ! is_null($filter)) ? $this->$filter($keys) : $this->input(); - - $this->session()->flashInput($flash); - } - - /** - * Flash only some of the input to the session. - * - * @param mixed string - * @return void - */ - public function flashOnly($keys) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - return $this->flash('only', $keys); - } - - /** - * Flash only some of the input to the session. - * - * @param mixed string - * @return void - */ - public function flashExcept($keys) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - return $this->flash('except', $keys); - } - - /** - * Flush all of the old input from the session. - * - * @return void - */ - public function flush() - { - $this->session()->flashInput(array()); - } - - /** - * Retrieve a parameter item from a given source. - * - * @param string $source - * @param string $key - * @param mixed $default - * @return string|array - */ - protected function retrieveItem($source, $key, $default) - { - if (is_null($key)) - { - return $this->$source->all(); - } - - return $this->$source->get($key, $default, true); - } - - /** - * Merge new input into the current request's input array. - * - * @param array $input - * @return void - */ - public function merge(array $input) - { - $this->getInputSource()->add($input); - } - - /** - * Replace the input for the current request. - * - * @param array $input - * @return void - */ - public function replace(array $input) - { - $this->getInputSource()->replace($input); - } - - /** - * Get the JSON payload for the request. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function json($key = null, $default = null) - { - if ( ! isset($this->json)) - { - $this->json = new ParameterBag((array) json_decode($this->getContent(), true)); - } - - if (is_null($key)) return $this->json; - - return array_get($this->json->all(), $key, $default); - } - - /** - * Get the input source for the request. - * - * @return \Symfony\Component\HttpFoundation\ParameterBag - */ - protected function getInputSource() - { - if ($this->isJson()) return $this->json(); - - return $this->getMethod() == 'GET' ? $this->query : $this->request; - } - - /** - * Determine if the request is sending JSON. - * - * @return bool - */ - public function isJson() - { - return str_contains($this->header('CONTENT_TYPE'), '/json'); - } - - /** - * Determine if the current request is asking for JSON in return. - * - * @return bool - */ - public function wantsJson() - { - $acceptable = $this->getAcceptableContentTypes(); - - return isset($acceptable[0]) && $acceptable[0] == 'application/json'; - } - - /** - * Get the data format expected in the response. - * - * @param string $default - * @return string - */ - public function format($default = 'html') - { - foreach ($this->getAcceptableContentTypes() as $type) - { - if ($format = $this->getFormat($type)) return $format; - } - - return $default; - } - - /** - * Create an Illuminate request from a Symfony instance. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @return \Illuminate\Http\Request - */ - public static function createFromBase(SymfonyRequest $request) - { - if ($request instanceof static) return $request; - - $content = $request->content; - - $request = (new static)->duplicate( - - $request->query->all(), $request->request->all(), $request->attributes->all(), - - $request->cookies->all(), $request->files->all(), $request->server->all() - ); - - $request->content = $content; - - $request->request = $request->getInputSource(); - - return $request; - } - - /** - * {@inheritdoc} - */ - public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) - { - return parent::duplicate($query, $request, $attributes, $cookies, array_filter((array) $files), $server); - } - - /** - * Get the session associated with the request. - * - * @return \Illuminate\Session\Store - * - * @throws \RuntimeException - */ - public function session() - { - if ( ! $this->hasSession()) - { - throw new RuntimeException("Session store not set on request."); - } - - return $this->getSession(); - } - - /** - * Get the user making the request. - * - * @return mixed - */ - public function user() - { - return call_user_func($this->getUserResolver()); - } - - /** - * Get the route handling the request. - * - * @return \Illuminate\Routing\Route|null - */ - public function route() - { - if (func_num_args() == 1) - { - return $this->route()->parameter(func_get_arg(0)); - } - else - { - return call_user_func($this->getRouteResolver()); - } - } - - /** - * Get the user resolver callback. - * - * @return \Closure - */ - public function getUserResolver() - { - return $this->userResolver ?: function() {}; - } - - /** - * Set the user resolver callback. - * - * @param \Closure $callback - * @return $this - */ - public function setUserResolver(Closure $callback) - { - $this->userResolver = $callback; - - return $this; - } - - /** - * Get the route resolver callback. - * - * @return \Closure - */ - public function getRouteResolver() - { - return $this->routeResolver ?: function() {}; - } - - /** - * Set the route resolver callback. - * - * @param \Closure $callback - * @return $this - */ - public function setRouteResolver(Closure $callback) - { - $this->routeResolver = $callback; - - return $this; - } - - /** - * Determine if the given offset exists. - * - * @param string $offset - * @return bool - */ - public function offsetExists($offset) - { - return array_key_exists($offset, $this->all()); - } - - /** - * Get the value at the given offset. - * - * @param string $offset - * @return mixed - */ - public function offsetGet($offset) - { - return $this->input($offset); - } - - /** - * Set the value at the given offset. - * - * @param string $offset - * @param mixed $value - * @return void - */ - public function offsetSet($offset, $value) - { - return $this->getInputSource()->set($offset, $value); - } - - /** - * Remove the value at the given offset. - * - * @param string $offset - * @return void - */ - public function offsetUnset($offset) - { - return $this->getInputSource()->remove($offset); - } - - /** - * Get an input element from the request. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - $input = $this->input(); - - if (array_key_exists($key, $input)) - { - return $this->input($key); - } - elseif ( ! is_null($this->route())) - { - return $this->route()->parameter($key); - } - } - +class Request extends SymfonyRequest implements ArrayAccess +{ + /** + * The decoded JSON content for the request. + * + * @var string + */ + protected $json; + + /** + * The user resolver callback. + * + * @var \Closure + */ + protected $userResolver; + + /** + * The route resolver callback. + * + * @var \Closure + */ + protected $routeResolver; + + /** + * Create a new Illuminate HTTP request from server variables. + * + * @return static + */ + public static function capture() + { + static::enableHttpMethodParameterOverride(); + + return static::createFromBase(SymfonyRequest::createFromGlobals()); + } + + /** + * Return the Request instance. + * + * @return $this + */ + public function instance() + { + return $this; + } + + /** + * Get the request method. + * + * @return string + */ + public function method() + { + return $this->getMethod(); + } + + /** + * Get the root URL for the application. + * + * @return string + */ + public function root() + { + return rtrim($this->getSchemeAndHttpHost().$this->getBaseUrl(), '/'); + } + + /** + * Get the URL (no query string) for the request. + * + * @return string + */ + public function url() + { + return rtrim(preg_replace('/\?.*/', '', $this->getUri()), '/'); + } + + /** + * Get the full URL for the request. + * + * @return string + */ + public function fullUrl() + { + $query = $this->getQueryString(); + + return $query ? $this->url().'?'.$query : $this->url(); + } + + /** + * Get the current path info for the request. + * + * @return string + */ + public function path() + { + $pattern = trim($this->getPathInfo(), '/'); + + return $pattern == '' ? '/' : $pattern; + } + + /** + * Get the current encoded path info for the request. + * + * @return string + */ + public function decodedPath() + { + return rawurldecode($this->path()); + } + + /** + * Get a segment from the URI (1 based index). + * + * @param int $index + * @param string|null $default + * @return string|null + */ + public function segment($index, $default = null) + { + return Arr::get($this->segments(), $index - 1, $default); + } + + /** + * Get all of the segments for the request path. + * + * @return array + */ + public function segments() + { + $segments = explode('/', $this->path()); + + return array_values(array_filter($segments, function ($v) { + return $v != ''; + })); + } + + /** + * Determine if the current request URI matches a pattern. + * + * @param mixed string + * @return bool + */ + public function is() + { + foreach (func_get_args() as $pattern) { + if (Str::is($pattern, urldecode($this->path()))) { + return true; + } + } + + return false; + } + + /** + * Determine if the request is the result of an AJAX call. + * + * @return bool + */ + public function ajax() + { + return $this->isXmlHttpRequest(); + } + + /** + * Determine if the request is the result of an PJAX call. + * + * @return bool + */ + public function pjax() + { + return $this->headers->get('X-PJAX') == true; + } + + /** + * Determine if the request is over HTTPS. + * + * @return bool + */ + public function secure() + { + return $this->isSecure(); + } + + /** + * Returns the client IP address. + * + * @return string + */ + public function ip() + { + return $this->getClientIp(); + } + + /** + * Returns the client IP addresses. + * + * @return array + */ + public function ips() + { + return $this->getClientIps(); + } + + /** + * Determine if the request contains a given input item key. + * + * @param string|array $key + * @return bool + */ + public function exists($key) + { + $keys = is_array($key) ? $key : func_get_args(); + + $input = $this->all(); + + foreach ($keys as $value) { + if (! array_key_exists($value, $input)) { + return false; + } + } + + return true; + } + + /** + * Determine if the request contains a non-empty value for an input item. + * + * @param string|array $key + * @return bool + */ + public function has($key) + { + $keys = is_array($key) ? $key : func_get_args(); + + foreach ($keys as $value) { + if ($this->isEmptyString($value)) { + return false; + } + } + + return true; + } + + /** + * Determine if the given input key is an empty string for "has". + * + * @param string $key + * @return bool + */ + protected function isEmptyString($key) + { + $value = $this->input($key); + + $boolOrArray = is_bool($value) || is_array($value); + + return ! $boolOrArray && trim((string) $value) === ''; + } + + /** + * Get all of the input and files for the request. + * + * @return array + */ + public function all() + { + return array_replace_recursive($this->input(), $this->files->all()); + } + + /** + * Retrieve an input item from the request. + * + * @param string $key + * @param string|array|null $default + * @return string|array + */ + public function input($key = null, $default = null) + { + $input = $this->getInputSource()->all() + $this->query->all(); + + return Arr::get($input, $key, $default); + } + + /** + * Get a subset of the items from the input data. + * + * @param array $keys + * @return array + */ + public function only($keys) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + $results = []; + + $input = $this->all(); + + foreach ($keys as $key) { + Arr::set($results, $key, Arr::get($input, $key)); + } + + return $results; + } + + /** + * Get all of the input except for a specified array of items. + * + * @param array|mixed $keys + * @return array + */ + public function except($keys) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + $results = $this->all(); + + Arr::forget($results, $keys); + + return $results; + } + + /** + * Retrieve a query string item from the request. + * + * @param string $key + * @param string|array|null $default + * @return string|array + */ + public function query($key = null, $default = null) + { + return $this->retrieveItem('query', $key, $default); + } + + /** + * Determine if a cookie is set on the request. + * + * @param string $key + * @return bool + */ + public function hasCookie($key) + { + return ! is_null($this->cookie($key)); + } + + /** + * Retrieve a cookie from the request. + * + * @param string $key + * @param string|array|null $default + * @return string|array + */ + public function cookie($key = null, $default = null) + { + return $this->retrieveItem('cookies', $key, $default); + } + + /** + * Retrieve a file from the request. + * + * @param string $key + * @param mixed $default + * @return \Symfony\Component\HttpFoundation\File\UploadedFile|array|null + */ + public function file($key = null, $default = null) + { + return Arr::get($this->files->all(), $key, $default); + } + + /** + * Determine if the uploaded data contains a file. + * + * @param string $key + * @return bool + */ + public function hasFile($key) + { + if (! is_array($files = $this->file($key))) { + $files = [$files]; + } + + foreach ($files as $file) { + if ($this->isValidFile($file)) { + return true; + } + } + + return false; + } + + /** + * Check that the given file is a valid file instance. + * + * @param mixed $file + * @return bool + */ + protected function isValidFile($file) + { + return $file instanceof SplFileInfo && $file->getPath() != ''; + } + + /** + * Retrieve a header from the request. + * + * @param string $key + * @param string|array|null $default + * @return string|array + */ + public function header($key = null, $default = null) + { + return $this->retrieveItem('headers', $key, $default); + } + + /** + * Retrieve a server variable from the request. + * + * @param string $key + * @param string|array|null $default + * @return string|array + */ + public function server($key = null, $default = null) + { + return $this->retrieveItem('server', $key, $default); + } + + /** + * Retrieve an old input item. + * + * @param string $key + * @param string|array|null $default + * @return string|array + */ + public function old($key = null, $default = null) + { + return $this->session()->getOldInput($key, $default); + } + + /** + * Flash the input for the current request to the session. + * + * @param string $filter + * @param array $keys + * @return void + */ + public function flash($filter = null, $keys = []) + { + $flash = (! is_null($filter)) ? $this->$filter($keys) : $this->input(); + + $this->session()->flashInput($flash); + } + + /** + * Flash only some of the input to the session. + * + * @param array|mixed $keys + * @return void + */ + public function flashOnly($keys) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + return $this->flash('only', $keys); + } + + /** + * Flash only some of the input to the session. + * + * @param array|mixed $keys + * @return void + */ + public function flashExcept($keys) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + return $this->flash('except', $keys); + } + + /** + * Flush all of the old input from the session. + * + * @return void + */ + public function flush() + { + $this->session()->flashInput([]); + } + + /** + * Retrieve a parameter item from a given source. + * + * @param string $source + * @param string $key + * @param string|array|null $default + * @return string|array + */ + protected function retrieveItem($source, $key, $default) + { + if (is_null($key)) { + return $this->$source->all(); + } + + return $this->$source->get($key, $default, true); + } + + /** + * Merge new input into the current request's input array. + * + * @param array $input + * @return void + */ + public function merge(array $input) + { + $this->getInputSource()->add($input); + } + + /** + * Replace the input for the current request. + * + * @param array $input + * @return void + */ + public function replace(array $input) + { + $this->getInputSource()->replace($input); + } + + /** + * Get the JSON payload for the request. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function json($key = null, $default = null) + { + if (! isset($this->json)) { + $this->json = new ParameterBag((array) json_decode($this->getContent(), true)); + } + + if (is_null($key)) { + return $this->json; + } + + return Arr::get($this->json->all(), $key, $default); + } + + /** + * Get the input source for the request. + * + * @return \Symfony\Component\HttpFoundation\ParameterBag + */ + protected function getInputSource() + { + if ($this->isJson()) { + return $this->json(); + } + + return $this->getRealMethod() == 'GET' ? $this->query : $this->request; + } + + /** + * Determine if the given content types match. + * + * @param string $actual + * @param string $type + * @return bool + */ + public static function matchesType($actual, $type) + { + if ($actual === $type) { + return true; + } + + $split = explode('/', $actual); + + return isset($split[1]) && preg_match('#'.preg_quote($split[0], '#').'/.+\+'.preg_quote($split[1], '#').'#', $type); + } + + /** + * Determine if the request is sending JSON. + * + * @return bool + */ + public function isJson() + { + return Str::contains($this->header('CONTENT_TYPE'), ['/json', '+json']); + } + + /** + * Determine if the current request is asking for JSON in return. + * + * @return bool + */ + public function wantsJson() + { + $acceptable = $this->getAcceptableContentTypes(); + + return isset($acceptable[0]) && Str::contains($acceptable[0], ['/json', '+json']); + } + + /** + * Determines whether the current requests accepts a given content type. + * + * @param string|array $contentTypes + * @return bool + */ + public function accepts($contentTypes) + { + $accepts = $this->getAcceptableContentTypes(); + + if (count($accepts) === 0) { + return true; + } + + $types = (array) $contentTypes; + + foreach ($accepts as $accept) { + if ($accept === '*/*' || $accept === '*') { + return true; + } + + foreach ($types as $type) { + if ($this->matchesType($accept, $type) || $accept === strtok($type, '/').'/*') { + return true; + } + } + } + + return false; + } + + /** + * Return the most suitable content type from the given array based on content negotiation. + * + * @param string|array $contentTypes + * @return string|null + */ + public function prefers($contentTypes) + { + $accepts = $this->getAcceptableContentTypes(); + + $contentTypes = (array) $contentTypes; + + foreach ($accepts as $accept) { + if (in_array($accept, ['*/*', '*'])) { + return $contentTypes[0]; + } + + foreach ($contentTypes as $contentType) { + $type = $contentType; + + if (! is_null($mimeType = $this->getMimeType($contentType))) { + $type = $mimeType; + } + + if ($this->matchesType($type, $accept) || $accept === strtok($type, '/').'/*') { + return $contentType; + } + } + } + } + + /** + * Determines whether a request accepts JSON. + * + * @return bool + */ + public function acceptsJson() + { + return $this->accepts('application/json'); + } + + /** + * Determines whether a request accepts HTML. + * + * @return bool + */ + public function acceptsHtml() + { + return $this->accepts('text/html'); + } + + /** + * Get the data format expected in the response. + * + * @param string $default + * @return string + */ + public function format($default = 'html') + { + foreach ($this->getAcceptableContentTypes() as $type) { + if ($format = $this->getFormat($type)) { + return $format; + } + } + + return $default; + } + + /** + * Create an Illuminate request from a Symfony instance. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return \Illuminate\Http\Request + */ + public static function createFromBase(SymfonyRequest $request) + { + if ($request instanceof static) { + return $request; + } + + $content = $request->content; + + $request = (new static)->duplicate( + + $request->query->all(), $request->request->all(), $request->attributes->all(), + + $request->cookies->all(), $request->files->all(), $request->server->all() + ); + + $request->content = $content; + + $request->request = $request->getInputSource(); + + return $request; + } + + /** + * {@inheritdoc} + */ + public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) + { + return parent::duplicate($query, $request, $attributes, $cookies, array_filter((array) $files), $server); + } + + /** + * Get the session associated with the request. + * + * @return \Illuminate\Session\Store + * + * @throws \RuntimeException + */ + public function session() + { + if (! $this->hasSession()) { + throw new RuntimeException('Session store not set on request.'); + } + + return $this->getSession(); + } + + /** + * Get the user making the request. + * + * @return mixed + */ + public function user() + { + return call_user_func($this->getUserResolver()); + } + + /** + * Get the route handling the request. + * + * @param string|null $param + * + * @return \Illuminate\Routing\Route|object|string + */ + public function route($param = null) + { + $route = call_user_func($this->getRouteResolver()); + + if (is_null($route) || is_null($param)) { + return $route; + } else { + return $route->parameter($param); + } + } + + /** + * Get the user resolver callback. + * + * @return \Closure + */ + public function getUserResolver() + { + return $this->userResolver ?: function () { + // + }; + } + + /** + * Set the user resolver callback. + * + * @param \Closure $callback + * @return $this + */ + public function setUserResolver(Closure $callback) + { + $this->userResolver = $callback; + + return $this; + } + + /** + * Get the route resolver callback. + * + * @return \Closure + */ + public function getRouteResolver() + { + return $this->routeResolver ?: function () { + // + }; + } + + /** + * Set the route resolver callback. + * + * @param \Closure $callback + * @return $this + */ + public function setRouteResolver(Closure $callback) + { + $this->routeResolver = $callback; + + return $this; + } + + /** + * Determine if the given offset exists. + * + * @param string $offset + * @return bool + */ + public function offsetExists($offset) + { + return array_key_exists($offset, $this->all()); + } + + /** + * Get the value at the given offset. + * + * @param string $offset + * @return mixed + */ + public function offsetGet($offset) + { + return Arr::get($this->all(), $offset); + } + + /** + * Set the value at the given offset. + * + * @param string $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset, $value) + { + return $this->getInputSource()->set($offset, $value); + } + + /** + * Remove the value at the given offset. + * + * @param string $offset + * @return void + */ + public function offsetUnset($offset) + { + return $this->getInputSource()->remove($offset); + } + + /** + * Check if an input element is set on the request. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return ! is_null($this->__get($key)); + } + + /** + * Get an input element from the request. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + $all = $this->all(); + + if (array_key_exists($key, $all)) { + return $all[$key]; + } else { + return $this->route($key); + } + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Http/Response.php b/application/vendor/laravel/framework/src/Illuminate/Http/Response.php index 5e61fe0..3c9299d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Http/Response.php +++ b/application/vendor/laravel/framework/src/Illuminate/Http/Response.php @@ -1,86 +1,94 @@ -original = $content; + /** + * The exception that triggered the error response (if applicable). + * + * @var \Exception + */ + public $exception; - // If the content is "JSONable" we will set the appropriate header and convert - // the content to JSON. This is useful when returning something like models - // from routes that will be automatically transformed to their JSON form. - if ($this->shouldBeJson($content)) - { - $this->header('Content-Type', 'application/json'); + /** + * Set the content on the response. + * + * @param mixed $content + * @return $this + */ + public function setContent($content) + { + $this->original = $content; - $content = $this->morphToJson($content); - } + // If the content is "JSONable" we will set the appropriate header and convert + // the content to JSON. This is useful when returning something like models + // from routes that will be automatically transformed to their JSON form. + if ($this->shouldBeJson($content)) { + $this->header('Content-Type', 'application/json'); - // If this content implements the "Renderable" interface then we will call the - // render method on the object so we will avoid any "__toString" exceptions - // that might be thrown and have their errors obscured by PHP's handling. - elseif ($content instanceof Renderable) - { - $content = $content->render(); - } + $content = $this->morphToJson($content); + } - return parent::setContent($content); - } + // If this content implements the "Renderable" interface then we will call the + // render method on the object so we will avoid any "__toString" exceptions + // that might be thrown and have their errors obscured by PHP's handling. + elseif ($content instanceof Renderable) { + $content = $content->render(); + } - /** - * Morph the given content into JSON. - * - * @param mixed $content - * @return string - */ - protected function morphToJson($content) - { - if ($content instanceof Jsonable) return $content->toJson(); + return parent::setContent($content); + } - return json_encode($content); - } + /** + * Morph the given content into JSON. + * + * @param mixed $content + * @return string + */ + protected function morphToJson($content) + { + if ($content instanceof Jsonable) { + return $content->toJson(); + } - /** - * Determine if the given content should be turned into JSON. - * - * @param mixed $content - * @return bool - */ - protected function shouldBeJson($content) - { - return $content instanceof Jsonable || - $content instanceof ArrayObject || - is_array($content); - } + return json_encode($content); + } - /** - * Get the original response content. - * - * @return mixed - */ - public function getOriginalContent() - { - return $this->original; - } + /** + * Determine if the given content should be turned into JSON. + * + * @param mixed $content + * @return bool + */ + protected function shouldBeJson($content) + { + return $content instanceof Jsonable || + $content instanceof ArrayObject || + is_array($content); + } + /** + * Get the original response content. + * + * @return mixed + */ + public function getOriginalContent() + { + return $this->original; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php b/application/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php index 2cfd9be..56ddc6a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php +++ b/application/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php @@ -1,35 +1,58 @@ -headers->set($key, $value, $replace); - - return $this; - } - - /** - * Add a cookie to the response. - * - * @param \Symfony\Component\HttpFoundation\Cookie $cookie - * @return $this - */ - public function withCookie(Cookie $cookie) - { - $this->headers->setCookie($cookie); - - return $this; - } +getStatusCode(); + } + + /** + * Get the content of the response. + * + * @return string + */ + public function content() + { + return $this->getContent(); + } + + /** + * Set a header on the Response. + * + * @param string $key + * @param string $value + * @param bool $replace + * @return $this + */ + public function header($key, $value, $replace = true) + { + $this->headers->set($key, $value, $replace); + + return $this; + } + + /** + * Add a cookie to the response. + * + * @param \Symfony\Component\HttpFoundation\Cookie|mixed $cookie + * @return $this + */ + public function withCookie($cookie) + { + if (is_string($cookie) && function_exists('cookie')) { + $cookie = call_user_func_array('cookie', func_get_args()); + } + + $this->headers->setCookie($cookie); + + return $this; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Http/composer.json b/application/vendor/laravel/framework/src/Illuminate/Http/composer.json index 10a885b..a7bb6d3 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Http/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Http/composer.json @@ -14,11 +14,11 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/session": "5.0.*", - "illuminate/support": "5.0.*", - "symfony/http-foundation": "2.6.*", - "symfony/http-kernel": "2.6.*" + "php": ">=5.5.9", + "illuminate/session": "5.1.*", + "illuminate/support": "5.1.*", + "symfony/http-foundation": "2.7.*", + "symfony/http-kernel": "2.7.*" }, "autoload": { "psr-4": { @@ -27,7 +27,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Log/Writer.php b/application/vendor/laravel/framework/src/Illuminate/Log/Writer.php index 1932e3a..ae386d1 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Log/Writer.php +++ b/application/vendor/laravel/framework/src/Illuminate/Log/Writer.php @@ -1,13 +1,15 @@ - MonologLogger::DEBUG, - 'info' => MonologLogger::INFO, - 'notice' => MonologLogger::NOTICE, - 'warning' => MonologLogger::WARNING, - 'error' => MonologLogger::ERROR, - 'critical' => MonologLogger::CRITICAL, - 'alert' => MonologLogger::ALERT, - 'emergency' => MonologLogger::EMERGENCY, - ]; - - /** - * Create a new log writer instance. - * - * @param \Monolog\Logger $monolog - * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher - * @return void - */ - public function __construct(MonologLogger $monolog, Dispatcher $dispatcher = null) - { - $this->monolog = $monolog; - - if (isset($dispatcher)) - { - $this->dispatcher = $dispatcher; - } - } - - /** - * Log an emergency message to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function emergency($message, array $context = array()) - { - return $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log an alert message to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function alert($message, array $context = array()) - { - return $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log a critical message to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function critical($message, array $context = array()) - { - return $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log an error message to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function error($message, array $context = array()) - { - return $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log a warning message to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function warning($message, array $context = array()) - { - return $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log a notice to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function notice($message, array $context = array()) - { - return $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log an informational message to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function info($message, array $context = array()) - { - return $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log a debug message to the logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function debug($message, array $context = array()) - { - return $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log a message to the logs. - * - * @param string $level - * @param string $message - * @param array $context - * @return void - */ - public function log($level, $message, array $context = array()) - { - return $this->writeLog($level, $message, $context); - } - - /** - * Dynamically pass log calls into the writer. - * - * @param string $level - * @param string $message - * @param array $context - * @return void - */ - public function write($level, $message, array $context = array()) - { - return $this->writeLog($level, $message, $context); - } - - /** - * Write a message to Monolog. - * - * @param string $level - * @param string $message - * @param array $context - * @return void - */ - protected function writeLog($level, $message, $context) - { - $this->fireLogEvent($level, $message = $this->formatMessage($message), $context); - - $this->monolog->{$level}($message, $context); - } - - /** - * Register a file log handler. - * - * @param string $path - * @param string $level - * @return void - */ - public function useFiles($path, $level = 'debug') - { - $this->monolog->pushHandler($handler = new StreamHandler($path, $this->parseLevel($level))); - - $handler->setFormatter($this->getDefaultFormatter()); - } - - /** - * Register a daily file log handler. - * - * @param string $path - * @param int $days - * @param string $level - * @return void - */ - public function useDailyFiles($path, $days = 0, $level = 'debug') - { - $this->monolog->pushHandler( - $handler = new RotatingFileHandler($path, $days, $this->parseLevel($level)) - ); - - $handler->setFormatter($this->getDefaultFormatter()); - } - - /** - * Register a Syslog handler. - * - * @param string $name - * @param string $level - * @return void - */ - public function useSyslog($name = 'laravel', $level = 'debug') - { - return $this->monolog->pushHandler(new SyslogHandler($name, LOG_USER, $level)); - } - - /** - * Register an error_log handler. - * - * @param string $level - * @param int $messageType - * @return void - */ - public function useErrorLog($level = 'debug', $messageType = ErrorLogHandler::OPERATING_SYSTEM) - { - $this->monolog->pushHandler( - $handler = new ErrorLogHandler($messageType, $this->parseLevel($level)) - ); - - $handler->setFormatter($this->getDefaultFormatter()); - } - - /** - * Register a new callback handler for when a log event is triggered. - * - * @param \Closure $callback - * @return void - * - * @throws \RuntimeException - */ - public function listen(Closure $callback) - { - if ( ! isset($this->dispatcher)) - { - throw new RuntimeException("Events dispatcher has not been set."); - } - - $this->dispatcher->listen('illuminate.log', $callback); - } - - /** - * Fires a log event. - * - * @param string $level - * @param string $message - * @param array $context - * @return void - */ - protected function fireLogEvent($level, $message, array $context = array()) - { - // If the event dispatcher is set, we will pass along the parameters to the - // log listeners. These are useful for building profilers or other tools - // that aggregate all of the log messages for a given "request" cycle. - if (isset($this->dispatcher)) - { - $this->dispatcher->fire('illuminate.log', compact('level', 'message', 'context')); - } - } - - /** - * Format the parameters for the logger. - * - * @param mixed $message - * @return void - */ - protected function formatMessage($message) - { - if (is_array($message)) - { - return var_export($message, true); - } - elseif ($message instanceof Jsonable) - { - return $message->toJson(); - } - elseif ($message instanceof Arrayable) - { - return var_export($message->toArray(), true); - } - - return $message; - } - - /** - * Parse the string level into a Monolog constant. - * - * @param string $level - * @return int - * - * @throws \InvalidArgumentException - */ - protected function parseLevel($level) - { - if (isset($this->levels[$level])) - { - return $this->levels[$level]; - } - - throw new InvalidArgumentException("Invalid log level."); - } - - /** - * Get the underlying Monolog instance. - * - * @return \Monolog\Logger - */ - public function getMonolog() - { - return $this->monolog; - } - - /** - * Get a defaut Monolog formatter instance. - * - * @return \Monolog\Formatter\LineFormatter - */ - protected function getDefaultFormatter() - { - return new LineFormatter(null, null, true, true); - } - - /** - * Get the event dispatcher instance. - * - * @return \Illuminate\Contracts\Events\Dispatcher - */ - public function getEventDispatcher() - { - return $this->dispatcher; - } - - /** - * Set the event dispatcher instance. - * - * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher - * @return void - */ - public function setEventDispatcher(Dispatcher $dispatcher) - { - $this->dispatcher = $dispatcher; - } - +class Writer implements LogContract, PsrLoggerInterface +{ + /** + * The Monolog logger instance. + * + * @var \Monolog\Logger + */ + protected $monolog; + + /** + * The event dispatcher instance. + * + * @var \Illuminate\Contracts\Events\Dispatcher + */ + protected $dispatcher; + + /** + * The Log levels. + * + * @var array + */ + protected $levels = [ + 'debug' => MonologLogger::DEBUG, + 'info' => MonologLogger::INFO, + 'notice' => MonologLogger::NOTICE, + 'warning' => MonologLogger::WARNING, + 'error' => MonologLogger::ERROR, + 'critical' => MonologLogger::CRITICAL, + 'alert' => MonologLogger::ALERT, + 'emergency' => MonologLogger::EMERGENCY, + ]; + + /** + * Create a new log writer instance. + * + * @param \Monolog\Logger $monolog + * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher + * @return void + */ + public function __construct(MonologLogger $monolog, Dispatcher $dispatcher = null) + { + $this->monolog = $monolog; + + if (isset($dispatcher)) { + $this->dispatcher = $dispatcher; + } + } + + /** + * Log an emergency message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function emergency($message, array $context = []) + { + return $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log an alert message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function alert($message, array $context = []) + { + return $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a critical message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function critical($message, array $context = []) + { + return $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log an error message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function error($message, array $context = []) + { + return $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a warning message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function warning($message, array $context = []) + { + return $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a notice to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function notice($message, array $context = []) + { + return $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log an informational message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function info($message, array $context = []) + { + return $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a debug message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function debug($message, array $context = []) + { + return $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a message to the logs. + * + * @param string $level + * @param string $message + * @param array $context + * @return void + */ + public function log($level, $message, array $context = []) + { + return $this->writeLog($level, $message, $context); + } + + /** + * Dynamically pass log calls into the writer. + * + * @param string $level + * @param string $message + * @param array $context + * @return void + */ + public function write($level, $message, array $context = []) + { + return $this->writeLog($level, $message, $context); + } + + /** + * Write a message to Monolog. + * + * @param string $level + * @param string $message + * @param array $context + * @return void + */ + protected function writeLog($level, $message, $context) + { + $this->fireLogEvent($level, $message = $this->formatMessage($message), $context); + + $this->monolog->{$level}($message, $context); + } + + /** + * Register a file log handler. + * + * @param string $path + * @param string $level + * @return void + */ + public function useFiles($path, $level = 'debug') + { + $this->monolog->pushHandler($handler = new StreamHandler($path, $this->parseLevel($level))); + + $handler->setFormatter($this->getDefaultFormatter()); + } + + /** + * Register a daily file log handler. + * + * @param string $path + * @param int $days + * @param string $level + * @return void + */ + public function useDailyFiles($path, $days = 0, $level = 'debug') + { + $this->monolog->pushHandler( + $handler = new RotatingFileHandler($path, $days, $this->parseLevel($level)) + ); + + $handler->setFormatter($this->getDefaultFormatter()); + } + + /** + * Register a Syslog handler. + * + * @param string $name + * @param string $level + * @return \Psr\Log\LoggerInterface + */ + public function useSyslog($name = 'laravel', $level = 'debug') + { + return $this->monolog->pushHandler(new SyslogHandler($name, LOG_USER, $level)); + } + + /** + * Register an error_log handler. + * + * @param string $level + * @param int $messageType + * @return void + */ + public function useErrorLog($level = 'debug', $messageType = ErrorLogHandler::OPERATING_SYSTEM) + { + $this->monolog->pushHandler( + $handler = new ErrorLogHandler($messageType, $this->parseLevel($level)) + ); + + $handler->setFormatter($this->getDefaultFormatter()); + } + + /** + * Register a new callback handler for when a log event is triggered. + * + * @param \Closure $callback + * @return void + * + * @throws \RuntimeException + */ + public function listen(Closure $callback) + { + if (! isset($this->dispatcher)) { + throw new RuntimeException('Events dispatcher has not been set.'); + } + + $this->dispatcher->listen('illuminate.log', $callback); + } + + /** + * Fires a log event. + * + * @param string $level + * @param string $message + * @param array $context + * @return void + */ + protected function fireLogEvent($level, $message, array $context = []) + { + // If the event dispatcher is set, we will pass along the parameters to the + // log listeners. These are useful for building profilers or other tools + // that aggregate all of the log messages for a given "request" cycle. + if (isset($this->dispatcher)) { + $this->dispatcher->fire('illuminate.log', compact('level', 'message', 'context')); + } + } + + /** + * Format the parameters for the logger. + * + * @param mixed $message + * @return mixed + */ + protected function formatMessage($message) + { + if (is_array($message)) { + return var_export($message, true); + } elseif ($message instanceof Jsonable) { + return $message->toJson(); + } elseif ($message instanceof Arrayable) { + return var_export($message->toArray(), true); + } + + return $message; + } + + /** + * Parse the string level into a Monolog constant. + * + * @param string $level + * @return int + * + * @throws \InvalidArgumentException + */ + protected function parseLevel($level) + { + if (isset($this->levels[$level])) { + return $this->levels[$level]; + } + + throw new InvalidArgumentException('Invalid log level.'); + } + + /** + * Get the underlying Monolog instance. + * + * @return \Monolog\Logger + */ + public function getMonolog() + { + return $this->monolog; + } + + /** + * Get a defaut Monolog formatter instance. + * + * @return \Monolog\Formatter\LineFormatter + */ + protected function getDefaultFormatter() + { + return new LineFormatter(null, null, true, true); + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getEventDispatcher() + { + return $this->dispatcher; + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher + * @return void + */ + public function setEventDispatcher(Dispatcher $dispatcher) + { + $this->dispatcher = $dispatcher; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Log/composer.json b/application/vendor/laravel/framework/src/Illuminate/Log/composer.json index 129511a..f5bfc36 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Log/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Log/composer.json @@ -14,9 +14,9 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*", + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*", "monolog/monolog": "~1.11" }, "autoload": { @@ -26,7 +26,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php index a33302e..afb5e4b 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php @@ -1,119 +1,120 @@ -app->singleton('mailer', function($app) - { - $this->registerSwiftMailer(); - - // Once we have create the mailer instance, we will set a container instance - // on the mailer. This allows us to resolve mailer classes via containers - // for maximum testability on said classes instead of passing Closures. - $mailer = new Mailer( - $app['view'], $app['swift.mailer'], $app['events'] - ); - - $this->setMailerDependencies($mailer, $app); - - // If a "from" address is set, we will set it on the mailer so that all mail - // messages sent by the applications will utilize the same "from" address - // on each one, which makes the developer's life a lot more convenient. - $from = $app['config']['mail.from']; - - if (is_array($from) && isset($from['address'])) - { - $mailer->alwaysFrom($from['address'], $from['name']); - } - - // Here we will determine if the mailer should be in "pretend" mode for this - // environment, which will simply write out e-mail to the logs instead of - // sending it over the web, which is useful for local dev environments. - $pretend = $app['config']->get('mail.pretend', false); - - $mailer->pretend($pretend); - - return $mailer; - }); - } - - /** - * Set a few dependencies on the mailer instance. - * - * @param \Illuminate\Mail\Mailer $mailer - * @param \Illuminate\Foundation\Application $app - * @return void - */ - protected function setMailerDependencies($mailer, $app) - { - $mailer->setContainer($app); - - if ($app->bound('Psr\Log\LoggerInterface')) - { - $mailer->setLogger($app->make('Psr\Log\LoggerInterface')); - } - - if ($app->bound('queue')) - { - $mailer->setQueue($app['queue.connection']); - } - } - - /** - * Register the Swift Mailer instance. - * - * @return void - */ - public function registerSwiftMailer() - { - $this->registerSwiftTransport(); - - // Once we have the transporter registered, we will register the actual Swift - // mailer instance, passing in the transport instances, which allows us to - // override this transporter instances during app start-up if necessary. - $this->app['swift.mailer'] = $this->app->share(function($app) - { - return new Swift_Mailer($app['swift.transport']->driver()); - }); - } - - /** - * Register the Swift Transport instance. - * - * @return void - */ - protected function registerSwiftTransport() - { - $this->app['swift.transport'] = $this->app->share(function($app) - { - return new TransportManager($app); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return ['mailer', 'swift.mailer', 'swift.transport']; - } - +class MailServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerSwiftMailer(); + + $this->app->singleton('mailer', function ($app) { + // Once we have create the mailer instance, we will set a container instance + // on the mailer. This allows us to resolve mailer classes via containers + // for maximum testability on said classes instead of passing Closures. + $mailer = new Mailer( + $app['view'], $app['swift.mailer'], $app['events'] + ); + + $this->setMailerDependencies($mailer, $app); + + // If a "from" address is set, we will set it on the mailer so that all mail + // messages sent by the applications will utilize the same "from" address + // on each one, which makes the developer's life a lot more convenient. + $from = $app['config']['mail.from']; + + if (is_array($from) && isset($from['address'])) { + $mailer->alwaysFrom($from['address'], $from['name']); + } + + $to = $app['config']['mail.to']; + + if (is_array($to) && isset($to['address'])) { + $mailer->alwaysTo($to['address'], $to['name']); + } + + // Here we will determine if the mailer should be in "pretend" mode for this + // environment, which will simply write out e-mail to the logs instead of + // sending it over the web, which is useful for local dev environments. + $pretend = $app['config']->get('mail.pretend', false); + + $mailer->pretend($pretend); + + return $mailer; + }); + } + + /** + * Set a few dependencies on the mailer instance. + * + * @param \Illuminate\Mail\Mailer $mailer + * @param \Illuminate\Foundation\Application $app + * @return void + */ + protected function setMailerDependencies($mailer, $app) + { + $mailer->setContainer($app); + + if ($app->bound('Psr\Log\LoggerInterface')) { + $mailer->setLogger($app->make('Psr\Log\LoggerInterface')); + } + + if ($app->bound('queue')) { + $mailer->setQueue($app['queue.connection']); + } + } + + /** + * Register the Swift Mailer instance. + * + * @return void + */ + public function registerSwiftMailer() + { + $this->registerSwiftTransport(); + + // Once we have the transporter registered, we will register the actual Swift + // mailer instance, passing in the transport instances, which allows us to + // override this transporter instances during app start-up if necessary. + $this->app['swift.mailer'] = $this->app->share(function ($app) { + return new Swift_Mailer($app['swift.transport']->driver()); + }); + } + + /** + * Register the Swift Transport instance. + * + * @return void + */ + protected function registerSwiftTransport() + { + $this->app['swift.transport'] = $this->app->share(function ($app) { + return new TransportManager($app); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['mailer', 'swift.mailer', 'swift.transport']; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php b/application/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php index 9a26df8..1292a97 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php +++ b/application/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php @@ -1,10 +1,14 @@ -views = $views; - $this->swift = $swift; - $this->events = $events; - } - - /** - * Set the global from address and name. - * - * @param string $address - * @param string $name - * @return void - */ - public function alwaysFrom($address, $name = null) - { - $this->from = compact('address', 'name'); - } - - /** - * Send a new message when only a raw text part. - * - * @param string $text - * @param mixed $callback - * @return int - */ - public function raw($text, $callback) - { - return $this->send(array('raw' => $text), [], $callback); - } - - /** - * Send a new message when only a plain part. - * - * @param string $view - * @param array $data - * @param mixed $callback - * @return int - */ - public function plain($view, array $data, $callback) - { - return $this->send(array('text' => $view), $data, $callback); - } - - /** - * Send a new message using a view. - * - * @param string|array $view - * @param array $data - * @param \Closure|string $callback - * @return mixed - */ - public function send($view, array $data, $callback) - { - $this->forceReconnection(); - - // First we need to parse the view, which could either be a string or an array - // containing both an HTML and plain text versions of the view which should - // be used when sending an e-mail. We will extract both of them out here. - list($view, $plain, $raw) = $this->parseView($view); - - $data['message'] = $message = $this->createMessage(); - - $this->callMessageBuilder($callback, $message); - - // Once we have retrieved the view content for the e-mail we will set the body - // of this message using the HTML type, which will provide a simple wrapper - // to creating view based emails that are able to receive arrays of data. - $this->addContent($message, $view, $plain, $raw, $data); - - $message = $message->getSwiftMessage(); - - return $this->sendSwiftMessage($message); - } - - /** - * Queue a new e-mail message for sending. - * - * @param string|array $view - * @param array $data - * @param \Closure|string $callback - * @param string $queue - * @return mixed - */ - public function queue($view, array $data, $callback, $queue = null) - { - $callback = $this->buildQueueCallable($callback); - - return $this->queue->push('mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue); - } - - /** - * Queue a new e-mail message for sending on the given queue. - * - * @param string $queue - * @param string|array $view - * @param array $data - * @param \Closure|string $callback - * @return mixed - */ - public function queueOn($queue, $view, array $data, $callback) - { - return $this->queue($view, $data, $callback, $queue); - } - - /** - * Queue a new e-mail message for sending after (n) seconds. - * - * @param int $delay - * @param string|array $view - * @param array $data - * @param \Closure|string $callback - * @param string $queue - * @return mixed - */ - public function later($delay, $view, array $data, $callback, $queue = null) - { - $callback = $this->buildQueueCallable($callback); - - return $this->queue->later($delay, 'mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue); - } - - /** - * Queue a new e-mail message for sending after (n) seconds on the given queue. - * - * @param string $queue - * @param int $delay - * @param string|array $view - * @param array $data - * @param \Closure|string $callback - * @return mixed - */ - public function laterOn($queue, $delay, $view, array $data, $callback) - { - return $this->later($delay, $view, $data, $callback, $queue); - } - - /** - * Build the callable for a queued e-mail job. - * - * @param mixed $callback - * @return mixed - */ - protected function buildQueueCallable($callback) - { - if ( ! $callback instanceof Closure) return $callback; - - return (new Serializer)->serialize($callback); - } - - /** - * Handle a queued e-mail message job. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param array $data - * @return void - */ - public function handleQueuedMessage($job, $data) - { - $this->send($data['view'], $data['data'], $this->getQueuedCallable($data)); - - $job->delete(); - } - - /** - * Get the true callable for a queued e-mail message. - * - * @param array $data - * @return mixed - */ - protected function getQueuedCallable(array $data) - { - if (str_contains($data['callback'], 'SerializableClosure')) - { - return unserialize($data['callback'])->getClosure(); - } - - return $data['callback']; - } - - /** - * Force the transport to re-connect. - * - * This will prevent errors in daemon queue situations. - * - * @return void - */ - protected function forceReconnection() - { - $this->getSwiftMailer()->getTransport()->stop(); - } - - /** - * Add the content to a given message. - * - * @param \Illuminate\Mail\Message $message - * @param string $view - * @param string $plain - * @param string $raw - * @param array $data - * @return void - */ - protected function addContent($message, $view, $plain, $raw, $data) - { - if (isset($view)) - { - $message->setBody($this->getView($view, $data), 'text/html'); - } - - if (isset($plain)) - { - $message->addPart($this->getView($plain, $data), 'text/plain'); - } - - if (isset($raw)) - { - $message->addPart($raw, 'text/plain'); - } - } - - /** - * Parse the given view name or array. - * - * @param string|array $view - * @return array - * - * @throws \InvalidArgumentException - */ - protected function parseView($view) - { - if (is_string($view)) return [$view, null, null]; - - // If the given view is an array with numeric keys, we will just assume that - // both a "pretty" and "plain" view were provided, so we will return this - // array as is, since must should contain both views with numeric keys. - if (is_array($view) && isset($view[0])) - { - return [$view[0], $view[1], null]; - } - - // If the view is an array, but doesn't contain numeric keys, we will assume - // the the views are being explicitly specified and will extract them via - // named keys instead, allowing the developers to use one or the other. - elseif (is_array($view)) - { - return [ - array_get($view, 'html'), - array_get($view, 'text'), - array_get($view, 'raw'), - ]; - } - - throw new InvalidArgumentException("Invalid view."); - } - - /** - * Send a Swift Message instance. - * - * @param \Swift_Message $message - * @return void - */ - protected function sendSwiftMessage($message) - { - if ($this->events) - { - $this->events->fire('mailer.sending', array($message)); - } - - if ( ! $this->pretending) - { - return $this->swift->send($message, $this->failedRecipients); - } - elseif (isset($this->logger)) - { - $this->logMessage($message); - } - } - - /** - * Log that a message was sent. - * - * @param \Swift_Message $message - * @return void - */ - protected function logMessage($message) - { - $emails = implode(', ', array_keys((array) $message->getTo())); - - $this->logger->info("Pretending to mail message to: {$emails}"); - } - - /** - * Call the provided message builder. - * - * @param \Closure|string $callback - * @param \Illuminate\Mail\Message $message - * @return mixed - * - * @throws \InvalidArgumentException - */ - protected function callMessageBuilder($callback, $message) - { - if ($callback instanceof Closure) - { - return call_user_func($callback, $message); - } - elseif (is_string($callback)) - { - return $this->container->make($callback)->mail($message); - } - - throw new InvalidArgumentException("Callback is not valid."); - } - - /** - * Create a new message instance. - * - * @return \Illuminate\Mail\Message - */ - protected function createMessage() - { - $message = new Message(new Swift_Message); - - // If a global from address has been specified we will set it on every message - // instances so the developer does not have to repeat themselves every time - // they create a new message. We will just go ahead and push the address. - if (! empty($this->from['address'])) - { - $message->from($this->from['address'], $this->from['name']); - } - - return $message; - } - - /** - * Render the given view. - * - * @param string $view - * @param array $data - * @return \Illuminate\View\View - */ - protected function getView($view, $data) - { - return $this->views->make($view, $data)->render(); - } - - /** - * Tell the mailer to not really send messages. - * - * @param bool $value - * @return void - */ - public function pretend($value = true) - { - $this->pretending = $value; - } - - /** - * Check if the mailer is pretending to send messages. - * - * @return bool - */ - public function isPretending() - { - return $this->pretending; - } - - /** - * Get the view factory instance. - * - * @return \Illuminate\Contracts\View\Factory - */ - public function getViewFactory() - { - return $this->views; - } - - /** - * Get the Swift Mailer instance. - * - * @return \Swift_Mailer - */ - public function getSwiftMailer() - { - return $this->swift; - } - - /** - * Get the array of failed recipients. - * - * @return array - */ - public function failures() - { - return $this->failedRecipients; - } - - /** - * Set the Swift Mailer instance. - * - * @param \Swift_Mailer $swift - * @return void - */ - public function setSwiftMailer($swift) - { - $this->swift = $swift; - } - - /** - * Set the log writer instance. - * - * @param \Psr\Log\LoggerInterface $logger - * @return $this - */ - public function setLogger(LoggerInterface $logger) - { - $this->logger = $logger; - - return $this; - } - - /** - * Set the queue manager instance. - * - * @param \Illuminate\Contracts\Queue\Queue $queue - * @return $this - */ - public function setQueue(QueueContract $queue) - { - $this->queue = $queue; - - return $this; - } - - /** - * Set the IoC container instance. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - public function setContainer(Container $container) - { - $this->container = $container; - } - +class Mailer implements MailerContract, MailQueueContract +{ + /** + * The view factory instance. + * + * @var \Illuminate\Contracts\View\Factory + */ + protected $views; + + /** + * The Swift Mailer instance. + * + * @var \Swift_Mailer + */ + protected $swift; + + /** + * The event dispatcher instance. + * + * @var \Illuminate\Contracts\Events\Dispatcher|null + */ + protected $events; + + /** + * The global from address and name. + * + * @var array + */ + protected $from; + + /** + * The log writer instance. + * + * @var \Psr\Log\LoggerInterface + */ + protected $logger; + + /** + * The IoC container instance. + * + * @var \Illuminate\Contracts\Container\Container + */ + protected $container; + + /** + * The queue implementation. + * + * @var \Illuminate\Contracts\Queue\Queue + */ + protected $queue; + + /** + * Indicates if the actual sending is disabled. + * + * @var bool + */ + protected $pretending = false; + + /** + * Array of failed recipients. + * + * @var array + */ + protected $failedRecipients = []; + + /** + * Create a new Mailer instance. + * + * @param \Illuminate\Contracts\View\Factory $views + * @param \Swift_Mailer $swift + * @param \Illuminate\Contracts\Events\Dispatcher|null $events + * @return void + */ + public function __construct(Factory $views, Swift_Mailer $swift, Dispatcher $events = null) + { + $this->views = $views; + $this->swift = $swift; + $this->events = $events; + } + + /** + * Set the global from address and name. + * + * @param string $address + * @param string|null $name + * @return void + */ + public function alwaysFrom($address, $name = null) + { + $this->from = compact('address', 'name'); + } + + /** + * Set the global to address and name. + * + * @param string $address + * @param string|null $name + * @return void + */ + public function alwaysTo($address, $name = null) + { + $this->to = compact('address', 'name'); + } + + /** + * Send a new message when only a raw text part. + * + * @param string $text + * @param mixed $callback + * @return int + */ + public function raw($text, $callback) + { + return $this->send(['raw' => $text], [], $callback); + } + + /** + * Send a new message when only a plain part. + * + * @param string $view + * @param array $data + * @param mixed $callback + * @return int + */ + public function plain($view, array $data, $callback) + { + return $this->send(['text' => $view], $data, $callback); + } + + /** + * Send a new message using a view. + * + * @param string|array $view + * @param array $data + * @param \Closure|string $callback + * @return void + */ + public function send($view, array $data, $callback) + { + // First we need to parse the view, which could either be a string or an array + // containing both an HTML and plain text versions of the view which should + // be used when sending an e-mail. We will extract both of them out here. + list($view, $plain, $raw) = $this->parseView($view); + + $data['message'] = $message = $this->createMessage(); + + // Once we have retrieved the view content for the e-mail we will set the body + // of this message using the HTML type, which will provide a simple wrapper + // to creating view based emails that are able to receive arrays of data. + $this->addContent($message, $view, $plain, $raw, $data); + + $this->callMessageBuilder($callback, $message); + + if (isset($this->to['address'])) { + $message->to($this->to['address'], $this->to['name'], true); + } + + $message = $message->getSwiftMessage(); + + return $this->sendSwiftMessage($message); + } + + /** + * Queue a new e-mail message for sending. + * + * @param string|array $view + * @param array $data + * @param \Closure|string $callback + * @param string|null $queue + * @return mixed + */ + public function queue($view, array $data, $callback, $queue = null) + { + $callback = $this->buildQueueCallable($callback); + + return $this->queue->push('mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue); + } + + /** + * Queue a new e-mail message for sending on the given queue. + * + * @param string $queue + * @param string|array $view + * @param array $data + * @param \Closure|string $callback + * @return mixed + */ + public function onQueue($queue, $view, array $data, $callback) + { + return $this->queue($view, $data, $callback, $queue); + } + + /** + * Queue a new e-mail message for sending on the given queue. + * + * This method didn't match rest of framework's "onQueue" phrasing. Added "onQueue". + * + * @param string $queue + * @param string|array $view + * @param array $data + * @param \Closure|string $callback + * @return mixed + */ + public function queueOn($queue, $view, array $data, $callback) + { + return $this->onQueue($queue, $view, $data, $callback); + } + + /** + * Queue a new e-mail message for sending after (n) seconds. + * + * @param int $delay + * @param string|array $view + * @param array $data + * @param \Closure|string $callback + * @param string|null $queue + * @return mixed + */ + public function later($delay, $view, array $data, $callback, $queue = null) + { + $callback = $this->buildQueueCallable($callback); + + return $this->queue->later($delay, 'mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue); + } + + /** + * Queue a new e-mail message for sending after (n) seconds on the given queue. + * + * @param string $queue + * @param int $delay + * @param string|array $view + * @param array $data + * @param \Closure|string $callback + * @return mixed + */ + public function laterOn($queue, $delay, $view, array $data, $callback) + { + return $this->later($delay, $view, $data, $callback, $queue); + } + + /** + * Build the callable for a queued e-mail job. + * + * @param mixed $callback + * @return mixed + */ + protected function buildQueueCallable($callback) + { + if (! $callback instanceof Closure) { + return $callback; + } + + return (new Serializer)->serialize($callback); + } + + /** + * Handle a queued e-mail message job. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param array $data + * @return void + */ + public function handleQueuedMessage($job, $data) + { + $this->send($data['view'], $data['data'], $this->getQueuedCallable($data)); + + $job->delete(); + } + + /** + * Get the true callable for a queued e-mail message. + * + * @param array $data + * @return mixed + */ + protected function getQueuedCallable(array $data) + { + if (Str::contains($data['callback'], 'SerializableClosure')) { + return unserialize($data['callback'])->getClosure(); + } + + return $data['callback']; + } + + /** + * Force the transport to re-connect. + * + * This will prevent errors in daemon queue situations. + * + * @return void + */ + protected function forceReconnection() + { + $this->getSwiftMailer()->getTransport()->stop(); + } + + /** + * Add the content to a given message. + * + * @param \Illuminate\Mail\Message $message + * @param string $view + * @param string $plain + * @param string $raw + * @param array $data + * @return void + */ + protected function addContent($message, $view, $plain, $raw, $data) + { + if (isset($view)) { + $message->setBody($this->getView($view, $data), 'text/html'); + } + + if (isset($plain)) { + $method = isset($view) ? 'addPart' : 'setBody'; + + $message->$method($this->getView($plain, $data), 'text/plain'); + } + + if (isset($raw)) { + $method = (isset($view) || isset($plain)) ? 'addPart' : 'setBody'; + + $message->$method($raw, 'text/plain'); + } + } + + /** + * Parse the given view name or array. + * + * @param string|array $view + * @return array + * + * @throws \InvalidArgumentException + */ + protected function parseView($view) + { + if (is_string($view)) { + return [$view, null, null]; + } + + // If the given view is an array with numeric keys, we will just assume that + // both a "pretty" and "plain" view were provided, so we will return this + // array as is, since must should contain both views with numeric keys. + if (is_array($view) && isset($view[0])) { + return [$view[0], $view[1], null]; + } + + // If the view is an array, but doesn't contain numeric keys, we will assume + // the the views are being explicitly specified and will extract them via + // named keys instead, allowing the developers to use one or the other. + if (is_array($view)) { + return [ + Arr::get($view, 'html'), + Arr::get($view, 'text'), + Arr::get($view, 'raw'), + ]; + } + + throw new InvalidArgumentException('Invalid view.'); + } + + /** + * Send a Swift Message instance. + * + * @param \Swift_Message $message + * @return void + */ + protected function sendSwiftMessage($message) + { + if ($this->events) { + $this->events->fire('mailer.sending', [$message]); + } + + if (! $this->pretending) { + try { + return $this->swift->send($message, $this->failedRecipients); + } finally { + $this->swift->getTransport()->stop(); + } + } elseif (isset($this->logger)) { + $this->logMessage($message); + } + } + + /** + * Log that a message was sent. + * + * @param \Swift_Message $message + * @return void + */ + protected function logMessage($message) + { + $emails = implode(', ', array_keys((array) $message->getTo())); + + $this->logger->info("Pretending to mail message to: {$emails}"); + } + + /** + * Call the provided message builder. + * + * @param \Closure|string $callback + * @param \Illuminate\Mail\Message $message + * @return mixed + * + * @throws \InvalidArgumentException + */ + protected function callMessageBuilder($callback, $message) + { + if ($callback instanceof Closure) { + return call_user_func($callback, $message); + } + + if (is_string($callback)) { + return $this->container->make($callback)->mail($message); + } + + throw new InvalidArgumentException('Callback is not valid.'); + } + + /** + * Create a new message instance. + * + * @return \Illuminate\Mail\Message + */ + protected function createMessage() + { + $message = new Message(new Swift_Message); + + // If a global from address has been specified we will set it on every message + // instances so the developer does not have to repeat themselves every time + // they create a new message. We will just go ahead and push the address. + if (! empty($this->from['address'])) { + $message->from($this->from['address'], $this->from['name']); + } + + return $message; + } + + /** + * Render the given view. + * + * @param string $view + * @param array $data + * @return \Illuminate\View\View + */ + protected function getView($view, $data) + { + return $this->views->make($view, $data)->render(); + } + + /** + * Tell the mailer to not really send messages. + * + * @param bool $value + * @return void + */ + public function pretend($value = true) + { + $this->pretending = $value; + } + + /** + * Check if the mailer is pretending to send messages. + * + * @return bool + */ + public function isPretending() + { + return $this->pretending; + } + + /** + * Get the view factory instance. + * + * @return \Illuminate\Contracts\View\Factory + */ + public function getViewFactory() + { + return $this->views; + } + + /** + * Get the Swift Mailer instance. + * + * @return \Swift_Mailer + */ + public function getSwiftMailer() + { + return $this->swift; + } + + /** + * Get the array of failed recipients. + * + * @return array + */ + public function failures() + { + return $this->failedRecipients; + } + + /** + * Set the Swift Mailer instance. + * + * @param \Swift_Mailer $swift + * @return void + */ + public function setSwiftMailer($swift) + { + $this->swift = $swift; + } + + /** + * Set the log writer instance. + * + * @param \Psr\Log\LoggerInterface $logger + * @return $this + */ + public function setLogger(LoggerInterface $logger) + { + $this->logger = $logger; + + return $this; + } + + /** + * Set the queue manager instance. + * + * @param \Illuminate\Contracts\Queue\Queue $queue + * @return $this + */ + public function setQueue(QueueContract $queue) + { + $this->queue = $queue; + + return $this; + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function setContainer(Container $container) + { + $this->container = $container; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Mail/Message.php b/application/vendor/laravel/framework/src/Illuminate/Mail/Message.php index 4085571..5dd1fa2 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Mail/Message.php +++ b/application/vendor/laravel/framework/src/Illuminate/Mail/Message.php @@ -1,295 +1,296 @@ -swift = $swift; - } - - /** - * Add a "from" address to the message. - * - * @param string $address - * @param string $name - * @return $this - */ - public function from($address, $name = null) - { - $this->swift->setFrom($address, $name); - - return $this; - } - - /** - * Set the "sender" of the message. - * - * @param string $address - * @param string $name - * @return $this - */ - public function sender($address, $name = null) - { - $this->swift->setSender($address, $name); - - return $this; - } - - /** - * Set the "return path" of the message. - * - * @param string $address - * @return $this - */ - public function returnPath($address) - { - $this->swift->setReturnPath($address); - - return $this; - } - - /** - * Add a recipient to the message. - * - * @param string|array $address - * @param string $name - * @return $this - */ - public function to($address, $name = null) - { - return $this->addAddresses($address, $name, 'To'); - } - - /** - * Add a carbon copy to the message. - * - * @param string $address - * @param string $name - * @return $this - */ - public function cc($address, $name = null) - { - return $this->addAddresses($address, $name, 'Cc'); - } - - /** - * Add a blind carbon copy to the message. - * - * @param string $address - * @param string $name - * @return $this - */ - public function bcc($address, $name = null) - { - return $this->addAddresses($address, $name, 'Bcc'); - } - - /** - * Add a reply to address to the message. - * - * @param string $address - * @param string $name - * @return $this - */ - public function replyTo($address, $name = null) - { - return $this->addAddresses($address, $name, 'ReplyTo'); - } - - /** - * Add a recipient to the message. - * - * @param string|array $address - * @param string $name - * @param string $type - * @return $this - */ - protected function addAddresses($address, $name, $type) - { - if (is_array($address)) - { - $this->swift->{"set{$type}"}($address, $name); - } - else - { - $this->swift->{"add{$type}"}($address, $name); - } - - return $this; - } - - /** - * Set the subject of the message. - * - * @param string $subject - * @return $this - */ - public function subject($subject) - { - $this->swift->setSubject($subject); - - return $this; - } - - /** - * Set the message priority level. - * - * @param int $level - * @return $this - */ - public function priority($level) - { - $this->swift->setPriority($level); - - return $this; - } - - /** - * Attach a file to the message. - * - * @param string $file - * @param array $options - * @return $this - */ - public function attach($file, array $options = array()) - { - $attachment = $this->createAttachmentFromPath($file); - - return $this->prepAttachment($attachment, $options); - } - - /** - * Create a Swift Attachment instance. - * - * @param string $file - * @return \Swift_Attachment - */ - protected function createAttachmentFromPath($file) - { - return Swift_Attachment::fromPath($file); - } - - /** - * Attach in-memory data as an attachment. - * - * @param string $data - * @param string $name - * @param array $options - * @return $this - */ - public function attachData($data, $name, array $options = array()) - { - $attachment = $this->createAttachmentFromData($data, $name); - - return $this->prepAttachment($attachment, $options); - } - - /** - * Create a Swift Attachment instance from data. - * - * @param string $data - * @param string $name - * @return \Swift_Attachment - */ - protected function createAttachmentFromData($data, $name) - { - return Swift_Attachment::newInstance($data, $name); - } - - /** - * Embed a file in the message and get the CID. - * - * @param string $file - * @return string - */ - public function embed($file) - { - return $this->swift->embed(Swift_Image::fromPath($file)); - } - - /** - * Embed in-memory data in the message and get the CID. - * - * @param string $data - * @param string $name - * @param string $contentType - * @return string - */ - public function embedData($data, $name, $contentType = null) - { - $image = Swift_Image::newInstance($data, $name, $contentType); - - return $this->swift->embed($image); - } - - /** - * Prepare and attach the given attachment. - * - * @param \Swift_Attachment $attachment - * @param array $options - * @return $this - */ - protected function prepAttachment($attachment, $options = array()) - { - // First we will check for a MIME type on the message, which instructs the - // mail client on what type of attachment the file is so that it may be - // downloaded correctly by the user. The MIME option is not required. - if (isset($options['mime'])) - { - $attachment->setContentType($options['mime']); - } - - // If an alternative name was given as an option, we will set that on this - // attachment so that it will be downloaded with the desired names from - // the developer, otherwise the default file names will get assigned. - if (isset($options['as'])) - { - $attachment->setFilename($options['as']); - } - - $this->swift->attach($attachment); - - return $this; - } - - /** - * Get the underlying Swift Message instance. - * - * @return \Swift_Message - */ - public function getSwiftMessage() - { - return $this->swift; - } - - /** - * Dynamically pass missing methods to the Swift instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - $callable = array($this->swift, $method); - - return call_user_func_array($callable, $parameters); - } - +class Message +{ + /** + * The Swift Message instance. + * + * @var \Swift_Message + */ + protected $swift; + + /** + * Create a new message instance. + * + * @param \Swift_Message $swift + * @return void + */ + public function __construct($swift) + { + $this->swift = $swift; + } + + /** + * Add a "from" address to the message. + * + * @param string $address + * @param string|null $name + * @return $this + */ + public function from($address, $name = null) + { + $this->swift->setFrom($address, $name); + + return $this; + } + + /** + * Set the "sender" of the message. + * + * @param string $address + * @param string|null $name + * @return $this + */ + public function sender($address, $name = null) + { + $this->swift->setSender($address, $name); + + return $this; + } + + /** + * Set the "return path" of the message. + * + * @param string $address + * @return $this + */ + public function returnPath($address) + { + $this->swift->setReturnPath($address); + + return $this; + } + + /** + * Add a recipient to the message. + * + * @param string|array $address + * @param string|null $name + * @param bool $override + * @return $this + */ + public function to($address, $name = null, $override = false) + { + if ($override) { + return $this->swift->setTo($address, $name); + } + + return $this->addAddresses($address, $name, 'To'); + } + + /** + * Add a carbon copy to the message. + * + * @param string|array $address + * @param string|null $name + * @return $this + */ + public function cc($address, $name = null) + { + return $this->addAddresses($address, $name, 'Cc'); + } + + /** + * Add a blind carbon copy to the message. + * + * @param string|array $address + * @param string|null $name + * @return $this + */ + public function bcc($address, $name = null) + { + return $this->addAddresses($address, $name, 'Bcc'); + } + + /** + * Add a reply to address to the message. + * + * @param string $address + * @param string|null $name + * @return $this + */ + public function replyTo($address, $name = null) + { + return $this->addAddresses($address, $name, 'ReplyTo'); + } + + /** + * Add a recipient to the message. + * + * @param string|array $address + * @param string $name + * @param string $type + * @return $this + */ + protected function addAddresses($address, $name, $type) + { + if (is_array($address)) { + $this->swift->{"set{$type}"}($address, $name); + } else { + $this->swift->{"add{$type}"}($address, $name); + } + + return $this; + } + + /** + * Set the subject of the message. + * + * @param string $subject + * @return $this + */ + public function subject($subject) + { + $this->swift->setSubject($subject); + + return $this; + } + + /** + * Set the message priority level. + * + * @param int $level + * @return $this + */ + public function priority($level) + { + $this->swift->setPriority($level); + + return $this; + } + + /** + * Attach a file to the message. + * + * @param string $file + * @param array $options + * @return $this + */ + public function attach($file, array $options = []) + { + $attachment = $this->createAttachmentFromPath($file); + + return $this->prepAttachment($attachment, $options); + } + + /** + * Create a Swift Attachment instance. + * + * @param string $file + * @return \Swift_Attachment + */ + protected function createAttachmentFromPath($file) + { + return Swift_Attachment::fromPath($file); + } + + /** + * Attach in-memory data as an attachment. + * + * @param string $data + * @param string $name + * @param array $options + * @return $this + */ + public function attachData($data, $name, array $options = []) + { + $attachment = $this->createAttachmentFromData($data, $name); + + return $this->prepAttachment($attachment, $options); + } + + /** + * Create a Swift Attachment instance from data. + * + * @param string $data + * @param string $name + * @return \Swift_Attachment + */ + protected function createAttachmentFromData($data, $name) + { + return Swift_Attachment::newInstance($data, $name); + } + + /** + * Embed a file in the message and get the CID. + * + * @param string $file + * @return string + */ + public function embed($file) + { + return $this->swift->embed(Swift_Image::fromPath($file)); + } + + /** + * Embed in-memory data in the message and get the CID. + * + * @param string $data + * @param string $name + * @param string|null $contentType + * @return string + */ + public function embedData($data, $name, $contentType = null) + { + $image = Swift_Image::newInstance($data, $name, $contentType); + + return $this->swift->embed($image); + } + + /** + * Prepare and attach the given attachment. + * + * @param \Swift_Attachment $attachment + * @param array $options + * @return $this + */ + protected function prepAttachment($attachment, $options = []) + { + // First we will check for a MIME type on the message, which instructs the + // mail client on what type of attachment the file is so that it may be + // downloaded correctly by the user. The MIME option is not required. + if (isset($options['mime'])) { + $attachment->setContentType($options['mime']); + } + + // If an alternative name was given as an option, we will set that on this + // attachment so that it will be downloaded with the desired names from + // the developer, otherwise the default file names will get assigned. + if (isset($options['as'])) { + $attachment->setFilename($options['as']); + } + + $this->swift->attach($attachment); + + return $this; + } + + /** + * Get the underlying Swift Message instance. + * + * @return \Swift_Message + */ + public function getSwiftMessage() + { + return $this->swift; + } + + /** + * Dynamically pass missing methods to the Swift instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + $callable = [$this->swift, $method]; + + return call_user_func_array($callable, $parameters); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php b/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php index 1fe8136..9396d15 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php +++ b/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php @@ -1,87 +1,55 @@ -logger = $logger; - } - - /** - * {@inheritdoc} - */ - public function isStarted() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function start() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function stop() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function send(Swift_Mime_Message $message, &$failedRecipients = null) - { - $this->logger->debug($this->getMimeEntityString($message)); - } - - /** - * Get a loggable string out of a Swiftmailer entity. - * - * @param \Swift_Mime_MimeEntity $entity - * @return string - */ - protected function getMimeEntityString(Swift_Mime_MimeEntity $entity) - { - $string = (string) $entity->getHeaders().PHP_EOL.$entity->getBody(); - - foreach ($entity->getChildren() as $children) - { - $string .= PHP_EOL.PHP_EOL.$this->getMimeEntityString($children); - } - - return $string; - } - - /** - * {@inheritdoc} - */ - public function registerPlugin(Swift_Events_EventListener $plugin) - { - // - } +class LogTransport extends Transport +{ + /** + * The Logger instance. + * + * @var \Psr\Log\LoggerInterface + */ + protected $logger; + + /** + * Create a new log transport instance. + * + * @param \Psr\Log\LoggerInterface $logger + * @return void + */ + public function __construct(LoggerInterface $logger) + { + $this->logger = $logger; + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_Message $message, &$failedRecipients = null) + { + $this->beforeSendPerformed($message); + + $this->logger->debug($this->getMimeEntityString($message)); + } + + /** + * Get a loggable string out of a Swiftmailer entity. + * + * @param \Swift_Mime_MimeEntity $entity + * @return string + */ + protected function getMimeEntityString(Swift_Mime_MimeEntity $entity) + { + $string = (string) $entity->getHeaders().PHP_EOL.$entity->getBody(); + + foreach ($entity->getChildren() as $children) { + $string .= PHP_EOL.PHP_EOL.$this->getMimeEntityString($children); + } + + return $string; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php b/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php index a902639..d9f8704 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php +++ b/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php @@ -1,168 +1,146 @@ -key = $key; - $this->setDomain($domain); - } - - /** - * {@inheritdoc} - */ - public function isStarted() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function start() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function stop() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function send(Swift_Mime_Message $message, &$failedRecipients = null) - { - $client = $this->getHttpClient(); - - return $client->post($this->url, ['auth' => ['api', $this->key], - 'body' => [ - 'to' => $this->getTo($message), - 'message' => new PostFile('message', (string) $message), - ], - ]); - } - - /** - * {@inheritdoc} - */ - public function registerPlugin(Swift_Events_EventListener $plugin) - { - // - } - - /** - * Get the "to" payload field for the API request. - * - * @param \Swift_Mime_Message $message - * @return array - */ - protected function getTo(Swift_Mime_Message $message) - { - $formatted = []; - - $contacts = array_merge( - (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc() - ); - - foreach ($contacts as $address => $display) - { - $formatted[] = $display ? $display." <$address>" : $address; - } - - return implode(',', $formatted); - } - - /** - * Get a new HTTP client instance. - * - * @return \GuzzleHttp\Client - */ - protected function getHttpClient() - { - return new Client; - } - - /** - * Get the API key being used by the transport. - * - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * Set the API key being used by the transport. - * - * @param string $key - * @return void - */ - public function setKey($key) - { - return $this->key = $key; - } - - /** - * Get the domain being used by the transport. - * - * @return string - */ - public function getDomain() - { - return $this->domain; - } - - /** - * Set the domain being used by the transport. - * - * @param string $domain - * @return void - */ - public function setDomain($domain) - { - $this->url = 'https://api.mailgun.net/v2/'.$domain.'/messages.mime'; - - return $this->domain = $domain; - } - +use GuzzleHttp\ClientInterface; + +class MailgunTransport extends Transport +{ + /** + * Guzzle client instance. + * + * @var \GuzzleHttp\ClientInterface + */ + protected $client; + + /** + * The Mailgun API key. + * + * @var string + */ + protected $key; + + /** + * The Mailgun domain. + * + * @var string + */ + protected $domain; + + /** + * THe Mailgun API end-point. + * + * @var string + */ + protected $url; + + /** + * Create a new Mailgun transport instance. + * + * @param \GuzzleHttp\ClientInterface $client + * @param string $key + * @param string $domain + * @return void + */ + public function __construct(ClientInterface $client, $key, $domain) + { + $this->key = $key; + $this->client = $client; + $this->setDomain($domain); + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_Message $message, &$failedRecipients = null) + { + $this->beforeSendPerformed($message); + + $options = ['auth' => ['api', $this->key]]; + + $to = $this->getTo($message); + + $message->setBcc([]); + + if (version_compare(ClientInterface::VERSION, '6') === 1) { + $options['multipart'] = [ + ['name' => 'to', 'contents' => $to], + ['name' => 'message', 'contents' => $message->toString(), 'filename' => 'message.mime'], + ]; + } else { + $options['body'] = [ + 'to' => $to, + 'message' => new PostFile('message', $message->toString()), + ]; + } + + return $this->client->post($this->url, $options); + } + + /** + * Get the "to" payload field for the API request. + * + * @param \Swift_Mime_Message $message + * @return array + */ + protected function getTo(Swift_Mime_Message $message) + { + $formatted = []; + + $contacts = array_merge( + (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc() + ); + + foreach ($contacts as $address => $display) { + $formatted[] = $display ? $display." <$address>" : $address; + } + + return implode(',', $formatted); + } + + /** + * Get the API key being used by the transport. + * + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Set the API key being used by the transport. + * + * @param string $key + * @return string + */ + public function setKey($key) + { + return $this->key = $key; + } + + /** + * Get the domain being used by the transport. + * + * @return string + */ + public function getDomain() + { + return $this->domain; + } + + /** + * Set the domain being used by the transport. + * + * @param string $domain + * @return void + */ + public function setDomain($domain) + { + $this->url = 'https://api.mailgun.net/v3/'.$domain.'/messages.mime'; + + return $this->domain = $domain; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php b/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php index 809d96c..32f4e10 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php +++ b/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php @@ -1,138 +1,107 @@ -key = $key; - } - - /** - * {@inheritdoc} - */ - public function isStarted() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function start() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function stop() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function send(Swift_Mime_Message $message, &$failedRecipients = null) - { - $client = $this->getHttpClient(); - - return $client->post('https://mandrillapp.com/api/1.0/messages/send-raw.json', [ - 'body' => [ - 'key' => $this->key, - 'to' => $this->getToAddresses($message), - 'raw_message' => (string) $message, - 'async' => false, - ], - ]); - } - - /** - * Get all the addresses this message should be sent to. - * - * Note that Mandrill still respects CC, BCC headers in raw message itself. - * - * @param Swift_Mime_Message $message - * @return array - */ - protected function getToAddresses(Swift_Mime_Message $message) - { - $to = []; - - if ($message->getTo()) - { - $to = array_merge($to, array_keys($message->getTo())); - } - - if ($message->getCc()) - { - $to = array_merge($to, array_keys($message->getCc())); - } - - if ($message->getBcc()) - { - $to = array_merge($to, array_keys($message->getBcc())); - } - - return $to; - } - - /** - * {@inheritdoc} - */ - public function registerPlugin(Swift_Events_EventListener $plugin) - { - // - } - - /** - * Get a new HTTP client instance. - * - * @return \GuzzleHttp\Client - */ - protected function getHttpClient() - { - return new Client; - } - - /** - * Get the API key being used by the transport. - * - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * Set the API key being used by the transport. - * - * @param string $key - * @return void - */ - public function setKey($key) - { - return $this->key = $key; - } +namespace Illuminate\Mail\Transport; +use Swift_Mime_Message; +use GuzzleHttp\ClientInterface; + +class MandrillTransport extends Transport +{ + /** + * Guzzle client instance. + * + * @var \GuzzleHttp\ClientInterface + */ + protected $client; + + /** + * The Mandrill API key. + * + * @var string + */ + protected $key; + + /** + * Create a new Mandrill transport instance. + * + * @param \GuzzleHttp\ClientInterface $client + * @param string $key + * @return void + */ + public function __construct(ClientInterface $client, $key) + { + $this->client = $client; + $this->key = $key; + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_Message $message, &$failedRecipients = null) + { + $this->beforeSendPerformed($message); + + $data = [ + 'key' => $this->key, + 'to' => $this->getToAddresses($message), + 'raw_message' => $message->toString(), + 'async' => false, + ]; + + if (version_compare(ClientInterface::VERSION, '6') === 1) { + $options = ['form_params' => $data]; + } else { + $options = ['body' => $data]; + } + + return $this->client->post('https://mandrillapp.com/api/1.0/messages/send-raw.json', $options); + } + + /** + * Get all the addresses this message should be sent to. + * + * Note that Mandrill still respects CC, BCC headers in raw message itself. + * + * @param \Swift_Mime_Message $message + * @return array + */ + protected function getToAddresses(Swift_Mime_Message $message) + { + $to = []; + + if ($message->getTo()) { + $to = array_merge($to, array_keys($message->getTo())); + } + + if ($message->getCc()) { + $to = array_merge($to, array_keys($message->getCc())); + } + + if ($message->getBcc()) { + $to = array_merge($to, array_keys($message->getBcc())); + } + + return $to; + } + + /** + * Get the API key being used by the transport. + * + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Set the API key being used by the transport. + * + * @param string $key + * @return string + */ + public function setKey($key) + { + return $this->key = $key; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php b/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php index 118981a..63457ba 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php +++ b/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php @@ -1,96 +1,42 @@ -ses = $ses; - } - - /** - * {@inheritdoc} - */ - public function isStarted() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function start() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function stop() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function send(Swift_Mime_Message $message, &$failedRecipients = null) - { - return $this->ses->sendRawEmail([ - 'Source' => $message->getSender(), - 'Destinations' => $this->getTo($message), - 'RawMessage' => [ - 'Data' => base64_encode((string) $message), - ], - ]); - } - - /** - * {@inheritdoc} - */ - public function registerPlugin(Swift_Events_EventListener $plugin) - { - // - } - - /** - * Get the "to" payload field for the API request. - * - * @param \Swift_Mime_Message $message - * @return array - */ - protected function getTo(Swift_Mime_Message $message) - { - $destinations = []; - - $contacts = array_merge( - (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc() - ); - - foreach ($contacts as $address => $display) - { - $destinations[] = $address; - } - - return $destinations; - } +class SesTransport extends Transport +{ + /** + * The Amazon SES instance. + * + * @var \Aws\Ses\SesClient + */ + protected $ses; + + /** + * Create a new SES transport instance. + * + * @param \Aws\Ses\SesClient $ses + * @return void + */ + public function __construct(SesClient $ses) + { + $this->ses = $ses; + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_Message $message, &$failedRecipients = null) + { + $this->beforeSendPerformed($message); + + return $this->ses->sendRawEmail([ + 'Source' => key($message->getSender() ?: $message->getFrom()), + 'RawMessage' => [ + 'Data' => $message->toString(), + ], + ]); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/Transport.php b/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/Transport.php new file mode 100644 index 0000000..eeca110 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Mail/Transport/Transport.php @@ -0,0 +1,70 @@ +plugins, $plugin); + } + + /** + * Iterate through registered plugins and execute plugins' methods. + * + * @param \Swift_Mime_Message $message + * @return void + */ + protected function beforeSendPerformed(Swift_Mime_Message $message) + { + $event = new Swift_Events_SendEvent($this, $message); + + foreach ($this->plugins as $plugin) { + if (method_exists($plugin, 'beforeSendPerformed')) { + $plugin->beforeSendPerformed($event); + } + } + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php b/application/vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php index 13c9169..d638dcf 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php +++ b/application/vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php @@ -1,138 +1,155 @@ -app['config']['mail']; - - // The Swift SMTP transport instance will allow us to use any SMTP backend - // for delivering mail such as Sendgrid, Amazon SES, or a custom server - // a developer has available. We will just pass this configured host. - $transport = SmtpTransport::newInstance( - $config['host'], $config['port'] - ); - - if (isset($config['encryption'])) - { - $transport->setEncryption($config['encryption']); - } - - // Once we have the transport we will check for the presence of a username - // and password. If we have it we will set the credentials on the Swift - // transporter instance so that we'll properly authenticate delivery. - if (isset($config['username'])) - { - $transport->setUsername($config['username']); - - $transport->setPassword($config['password']); - } - - return $transport; - } - - /** - * Create an instance of the Sendmail Swift Transport driver. - * - * @return \Swift_SendmailTransport - */ - protected function createSendmailDriver() - { - $command = $this->app['config']['mail']['sendmail']; - - return SendmailTransport::newInstance($command); - } - - /** - * Create an instance of the Amazon SES Swift Transport driver. - * - * @return \Swift_SendmailTransport - */ - protected function createSesDriver() - { - $sesClient = SesClient::factory($this->app['config']->get('services.ses', [])); - - return new SesTransport($sesClient); - } - - /** - * Create an instance of the Mail Swift Transport driver. - * - * @return \Swift_MailTransport - */ - protected function createMailDriver() - { - return MailTransport::newInstance(); - } - - /** - * Create an instance of the Mailgun Swift Transport driver. - * - * @return \Illuminate\Mail\Transport\MailgunTransport - */ - protected function createMailgunDriver() - { - $config = $this->app['config']->get('services.mailgun', array()); - - return new MailgunTransport($config['secret'], $config['domain']); - } - - /** - * Create an instance of the Mandrill Swift Transport driver. - * - * @return \Illuminate\Mail\Transport\MandrillTransport - */ - protected function createMandrillDriver() - { - $config = $this->app['config']->get('services.mandrill', array()); - - return new MandrillTransport($config['secret']); - } - - /** - * Create an instance of the Log Swift Transport driver. - * - * @return \Illuminate\Mail\Transport\LogTransport - */ - protected function createLogDriver() - { - return new LogTransport($this->app->make('Psr\Log\LoggerInterface')); - } - - /** - * Get the default cache driver name. - * - * @return string - */ - public function getDefaultDriver() - { - return $this->app['config']['mail.driver']; - } - - /** - * Set the default cache driver name. - * - * @param string $name - * @return void - */ - public function setDefaultDriver($name) - { - $this->app['config']['mail.driver'] = $name; - } - +class TransportManager extends Manager +{ + /** + * Create an instance of the SMTP Swift Transport driver. + * + * @return \Swift_SmtpTransport + */ + protected function createSmtpDriver() + { + $config = $this->app['config']['mail']; + + // The Swift SMTP transport instance will allow us to use any SMTP backend + // for delivering mail such as Sendgrid, Amazon SES, or a custom server + // a developer has available. We will just pass this configured host. + $transport = SmtpTransport::newInstance( + $config['host'], $config['port'] + ); + + if (isset($config['encryption'])) { + $transport->setEncryption($config['encryption']); + } + + // Once we have the transport we will check for the presence of a username + // and password. If we have it we will set the credentials on the Swift + // transporter instance so that we'll properly authenticate delivery. + if (isset($config['username'])) { + $transport->setUsername($config['username']); + + $transport->setPassword($config['password']); + } + + if (isset($config['stream'])) { + $transport->setStreamOptions($config['stream']); + } + + return $transport; + } + + /** + * Create an instance of the Sendmail Swift Transport driver. + * + * @return \Swift_SendmailTransport + */ + protected function createSendmailDriver() + { + $command = $this->app['config']['mail']['sendmail']; + + return SendmailTransport::newInstance($command); + } + + /** + * Create an instance of the Amazon SES Swift Transport driver. + * + * @return \Swift_SendmailTransport + */ + protected function createSesDriver() + { + $config = $this->app['config']->get('services.ses', []); + + $config += [ + 'version' => 'latest', 'service' => 'email', + ]; + + if ($config['key'] && $config['secret']) { + $config['credentials'] = Arr::only($config, ['key', 'secret']); + } + + return new SesTransport(new SesClient($config)); + } + + /** + * Create an instance of the Mail Swift Transport driver. + * + * @return \Swift_MailTransport + */ + protected function createMailDriver() + { + return MailTransport::newInstance(); + } + + /** + * Create an instance of the Mailgun Swift Transport driver. + * + * @return \Illuminate\Mail\Transport\MailgunTransport + */ + protected function createMailgunDriver() + { + $config = $this->app['config']->get('services.mailgun', []); + + $client = new HttpClient(Arr::get($config, 'guzzle', [])); + + return new MailgunTransport($client, $config['secret'], $config['domain']); + } + + /** + * Create an instance of the Mandrill Swift Transport driver. + * + * @return \Illuminate\Mail\Transport\MandrillTransport + */ + protected function createMandrillDriver() + { + $config = $this->app['config']->get('services.mandrill', []); + + $client = new HttpClient(Arr::get($config, 'guzzle', [])); + + return new MandrillTransport($client, $config['secret']); + } + + /** + * Create an instance of the Log Swift Transport driver. + * + * @return \Illuminate\Mail\Transport\LogTransport + */ + protected function createLogDriver() + { + return new LogTransport($this->app->make('Psr\Log\LoggerInterface')); + } + + /** + * Get the default cache driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['mail.driver']; + } + + /** + * Set the default cache driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['mail.driver'] = $name; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Mail/composer.json b/application/vendor/laravel/framework/src/Illuminate/Mail/composer.json index a8672b4..e59faa3 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Mail/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Mail/composer.json @@ -14,10 +14,10 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/container": "5.0.*", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*", + "php": ">=5.5.9", + "illuminate/container": "5.1.*", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*", "psr/log": "~1.0", "swiftmailer/swiftmailer": "~5.1" }, @@ -28,12 +28,13 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "suggest": { - "aws/aws-sdk-php": "Required to use the SES mail driver (~2.4).", - "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers (~5.0)." + "aws/aws-sdk-php": "Required to use the SES mail driver (~3.0).", + "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers (~5.3|~6.0).", + "jeremeamia/superclosure": "Required to be able to serialize closures (~2.0)." }, "minimum-stability": "dev" } diff --git a/application/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php b/application/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php index e5dc49d..40a68ee 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php +++ b/application/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php @@ -1,476 +1,487 @@ -= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false; - } - - /** - * Create a range of pagination URLs. - * - * @param int $start - * @param int $end - * @return string - */ - public function getUrlRange($start, $end) - { - $urls = []; - - for ($page = $start; $page <= $end; $page++) - { - $urls[$page] = $this->url($page); - } - - return $urls; - } - - /** - * Get a URL for a given page number. - * - * @param int $page - * @return string - */ - public function url($page) - { - if ($page <= 0) $page = 1; - - // If we have any extra query string key / value pairs that need to be added - // onto the URL, we will put them in query string form and then attach it - // to the URL. This allows for extra information like sortings storage. - $parameters = [$this->pageName => $page]; - - if (count($this->query) > 0) - { - $parameters = array_merge($this->query, $parameters); - } - - return $this->path.'?' - .http_build_query($parameters, null, '&') - .$this->buildFragment(); - } - - /** - * Get the URL for the previous page. - * - * @return string|null - */ - public function previousPageUrl() - { - if ($this->currentPage() > 1) - { - return $this->url($this->currentPage() - 1); - } - } - - /** - * Get / set the URL fragment to be appended to URLs. - * - * @param string|null $fragment - * @return $this|string|null - */ - public function fragment($fragment = null) - { - if (is_null($fragment)) return $this->fragment; - - $this->fragment = $fragment; - - return $this; - } - - /** - * Add a set of query string values to the paginator. - * - * @param array|string $key - * @param string|null $value - * @return $this - */ - public function appends($key, $value = null) - { - if (is_array($key)) return $this->appendArray($key); - - return $this->addQuery($key, $value); - } - - /** - * Add an array of query string values. - * - * @param array $keys - * @return $this - */ - protected function appendArray(array $keys) - { - foreach ($keys as $key => $value) - { - $this->addQuery($key, $value); - } - - return $this; - } - - /** - * Add a query string value to the paginator. - * - * @param string $key - * @param string $value - * @return $this - */ - public function addQuery($key, $value) - { - if ($key !== $this->pageName) - { - $this->query[$key] = $value; - } - - return $this; - } - - /** - * Build the full fragment portion of a URL. - * - * @return string - */ - protected function buildFragment() - { - return $this->fragment ? '#'.$this->fragment : ''; - } - - /** - * Get the slice of items being paginated. - * - * @return array - */ - public function items() - { - return $this->items->all(); - } - - /** - * Get the number of the first item in the slice. - * - * @return int - */ - public function firstItem() - { - return ($this->currentPage - 1) * $this->perPage + 1; - } - - /** - * Get the number of the last item in the slice. - * - * @return int - */ - public function lastItem() - { - return $this->firstItem() + $this->count() - 1; - } - - /** - * Get the number of items shown per page. - * - * @return int - */ - public function perPage() - { - return $this->perPage; - } - - /** - * Get the current page. - * - * @return int - */ - public function currentPage() - { - return $this->currentPage; - } - - /** - * Determine if there are enough items to split into multiple pages. - * - * @return bool - */ - public function hasPages() - { - return ! ($this->currentPage() == 1 && ! $this->hasMorePages()); - } - - /** - * Resolve the current request path or return the default value. - * - * @param string $default - * @return string - */ - public static function resolveCurrentPath($default = '/') - { - if (isset(static::$currentPathResolver)) - { - return call_user_func(static::$currentPathResolver); - } - - return $default; - } - - /** - * Set the current request path resolver callback. - * - * @param \Closure $resolver - * @return void - */ - public static function currentPathResolver(Closure $resolver) - { - static::$currentPathResolver = $resolver; - } - - /** - * Resolve the current page or return the default value. - * - * @param int $default - * @return int - */ - public static function resolveCurrentPage($default = 1) - { - if (isset(static::$currentPageResolver)) - { - return call_user_func(static::$currentPageResolver); - } - - return $default; - } - - /** - * Set the current page resolver callback. - * - * @param \Closure $resolver - * @return void - */ - public static function currentPageResolver(Closure $resolver) - { - static::$currentPageResolver = $resolver; - } - - /** - * Set the default Presenter resolver. - * - * @param \Closure $resolver - * @return void - */ - public static function presenter(Closure $resolver) - { - static::$presenterResolver = $resolver; - } - - /** - * Set the query string variable used to store the page. - * - * @param string $name - * @return $this - */ - public function setPageName($name) - { - $this->pageName = $name; - - return $this; - } - - /** - * Set the base path to assign to all URLs. - * - * @param string $path - * @return $this - */ - public function setPath($path) - { - $this->path = $path; - - return $this; - } - - /** - * Get an iterator for the items. - * - * @return \ArrayIterator - */ - public function getIterator() - { - return new ArrayIterator($this->items->all()); - } - - /** - * Determine if the list of items is empty or not. - * - * @return bool - */ - public function isEmpty() - { - return $this->items->isEmpty(); - } - - /** - * Get the number of items for the current page. - * - * @return int - */ - public function count() - { - return $this->items->count(); - } - - /** - * Get the paginator's underlying collection. - * - * @return \Illuminate\Support\Collection - */ - public function getCollection() - { - return $this->items; - } - - /** - * Determine if the given item exists. - * - * @param mixed $key - * @return bool - */ - public function offsetExists($key) - { - return $this->items->has($key); - } - - /** - * Get the item at the given offset. - * - * @param mixed $key - * @return mixed - */ - public function offsetGet($key) - { - return $this->items->get($key); - } - - /** - * Set the item at the given offset. - * - * @param mixed $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value) - { - $this->items->put($key, $value); - } - - /** - * Unset the item at the given key. - * - * @param mixed $key - * @return void - */ - public function offsetUnset($key) - { - $this->items->forget($key); - } - - /** - * Make dynamic calls into the collection. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return call_user_func_array([$this->getCollection(), $method], $parameters); - } - - /** - * Render the contents of the paginator when casting to string. - * - * @return string - */ - public function __toString() - { - return $this->render(); - } - +abstract class AbstractPaginator +{ + /** + * All of the items being paginated. + * + * @var \Illuminate\Support\Collection + */ + protected $items; + + /** + * The number of items to be shown per page. + * + * @var int + */ + protected $perPage; + + /** + * The current page being "viewed". + * + * @var int + */ + protected $currentPage; + + /** + * The base path to assign to all URLs. + * + * @var string + */ + protected $path = '/'; + + /** + * The query parameters to add to all URLs. + * + * @var array + */ + protected $query = []; + + /** + * The URL fragment to add to all URLs. + * + * @var string|null + */ + protected $fragment = null; + + /** + * The query string variable used to store the page. + * + * @var string + */ + protected $pageName = 'page'; + + /** + * The current page resolver callback. + * + * @var \Closure + */ + protected static $currentPathResolver; + + /** + * The current page resolver callback. + * + * @var \Closure + */ + protected static $currentPageResolver; + + /** + * The default presenter resolver. + * + * @var \Closure + */ + protected static $presenterResolver; + + /** + * Determine if the given value is a valid page number. + * + * @param int $page + * @return bool + */ + protected function isValidPageNumber($page) + { + return $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false; + } + + /** + * Create a range of pagination URLs. + * + * @param int $start + * @param int $end + * @return string + */ + public function getUrlRange($start, $end) + { + $urls = []; + + for ($page = $start; $page <= $end; $page++) { + $urls[$page] = $this->url($page); + } + + return $urls; + } + + /** + * Get a URL for a given page number. + * + * @param int $page + * @return string + */ + public function url($page) + { + if ($page <= 0) { + $page = 1; + } + + // If we have any extra query string key / value pairs that need to be added + // onto the URL, we will put them in query string form and then attach it + // to the URL. This allows for extra information like sortings storage. + $parameters = [$this->pageName => $page]; + + if (count($this->query) > 0) { + $parameters = array_merge($this->query, $parameters); + } + + return $this->path.'?' + .http_build_query($parameters, '', '&') + .$this->buildFragment(); + } + + /** + * Get the URL for the previous page. + * + * @return string|null + */ + public function previousPageUrl() + { + if ($this->currentPage() > 1) { + return $this->url($this->currentPage() - 1); + } + } + + /** + * Get / set the URL fragment to be appended to URLs. + * + * @param string|null $fragment + * @return $this|string|null + */ + public function fragment($fragment = null) + { + if (is_null($fragment)) { + return $this->fragment; + } + + $this->fragment = $fragment; + + return $this; + } + + /** + * Add a set of query string values to the paginator. + * + * @param array|string $key + * @param string|null $value + * @return $this + */ + public function appends($key, $value = null) + { + if (is_array($key)) { + return $this->appendArray($key); + } + + return $this->addQuery($key, $value); + } + + /** + * Add an array of query string values. + * + * @param array $keys + * @return $this + */ + protected function appendArray(array $keys) + { + foreach ($keys as $key => $value) { + $this->addQuery($key, $value); + } + + return $this; + } + + /** + * Add a query string value to the paginator. + * + * @param string $key + * @param string $value + * @return $this + */ + public function addQuery($key, $value) + { + if ($key !== $this->pageName) { + $this->query[$key] = $value; + } + + return $this; + } + + /** + * Build the full fragment portion of a URL. + * + * @return string + */ + protected function buildFragment() + { + return $this->fragment ? '#'.$this->fragment : ''; + } + + /** + * Get the slice of items being paginated. + * + * @return array + */ + public function items() + { + return $this->items->all(); + } + + /** + * Get the number of the first item in the slice. + * + * @return int + */ + public function firstItem() + { + return ($this->currentPage - 1) * $this->perPage + 1; + } + + /** + * Get the number of the last item in the slice. + * + * @return int + */ + public function lastItem() + { + return $this->firstItem() + $this->count() - 1; + } + + /** + * Get the number of items shown per page. + * + * @return int + */ + public function perPage() + { + return $this->perPage; + } + + /** + * Get the current page. + * + * @return int + */ + public function currentPage() + { + return $this->currentPage; + } + + /** + * Determine if there are enough items to split into multiple pages. + * + * @return bool + */ + public function hasPages() + { + return ! ($this->currentPage() == 1 && ! $this->hasMorePages()); + } + + /** + * Resolve the current request path or return the default value. + * + * @param string $default + * @return string + */ + public static function resolveCurrentPath($default = '/') + { + if (isset(static::$currentPathResolver)) { + return call_user_func(static::$currentPathResolver); + } + + return $default; + } + + /** + * Set the current request path resolver callback. + * + * @param \Closure $resolver + * @return void + */ + public static function currentPathResolver(Closure $resolver) + { + static::$currentPathResolver = $resolver; + } + + /** + * Resolve the current page or return the default value. + * + * @param string $pageName + * @param int $default + * @return int + */ + public static function resolveCurrentPage($pageName = 'page', $default = 1) + { + if (isset(static::$currentPageResolver)) { + return call_user_func(static::$currentPageResolver, $pageName); + } + + return $default; + } + + /** + * Set the current page resolver callback. + * + * @param \Closure $resolver + * @return void + */ + public static function currentPageResolver(Closure $resolver) + { + static::$currentPageResolver = $resolver; + } + + /** + * Set the default Presenter resolver. + * + * @param \Closure $resolver + * @return void + */ + public static function presenter(Closure $resolver) + { + static::$presenterResolver = $resolver; + } + + /** + * Get the query string variable used to store the page. + * + * @return string + */ + public function getPageName() + { + return $this->pageName; + } + + /** + * Set the query string variable used to store the page. + * + * @param string $name + * @return $this + */ + public function setPageName($name) + { + $this->pageName = $name; + + return $this; + } + + /** + * Set the base path to assign to all URLs. + * + * @param string $path + * @return $this + */ + public function setPath($path) + { + $this->path = $path; + + return $this; + } + + /** + * Get an iterator for the items. + * + * @return \ArrayIterator + */ + public function getIterator() + { + return new ArrayIterator($this->items->all()); + } + + /** + * Determine if the list of items is empty or not. + * + * @return bool + */ + public function isEmpty() + { + return $this->items->isEmpty(); + } + + /** + * Get the number of items for the current page. + * + * @return int + */ + public function count() + { + return $this->items->count(); + } + + /** + * Get the paginator's underlying collection. + * + * @return \Illuminate\Support\Collection + */ + public function getCollection() + { + return $this->items; + } + + /** + * Determine if the given item exists. + * + * @param mixed $key + * @return bool + */ + public function offsetExists($key) + { + return $this->items->has($key); + } + + /** + * Get the item at the given offset. + * + * @param mixed $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->items->get($key); + } + + /** + * Set the item at the given offset. + * + * @param mixed $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->items->put($key, $value); + } + + /** + * Unset the item at the given key. + * + * @param mixed $key + * @return void + */ + public function offsetUnset($key) + { + $this->items->forget($key); + } + + /** + * Make dynamic calls into the collection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return call_user_func_array([$this->getCollection(), $method], $parameters); + } + + /** + * Render the contents of the paginator when casting to string. + * + * @return string + */ + public function __toString() + { + return $this->render(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Pagination/BootstrapThreeNextPreviousButtonRendererTrait.php b/application/vendor/laravel/framework/src/Illuminate/Pagination/BootstrapThreeNextPreviousButtonRendererTrait.php index 1d9aef3..a8fda50 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Pagination/BootstrapThreeNextPreviousButtonRendererTrait.php +++ b/application/vendor/laravel/framework/src/Illuminate/Pagination/BootstrapThreeNextPreviousButtonRendererTrait.php @@ -1,49 +1,48 @@ -paginator->currentPage() <= 1) - { - return $this->getDisabledTextWrapper($text); - } - - $url = $this->paginator->url( - $this->paginator->currentPage() - 1 - ); - - return $this->getPageLinkWrapper($url, $text, 'prev'); - } - - /** - * Get the next page pagination element. - * - * @param string $text - * @return string - */ - protected function getNextButton($text = '»') - { - // If the current page is greater than or equal to the last page, it means we - // can't go any further into the pages, as we're already on this last page - // that is available, so we will make it the "next" link style disabled. - if ( ! $this->paginator->hasMorePages()) - { - return $this->getDisabledTextWrapper($text); - } - - $url = $this->paginator->url($this->paginator->currentPage() + 1); - - return $this->getPageLinkWrapper($url, $text, 'next'); - } - +paginator->currentPage() <= 1) { + return $this->getDisabledTextWrapper($text); + } + + $url = $this->paginator->url( + $this->paginator->currentPage() - 1 + ); + + return $this->getPageLinkWrapper($url, $text, 'prev'); + } + + /** + * Get the next page pagination element. + * + * @param string $text + * @return string + */ + public function getNextButton($text = '»') + { + // If the current page is greater than or equal to the last page, it means we + // can't go any further into the pages, as we're already on this last page + // that is available, so we will make it the "next" link style disabled. + if (! $this->paginator->hasMorePages()) { + return $this->getDisabledTextWrapper($text); + } + + $url = $this->paginator->url($this->paginator->currentPage() + 1); + + return $this->getPageLinkWrapper($url, $text, 'next'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Pagination/BootstrapThreePresenter.php b/application/vendor/laravel/framework/src/Illuminate/Pagination/BootstrapThreePresenter.php index cd3d252..21e647d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Pagination/BootstrapThreePresenter.php +++ b/application/vendor/laravel/framework/src/Illuminate/Pagination/BootstrapThreePresenter.php @@ -1,134 +1,134 @@ -paginator = $paginator; - $this->window = is_null($window) ? UrlWindow::make($paginator) : $window->get(); - } - - /** - * Determine if the underlying paginator being presented has pages to show. - * - * @return bool - */ - public function hasPages() - { - return $this->paginator->hasPages(); - } - - /** - * Convert the URL window into Bootstrap HTML. - * - * @return string - */ - public function render() - { - if ($this->hasPages()) - { - return sprintf( - '
      %s %s %s
    ', - $this->getPreviousButton(), - $this->getLinks(), - $this->getNextButton() - ); - } - - return ''; - } - - /** - * Get HTML wrapper for an available page link. - * - * @param string $url - * @param int $page - * @param string|null $rel - * @return string - */ - protected function getAvailablePageWrapper($url, $page, $rel = null) - { - $rel = is_null($rel) ? '' : ' rel="'.$rel.'"'; - - return '
  • '.$page.'
  • '; - } - - /** - * Get HTML wrapper for disabled text. - * - * @param string $text - * @return string - */ - protected function getDisabledTextWrapper($text) - { - return '
  • '.$text.'
  • '; - } - - /** - * Get HTML wrapper for active text. - * - * @param string $text - * @return string - */ - protected function getActivePageWrapper($text) - { - return '
  • '.$text.'
  • '; - } - - /** - * Get a pagination "dot" element. - * - * @return string - */ - protected function getDots() - { - return $this->getDisabledTextWrapper("..."); - } - - /** - * Get the current page from the paginator. - * - * @return int - */ - protected function currentPage() - { - return $this->paginator->currentPage(); - } - - /** - * Get the last page from the paginator. - * - * @return int - */ - protected function lastPage() - { - return $this->paginator->lastPage(); - } - +class BootstrapThreePresenter implements PresenterContract +{ + use BootstrapThreeNextPreviousButtonRendererTrait, UrlWindowPresenterTrait; + + /** + * The paginator implementation. + * + * @var \Illuminate\Contracts\Pagination\Paginator + */ + protected $paginator; + + /** + * The URL window data structure. + * + * @var array + */ + protected $window; + + /** + * Create a new Bootstrap presenter instance. + * + * @param \Illuminate\Contracts\Pagination\Paginator $paginator + * @param \Illuminate\Pagination\UrlWindow|null $window + * @return void + */ + public function __construct(PaginatorContract $paginator, UrlWindow $window = null) + { + $this->paginator = $paginator; + $this->window = is_null($window) ? UrlWindow::make($paginator) : $window->get(); + } + + /** + * Determine if the underlying paginator being presented has pages to show. + * + * @return bool + */ + public function hasPages() + { + return $this->paginator->hasPages(); + } + + /** + * Convert the URL window into Bootstrap HTML. + * + * @return string + */ + public function render() + { + if ($this->hasPages()) { + return sprintf( + '
      %s %s %s
    ', + $this->getPreviousButton(), + $this->getLinks(), + $this->getNextButton() + ); + } + + return ''; + } + + /** + * Get HTML wrapper for an available page link. + * + * @param string $url + * @param int $page + * @param string|null $rel + * @return string + */ + protected function getAvailablePageWrapper($url, $page, $rel = null) + { + $rel = is_null($rel) ? '' : ' rel="'.$rel.'"'; + + return '
  • '.$page.'
  • '; + } + + /** + * Get HTML wrapper for disabled text. + * + * @param string $text + * @return string + */ + protected function getDisabledTextWrapper($text) + { + return '
  • '.$text.'
  • '; + } + + /** + * Get HTML wrapper for active text. + * + * @param string $text + * @return string + */ + protected function getActivePageWrapper($text) + { + return '
  • '.$text.'
  • '; + } + + /** + * Get a pagination "dot" element. + * + * @return string + */ + protected function getDots() + { + return $this->getDisabledTextWrapper('...'); + } + + /** + * Get the current page from the paginator. + * + * @return int + */ + protected function currentPage() + { + return $this->paginator->currentPage(); + } + + /** + * Get the last page from the paginator. + * + * @return int + */ + protected function lastPage() + { + return $this->paginator->lastPage(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php b/application/vendor/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php index 468505d..8c562e1 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php +++ b/application/vendor/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php @@ -1,4 +1,6 @@ - $value) - { - $this->{$key} = $value; - } - - $this->total = $total; - $this->perPage = $perPage; - $this->lastPage = (int) ceil($total / $perPage); - $this->currentPage = $this->setCurrentPage($currentPage, $this->lastPage); - $this->path = $this->path != '/' ? rtrim($this->path, '/').'/' : $this->path; - $this->items = $items instanceof Collection ? $items : Collection::make($items); - } - - /** - * Get the current page for the request. - * - * @param int $currentPage - * @param int $lastPage - * @return int - */ - protected function setCurrentPage($currentPage, $lastPage) - { - $currentPage = $currentPage ?: static::resolveCurrentPage(); - - // The page number will get validated and adjusted if it either less than one - // or greater than the last page available based on the count of the given - // items array. If it's greater than the last, we'll give back the last. - if (is_numeric($currentPage) && $currentPage > $lastPage) - { - return $lastPage > 0 ? $lastPage : 1; - } - - return $this->isValidPageNumber($currentPage) ? (int) $currentPage : 1; - } - - /** - * Get the URL for the next page. - * - * @return string - */ - public function nextPageUrl() - { - if ($this->lastPage() > $this->currentPage()) - { - return $this->url($this->currentPage() + 1); - } - } - - /** - * Determine if there are more items in the data source. - * - * @return bool - */ - public function hasMorePages() - { - return $this->currentPage() < $this->lastPage(); - } - - /** - * Get the total number of items being paginated. - * - * @return int - */ - public function total() - { - return $this->total; - } - - /** - * Get the last page. - * - * @return int - */ - public function lastPage() - { - return $this->lastPage; - } - - /** - * Render the paginator using the given presenter. - * - * @param \Illuminate\Contracts\Pagination\Presenter|null $presenter - * @return string - */ - public function render(Presenter $presenter = null) - { - if (is_null($presenter) && static::$presenterResolver) - { - $presenter = call_user_func(static::$presenterResolver, $this); - } - - $presenter = $presenter ?: new BootstrapThreePresenter($this); - - return $presenter->render(); - } - - /** - * Get the instance as an array. - * - * @return array - */ - public function toArray() - { - return [ - 'total' => $this->total(), - 'per_page' => $this->perPage(), - 'current_page' => $this->currentPage(), - 'last_page' => $this->lastPage(), - 'next_page_url' => $this->nextPageUrl(), - 'prev_page_url' => $this->previousPageUrl(), - 'from' => $this->firstItem(), - 'to' => $this->lastItem(), - 'data' => $this->items->toArray(), - ]; - } - - /** - * Convert the object to its JSON representation. - * - * @param int $options - * @return string - */ - public function toJson($options = 0) - { - return json_encode($this->toArray(), $options); - } - +class LengthAwarePaginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, LengthAwarePaginatorContract +{ + /** + * The total number of items before slicing. + * + * @var int + */ + protected $total; + + /** + * The last available page. + * + * @var int + */ + protected $lastPage; + + /** + * Create a new paginator instance. + * + * @param mixed $items + * @param int $total + * @param int $perPage + * @param int|null $currentPage + * @param array $options (path, query, fragment, pageName) + * @return void + */ + public function __construct($items, $total, $perPage, $currentPage = null, array $options = []) + { + foreach ($options as $key => $value) { + $this->{$key} = $value; + } + + $this->total = $total; + $this->perPage = $perPage; + $this->lastPage = (int) ceil($total / $perPage); + $this->path = $this->path != '/' ? rtrim($this->path, '/') : $this->path; + $this->currentPage = $this->setCurrentPage($currentPage, $this->lastPage); + $this->items = $items instanceof Collection ? $items : Collection::make($items); + } + + /** + * Get the current page for the request. + * + * @param int $currentPage + * @param int $lastPage + * @return int + */ + protected function setCurrentPage($currentPage, $lastPage) + { + $currentPage = $currentPage ?: static::resolveCurrentPage(); + + // The page number will get validated and adjusted if it either less than one + // or greater than the last page available based on the count of the given + // items array. If it's greater than the last, we'll give back the last. + if (is_numeric($currentPage) && $currentPage > $lastPage) { + return $lastPage > 0 ? $lastPage : 1; + } + + return $this->isValidPageNumber($currentPage) ? (int) $currentPage : 1; + } + + /** + * Get the URL for the next page. + * + * @return string|null + */ + public function nextPageUrl() + { + if ($this->lastPage() > $this->currentPage()) { + return $this->url($this->currentPage() + 1); + } + } + + /** + * Determine if there are more items in the data source. + * + * @return bool + */ + public function hasMorePages() + { + return $this->currentPage() < $this->lastPage(); + } + + /** + * Get the total number of items being paginated. + * + * @return int + */ + public function total() + { + return $this->total; + } + + /** + * Get the last page. + * + * @return int + */ + public function lastPage() + { + return $this->lastPage; + } + + /** + * Render the paginator using the given presenter. + * + * @param \Illuminate\Contracts\Pagination\Presenter|null $presenter + * @return string + */ + public function render(Presenter $presenter = null) + { + if (is_null($presenter) && static::$presenterResolver) { + $presenter = call_user_func(static::$presenterResolver, $this); + } + + $presenter = $presenter ?: new BootstrapThreePresenter($this); + + return $presenter->render(); + } + + /** + * Get the instance as an array. + * + * @return array + */ + public function toArray() + { + return [ + 'total' => $this->total(), + 'per_page' => $this->perPage(), + 'current_page' => $this->currentPage(), + 'last_page' => $this->lastPage(), + 'next_page_url' => $this->nextPageUrl(), + 'prev_page_url' => $this->previousPageUrl(), + 'from' => $this->firstItem(), + 'to' => $this->lastItem(), + 'data' => $this->items->toArray(), + ]; + } + + /** + * Convert the object to its JSON representation. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->toArray(), $options); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php index 980c5fe..48d3e2c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php @@ -1,25 +1,30 @@ -app['request']->url(); + }); - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - Paginator::currentPathResolver(function() - { - return $this->app['request']->url(); - }); + Paginator::currentPageResolver(function ($pageName = 'page') { + $page = $this->app['request']->input($pageName); - Paginator::currentPageResolver(function() - { - return $this->app['request']->input('page'); - }); - } + if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) { + return $page; + } + return 1; + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php b/application/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php index 5f1fe97..6229f06 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php +++ b/application/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php @@ -1,4 +1,6 @@ - $value) - { - $this->{$key} = $value; - } - - $this->perPage = $perPage; - $this->currentPage = $this->setCurrentPage($currentPage); - $this->path = $this->path != '/' ? rtrim($this->path, '/').'/' : $this->path; - $this->items = $items instanceof Collection ? $items : Collection::make($items); - - $this->checkForMorePages(); - } - - /** - * Get the current page for the request. - * - * @param int $currentPage - * @return int - */ - protected function setCurrentPage($currentPage) - { - $currentPage = $currentPage ?: static::resolveCurrentPage(); - - return $this->isValidPageNumber($currentPage) ? (int) $currentPage : 1; - } - - /** - * Check for more pages. The last item will be sliced off. - * - * @return void - */ - protected function checkForMorePages() - { - $this->hasMore = count($this->items) > ($this->perPage); - - $this->items = $this->items->slice(0, $this->perPage); - } - - /** - * Get the URL for the next page. - * - * @return string|null - */ - public function nextPageUrl() - { - if ($this->hasMore) - { - return $this->url($this->currentPage() + 1); - } - } - - /** - * Determine if there are more items in the data source. - * - * @return bool - */ - public function hasMorePages() - { - return $this->hasMore; - } - - /** - * Render the paginator using the given presenter. - * - * @param \Illuminate\Contracts\Pagination\Presenter|null $presenter - * @return string - */ - public function render(Presenter $presenter = null) - { - if (is_null($presenter) && static::$presenterResolver) - { - $presenter = call_user_func(static::$presenterResolver, $this); - } - - $presenter = $presenter ?: new SimpleBootstrapThreePresenter($this); - - return $presenter->render(); - } - - /** - * Get the instance as an array. - * - * @return array - */ - public function toArray() - { - return [ - 'per_page' => $this->perPage(), 'current_page' => $this->currentPage(), - 'next_page_url' => $this->nextPageUrl(), 'prev_page_url' => $this->previousPageUrl(), - 'from' => $this->firstItem(), 'to' => $this->lastItem(), - 'data' => $this->items->toArray(), - ]; - } - - /** - * Convert the object to its JSON representation. - * - * @param int $options - * @return string - */ - public function toJson($options = 0) - { - return json_encode($this->toArray(), $options); - } - +class Paginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, PaginatorContract +{ + /** + * Determine if there are more items in the data source. + * + * @return bool + */ + protected $hasMore; + + /** + * Create a new paginator instance. + * + * @param mixed $items + * @param int $perPage + * @param int|null $currentPage + * @param array $options (path, query, fragment, pageName) + * @return void + */ + public function __construct($items, $perPage, $currentPage = null, array $options = []) + { + foreach ($options as $key => $value) { + $this->{$key} = $value; + } + + $this->perPage = $perPage; + $this->currentPage = $this->setCurrentPage($currentPage); + $this->path = $this->path != '/' ? rtrim($this->path, '/') : $this->path; + $this->items = $items instanceof Collection ? $items : Collection::make($items); + + $this->checkForMorePages(); + } + + /** + * Get the current page for the request. + * + * @param int $currentPage + * @return int + */ + protected function setCurrentPage($currentPage) + { + $currentPage = $currentPage ?: static::resolveCurrentPage(); + + return $this->isValidPageNumber($currentPage) ? (int) $currentPage : 1; + } + + /** + * Check for more pages. The last item will be sliced off. + * + * @return void + */ + protected function checkForMorePages() + { + $this->hasMore = count($this->items) > ($this->perPage); + + $this->items = $this->items->slice(0, $this->perPage); + } + + /** + * Get the URL for the next page. + * + * @return string|null + */ + public function nextPageUrl() + { + if ($this->hasMore) { + return $this->url($this->currentPage() + 1); + } + } + + /** + * Determine if there are more items in the data source. + * + * @return bool + */ + public function hasMorePages() + { + return $this->hasMore; + } + + /** + * Render the paginator using the given presenter. + * + * @param \Illuminate\Contracts\Pagination\Presenter|null $presenter + * @return string + */ + public function render(Presenter $presenter = null) + { + if (is_null($presenter) && static::$presenterResolver) { + $presenter = call_user_func(static::$presenterResolver, $this); + } + + $presenter = $presenter ?: new SimpleBootstrapThreePresenter($this); + + return $presenter->render(); + } + + /** + * Get the instance as an array. + * + * @return array + */ + public function toArray() + { + return [ + 'per_page' => $this->perPage(), 'current_page' => $this->currentPage(), + 'next_page_url' => $this->nextPageUrl(), 'prev_page_url' => $this->previousPageUrl(), + 'from' => $this->firstItem(), 'to' => $this->lastItem(), + 'data' => $this->items->toArray(), + ]; + } + + /** + * Convert the object to its JSON representation. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->toArray(), $options); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Pagination/SimpleBootstrapThreePresenter.php b/application/vendor/laravel/framework/src/Illuminate/Pagination/SimpleBootstrapThreePresenter.php index be1851f..bbb2790 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Pagination/SimpleBootstrapThreePresenter.php +++ b/application/vendor/laravel/framework/src/Illuminate/Pagination/SimpleBootstrapThreePresenter.php @@ -1,47 +1,47 @@ -paginator = $paginator; - } +use Illuminate\Contracts\Pagination\Paginator as PaginatorContract; - /** - * Determine if the underlying paginator being presented has pages to show. - * - * @return bool - */ - public function hasPages() - { - return $this->paginator->hasPages() && count($this->paginator->items()) > 0; - } +class SimpleBootstrapThreePresenter extends BootstrapThreePresenter +{ + /** + * Create a simple Bootstrap 3 presenter. + * + * @param \Illuminate\Contracts\Pagination\Paginator $paginator + * @return void + */ + public function __construct(PaginatorContract $paginator) + { + $this->paginator = $paginator; + } - /** - * Convert the URL window into Bootstrap HTML. - * - * @return string - */ - public function render() - { - if ($this->hasPages()) - { - return sprintf( - '
      %s %s
    ', - $this->getPreviousButton(), - $this->getNextButton() - ); - } + /** + * Determine if the underlying paginator being presented has pages to show. + * + * @return bool + */ + public function hasPages() + { + return $this->paginator->hasPages() && count($this->paginator->items()) > 0; + } - return ''; - } + /** + * Convert the URL window into Bootstrap HTML. + * + * @return string + */ + public function render() + { + if ($this->hasPages()) { + return sprintf( + '
      %s %s
    ', + $this->getPreviousButton(), + $this->getNextButton() + ); + } + return ''; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Pagination/UrlWindow.php b/application/vendor/laravel/framework/src/Illuminate/Pagination/UrlWindow.php index e501aa6..655f646 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Pagination/UrlWindow.php +++ b/application/vendor/laravel/framework/src/Illuminate/Pagination/UrlWindow.php @@ -1,225 +1,222 @@ -paginator = $paginator; - } - - /** - * Create a new URL window instance. - * - * @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator - * @param int $onEachSide - * @return array - */ - public static function make(PaginatorContract $paginator, $onEachSide = 3) - { - return (new static($paginator))->get($onEachSide); - } - - /** - * Get the window of URLs to be shown. - * - * @param int $onEachSide - * @return array - */ - public function get($onEachSide = 3) - { - if ($this->paginator->lastPage() < ($onEachSide * 2) + 6) - { - return $this->getSmallSlider(); - } - - return $this->getUrlSlider($onEachSide); - } - - /** - * Get the slider of URLs there are not enough pages to slide. - * - * @return array - */ - protected function getSmallSlider() - { - return [ - 'first' => $this->paginator->getUrlRange(1, $this->lastPage()), - 'slider' => null, - 'last' => null, - ]; - } - - /** - * Create a URL slider links. - * - * @param int $onEachSide - * @return array - */ - protected function getUrlSlider($onEachSide) - { - $window = $onEachSide * 2; - - if ( ! $this->hasPages()) - { - return [ - 'first' => null, - 'slider' => null, - 'last' => null, - ]; - } - - // If the current page is very close to the beginning of the page range, we will - // just render the beginning of the page range, followed by the last 2 of the - // links in this list, since we will not have room to create a full slider. - if ($this->currentPage() <= $window) - { - return $this->getSliderTooCloseToBeginning($window); - } - - // If the current page is close to the ending of the page range we will just get - // this first couple pages, followed by a larger window of these ending pages - // since we're too close to the end of the list to create a full on slider. - elseif ($this->currentPage() > ($this->lastPage() - $window)) - { - return $this->getSliderTooCloseToEnding($window); - } - - // If we have enough room on both sides of the current page to build a slider we - // will surround it with both the beginning and ending caps, with this window - // of pages in the middle providing a Google style sliding paginator setup. - return $this->getFullSlider($onEachSide); - } - - /** - * Get the slider of URLs when too close to beginning of window. - * - * @param int $window - * @return array - */ - protected function getSliderTooCloseToBeginning($window) - { - return [ - 'first' => $this->paginator->getUrlRange(1, $window + 2), - 'slider' => null, - 'last' => $this->getFinish(), - ]; - } - - /** - * Get the slider of URLs when too close to ending of window. - * - * @param int $window - * @return array - */ - protected function getSliderTooCloseToEnding($window) - { - $last = $this->paginator->getUrlRange( - $this->lastPage() - ($window + 2), - $this->lastPage() - ); - - return [ - 'first' => $this->getStart(), - 'slider' => null, - 'last' => $last, - ]; - } - - /** - * Get the slider of URLs when a full slider can be made. - * - * @param int $onEachSide - * @return array - */ - protected function getFullSlider($onEachSide) - { - return [ - 'first' => $this->getStart(), - 'slider' => $this->getAdjacentUrlRange($onEachSide), - 'last' => $this->getFinish(), - ]; - } - - /** - * Get the page range for the current page window. - * - * @param int $onEachSide - * @return array - */ - public function getAdjacentUrlRange($onEachSide) - { - return $this->paginator->getUrlRange( - $this->currentPage() - $onEachSide, - $this->currentPage() + $onEachSide - ); - } - - /** - * Get the starting URLs of a pagination slider. - * - * @return array - */ - public function getStart() - { - return $this->paginator->getUrlRange(1, 2); - } - - /** - * Get the ending URLs of a pagination slider. - * - * @return array - */ - public function getFinish() - { - return $this->paginator->getUrlRange( - $this->lastPage() - 1, - $this->lastPage() - ); - } - - /** - * Determine if the underlying paginator being presented has pages to show. - * - * @return bool - */ - public function hasPages() - { - return $this->paginator->lastPage() > 1; - } - - /** - * Get the current page from the paginator. - * - * @return int - */ - protected function currentPage() - { - return $this->paginator->currentPage(); - } - - /** - * Get the last page from the paginator. - * - * @return int - */ - protected function lastPage() - { - return $this->paginator->lastPage(); - } +use Illuminate\Contracts\Pagination\LengthAwarePaginator as PaginatorContract; +class UrlWindow +{ + /** + * The paginator implementation. + * + * @var \Illuminate\Contracts\Pagination\LengthAwarePaginator + */ + protected $paginator; + + /** + * Create a new URL window instance. + * + * @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator + * @return void + */ + public function __construct(PaginatorContract $paginator) + { + $this->paginator = $paginator; + } + + /** + * Create a new URL window instance. + * + * @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator + * @param int $onEachSide + * @return array + */ + public static function make(PaginatorContract $paginator, $onEachSide = 3) + { + return (new static($paginator))->get($onEachSide); + } + + /** + * Get the window of URLs to be shown. + * + * @param int $onEachSide + * @return array + */ + public function get($onEachSide = 3) + { + if ($this->paginator->lastPage() < ($onEachSide * 2) + 6) { + return $this->getSmallSlider(); + } + + return $this->getUrlSlider($onEachSide); + } + + /** + * Get the slider of URLs there are not enough pages to slide. + * + * @return array + */ + protected function getSmallSlider() + { + return [ + 'first' => $this->paginator->getUrlRange(1, $this->lastPage()), + 'slider' => null, + 'last' => null, + ]; + } + + /** + * Create a URL slider links. + * + * @param int $onEachSide + * @return array + */ + protected function getUrlSlider($onEachSide) + { + $window = $onEachSide * 2; + + if (! $this->hasPages()) { + return [ + 'first' => null, + 'slider' => null, + 'last' => null, + ]; + } + + // If the current page is very close to the beginning of the page range, we will + // just render the beginning of the page range, followed by the last 2 of the + // links in this list, since we will not have room to create a full slider. + if ($this->currentPage() <= $window) { + return $this->getSliderTooCloseToBeginning($window); + } + + // If the current page is close to the ending of the page range we will just get + // this first couple pages, followed by a larger window of these ending pages + // since we're too close to the end of the list to create a full on slider. + elseif ($this->currentPage() > ($this->lastPage() - $window)) { + return $this->getSliderTooCloseToEnding($window); + } + + // If we have enough room on both sides of the current page to build a slider we + // will surround it with both the beginning and ending caps, with this window + // of pages in the middle providing a Google style sliding paginator setup. + return $this->getFullSlider($onEachSide); + } + + /** + * Get the slider of URLs when too close to beginning of window. + * + * @param int $window + * @return array + */ + protected function getSliderTooCloseToBeginning($window) + { + return [ + 'first' => $this->paginator->getUrlRange(1, $window + 2), + 'slider' => null, + 'last' => $this->getFinish(), + ]; + } + + /** + * Get the slider of URLs when too close to ending of window. + * + * @param int $window + * @return array + */ + protected function getSliderTooCloseToEnding($window) + { + $last = $this->paginator->getUrlRange( + $this->lastPage() - ($window + 2), + $this->lastPage() + ); + + return [ + 'first' => $this->getStart(), + 'slider' => null, + 'last' => $last, + ]; + } + + /** + * Get the slider of URLs when a full slider can be made. + * + * @param int $onEachSide + * @return array + */ + protected function getFullSlider($onEachSide) + { + return [ + 'first' => $this->getStart(), + 'slider' => $this->getAdjacentUrlRange($onEachSide), + 'last' => $this->getFinish(), + ]; + } + + /** + * Get the page range for the current page window. + * + * @param int $onEachSide + * @return array + */ + public function getAdjacentUrlRange($onEachSide) + { + return $this->paginator->getUrlRange( + $this->currentPage() - $onEachSide, + $this->currentPage() + $onEachSide + ); + } + + /** + * Get the starting URLs of a pagination slider. + * + * @return array + */ + public function getStart() + { + return $this->paginator->getUrlRange(1, 2); + } + + /** + * Get the ending URLs of a pagination slider. + * + * @return array + */ + public function getFinish() + { + return $this->paginator->getUrlRange( + $this->lastPage() - 1, + $this->lastPage() + ); + } + + /** + * Determine if the underlying paginator being presented has pages to show. + * + * @return bool + */ + public function hasPages() + { + return $this->paginator->lastPage() > 1; + } + + /** + * Get the current page from the paginator. + * + * @return int + */ + protected function currentPage() + { + return $this->paginator->currentPage(); + } + + /** + * Get the last page from the paginator. + * + * @return int + */ + protected function lastPage() + { + return $this->paginator->lastPage(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Pagination/UrlWindowPresenterTrait.php b/application/vendor/laravel/framework/src/Illuminate/Pagination/UrlWindowPresenterTrait.php index 1b13483..64a3397 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Pagination/UrlWindowPresenterTrait.php +++ b/application/vendor/laravel/framework/src/Illuminate/Pagination/UrlWindowPresenterTrait.php @@ -1,70 +1,66 @@ -window['first'])) - { - $html .= $this->getUrlLinks($this->window['first']); - } + if (is_array($this->window['first'])) { + $html .= $this->getUrlLinks($this->window['first']); + } - if (is_array($this->window['slider'])) - { - $html .= $this->getDots(); - $html .= $this->getUrlLinks($this->window['slider']); - } + if (is_array($this->window['slider'])) { + $html .= $this->getDots(); + $html .= $this->getUrlLinks($this->window['slider']); + } - if (is_array($this->window['last'])) - { - $html .= $this->getDots(); - $html .= $this->getUrlLinks($this->window['last']); - } + if (is_array($this->window['last'])) { + $html .= $this->getDots(); + $html .= $this->getUrlLinks($this->window['last']); + } - return $html; - } + return $html; + } - /** - * Get the links for the URLs in the given array. - * - * @param array $urls - * @return string - */ - protected function getUrlLinks(array $urls) - { - $html = ''; + /** + * Get the links for the URLs in the given array. + * + * @param array $urls + * @return string + */ + protected function getUrlLinks(array $urls) + { + $html = ''; - foreach ($urls as $page => $url) - { - $html .= $this->getPageLinkWrapper($url, $page); - } + foreach ($urls as $page => $url) { + $html .= $this->getPageLinkWrapper($url, $page); + } - return $html; - } + return $html; + } - /** - * Get HTML wrapper for a page link. - * - * @param string $url - * @param int $page - * @param string|null $rel - * @return string - */ - protected function getPageLinkWrapper($url, $page, $rel = null) - { - if ($page == $this->paginator->currentPage()) - { - return $this->getActivePageWrapper($page); - } - - return $this->getAvailablePageWrapper($url, $page, $rel); - } + /** + * Get HTML wrapper for a page link. + * + * @param string $url + * @param int $page + * @param string|null $rel + * @return string + */ + protected function getPageLinkWrapper($url, $page, $rel = null) + { + if ($page == $this->paginator->currentPage()) { + return $this->getActivePageWrapper($page); + } + return $this->getAvailablePageWrapper($url, $page, $rel); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Pagination/composer.json b/application/vendor/laravel/framework/src/Illuminate/Pagination/composer.json index 9ac2f69..871c66e 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Pagination/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Pagination/composer.json @@ -14,9 +14,9 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*" + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*" }, "autoload": { "psr-4": { @@ -25,7 +25,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Pipeline/Hub.php b/application/vendor/laravel/framework/src/Illuminate/Pipeline/Hub.php index 2ad1bd9..ed48df4 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Pipeline/Hub.php +++ b/application/vendor/laravel/framework/src/Illuminate/Pipeline/Hub.php @@ -1,73 +1,74 @@ -container = $container; - } + /** + * All of the available pipelines. + * + * @var array + */ + protected $pipelines = []; - /** - * Define the default named pipeline. - * - * @param \Closure $callback - * @return void - */ - public function defaults(Closure $callback) - { - return $this->pipeline('default', $callback); - } + /** + * Create a new Depot instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function __construct(Container $container) + { + $this->container = $container; + } - /** - * Define a new named pipeline. - * - * @param string $name - * @param \Closure $callback - * @return void - */ - public function pipeline($name, Closure $callback) - { - $this->pipelines[$name] = $callback; - } + /** + * Define the default named pipeline. + * + * @param \Closure $callback + * @return void + */ + public function defaults(Closure $callback) + { + return $this->pipeline('default', $callback); + } - /** - * Send an object through one of the available pipelines. - * - * @param mixed $object - * @param string|null $pipeline - * @return mixed - */ - public function pipe($object, $pipeline = null) - { - $pipeline = $pipeline ?: 'default'; + /** + * Define a new named pipeline. + * + * @param string $name + * @param \Closure $callback + * @return void + */ + public function pipeline($name, Closure $callback) + { + $this->pipelines[$name] = $callback; + } - return call_user_func( - $this->pipelines[$pipeline], new Pipeline($this->container), $object - ); - } + /** + * Send an object through one of the available pipelines. + * + * @param mixed $object + * @param string|null $pipeline + * @return mixed + */ + public function pipe($object, $pipeline = null) + { + $pipeline = $pipeline ?: 'default'; + return call_user_func( + $this->pipelines[$pipeline], new Pipeline($this->container), $object + ); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php b/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php index bfcc4e2..12aa6d7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php +++ b/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php @@ -1,145 +1,159 @@ -container = $container; - } - - /** - * Set the object being sent through the pipeline. - * - * @param mixed $passable - * @return $this - */ - public function send($passable) - { - $this->passable = $passable; - - return $this; - } - - /** - * Set the array of pipes. - * - * @param dynamic|array $pipes - * @return $this - */ - public function through($pipes) - { - $this->pipes = is_array($pipes) ? $pipes : func_get_args(); - - return $this; - } - - /** - * Set the method to call on the pipes. - * - * @param string $method - * @return $this - */ - public function via($method) - { - $this->method = $method; - - return $this; - } - - /** - * Run the pipeline with a final destination callback. - * - * @param \Closure $destination - * @return mixed - */ - public function then(Closure $destination) - { - $firstSlice = $this->getInitialSlice($destination); - - $pipes = array_reverse($this->pipes); - - return call_user_func( - array_reduce($pipes, $this->getSlice(), $firstSlice), $this->passable - ); - } - - /** - * Get a Closure that represents a slice of the application onion. - * - * @return \Closure - */ - protected function getSlice() - { - return function($stack, $pipe) - { - return function($passable) use ($stack, $pipe) - { - // If the pipe is an instance of a Closure, we will just call it directly but - // otherwise we'll resolve the pipes out of the container and call it with - // the appropriate method and arguments, returning the results back out. - if ($pipe instanceof Closure) - { - return call_user_func($pipe, $passable, $stack); - } - else - { - return $this->container->make($pipe) - ->{$this->method}($passable, $stack); - } - }; - }; - } - - /** - * Get the initial slice to begin the stack call. - * - * @param \Closure $destination - * @return \Closure - */ - protected function getInitialSlice(Closure $destination) - { - return function($passable) use ($destination) - { - return call_user_func($destination, $passable); - }; - } - +class Pipeline implements PipelineContract +{ + /** + * The container implementation. + * + * @var \Illuminate\Contracts\Container\Container + */ + protected $container; + + /** + * The object being passed through the pipeline. + * + * @var mixed + */ + protected $passable; + + /** + * The array of class pipes. + * + * @var array + */ + protected $pipes = []; + + /** + * The method to call on each pipe. + * + * @var string + */ + protected $method = 'handle'; + + /** + * Create a new class instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function __construct(Container $container) + { + $this->container = $container; + } + + /** + * Set the object being sent through the pipeline. + * + * @param mixed $passable + * @return $this + */ + public function send($passable) + { + $this->passable = $passable; + + return $this; + } + + /** + * Set the array of pipes. + * + * @param array|mixed $pipes + * @return $this + */ + public function through($pipes) + { + $this->pipes = is_array($pipes) ? $pipes : func_get_args(); + + return $this; + } + + /** + * Set the method to call on the pipes. + * + * @param string $method + * @return $this + */ + public function via($method) + { + $this->method = $method; + + return $this; + } + + /** + * Run the pipeline with a final destination callback. + * + * @param \Closure $destination + * @return mixed + */ + public function then(Closure $destination) + { + $firstSlice = $this->getInitialSlice($destination); + + $pipes = array_reverse($this->pipes); + + return call_user_func( + array_reduce($pipes, $this->getSlice(), $firstSlice), $this->passable + ); + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function getSlice() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + // If the pipe is an instance of a Closure, we will just call it directly but + // otherwise we'll resolve the pipes out of the container and call it with + // the appropriate method and arguments, returning the results back out. + if ($pipe instanceof Closure) { + return call_user_func($pipe, $passable, $stack); + } else { + list($name, $parameters) = $this->parsePipeString($pipe); + + return call_user_func_array([$this->container->make($name), $this->method], + array_merge([$passable, $stack], $parameters)); + } + }; + }; + } + + /** + * Get the initial slice to begin the stack call. + * + * @param \Closure $destination + * @return \Closure + */ + protected function getInitialSlice(Closure $destination) + { + return function ($passable) use ($destination) { + return call_user_func($destination, $passable); + }; + } + + /** + * Parse full pipe string to get name and parameters. + * + * @param string $pipe + * @return array + */ + protected function parsePipeString($pipe) + { + list($name, $parameters) = array_pad(explode(':', $pipe, 2), 2, []); + + if (is_string($parameters)) { + $parameters = explode(',', $parameters); + } + + return [$name, $parameters]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Pipeline/PipelineServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Pipeline/PipelineServiceProvider.php index dccd250..aceaddf 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Pipeline/PipelineServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Pipeline/PipelineServiceProvider.php @@ -1,38 +1,39 @@ -app->singleton( - 'Illuminate\Contracts\Pipeline\Hub', 'Illuminate\Pipeline\Hub' - ); - } +class PipelineServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - 'Illuminate\Contracts\Pipeline\Hub', - ]; - } + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton( + 'Illuminate\Contracts\Pipeline\Hub', 'Illuminate\Pipeline\Hub' + ); + } + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'Illuminate\Contracts\Pipeline\Hub', + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Pipeline/composer.json b/application/vendor/laravel/framework/src/Illuminate/Pipeline/composer.json index 97ef7ec..85b0734 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Pipeline/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Pipeline/composer.json @@ -14,9 +14,9 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*" + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*" }, "autoload": { "psr-4": { @@ -25,7 +25,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php b/application/vendor/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php index 34f6780..ad090ac 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php @@ -1,143 +1,143 @@ -default = $default; - $this->timeToRun = $timeToRun; - $this->pheanstalk = $pheanstalk; - } - - /** - * Push a new job onto the queue. - * - * @param string $job - * @param mixed $data - * @param string $queue - * @return mixed - */ - public function push($job, $data = '', $queue = null) - { - return $this->pushRaw($this->createPayload($job, $data), $queue); - } - - /** - * Push a raw payload onto the queue. - * - * @param string $payload - * @param string $queue - * @param array $options - * @return mixed - */ - public function pushRaw($payload, $queue = null, array $options = array()) - { - return $this->pheanstalk->useTube($this->getQueue($queue))->put( - $payload, Pheanstalk::DEFAULT_PRIORITY, Pheanstalk::DEFAULT_DELAY, $this->timeToRun - ); - } - - /** - * Push a new job onto the queue after a delay. - * - * @param \DateTime|int $delay - * @param string $job - * @param mixed $data - * @param string $queue - * @return mixed - */ - public function later($delay, $job, $data = '', $queue = null) - { - $payload = $this->createPayload($job, $data); - - $pheanstalk = $this->pheanstalk->useTube($this->getQueue($queue)); - - return $pheanstalk->put($payload, Pheanstalk::DEFAULT_PRIORITY, $this->getSeconds($delay), $this->timeToRun); - } - - /** - * Pop the next job off of the queue. - * - * @param string $queue - * @return \Illuminate\Contracts\Queue\Job|null - */ - public function pop($queue = null) - { - $queue = $this->getQueue($queue); - - $job = $this->pheanstalk->watchOnly($queue)->reserve(0); - - if ($job instanceof PheanstalkJob) - { - return new BeanstalkdJob($this->container, $this->pheanstalk, $job, $queue); - } - } - - /** - * Delete a message from the Beanstalk queue. - * - * @param string $queue - * @param string $id - * @return void - */ - public function deleteMessage($queue, $id) - { - $this->pheanstalk->useTube($this->getQueue($queue))->delete($id); - } - - /** - * Get the queue or return the default. - * - * @param string|null $queue - * @return string - */ - public function getQueue($queue) - { - return $queue ?: $this->default; - } - - /** - * Get the underlying Pheanstalk instance. - * - * @return \Pheanstalk_Pheanstalk - */ - public function getPheanstalk() - { - return $this->pheanstalk; - } - +class BeanstalkdQueue extends Queue implements QueueContract +{ + /** + * The Pheanstalk instance. + * + * @var \Pheanstalk\Pheanstalk + */ + protected $pheanstalk; + + /** + * The name of the default tube. + * + * @var string + */ + protected $default; + + /** + * The "time to run" for all pushed jobs. + * + * @var int + */ + protected $timeToRun; + + /** + * Create a new Beanstalkd queue instance. + * + * @param \Pheanstalk\Pheanstalk $pheanstalk + * @param string $default + * @param int $timeToRun + * @return void + */ + public function __construct(Pheanstalk $pheanstalk, $default, $timeToRun) + { + $this->default = $default; + $this->timeToRun = $timeToRun; + $this->pheanstalk = $pheanstalk; + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + return $this->pushRaw($this->createPayload($job, $data), $queue); + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + return $this->pheanstalk->useTube($this->getQueue($queue))->put( + $payload, Pheanstalk::DEFAULT_PRIORITY, Pheanstalk::DEFAULT_DELAY, $this->timeToRun + ); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTime|int $delay + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + $payload = $this->createPayload($job, $data); + + $pheanstalk = $this->pheanstalk->useTube($this->getQueue($queue)); + + return $pheanstalk->put($payload, Pheanstalk::DEFAULT_PRIORITY, $this->getSeconds($delay), $this->timeToRun); + } + + /** + * Pop the next job off of the queue. + * + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + $queue = $this->getQueue($queue); + + $job = $this->pheanstalk->watchOnly($queue)->reserve(0); + + if ($job instanceof PheanstalkJob) { + return new BeanstalkdJob($this->container, $this->pheanstalk, $job, $queue); + } + } + + /** + * Delete a message from the Beanstalk queue. + * + * @param string $queue + * @param string $id + * @return void + */ + public function deleteMessage($queue, $id) + { + $this->pheanstalk->useTube($this->getQueue($queue))->delete($id); + } + + /** + * Get the queue or return the default. + * + * @param string|null $queue + * @return string + */ + public function getQueue($queue) + { + return $queue ?: $this->default; + } + + /** + * Get the underlying Pheanstalk instance. + * + * @return \Pheanstalk\Pheanstalk + */ + public function getPheanstalk() + { + return $this->pheanstalk; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php b/application/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php index 30f1409..dc16c88 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php @@ -1,82 +1,80 @@ -dispatcher = $dispatcher; - } +class CallQueuedHandler +{ + /** + * The bus dispatcher implementation. + * + * @var \Illuminate\Contracts\Bus\Dispatcher + */ + protected $dispatcher; - /** - * Handle the queued job. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param array $data - * @return void - */ - public function call(Job $job, array $data) - { - $command = $this->setJobInstanceIfNecessary( - $job, unserialize($data['command']) - ); + /** + * Create a new handler instance. + * + * @param \Illuminate\Contracts\Bus\Dispatcher $dispatcher + * @return void + */ + public function __construct(Dispatcher $dispatcher) + { + $this->dispatcher = $dispatcher; + } - $this->dispatcher->dispatchNow($command, function($handler) use ($job) - { - $this->setJobInstanceIfNecessary($job, $handler); - }); + /** + * Handle the queued job. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param array $data + * @return void + */ + public function call(Job $job, array $data) + { + $command = $this->setJobInstanceIfNecessary( + $job, unserialize($data['command']) + ); - if ( ! $job->isDeletedOrReleased()) - { - $job->delete(); - } - } + $this->dispatcher->dispatchNow($command, function ($handler) use ($job) { + $this->setJobInstanceIfNecessary($job, $handler); + }); - /** - * Set the job instance of the given class if necessary. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param mixed $instance - * @return mixed - */ - protected function setJobInstanceIfNecessary(Job $job, $instance) - { - if (in_array('Illuminate\Queue\InteractsWithQueue', class_uses_recursive(get_class($instance)))) - { - $instance->setJob($job); - } + if (! $job->isDeletedOrReleased()) { + $job->delete(); + } + } - return $instance; - } + /** + * Set the job instance of the given class if necessary. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param mixed $instance + * @return mixed + */ + protected function setJobInstanceIfNecessary(Job $job, $instance) + { + if (in_array('Illuminate\Queue\InteractsWithQueue', class_uses_recursive(get_class($instance)))) { + $instance->setJob($job); + } - /** - * Call the failed method on the job instance. - * - * @return void - */ - public function failed(array $data) - { - $handler = $this->dispatcher->resolveHandler($command = unserialize($data['command'])); + return $instance; + } - if (method_exists($handler, 'failed')) - { - call_user_func([$handler, 'failed'], $command); - } - } + /** + * Call the failed method on the job instance. + * + * @param array $data + * @return void + */ + public function failed(array $data) + { + $handler = $this->dispatcher->resolveHandler($command = unserialize($data['command'])); + if (method_exists($handler, 'failed')) { + call_user_func([$handler, 'failed'], $command); + } + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Capsule/Manager.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Capsule/Manager.php index bc78a21..179be60 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Capsule/Manager.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Capsule/Manager.php @@ -1,182 +1,183 @@ -setupContainer($container ?: new Container); - - // Once we have the container setup, we will setup the default configuration - // options in the container "config" bindings. This just makes this queue - // manager behave correctly since all the correct binding are in place. - $this->setupDefaultConfiguration(); - - $this->setupManager(); - - $this->registerConnectors(); - } - - /** - * Setup the default queue configuration options. - * - * @return void - */ - protected function setupDefaultConfiguration() - { - $this->container['config']['queue.default'] = 'default'; - } - - /** - * Build the queue manager instance. - * - * @return void - */ - protected function setupManager() - { - $this->manager = new QueueManager($this->container); - } - - /** - * Register the default connectors that the component ships with. - * - * @return void - */ - protected function registerConnectors() - { - $provider = new QueueServiceProvider($this->container); - - $provider->registerConnectors($this->manager); - } - - /** - * Get a connection instance from the global manager. - * - * @param string $connection - * @return \Illuminate\Contracts\Queue\Queue - */ - public static function connection($connection = null) - { - return static::$instance->getConnection($connection); - } - - /** - * Push a new job onto the queue. - * - * @param string $job - * @param mixed $data - * @param string $queue - * @param string $connection - * @return mixed - */ - public static function push($job, $data = '', $queue = null, $connection = null) - { - return static::$instance->connection($connection)->push($job, $data, $queue); - } - - /** - * Push a new an array of jobs onto the queue. - * - * @param array $jobs - * @param mixed $data - * @param string $queue - * @param string $connection - * @return mixed - */ - public static function bulk($jobs, $data = '', $queue = null, $connection = null) - { - return static::$instance->connection($connection)->bulk($jobs, $data, $queue); - } - - /** - * Push a new job onto the queue after a delay. - * - * @param \DateTime|int $delay - * @param string $job - * @param mixed $data - * @param string $queue - * @param string $connection - * @return mixed - */ - public static function later($delay, $job, $data = '', $queue = null, $connection = null) - { - return static::$instance->connection($connection)->later($delay, $job, $data, $queue); - } - - /** - * Get a registered connection instance. - * - * @param string $name - * @return \Illuminate\Contracts\Queue\Queue - */ - public function getConnection($name = null) - { - return $this->manager->connection($name); - } - - /** - * Register a connection with the manager. - * - * @param array $config - * @param string $name - * @return void - */ - public function addConnection(array $config, $name = 'default') - { - $this->container['config']["queue.connections.{$name}"] = $config; - } - - /** - * Get the queue manager instance. - * - * @return \Illuminate\Queue\QueueManager - */ - public function getQueueManager() - { - return $this->manager; - } - - /** - * Pass dynamic instance methods to the manager. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return call_user_func_array(array($this->manager, $method), $parameters); - } - - /** - * Dynamically pass methods to the default connection. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public static function __callStatic($method, $parameters) - { - return call_user_func_array(array(static::connection(), $method), $parameters); - } - +class Manager +{ + use CapsuleManagerTrait; + + /** + * The queue manager instance. + * + * @var \Illuminate\Queue\QueueManager + */ + protected $manager; + + /** + * Create a new queue capsule manager. + * + * @param \Illuminate\Container\Container $container + * @return void + */ + public function __construct(Container $container = null) + { + $this->setupContainer($container ?: new Container); + + // Once we have the container setup, we will setup the default configuration + // options in the container "config" bindings. This just makes this queue + // manager behave correctly since all the correct binding are in place. + $this->setupDefaultConfiguration(); + + $this->setupManager(); + + $this->registerConnectors(); + } + + /** + * Setup the default queue configuration options. + * + * @return void + */ + protected function setupDefaultConfiguration() + { + $this->container['config']['queue.default'] = 'default'; + } + + /** + * Build the queue manager instance. + * + * @return void + */ + protected function setupManager() + { + $this->manager = new QueueManager($this->container); + } + + /** + * Register the default connectors that the component ships with. + * + * @return void + */ + protected function registerConnectors() + { + $provider = new QueueServiceProvider($this->container); + + $provider->registerConnectors($this->manager); + } + + /** + * Get a connection instance from the global manager. + * + * @param string $connection + * @return \Illuminate\Contracts\Queue\Queue + */ + public static function connection($connection = null) + { + return static::$instance->getConnection($connection); + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @param string $connection + * @return mixed + */ + public static function push($job, $data = '', $queue = null, $connection = null) + { + return static::$instance->connection($connection)->push($job, $data, $queue); + } + + /** + * Push a new an array of jobs onto the queue. + * + * @param array $jobs + * @param mixed $data + * @param string $queue + * @param string $connection + * @return mixed + */ + public static function bulk($jobs, $data = '', $queue = null, $connection = null) + { + return static::$instance->connection($connection)->bulk($jobs, $data, $queue); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTime|int $delay + * @param string $job + * @param mixed $data + * @param string $queue + * @param string $connection + * @return mixed + */ + public static function later($delay, $job, $data = '', $queue = null, $connection = null) + { + return static::$instance->connection($connection)->later($delay, $job, $data, $queue); + } + + /** + * Get a registered connection instance. + * + * @param string $name + * @return \Illuminate\Contracts\Queue\Queue + */ + public function getConnection($name = null) + { + return $this->manager->connection($name); + } + + /** + * Register a connection with the manager. + * + * @param array $config + * @param string $name + * @return void + */ + public function addConnection(array $config, $name = 'default') + { + $this->container['config']["queue.connections.{$name}"] = $config; + } + + /** + * Get the queue manager instance. + * + * @return \Illuminate\Queue\QueueManager + */ + public function getQueueManager() + { + return $this->manager; + } + + /** + * Pass dynamic instance methods to the manager. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return call_user_func_array([$this->manager, $method], $parameters); + } + + /** + * Dynamically pass methods to the default connection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + return call_user_func_array([static::connection(), $method], $parameters); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php index a613807..1087415 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php @@ -1,24 +1,26 @@ -connections = $connections; - } +class DatabaseConnector implements ConnectorInterface +{ + /** + * Database connections. + * + * @var \Illuminate\Database\ConnectionResolverInterface + */ + protected $connections; - /** - * Establish a queue connection. - * - * @param array $config - * @return \Illuminate\Contracts\Queue\Queue - */ - public function connect(array $config) - { - return new DatabaseQueue( - $this->connections->connection(array_get($config, 'connection')), - $config['table'], - $config['queue'], - array_get($config, 'expire', 60) - ); - } + /** + * Create a new connector instance. + * + * @param \Illuminate\Database\ConnectionResolverInterface $connections + * @return void + */ + public function __construct(ConnectionResolverInterface $connections) + { + $this->connections = $connections; + } + /** + * Establish a queue connection. + * + * @param array $config + * @return \Illuminate\Contracts\Queue\Queue + */ + public function connect(array $config) + { + return new DatabaseQueue( + $this->connections->connection(Arr::get($config, 'connection')), + $config['table'], + $config['queue'], + Arr::get($config, 'expire', 60) + ); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/IronConnector.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/IronConnector.php index cf40d8b..d103c19 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/IronConnector.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/IronConnector.php @@ -1,59 +1,61 @@ -crypt = $crypt; - $this->request = $request; - } - - /** - * Establish a queue connection. - * - * @param array $config - * @return \Illuminate\Contracts\Queue\Queue - */ - public function connect(array $config) - { - $ironConfig = array('token' => $config['token'], 'project_id' => $config['project']); - - if (isset($config['host'])) $ironConfig['host'] = $config['host']; - - $iron = new IronMQ($ironConfig); - - if (isset($config['ssl_verifypeer'])) - { - $iron->ssl_verifypeer = $config['ssl_verifypeer']; - } - - return new IronQueue($iron, $this->request, $config['queue'], $config['encrypt']); - } - +class IronConnector implements ConnectorInterface +{ + /** + * The encrypter instance. + * + * @var \Illuminate\Encryption\Encrypter + */ + protected $crypt; + + /** + * The current request instance. + * + * @var \Illuminate\Http\Request + */ + protected $request; + + /** + * Create a new Iron connector instance. + * + * @param \Illuminate\Contracts\Encryption\Encrypter $crypt + * @param \Illuminate\Http\Request $request + * @return void + */ + public function __construct(EncrypterContract $crypt, Request $request) + { + $this->crypt = $crypt; + $this->request = $request; + } + + /** + * Establish a queue connection. + * + * @param array $config + * @return \Illuminate\Contracts\Queue\Queue + */ + public function connect(array $config) + { + $ironConfig = ['token' => $config['token'], 'project_id' => $config['project']]; + + if (isset($config['host'])) { + $ironConfig['host'] = $config['host']; + } + + $iron = new IronMQ($ironConfig); + + if (isset($config['ssl_verifypeer'])) { + $iron->ssl_verifypeer = $config['ssl_verifypeer']; + } + + return new IronQueue($iron, $this->request, $config['queue'], $config['encrypt']); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/NullConnector.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/NullConnector.php index 9d3689d..39de480 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/NullConnector.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/NullConnector.php @@ -1,18 +1,19 @@ -redis = $redis; - $this->connection = $connection; - } - - /** - * Establish a queue connection. - * - * @param array $config - * @return \Illuminate\Contracts\Queue\Queue - */ - public function connect(array $config) - { - $queue = new RedisQueue( - $this->redis, $config['queue'], array_get($config, 'connection', $this->connection) - ); - - $queue->setExpire(array_get($config, 'expire', 60)); - - return $queue; - } - +class RedisConnector implements ConnectorInterface +{ + /** + * The Redis database instance. + * + * @var \Illuminate\Redis\Database + */ + protected $redis; + + /** + * The connection name. + * + * @var string + */ + protected $connection; + + /** + * Create a new Redis queue connector instance. + * + * @param \Illuminate\Redis\Database $redis + * @param string|null $connection + * @return void + */ + public function __construct(Database $redis, $connection = null) + { + $this->redis = $redis; + $this->connection = $connection; + } + + /** + * Establish a queue connection. + * + * @param array $config + * @return \Illuminate\Contracts\Queue\Queue + */ + public function connect(array $config) + { + $queue = new RedisQueue( + $this->redis, $config['queue'], Arr::get($config, 'connection', $this->connection) + ); + + $queue->setExpire(Arr::get($config, 'expire', 60)); + + return $queue; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php index c161d47..4e8e5e6 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php @@ -1,21 +1,46 @@ -getDefaultConfiguration($config); - /** - * Establish a queue connection. - * - * @param array $config - * @return \Illuminate\Contracts\Queue\Queue - */ - public function connect(array $config) - { - $sqs = SqsClient::factory($config); + if ($config['key'] && $config['secret']) { + $config['credentials'] = Arr::only($config, ['key', 'secret']); + } - return new SqsQueue($sqs, $config['queue']); - } + return new SqsQueue( + new SqsClient($config), $config['queue'], Arr::get($config, 'prefix', '') + ); + } + /** + * Get the default configuration for SQS. + * + * @param array $config + * @return array + */ + protected function getDefaultConfiguration(array $config) + { + return array_merge([ + 'version' => 'latest', + 'http' => [ + 'timeout' => 60, + 'connect_timeout' => 60, + ], + ], $config); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SyncConnector.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SyncConnector.php index 468d61b..4269b80 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SyncConnector.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SyncConnector.php @@ -1,18 +1,19 @@ -files = $files; - $this->composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $fullPath = $this->createBaseMigration(); - - $table = $this->laravel['config']['queue.failed.table']; - - $stub = str_replace( - '{{table}}', $table, $this->files->get(__DIR__.'/stubs/failed_jobs.stub') - ); - - $this->files->put($fullPath, $stub); - - $this->info('Migration created successfully!'); - - $this->composer->dumpAutoloads(); - } - - /** - * Create a base migration file for the table. - * - * @return string - */ - protected function createBaseMigration() - { - $name = 'create_failed_jobs_table'; - - $path = $this->laravel->databasePath().'/migrations'; - - return $this->laravel['migration.creator']->create($name, $path); - } - +class FailedTableCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'queue:failed-table'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Create a migration for the failed queue jobs database table'; + + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * @var \Illuminate\Foundation\Composer + */ + protected $composer; + + /** + * Create a new failed queue jobs table command instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @param \Illuminate\Foundation\Composer $composer + * @return void + */ + public function __construct(Filesystem $files, Composer $composer) + { + parent::__construct(); + + $this->files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $table = $this->laravel['config']['queue.failed.table']; + + $tableClassName = Str::studly($table); + + $fullPath = $this->createBaseMigration($table); + + $stub = str_replace( + ['{{table}}', '{{tableClassName}}'], [$table, $tableClassName], $this->files->get(__DIR__.'/stubs/failed_jobs.stub') + ); + + $this->files->put($fullPath, $stub); + + $this->info('Migration created successfully!'); + + $this->composer->dumpAutoloads(); + } + + /** + * Create a base migration file for the table. + * + * @param string $table + * @return string + */ + protected function createBaseMigration($table = 'failed_jobs') + { + $name = 'create_'.$table.'_table'; + + $path = $this->laravel->databasePath().'/migrations'; + + return $this->laravel['migration.creator']->create($name, $path); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/FlushFailedCommand.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/FlushFailedCommand.php index 0ece99b..fc21093 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/FlushFailedCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/FlushFailedCommand.php @@ -1,33 +1,34 @@ -laravel['queue.failer']->flush(); + /** + * The console command description. + * + * @var string + */ + protected $description = 'Flush all of the failed queue jobs'; - $this->info('All failed jobs deleted successfully!'); - } + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $this->laravel['queue.failer']->flush(); + $this->info('All failed jobs deleted successfully!'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/ForgetFailedCommand.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/ForgetFailedCommand.php index fef76f0..2a016cf 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/ForgetFailedCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/ForgetFailedCommand.php @@ -1,51 +1,49 @@ -laravel['queue.failer']->forget($this->argument('id'))) - { - $this->info('Failed job deleted successfully!'); - } - else - { - $this->error('No failed job matches the given ID.'); - } - } + /** + * The console command description. + * + * @var string + */ + protected $description = 'Delete a failed queue job'; - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return array( - array('id', InputArgument::REQUIRED, 'The ID of the failed job'), - ); - } + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + if ($this->laravel['queue.failer']->forget($this->argument('id'))) { + $this->info('Failed job deleted successfully!'); + } else { + $this->error('No failed job matches the given ID.'); + } + } + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['id', InputArgument::REQUIRED, 'The ID of the failed job'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/ListFailedCommand.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/ListFailedCommand.php index 03bc411..27b4df7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/ListFailedCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/ListFailedCommand.php @@ -1,62 +1,113 @@ -laravel['queue.failer']->all() as $failed) - { - $rows[] = $this->parseFailedJob((array) $failed); - } - - if (count($rows) == 0) - { - return $this->info('No failed jobs!'); - } - - $table = $this->getHelperSet()->get('table'); - - $table->setHeaders(array('ID', 'Connection', 'Queue', 'Class', 'Failed At')) - ->setRows($rows) - ->render($this->output); - } - - /** - * Parse the failed job row. - * - * @param array $failed - * @return array - */ - protected function parseFailedJob(array $failed) - { - $row = array_values(array_except($failed, array('payload'))); - - array_splice($row, 3, 0, array_get(json_decode($failed['payload'], true), 'job')); - - return $row; - } +class ListFailedCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'queue:failed'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'List all of the failed queue jobs'; + + /** + * The table headers for the command. + * + * @var array + */ + protected $headers = ['ID', 'Connection', 'Queue', 'Class', 'Failed At']; + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $jobs = $this->getFailedJobs(); + + if (count($jobs) == 0) { + return $this->info('No failed jobs!'); + } + + $this->displayFailedJobs($jobs); + } + + /** + * Compile the failed jobs into a displayable format. + * + * @return array + */ + protected function getFailedJobs() + { + $results = []; + + foreach ($this->laravel['queue.failer']->all() as $failed) { + $results[] = $this->parseFailedJob((array) $failed); + } + + return array_filter($results); + } + + /** + * Parse the failed job row. + * + * @param array $failed + * @return array + */ + protected function parseFailedJob(array $failed) + { + $row = array_values(Arr::except($failed, ['payload'])); + + array_splice($row, 3, 0, $this->extractJobName($failed['payload'])); + + return $row; + } + + /** + * Extract the failed job name from payload. + * + * @param string $payload + * @return string|null + */ + private function extractJobName($payload) + { + $payload = json_decode($payload, true); + + if ($payload && (! isset($payload['data']['command']))) { + return Arr::get($payload, 'job'); + } + + if ($payload && isset($payload['data']['command'])) { + preg_match('/"([^"]+)"/', $payload['data']['command'], $matches); + + if (isset($matches[1])) { + return $matches[1]; + } else { + return Arr::get($payload, 'job'); + } + } + } + /** + * Display the failed jobs in the console. + * + * @param array $jobs + * @return void + */ + protected function displayFailedJobs(array $jobs) + { + $this->table($this->headers, $jobs); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/ListenCommand.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/ListenCommand.php index 408d564..67de1d1 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/ListenCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/ListenCommand.php @@ -1,145 +1,144 @@ -listener = $listener; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $this->setListenerOptions(); - - $delay = $this->input->getOption('delay'); - - // The memory limit is the amount of memory we will allow the script to occupy - // before killing it and letting a process manager restart it for us, which - // is to protect us against any memory leaks that will be in the scripts. - $memory = $this->input->getOption('memory'); - - $connection = $this->input->getArgument('connection'); - - $timeout = $this->input->getOption('timeout'); - - // We need to get the right queue for the connection which is set in the queue - // configuration file for the application. We will pull it based on the set - // connection being run for the queue operation currently being executed. - $queue = $this->getQueue($connection); - - $this->listener->listen( - $connection, $queue, $delay, $memory, $timeout - ); - } - - /** - * Get the name of the queue connection to listen on. - * - * @param string $connection - * @return string - */ - protected function getQueue($connection) - { - if (is_null($connection)) - { - $connection = $this->laravel['config']['queue.default']; - } - - $queue = $this->laravel['config']->get("queue.connections.{$connection}.queue", 'default'); - - return $this->input->getOption('queue') ?: $queue; - } - - /** - * Set the options on the queue listener. - * - * @return void - */ - protected function setListenerOptions() - { - $this->listener->setEnvironment($this->laravel->environment()); - - $this->listener->setSleep($this->option('sleep')); - - $this->listener->setMaxTries($this->option('tries')); - - $this->listener->setOutputHandler(function($type, $line) - { - $this->output->write($line); - }); - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return array( - array('connection', InputArgument::OPTIONAL, 'The name of connection'), - ); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('queue', null, InputOption::VALUE_OPTIONAL, 'The queue to listen on', null), - - array('delay', null, InputOption::VALUE_OPTIONAL, 'Amount of time to delay failed jobs', 0), - - array('memory', null, InputOption::VALUE_OPTIONAL, 'The memory limit in megabytes', 128), - - array('timeout', null, InputOption::VALUE_OPTIONAL, 'Seconds a job may run before timing out', 60), - - array('sleep', null, InputOption::VALUE_OPTIONAL, 'Seconds to wait before checking queue for jobs', 3), - - array('tries', null, InputOption::VALUE_OPTIONAL, 'Number of times to attempt a job before logging it failed', 0), - ); - } - +class ListenCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'queue:listen'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Listen to a given queue'; + + /** + * The queue listener instance. + * + * @var \Illuminate\Queue\Listener + */ + protected $listener; + + /** + * Create a new queue listen command. + * + * @param \Illuminate\Queue\Listener $listener + * @return void + */ + public function __construct(Listener $listener) + { + parent::__construct(); + + $this->listener = $listener; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $this->setListenerOptions(); + + $delay = $this->input->getOption('delay'); + + // The memory limit is the amount of memory we will allow the script to occupy + // before killing it and letting a process manager restart it for us, which + // is to protect us against any memory leaks that will be in the scripts. + $memory = $this->input->getOption('memory'); + + $connection = $this->input->getArgument('connection'); + + $timeout = $this->input->getOption('timeout'); + + // We need to get the right queue for the connection which is set in the queue + // configuration file for the application. We will pull it based on the set + // connection being run for the queue operation currently being executed. + $queue = $this->getQueue($connection); + + $this->listener->listen( + $connection, $queue, $delay, $memory, $timeout + ); + } + + /** + * Get the name of the queue connection to listen on. + * + * @param string $connection + * @return string + */ + protected function getQueue($connection) + { + if (is_null($connection)) { + $connection = $this->laravel['config']['queue.default']; + } + + $queue = $this->laravel['config']->get("queue.connections.{$connection}.queue", 'default'); + + return $this->input->getOption('queue') ?: $queue; + } + + /** + * Set the options on the queue listener. + * + * @return void + */ + protected function setListenerOptions() + { + $this->listener->setEnvironment($this->laravel->environment()); + + $this->listener->setSleep($this->option('sleep')); + + $this->listener->setMaxTries($this->option('tries')); + + $this->listener->setOutputHandler(function ($type, $line) { + $this->output->write($line); + }); + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['connection', InputArgument::OPTIONAL, 'The name of connection'], + ]; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['queue', null, InputOption::VALUE_OPTIONAL, 'The queue to listen on', null], + + ['delay', null, InputOption::VALUE_OPTIONAL, 'Amount of time to delay failed jobs', 0], + + ['memory', null, InputOption::VALUE_OPTIONAL, 'The memory limit in megabytes', 128], + + ['timeout', null, InputOption::VALUE_OPTIONAL, 'Seconds a job may run before timing out', 60], + + ['sleep', null, InputOption::VALUE_OPTIONAL, 'Seconds to wait before checking queue for jobs', 3], + + ['tries', null, InputOption::VALUE_OPTIONAL, 'Number of times to attempt a job before logging it failed', 0], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/RestartCommand.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/RestartCommand.php index 7b8dda6..72ad27e 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/RestartCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/RestartCommand.php @@ -1,33 +1,34 @@ -laravel['cache']->forever('illuminate:queue:restart', time()); + /** + * The console command description. + * + * @var string + */ + protected $description = 'Restart queue worker daemons after their current job'; - $this->info('Broadcasting queue restart signal.'); - } + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $this->laravel['cache']->forever('illuminate:queue:restart', time()); + $this->info('Broadcasting queue restart signal.'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/RetryCommand.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/RetryCommand.php index 454b56d..703c8d5 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/RetryCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/RetryCommand.php @@ -1,74 +1,97 @@ -laravel['queue.failer']->find($this->argument('id')); - - if ( ! is_null($failed)) - { - $failed->payload = $this->resetAttempts($failed->payload); - - $this->laravel['queue']->connection($failed->connection)->pushRaw($failed->payload, $failed->queue); - - $this->laravel['queue.failer']->forget($failed->id); - - $this->info('The failed job has been pushed back onto the queue!'); - } - else - { - $this->error('No failed job matches the given ID.'); - } - } - - /** - * Reset the payload attempts. - * - * @param string $payload - * @return string - */ - protected function resetAttempts($payload) - { - $payload = json_decode($payload, true); - - if (isset($payload['attempts'])) $payload['attempts'] = 0; - - return json_encode($payload); - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return array( - array('id', InputArgument::REQUIRED, 'The ID of the failed job'), - ); - } +class RetryCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'queue:retry'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Retry a failed queue job'; + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $ids = $this->argument('id'); + + if (count($ids) === 1 && $ids[0] === 'all') { + $ids = Arr::pluck($this->laravel['queue.failer']->all(), 'id'); + } + + foreach ($ids as $id) { + $this->retryJob($id); + } + } + + /** + * Retry the queue job with the given ID. + * + * @param string $id + * @return void + */ + protected function retryJob($id) + { + $failed = $this->laravel['queue.failer']->find($id); + + if (! is_null($failed)) { + $failed = (object) $failed; + + $failed->payload = $this->resetAttempts($failed->payload); + + $this->laravel['queue']->connection($failed->connection) + ->pushRaw($failed->payload, $failed->queue); + + $this->laravel['queue.failer']->forget($failed->id); + + $this->info("The failed job [{$id}] has been pushed back onto the queue!"); + } else { + $this->error("No failed job matches the given ID [{$id}]."); + } + } + + /** + * Reset the payload attempts. + * + * @param string $payload + * @return string + */ + protected function resetAttempts($payload) + { + $payload = json_decode($payload, true); + + if (isset($payload['attempts'])) { + $payload['attempts'] = 1; + } + + return json_encode($payload); + } + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['id', InputArgument::IS_ARRAY, 'The ID of the failed job'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/SubscribeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/SubscribeCommand.php index 0037cc2..a19be46 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/SubscribeCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/SubscribeCommand.php @@ -1,161 +1,162 @@ -laravel['queue']->connection(); - - if ( ! $iron instanceof IronQueue) - { - throw new RuntimeException("Iron.io based queue must be default."); - } - - $iron->getIron()->updateQueue($this->argument('queue'), $this->getQueueOptions()); - - $this->line('Queue subscriber added: '.$this->argument('url').''); - } - - /** - * Get the queue options. - * - * @return array - */ - protected function getQueueOptions() - { - return array( - 'push_type' => $this->getPushType(), 'subscribers' => $this->getSubscriberList(), - ); - } - - /** - * Get the push type for the queue. - * - * @return string - */ - protected function getPushType() - { - if ($this->option('type')) return $this->option('type'); - - try - { - return $this->getQueue()->push_type; - } - catch (Exception $e) - { - return 'multicast'; - } - } - - /** - * Get the current subscribers for the queue. - * - * @return array - */ - protected function getSubscriberList() - { - $subscribers = $this->getCurrentSubscribers(); - - $url = $this->argument('url'); - - if ( ! starts_with($url, ['http://', 'https://'])) - { - $url = $this->laravel['url']->to($url); - } - - $subscribers[] = array('url' => $url); - - return $subscribers; - } - - /** - * Get the current subscriber list. - * - * @return array - */ - protected function getCurrentSubscribers() - { - try - { - return $this->getQueue()->subscribers; - } - catch (Exception $e) - { - return array(); - } - } - - /** - * Get the queue information from Iron.io. - * - * @return object - */ - protected function getQueue() - { - if (isset($this->meta)) return $this->meta; - - return $this->meta = $this->laravel['queue']->getIron()->getQueue($this->argument('queue')); - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return array( - array('queue', InputArgument::REQUIRED, 'The name of Iron.io queue.'), - - array('url', InputArgument::REQUIRED, 'The URL to be subscribed.'), - ); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('type', null, InputOption::VALUE_OPTIONAL, 'The push type for the queue.'), - ); - } - +/** + * @deprecated since version 5.1 + */ +class SubscribeCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'queue:subscribe'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Subscribe a URL to an Iron.io push queue'; + + /** + * The queue meta information from Iron.io. + * + * @var object + */ + protected $meta; + + /** + * Execute the console command. + * + * @return void + * + * @throws \RuntimeException + */ + public function fire() + { + $iron = $this->laravel['queue']->connection(); + + if (! $iron instanceof IronQueue) { + throw new RuntimeException('Iron.io based queue must be default.'); + } + + $iron->getIron()->updateQueue($this->argument('queue'), $this->getQueueOptions()); + + $this->line('Queue subscriber added: '.$this->argument('url').''); + } + + /** + * Get the queue options. + * + * @return array + */ + protected function getQueueOptions() + { + return [ + 'push_type' => $this->getPushType(), 'subscribers' => $this->getSubscriberList(), + ]; + } + + /** + * Get the push type for the queue. + * + * @return string + */ + protected function getPushType() + { + if ($this->option('type')) { + return $this->option('type'); + } + + try { + return $this->getQueue()->push_type; + } catch (Exception $e) { + return 'multicast'; + } + } + + /** + * Get the current subscribers for the queue. + * + * @return array + */ + protected function getSubscriberList() + { + $subscribers = $this->getCurrentSubscribers(); + + $url = $this->argument('url'); + + if (! Str::startsWith($url, ['http://', 'https://'])) { + $url = $this->laravel['url']->to($url); + } + + $subscribers[] = ['url' => $url]; + + return $subscribers; + } + + /** + * Get the current subscriber list. + * + * @return array + */ + protected function getCurrentSubscribers() + { + try { + return $this->getQueue()->subscribers; + } catch (Exception $e) { + return []; + } + } + + /** + * Get the queue information from Iron.io. + * + * @return object + */ + protected function getQueue() + { + if (isset($this->meta)) { + return $this->meta; + } + + return $this->meta = $this->laravel['queue']->getIron()->getQueue($this->argument('queue')); + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['queue', InputArgument::REQUIRED, 'The name of Iron.io queue.'], + + ['url', InputArgument::REQUIRED, 'The URL to be subscribed.'], + ]; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['type', null, InputOption::VALUE_OPTIONAL, 'The push type for the queue.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/TableCommand.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/TableCommand.php index b14b450..f41d15c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/TableCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/TableCommand.php @@ -1,85 +1,91 @@ -files = $files; - $this->composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $fullPath = $this->createBaseMigration(); - - $table = $this->laravel['config']['queue.connections.database.table']; - - $stub = str_replace( - '{{table}}', $table, $this->files->get(__DIR__.'/stubs/jobs.stub') - ); - - $this->files->put($fullPath, $stub); - - $this->info('Migration created successfully!'); - - $this->composer->dumpAutoloads(); - } - - /** - * Create a base migration file for the table. - * - * @return string - */ - protected function createBaseMigration() - { - $name = 'create_jobs_table'; - - $path = $this->laravel->databasePath().'/migrations'; - - return $this->laravel['migration.creator']->create($name, $path); - } - +class TableCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'queue:table'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Create a migration for the queue jobs database table'; + + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * @var \Illuminate\Foundation\Composer + */ + protected $composer; + + /** + * Create a new queue job table command instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @param \Illuminate\Foundation\Composer $composer + * @return void + */ + public function __construct(Filesystem $files, Composer $composer) + { + parent::__construct(); + + $this->files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $table = $this->laravel['config']['queue.connections.database.table']; + + $tableClassName = Str::studly($table); + + $fullPath = $this->createBaseMigration($table); + + $stub = str_replace( + ['{{table}}', '{{tableClassName}}'], [$table, $tableClassName], $this->files->get(__DIR__.'/stubs/jobs.stub') + ); + + $this->files->put($fullPath, $stub); + + $this->info('Migration created successfully!'); + + $this->composer->dumpAutoloads(); + } + + /** + * Create a base migration file for the table. + * + * @param string $table + * @return string + */ + protected function createBaseMigration($table = 'jobs') + { + $name = 'create_'.$table.'_table'; + + $path = $this->laravel->databasePath().'/migrations'; + + return $this->laravel['migration.creator']->create($name, $path); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php index 2dcd77e..586fa6e 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php @@ -1,4 +1,6 @@ -worker = $worker; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - if ($this->downForMaintenance() && ! $this->option('daemon')) - { - return $this->worker->sleep($this->option('sleep')); - } - - $queue = $this->option('queue'); - - $delay = $this->option('delay'); - - // The memory limit is the amount of memory we will allow the script to occupy - // before killing it and letting a process manager restart it for us, which - // is to protect us against any memory leaks that will be in the scripts. - $memory = $this->option('memory'); - - $connection = $this->argument('connection'); - - $response = $this->runWorker( - $connection, $queue, $delay, $memory, $this->option('daemon') - ); - - // If a job was fired by the worker, we'll write the output out to the console - // so that the developer can watch live while the queue runs in the console - // window, which will also of get logged if stdout is logged out to disk. - if ( ! is_null($response['job'])) - { - $this->writeOutput($response['job'], $response['failed']); - } - } - - /** - * Run the worker instance. - * - * @param string $connection - * @param string $queue - * @param int $delay - * @param int $memory - * @param bool $daemon - * @return array - */ - protected function runWorker($connection, $queue, $delay, $memory, $daemon = false) - { - if ($daemon) - { - $this->worker->setCache($this->laravel['cache']->driver()); - - $this->worker->setDaemonExceptionHandler( - $this->laravel['Illuminate\Contracts\Debug\ExceptionHandler'] - ); - - return $this->worker->daemon( - $connection, $queue, $delay, $memory, - $this->option('sleep'), $this->option('tries') - ); - } - - return $this->worker->pop( - $connection, $queue, $delay, - $this->option('sleep'), $this->option('tries') - ); - } - - /** - * Write the status output for the queue worker. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param bool $failed - * @return void - */ - protected function writeOutput(Job $job, $failed) - { - if ($failed) - { - $this->output->writeln('Failed: '.$job->getName()); - } - else - { - $this->output->writeln('Processed: '.$job->getName()); - } - } - - /** - * Determine if the worker should run in maintenance mode. - * - * @return bool - */ - protected function downForMaintenance() - { - if ($this->option('force')) return false; - - return $this->laravel->isDownForMaintenance(); - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return array( - array('connection', InputArgument::OPTIONAL, 'The name of connection', null), - ); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('queue', null, InputOption::VALUE_OPTIONAL, 'The queue to listen on'), - - array('daemon', null, InputOption::VALUE_NONE, 'Run the worker in daemon mode'), - - array('delay', null, InputOption::VALUE_OPTIONAL, 'Amount of time to delay failed jobs', 0), - - array('force', null, InputOption::VALUE_NONE, 'Force the worker to run even in maintenance mode'), - - array('memory', null, InputOption::VALUE_OPTIONAL, 'The memory limit in megabytes', 128), - - array('sleep', null, InputOption::VALUE_OPTIONAL, 'Number of seconds to sleep when no job is available', 3), - - array('tries', null, InputOption::VALUE_OPTIONAL, 'Number of times to attempt a job before logging it failed', 0), - ); - } - +class WorkCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'queue:work'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Process the next job on a queue'; + + /** + * The queue worker instance. + * + * @var \Illuminate\Queue\Worker + */ + protected $worker; + + /** + * Create a new queue listen command. + * + * @param \Illuminate\Queue\Worker $worker + * @return void + */ + public function __construct(Worker $worker) + { + parent::__construct(); + + $this->worker = $worker; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + if ($this->downForMaintenance() && ! $this->option('daemon')) { + return $this->worker->sleep($this->option('sleep')); + } + + $queue = $this->option('queue'); + + $delay = $this->option('delay'); + + // The memory limit is the amount of memory we will allow the script to occupy + // before killing it and letting a process manager restart it for us, which + // is to protect us against any memory leaks that will be in the scripts. + $memory = $this->option('memory'); + + $connection = $this->argument('connection'); + + $response = $this->runWorker( + $connection, $queue, $delay, $memory, $this->option('daemon') + ); + + // If a job was fired by the worker, we'll write the output out to the console + // so that the developer can watch live while the queue runs in the console + // window, which will also of get logged if stdout is logged out to disk. + if (! is_null($response['job'])) { + $this->writeOutput($response['job'], $response['failed']); + } + } + + /** + * Run the worker instance. + * + * @param string $connection + * @param string $queue + * @param int $delay + * @param int $memory + * @param bool $daemon + * @return array + */ + protected function runWorker($connection, $queue, $delay, $memory, $daemon = false) + { + $this->worker->setDaemonExceptionHandler( + $this->laravel['Illuminate\Contracts\Debug\ExceptionHandler'] + ); + + if ($daemon) { + $this->worker->setCache($this->laravel['cache']->driver()); + + return $this->worker->daemon( + $connection, $queue, $delay, $memory, + $this->option('sleep'), $this->option('tries') + ); + } + + return $this->worker->pop( + $connection, $queue, $delay, + $this->option('sleep'), $this->option('tries') + ); + } + + /** + * Write the status output for the queue worker. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param bool $failed + * @return void + */ + protected function writeOutput(Job $job, $failed) + { + if ($failed) { + $this->output->writeln('Failed: '.$job->getName()); + } else { + $this->output->writeln('Processed: '.$job->getName()); + } + } + + /** + * Determine if the worker should run in maintenance mode. + * + * @return bool + */ + protected function downForMaintenance() + { + if ($this->option('force')) { + return false; + } + + return $this->laravel->isDownForMaintenance(); + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['connection', InputArgument::OPTIONAL, 'The name of connection', null], + ]; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['queue', null, InputOption::VALUE_OPTIONAL, 'The queue to listen on'], + + ['daemon', null, InputOption::VALUE_NONE, 'Run the worker in daemon mode'], + + ['delay', null, InputOption::VALUE_OPTIONAL, 'Amount of time to delay failed jobs', 0], + + ['force', null, InputOption::VALUE_NONE, 'Force the worker to run even in maintenance mode'], + + ['memory', null, InputOption::VALUE_OPTIONAL, 'The memory limit in megabytes', 128], + + ['sleep', null, InputOption::VALUE_OPTIONAL, 'Number of seconds to sleep when no job is available', 3], + + ['tries', null, InputOption::VALUE_OPTIONAL, 'Number of times to attempt a job before logging it failed', 0], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/failed_jobs.stub b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/failed_jobs.stub index 478ec40..06d00bd 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/failed_jobs.stub +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/failed_jobs.stub @@ -3,33 +3,31 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class CreateFailedJobsTable extends Migration { - - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('{{table}}', function(Blueprint $table) - { - $table->increments('id'); - $table->text('connection'); - $table->text('queue'); - $table->text('payload'); - $table->timestamp('failed_at'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('{{table}}'); - } +class Create{{tableClassName}}Table extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('{{table}}', function (Blueprint $table) { + $table->increments('id'); + $table->text('connection'); + $table->text('queue'); + $table->longText('payload'); + $table->timestamp('failed_at')->useCurrent(); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('{{table}}'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/jobs.stub b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/jobs.stub index 64ace3b..1866669 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/jobs.stub +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/jobs.stub @@ -3,36 +3,35 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class CreateJobsTable extends Migration { - - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('{{table}}', function(Blueprint $table) - { - $table->bigIncrements('id'); - $table->string('queue'); - $table->text('payload'); - $table->tinyInteger('attempts')->unsigned(); - $table->tinyInteger('reserved')->unsigned(); - $table->unsignedInteger('reserved_at')->nullable(); - $table->unsignedInteger('available_at'); - $table->unsignedInteger('created_at'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('{{table}}'); - } +class Create{{tableClassName}}Table extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('{{table}}', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->string('queue'); + $table->longText('payload'); + $table->tinyInteger('attempts')->unsigned(); + $table->tinyInteger('reserved')->unsigned(); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + $table->index(['queue', 'reserved', 'reserved_at']); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('{{table}}'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/ConsoleServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Queue/ConsoleServiceProvider.php index 0658cb2..395e686 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/ConsoleServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/ConsoleServiceProvider.php @@ -1,76 +1,71 @@ -app->singleton('command.queue.table', function($app) - { - return new TableCommand($app['files'], $app['composer']); - }); +class ConsoleServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; - $this->app->singleton('command.queue.failed', function() - { - return new ListFailedCommand; - }); + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton('command.queue.table', function ($app) { + return new TableCommand($app['files'], $app['composer']); + }); - $this->app->singleton('command.queue.retry', function() - { - return new RetryCommand; - }); + $this->app->singleton('command.queue.failed', function () { + return new ListFailedCommand; + }); - $this->app->singleton('command.queue.forget', function() - { - return new ForgetFailedCommand; - }); + $this->app->singleton('command.queue.retry', function () { + return new RetryCommand; + }); - $this->app->singleton('command.queue.flush', function() - { - return new FlushFailedCommand; - }); + $this->app->singleton('command.queue.forget', function () { + return new ForgetFailedCommand; + }); - $this->app->singleton('command.queue.failed-table', function($app) - { - return new FailedTableCommand($app['files'], $app['composer']); - }); + $this->app->singleton('command.queue.flush', function () { + return new FlushFailedCommand; + }); - $this->commands( - 'command.queue.table', 'command.queue.failed', 'command.queue.retry', - 'command.queue.forget', 'command.queue.flush', 'command.queue.failed-table' - ); - } + $this->app->singleton('command.queue.failed-table', function ($app) { + return new FailedTableCommand($app['files'], $app['composer']); + }); - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array( - 'command.queue.table', 'command.queue.failed', 'command.queue.retry', - 'command.queue.forget', 'command.queue.flush', 'command.queue.failed-table', - ); - } + $this->commands( + 'command.queue.table', 'command.queue.failed', 'command.queue.retry', + 'command.queue.forget', 'command.queue.flush', 'command.queue.failed-table' + ); + } + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'command.queue.table', 'command.queue.failed', 'command.queue.retry', + 'command.queue.forget', 'command.queue.flush', 'command.queue.failed-table', + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php b/application/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php index 3a7e7b8..7aa6db8 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php @@ -1,4 +1,6 @@ -table = $table; - $this->expire = $expire; - $this->default = $default; - $this->database = $database; - } - - /** - * Push a new job onto the queue. - * - * @param string $job - * @param mixed $data - * @param string $queue - * @return void - */ - public function push($job, $data = '', $queue = null) - { - return $this->pushToDatabase(0, $queue, $this->createPayload($job, $data)); - } - - /** - * Push a raw payload onto the queue. - * - * @param string $payload - * @param string $queue - * @param array $options - * @return mixed - */ - public function pushRaw($payload, $queue = null, array $options = array()) - { - return $this->pushToDatabase(0, $queue, $payload); - } - - /** - * Push a new job onto the queue after a delay. - * - * @param \DateTime|int $delay - * @param string $job - * @param mixed $data - * @param string $queue - * @return void - */ - public function later($delay, $job, $data = '', $queue = null) - { - return $this->pushToDatabase($delay, $queue, $this->createPayload($job, $data)); - } - - /** - * Release a reserved job back onto the queue. - * - * @param string $queue - * @param \StdClass $job - * @param int $delay - * @return void - */ - public function release($queue, $job, $delay) - { - return $this->pushToDatabase($delay, $queue, $job->payload, $job->attempts); - } - - /** - * Push a raw payload to the database with a given delay. - * - * @param \DateTime|int $delay - * @param string|null $queue - * @param string $payload - * @param int $attempts - * @return mixed - */ - protected function pushToDatabase($delay, $queue, $payload, $attempts = 0) - { - $availableAt = $delay instanceof DateTime ? $delay : Carbon::now()->addSeconds($delay); - - return $this->database->table($this->table)->insertGetId([ - 'queue' => $this->getQueue($queue), - 'payload' => $payload, - 'attempts' => $attempts, - 'reserved' => 0, - 'reserved_at' => null, - 'available_at' => $availableAt->getTimestamp(), - 'created_at' => $this->getTime(), - ]); - } - - /** - * Pop the next job off of the queue. - * - * @param string $queue - * @return \Illuminate\Contracts\Queue\Job|null - */ - public function pop($queue = null) - { - $queue = $this->getQueue($queue); - - if ( ! is_null($this->expire)) - { - $this->releaseJobsThatHaveBeenReservedTooLong($queue); - } - - if ($job = $this->getNextAvailableJob($queue)) - { - $this->markJobAsReserved($job->id); - - $this->database->commit(); - - return new DatabaseJob( - $this->container, $this, $job, $queue - ); - } - - $this->database->commit(); - } - - /** - * Release the jobs that have been reserved for too long. - * - * @param string $queue - * @return void - */ - protected function releaseJobsThatHaveBeenReservedTooLong($queue) - { - $expired = Carbon::now()->subSeconds($this->expire)->getTimestamp(); - - $this->database->table($this->table) - ->where('queue', $this->getQueue($queue)) - ->where('reserved', 1) - ->where('reserved_at', '<=', $expired) - ->update([ - 'reserved' => 0, - 'reserved_at' => null, - 'attempts' => new Expression('attempts + 1'), - ]); - } - - /** - * Get the next available job for the queue. - * - * @param string|null $queue - * @return \StdClass|null - */ - protected function getNextAvailableJob($queue) - { - $this->database->beginTransaction(); - - $job = $this->database->table($this->table) - ->lockForUpdate() - ->where('queue', $this->getQueue($queue)) - ->where('reserved', 0) - ->where('available_at', '<=', $this->getTime()) - ->orderBy('id', 'asc') - ->first(); - - return $job ? (object) $job : null; - } - - /** - * Mark the given job ID as reserved. - * - * @param string $id - * @return void - */ - protected function markJobAsReserved($id) - { - $this->database->table($this->table)->where('id', $id)->update([ - 'reserved' => 1, 'reserved_at' => $this->getTime(), - ]); - } - - /** - * Delete a reserved job from the queue. - * - * @param string $queue - * @param string $id - * @return void - */ - public function deleteReserved($queue, $id) - { - $this->database->table($this->table)->where('id', $id)->delete(); - } - - /** - * Get the queue or return the default. - * - * @param string|null $queue - * @return string - */ - protected function getQueue($queue) - { - return $queue ?: $this->default; - } - - /** - * Get the underlying database instance. - * - * @return \Illuminate\Database\Connection - */ - public function getDatabase() - { - return $this->database; - } - - /** - * Get the expiration time in seconds. - * - * @return int|null - */ - public function getExpire() - { - return $this->expire; - } - - /** - * Set the expiration time in seconds. - * - * @param int|null $seconds - * @return void - */ - public function setExpire($seconds) - { - $this->expire = $seconds; - } +class DatabaseQueue extends Queue implements QueueContract +{ + /** + * The database connection instance. + * + * @var \Illuminate\Database\Connection + */ + protected $database; + + /** + * The database table that holds the jobs. + * + * @var string + */ + protected $table; + + /** + * The name of the default queue. + * + * @var string + */ + protected $default; + + /** + * The expiration time of a job. + * + * @var int|null + */ + protected $expire = 60; + + /** + * Create a new database queue instance. + * + * @param \Illuminate\Database\Connection $database + * @param string $table + * @param string $default + * @param int $expire + * @return void + */ + public function __construct(Connection $database, $table, $default = 'default', $expire = 60) + { + $this->table = $table; + $this->expire = $expire; + $this->default = $default; + $this->database = $database; + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + return $this->pushToDatabase(0, $queue, $this->createPayload($job, $data)); + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + return $this->pushToDatabase(0, $queue, $payload); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTime|int $delay + * @param string $job + * @param mixed $data + * @param string $queue + * @return void + */ + public function later($delay, $job, $data = '', $queue = null) + { + return $this->pushToDatabase($delay, $queue, $this->createPayload($job, $data)); + } + + /** + * Push an array of jobs onto the queue. + * + * @param array $jobs + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function bulk($jobs, $data = '', $queue = null) + { + $queue = $this->getQueue($queue); + + $availableAt = $this->getAvailableAt(0); + + $records = array_map(function ($job) use ($queue, $data, $availableAt) { + return $this->buildDatabaseRecord( + $queue, $this->createPayload($job, $data), $availableAt + ); + }, (array) $jobs); + + return $this->database->table($this->table)->insert($records); + } + + /** + * Release a reserved job back onto the queue. + * + * @param string $queue + * @param \StdClass $job + * @param int $delay + * @return mixed + */ + public function release($queue, $job, $delay) + { + return $this->pushToDatabase($delay, $queue, $job->payload, $job->attempts); + } + + /** + * Push a raw payload to the database with a given delay. + * + * @param \DateTime|int $delay + * @param string|null $queue + * @param string $payload + * @param int $attempts + * @return mixed + */ + protected function pushToDatabase($delay, $queue, $payload, $attempts = 0) + { + $attributes = $this->buildDatabaseRecord( + $this->getQueue($queue), $payload, $this->getAvailableAt($delay), $attempts + ); + + return $this->database->table($this->table)->insertGetId($attributes); + } + + /** + * Pop the next job off of the queue. + * + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + $queue = $this->getQueue($queue); + + if (! is_null($this->expire)) { + $this->releaseJobsThatHaveBeenReservedTooLong($queue); + } + + if ($job = $this->getNextAvailableJob($queue)) { + $this->markJobAsReserved($job->id); + + $this->database->commit(); + + return new DatabaseJob( + $this->container, $this, $job, $queue + ); + } + + $this->database->commit(); + } + + /** + * Release the jobs that have been reserved for too long. + * + * @param string $queue + * @return void + */ + protected function releaseJobsThatHaveBeenReservedTooLong($queue) + { + $expired = Carbon::now()->subSeconds($this->expire)->getTimestamp(); + + $this->database->table($this->table) + ->where('queue', $this->getQueue($queue)) + ->where('reserved', 1) + ->where('reserved_at', '<=', $expired) + ->update([ + 'reserved' => 0, + 'reserved_at' => null, + 'attempts' => new Expression('attempts + 1'), + ]); + } + + /** + * Get the next available job for the queue. + * + * @param string|null $queue + * @return \StdClass|null + */ + protected function getNextAvailableJob($queue) + { + $this->database->beginTransaction(); + + $job = $this->database->table($this->table) + ->lockForUpdate() + ->where('queue', $this->getQueue($queue)) + ->where('reserved', 0) + ->where('available_at', '<=', $this->getTime()) + ->orderBy('id', 'asc') + ->first(); + + return $job ? (object) $job : null; + } + + /** + * Mark the given job ID as reserved. + * + * @param string $id + * @return void + */ + protected function markJobAsReserved($id) + { + $this->database->table($this->table)->where('id', $id)->update([ + 'reserved' => 1, 'reserved_at' => $this->getTime(), + ]); + } + + /** + * Delete a reserved job from the queue. + * + * @param string $queue + * @param string $id + * @return void + */ + public function deleteReserved($queue, $id) + { + $this->database->table($this->table)->where('id', $id)->delete(); + } + + /** + * Get the "available at" UNIX timestamp. + * + * @param \DateTime|int $delay + * @return int + */ + protected function getAvailableAt($delay) + { + $availableAt = $delay instanceof DateTime ? $delay : Carbon::now()->addSeconds($delay); + + return $availableAt->getTimestamp(); + } + + /** + * Create an array to insert for the given job. + * + * @param string|null $queue + * @param string $payload + * @param int $availableAt + * @param int $attempts + * @return array + */ + protected function buildDatabaseRecord($queue, $payload, $availableAt, $attempts = 0) + { + return [ + 'queue' => $queue, + 'payload' => $payload, + 'attempts' => $attempts, + 'reserved' => 0, + 'reserved_at' => null, + 'available_at' => $availableAt, + 'created_at' => $this->getTime(), + ]; + } + + /** + * Get the queue or return the default. + * + * @param string|null $queue + * @return string + */ + protected function getQueue($queue) + { + return $queue ?: $this->default; + } + + /** + * Get the underlying database instance. + * + * @return \Illuminate\Database\Connection + */ + public function getDatabase() + { + return $this->database; + } + + /** + * Get the expiration time in seconds. + * + * @return int|null + */ + public function getExpire() + { + return $this->expire; + } + /** + * Set the expiration time in seconds. + * + * @param int|null $seconds + * @return void + */ + public function setExpire($seconds) + { + $this->expire = $seconds; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php index 1fbf6f1..5758627 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php @@ -1,111 +1,112 @@ -table = $table; - $this->resolver = $resolver; - $this->database = $database; - } + /** + * The database table. + * + * @var string + */ + protected $table; - /** - * Log a failed job into storage. - * - * @param string $connection - * @param string $queue - * @param string $payload - * @return void - */ - public function log($connection, $queue, $payload) - { - $failed_at = Carbon::now(); + /** + * Create a new database failed job provider. + * + * @param \Illuminate\Database\ConnectionResolverInterface $resolver + * @param string $database + * @param string $table + * @return void + */ + public function __construct(ConnectionResolverInterface $resolver, $database, $table) + { + $this->table = $table; + $this->resolver = $resolver; + $this->database = $database; + } - $this->getTable()->insert(compact('connection', 'queue', 'payload', 'failed_at')); - } + /** + * Log a failed job into storage. + * + * @param string $connection + * @param string $queue + * @param string $payload + * @return void + */ + public function log($connection, $queue, $payload) + { + $failed_at = Carbon::now(); - /** - * Get a list of all of the failed jobs. - * - * @return array - */ - public function all() - { - return $this->getTable()->orderBy('id', 'desc')->get(); - } + $this->getTable()->insert(compact('connection', 'queue', 'payload', 'failed_at')); + } - /** - * Get a single failed job. - * - * @param mixed $id - * @return array - */ - public function find($id) - { - return $this->getTable()->find($id); - } + /** + * Get a list of all of the failed jobs. + * + * @return array + */ + public function all() + { + return $this->getTable()->orderBy('id', 'desc')->get(); + } - /** - * Delete a single failed job from storage. - * - * @param mixed $id - * @return bool - */ - public function forget($id) - { - return $this->getTable()->where('id', $id)->delete() > 0; - } + /** + * Get a single failed job. + * + * @param mixed $id + * @return array + */ + public function find($id) + { + return $this->getTable()->find($id); + } - /** - * Flush all of the failed jobs from storage. - * - * @return void - */ - public function flush() - { - $this->getTable()->delete(); - } + /** + * Delete a single failed job from storage. + * + * @param mixed $id + * @return bool + */ + public function forget($id) + { + return $this->getTable()->where('id', $id)->delete() > 0; + } - /** - * Get a new query builder instance for the table. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function getTable() - { - return $this->resolver->connection($this->database)->table($this->table); - } + /** + * Flush all of the failed jobs from storage. + * + * @return void + */ + public function flush() + { + $this->getTable()->delete(); + } + /** + * Get a new query builder instance for the table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function getTable() + { + return $this->resolver->connection($this->database)->table($this->table); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php index 7db652e..1b207c0 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php @@ -1,45 +1,46 @@ -crypt = $crypt; + } - /** - * Create a new queued Closure job. - * - * @param \Illuminate\Contracts\Encryption\Encrypter $crypt - * @return void - */ - public function __construct(EncrypterContract $crypt) - { - $this->crypt = $crypt; - } - - /** - * Fire the Closure based queue job. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param array $data - * @return void - */ - public function fire($job, $data) - { - $closure = unserialize($this->crypt->decrypt($data['closure'])); - - $closure($job); - } + /** + * Fire the Closure based queue job. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param array $data + * @return void + */ + public function fire($job, $data) + { + $closure = unserialize($this->crypt->decrypt($data['closure'])); + $closure($job); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/InteractsWithQueue.php b/application/vendor/laravel/framework/src/Illuminate/Queue/InteractsWithQueue.php index 68bc09c..bf1e021 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/InteractsWithQueue.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/InteractsWithQueue.php @@ -1,64 +1,63 @@ -job) - { - return $this->job->delete(); - } - } +namespace Illuminate\Queue; - /** - * Release the job back into the queue. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - if ($this->job) - { - return $this->job->release($delay); - } - } - - /** - * Get the number of times the job has been attempted. - * - * @return int - */ - public function attempts() - { - return $this->job ? $this->job->attempts() : 1; - } - - /** - * Set the base queue job instance. - * - * @param \Illuminate\Contracts\Queue\Job - * @return $this - */ - public function setJob(JobContract $job) - { - $this->job = $job; - - return $this; - } +use Illuminate\Contracts\Queue\Job as JobContract; +trait InteractsWithQueue +{ + /** + * The underlying queue job instance. + * + * @var \Illuminate\Contracts\Queue\Job + */ + protected $job; + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + if ($this->job) { + return $this->job->delete(); + } + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + if ($this->job) { + return $this->job->release($delay); + } + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + return $this->job ? $this->job->attempts() : 1; + } + + /** + * Set the base queue job instance. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @return $this + */ + public function setJob(JobContract $job) + { + $this->job = $job; + + return $this; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/IronQueue.php b/application/vendor/laravel/framework/src/Illuminate/Queue/IronQueue.php index 48b113c..6831889 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/IronQueue.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/IronQueue.php @@ -1,259 +1,263 @@ -iron = $iron; - $this->request = $request; - $this->default = $default; - $this->shouldEncrypt = $shouldEncrypt; - } - - /** - * Push a new job onto the queue. - * - * @param string $job - * @param mixed $data - * @param string $queue - * @return mixed - */ - public function push($job, $data = '', $queue = null) - { - return $this->pushRaw($this->createPayload($job, $data, $queue), $queue); - } - - /** - * Push a raw payload onto the queue. - * - * @param string $payload - * @param string $queue - * @param array $options - * @return mixed - */ - public function pushRaw($payload, $queue = null, array $options = array()) - { - if ($this->shouldEncrypt) $payload = $this->crypt->encrypt($payload); - - return $this->iron->postMessage($this->getQueue($queue), $payload, $options)->id; - } - - /** - * Push a raw payload onto the queue after encrypting the payload. - * - * @param string $payload - * @param string $queue - * @param int $delay - * @return mixed - */ - public function recreate($payload, $queue = null, $delay) - { - $options = array('delay' => $this->getSeconds($delay)); - - return $this->pushRaw($payload, $queue, $options); - } - - /** - * Push a new job onto the queue after a delay. - * - * @param \DateTime|int $delay - * @param string $job - * @param mixed $data - * @param string $queue - * @return mixed - */ - public function later($delay, $job, $data = '', $queue = null) - { - $delay = $this->getSeconds($delay); - - $payload = $this->createPayload($job, $data, $queue); - - return $this->pushRaw($payload, $queue, compact('delay')); - } - - /** - * Pop the next job off of the queue. - * - * @param string $queue - * @return \Illuminate\Contracts\Queue\Job|null - */ - public function pop($queue = null) - { - $queue = $this->getQueue($queue); - - $job = $this->iron->getMessage($queue); - - // If we were able to pop a message off of the queue, we will need to decrypt - // the message body, as all Iron.io messages are encrypted, since the push - // queues will be a security hazard to unsuspecting developers using it. - if ( ! is_null($job)) - { - $job->body = $this->parseJobBody($job->body); - - return new IronJob($this->container, $this, $job); - } - } - - /** - * Delete a message from the Iron queue. - * - * @param string $queue - * @param string $id - * @return void - */ - public function deleteMessage($queue, $id) - { - $this->iron->deleteMessage($queue, $id); - } - - /** - * Marshal a push queue request and fire the job. - * - * @return \Illuminate\Http\Response - */ - public function marshal() - { - $this->createPushedIronJob($this->marshalPushedJob())->fire(); - - return new Response('OK'); - } - - /** - * Marshal out the pushed job and payload. - * - * @return object - */ - protected function marshalPushedJob() - { - $r = $this->request; - - $body = $this->parseJobBody($r->getContent()); - - return (object) array( - 'id' => $r->header('iron-message-id'), 'body' => $body, 'pushed' => true, - ); - } - - /** - * Create a new IronJob for a pushed job. - * - * @param object $job - * @return \Illuminate\Queue\Jobs\IronJob - */ - protected function createPushedIronJob($job) - { - return new IronJob($this->container, $this, $job, true); - } - - /** - * Create a payload string from the given job and data. - * - * @param string $job - * @param mixed $data - * @param string $queue - * @return string - */ - protected function createPayload($job, $data = '', $queue = null) - { - $payload = $this->setMeta(parent::createPayload($job, $data), 'attempts', 1); - - return $this->setMeta($payload, 'queue', $this->getQueue($queue)); - } - - /** - * Parse the job body for firing. - * - * @param string $body - * @return string - */ - protected function parseJobBody($body) - { - return $this->shouldEncrypt ? $this->crypt->decrypt($body) : $body; - } - - /** - * Get the queue or return the default. - * - * @param string|null $queue - * @return string - */ - public function getQueue($queue) - { - return $queue ?: $this->default; - } - - /** - * Get the underlying IronMQ instance. - * - * @return \IronMQ - */ - public function getIron() - { - return $this->iron; - } - - /** - * Get the request instance. - * - * @return \Symfony\Component\HttpFoundation\Request - */ - public function getRequest() - { - return $this->request; - } - - /** - * Set the request instance. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @return void - */ - public function setRequest(Request $request) - { - $this->request = $request; - } - +class IronQueue extends Queue implements QueueContract +{ + /** + * The IronMQ instance. + * + * @var \IronMQ\IronMQ + */ + protected $iron; + + /** + * The current request instance. + * + * @var \Illuminate\Http\Request + */ + protected $request; + + /** + * The name of the default tube. + * + * @var string + */ + protected $default; + + /** + * Indicates if the messages should be encrypted. + * + * @var bool + */ + protected $shouldEncrypt; + + /** + * Create a new IronMQ queue instance. + * + * @param \IronMQ\IronMQ $iron + * @param \Illuminate\Http\Request $request + * @param string $default + * @param bool $shouldEncrypt + * @return void + */ + public function __construct(IronMQ $iron, Request $request, $default, $shouldEncrypt = false) + { + $this->iron = $iron; + $this->request = $request; + $this->default = $default; + $this->shouldEncrypt = $shouldEncrypt; + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + return $this->pushRaw($this->createPayload($job, $data, $queue), $queue); + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + if ($this->shouldEncrypt) { + $payload = $this->crypt->encrypt($payload); + } + + return $this->iron->postMessage($this->getQueue($queue), $payload, $options)->id; + } + + /** + * Push a raw payload onto the queue after encrypting the payload. + * + * @param string $payload + * @param string $queue + * @param int $delay + * @return mixed + */ + public function recreate($payload, $queue, $delay) + { + $options = ['delay' => $this->getSeconds($delay)]; + + return $this->pushRaw($payload, $queue, $options); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTime|int $delay + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + $delay = $this->getSeconds($delay); + + $payload = $this->createPayload($job, $data, $queue); + + return $this->pushRaw($payload, $queue, compact('delay')); + } + + /** + * Pop the next job off of the queue. + * + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + $queue = $this->getQueue($queue); + + $job = $this->iron->getMessage($queue); + + // If we were able to pop a message off of the queue, we will need to decrypt + // the message body, as all Iron.io messages are encrypted, since the push + // queues will be a security hazard to unsuspecting developers using it. + if (! is_null($job)) { + $job->body = $this->parseJobBody($job->body); + + return new IronJob($this->container, $this, $job); + } + } + + /** + * Delete a message from the Iron queue. + * + * @param string $queue + * @param string $id + * @return void + */ + public function deleteMessage($queue, $id) + { + $this->iron->deleteMessage($queue, $id); + } + + /** + * Marshal a push queue request and fire the job. + * + * @return \Illuminate\Http\Response + * + * @deprecated since version 5.1. + */ + public function marshal() + { + $this->createPushedIronJob($this->marshalPushedJob())->fire(); + + return new Response('OK'); + } + + /** + * Marshal out the pushed job and payload. + * + * @return object + */ + protected function marshalPushedJob() + { + $r = $this->request; + + $body = $this->parseJobBody($r->getContent()); + + return (object) [ + 'id' => $r->header('iron-message-id'), 'body' => $body, 'pushed' => true, + ]; + } + + /** + * Create a new IronJob for a pushed job. + * + * @param object $job + * @return \Illuminate\Queue\Jobs\IronJob + */ + protected function createPushedIronJob($job) + { + return new IronJob($this->container, $this, $job, true); + } + + /** + * Create a payload string from the given job and data. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @return string + */ + protected function createPayload($job, $data = '', $queue = null) + { + $payload = $this->setMeta(parent::createPayload($job, $data), 'attempts', 1); + + return $this->setMeta($payload, 'queue', $this->getQueue($queue)); + } + + /** + * Parse the job body for firing. + * + * @param string $body + * @return string + */ + protected function parseJobBody($body) + { + return $this->shouldEncrypt ? $this->crypt->decrypt($body) : $body; + } + + /** + * Get the queue or return the default. + * + * @param string|null $queue + * @return string + */ + public function getQueue($queue) + { + return $queue ?: $this->default; + } + + /** + * Get the underlying IronMQ instance. + * + * @return \IronMQ\IronMQ + */ + public function getIron() + { + return $this->iron; + } + + /** + * Get the request instance. + * + * @return \Illuminate\Http\Request + */ + public function getRequest() + { + return $this->request; + } + + /** + * Set the request instance. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + public function setRequest(Request $request) + { + $this->request = $request; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/BeanstalkdJob.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/BeanstalkdJob.php index c666927..be245b7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/BeanstalkdJob.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/BeanstalkdJob.php @@ -1,153 +1,156 @@ -job = $job; - $this->queue = $queue; - $this->container = $container; - $this->pheanstalk = $pheanstalk; - } - - /** - * Fire the job. - * - * @return void - */ - public function fire() - { - $this->resolveAndFire(json_decode($this->getRawBody(), true)); - } - - /** - * Get the raw body string for the job. - * - * @return string - */ - public function getRawBody() - { - return $this->job->getData(); - } - - /** - * Delete the job from the queue. - * - * @return void - */ - public function delete() - { - parent::delete(); - - $this->pheanstalk->delete($this->job); - } - - /** - * Release the job back into the queue. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - parent::release($delay); - - $priority = Pheanstalk::DEFAULT_PRIORITY; - - $this->pheanstalk->release($this->job, $priority, $delay); - } - - /** - * Bury the job in the queue. - * - * @return void - */ - public function bury() - { - $this->pheanstalk->bury($this->job); - } - - /** - * Get the number of times the job has been attempted. - * - * @return int - */ - public function attempts() - { - $stats = $this->pheanstalk->statsJob($this->job); - - return (int) $stats->reserves; - } - - /** - * Get the job identifier. - * - * @return string - */ - public function getJobId() - { - return $this->job->getId(); - } - - /** - * Get the IoC container instance. - * - * @return \Illuminate\Container\Container - */ - public function getContainer() - { - return $this->container; - } - - /** - * Get the underlying Pheanstalk instance. - * - * @return \Pheanstalk_Pheanstalk - */ - public function getPheanstalk() - { - return $this->pheanstalk; - } - - /** - * Get the underlying Pheanstalk job. - * - * @return PheanstalkJob - */ - public function getPheanstalkJob() - { - return $this->job; - } - + { + $this->job = $job; + $this->queue = $queue; + $this->container = $container; + $this->pheanstalk = $pheanstalk; + } + + /** + * Fire the job. + * + * @return void + */ + public function fire() + { + $this->resolveAndFire(json_decode($this->getRawBody(), true)); + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->job->getData(); + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + parent::delete(); + + $this->pheanstalk->delete($this->job); + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + parent::release($delay); + + $priority = Pheanstalk::DEFAULT_PRIORITY; + + $this->pheanstalk->release($this->job, $priority, $delay); + } + + /** + * Bury the job in the queue. + * + * @return void + */ + public function bury() + { + parent::release(); + + $this->pheanstalk->bury($this->job); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + $stats = $this->pheanstalk->statsJob($this->job); + + return (int) $stats->reserves; + } + + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId() + { + return $this->job->getId(); + } + + /** + * Get the IoC container instance. + * + * @return \Illuminate\Container\Container + */ + public function getContainer() + { + return $this->container; + } + + /** + * Get the underlying Pheanstalk instance. + * + * @return \Pheanstalk\Pheanstalk + */ + public function getPheanstalk() + { + return $this->pheanstalk; + } + + /** + * Get the underlying Pheanstalk job. + * + * @return \Pheanstalk\Job + */ + public function getPheanstalkJob() + { + return $this->job; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJob.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJob.php index d28bd01..4bcc8eb 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJob.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJob.php @@ -1,138 +1,139 @@ -job = $job; - $this->queue = $queue; - $this->database = $database; - $this->container = $container; - $this->job->attempts = $this->job->attempts + 1; - } - - /** - * Fire the job. - * - * @return void - */ - public function fire() - { - $this->resolveAndFire(json_decode($this->job->payload, true)); - } - - /** - * Delete the job from the queue. - * - * @return void - */ - public function delete() - { - parent::delete(); - - $this->database->deleteReserved($this->queue, $this->job->id); - } - - /** - * Release the job back into the queue. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - parent::release($delay); - - $this->delete(); - - $this->database->release($this->queue, $this->job, $delay); - } - - /** - * Get the number of times the job has been attempted. - * - * @return int - */ - public function attempts() - { - return (int) $this->job->attempts; - } - - /** - * Get the job identifier. - * - * @return string - */ - public function getJobId() - { - return $this->job->id; - } - - /** - * Get the raw body string for the job. - * - * @return string - */ - public function getRawBody() - { - return $this->job->payload; - } - - /** - * Get the IoC container instance. - * - * @return \Illuminate\Container\Container - */ - public function getContainer() - { - return $this->container; - } - - /** - * Get the underlying queue driver instance. - * - * @return \Illuminate\Queue\DatabaseQueue - */ - public function getDatabaseQueue() - { - return $this->database; - } - - /** - * Get the underlying database job. - * - * @return \StdClass - */ - public function getDatabaseJob() - { - return $this->job; - } - +class DatabaseJob extends Job implements JobContract +{ + /** + * The database queue instance. + * + * @var \Illuminate\Queue\DatabaseQueue + */ + protected $database; + + /** + * The database job payload. + * + * @var \StdClass + */ + protected $job; + + /** + * Create a new job instance. + * + * @param \Illuminate\Container\Container $container + * @param \Illuminate\Queue\DatabaseQueue $database + * @param \StdClass $job + * @param string $queue + * @return void + */ + public function __construct(Container $container, DatabaseQueue $database, $job, $queue) + { + $this->job = $job; + $this->queue = $queue; + $this->database = $database; + $this->container = $container; + $this->job->attempts = $this->job->attempts + 1; + } + + /** + * Fire the job. + * + * @return void + */ + public function fire() + { + $this->resolveAndFire(json_decode($this->job->payload, true)); + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + parent::delete(); + + $this->database->deleteReserved($this->queue, $this->job->id); + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + parent::release($delay); + + $this->delete(); + + $this->database->release($this->queue, $this->job, $delay); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + return (int) $this->job->attempts; + } + + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId() + { + return $this->job->id; + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->job->payload; + } + + /** + * Get the IoC container instance. + * + * @return \Illuminate\Container\Container + */ + public function getContainer() + { + return $this->container; + } + + /** + * Get the underlying queue driver instance. + * + * @return \Illuminate\Queue\DatabaseQueue + */ + public function getDatabaseQueue() + { + return $this->database; + } + + /** + * Get the underlying database job. + * + * @return \StdClass + */ + public function getDatabaseJob() + { + return $this->job; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/IronJob.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/IronJob.php index 26717c9..6793bcd 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/IronJob.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/IronJob.php @@ -1,174 +1,180 @@ -job = $job; - $this->iron = $iron; - $this->pushed = $pushed; - $this->container = $container; - } - - /** - * Fire the job. - * - * @return void - */ - public function fire() - { - $this->resolveAndFire(json_decode($this->getRawBody(), true)); - } - - /** - * Get the raw body string for the job. - * - * @return string - */ - public function getRawBody() - { - return $this->job->body; - } - - /** - * Delete the job from the queue. - * - * @return void - */ - public function delete() - { - parent::delete(); - - if (isset($this->job->pushed)) return; - - $this->iron->deleteMessage($this->getQueue(), $this->job->id); - } - - /** - * Release the job back into the queue. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - parent::release($delay); - - if ( ! $this->pushed) $this->delete(); - - $this->recreateJob($delay); - } - - /** - * Release a pushed job back onto the queue. - * - * @param int $delay - * @return void - */ - protected function recreateJob($delay) - { - $payload = json_decode($this->job->body, true); - - array_set($payload, 'attempts', array_get($payload, 'attempts', 1) + 1); - - $this->iron->recreate(json_encode($payload), $this->getQueue(), $delay); - } - - /** - * Get the number of times the job has been attempted. - * - * @return int - */ - public function attempts() - { - return array_get(json_decode($this->job->body, true), 'attempts', 1); - } - - /** - * Get the job identifier. - * - * @return string - */ - public function getJobId() - { - return $this->job->id; - } - - /** - * Get the IoC container instance. - * - * @return \Illuminate\Container\Container - */ - public function getContainer() - { - return $this->container; - } - - /** - * Get the underlying Iron queue instance. - * - * @return \Illuminate\Queue\IronQueue - */ - public function getIron() - { - return $this->iron; - } - - /** - * Get the underlying IronMQ job. - * - * @return array - */ - public function getIronJob() - { - return $this->job; - } - - /** - * Get the name of the queue the job belongs to. - * - * @return string - */ - public function getQueue() - { - return array_get(json_decode($this->job->body, true), 'queue'); - } - + { + $this->job = $job; + $this->iron = $iron; + $this->pushed = $pushed; + $this->container = $container; + } + + /** + * Fire the job. + * + * @return void + */ + public function fire() + { + $this->resolveAndFire(json_decode($this->getRawBody(), true)); + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->job->body; + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + parent::delete(); + + if (isset($this->job->pushed)) { + return; + } + + $this->iron->deleteMessage($this->getQueue(), $this->job->id); + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + parent::release($delay); + + if (! $this->pushed) { + $this->delete(); + } + + $this->recreateJob($delay); + } + + /** + * Release a pushed job back onto the queue. + * + * @param int $delay + * @return void + */ + protected function recreateJob($delay) + { + $payload = json_decode($this->job->body, true); + + Arr::set($payload, 'attempts', Arr::get($payload, 'attempts', 1) + 1); + + $this->iron->recreate(json_encode($payload), $this->getQueue(), $delay); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + return Arr::get(json_decode($this->job->body, true), 'attempts', 1); + } + + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId() + { + return $this->job->id; + } + + /** + * Get the IoC container instance. + * + * @return \Illuminate\Container\Container + */ + public function getContainer() + { + return $this->container; + } + + /** + * Get the underlying Iron queue instance. + * + * @return \Illuminate\Queue\IronQueue + */ + public function getIron() + { + return $this->iron; + } + + /** + * Get the underlying IronMQ job. + * + * @return array + */ + public function getIronJob() + { + return $this->job; + } + + /** + * Get the name of the queue the job belongs to. + * + * @return string + */ + public function getQueue() + { + return Arr::get(json_decode($this->job->body, true), 'queue'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php index f8709a3..304bc9d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php @@ -1,267 +1,270 @@ -deleted = true; - } - - /** - * Determine if the job has been deleted. - * - * @return bool - */ - public function isDeleted() - { - return $this->deleted; - } - - /** - * Release the job back into the queue. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - $this->released = true; - } - - /** - * Determine if the job was released back into the queue. - * - * @return bool - */ - public function isReleased() - { - return $this->released; - } - - /** - * Determine if the job has been deleted or released. - * - * @return bool - */ - public function isDeletedOrReleased() - { - return $this->isDeleted() || $this->isReleased(); - } - - /** - * Get the number of times the job has been attempted. - * - * @return int - */ - abstract public function attempts(); - - /** - * Get the raw body string for the job. - * - * @return string - */ - abstract public function getRawBody(); - - /** - * Resolve and fire the job handler method. - * - * @param array $payload - * @return void - */ - protected function resolveAndFire(array $payload) - { - list($class, $method) = $this->parseJob($payload['job']); - - $this->instance = $this->resolve($class); - - $this->instance->{$method}($this, $this->resolveQueueableEntities($payload['data'])); - } - - /** - * Parse the job declaration into class and method. - * - * @param string $job - * @return array - */ - protected function parseJob($job) - { - $segments = explode('@', $job); - - return count($segments) > 1 ? $segments : array($segments[0], 'fire'); - } - - /** - * Resolve the given job handler. - * - * @param string $class - * @return mixed - */ - protected function resolve($class) - { - return $this->container->make($class); - } - - /** - * Resolve all of the queueable entities in the given payload. - * - * @param mixed $data - * @return mixed - */ - protected function resolveQueueableEntities($data) - { - if (is_string($data)) - { - return $this->resolveQueueableEntity($data); - } - - if (is_array($data)) - { - array_walk($data, function(&$d) { $d = $this->resolveQueueableEntity($d); }); - } - - return $data; - } - - /** - * Resolve a single queueable entity from the resolver. - * - * @param mixed $value - * @return \Illuminate\Contracts\Queue\QueueableEntity - */ - protected function resolveQueueableEntity($value) - { - if (is_string($value) && starts_with($value, '::entity::')) - { - list($marker, $type, $id) = explode('|', $value, 3); - - return $this->getEntityResolver()->resolve($type, $id); - } - - return $value; - } - - /** - * Call the failed method on the job instance. - * - * @return void - */ - public function failed() - { - $payload = json_decode($this->getRawBody(), true); - - list($class, $method) = $this->parseJob($payload['job']); - - $this->instance = $this->resolve($class); - - if (method_exists($this->instance, 'failed')) - { - $this->instance->failed($this->resolveQueueableEntities($payload['data'])); - } - } - - /** - * Get an entity resolver instance. - * - * @return \Illuminate\Contracts\Queue\EntityResolver - */ - protected function getEntityResolver() - { - return $this->container->make('Illuminate\Contracts\Queue\EntityResolver'); - } - - /** - * Calculate the number of seconds with the given delay. - * - * @param \DateTime|int $delay - * @return int - */ - protected function getSeconds($delay) - { - if ($delay instanceof DateTime) - { - return max(0, $delay->getTimestamp() - $this->getTime()); - } - - return (int) $delay; - } - - /** - * Get the current system time. - * - * @return int - */ - protected function getTime() - { - return time(); - } - - /** - * Get the name of the queued job class. - * - * @return string - */ - public function getName() - { - return json_decode($this->getRawBody(), true)['job']; - } - - /** - * Get the name of the queue the job belongs to. - * - * @return string - */ - public function getQueue() - { - return $this->queue; - } +namespace Illuminate\Queue\Jobs; +use DateTime; +use Illuminate\Support\Str; + +abstract class Job +{ + /** + * The job handler instance. + * + * @var mixed + */ + protected $instance; + + /** + * The IoC container instance. + * + * @var \Illuminate\Container\Container + */ + protected $container; + + /** + * The name of the queue the job belongs to. + * + * @var string + */ + protected $queue; + + /** + * Indicates if the job has been deleted. + * + * @var bool + */ + protected $deleted = false; + + /** + * Indicates if the job has been released. + * + * @var bool + */ + protected $released = false; + + /** + * Fire the job. + * + * @return void + */ + abstract public function fire(); + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + $this->deleted = true; + } + + /** + * Determine if the job has been deleted. + * + * @return bool + */ + public function isDeleted() + { + return $this->deleted; + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + $this->released = true; + } + + /** + * Determine if the job was released back into the queue. + * + * @return bool + */ + public function isReleased() + { + return $this->released; + } + + /** + * Determine if the job has been deleted or released. + * + * @return bool + */ + public function isDeletedOrReleased() + { + return $this->isDeleted() || $this->isReleased(); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + abstract public function attempts(); + + /** + * Get the raw body string for the job. + * + * @return string + */ + abstract public function getRawBody(); + + /** + * Resolve and fire the job handler method. + * + * @param array $payload + * @return void + */ + protected function resolveAndFire(array $payload) + { + list($class, $method) = $this->parseJob($payload['job']); + + $this->instance = $this->resolve($class); + + $this->instance->{$method}($this, $this->resolveQueueableEntities($payload['data'])); + } + + /** + * Parse the job declaration into class and method. + * + * @param string $job + * @return array + */ + protected function parseJob($job) + { + $segments = explode('@', $job); + + return count($segments) > 1 ? $segments : [$segments[0], 'fire']; + } + + /** + * Resolve the given job handler. + * + * @param string $class + * @return mixed + */ + protected function resolve($class) + { + return $this->container->make($class); + } + + /** + * Resolve all of the queueable entities in the given payload. + * + * @param mixed $data + * @return mixed + */ + protected function resolveQueueableEntities($data) + { + if (is_string($data)) { + return $this->resolveQueueableEntity($data); + } + + if (is_array($data)) { + $data = array_map(function ($d) { + if (is_array($d)) { + return $this->resolveQueueableEntities($d); + } + + return $this->resolveQueueableEntity($d); + }, $data); + } + + return $data; + } + + /** + * Resolve a single queueable entity from the resolver. + * + * @param mixed $value + * @return \Illuminate\Contracts\Queue\QueueableEntity + */ + protected function resolveQueueableEntity($value) + { + if (is_string($value) && Str::startsWith($value, '::entity::')) { + list($marker, $type, $id) = explode('|', $value, 3); + + return $this->getEntityResolver()->resolve($type, $id); + } + + return $value; + } + + /** + * Call the failed method on the job instance. + * + * @return void + */ + public function failed() + { + $payload = json_decode($this->getRawBody(), true); + + list($class, $method) = $this->parseJob($payload['job']); + + $this->instance = $this->resolve($class); + + if (method_exists($this->instance, 'failed')) { + $this->instance->failed($this->resolveQueueableEntities($payload['data'])); + } + } + + /** + * Get an entity resolver instance. + * + * @return \Illuminate\Contracts\Queue\EntityResolver + */ + protected function getEntityResolver() + { + return $this->container->make('Illuminate\Contracts\Queue\EntityResolver'); + } + + /** + * Calculate the number of seconds with the given delay. + * + * @param \DateTime|int $delay + * @return int + */ + protected function getSeconds($delay) + { + if ($delay instanceof DateTime) { + return max(0, $delay->getTimestamp() - $this->getTime()); + } + + return (int) $delay; + } + + /** + * Get the current system time. + * + * @return int + */ + protected function getTime() + { + return time(); + } + + /** + * Get the name of the queued job class. + * + * @return string + */ + public function getName() + { + return json_decode($this->getRawBody(), true)['job']; + } + + /** + * Get the name of the queue the job belongs to. + * + * @return string + */ + public function getQueue() + { + return $this->queue; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/RedisJob.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/RedisJob.php index 815b9bc..af9ca97 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/RedisJob.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/RedisJob.php @@ -1,137 +1,139 @@ -job = $job; - $this->redis = $redis; - $this->queue = $queue; - $this->container = $container; - } - - /** - * Fire the job. - * - * @return void - */ - public function fire() - { - $this->resolveAndFire(json_decode($this->getRawBody(), true)); - } - - /** - * Get the raw body string for the job. - * - * @return string - */ - public function getRawBody() - { - return $this->job; - } - - /** - * Delete the job from the queue. - * - * @return void - */ - public function delete() - { - parent::delete(); - - $this->redis->deleteReserved($this->queue, $this->job); - } - - /** - * Release the job back into the queue. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - parent::release($delay); - - $this->delete(); - - $this->redis->release($this->queue, $this->job, $delay, $this->attempts() + 1); - } - - /** - * Get the number of times the job has been attempted. - * - * @return int - */ - public function attempts() - { - return array_get(json_decode($this->job, true), 'attempts'); - } - - /** - * Get the job identifier. - * - * @return string - */ - public function getJobId() - { - return array_get(json_decode($this->job, true), 'id'); - } - - /** - * Get the IoC container instance. - * - * @return \Illuminate\Container\Container - */ - public function getContainer() - { - return $this->container; - } - - /** - * Get the underlying queue driver instance. - * - * @return \Illuminate\Redis\Database - */ - public function getRedisQueue() - { - return $this->redis; - } - - /** - * Get the underlying Redis job. - * - * @return string - */ - public function getRedisJob() - { - return $this->job; - } - +class RedisJob extends Job implements JobContract +{ + /** + * The Redis queue instance. + * + * @var \Illuminate\Queue\RedisQueue + */ + protected $redis; + + /** + * The Redis job payload. + * + * @var string + */ + protected $job; + + /** + * Create a new job instance. + * + * @param \Illuminate\Container\Container $container + * @param \Illuminate\Queue\RedisQueue $redis + * @param string $job + * @param string $queue + * @return void + */ + public function __construct(Container $container, RedisQueue $redis, $job, $queue) + { + $this->job = $job; + $this->redis = $redis; + $this->queue = $queue; + $this->container = $container; + } + + /** + * Fire the job. + * + * @return void + */ + public function fire() + { + $this->resolveAndFire(json_decode($this->getRawBody(), true)); + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->job; + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + parent::delete(); + + $this->redis->deleteReserved($this->queue, $this->job); + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + parent::release($delay); + + $this->delete(); + + $this->redis->release($this->queue, $this->job, $delay, $this->attempts() + 1); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + return Arr::get(json_decode($this->job, true), 'attempts'); + } + + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId() + { + return Arr::get(json_decode($this->job, true), 'id'); + } + + /** + * Get the IoC container instance. + * + * @return \Illuminate\Container\Container + */ + public function getContainer() + { + return $this->container; + } + + /** + * Get the underlying queue driver instance. + * + * @return \Illuminate\Redis\Database + */ + public function getRedisQueue() + { + return $this->redis; + } + + /** + * Get the underlying Redis job. + * + * @return string + */ + public function getRedisJob() + { + return $this->job; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SqsJob.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SqsJob.php index affcb30..b676a52 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SqsJob.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SqsJob.php @@ -1,146 +1,147 @@ -sqs = $sqs; - $this->job = $job; - $this->queue = $queue; - $this->container = $container; - } - - /** - * Fire the job. - * - * @return void - */ - public function fire() - { - $this->resolveAndFire(json_decode($this->getRawBody(), true)); - } - - /** - * Get the raw body string for the job. - * - * @return string - */ - public function getRawBody() - { - return $this->job['Body']; - } - - /** - * Delete the job from the queue. - * - * @return void - */ - public function delete() - { - parent::delete(); - - $this->sqs->deleteMessage(array( - - 'QueueUrl' => $this->queue, 'ReceiptHandle' => $this->job['ReceiptHandle'], - - )); - } - - /** - * Release the job back into the queue. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - parent::release($delay); - - $this->sqs->changeMessageVisibility([ - 'QueueUrl' => $this->queue, - 'ReceiptHandle' => $this->job['ReceiptHandle'], - 'VisibilityTimeout' => $delay, - ]); - } - - /** - * Get the number of times the job has been attempted. - * - * @return int - */ - public function attempts() - { - return (int) $this->job['Attributes']['ApproximateReceiveCount']; - } - - /** - * Get the job identifier. - * - * @return string - */ - public function getJobId() - { - return $this->job['MessageId']; - } - - /** - * Get the IoC container instance. - * - * @return \Illuminate\Container\Container - */ - public function getContainer() - { - return $this->container; - } - - /** - * Get the underlying SQS client instance. - * - * @return \Aws\Sqs\SqsClient - */ - public function getSqs() - { - return $this->sqs; - } - - /** - * Get the underlying raw SQS job. - * - * @return array - */ - public function getSqsJob() - { - return $this->job; - } - + { + $this->sqs = $sqs; + $this->job = $job; + $this->queue = $queue; + $this->container = $container; + } + + /** + * Fire the job. + * + * @return void + */ + public function fire() + { + $this->resolveAndFire(json_decode($this->getRawBody(), true)); + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->job['Body']; + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + parent::delete(); + + $this->sqs->deleteMessage([ + + 'QueueUrl' => $this->queue, 'ReceiptHandle' => $this->job['ReceiptHandle'], + + ]); + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + parent::release($delay); + + $this->sqs->changeMessageVisibility([ + 'QueueUrl' => $this->queue, + 'ReceiptHandle' => $this->job['ReceiptHandle'], + 'VisibilityTimeout' => $delay, + ]); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + return (int) $this->job['Attributes']['ApproximateReceiveCount']; + } + + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId() + { + return $this->job['MessageId']; + } + + /** + * Get the IoC container instance. + * + * @return \Illuminate\Container\Container + */ + public function getContainer() + { + return $this->container; + } + + /** + * Get the underlying SQS client instance. + * + * @return \Aws\Sqs\SqsClient + */ + public function getSqs() + { + return $this->sqs; + } + + /** + * Get the underlying raw SQS job. + * + * @return array + */ + public function getSqsJob() + { + return $this->job; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SyncJob.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SyncJob.php index 5ee0c4a..c1f2236 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SyncJob.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SyncJob.php @@ -1,86 +1,89 @@ -payload = $payload; - $this->container = $container; - } + /** + * The queue message data. + * + * @var string + */ + protected $payload; - /** - * Fire the job. - * - * @return void - */ - public function fire() - { - $this->resolveAndFire(json_decode($this->payload, true)); - } + /** + * Create a new job instance. + * + * @param \Illuminate\Container\Container $container + * @param string $payload + * @param string $queue + * @return void + */ + public function __construct(Container $container, $payload, $queue) + { + $this->queue = $queue; + $this->payload = $payload; + $this->container = $container; + } - /** - * Get the raw body string for the job. - * - * @return string - */ - public function getRawBody() - { - return $this->payload; - } + /** + * Fire the job. + * + * @return void + */ + public function fire() + { + $this->resolveAndFire(json_decode($this->payload, true)); + } - /** - * Release the job back into the queue. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - parent::release($delay); - } + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->payload; + } - /** - * Get the number of times the job has been attempted. - * - * @return int - */ - public function attempts() - { - return 1; - } + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + parent::release($delay); + } - /** - * Get the job identifier. - * - * @return string - */ - public function getJobId() - { - return ''; - } + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + return 1; + } + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId() + { + return ''; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Listener.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Listener.php index 96a809f..b19d46c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Listener.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Listener.php @@ -1,238 +1,265 @@ -commandPath = $commandPath; + $this->workerCommand = $this->buildWorkerCommand(); + } + + /** + * Build the environment specific worker command. + * + * @return string + */ + protected function buildWorkerCommand() + { + $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); + + if (defined('HHVM_VERSION')) { + $binary .= ' --php'; + } + + if (defined('ARTISAN_BINARY')) { + $artisan = ProcessUtils::escapeArgument(ARTISAN_BINARY); + } else { + $artisan = 'artisan'; + } + + $command = 'queue:work %s --queue=%s --delay=%s --memory=%s --sleep=%s --tries=%s'; + + return "{$binary} {$artisan} {$command}"; + } + + /** + * Listen to the given queue connection. + * + * @param string $connection + * @param string $queue + * @param string $delay + * @param string $memory + * @param int $timeout + * @return void + */ + public function listen($connection, $queue, $delay, $memory, $timeout = 60) + { + $process = $this->makeProcess($connection, $queue, $delay, $memory, $timeout); + + while (true) { + $this->runProcess($process, $memory); + } + } + + /** + * Run the given process. + * + * @param \Symfony\Component\Process\Process $process + * @param int $memory + * @return void + */ + public function runProcess(Process $process, $memory) + { + $process->run(function ($type, $line) { + $this->handleWorkerOutput($type, $line); + }); + + // Once we have run the job we'll go check if the memory limit has been + // exceeded for the script. If it has, we will kill this script so a + // process manager will restart this with a clean slate of memory. + if ($this->memoryExceeded($memory)) { + $this->stop(); + } + } + + /** + * Create a new Symfony process for the worker. + * + * @param string $connection + * @param string $queue + * @param int $delay + * @param int $memory + * @param int $timeout + * @return \Symfony\Component\Process\Process + */ + public function makeProcess($connection, $queue, $delay, $memory, $timeout) + { + $string = $this->workerCommand; + + // If the environment is set, we will append it to the command string so the + // workers will run under the specified environment. Otherwise, they will + // just run under the production environment which is not always right. + if (isset($this->environment)) { + $string .= ' --env='.ProcessUtils::escapeArgument($this->environment); + } + + // Next, we will just format out the worker commands with all of the various + // options available for the command. This will produce the final command + // line that we will pass into a Symfony process object for processing. + $command = sprintf( + $string, + ProcessUtils::escapeArgument($connection), + ProcessUtils::escapeArgument($queue), + $delay, + $memory, + $this->sleep, + $this->maxTries + ); + + return new Process($command, $this->commandPath, null, null, $timeout); + } + + /** + * Handle output from the worker process. + * + * @param int $type + * @param string $line + * @return void + */ + protected function handleWorkerOutput($type, $line) + { + if (isset($this->outputHandler)) { + call_user_func($this->outputHandler, $type, $line); + } + } + + /** + * Determine if the memory limit has been exceeded. + * + * @param int $memoryLimit + * @return bool + */ + public function memoryExceeded($memoryLimit) + { + return (memory_get_usage() / 1024 / 1024) >= $memoryLimit; + } + + /** + * Stop listening and bail out of the script. + * + * @return void + */ + public function stop() + { + die; + } + + /** + * Set the output handler callback. + * + * @param \Closure $outputHandler + * @return void + */ + public function setOutputHandler(Closure $outputHandler) + { + $this->outputHandler = $outputHandler; + } + + /** + * Get the current listener environment. + * + * @return string + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * Set the current environment. + * + * @param string $environment + * @return void + */ + public function setEnvironment($environment) + { + $this->environment = $environment; + } + + /** + * Get the amount of seconds to wait before polling the queue. + * + * @return int + */ + public function getSleep() + { + return $this->sleep; + } -class Listener { - - /** - * The command working path. - * - * @var string - */ - protected $commandPath; - - /** - * The environment the workers should run under. - * - * @var string - */ - protected $environment; - - /** - * The amount of seconds to wait before polling the queue. - * - * @var int - */ - protected $sleep = 3; - - /** - * The amount of times to try a job before logging it failed. - * - * @var int - */ - protected $maxTries = 0; - - /** - * The queue worker command line. - * - * @var string - */ - protected $workerCommand; - - /** - * The output handler callback. - * - * @var \Closure|null - */ - protected $outputHandler; - - /** - * Create a new queue listener. - * - * @param string $commandPath - * @return void - */ - public function __construct($commandPath) - { - $this->commandPath = $commandPath; - $this->workerCommand = '"'.PHP_BINARY.'" artisan queue:work %s --queue="%s" --delay=%s --memory=%s --sleep=%s --tries=%s'; - } - - /** - * Listen to the given queue connection. - * - * @param string $connection - * @param string $queue - * @param string $delay - * @param string $memory - * @param int $timeout - * @return void - */ - public function listen($connection, $queue, $delay, $memory, $timeout = 60) - { - $process = $this->makeProcess($connection, $queue, $delay, $memory, $timeout); - - while (true) - { - $this->runProcess($process, $memory); - } - } - - /** - * Run the given process. - * - * @param \Symfony\Component\Process\Process $process - * @param int $memory - * @return void - */ - public function runProcess(Process $process, $memory) - { - $process->run(function($type, $line) - { - $this->handleWorkerOutput($type, $line); - }); - - // Once we have run the job we'll go check if the memory limit has been - // exceeded for the script. If it has, we will kill this script so a - // process manager will restart this with a clean slate of memory. - if ($this->memoryExceeded($memory)) - { - $this->stop(); - } - } - - /** - * Create a new Symfony process for the worker. - * - * @param string $connection - * @param string $queue - * @param int $delay - * @param int $memory - * @param int $timeout - * @return \Symfony\Component\Process\Process - */ - public function makeProcess($connection, $queue, $delay, $memory, $timeout) - { - $string = $this->workerCommand; - - // If the environment is set, we will append it to the command string so the - // workers will run under the specified environment. Otherwise, they will - // just run under the production environment which is not always right. - if (isset($this->environment)) - { - $string .= ' --env='.$this->environment; - } - - // Next, we will just format out the worker commands with all of the various - // options available for the command. This will produce the final command - // line that we will pass into a Symfony process object for processing. - $command = sprintf( - $string, $connection, $queue, $delay, - $memory, $this->sleep, $this->maxTries - ); - - return new Process($command, $this->commandPath, null, null, $timeout); - } - - /** - * Handle output from the worker process. - * - * @param int $type - * @param string $line - * @return void - */ - protected function handleWorkerOutput($type, $line) - { - if (isset($this->outputHandler)) - { - call_user_func($this->outputHandler, $type, $line); - } - } - - /** - * Determine if the memory limit has been exceeded. - * - * @param int $memoryLimit - * @return bool - */ - public function memoryExceeded($memoryLimit) - { - return (memory_get_usage() / 1024 / 1024) >= $memoryLimit; - } - - /** - * Stop listening and bail out of the script. - * - * @return void - */ - public function stop() - { - die; - } - - /** - * Set the output handler callback. - * - * @param \Closure $outputHandler - * @return void - */ - public function setOutputHandler(Closure $outputHandler) - { - $this->outputHandler = $outputHandler; - } - - /** - * Get the current listener environment. - * - * @return string - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * Set the current environment. - * - * @param string $environment - * @return void - */ - public function setEnvironment($environment) - { - $this->environment = $environment; - } - - /** - * Get the amount of seconds to wait before polling the queue. - * - * @return int - */ - public function getSleep() - { - return $this->sleep; - } - - /** - * Set the amount of seconds to wait before polling the queue. - * - * @param int $sleep - * @return void - */ - public function setSleep($sleep) - { - $this->sleep = $sleep; - } - - /** - * Set the amount of times to try a job before logging it failed. - * - * @param int $tries - * @return void - */ - public function setMaxTries($tries) - { - $this->maxTries = $tries; - } + /** + * Set the amount of seconds to wait before polling the queue. + * + * @param int $sleep + * @return void + */ + public function setSleep($sleep) + { + $this->sleep = $sleep; + } + /** + * Set the amount of times to try a job before logging it failed. + * + * @param int $tries + * @return void + */ + public function setMaxTries($tries) + { + $this->maxTries = $tries; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/NullQueue.php b/application/vendor/laravel/framework/src/Illuminate/Queue/NullQueue.php index e8d92ef..bdef6cc 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/NullQueue.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/NullQueue.php @@ -1,58 +1,59 @@ -push($job, $data, $queue); - } - - /** - * Push a new job onto the queue after a delay. - * - * @param string $queue - * @param \DateTime|int $delay - * @param string $job - * @param mixed $data - * @return mixed - */ - public function laterOn($queue, $delay, $job, $data = '') - { - return $this->later($delay, $job, $data, $queue); - } - - /** - * Marshal a push queue request and fire the job. - * - * @throws \RuntimeException - */ - public function marshal() - { - throw new RuntimeException("Push queues only supported by Iron."); - } - - /** - * Push an array of jobs onto the queue. - * - * @param array $jobs - * @param mixed $data - * @param string $queue - * @return mixed - */ - public function bulk($jobs, $data = '', $queue = null) - { - foreach ((array) $jobs as $job) - { - $this->push($job, $data, $queue); - } - } - - /** - * Create a payload string from the given job and data. - * - * @param string $job - * @param mixed $data - * @param string $queue - * @return string - */ - protected function createPayload($job, $data = '', $queue = null) - { - if ($job instanceof Closure) - { - return json_encode($this->createClosurePayload($job, $data)); - } - elseif (is_object($job)) - { - return json_encode([ - 'job' => 'Illuminate\Queue\CallQueuedHandler@call', - 'data' => ['command' => serialize(clone $job)], - ]); - } - - return json_encode($this->createPlainPayload($job, $data)); - } - - /** - * Create a typical, "plain" queue payload array. - * - * @param string $job - * @param mixed $data - * @return array - */ - protected function createPlainPayload($job, $data) - { - return ['job' => $job, 'data' => $this->prepareQueueableEntities($data)]; - } - - /** - * Prepare any queueable entities for storage in the queue. - * - * @param mixed $data - * @return mixed - */ - protected function prepareQueueableEntities($data) - { - if ($data instanceof QueueableEntity) - { - return $this->prepareQueueableEntity($data); - } - - if (is_array($data)) - { - array_walk($data, function(&$d) { $d = $this->prepareQueueableEntity($d); }); - } - - return $data; - } - - /** - * Prepare a single queueable entity for storage on the queue. - * - * @param mixed $value - * @return mixed - */ - protected function prepareQueueableEntity($value) - { - if ($value instanceof QueueableEntity) - { - return '::entity::|'.get_class($value).'|'.$value->getQueueableId(); - } - - return $value; - } - - /** - * Create a payload string for the given Closure job. - * - * @param \Closure $job - * @param mixed $data - * @return string - */ - protected function createClosurePayload($job, $data) - { - $closure = $this->crypt->encrypt((new Serializer)->serialize($job)); - - return ['job' => 'IlluminateQueueClosure', 'data' => compact('closure')]; - } - - /** - * Set additional meta on a payload string. - * - * @param string $payload - * @param string $key - * @param string $value - * @return string - */ - protected function setMeta($payload, $key, $value) - { - $payload = json_decode($payload, true); - - return json_encode(array_set($payload, $key, $value)); - } - - /** - * Calculate the number of seconds with the given delay. - * - * @param \DateTime|int $delay - * @return int - */ - protected function getSeconds($delay) - { - if ($delay instanceof DateTime) - { - return max(0, $delay->getTimestamp() - $this->getTime()); - } - - return (int) $delay; - } - - /** - * Get the current UNIX timestamp. - * - * @return int - */ - protected function getTime() - { - return time(); - } - - /** - * Set the IoC container instance. - * - * @param \Illuminate\Container\Container $container - * @return void - */ - public function setContainer(Container $container) - { - $this->container = $container; - } - - /** - * Set the encrypter instance. - * - * @param \Illuminate\Contracts\Encryption\Encrypter $crypt - * @return void - */ - public function setEncrypter(EncrypterContract $crypt) - { - $this->crypt = $crypt; - } - +abstract class Queue +{ + /** + * The IoC container instance. + * + * @var \Illuminate\Container\Container + */ + protected $container; + + /** + * Push a new job onto the queue. + * + * @param string $queue + * @param string $job + * @param mixed $data + * @return mixed + */ + public function pushOn($queue, $job, $data = '') + { + return $this->push($job, $data, $queue); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param string $queue + * @param \DateTime|int $delay + * @param string $job + * @param mixed $data + * @return mixed + */ + public function laterOn($queue, $delay, $job, $data = '') + { + return $this->later($delay, $job, $data, $queue); + } + + /** + * Marshal a push queue request and fire the job. + * + * @throws \RuntimeException + * + * @deprecated since version 5.1. + */ + public function marshal() + { + throw new RuntimeException('Push queues only supported by Iron.'); + } + + /** + * Push an array of jobs onto the queue. + * + * @param array $jobs + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function bulk($jobs, $data = '', $queue = null) + { + foreach ((array) $jobs as $job) { + $this->push($job, $data, $queue); + } + } + + /** + * Create a payload string from the given job and data. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @return string + */ + protected function createPayload($job, $data = '', $queue = null) + { + if ($job instanceof Closure) { + return json_encode($this->createClosurePayload($job, $data)); + } elseif (is_object($job)) { + return json_encode([ + 'job' => 'Illuminate\Queue\CallQueuedHandler@call', + 'data' => ['command' => serialize(clone $job)], + ]); + } + + return json_encode($this->createPlainPayload($job, $data)); + } + + /** + * Create a typical, "plain" queue payload array. + * + * @param string $job + * @param mixed $data + * @return array + */ + protected function createPlainPayload($job, $data) + { + return ['job' => $job, 'data' => $this->prepareQueueableEntities($data)]; + } + + /** + * Prepare any queueable entities for storage in the queue. + * + * @param mixed $data + * @return mixed + */ + protected function prepareQueueableEntities($data) + { + if ($data instanceof QueueableEntity) { + return $this->prepareQueueableEntity($data); + } + + if (is_array($data)) { + $data = array_map(function ($d) { + if (is_array($d)) { + return $this->prepareQueueableEntities($d); + } + + return $this->prepareQueueableEntity($d); + }, $data); + } + + return $data; + } + + /** + * Prepare a single queueable entity for storage on the queue. + * + * @param mixed $value + * @return mixed + */ + protected function prepareQueueableEntity($value) + { + if ($value instanceof QueueableEntity) { + return '::entity::|'.get_class($value).'|'.$value->getQueueableId(); + } + + return $value; + } + + /** + * Create a payload string for the given Closure job. + * + * @param \Closure $job + * @param mixed $data + * @return string + */ + protected function createClosurePayload($job, $data) + { + $closure = $this->crypt->encrypt((new Serializer)->serialize($job)); + + return ['job' => 'IlluminateQueueClosure', 'data' => compact('closure')]; + } + + /** + * Set additional meta on a payload string. + * + * @param string $payload + * @param string $key + * @param string $value + * @return string + */ + protected function setMeta($payload, $key, $value) + { + $payload = json_decode($payload, true); + + return json_encode(Arr::set($payload, $key, $value)); + } + + /** + * Calculate the number of seconds with the given delay. + * + * @param \DateTime|int $delay + * @return int + */ + protected function getSeconds($delay) + { + if ($delay instanceof DateTime) { + return max(0, $delay->getTimestamp() - $this->getTime()); + } + + return (int) $delay; + } + + /** + * Get the current UNIX timestamp. + * + * @return int + */ + protected function getTime() + { + return time(); + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Container\Container $container + * @return void + */ + public function setContainer(Container $container) + { + $this->container = $container; + } + + /** + * Set the encrypter instance. + * + * @param \Illuminate\Contracts\Encryption\Encrypter $crypt + * @return void + */ + public function setEncrypter(EncrypterContract $crypt) + { + $this->crypt = $crypt; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php b/application/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php index 4f8f47a..cf91bbd 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php @@ -1,226 +1,243 @@ -app = $app; - } - - /** - * Register an event listener for the daemon queue loop. - * - * @param mixed $callback - * @return void - */ - public function looping($callback) - { - $this->app['events']->listen('illuminate.queue.looping', $callback); - } - - /** - * Register an event listener for the failed job event. - * - * @param mixed $callback - * @return void - */ - public function failing($callback) - { - $this->app['events']->listen('illuminate.queue.failed', $callback); - } - - /** - * Register an event listener for the daemon queue stopping. - * - * @param mixed $callback - * @return void - */ - public function stopping($callback) - { - $this->app['events']->listen('illuminate.queue.stopping', $callback); - } - - /** - * Determine if the driver is connected. - * - * @param string $name - * @return bool - */ - public function connected($name = null) - { - return isset($this->connections[$name ?: $this->getDefaultDriver()]); - } - - /** - * Resolve a queue connection instance. - * - * @param string $name - * @return \Illuminate\Contracts\Queue\Queue - */ - public function connection($name = null) - { - $name = $name ?: $this->getDefaultDriver(); - - // If the connection has not been resolved yet we will resolve it now as all - // of the connections are resolved when they are actually needed so we do - // not make any unnecessary connection to the various queue end-points. - if ( ! isset($this->connections[$name])) - { - $this->connections[$name] = $this->resolve($name); - - $this->connections[$name]->setContainer($this->app); - - $this->connections[$name]->setEncrypter($this->app['encrypter']); - } - - return $this->connections[$name]; - } - - /** - * Resolve a queue connection. - * - * @param string $name - * @return \Illuminate\Contracts\Queue\Queue - */ - protected function resolve($name) - { - $config = $this->getConfig($name); - - return $this->getConnector($config['driver'])->connect($config); - } - - /** - * Get the connector for a given driver. - * - * @param string $driver - * @return \Illuminate\Queue\Connectors\ConnectorInterface - * - * @throws \InvalidArgumentException - */ - protected function getConnector($driver) - { - if (isset($this->connectors[$driver])) - { - return call_user_func($this->connectors[$driver]); - } - - throw new InvalidArgumentException("No connector for [$driver]"); - } - - /** - * Add a queue connection resolver. - * - * @param string $driver - * @param \Closure $resolver - * @return void - */ - public function extend($driver, Closure $resolver) - { - return $this->addConnector($driver, $resolver); - } - - /** - * Add a queue connection resolver. - * - * @param string $driver - * @param \Closure $resolver - * @return void - */ - public function addConnector($driver, Closure $resolver) - { - $this->connectors[$driver] = $resolver; - } - - /** - * Get the queue connection configuration. - * - * @param string $name - * @return array - */ - protected function getConfig($name) - { - return $this->app['config']["queue.connections.{$name}"]; - } - - /** - * Get the name of the default queue connection. - * - * @return string - */ - public function getDefaultDriver() - { - return $this->app['config']['queue.default']; - } - - /** - * Set the name of the default queue connection. - * - * @param string $name - * @return void - */ - public function setDefaultDriver($name) - { - $this->app['config']['queue.default'] = $name; - } - - /** - * Get the full name for the given connection. - * - * @param string $connection - * @return string - */ - public function getName($connection = null) - { - return $connection ?: $this->getDefaultDriver(); - } - - /** - * Determine if the application is in maintenance mode. - * - * @return bool - */ - public function isDownForMaintenance() - { - return $this->app->isDownForMaintenance(); - } - - /** - * Dynamically pass calls to the default connection. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - $callable = array($this->connection(), $method); - - return call_user_func_array($callable, $parameters); - } - +class QueueManager implements FactoryContract, MonitorContract +{ + /** + * The application instance. + * + * @var \Illuminate\Foundation\Application + */ + protected $app; + + /** + * The array of resolved queue connections. + * + * @var array + */ + protected $connections = []; + + /** + * The array of resolved queue connectors. + * + * @var array + */ + protected $connectors = []; + + /** + * Create a new queue manager instance. + * + * @param \Illuminate\Foundation\Application $app + * @return void + */ + public function __construct($app) + { + $this->app = $app; + } + + /** + * Register an event listener for the after job event. + * + * @param mixed $callback + * @return void + */ + public function after($callback) + { + $this->app['events']->listen('illuminate.queue.after', $callback); + } + + /** + * Register an event listener for the daemon queue loop. + * + * @param mixed $callback + * @return void + */ + public function looping($callback) + { + $this->app['events']->listen('illuminate.queue.looping', $callback); + } + + /** + * Register an event listener for the failed job event. + * + * @param mixed $callback + * @return void + */ + public function failing($callback) + { + $this->app['events']->listen('illuminate.queue.failed', $callback); + } + + /** + * Register an event listener for the daemon queue stopping. + * + * @param mixed $callback + * @return void + */ + public function stopping($callback) + { + $this->app['events']->listen('illuminate.queue.stopping', $callback); + } + + /** + * Determine if the driver is connected. + * + * @param string $name + * @return bool + */ + public function connected($name = null) + { + return isset($this->connections[$name ?: $this->getDefaultDriver()]); + } + + /** + * Resolve a queue connection instance. + * + * @param string $name + * @return \Illuminate\Contracts\Queue\Queue + */ + public function connection($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + // If the connection has not been resolved yet we will resolve it now as all + // of the connections are resolved when they are actually needed so we do + // not make any unnecessary connection to the various queue end-points. + if (! isset($this->connections[$name])) { + $this->connections[$name] = $this->resolve($name); + + $this->connections[$name]->setContainer($this->app); + + $this->connections[$name]->setEncrypter($this->app['encrypter']); + } + + return $this->connections[$name]; + } + + /** + * Resolve a queue connection. + * + * @param string $name + * @return \Illuminate\Contracts\Queue\Queue + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + return $this->getConnector($config['driver'])->connect($config); + } + + /** + * Get the connector for a given driver. + * + * @param string $driver + * @return \Illuminate\Queue\Connectors\ConnectorInterface + * + * @throws \InvalidArgumentException + */ + protected function getConnector($driver) + { + if (isset($this->connectors[$driver])) { + return call_user_func($this->connectors[$driver]); + } + + throw new InvalidArgumentException("No connector for [$driver]"); + } + + /** + * Add a queue connection resolver. + * + * @param string $driver + * @param \Closure $resolver + * @return void + */ + public function extend($driver, Closure $resolver) + { + return $this->addConnector($driver, $resolver); + } + + /** + * Add a queue connection resolver. + * + * @param string $driver + * @param \Closure $resolver + * @return void + */ + public function addConnector($driver, Closure $resolver) + { + $this->connectors[$driver] = $resolver; + } + + /** + * Get the queue connection configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + return $this->app['config']["queue.connections.{$name}"]; + } + + /** + * Get the name of the default queue connection. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['queue.default']; + } + + /** + * Set the name of the default queue connection. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['queue.default'] = $name; + } + + /** + * Get the full name for the given connection. + * + * @param string $connection + * @return string + */ + public function getName($connection = null) + { + return $connection ?: $this->getDefaultDriver(); + } + + /** + * Determine if the application is in maintenance mode. + * + * @return bool + */ + public function isDownForMaintenance() + { + return $this->app->isDownForMaintenance(); + } + + /** + * Dynamically pass calls to the default connection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + $callable = [$this->connection(), $method]; + + return call_user_func_array($callable, $parameters); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/QueueServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Queue/QueueServiceProvider.php index 1993a72..5957a89 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/QueueServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/QueueServiceProvider.php @@ -1,4 +1,6 @@ -registerManager(); - - $this->registerWorker(); - - $this->registerListener(); - - $this->registerSubscriber(); - - $this->registerFailedJobServices(); - - $this->registerQueueClosure(); - } - - /** - * Register the queue manager. - * - * @return void - */ - protected function registerManager() - { - $this->app->singleton('queue', function($app) - { - // Once we have an instance of the queue manager, we will register the various - // resolvers for the queue connectors. These connectors are responsible for - // creating the classes that accept queue configs and instantiate queues. - $manager = new QueueManager($app); - - $this->registerConnectors($manager); - - return $manager; - }); - - $this->app->singleton('queue.connection', function($app) - { - return $app['queue']->connection(); - }); - } - - /** - * Register the queue worker. - * - * @return void - */ - protected function registerWorker() - { - $this->registerWorkCommand(); - - $this->registerRestartCommand(); - - $this->app->singleton('queue.worker', function($app) - { - return new Worker($app['queue'], $app['queue.failer'], $app['events']); - }); - } - - /** - * Register the queue worker console command. - * - * @return void - */ - protected function registerWorkCommand() - { - $this->app->singleton('command.queue.work', function($app) - { - return new WorkCommand($app['queue.worker']); - }); - - $this->commands('command.queue.work'); - } - - /** - * Register the queue listener. - * - * @return void - */ - protected function registerListener() - { - $this->registerListenCommand(); - - $this->app->singleton('queue.listener', function($app) - { - return new Listener($app->basePath()); - }); - } - - /** - * Register the queue listener console command. - * - * @return void - */ - protected function registerListenCommand() - { - $this->app->singleton('command.queue.listen', function($app) - { - return new ListenCommand($app['queue.listener']); - }); - - $this->commands('command.queue.listen'); - } - - /** - * Register the queue restart console command. - * - * @return void - */ - public function registerRestartCommand() - { - $this->app->singleton('command.queue.restart', function() - { - return new RestartCommand; - }); - - $this->commands('command.queue.restart'); - } - - /** - * Register the push queue subscribe command. - * - * @return void - */ - protected function registerSubscriber() - { - $this->app->singleton('command.queue.subscribe', function() - { - return new SubscribeCommand; - }); - - $this->commands('command.queue.subscribe'); - } - - /** - * Register the connectors on the queue manager. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - public function registerConnectors($manager) - { - foreach (array('Null', 'Sync', 'Database', 'Beanstalkd', 'Redis', 'Sqs', 'Iron') as $connector) - { - $this->{"register{$connector}Connector"}($manager); - } - } - - /** - * Register the Null queue connector. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - protected function registerNullConnector($manager) - { - $manager->addConnector('null', function() - { - return new NullConnector; - }); - } - - /** - * Register the Sync queue connector. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - protected function registerSyncConnector($manager) - { - $manager->addConnector('sync', function() - { - return new SyncConnector; - }); - } - - /** - * Register the Beanstalkd queue connector. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - protected function registerBeanstalkdConnector($manager) - { - $manager->addConnector('beanstalkd', function() - { - return new BeanstalkdConnector; - }); - } - - /** - * Register the database queue connector. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - protected function registerDatabaseConnector($manager) - { - $manager->addConnector('database', function() - { - return new DatabaseConnector($this->app['db']); - }); - } - - /** - * Register the Redis queue connector. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - protected function registerRedisConnector($manager) - { - $app = $this->app; - - $manager->addConnector('redis', function() use ($app) - { - return new RedisConnector($app['redis']); - }); - } - - /** - * Register the Amazon SQS queue connector. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - protected function registerSqsConnector($manager) - { - $manager->addConnector('sqs', function() - { - return new SqsConnector; - }); - } - - /** - * Register the IronMQ queue connector. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - protected function registerIronConnector($manager) - { - $app = $this->app; - - $manager->addConnector('iron', function() use ($app) - { - return new IronConnector($app['encrypter'], $app['request']); - }); - - $this->registerIronRequestBinder(); - } - - /** - * Register the request rebinding event for the Iron queue. - * - * @return void - */ - protected function registerIronRequestBinder() - { - $this->app->rebinding('request', function($app, $request) - { - if ($app['queue']->connected('iron')) - { - $app['queue']->connection('iron')->setRequest($request); - } - }); - } - - /** - * Register the failed job services. - * - * @return void - */ - protected function registerFailedJobServices() - { - $this->app->singleton('queue.failer', function($app) - { - $config = $app['config']['queue.failed']; - - return new DatabaseFailedJobProvider($app['db'], $config['database'], $config['table']); - }); - } - - /** - * Register the Illuminate queued closure job. - * - * @return void - */ - protected function registerQueueClosure() - { - $this->app->singleton('IlluminateQueueClosure', function($app) - { - return new IlluminateQueueClosure($app['encrypter']); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array( - 'queue', 'queue.worker', 'queue.listener', 'queue.failer', - 'command.queue.work', 'command.queue.listen', 'command.queue.restart', - 'command.queue.subscribe', 'queue.connection', - ); - } - +class QueueServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerManager(); + + $this->registerWorker(); + + $this->registerListener(); + + $this->registerSubscriber(); + + $this->registerFailedJobServices(); + + $this->registerQueueClosure(); + } + + /** + * Register the queue manager. + * + * @return void + */ + protected function registerManager() + { + $this->app->singleton('queue', function ($app) { + // Once we have an instance of the queue manager, we will register the various + // resolvers for the queue connectors. These connectors are responsible for + // creating the classes that accept queue configs and instantiate queues. + $manager = new QueueManager($app); + + $this->registerConnectors($manager); + + return $manager; + }); + + $this->app->singleton('queue.connection', function ($app) { + return $app['queue']->connection(); + }); + } + + /** + * Register the queue worker. + * + * @return void + */ + protected function registerWorker() + { + $this->registerWorkCommand(); + + $this->registerRestartCommand(); + + $this->app->singleton('queue.worker', function ($app) { + return new Worker($app['queue'], $app['queue.failer'], $app['events']); + }); + } + + /** + * Register the queue worker console command. + * + * @return void + */ + protected function registerWorkCommand() + { + $this->app->singleton('command.queue.work', function ($app) { + return new WorkCommand($app['queue.worker']); + }); + + $this->commands('command.queue.work'); + } + + /** + * Register the queue listener. + * + * @return void + */ + protected function registerListener() + { + $this->registerListenCommand(); + + $this->app->singleton('queue.listener', function ($app) { + return new Listener($app->basePath()); + }); + } + + /** + * Register the queue listener console command. + * + * @return void + */ + protected function registerListenCommand() + { + $this->app->singleton('command.queue.listen', function ($app) { + return new ListenCommand($app['queue.listener']); + }); + + $this->commands('command.queue.listen'); + } + + /** + * Register the queue restart console command. + * + * @return void + */ + public function registerRestartCommand() + { + $this->app->singleton('command.queue.restart', function () { + return new RestartCommand; + }); + + $this->commands('command.queue.restart'); + } + + /** + * Register the push queue subscribe command. + * + * @return void + */ + protected function registerSubscriber() + { + $this->app->singleton('command.queue.subscribe', function () { + return new SubscribeCommand; + }); + + $this->commands('command.queue.subscribe'); + } + + /** + * Register the connectors on the queue manager. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + public function registerConnectors($manager) + { + foreach (['Null', 'Sync', 'Database', 'Beanstalkd', 'Redis', 'Sqs', 'Iron'] as $connector) { + $this->{"register{$connector}Connector"}($manager); + } + } + + /** + * Register the Null queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerNullConnector($manager) + { + $manager->addConnector('null', function () { + return new NullConnector; + }); + } + + /** + * Register the Sync queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerSyncConnector($manager) + { + $manager->addConnector('sync', function () { + return new SyncConnector; + }); + } + + /** + * Register the Beanstalkd queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerBeanstalkdConnector($manager) + { + $manager->addConnector('beanstalkd', function () { + return new BeanstalkdConnector; + }); + } + + /** + * Register the database queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerDatabaseConnector($manager) + { + $manager->addConnector('database', function () { + return new DatabaseConnector($this->app['db']); + }); + } + + /** + * Register the Redis queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerRedisConnector($manager) + { + $app = $this->app; + + $manager->addConnector('redis', function () use ($app) { + return new RedisConnector($app['redis']); + }); + } + + /** + * Register the Amazon SQS queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerSqsConnector($manager) + { + $manager->addConnector('sqs', function () { + return new SqsConnector; + }); + } + + /** + * Register the IronMQ queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerIronConnector($manager) + { + $app = $this->app; + + $manager->addConnector('iron', function () use ($app) { + return new IronConnector($app['encrypter'], $app['request']); + }); + + $this->registerIronRequestBinder(); + } + + /** + * Register the request rebinding event for the Iron queue. + * + * @return void + */ + protected function registerIronRequestBinder() + { + $this->app->rebinding('request', function ($app, $request) { + if ($app['queue']->connected('iron')) { + $app['queue']->connection('iron')->setRequest($request); + } + }); + } + + /** + * Register the failed job services. + * + * @return void + */ + protected function registerFailedJobServices() + { + $this->app->singleton('queue.failer', function ($app) { + $config = $app['config']['queue.failed']; + + if (isset($config['table'])) { + return new DatabaseFailedJobProvider($app['db'], $config['database'], $config['table']); + } else { + return new NullFailedJobProvider; + } + }); + } + + /** + * Register the Illuminate queued closure job. + * + * @return void + */ + protected function registerQueueClosure() + { + $this->app->singleton('IlluminateQueueClosure', function ($app) { + return new IlluminateQueueClosure($app['encrypter']); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'queue', 'queue.worker', 'queue.listener', 'queue.failer', + 'command.queue.work', 'command.queue.listen', 'command.queue.restart', + 'command.queue.subscribe', 'queue.connection', + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php b/application/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php index d349eb7..acd36ab 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php @@ -1,320 +1,319 @@ -redis = $redis; - $this->default = $default; - $this->connection = $connection; - } - - /** - * Push a new job onto the queue. - * - * @param string $job - * @param mixed $data - * @param string $queue - * @return void - */ - public function push($job, $data = '', $queue = null) - { - return $this->pushRaw($this->createPayload($job, $data), $queue); - } - - /** - * Push a raw payload onto the queue. - * - * @param string $payload - * @param string $queue - * @param array $options - * @return mixed - */ - public function pushRaw($payload, $queue = null, array $options = array()) - { - $this->getConnection()->rpush($this->getQueue($queue), $payload); - - return array_get(json_decode($payload, true), 'id'); - } - - /** - * Push a new job onto the queue after a delay. - * - * @param \DateTime|int $delay - * @param string $job - * @param mixed $data - * @param string $queue - * @return void - */ - public function later($delay, $job, $data = '', $queue = null) - { - $payload = $this->createPayload($job, $data); - - $delay = $this->getSeconds($delay); - - $this->getConnection()->zadd($this->getQueue($queue).':delayed', $this->getTime() + $delay, $payload); - - return array_get(json_decode($payload, true), 'id'); - } - - /** - * Release a reserved job back onto the queue. - * - * @param string $queue - * @param string $payload - * @param int $delay - * @param int $attempts - * @return void - */ - public function release($queue, $payload, $delay, $attempts) - { - $payload = $this->setMeta($payload, 'attempts', $attempts); - - $this->getConnection()->zadd($this->getQueue($queue).':delayed', $this->getTime() + $delay, $payload); - } - - /** - * Pop the next job off of the queue. - * - * @param string $queue - * @return \Illuminate\Contracts\Queue\Job|null - */ - public function pop($queue = null) - { - $original = $queue ?: $this->default; - - $queue = $this->getQueue($queue); - - if ( ! is_null($this->expire)) - { - $this->migrateAllExpiredJobs($queue); - } - - $job = $this->getConnection()->lpop($queue); - - if ( ! is_null($job)) - { - $this->getConnection()->zadd($queue.':reserved', $this->getTime() + $this->expire, $job); - - return new RedisJob($this->container, $this, $job, $original); - } - } - - /** - * Delete a reserved job from the queue. - * - * @param string $queue - * @param string $job - * @return void - */ - public function deleteReserved($queue, $job) - { - $this->getConnection()->zrem($this->getQueue($queue).':reserved', $job); - } - - /** - * Migrate all of the waiting jobs in the queue. - * - * @param string $queue - * @return void - */ - protected function migrateAllExpiredJobs($queue) - { - $this->migrateExpiredJobs($queue.':delayed', $queue); - - $this->migrateExpiredJobs($queue.':reserved', $queue); - } - - /** - * Migrate the delayed jobs that are ready to the regular queue. - * - * @param string $from - * @param string $to - * @return void - */ - public function migrateExpiredJobs($from, $to) - { - $options = ['cas' => true, 'watch' => $from, 'retry' => 10]; - - $this->getConnection()->transaction($options, function ($transaction) use ($from, $to) - { - // First we need to get all of jobs that have expired based on the current time - // so that we can push them onto the main queue. After we get them we simply - // remove them from this "delay" queues. All of this within a transaction. - $jobs = $this->getExpiredJobs( - $transaction, $from, $time = $this->getTime() - ); - - // If we actually found any jobs, we will remove them from the old queue and we - // will insert them onto the new (ready) "queue". This means they will stand - // ready to be processed by the queue worker whenever their turn comes up. - if (count($jobs) > 0) - { - $this->removeExpiredJobs($transaction, $from, $time); - - $this->pushExpiredJobsOntoNewQueue($transaction, $to, $jobs); - } - }); - } - - /** - * Get the expired jobs from a given queue. - * - * @param \Predis\Transaction\MultiExec $transaction - * @param string $from - * @param int $time - * @return array - */ - protected function getExpiredJobs($transaction, $from, $time) - { - return $transaction->zrangebyscore($from, '-inf', $time); - } - - /** - * Remove the expired jobs from a given queue. - * - * @param \Predis\Transaction\MultiExec $transaction - * @param string $from - * @param int $time - * @return void - */ - protected function removeExpiredJobs($transaction, $from, $time) - { - $transaction->multi(); - - $transaction->zremrangebyscore($from, '-inf', $time); - } - - /** - * Push all of the given jobs onto another queue. - * - * @param \Predis\Transaction\MultiExec $transaction - * @param string $to - * @param array $jobs - * @return void - */ - protected function pushExpiredJobsOntoNewQueue($transaction, $to, $jobs) - { - call_user_func_array([$transaction, 'rpush'], array_merge([$to], $jobs)); - } - - /** - * Create a payload string from the given job and data. - * - * @param string $job - * @param mixed $data - * @param string $queue - * @return string - */ - protected function createPayload($job, $data = '', $queue = null) - { - $payload = parent::createPayload($job, $data); - - $payload = $this->setMeta($payload, 'id', $this->getRandomId()); - - return $this->setMeta($payload, 'attempts', 1); - } - - /** - * Get a random ID string. - * - * @return string - */ - protected function getRandomId() - { - return str_random(32); - } - - /** - * Get the queue or return the default. - * - * @param string|null $queue - * @return string - */ - protected function getQueue($queue) - { - return 'queues:'.($queue ?: $this->default); - } - - /** - * Get the connection for the queue. - * - * @return \Predis\ClientInterface - */ - protected function getConnection() - { - return $this->redis->connection($this->connection); - } - - /** - * Get the underlying Redis instance. - * - * @return \Illuminate\Redis\Database - */ - public function getRedis() - { - return $this->redis; - } - - /** - * Get the expiration time in seconds. - * - * @return int|null - */ - public function getExpire() - { - return $this->expire; - } - - /** - * Set the expiration time in seconds. - * - * @param int|null $seconds - * @return void - */ - public function setExpire($seconds) - { - $this->expire = $seconds; - } - +class RedisQueue extends Queue implements QueueContract +{ + /** + * The Redis database instance. + * + * @var \Illuminate\Redis\Database + */ + protected $redis; + + /** + * The connection name. + * + * @var string + */ + protected $connection; + + /** + * The name of the default queue. + * + * @var string + */ + protected $default; + + /** + * The expiration time of a job. + * + * @var int|null + */ + protected $expire = 60; + + /** + * Create a new Redis queue instance. + * + * @param \Illuminate\Redis\Database $redis + * @param string $default + * @param string $connection + * @return void + */ + public function __construct(Database $redis, $default = 'default', $connection = null) + { + $this->redis = $redis; + $this->default = $default; + $this->connection = $connection; + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + return $this->pushRaw($this->createPayload($job, $data), $queue); + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + $this->getConnection()->rpush($this->getQueue($queue), $payload); + + return Arr::get(json_decode($payload, true), 'id'); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTime|int $delay + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + $payload = $this->createPayload($job, $data); + + $delay = $this->getSeconds($delay); + + $this->getConnection()->zadd($this->getQueue($queue).':delayed', $this->getTime() + $delay, $payload); + + return Arr::get(json_decode($payload, true), 'id'); + } + + /** + * Release a reserved job back onto the queue. + * + * @param string $queue + * @param string $payload + * @param int $delay + * @param int $attempts + * @return void + */ + public function release($queue, $payload, $delay, $attempts) + { + $payload = $this->setMeta($payload, 'attempts', $attempts); + + $this->getConnection()->zadd($this->getQueue($queue).':delayed', $this->getTime() + $delay, $payload); + } + + /** + * Pop the next job off of the queue. + * + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + $original = $queue ?: $this->default; + + $queue = $this->getQueue($queue); + + if (! is_null($this->expire)) { + $this->migrateAllExpiredJobs($queue); + } + + $job = $this->getConnection()->lpop($queue); + + if (! is_null($job)) { + $this->getConnection()->zadd($queue.':reserved', $this->getTime() + $this->expire, $job); + + return new RedisJob($this->container, $this, $job, $original); + } + } + + /** + * Delete a reserved job from the queue. + * + * @param string $queue + * @param string $job + * @return void + */ + public function deleteReserved($queue, $job) + { + $this->getConnection()->zrem($this->getQueue($queue).':reserved', $job); + } + + /** + * Migrate all of the waiting jobs in the queue. + * + * @param string $queue + * @return void + */ + protected function migrateAllExpiredJobs($queue) + { + $this->migrateExpiredJobs($queue.':delayed', $queue); + + $this->migrateExpiredJobs($queue.':reserved', $queue); + } + + /** + * Migrate the delayed jobs that are ready to the regular queue. + * + * @param string $from + * @param string $to + * @return void + */ + public function migrateExpiredJobs($from, $to) + { + $options = ['cas' => true, 'watch' => $from, 'retry' => 10]; + + $this->getConnection()->transaction($options, function ($transaction) use ($from, $to) { + // First we need to get all of jobs that have expired based on the current time + // so that we can push them onto the main queue. After we get them we simply + // remove them from this "delay" queues. All of this within a transaction. + $jobs = $this->getExpiredJobs( + $transaction, $from, $time = $this->getTime() + ); + + // If we actually found any jobs, we will remove them from the old queue and we + // will insert them onto the new (ready) "queue". This means they will stand + // ready to be processed by the queue worker whenever their turn comes up. + if (count($jobs) > 0) { + $this->removeExpiredJobs($transaction, $from, $time); + + $this->pushExpiredJobsOntoNewQueue($transaction, $to, $jobs); + } + }); + } + + /** + * Get the expired jobs from a given queue. + * + * @param \Predis\Transaction\MultiExec $transaction + * @param string $from + * @param int $time + * @return array + */ + protected function getExpiredJobs($transaction, $from, $time) + { + return $transaction->zrangebyscore($from, '-inf', $time); + } + + /** + * Remove the expired jobs from a given queue. + * + * @param \Predis\Transaction\MultiExec $transaction + * @param string $from + * @param int $time + * @return void + */ + protected function removeExpiredJobs($transaction, $from, $time) + { + $transaction->multi(); + + $transaction->zremrangebyscore($from, '-inf', $time); + } + + /** + * Push all of the given jobs onto another queue. + * + * @param \Predis\Transaction\MultiExec $transaction + * @param string $to + * @param array $jobs + * @return void + */ + protected function pushExpiredJobsOntoNewQueue($transaction, $to, $jobs) + { + call_user_func_array([$transaction, 'rpush'], array_merge([$to], $jobs)); + } + + /** + * Create a payload string from the given job and data. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @return string + */ + protected function createPayload($job, $data = '', $queue = null) + { + $payload = parent::createPayload($job, $data); + + $payload = $this->setMeta($payload, 'id', $this->getRandomId()); + + return $this->setMeta($payload, 'attempts', 1); + } + + /** + * Get a random ID string. + * + * @return string + */ + protected function getRandomId() + { + return Str::random(32); + } + + /** + * Get the queue or return the default. + * + * @param string|null $queue + * @return string + */ + protected function getQueue($queue) + { + return 'queues:'.($queue ?: $this->default); + } + + /** + * Get the connection for the queue. + * + * @return \Predis\ClientInterface + */ + protected function getConnection() + { + return $this->redis->connection($this->connection); + } + + /** + * Get the underlying Redis instance. + * + * @return \Illuminate\Redis\Database + */ + public function getRedis() + { + return $this->redis; + } + + /** + * Get the expiration time in seconds. + * + * @return int|null + */ + public function getExpire() + { + return $this->expire; + } + + /** + * Set the expiration time in seconds. + * + * @param int|null $seconds + * @return void + */ + public function setExpire($seconds) + { + $this->expire = $seconds; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php b/application/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php index 4d40354..9ad9cf7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php @@ -1,81 +1,83 @@ -getProperties(); - - foreach ($properties as $property) - { - $property->setValue($this, $this->getSerializedPropertyValue( - $this->getPropertyValue($property) - )); - } +trait SerializesModels +{ + /** + * Prepare the instance for serialization. + * + * @return array + */ + public function __sleep() + { + $properties = (new ReflectionClass($this))->getProperties(); - return array_map(function($p) { return $p->getName(); }, $properties); - } + foreach ($properties as $property) { + $property->setValue($this, $this->getSerializedPropertyValue( + $this->getPropertyValue($property) + )); + } - /** - * Restore the model after serialization. - * - * @return void - */ - public function __wakeup() - { - foreach ((new ReflectionClass($this))->getProperties() as $property) - { - $property->setValue($this, $this->getRestoredPropertyValue( - $this->getPropertyValue($property) - )); - } - } + return array_map(function ($p) { + return $p->getName(); + }, $properties); + } - /** - * Get the property value prepared for serialization. - * - * @param mixed $value - * @return mixed - */ - protected function getSerializedPropertyValue($value) - { - return $value instanceof QueueableEntity - ? new ModelIdentifier(get_class($value), $value->getQueueableId()) : $value; - } + /** + * Restore the model after serialization. + * + * @return void + */ + public function __wakeup() + { + foreach ((new ReflectionClass($this))->getProperties() as $property) { + $property->setValue($this, $this->getRestoredPropertyValue( + $this->getPropertyValue($property) + )); + } + } - /** - * Get the restored property value after deserialization. - * - * @param mixed $value - * @return mixed - */ - protected function getRestoredPropertyValue($value) - { - return $value instanceof ModelIdentifier - ? (new $value->class)->findOrFail($value->id) : $value; - } + /** + * Get the property value prepared for serialization. + * + * @param mixed $value + * @return mixed + */ + protected function getSerializedPropertyValue($value) + { + return $value instanceof QueueableEntity + ? new ModelIdentifier(get_class($value), $value->getQueueableId()) : $value; + } - /** - * Get the property value for the given property. - * - * @param \ReflectionProperty $property - * @return mixed - */ - protected function getPropertyValue(ReflectionProperty $property) - { - $property->setAccessible(true); + /** + * Get the restored property value after deserialization. + * + * @param mixed $value + * @return mixed + */ + protected function getRestoredPropertyValue($value) + { + return $value instanceof ModelIdentifier + ? (new $value->class)->newQuery()->useWritePdo()->findOrFail($value->id) + : $value; + } - return $property->getValue($this); - } + /** + * Get the property value for the given property. + * + * @param \ReflectionProperty $property + * @return mixed + */ + protected function getPropertyValue(ReflectionProperty $property) + { + $property->setAccessible(true); + return $property->getValue($this); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/SqsQueue.php b/application/vendor/laravel/framework/src/Illuminate/Queue/SqsQueue.php index 7bfd5d7..77609d1 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/SqsQueue.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/SqsQueue.php @@ -1,127 +1,165 @@ -sqs = $sqs; - $this->default = $default; - } - - /** - * Push a new job onto the queue. - * - * @param string $job - * @param mixed $data - * @param string $queue - * @return mixed - */ - public function push($job, $data = '', $queue = null) - { - return $this->pushRaw($this->createPayload($job, $data), $queue); - } - - /** - * Push a raw payload onto the queue. - * - * @param string $payload - * @param string $queue - * @param array $options - * @return mixed - */ - public function pushRaw($payload, $queue = null, array $options = array()) - { - $response = $this->sqs->sendMessage(array('QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload)); - - return $response->get('MessageId'); - } - - /** - * Push a new job onto the queue after a delay. - * - * @param \DateTime|int $delay - * @param string $job - * @param mixed $data - * @param string $queue - * @return mixed - */ - public function later($delay, $job, $data = '', $queue = null) - { - $payload = $this->createPayload($job, $data); - - $delay = $this->getSeconds($delay); - - return $this->sqs->sendMessage(array( - - 'QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload, 'DelaySeconds' => $delay, - - ))->get('MessageId'); - } - - /** - * Pop the next job off of the queue. - * - * @param string $queue - * @return \Illuminate\Contracts\Queue\Job|null - */ - public function pop($queue = null) - { - $queue = $this->getQueue($queue); - - $response = $this->sqs->receiveMessage( - array('QueueUrl' => $queue, 'AttributeNames' => array('ApproximateReceiveCount')) - ); - - if (count($response['Messages']) > 0) - { - return new SqsJob($this->container, $this->sqs, $queue, $response['Messages'][0]); - } - } - - /** - * Get the queue or return the default. - * - * @param string|null $queue - * @return string - */ - public function getQueue($queue) - { - return $queue ?: $this->default; - } - - /** - * Get the underlying SQS instance. - * - * @return \Aws\Sqs\SqsClient - */ - public function getSqs() - { - return $this->sqs; - } - +class SqsQueue extends Queue implements QueueContract +{ + /** + * The Amazon SQS instance. + * + * @var \Aws\Sqs\SqsClient + */ + protected $sqs; + + /** + * The name of the default tube. + * + * @var string + */ + protected $default; + + /** + * The sqs prefix url. + * + * @var string + */ + protected $prefix; + + /** + * The job creator callback. + * + * @var callable|null + */ + protected $jobCreator; + + /** + * Create a new Amazon SQS queue instance. + * + * @param \Aws\Sqs\SqsClient $sqs + * @param string $default + * @param string $prefix + * @return void + */ + public function __construct(SqsClient $sqs, $default, $prefix = '') + { + $this->sqs = $sqs; + $this->prefix = $prefix; + $this->default = $default; + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + return $this->pushRaw($this->createPayload($job, $data), $queue); + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + $response = $this->sqs->sendMessage(['QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload]); + + return $response->get('MessageId'); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTime|int $delay + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + $payload = $this->createPayload($job, $data); + + $delay = $this->getSeconds($delay); + + return $this->sqs->sendMessage([ + 'QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload, 'DelaySeconds' => $delay, + + ])->get('MessageId'); + } + + /** + * Pop the next job off of the queue. + * + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + $queue = $this->getQueue($queue); + + $response = $this->sqs->receiveMessage( + ['QueueUrl' => $queue, 'AttributeNames' => ['ApproximateReceiveCount']] + ); + + if (count($response['Messages']) > 0) { + if ($this->jobCreator) { + return call_user_func($this->jobCreator, $this->container, $this->sqs, $queue, $response); + } else { + return new SqsJob($this->container, $this->sqs, $queue, $response['Messages'][0]); + } + } + } + + /** + * Define the job creator callback for the connection. + * + * @param callable $callback + * @return $this + */ + public function createJobsUsing(callable $callback) + { + $this->jobCreator = $callback; + + return $this; + } + + /** + * Get the queue or return the default. + * + * @param string|null $queue + * @return string + */ + public function getQueue($queue) + { + $queue = $queue ?: $this->default; + + if (filter_var($queue, FILTER_VALIDATE_URL) !== false) { + return $queue; + } + + return rtrim($this->prefix, '/').'/'.($queue); + } + + /** + * Get the underlying SQS instance. + * + * @return \Aws\Sqs\SqsClient + */ + public function getSqs() + { + return $this->sqs; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php b/application/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php index ec01db7..36516db 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php @@ -1,115 +1,135 @@ -resolveJob($this->createPayload($job, $data, $queue)); - - try - { - $queueJob->fire(); - } - catch(Exception $e) - { - $this->handleFailedJob($queueJob); - - throw $e; - } - - return 0; - } - - /** - * Push a raw payload onto the queue. - * - * @param string $payload - * @param string $queue - * @param array $options - * @return mixed - */ - public function pushRaw($payload, $queue = null, array $options = array()) - { - // - } - - /** - * Push a new job onto the queue after a delay. - * - * @param \DateTime|int $delay - * @param string $job - * @param mixed $data - * @param string $queue - * @return mixed - */ - public function later($delay, $job, $data = '', $queue = null) - { - return $this->push($job, $data, $queue); - } - - /** - * Pop the next job off of the queue. - * - * @param string $queue - * @return \Illuminate\Contracts\Queue\Job|null - */ - public function pop($queue = null) - { - // - } - - /** - * Resolve a Sync job instance. - * - * @param string $payload - * @return \Illuminate\Queue\Jobs\SyncJob - */ - protected function resolveJob($payload) - { - return new SyncJob($this->container, $payload); - } - - /** - * Handle the failed job - * - * @param \Illuminate\Contracts\Queue\Job $job - * @return array - */ - protected function handleFailedJob(Job $job) - { - $job->failed(); - - $this->raiseFailedJobEvent($job); - } - - /** - * Raise the failed queue job event. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @return void - */ - protected function raiseFailedJobEvent(Job $job) - { - $data = json_decode($job->getRawBody(), true); - - if($this->container->bound('events')) - { - $this->container['events']->fire('illuminate.queue.failed', array('sync', $job, $data)); - } - } +class SyncQueue extends Queue implements QueueContract +{ + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + * @throws \Throwable + */ + public function push($job, $data = '', $queue = null) + { + $queueJob = $this->resolveJob($this->createPayload($job, $data, $queue), $queue); + + try { + $queueJob->fire(); + + $this->raiseAfterJobEvent($queueJob); + } catch (Exception $e) { + $this->handleFailedJob($queueJob); + + throw $e; + } catch (Throwable $e) { + $this->handleFailedJob($queueJob); + + throw $e; + } + + return 0; + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + // + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTime|int $delay + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + return $this->push($job, $data, $queue); + } + + /** + * Pop the next job off of the queue. + * + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + // + } + + /** + * Resolve a Sync job instance. + * + * @param string $payload + * @param string $queue + * @return \Illuminate\Queue\Jobs\SyncJob + */ + protected function resolveJob($payload, $queue) + { + return new SyncJob($this->container, $payload, $queue); + } + + /** + * Raise the after queue job event. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @return void + */ + protected function raiseAfterJobEvent(Job $job) + { + $data = json_decode($job->getRawBody(), true); + + if ($this->container->bound('events')) { + $this->container['events']->fire('illuminate.queue.after', ['sync', $job, $data]); + } + } + + /** + * Handle the failed job. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @return array + */ + protected function handleFailedJob(Job $job) + { + $job->failed(); + + $this->raiseFailedJobEvent($job); + } + + /** + * Raise the failed queue job event. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @return void + */ + protected function raiseFailedJobEvent(Job $job) + { + $data = json_decode($job->getRawBody(), true); + if ($this->container->bound('events')) { + $this->container['events']->fire('illuminate.queue.failed', ['sync', $job, $data]); + } + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php b/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php index c1ffdc1..47bfc09 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php @@ -1,364 +1,394 @@ -failer = $failer; - $this->events = $events; - $this->manager = $manager; - } - - /** - * Listen to the given queue in a loop. - * - * @param string $connectionName - * @param string $queue - * @param int $delay - * @param int $memory - * @param int $sleep - * @param int $maxTries - * @return array - */ - public function daemon($connectionName, $queue = null, $delay = 0, $memory = 128, $sleep = 3, $maxTries = 0) - { - $lastRestart = $this->getTimestampOfLastQueueRestart(); - - while (true) - { - if ($this->daemonShouldRun()) - { - $this->runNextJobForDaemon( - $connectionName, $queue, $delay, $sleep, $maxTries - ); - } - else - { - $this->sleep($sleep); - } - - if ($this->memoryExceeded($memory) || $this->queueShouldRestart($lastRestart)) - { - $this->stop(); - } - } - } - - /** - * Run the next job for the daemon worker. - * - * @param string $connectionName - * @param string $queue - * @param int $delay - * @param int $sleep - * @param int $maxTries - * @return void - */ - protected function runNextJobForDaemon($connectionName, $queue, $delay, $sleep, $maxTries) - { - try - { - $this->pop($connectionName, $queue, $delay, $sleep, $maxTries); - } - catch (Exception $e) - { - if ($this->exceptions) $this->exceptions->report($e); - } - } - - /** - * Determine if the daemon should process on this iteration. - * - * @return bool - */ - protected function daemonShouldRun() - { - if ($this->manager->isDownForMaintenance()) - { - return false; - } - - return $this->events->until('illuminate.queue.looping') !== false; - } - - /** - * Listen to the given queue. - * - * @param string $connectionName - * @param string $queue - * @param int $delay - * @param int $sleep - * @param int $maxTries - * @return array - */ - public function pop($connectionName, $queue = null, $delay = 0, $sleep = 3, $maxTries = 0) - { - $connection = $this->manager->connection($connectionName); - - $job = $this->getNextJob($connection, $queue); - - // If we're able to pull a job off of the stack, we will process it and - // then immediately return back out. If there is no job on the queue - // we will "sleep" the worker for the specified number of seconds. - if ( ! is_null($job)) - { - return $this->process( - $this->manager->getName($connectionName), $job, $maxTries, $delay - ); - } - - $this->sleep($sleep); - - return ['job' => null, 'failed' => false]; - } - - /** - * Get the next job from the queue connection. - * - * @param \Illuminate\Queue\Queue $connection - * @param string $queue - * @return \Illuminate\Contracts\Queue\Job|null - */ - protected function getNextJob($connection, $queue) - { - if (is_null($queue)) return $connection->pop(); - - foreach (explode(',', $queue) as $queue) - { - if ( ! is_null($job = $connection->pop($queue))) return $job; - } - } - - /** - * Process a given job from the queue. - * - * @param string $connection - * @param \Illuminate\Contracts\Queue\Job $job - * @param int $maxTries - * @param int $delay - * @return void - * - * @throws \Exception - */ - public function process($connection, Job $job, $maxTries = 0, $delay = 0) - { - if ($maxTries > 0 && $job->attempts() > $maxTries) - { - return $this->logFailedJob($connection, $job); - } - - try - { - // First we will fire off the job. Once it is done we will see if it will - // be auto-deleted after processing and if so we will go ahead and run - // the delete method on the job. Otherwise we will just keep moving. - $job->fire(); - - return ['job' => $job, 'failed' => false]; - } - - catch (Exception $e) - { - // If we catch an exception, we will attempt to release the job back onto - // the queue so it is not lost. This will let is be retried at a later - // time by another listener (or the same one). We will do that here. - if ( ! $job->isDeleted()) $job->release($delay); - - throw $e; - } - } - - /** - * Log a failed job into storage. - * - * @param string $connection - * @param \Illuminate\Contracts\Queue\Job $job - * @return array - */ - protected function logFailedJob($connection, Job $job) - { - if ($this->failer) - { - $this->failer->log($connection, $job->getQueue(), $job->getRawBody()); - - $job->delete(); - - $job->failed(); - - $this->raiseFailedJobEvent($connection, $job); - } - - return ['job' => $job, 'failed' => true]; - } - - /** - * Raise the failed queue job event. - * - * @param string $connection - * @param \Illuminate\Contracts\Queue\Job $job - * @return void - */ - protected function raiseFailedJobEvent($connection, Job $job) - { - if ($this->events) - { - $data = json_decode($job->getRawBody(), true); - - $this->events->fire('illuminate.queue.failed', array($connection, $job, $data)); - } - } - - /** - * Determine if the memory limit has been exceeded. - * - * @param int $memoryLimit - * @return bool - */ - public function memoryExceeded($memoryLimit) - { - return (memory_get_usage() / 1024 / 1024) >= $memoryLimit; - } - - /** - * Stop listening and bail out of the script. - * - * @return void - */ - public function stop() - { - $this->events->fire('illuminate.queue.stopping'); - - die; - } - - /** - * Sleep the script for a given number of seconds. - * - * @param int $seconds - * @return void - */ - public function sleep($seconds) - { - sleep($seconds); - } - - /** - * Get the last queue restart timestamp, or null. - * - * @return int|null - */ - protected function getTimestampOfLastQueueRestart() - { - if ($this->cache) - { - return $this->cache->get('illuminate:queue:restart'); - } - } - - /** - * Determine if the queue worker should restart. - * - * @param int|null $lastRestart - * @return bool - */ - protected function queueShouldRestart($lastRestart) - { - return $this->getTimestampOfLastQueueRestart() != $lastRestart; - } - - /** - * Set the exception handler to use in Daemon mode. - * - * @param \Illuminate\Contracts\Debug\ExceptionHandler $handler - * @return void - */ - public function setDaemonExceptionHandler(ExceptionHandler $handler) - { - $this->exceptions = $handler; - } - - /** - * Set the cache repository implementation. - * - * @param \Illuminate\Contracts\Cache\Repository $cache - * @return void - */ - public function setCache(CacheContract $cache) - { - $this->cache = $cache; - } - - /** - * Get the queue manager instance. - * - * @return \Illuminate\Queue\QueueManager - */ - public function getManager() - { - return $this->manager; - } - - /** - * Set the queue manager instance. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - public function setManager(QueueManager $manager) - { - $this->manager = $manager; - } - + { + $this->failer = $failer; + $this->events = $events; + $this->manager = $manager; + } + + /** + * Listen to the given queue in a loop. + * + * @param string $connectionName + * @param string $queue + * @param int $delay + * @param int $memory + * @param int $sleep + * @param int $maxTries + * @return array + */ + public function daemon($connectionName, $queue = null, $delay = 0, $memory = 128, $sleep = 3, $maxTries = 0) + { + $lastRestart = $this->getTimestampOfLastQueueRestart(); + + while (true) { + if ($this->daemonShouldRun()) { + $this->runNextJobForDaemon( + $connectionName, $queue, $delay, $sleep, $maxTries + ); + } else { + $this->sleep($sleep); + } + + if ($this->memoryExceeded($memory) || $this->queueShouldRestart($lastRestart)) { + $this->stop(); + } + } + } + + /** + * Run the next job for the daemon worker. + * + * @param string $connectionName + * @param string $queue + * @param int $delay + * @param int $sleep + * @param int $maxTries + * @return void + */ + protected function runNextJobForDaemon($connectionName, $queue, $delay, $sleep, $maxTries) + { + try { + $this->pop($connectionName, $queue, $delay, $sleep, $maxTries); + } catch (Exception $e) { + if ($this->exceptions) { + $this->exceptions->report($e); + } + } catch (Throwable $e) { + if ($this->exceptions) { + $this->exceptions->report(new FatalThrowableError($e)); + } + } + } + + /** + * Determine if the daemon should process on this iteration. + * + * @return bool + */ + protected function daemonShouldRun() + { + if ($this->manager->isDownForMaintenance()) { + return false; + } + + return $this->events->until('illuminate.queue.looping') !== false; + } + + /** + * Listen to the given queue. + * + * @param string $connectionName + * @param string $queue + * @param int $delay + * @param int $sleep + * @param int $maxTries + * @return array + */ + public function pop($connectionName, $queue = null, $delay = 0, $sleep = 3, $maxTries = 0) + { + try { + $connection = $this->manager->connection($connectionName); + + $job = $this->getNextJob($connection, $queue); + + // If we're able to pull a job off of the stack, we will process it and + // then immediately return back out. If there is no job on the queue + // we will "sleep" the worker for the specified number of seconds. + if (! is_null($job)) { + return $this->process( + $this->manager->getName($connectionName), $job, $maxTries, $delay + ); + } + } catch (Exception $e) { + if ($this->exceptions) { + $this->exceptions->report($e); + } + } catch (Throwable $e) { + if ($this->exceptions) { + $this->exceptions->report(new FatalThrowableError($e)); + } + } + + $this->sleep($sleep); + + return ['job' => null, 'failed' => false]; + } + + /** + * Get the next job from the queue connection. + * + * @param \Illuminate\Contracts\Queue\Queue $connection + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + protected function getNextJob($connection, $queue) + { + if (is_null($queue)) { + return $connection->pop(); + } + + foreach (explode(',', $queue) as $queue) { + if (! is_null($job = $connection->pop($queue))) { + return $job; + } + } + } + + /** + * Process a given job from the queue. + * + * @param string $connection + * @param \Illuminate\Contracts\Queue\Job $job + * @param int $maxTries + * @param int $delay + * @return array|null + * + * @throws \Throwable + */ + public function process($connection, Job $job, $maxTries = 0, $delay = 0) + { + if ($maxTries > 0 && $job->attempts() > $maxTries) { + return $this->logFailedJob($connection, $job); + } + + try { + // First we will fire off the job. Once it is done we will see if it will + // be auto-deleted after processing and if so we will go ahead and run + // the delete method on the job. Otherwise we will just keep moving. + $job->fire(); + + $this->raiseAfterJobEvent($connection, $job); + + return ['job' => $job, 'failed' => false]; + } catch (Exception $e) { + // If we catch an exception, we will attempt to release the job back onto + // the queue so it is not lost. This will let is be retried at a later + // time by another listener (or the same one). We will do that here. + if (! $job->isDeleted()) { + $job->release($delay); + } + + throw $e; + } catch (Throwable $e) { + if (! $job->isDeleted()) { + $job->release($delay); + } + + throw $e; + } + } + + /** + * Raise the after queue job event. + * + * @param string $connection + * @param \Illuminate\Contracts\Queue\Job $job + * @return void + */ + protected function raiseAfterJobEvent($connection, Job $job) + { + if ($this->events) { + $data = json_decode($job->getRawBody(), true); + + $this->events->fire('illuminate.queue.after', [$connection, $job, $data]); + } + } + + /** + * Log a failed job into storage. + * + * @param string $connection + * @param \Illuminate\Contracts\Queue\Job $job + * @return array + */ + protected function logFailedJob($connection, Job $job) + { + if ($this->failer) { + $this->failer->log($connection, $job->getQueue(), $job->getRawBody()); + + $job->delete(); + + $job->failed(); + + $this->raiseFailedJobEvent($connection, $job); + } + + return ['job' => $job, 'failed' => true]; + } + + /** + * Raise the failed queue job event. + * + * @param string $connection + * @param \Illuminate\Contracts\Queue\Job $job + * @return void + */ + protected function raiseFailedJobEvent($connection, Job $job) + { + if ($this->events) { + $data = json_decode($job->getRawBody(), true); + + $this->events->fire('illuminate.queue.failed', [$connection, $job, $data]); + } + } + + /** + * Determine if the memory limit has been exceeded. + * + * @param int $memoryLimit + * @return bool + */ + public function memoryExceeded($memoryLimit) + { + return (memory_get_usage() / 1024 / 1024) >= $memoryLimit; + } + + /** + * Stop listening and bail out of the script. + * + * @return void + */ + public function stop() + { + $this->events->fire('illuminate.queue.stopping'); + + die; + } + + /** + * Sleep the script for a given number of seconds. + * + * @param int $seconds + * @return void + */ + public function sleep($seconds) + { + sleep($seconds); + } + + /** + * Get the last queue restart timestamp, or null. + * + * @return int|null + */ + protected function getTimestampOfLastQueueRestart() + { + if ($this->cache) { + return $this->cache->get('illuminate:queue:restart'); + } + } + + /** + * Determine if the queue worker should restart. + * + * @param int|null $lastRestart + * @return bool + */ + protected function queueShouldRestart($lastRestart) + { + return $this->getTimestampOfLastQueueRestart() != $lastRestart; + } + + /** + * Set the exception handler to use in Daemon mode. + * + * @param \Illuminate\Contracts\Debug\ExceptionHandler $handler + * @return void + */ + public function setDaemonExceptionHandler(ExceptionHandler $handler) + { + $this->exceptions = $handler; + } + + /** + * Set the cache repository implementation. + * + * @param \Illuminate\Contracts\Cache\Repository $cache + * @return void + */ + public function setCache(CacheContract $cache) + { + $this->cache = $cache; + } + + /** + * Get the queue manager instance. + * + * @return \Illuminate\Queue\QueueManager + */ + public function getManager() + { + return $this->manager; + } + + /** + * Set the queue manager instance. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + public function setManager(QueueManager $manager) + { + $this->manager = $manager; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Queue/composer.json b/application/vendor/laravel/framework/src/Illuminate/Queue/composer.json index 99c4a0d..84f2edd 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Queue/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Queue/composer.json @@ -14,14 +14,15 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/console": "5.0.*", - "illuminate/contracts": "5.0.*", - "illuminate/container": "5.0.*", - "illuminate/http": "5.0.*", - "illuminate/support": "5.0.*", - "symfony/process": "2.6.*", - "nesbot/carbon": "~1.0" + "php": ">=5.5.9", + "illuminate/console": "5.1.*", + "illuminate/contracts": "5.1.*", + "illuminate/container": "5.1.*", + "illuminate/http": "5.1.*", + "illuminate/support": "5.1.*", + "symfony/process": "2.7.*", + "symfony/debug": "2.7.*", + "nesbot/carbon": "~1.19" }, "autoload": { "psr-4": { @@ -33,13 +34,13 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "suggest": { - "aws/aws-sdk-php": "Required to use the SQS queue driver (~2.4).", - "illuminate/redis": "Required to use the redis queue driver (5.0.*).", - "iron-io/iron_mq": "Required to use the iron queue driver (~1.5).", + "aws/aws-sdk-php": "Required to use the SQS queue driver (~3.0).", + "illuminate/redis": "Required to use the redis queue driver (5.1.*).", + "iron-io/iron_mq": "Required to use the iron queue driver (~2.0).", "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0)." }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Redis/Database.php b/application/vendor/laravel/framework/src/Illuminate/Redis/Database.php index 2f9dc87..437427b 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Redis/Database.php +++ b/application/vendor/laravel/framework/src/Illuminate/Redis/Database.php @@ -1,138 +1,139 @@ -clients = $this->createAggregateClient($servers); - } - else - { - $this->clients = $this->createSingleClients($servers); - } - } - - /** - * Create a new aggregate client supporting sharding. - * - * @param array $servers - * @return array - */ - protected function createAggregateClient(array $servers) - { - $servers = array_except($servers, array('cluster')); - - $options = $this->getClientOptions($servers); - - return array('default' => new Client(array_values($servers), $options)); - } - - /** - * Create an array of single connection clients. - * - * @param array $servers - * @return array - */ - protected function createSingleClients(array $servers) - { - $clients = array(); - - $options = $this->getClientOptions($servers); - - foreach ($servers as $key => $server) - { - $clients[$key] = new Client($server, $options); - } - - return $clients; - } - - /** - * Get any client options from the configuration array. - * - * @param array $servers - * @return array - */ - protected function getClientOptions(array $servers) - { - return isset($servers['options']) ? (array) $servers['options'] : []; - } - - /** - * Get a specific Redis connection instance. - * - * @param string $name - * @return \Predis\ClientInterface - */ - public function connection($name = 'default') - { - return $this->clients[$name ?: 'default']; - } - - /** - * Run a command against the Redis database. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function command($method, array $parameters = array()) - { - return call_user_func_array(array($this->clients['default'], $method), $parameters); - } - - /** - * Subscribe to a set of given channels for messages. - * - * @param array|string $channels - * @param \Closure $callback - * @param string $connection - * @return void - */ - public function subscribe($channels, Closure $callback, $connection = null) - { - $loop = $this->connection($connection)->pubSubLoop(); - - call_user_func_array([$loop, 'subscribe'], (array) $channels); - - foreach ($loop as $message) { - if ($message->kind === 'message') { - call_user_func($callback, $message->payload, $message->channel); - } - } - - unset($loop); - } - - /** - * Dynamically make a Redis command. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->command($method, $parameters); - } - +class Database implements DatabaseContract +{ + /** + * The host address of the database. + * + * @var array + */ + protected $clients; + + /** + * Create a new Redis connection instance. + * + * @param array $servers + * @return void + */ + public function __construct(array $servers = []) + { + $cluster = Arr::pull($servers, 'cluster'); + + $options = (array) Arr::pull($servers, 'options'); + + if ($cluster) { + $this->clients = $this->createAggregateClient($servers, $options); + } else { + $this->clients = $this->createSingleClients($servers, $options); + } + } + + /** + * Create a new aggregate client supporting sharding. + * + * @param array $servers + * @param array $options + * @return array + */ + protected function createAggregateClient(array $servers, array $options = []) + { + return ['default' => new Client(array_values($servers), $options)]; + } + + /** + * Create an array of single connection clients. + * + * @param array $servers + * @param array $options + * @return array + */ + protected function createSingleClients(array $servers, array $options = []) + { + $clients = []; + + foreach ($servers as $key => $server) { + $clients[$key] = new Client($server, $options); + } + + return $clients; + } + + /** + * Get a specific Redis connection instance. + * + * @param string $name + * @return \Predis\ClientInterface|null + */ + public function connection($name = 'default') + { + return Arr::get($this->clients, $name ?: 'default'); + } + + /** + * Run a command against the Redis database. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function command($method, array $parameters = []) + { + return call_user_func_array([$this->clients['default'], $method], $parameters); + } + + /** + * Subscribe to a set of given channels for messages. + * + * @param array|string $channels + * @param \Closure $callback + * @param string $connection + * @param string $method + * @return void + */ + public function subscribe($channels, Closure $callback, $connection = null, $method = 'subscribe') + { + $loop = $this->connection($connection)->pubSubLoop(); + + call_user_func_array([$loop, $method], (array) $channels); + + foreach ($loop as $message) { + if ($message->kind === 'message' || $message->kind === 'pmessage') { + call_user_func($callback, $message->payload, $message->channel); + } + } + + unset($loop); + } + + /** + * Subscribe to a set of given channels with wildcards. + * + * @param array|string $channels + * @param \Closure $callback + * @param string $connection + * @return void + */ + public function psubscribe($channels, Closure $callback, $connection = null) + { + return $this->subscribe($channels, $callback, $connection, __FUNCTION__); + } + + /** + * Dynamically make a Redis command. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->command($method, $parameters); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Redis/RedisServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Redis/RedisServiceProvider.php index ae088b0..78e1cc1 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Redis/RedisServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Redis/RedisServiceProvider.php @@ -1,37 +1,37 @@ -app->singleton('redis', function($app) - { - return new Database($app['config']['database.redis']); - }); - } +class RedisServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array('redis'); - } + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton('redis', function ($app) { + return new Database($app['config']['database.redis']); + }); + } + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['redis']; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Redis/composer.json b/application/vendor/laravel/framework/src/Illuminate/Redis/composer.json index ed577c9..b78240b 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Redis/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Redis/composer.json @@ -14,9 +14,9 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*", + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*", "predis/predis": "~1.0" }, "autoload": { @@ -26,7 +26,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/Console/ControllerMakeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Routing/Console/ControllerMakeCommand.php index fd84c12..8ff71e8 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/Console/ControllerMakeCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/Console/ControllerMakeCommand.php @@ -1,67 +1,67 @@ -option('plain')) - { - return __DIR__.'/stubs/controller.plain.stub'; - } + /** + * The type of class being generated. + * + * @var string + */ + protected $type = 'Controller'; - return __DIR__.'/stubs/controller.stub'; - } + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + if ($this->option('plain')) { + return __DIR__.'/stubs/controller.plain.stub'; + } - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Http\Controllers'; - } + return __DIR__.'/stubs/controller.stub'; + } - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return array( - array('plain', null, InputOption::VALUE_NONE, 'Generate an empty controller class.'), - ); - } + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Http\Controllers'; + } + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['plain', null, InputOption::VALUE_NONE, 'Generate an empty controller class.'], + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php b/application/vendor/laravel/framework/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php index 2ccc620..e41813d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php @@ -1,49 +1,50 @@ -middleware[$middleware] = $options; - } - - /** - * Register a "before" filter on the controller. - * - * @param \Closure|string $filter - * @param array $options - * @return void - */ - public function beforeFilter($filter, array $options = array()) - { - $this->beforeFilters[] = $this->parseFilter($filter, $options); - } - - /** - * Register an "after" filter on the controller. - * - * @param \Closure|string $filter - * @param array $options - * @return void - */ - public function afterFilter($filter, array $options = array()) - { - $this->afterFilters[] = $this->parseFilter($filter, $options); - } - - /** - * Parse the given filter and options. - * - * @param \Closure|string $filter - * @param array $options - * @return array - */ - protected function parseFilter($filter, array $options) - { - $parameters = array(); - - $original = $filter; - - if ($filter instanceof Closure) - { - $filter = $this->registerClosureFilter($filter); - } - elseif ($this->isInstanceFilter($filter)) - { - $filter = $this->registerInstanceFilter($filter); - } - else - { - list($filter, $parameters) = Route::parseFilter($filter); - } - - return compact('original', 'filter', 'parameters', 'options'); - } - - /** - * Register an anonymous controller filter Closure. - * - * @param \Closure $filter - * @return string - */ - protected function registerClosureFilter(Closure $filter) - { - $this->getRouter()->filter($name = spl_object_hash($filter), $filter); - - return $name; - } - - /** - * Register a controller instance method as a filter. - * - * @param string $filter - * @return string - */ - protected function registerInstanceFilter($filter) - { - $this->getRouter()->filter($filter, array($this, substr($filter, 1))); - - return $filter; - } - - /** - * Determine if a filter is a local method on the controller. - * - * @param mixed $filter - * @return bool - * - * @throws \InvalidArgumentException - */ - protected function isInstanceFilter($filter) - { - if (is_string($filter) && starts_with($filter, '@')) - { - if (method_exists($this, substr($filter, 1))) return true; - - throw new InvalidArgumentException("Filter method [$filter] does not exist."); - } - - return false; - } - - /** - * Remove the given before filter. - * - * @param string $filter - * @return void - */ - public function forgetBeforeFilter($filter) - { - $this->beforeFilters = $this->removeFilter($filter, $this->getBeforeFilters()); - } - - /** - * Remove the given after filter. - * - * @param string $filter - * @return void - */ - public function forgetAfterFilter($filter) - { - $this->afterFilters = $this->removeFilter($filter, $this->getAfterFilters()); - } - - /** - * Remove the given controller filter from the provided filter array. - * - * @param string $removing - * @param array $current - * @return array - */ - protected function removeFilter($removing, $current) - { - return array_filter($current, function($filter) use ($removing) - { - return $filter['original'] != $removing; - }); - } - - /** - * Get the middleware assigned to the controller. - * - * @return array - */ - public function getMiddleware() - { - return $this->middleware; - } - - /** - * Get the registered "before" filters. - * - * @return array - */ - public function getBeforeFilters() - { - return $this->beforeFilters; - } - - /** - * Get the registered "after" filters. - * - * @return array - */ - public function getAfterFilters() - { - return $this->afterFilters; - } - - /** - * Get the router instance. - * - * @return \Illuminate\Routing\Router - */ - public static function getRouter() - { - return static::$router; - } - - /** - * Set the router instance. - * - * @param \Illuminate\Routing\Router $router - * @return void - */ - public static function setRouter(Router $router) - { - static::$router = $router; - } - - /** - * Execute an action on the controller. - * - * @param string $method - * @param array $parameters - * @return \Symfony\Component\HttpFoundation\Response - */ - public function callAction($method, $parameters) - { - return call_user_func_array(array($this, $method), $parameters); - } - - /** - * Handle calls to missing methods on the controller. - * - * @param array $parameters - * @return mixed - * - * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException - */ - public function missingMethod($parameters = array()) - { - throw new NotFoundHttpException("Controller method not found."); - } - - /** - * Handle calls to missing methods on the controller. - * - * @param string $method - * @param array $parameters - * @return mixed - * - * @throws \BadMethodCallException - */ - public function __call($method, $parameters) - { - throw new BadMethodCallException("Method [$method] does not exist."); - } - +abstract class Controller +{ + /** + * The middleware registered on the controller. + * + * @var array + */ + protected $middleware = []; + + /** + * The "before" filters registered on the controller. + * + * @var array + */ + protected $beforeFilters = []; + + /** + * The "after" filters registered on the controller. + * + * @var array + */ + protected $afterFilters = []; + + /** + * The router instance. + * + * @var \Illuminate\Routing\Router + */ + protected static $router; + + /** + * Register middleware on the controller. + * + * @param string $middleware + * @param array $options + * @return void + */ + public function middleware($middleware, array $options = []) + { + $this->middleware[$middleware] = $options; + } + + /** + * Register a "before" filter on the controller. + * + * @param \Closure|string $filter + * @param array $options + * @return void + * + * @deprecated since version 5.1. + */ + public function beforeFilter($filter, array $options = []) + { + $this->beforeFilters[] = $this->parseFilter($filter, $options); + } + + /** + * Register an "after" filter on the controller. + * + * @param \Closure|string $filter + * @param array $options + * @return void + * + * @deprecated since version 5.1. + */ + public function afterFilter($filter, array $options = []) + { + $this->afterFilters[] = $this->parseFilter($filter, $options); + } + + /** + * Parse the given filter and options. + * + * @param \Closure|string $filter + * @param array $options + * @return array + */ + protected function parseFilter($filter, array $options) + { + $parameters = []; + + $original = $filter; + + if ($filter instanceof Closure) { + $filter = $this->registerClosureFilter($filter); + } elseif ($this->isInstanceFilter($filter)) { + $filter = $this->registerInstanceFilter($filter); + } else { + list($filter, $parameters) = Route::parseFilter($filter); + } + + return compact('original', 'filter', 'parameters', 'options'); + } + + /** + * Register an anonymous controller filter Closure. + * + * @param \Closure $filter + * @return string + */ + protected function registerClosureFilter(Closure $filter) + { + $this->getRouter()->filter($name = spl_object_hash($filter), $filter); + + return $name; + } + + /** + * Register a controller instance method as a filter. + * + * @param string $filter + * @return string + */ + protected function registerInstanceFilter($filter) + { + $this->getRouter()->filter($filter, [$this, substr($filter, 1)]); + + return $filter; + } + + /** + * Determine if a filter is a local method on the controller. + * + * @param mixed $filter + * @return bool + * + * @throws \InvalidArgumentException + */ + protected function isInstanceFilter($filter) + { + if (is_string($filter) && Str::startsWith($filter, '@')) { + if (method_exists($this, substr($filter, 1))) { + return true; + } + + throw new InvalidArgumentException("Filter method [$filter] does not exist."); + } + + return false; + } + + /** + * Remove the given before filter. + * + * @param string $filter + * @return void + * + * @deprecated since version 5.1. + */ + public function forgetBeforeFilter($filter) + { + $this->beforeFilters = $this->removeFilter($filter, $this->getBeforeFilters()); + } + + /** + * Remove the given after filter. + * + * @param string $filter + * @return void + * + * @deprecated since version 5.1. + */ + public function forgetAfterFilter($filter) + { + $this->afterFilters = $this->removeFilter($filter, $this->getAfterFilters()); + } + + /** + * Remove the given controller filter from the provided filter array. + * + * @param string $removing + * @param array $current + * @return array + */ + protected function removeFilter($removing, $current) + { + return array_filter($current, function ($filter) use ($removing) { + return $filter['original'] != $removing; + }); + } + + /** + * Get the middleware assigned to the controller. + * + * @return array + */ + public function getMiddleware() + { + return $this->middleware; + } + + /** + * Get the registered "before" filters. + * + * @return array + * + * @deprecated since version 5.1. + */ + public function getBeforeFilters() + { + return $this->beforeFilters; + } + + /** + * Get the registered "after" filters. + * + * @return array + * + * @deprecated since version 5.1. + */ + public function getAfterFilters() + { + return $this->afterFilters; + } + + /** + * Get the router instance. + * + * @return \Illuminate\Routing\Router + */ + public static function getRouter() + { + return static::$router; + } + + /** + * Set the router instance. + * + * @param \Illuminate\Routing\Router $router + * @return void + */ + public static function setRouter(Router $router) + { + static::$router = $router; + } + + /** + * Execute an action on the controller. + * + * @param string $method + * @param array $parameters + * @return \Symfony\Component\HttpFoundation\Response + */ + public function callAction($method, $parameters) + { + return call_user_func_array([$this, $method], $parameters); + } + + /** + * Handle calls to missing methods on the controller. + * + * @param array $parameters + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + public function missingMethod($parameters = []) + { + throw new NotFoundHttpException('Controller method not found.'); + } + + /** + * Handle calls to missing methods on the controller. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + throw new BadMethodCallException("Method [$method] does not exist."); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php b/application/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php index 2923c5e..6482868 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php @@ -1,297 +1,300 @@ -router = $router; - $this->container = $container; - } - - /** - * Dispatch a request to a given controller and method. - * - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @param string $controller - * @param string $method - * @return mixed - */ - public function dispatch(Route $route, Request $request, $controller, $method) - { - // First we will make an instance of this controller via the IoC container instance - // so that we can call the methods on it. We will also apply any "after" filters - // to the route so that they will be run by the routers after this processing. - $instance = $this->makeController($controller); - - $this->assignAfter($instance, $route, $request, $method); - - $response = $this->before($instance, $route, $request, $method); - - // If no before filters returned a response we'll call the method on the controller - // to get the response to be returned to the router. We will then return it back - // out for processing by this router and the after filters can be called then. - if (is_null($response)) - { - $response = $this->callWithinStack( - $instance, $route, $request, $method - ); - } - - return $response; - } - - /** - * Make a controller instance via the IoC container. - * - * @param string $controller - * @return mixed - */ - protected function makeController($controller) - { - Controller::setRouter($this->router); - - return $this->container->make($controller); - } - - /** - * Call the given controller instance method. - * - * @param \Illuminate\Routing\Controller $instance - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @param string $method - * @return mixed - */ - protected function callWithinStack($instance, $route, $request, $method) - { - $middleware = $this->getMiddleware($instance, $method); - - // Here we will make a stack onion instance to execute this request in, which gives - // us the ability to define middlewares on controllers. We will return the given - // response back out so that "after" filters can be run after the middlewares. - return (new Pipeline($this->container)) - ->send($request) - ->through($middleware) - ->then(function($request) use ($instance, $route, $method) - { - return $this->call($instance, $route, $method); - }); - } - - /** - * Get the middleware for the controller instance. - * - * @param \Illuminate\Routing\Controller $instance - * @param string $method - * @return array - */ - protected function getMiddleware($instance, $method) - { - $middleware = $this->router->getMiddleware(); - - $results = []; - - foreach ($instance->getMiddleware() as $name => $options) - { - if ( ! $this->methodExcludedByOptions($method, $options)) - { - $results[] = array_get($middleware, $name, $name); - } - } - - return $results; - } - - /** - * Determine if the given options exclude a particular method. - * - * @param string $method - * @param array $options - * @return bool - */ - public function methodExcludedByOptions($method, array $options) - { - return ( ! empty($options['only']) && ! in_array($method, (array) $options['only'])) || - ( ! empty($options['except']) && in_array($method, (array) $options['except'])); - } - - /** - * Call the given controller instance method. - * - * @param \Illuminate\Routing\Controller $instance - * @param \Illuminate\Routing\Route $route - * @param string $method - * @return mixed - */ - protected function call($instance, $route, $method) - { - $parameters = $this->resolveClassMethodDependencies( - $route->parametersWithoutNulls(), $instance, $method - ); - - return $instance->callAction($method, $parameters); - } - - /** - * Call the "before" filters for the controller. - * - * @param \Illuminate\Routing\Controller $instance - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @param string $method - * @return mixed - */ - protected function before($instance, $route, $request, $method) - { - foreach ($instance->getBeforeFilters() as $filter) - { - if ($this->filterApplies($filter, $request, $method)) - { - // Here we will just check if the filter applies. If it does we will call the filter - // and return the responses if it isn't null. If it is null, we will keep hitting - // them until we get a response or are finished iterating through this filters. - $response = $this->callFilter($filter, $route, $request); - - if ( ! is_null($response)) return $response; - } - } - } - - /** - * Apply the applicable after filters to the route. - * - * @param \Illuminate\Routing\Controller $instance - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @param string $method - * @return mixed - */ - protected function assignAfter($instance, $route, $request, $method) - { - foreach ($instance->getAfterFilters() as $filter) - { - // If the filter applies, we will add it to the route, since it has already been - // registered with the router by the controller, and will just let the normal - // router take care of calling these filters so we do not duplicate logics. - if ($this->filterApplies($filter, $request, $method)) - { - $route->after($this->getAssignableAfter($filter)); - } - } - } - - /** - * Get the assignable after filter for the route. - * - * @param \Closure|string $filter - * @return string - */ - protected function getAssignableAfter($filter) - { - if ($filter['original'] instanceof Closure) return $filter['filter']; - - return $filter['original']; - } - - /** - * Determine if the given filter applies to the request. - * - * @param array $filter - * @param \Illuminate\Http\Request $request - * @param string $method - * @return bool - */ - protected function filterApplies($filter, $request, $method) - { - foreach (array('Method', 'On') as $type) - { - if ($this->{"filterFails{$type}"}($filter, $request, $method)) - { - return false; - } - } - - return true; - } - - /** - * Determine if the filter fails the method constraints. - * - * @param array $filter - * @param \Illuminate\Http\Request $request - * @param string $method - * @return bool - */ - protected function filterFailsMethod($filter, $request, $method) - { - return $this->methodExcludedByOptions($method, $filter['options']); - } - - /** - * Determine if the filter fails the "on" constraint. - * - * @param array $filter - * @param \Illuminate\Http\Request $request - * @param string $method - * @return bool - */ - protected function filterFailsOn($filter, $request, $method) - { - $on = array_get($filter, 'options.on'); - - if (is_null($on)) return false; - - // If the "on" is a string, we will explode it on the pipe so you can set any - // amount of methods on the filter constraints and it will still work like - // you specified an array. Then we will check if the method is in array. - if (is_string($on)) $on = explode('|', $on); - - return ! in_array(strtolower($request->getMethod()), $on); - } - - /** - * Call the given controller filter method. - * - * @param array $filter - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @return mixed - */ - protected function callFilter($filter, $route, $request) - { - return $this->router->callRouteFilter( - $filter['filter'], $filter['parameters'], $route, $request - ); - } - +class ControllerDispatcher +{ + use RouteDependencyResolverTrait; + + /** + * The router instance. + * + * @var \Illuminate\Routing\Router + */ + protected $router; + + /** + * The IoC container instance. + * + * @var \Illuminate\Container\Container + */ + protected $container; + + /** + * Create a new controller dispatcher instance. + * + * @param \Illuminate\Routing\Router $router + * @param \Illuminate\Container\Container $container + * @return void + */ + public function __construct(Router $router, + Container $container = null) + { + $this->router = $router; + $this->container = $container; + } + + /** + * Dispatch a request to a given controller and method. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @param string $controller + * @param string $method + * @return mixed + */ + public function dispatch(Route $route, Request $request, $controller, $method) + { + // First we will make an instance of this controller via the IoC container instance + // so that we can call the methods on it. We will also apply any "after" filters + // to the route so that they will be run by the routers after this processing. + $instance = $this->makeController($controller); + + $this->assignAfter($instance, $route, $request, $method); + + $response = $this->before($instance, $route, $request, $method); + + // If no before filters returned a response we'll call the method on the controller + // to get the response to be returned to the router. We will then return it back + // out for processing by this router and the after filters can be called then. + if (is_null($response)) { + $response = $this->callWithinStack( + $instance, $route, $request, $method + ); + } + + return $response; + } + + /** + * Make a controller instance via the IoC container. + * + * @param string $controller + * @return mixed + */ + protected function makeController($controller) + { + Controller::setRouter($this->router); + + return $this->container->make($controller); + } + + /** + * Call the given controller instance method. + * + * @param \Illuminate\Routing\Controller $instance + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @param string $method + * @return mixed + */ + protected function callWithinStack($instance, $route, $request, $method) + { + $shouldSkipMiddleware = $this->container->bound('middleware.disable') && + $this->container->make('middleware.disable') === true; + + $middleware = $shouldSkipMiddleware ? [] : $this->getMiddleware($instance, $method); + + // Here we will make a stack onion instance to execute this request in, which gives + // us the ability to define middlewares on controllers. We will return the given + // response back out so that "after" filters can be run after the middlewares. + return (new Pipeline($this->container)) + ->send($request) + ->through($middleware) + ->then(function ($request) use ($instance, $route, $method) { + return $this->router->prepareResponse( + $request, $this->call($instance, $route, $method) + ); + }); + } + + /** + * Get the middleware for the controller instance. + * + * @param \Illuminate\Routing\Controller $instance + * @param string $method + * @return array + */ + protected function getMiddleware($instance, $method) + { + $results = []; + + foreach ($instance->getMiddleware() as $name => $options) { + if (! $this->methodExcludedByOptions($method, $options)) { + $results[] = $this->router->resolveMiddlewareClassName($name); + } + } + + return $results; + } + + /** + * Determine if the given options exclude a particular method. + * + * @param string $method + * @param array $options + * @return bool + */ + public function methodExcludedByOptions($method, array $options) + { + return (isset($options['only']) && ! in_array($method, (array) $options['only'])) || + (! empty($options['except']) && in_array($method, (array) $options['except'])); + } + + /** + * Call the given controller instance method. + * + * @param \Illuminate\Routing\Controller $instance + * @param \Illuminate\Routing\Route $route + * @param string $method + * @return mixed + */ + protected function call($instance, $route, $method) + { + $parameters = $this->resolveClassMethodDependencies( + $route->parametersWithoutNulls(), $instance, $method + ); + + return $instance->callAction($method, $parameters); + } + + /** + * Call the "before" filters for the controller. + * + * @param \Illuminate\Routing\Controller $instance + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @param string $method + * @return mixed + */ + protected function before($instance, $route, $request, $method) + { + foreach ($instance->getBeforeFilters() as $filter) { + if ($this->filterApplies($filter, $request, $method)) { + // Here we will just check if the filter applies. If it does we will call the filter + // and return the responses if it isn't null. If it is null, we will keep hitting + // them until we get a response or are finished iterating through this filters. + $response = $this->callFilter($filter, $route, $request); + + if (! is_null($response)) { + return $response; + } + } + } + } + + /** + * Apply the applicable after filters to the route. + * + * @param \Illuminate\Routing\Controller $instance + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @param string $method + * @return mixed + */ + protected function assignAfter($instance, $route, $request, $method) + { + foreach ($instance->getAfterFilters() as $filter) { + // If the filter applies, we will add it to the route, since it has already been + // registered with the router by the controller, and will just let the normal + // router take care of calling these filters so we do not duplicate logics. + if ($this->filterApplies($filter, $request, $method)) { + $route->after($this->getAssignableAfter($filter)); + } + } + } + + /** + * Get the assignable after filter for the route. + * + * @param \Closure|string $filter + * @return string + */ + protected function getAssignableAfter($filter) + { + if ($filter['original'] instanceof Closure) { + return $filter['filter']; + } + + return $filter['original']; + } + + /** + * Determine if the given filter applies to the request. + * + * @param array $filter + * @param \Illuminate\Http\Request $request + * @param string $method + * @return bool + */ + protected function filterApplies($filter, $request, $method) + { + foreach (['Method', 'On'] as $type) { + if ($this->{"filterFails{$type}"}($filter, $request, $method)) { + return false; + } + } + + return true; + } + + /** + * Determine if the filter fails the method constraints. + * + * @param array $filter + * @param \Illuminate\Http\Request $request + * @param string $method + * @return bool + */ + protected function filterFailsMethod($filter, $request, $method) + { + return $this->methodExcludedByOptions($method, $filter['options']); + } + + /** + * Determine if the filter fails the "on" constraint. + * + * @param array $filter + * @param \Illuminate\Http\Request $request + * @param string $method + * @return bool + */ + protected function filterFailsOn($filter, $request, $method) + { + $on = Arr::get($filter, 'options.on'); + + if (is_null($on)) { + return false; + } + + // If the "on" is a string, we will explode it on the pipe so you can set any + // amount of methods on the filter constraints and it will still work like + // you specified an array. Then we will check if the method is in array. + if (is_string($on)) { + $on = explode('|', $on); + } + + return ! in_array(strtolower($request->getMethod()), $on); + } + + /** + * Call the given controller filter method. + * + * @param array $filter + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return mixed + */ + protected function callFilter($filter, $route, $request) + { + return $this->router->callRouteFilter( + $filter['filter'], $filter['parameters'], $route, $request + ); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/ControllerInspector.php b/application/vendor/laravel/framework/src/Illuminate/Routing/ControllerInspector.php index 32ffc7e..bf6ff39 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/ControllerInspector.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/ControllerInspector.php @@ -1,132 +1,133 @@ -getMethods(ReflectionMethod::IS_PUBLIC); - - // To get the routable methods, we will simply spin through all methods on the - // controller instance checking to see if it belongs to the given class and - // is a publicly routable method. If so, we will add it to this listings. - foreach ($methods as $method) - { - if ($this->isRoutable($method)) - { - $data = $this->getMethodData($method, $prefix); - - $routable[$method->name][] = $data; - - // If the routable method is an index method, we will create a special index - // route which is simply the prefix and the verb and does not contain any - // the wildcard place-holders that each "typical" routes would contain. - if ($data['plain'] == $prefix.'/index') - { - $routable[$method->name][] = $this->getIndexData($data, $prefix); - } - } - } - - return $routable; - } - - /** - * Determine if the given controller method is routable. - * - * @param \ReflectionMethod $method - * @return bool - */ - public function isRoutable(ReflectionMethod $method) - { - if ($method->class == 'Illuminate\Routing\Controller') return false; - - return starts_with($method->name, $this->verbs); - } - - /** - * Get the method data for a given method. - * - * @param \ReflectionMethod $method - * @param string $prefix - * @return array - */ - public function getMethodData(ReflectionMethod $method, $prefix) - { - $verb = $this->getVerb($name = $method->name); - - $uri = $this->addUriWildcards($plain = $this->getPlainUri($name, $prefix)); - - return compact('verb', 'plain', 'uri'); - } - - /** - * Get the routable data for an index method. - * - * @param array $data - * @param string $prefix - * @return array - */ - protected function getIndexData($data, $prefix) - { - return array('verb' => $data['verb'], 'plain' => $prefix, 'uri' => $prefix); - } - - /** - * Extract the verb from a controller action. - * - * @param string $name - * @return string - */ - public function getVerb($name) - { - return head(explode('_', snake_case($name))); - } - - /** - * Determine the URI from the given method name. - * - * @param string $name - * @param string $prefix - * @return string - */ - public function getPlainUri($name, $prefix) - { - return $prefix.'/'.implode('-', array_slice(explode('_', snake_case($name)), 1)); - } - - /** - * Add wildcards to the given URI. - * - * @param string $uri - * @return string - */ - public function addUriWildcards($uri) - { - return $uri.'/{one?}/{two?}/{three?}/{four?}/{five?}'; - } - +use Illuminate\Support\Str; + +class ControllerInspector +{ + /** + * An array of HTTP verbs. + * + * @var array + */ + protected $verbs = [ + 'any', 'get', 'post', 'put', 'patch', + 'delete', 'head', 'options', + ]; + + /** + * Get the routable methods for a controller. + * + * @param string $controller + * @param string $prefix + * @return array + */ + public function getRoutable($controller, $prefix) + { + $routable = []; + + $reflection = new ReflectionClass($controller); + + $methods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC); + + // To get the routable methods, we will simply spin through all methods on the + // controller instance checking to see if it belongs to the given class and + // is a publicly routable method. If so, we will add it to this listings. + foreach ($methods as $method) { + if ($this->isRoutable($method)) { + $data = $this->getMethodData($method, $prefix); + + $routable[$method->name][] = $data; + + // If the routable method is an index method, we will create a special index + // route which is simply the prefix and the verb and does not contain any + // the wildcard place-holders that each "typical" routes would contain. + if ($data['plain'] == $prefix.'/index') { + $routable[$method->name][] = $this->getIndexData($data, $prefix); + } + } + } + + return $routable; + } + + /** + * Determine if the given controller method is routable. + * + * @param \ReflectionMethod $method + * @return bool + */ + public function isRoutable(ReflectionMethod $method) + { + if ($method->class == 'Illuminate\Routing\Controller') { + return false; + } + + return Str::startsWith($method->name, $this->verbs); + } + + /** + * Get the method data for a given method. + * + * @param \ReflectionMethod $method + * @param string $prefix + * @return array + */ + public function getMethodData(ReflectionMethod $method, $prefix) + { + $verb = $this->getVerb($name = $method->name); + + $uri = $this->addUriWildcards($plain = $this->getPlainUri($name, $prefix)); + + return compact('verb', 'plain', 'uri'); + } + + /** + * Get the routable data for an index method. + * + * @param array $data + * @param string $prefix + * @return array + */ + protected function getIndexData($data, $prefix) + { + return ['verb' => $data['verb'], 'plain' => $prefix, 'uri' => $prefix]; + } + + /** + * Extract the verb from a controller action. + * + * @param string $name + * @return string + */ + public function getVerb($name) + { + return head(explode('_', Str::snake($name))); + } + + /** + * Determine the URI from the given method name. + * + * @param string $name + * @param string $prefix + * @return string + */ + public function getPlainUri($name, $prefix) + { + return $prefix.'/'.implode('-', array_slice(explode('_', Str::snake($name)), 1)); + } + + /** + * Add wildcards to the given URI. + * + * @param string $uri + * @return string + */ + public function addUriWildcards($uri) + { + return $uri.'/{one?}/{two?}/{three?}/{four?}/{five?}'; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/ControllerServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Routing/ControllerServiceProvider.php index 029dc9e..ead0992 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/ControllerServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/ControllerServiceProvider.php @@ -1,20 +1,20 @@ -app->singleton('illuminate.route.dispatcher', function($app) - { - return new ControllerDispatcher($app['router'], $app); - }); - } +use Illuminate\Support\ServiceProvider; +class ControllerServiceProvider extends ServiceProvider +{ + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton('illuminate.route.dispatcher', function ($app) { + return new ControllerDispatcher($app['router'], $app); + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/GeneratorServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Routing/GeneratorServiceProvider.php index f3edcd4..1b5bfea 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/GeneratorServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/GeneratorServiceProvider.php @@ -1,68 +1,67 @@ -registerControllerGenerator(); +class GeneratorServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; - $this->registerMiddlewareGenerator(); + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerControllerGenerator(); - $this->commands('command.controller.make', 'command.middleware.make'); - } + $this->registerMiddlewareGenerator(); - /** - * Register the controller generator command. - * - * @return void - */ - protected function registerControllerGenerator() - { - $this->app->singleton('command.controller.make', function($app) - { - return new ControllerMakeCommand($app['files']); - }); - } + $this->commands('command.controller.make', 'command.middleware.make'); + } - /** - * Register the middleware generator command. - * - * @return void - */ - protected function registerMiddlewareGenerator() - { - $this->app->singleton('command.middleware.make', function($app) - { - return new MiddlewareMakeCommand($app['files']); - }); - } + /** + * Register the controller generator command. + * + * @return void + */ + protected function registerControllerGenerator() + { + $this->app->singleton('command.controller.make', function ($app) { + return new ControllerMakeCommand($app['files']); + }); + } - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array( - 'command.controller.make', 'command.middleware.make', - ); - } + /** + * Register the middleware generator command. + * + * @return void + */ + protected function registerMiddlewareGenerator() + { + $this->app->singleton('command.middleware.make', function ($app) { + return new MiddlewareMakeCommand($app['files']); + }); + } + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'command.controller.make', 'command.middleware.make', + ]; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php b/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php index 5b74baa..76f9d87 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php @@ -1,22 +1,25 @@ -getCompiled()->getHostRegex())) return true; - - return preg_match($route->getCompiled()->getHostRegex(), $request->getHost()); - } +class HostValidator implements ValidatorInterface +{ + /** + * Validate a given rule against a route and request. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return bool + */ + public function matches(Route $route, Request $request) + { + if (is_null($route->getCompiled()->getHostRegex())) { + return true; + } + return preg_match($route->getCompiled()->getHostRegex(), $request->getHost()); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php b/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php index 21bc65c..f9cf155 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php @@ -1,20 +1,21 @@ -getMethod(), $route->methods()); - } - +class MethodValidator implements ValidatorInterface +{ + /** + * Validate a given rule against a route and request. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return bool + */ + public function matches(Route $route, Request $request) + { + return in_array($request->getMethod(), $route->methods()); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php b/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php index e9e9b66..fd5d5af 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php @@ -1,29 +1,27 @@ -httpOnly()) - { - return ! $request->secure(); - } - elseif ($route->secure()) - { - return $request->secure(); - } - - return true; - } +class SchemeValidator implements ValidatorInterface +{ + /** + * Validate a given rule against a route and request. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return bool + */ + public function matches(Route $route, Request $request) + { + if ($route->httpOnly()) { + return ! $request->secure(); + } elseif ($route->secure()) { + return $request->secure(); + } + return true; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php b/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php index 757bc4c..6a54d12 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php @@ -1,22 +1,23 @@ -path() == '/' ? '/' : '/'.$request->path(); - - return preg_match($route->getCompiled()->getRegex(), rawurldecode($path)); - } +class UriValidator implements ValidatorInterface +{ + /** + * Validate a given rule against a route and request. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return bool + */ + public function matches(Route $route, Request $request) + { + $path = $request->path() == '/' ? '/' : '/'.$request->path(); + return preg_match($route->getCompiled()->getRegex(), rawurldecode($path)); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php b/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php index d2ba1e5..0f178f1 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php @@ -1,17 +1,18 @@ -generator = $generator; - } - - /** - * Create a new redirect response to the "home" route. - * - * @param int $status - * @return \Illuminate\Http\RedirectResponse - */ - public function home($status = 302) - { - return $this->to($this->generator->route('home'), $status); - } - - /** - * Create a new redirect response to the previous location. - * - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function back($status = 302, $headers = array()) - { - $back = $this->generator->previous(); - - return $this->createRedirect($back, $status, $headers); - } - - /** - * Create a new redirect response to the current URI. - * - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function refresh($status = 302, $headers = array()) - { - return $this->to($this->generator->getRequest()->path(), $status, $headers); - } - - /** - * Create a new redirect response, while putting the current URL in the session. - * - * @param string $path - * @param int $status - * @param array $headers - * @param bool $secure - * @return \Illuminate\Http\RedirectResponse - */ - public function guest($path, $status = 302, $headers = array(), $secure = null) - { - $this->session->put('url.intended', $this->generator->full()); - - return $this->to($path, $status, $headers, $secure); - } - - /** - * Create a new redirect response to the previously intended location. - * - * @param string $default - * @param int $status - * @param array $headers - * @param bool $secure - * @return \Illuminate\Http\RedirectResponse - */ - public function intended($default = '/', $status = 302, $headers = array(), $secure = null) - { - $path = $this->session->pull('url.intended', $default); - - return $this->to($path, $status, $headers, $secure); - } - - /** - * Create a new redirect response to the given path. - * - * @param string $path - * @param int $status - * @param array $headers - * @param bool $secure - * @return \Illuminate\Http\RedirectResponse - */ - public function to($path, $status = 302, $headers = array(), $secure = null) - { - $path = $this->generator->to($path, array(), $secure); - - return $this->createRedirect($path, $status, $headers); - } - - /** - * Create a new redirect response to an external URL (no validation). - * - * @param string $path - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function away($path, $status = 302, $headers = array()) - { - return $this->createRedirect($path, $status, $headers); - } - - /** - * Create a new redirect response to the given HTTPS path. - * - * @param string $path - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function secure($path, $status = 302, $headers = array()) - { - return $this->to($path, $status, $headers, true); - } - - /** - * Create a new redirect response to a named route. - * - * @param string $route - * @param array $parameters - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function route($route, $parameters = array(), $status = 302, $headers = array()) - { - $path = $this->generator->route($route, $parameters); - - return $this->to($path, $status, $headers); - } - - /** - * Create a new redirect response to a controller action. - * - * @param string $action - * @param array $parameters - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function action($action, $parameters = array(), $status = 302, $headers = array()) - { - $path = $this->generator->action($action, $parameters); - - return $this->to($path, $status, $headers); - } - - /** - * Create a new redirect response. - * - * @param string $path - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - protected function createRedirect($path, $status, $headers) - { - $redirect = new RedirectResponse($path, $status, $headers); - - if (isset($this->session)) - { - $redirect->setSession($this->session); - } - - $redirect->setRequest($this->generator->getRequest()); - - return $redirect; - } - - /** - * Get the URL generator instance. - * - * @return \Illuminate\Routing\UrlGenerator - */ - public function getUrlGenerator() - { - return $this->generator; - } - - /** - * Set the active session store. - * - * @param \Illuminate\Session\Store $session - * @return void - */ - public function setSession(SessionStore $session) - { - $this->session = $session; - } - +class Redirector +{ + /** + * The URL generator instance. + * + * @var \Illuminate\Routing\UrlGenerator + */ + protected $generator; + + /** + * The session store instance. + * + * @var \Illuminate\Session\Store + */ + protected $session; + + /** + * Create a new Redirector instance. + * + * @param \Illuminate\Routing\UrlGenerator $generator + * @return void + */ + public function __construct(UrlGenerator $generator) + { + $this->generator = $generator; + } + + /** + * Create a new redirect response to the "home" route. + * + * @param int $status + * @return \Illuminate\Http\RedirectResponse + */ + public function home($status = 302) + { + return $this->to($this->generator->route('home'), $status); + } + + /** + * Create a new redirect response to the previous location. + * + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function back($status = 302, $headers = []) + { + $back = $this->generator->previous(); + + return $this->createRedirect($back, $status, $headers); + } + + /** + * Create a new redirect response to the current URI. + * + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function refresh($status = 302, $headers = []) + { + return $this->to($this->generator->getRequest()->path(), $status, $headers); + } + + /** + * Create a new redirect response, while putting the current URL in the session. + * + * @param string $path + * @param int $status + * @param array $headers + * @param bool $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function guest($path, $status = 302, $headers = [], $secure = null) + { + $this->session->put('url.intended', $this->generator->full()); + + return $this->to($path, $status, $headers, $secure); + } + + /** + * Create a new redirect response to the previously intended location. + * + * @param string $default + * @param int $status + * @param array $headers + * @param bool $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function intended($default = '/', $status = 302, $headers = [], $secure = null) + { + $path = $this->session->pull('url.intended', $default); + + return $this->to($path, $status, $headers, $secure); + } + + /** + * Create a new redirect response to the given path. + * + * @param string $path + * @param int $status + * @param array $headers + * @param bool $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function to($path, $status = 302, $headers = [], $secure = null) + { + $path = $this->generator->to($path, [], $secure); + + return $this->createRedirect($path, $status, $headers); + } + + /** + * Create a new redirect response to an external URL (no validation). + * + * @param string $path + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function away($path, $status = 302, $headers = []) + { + return $this->createRedirect($path, $status, $headers); + } + + /** + * Create a new redirect response to the given HTTPS path. + * + * @param string $path + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function secure($path, $status = 302, $headers = []) + { + return $this->to($path, $status, $headers, true); + } + + /** + * Create a new redirect response to a named route. + * + * @param string $route + * @param array $parameters + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function route($route, $parameters = [], $status = 302, $headers = []) + { + $path = $this->generator->route($route, $parameters); + + return $this->to($path, $status, $headers); + } + + /** + * Create a new redirect response to a controller action. + * + * @param string $action + * @param array $parameters + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function action($action, $parameters = [], $status = 302, $headers = []) + { + $path = $this->generator->action($action, $parameters); + + return $this->to($path, $status, $headers); + } + + /** + * Create a new redirect response. + * + * @param string $path + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + protected function createRedirect($path, $status, $headers) + { + $redirect = new RedirectResponse($path, $status, $headers); + + if (isset($this->session)) { + $redirect->setSession($this->session); + } + + $redirect->setRequest($this->generator->getRequest()); + + return $redirect; + } + + /** + * Get the URL generator instance. + * + * @return \Illuminate\Routing\UrlGenerator + */ + public function getUrlGenerator() + { + return $this->generator; + } + + /** + * Set the active session store. + * + * @param \Illuminate\Session\Store $session + * @return void + */ + public function setSession(SessionStore $session) + { + $this->session = $session; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/ResourceRegistrar.php b/application/vendor/laravel/framework/src/Illuminate/Routing/ResourceRegistrar.php index 970d425..bd46c9a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/ResourceRegistrar.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/ResourceRegistrar.php @@ -1,392 +1,389 @@ -router = $router; - } - - /** - * Route a resource to a controller. - * - * @param string $name - * @param string $controller - * @param array $options - * @return void - */ - public function register($name, $controller, array $options = array()) - { - // If the resource name contains a slash, we will assume the developer wishes to - // register these resource routes with a prefix so we will set that up out of - // the box so they don't have to mess with it. Otherwise, we will continue. - if (str_contains($name, '/')) - { - $this->prefixedResource($name, $controller, $options); - - return; - } - - // We need to extract the base resource from the resource name. Nested resources - // are supported in the framework, but we need to know what name to use for a - // place-holder on the route wildcards, which should be the base resources. - $base = $this->getResourceWildcard(last(explode('.', $name))); - - $defaults = $this->resourceDefaults; - - foreach ($this->getResourceMethods($defaults, $options) as $m) - { - $this->{'addResource'.ucfirst($m)}($name, $base, $controller, $options); - } - } - - /** - * Build a set of prefixed resource routes. - * - * @param string $name - * @param string $controller - * @param array $options - * @return void - */ - protected function prefixedResource($name, $controller, array $options) - { - list($name, $prefix) = $this->getResourcePrefix($name); - - // We need to extract the base resource from the resource name. Nested resources - // are supported in the framework, but we need to know what name to use for a - // place-holder on the route wildcards, which should be the base resources. - $callback = function($me) use ($name, $controller, $options) - { - $me->resource($name, $controller, $options); - }; - - return $this->router->group(compact('prefix'), $callback); - } - - /** - * Extract the resource and prefix from a resource name. - * - * @param string $name - * @return array - */ - protected function getResourcePrefix($name) - { - $segments = explode('/', $name); - - // To get the prefix, we will take all of the name segments and implode them on - // a slash. This will generate a proper URI prefix for us. Then we take this - // last segment, which will be considered the final resources name we use. - $prefix = implode('/', array_slice($segments, 0, -1)); - - return array(end($segments), $prefix); - } - - /** - * Get the applicable resource methods. - * - * @param array $defaults - * @param array $options - * @return array - */ - protected function getResourceMethods($defaults, $options) - { - if (isset($options['only'])) - { - return array_intersect($defaults, (array) $options['only']); - } - elseif (isset($options['except'])) - { - return array_diff($defaults, (array) $options['except']); - } - - return $defaults; - } - - /** - * Get the base resource URI for a given resource. - * - * @param string $resource - * @return string - */ - public function getResourceUri($resource) - { - if ( ! str_contains($resource, '.')) return $resource; - - // Once we have built the base URI, we'll remove the wildcard holder for this - // base resource name so that the individual route adders can suffix these - // paths however they need to, as some do not have any wildcards at all. - $segments = explode('.', $resource); - - $uri = $this->getNestedResourceUri($segments); - - return str_replace('/{'.$this->getResourceWildcard(last($segments)).'}', '', $uri); - } - - /** - * Get the URI for a nested resource segment array. - * - * @param array $segments - * @return string - */ - protected function getNestedResourceUri(array $segments) - { - // We will spin through the segments and create a place-holder for each of the - // resource segments, as well as the resource itself. Then we should get an - // entire string for the resource URI that contains all nested resources. - return implode('/', array_map(function($s) - { - return $s.'/{'.$this->getResourceWildcard($s).'}'; - - }, $segments)); - } - - /** - * Get the action array for a resource route. - * - * @param string $resource - * @param string $controller - * @param string $method - * @param array $options - * @return array - */ - protected function getResourceAction($resource, $controller, $method, $options) - { - $name = $this->getResourceName($resource, $method, $options); - - return array('as' => $name, 'uses' => $controller.'@'.$method); - } - - /** - * Get the name for a given resource. - * - * @param string $resource - * @param string $method - * @param array $options - * @return string - */ - protected function getResourceName($resource, $method, $options) - { - if (isset($options['names'][$method])) return $options['names'][$method]; - - // If a global prefix has been assigned to all names for this resource, we will - // grab that so we can prepend it onto the name when we create this name for - // the resource action. Otherwise we'll just use an empty string for here. - $prefix = isset($options['as']) ? $options['as'].'.' : ''; - - if ( ! $this->router->hasGroupStack()) - { - return $prefix.$resource.'.'.$method; - } - - return $this->getGroupResourceName($prefix, $resource, $method); - } - - /** - * Get the resource name for a grouped resource. - * - * @param string $prefix - * @param string $resource - * @param string $method - * @return string - */ - protected function getGroupResourceName($prefix, $resource, $method) - { - $group = trim(str_replace('/', '.', $this->router->getLastGroupPrefix()), '.'); - - if (empty($group)) - { - return trim("{$prefix}{$resource}.{$method}", '.'); - } - - return trim("{$prefix}{$group}.{$resource}.{$method}", '.'); - } - - /** - * Format a resource wildcard for usage. - * - * @param string $value - * @return string - */ - public function getResourceWildcard($value) - { - return str_replace('-', '_', $value); - } - - /** - * Add the index method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addResourceIndex($name, $base, $controller, $options) - { - $uri = $this->getResourceUri($name); - - $action = $this->getResourceAction($name, $controller, 'index', $options); - - return $this->router->get($uri, $action); - } - - /** - * Add the create method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addResourceCreate($name, $base, $controller, $options) - { - $uri = $this->getResourceUri($name).'/create'; - - $action = $this->getResourceAction($name, $controller, 'create', $options); - - return $this->router->get($uri, $action); - } - - /** - * Add the store method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addResourceStore($name, $base, $controller, $options) - { - $uri = $this->getResourceUri($name); - - $action = $this->getResourceAction($name, $controller, 'store', $options); - - return $this->router->post($uri, $action); - } - - /** - * Add the show method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addResourceShow($name, $base, $controller, $options) - { - $uri = $this->getResourceUri($name).'/{'.$base.'}'; - - $action = $this->getResourceAction($name, $controller, 'show', $options); - - return $this->router->get($uri, $action); - } - - /** - * Add the edit method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addResourceEdit($name, $base, $controller, $options) - { - $uri = $this->getResourceUri($name).'/{'.$base.'}/edit'; - - $action = $this->getResourceAction($name, $controller, 'edit', $options); - - return $this->router->get($uri, $action); - } - - /** - * Add the update method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return void - */ - protected function addResourceUpdate($name, $base, $controller, $options) - { - $this->addPutResourceUpdate($name, $base, $controller, $options); - - return $this->addPatchResourceUpdate($name, $base, $controller); - } - - /** - * Add the update method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addPutResourceUpdate($name, $base, $controller, $options) - { - $uri = $this->getResourceUri($name).'/{'.$base.'}'; - - $action = $this->getResourceAction($name, $controller, 'update', $options); - - return $this->router->put($uri, $action); - } - - /** - * Add the update method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @return void - */ - protected function addPatchResourceUpdate($name, $base, $controller) - { - $uri = $this->getResourceUri($name).'/{'.$base.'}'; - - $this->router->patch($uri, $controller.'@update'); - } - - /** - * Add the destroy method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addResourceDestroy($name, $base, $controller, $options) - { - $uri = $this->getResourceUri($name).'/{'.$base.'}'; - - $action = $this->getResourceAction($name, $controller, 'destroy', $options); - - return $this->router->delete($uri, $action); - } - +router = $router; + } + + /** + * Route a resource to a controller. + * + * @param string $name + * @param string $controller + * @param array $options + * @return void + */ + public function register($name, $controller, array $options = []) + { + // If the resource name contains a slash, we will assume the developer wishes to + // register these resource routes with a prefix so we will set that up out of + // the box so they don't have to mess with it. Otherwise, we will continue. + if (Str::contains($name, '/')) { + $this->prefixedResource($name, $controller, $options); + + return; + } + + // We need to extract the base resource from the resource name. Nested resources + // are supported in the framework, but we need to know what name to use for a + // place-holder on the route wildcards, which should be the base resources. + $base = $this->getResourceWildcard(last(explode('.', $name))); + + $defaults = $this->resourceDefaults; + + foreach ($this->getResourceMethods($defaults, $options) as $m) { + $this->{'addResource'.ucfirst($m)}($name, $base, $controller, $options); + } + } + + /** + * Build a set of prefixed resource routes. + * + * @param string $name + * @param string $controller + * @param array $options + * @return void + */ + protected function prefixedResource($name, $controller, array $options) + { + list($name, $prefix) = $this->getResourcePrefix($name); + + // We need to extract the base resource from the resource name. Nested resources + // are supported in the framework, but we need to know what name to use for a + // place-holder on the route wildcards, which should be the base resources. + $callback = function ($me) use ($name, $controller, $options) { + $me->resource($name, $controller, $options); + }; + + return $this->router->group(compact('prefix'), $callback); + } + + /** + * Extract the resource and prefix from a resource name. + * + * @param string $name + * @return array + */ + protected function getResourcePrefix($name) + { + $segments = explode('/', $name); + + // To get the prefix, we will take all of the name segments and implode them on + // a slash. This will generate a proper URI prefix for us. Then we take this + // last segment, which will be considered the final resources name we use. + $prefix = implode('/', array_slice($segments, 0, -1)); + + return [end($segments), $prefix]; + } + + /** + * Get the applicable resource methods. + * + * @param array $defaults + * @param array $options + * @return array + */ + protected function getResourceMethods($defaults, $options) + { + if (isset($options['only'])) { + return array_intersect($defaults, (array) $options['only']); + } elseif (isset($options['except'])) { + return array_diff($defaults, (array) $options['except']); + } + + return $defaults; + } + + /** + * Get the base resource URI for a given resource. + * + * @param string $resource + * @return string + */ + public function getResourceUri($resource) + { + if (! Str::contains($resource, '.')) { + return $resource; + } + + // Once we have built the base URI, we'll remove the wildcard holder for this + // base resource name so that the individual route adders can suffix these + // paths however they need to, as some do not have any wildcards at all. + $segments = explode('.', $resource); + + $uri = $this->getNestedResourceUri($segments); + + return str_replace('/{'.$this->getResourceWildcard(end($segments)).'}', '', $uri); + } + + /** + * Get the URI for a nested resource segment array. + * + * @param array $segments + * @return string + */ + protected function getNestedResourceUri(array $segments) + { + // We will spin through the segments and create a place-holder for each of the + // resource segments, as well as the resource itself. Then we should get an + // entire string for the resource URI that contains all nested resources. + return implode('/', array_map(function ($s) { + return $s.'/{'.$this->getResourceWildcard($s).'}'; + }, $segments)); + } + + /** + * Get the action array for a resource route. + * + * @param string $resource + * @param string $controller + * @param string $method + * @param array $options + * @return array + */ + protected function getResourceAction($resource, $controller, $method, $options) + { + $name = $this->getResourceName($resource, $method, $options); + + return ['as' => $name, 'uses' => $controller.'@'.$method]; + } + + /** + * Get the name for a given resource. + * + * @param string $resource + * @param string $method + * @param array $options + * @return string + */ + protected function getResourceName($resource, $method, $options) + { + if (isset($options['names'][$method])) { + return $options['names'][$method]; + } + + // If a global prefix has been assigned to all names for this resource, we will + // grab that so we can prepend it onto the name when we create this name for + // the resource action. Otherwise we'll just use an empty string for here. + $prefix = isset($options['as']) ? $options['as'].'.' : ''; + + if (! $this->router->hasGroupStack()) { + return $prefix.$resource.'.'.$method; + } + + return $this->getGroupResourceName($prefix, $resource, $method); + } + + /** + * Get the resource name for a grouped resource. + * + * @param string $prefix + * @param string $resource + * @param string $method + * @return string + */ + protected function getGroupResourceName($prefix, $resource, $method) + { + $group = trim(str_replace('/', '.', $this->router->getLastGroupPrefix()), '.'); + + if (empty($group)) { + return trim("{$prefix}{$resource}.{$method}", '.'); + } + + return trim("{$prefix}{$group}.{$resource}.{$method}", '.'); + } + + /** + * Format a resource wildcard for usage. + * + * @param string $value + * @return string + */ + public function getResourceWildcard($value) + { + return str_replace('-', '_', $value); + } + + /** + * Add the index method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceIndex($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name); + + $action = $this->getResourceAction($name, $controller, 'index', $options); + + return $this->router->get($uri, $action); + } + + /** + * Add the create method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceCreate($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name).'/create'; + + $action = $this->getResourceAction($name, $controller, 'create', $options); + + return $this->router->get($uri, $action); + } + + /** + * Add the store method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceStore($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name); + + $action = $this->getResourceAction($name, $controller, 'store', $options); + + return $this->router->post($uri, $action); + } + + /** + * Add the show method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceShow($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name).'/{'.$base.'}'; + + $action = $this->getResourceAction($name, $controller, 'show', $options); + + return $this->router->get($uri, $action); + } + + /** + * Add the edit method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceEdit($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name).'/{'.$base.'}/edit'; + + $action = $this->getResourceAction($name, $controller, 'edit', $options); + + return $this->router->get($uri, $action); + } + + /** + * Add the update method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return void + */ + protected function addResourceUpdate($name, $base, $controller, $options) + { + $this->addPutResourceUpdate($name, $base, $controller, $options); + + return $this->addPatchResourceUpdate($name, $base, $controller); + } + + /** + * Add the update method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addPutResourceUpdate($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name).'/{'.$base.'}'; + + $action = $this->getResourceAction($name, $controller, 'update', $options); + + return $this->router->put($uri, $action); + } + + /** + * Add the update method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @return void + */ + protected function addPatchResourceUpdate($name, $base, $controller) + { + $uri = $this->getResourceUri($name).'/{'.$base.'}'; + + $this->router->patch($uri, $controller.'@update'); + } + + /** + * Add the destroy method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceDestroy($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name).'/{'.$base.'}'; + + $action = $this->getResourceAction($name, $controller, 'destroy', $options); + + return $this->router->delete($uri, $action); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php b/application/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php index 82b49e2..02e77cb 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php @@ -1,5 +1,8 @@ -view = $view; - $this->redirector = $redirector; - } - - /** - * Return a new response from the application. - * - * @param string $content - * @param int $status - * @param array $headers - * @return \Symfony\Component\HttpFoundation\Response - */ - public function make($content = '', $status = 200, array $headers = array()) - { - return new Response($content, $status, $headers); - } - - /** - * Return a new view response from the application. - * - * @param string $view - * @param array $data - * @param int $status - * @param array $headers - * @return \Symfony\Component\HttpFoundation\Response - */ - public function view($view, $data = array(), $status = 200, array $headers = array()) - { - return static::make($this->view->make($view, $data), $status, $headers); - } - - /** - * Return a new JSON response from the application. - * - * @param string|array $data - * @param int $status - * @param array $headers - * @param int $options - * @return \Symfony\Component\HttpFoundation\Response - */ - public function json($data = array(), $status = 200, array $headers = array(), $options = 0) - { - if ($data instanceof Arrayable) - { - $data = $data->toArray(); - } - - return new JsonResponse($data, $status, $headers, $options); - } - - /** - * Return a new JSONP response from the application. - * - * @param string $callback - * @param string|array $data - * @param int $status - * @param array $headers - * @param int $options - * @return \Symfony\Component\HttpFoundation\Response - */ - public function jsonp($callback, $data = array(), $status = 200, array $headers = array(), $options = 0) - { - return $this->json($data, $status, $headers, $options)->setCallback($callback); - } - - /** - * Return a new streamed response from the application. - * - * @param \Closure $callback - * @param int $status - * @param array $headers - * @return \Symfony\Component\HttpFoundation\StreamedResponse - */ - public function stream($callback, $status = 200, array $headers = array()) - { - return new StreamedResponse($callback, $status, $headers); - } - - /** - * Create a new file download response. - * - * @param \SplFileInfo|string $file - * @param string $name - * @param array $headers - * @param null|string $disposition - * @return \Symfony\Component\HttpFoundation\BinaryFileResponse - */ - public function download($file, $name = null, array $headers = array(), $disposition = 'attachment') - { - $response = new BinaryFileResponse($file, 200, $headers, true, $disposition); - - if ( ! is_null($name)) - { - return $response->setContentDisposition($disposition, $name, str_replace('%', '', Str::ascii($name))); - } - - return $response; - } - - /** - * Create a new redirect response to the given path. - * - * @param string $path - * @param int $status - * @param array $headers - * @param bool $secure - * @return \Symfony\Component\HttpFoundation\Response - */ - public function redirectTo($path, $status = 302, $headers = array(), $secure = null) - { - return $this->redirector->to($path, $status, $headers, $secure); - } - - /** - * Create a new redirect response to a named route. - * - * @param string $route - * @param array $parameters - * @param int $status - * @param array $headers - * @return \Symfony\Component\HttpFoundation\Response - */ - public function redirectToRoute($route, $parameters = array(), $status = 302, $headers = array()) - { - return $this->redirector->route($route, $parameters, $status, $headers); - } - - /** - * Create a new redirect response to a controller action. - * - * @param string $action - * @param array $parameters - * @param int $status - * @param array $headers - * @return \Symfony\Component\HttpFoundation\Response - */ - public function redirectToAction($action, $parameters = array(), $status = 302, $headers = array()) - { - return $this->redirector->action($action, $parameters, $status, $headers); - } - - /** - * Create a new redirect response, while putting the current URL in the session. - * - * @param string $path - * @param int $status - * @param array $headers - * @param bool $secure - * @return \Symfony\Component\HttpFoundation\Response - */ - public function redirectGuest($path, $status = 302, $headers = array(), $secure = null) - { - return $this->redirector->guest($path, $status, $headers, $secure); - } - - /** - * Create a new redirect response to the previously intended location. - * - * @param string $default - * @param int $status - * @param array $headers - * @param bool $secure - * @return \Symfony\Component\HttpFoundation\Response - */ - public function redirectToIntended($default = '/', $status = 302, $headers = array(), $secure = null) - { - return $this->redirector->intended($default, $status, $headers, $secure); - } - +class ResponseFactory implements FactoryContract +{ + use Macroable; + + /** + * The view factory instance. + * + * @var \Illuminate\Contracts\View\Factory + */ + protected $view; + + /** + * The redirector instance. + * + * @var \Illuminate\Routing\Redirector + */ + protected $redirector; + + /** + * Create a new response factory instance. + * + * @param \Illuminate\Contracts\View\Factory $view + * @param \Illuminate\Routing\Redirector $redirector + * @return void + */ + public function __construct(ViewFactory $view, Redirector $redirector) + { + $this->view = $view; + $this->redirector = $redirector; + } + + /** + * Return a new response from the application. + * + * @param string $content + * @param int $status + * @param array $headers + * @return \Illuminate\Http\Response + */ + public function make($content = '', $status = 200, array $headers = []) + { + return new Response($content, $status, $headers); + } + + /** + * Return a new view response from the application. + * + * @param string $view + * @param array $data + * @param int $status + * @param array $headers + * @return \Illuminate\Http\Response + */ + public function view($view, $data = [], $status = 200, array $headers = []) + { + return static::make($this->view->make($view, $data), $status, $headers); + } + + /** + * Return a new JSON response from the application. + * + * @param string|array $data + * @param int $status + * @param array $headers + * @param int $options + * @return \Illuminate\Http\JsonResponse + */ + public function json($data = [], $status = 200, array $headers = [], $options = 0) + { + if ($data instanceof Arrayable && ! $data instanceof JsonSerializable) { + $data = $data->toArray(); + } + + return new JsonResponse($data, $status, $headers, $options); + } + + /** + * Return a new JSONP response from the application. + * + * @param string $callback + * @param string|array $data + * @param int $status + * @param array $headers + * @param int $options + * @return \Illuminate\Http\JsonResponse + */ + public function jsonp($callback, $data = [], $status = 200, array $headers = [], $options = 0) + { + return $this->json($data, $status, $headers, $options)->setCallback($callback); + } + + /** + * Return a new streamed response from the application. + * + * @param \Closure $callback + * @param int $status + * @param array $headers + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function stream($callback, $status = 200, array $headers = []) + { + return new StreamedResponse($callback, $status, $headers); + } + + /** + * Create a new file download response. + * + * @param \SplFileInfo|string $file + * @param string $name + * @param array $headers + * @param string|null $disposition + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + */ + public function download($file, $name = null, array $headers = [], $disposition = 'attachment') + { + $response = new BinaryFileResponse($file, 200, $headers, true, $disposition); + + if (! is_null($name)) { + return $response->setContentDisposition($disposition, $name, str_replace('%', '', Str::ascii($name))); + } + + return $response; + } + + /** + * Create a new redirect response to the given path. + * + * @param string $path + * @param int $status + * @param array $headers + * @param bool|null $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectTo($path, $status = 302, $headers = [], $secure = null) + { + return $this->redirector->to($path, $status, $headers, $secure); + } + + /** + * Create a new redirect response to a named route. + * + * @param string $route + * @param array $parameters + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectToRoute($route, $parameters = [], $status = 302, $headers = []) + { + return $this->redirector->route($route, $parameters, $status, $headers); + } + + /** + * Create a new redirect response to a controller action. + * + * @param string $action + * @param array $parameters + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectToAction($action, $parameters = [], $status = 302, $headers = []) + { + return $this->redirector->action($action, $parameters, $status, $headers); + } + + /** + * Create a new redirect response, while putting the current URL in the session. + * + * @param string $path + * @param int $status + * @param array $headers + * @param bool|null $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectGuest($path, $status = 302, $headers = [], $secure = null) + { + return $this->redirector->guest($path, $status, $headers, $secure); + } + + /** + * Create a new redirect response to the previously intended location. + * + * @param string $default + * @param int $status + * @param array $headers + * @param bool|null $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectToIntended($default = '/', $status = 302, $headers = [], $secure = null) + { + return $this->redirector->intended($default, $status, $headers, $secure); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/Route.php b/application/vendor/laravel/framework/src/Illuminate/Routing/Route.php index d7d3c41..cd4627a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/Route.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/Route.php @@ -1,971 +1,1027 @@ -uri = $uri; - $this->methods = (array) $methods; - $this->action = $this->parseAction($action); - - if (in_array('GET', $this->methods) && ! in_array('HEAD', $this->methods)) - { - $this->methods[] = 'HEAD'; - } - - if (isset($this->action['prefix'])) - { - $this->prefix($this->action['prefix']); - } - } - - /** - * Run the route action and return the response. - * - * @param \Illuminate\Http\Request $request - * @return mixed - */ - public function run(Request $request) - { - $this->container = $this->container ?: new Container; - - try - { - if ( ! is_string($this->action['uses'])) - { - return $this->runCallable($request); - } - - if ($this->customDispatcherIsBound()) - { - return $this->runWithCustomDispatcher($request); - } - - return $this->runController($request); - } - catch (HttpResponseException $e) - { - return $e->getResponse(); - } - } - - /** - * Run the route action and return the response. - * - * @param \Illuminate\Http\Request $request - * @return mixed - */ - protected function runCallable(Request $request) - { - $parameters = $this->resolveMethodDependencies( - $this->parametersWithoutNulls(), new ReflectionFunction($this->action['uses']) - ); - - return call_user_func_array($this->action['uses'], $parameters); - } - - /** - * Run the route action and return the response. - * - * @param \Illuminate\Http\Request $request - * @return mixed - */ - protected function runController(Request $request) - { - list($class, $method) = explode('@', $this->action['uses']); - - $parameters = $this->resolveClassMethodDependencies( - $this->parametersWithoutNulls(), $class, $method - ); - - if ( ! method_exists($instance = $this->container->make($class), $method)) - { - throw new NotFoundHttpException; - } - - return call_user_func_array([$instance, $method], $parameters); - } - - /** - * Determine if a custom route dispatcher is bound in the container. - * - * @return bool - */ - protected function customDispatcherIsBound() - { - return $this->container->bound('illuminate.route.dispatcher'); - } - - /** - * Send the request and route to a custom dispatcher for handling. - * - * @param \Illuminate\Http\Request $request - * @return mixed - */ - protected function runWithCustomDispatcher(Request $request) - { - list($class, $method) = explode('@', $this->action['uses']); - - $dispatcher = $this->container->make('illuminate.route.dispatcher'); - - return $dispatcher->dispatch($this, $request, $class, $method); - } - - /** - * Determine if the route matches given request. - * - * @param \Illuminate\Http\Request $request - * @param bool $includingMethod - * @return bool - */ - public function matches(Request $request, $includingMethod = true) - { - $this->compileRoute(); - - foreach ($this->getValidators() as $validator) - { - if ( ! $includingMethod && $validator instanceof MethodValidator) continue; - - if ( ! $validator->matches($this, $request)) return false; - } - - return true; - } - - /** - * Compile the route into a Symfony CompiledRoute instance. - * - * @return void - */ - protected function compileRoute() - { - $optionals = $this->extractOptionalParameters(); - - $uri = preg_replace('/\{(\w+?)\?\}/', '{$1}', $this->uri); - - $this->compiled = with( - - new SymfonyRoute($uri, $optionals, $this->wheres, array(), $this->domain() ?: '') - - )->compile(); - } - - /** - * Get the optional parameters for the route. - * - * @return array - */ - protected function extractOptionalParameters() - { - preg_match_all('/\{(\w+?)\?\}/', $this->uri, $matches); - - return isset($matches[1]) ? array_fill_keys($matches[1], null) : []; - } - - /** - * Get the middlewares attached to the route. - * - * @return array - */ - public function middleware() - { - return (array) array_get($this->action, 'middleware', []); - } - - /** - * Get the "before" filters for the route. - * - * @return array - */ - public function beforeFilters() - { - if ( ! isset($this->action['before'])) return array(); - - return $this->parseFilters($this->action['before']); - } - - /** - * Get the "after" filters for the route. - * - * @return array - */ - public function afterFilters() - { - if ( ! isset($this->action['after'])) return array(); - - return $this->parseFilters($this->action['after']); - } - - /** - * Parse the given filter string. - * - * @param string $filters - * @return array - */ - public static function parseFilters($filters) - { - return array_build(static::explodeFilters($filters), function($key, $value) - { - return Route::parseFilter($value); - }); - } - - /** - * Turn the filters into an array if they aren't already. - * - * @param array|string $filters - * @return array - */ - protected static function explodeFilters($filters) - { - if (is_array($filters)) return static::explodeArrayFilters($filters); - - return array_map('trim', explode('|', $filters)); - } - - /** - * Flatten out an array of filter declarations. - * - * @param array $filters - * @return array - */ - protected static function explodeArrayFilters(array $filters) - { - $results = array(); - - foreach ($filters as $filter) - { - $results = array_merge($results, array_map('trim', explode('|', $filter))); - } - - return $results; - } - - /** - * Parse the given filter into name and parameters. - * - * @param string $filter - * @return array - */ - public static function parseFilter($filter) - { - if ( ! str_contains($filter, ':')) return array($filter, array()); - - return static::parseParameterFilter($filter); - } - - /** - * Parse a filter with parameters. - * - * @param string $filter - * @return array - */ - protected static function parseParameterFilter($filter) - { - list($name, $parameters) = explode(':', $filter, 2); - - return array($name, explode(',', $parameters)); - } - - /** - * Determine a given parameter exists from the route. - * - * @param string $name - * @return bool - */ - public function hasParameter($name) - { - return array_key_exists($name, $this->parameters()); - } - - /** - * Get a given parameter from the route. - * - * @param string $name - * @param mixed $default - * @return string|object - */ - public function getParameter($name, $default = null) - { - return $this->parameter($name, $default); - } - - /** - * Get a given parameter from the route. - * - * @param string $name - * @param mixed $default - * @return string|object - */ - public function parameter($name, $default = null) - { - return array_get($this->parameters(), $name, $default); - } - - /** - * Set a parameter to the given value. - * - * @param string $name - * @param mixed $value - * @return void - */ - public function setParameter($name, $value) - { - $this->parameters(); - - $this->parameters[$name] = $value; - } - - /** - * Unset a parameter on the route if it is set. - * - * @param string $name - * @return void - */ - public function forgetParameter($name) - { - $this->parameters(); - - unset($this->parameters[$name]); - } - - /** - * Get the key / value list of parameters for the route. - * - * @return array - * - * @throws LogicException - */ - public function parameters() - { - if (isset($this->parameters)) - { - return array_map(function($value) - { - return is_string($value) ? rawurldecode($value) : $value; - - }, $this->parameters); - } - - throw new LogicException("Route is not bound."); - } - - /** - * Get the key / value list of parameters without null values. - * - * @return array - */ - public function parametersWithoutNulls() - { - return array_filter($this->parameters(), function($p) { return ! is_null($p); }); - } - - /** - * Get all of the parameter names for the route. - * - * @return array - */ - public function parameterNames() - { - if (isset($this->parameterNames)) return $this->parameterNames; - - return $this->parameterNames = $this->compileParameterNames(); - } - - /** - * Get the parameter names for the route. - * - * @return array - */ - protected function compileParameterNames() - { - preg_match_all('/\{(.*?)\}/', $this->domain().$this->uri, $matches); - - return array_map(function($m) { return trim($m, '?'); }, $matches[1]); - } - - /** - * Bind the route to a given request for execution. - * - * @param \Illuminate\Http\Request $request - * @return $this - */ - public function bind(Request $request) - { - $this->compileRoute(); - - $this->bindParameters($request); - - return $this; - } - - /** - * Extract the parameter list from the request. - * - * @param \Illuminate\Http\Request $request - * @return array - */ - public function bindParameters(Request $request) - { - // If the route has a regular expression for the host part of the URI, we will - // compile that and get the parameter matches for this domain. We will then - // merge them into this parameters array so that this array is completed. - $params = $this->matchToKeys( - - array_slice($this->bindPathParameters($request), 1) - - ); - - // If the route has a regular expression for the host part of the URI, we will - // compile that and get the parameter matches for this domain. We will then - // merge them into this parameters array so that this array is completed. - if ( ! is_null($this->compiled->getHostRegex())) - { - $params = $this->bindHostParameters( - $request, $params - ); - } - - return $this->parameters = $this->replaceDefaults($params); - } - - /** - * Get the parameter matches for the path portion of the URI. - * - * @param \Illuminate\Http\Request $request - * @return array - */ - protected function bindPathParameters(Request $request) - { - preg_match($this->compiled->getRegex(), '/'.$request->decodedPath(), $matches); - - return $matches; - } - - /** - * Extract the parameter list from the host part of the request. - * - * @param \Illuminate\Http\Request $request - * @param array $parameters - * @return array - */ - protected function bindHostParameters(Request $request, $parameters) - { - preg_match($this->compiled->getHostRegex(), $request->getHost(), $matches); - - return array_merge($this->matchToKeys(array_slice($matches, 1)), $parameters); - } - - /** - * Combine a set of parameter matches with the route's keys. - * - * @param array $matches - * @return array - */ - protected function matchToKeys(array $matches) - { - if (count($this->parameterNames()) == 0) return array(); - - $parameters = array_intersect_key($matches, array_flip($this->parameterNames())); - - return array_filter($parameters, function($value) - { - return is_string($value) && strlen($value) > 0; - }); - } - - /** - * Replace null parameters with their defaults. - * - * @param array $parameters - * @return array - */ - protected function replaceDefaults(array $parameters) - { - foreach ($parameters as $key => &$value) - { - $value = isset($value) ? $value : array_get($this->defaults, $key); - } - - return $parameters; - } - - /** - * Parse the route action into a standard array. - * - * @param callable|array $action - * @return array - */ - protected function parseAction($action) - { - // If the action is already a Closure instance, we will just set that instance - // as the "uses" property, because there is nothing else we need to do when - // it is available. Otherwise we will need to find it in the action list. - if (is_callable($action)) - { - return array('uses' => $action); - } - - // If no "uses" property has been set, we will dig through the array to find a - // Closure instance within this list. We will set the first Closure we come - // across into the "uses" property that will get fired off by this route. - elseif ( ! isset($action['uses'])) - { - $action['uses'] = $this->findCallable($action); - } - - return $action; - } - - /** - * Find the callable in an action array. - * - * @param array $action - * @return callable - */ - protected function findCallable(array $action) - { - return array_first($action, function($key, $value) - { - return is_callable($value) && is_numeric($key); - }); - } - - /** - * Get the route validators for the instance. - * - * @return array - */ - public static function getValidators() - { - if (isset(static::$validators)) return static::$validators; - - // To match the route, we will use a chain of responsibility pattern with the - // validator implementations. We will spin through each one making sure it - // passes and then we will know if the route as a whole matches request. - return static::$validators = array( - new MethodValidator, new SchemeValidator, - new HostValidator, new UriValidator, - ); - } - - /** - * Add before filters to the route. - * - * @param string $filters - * @return $this - */ - public function before($filters) - { - return $this->addFilters('before', $filters); - } - - /** - * Add after filters to the route. - * - * @param string $filters - * @return $this - */ - public function after($filters) - { - return $this->addFilters('after', $filters); - } - - /** - * Add the given filters to the route by type. - * - * @param string $type - * @param string $filters - * @return $this - */ - protected function addFilters($type, $filters) - { - $filters = static::explodeFilters($filters); - - if (isset($this->action[$type])) - { - $existing = static::explodeFilters($this->action[$type]); - - $this->action[$type] = array_merge($existing, $filters); - } - else - { - $this->action[$type] = $filters; - } - - return $this; - } - - /** - * Set a default value for the route. - * - * @param string $key - * @param mixed $value - * @return $this - */ - public function defaults($key, $value) - { - $this->defaults[$key] = $value; - - return $this; - } - - /** - * Set a regular expression requirement on the route. - * - * @param array|string $name - * @param string $expression - * @return $this - */ - public function where($name, $expression = null) - { - foreach ($this->parseWhere($name, $expression) as $name => $expression) - { - $this->wheres[$name] = $expression; - } - - return $this; - } - - /** - * Parse arguments to the where method into an array. - * - * @param array|string $name - * @param string $expression - * @return array - */ - protected function parseWhere($name, $expression) - { - return is_array($name) ? $name : array($name => $expression); - } - - /** - * Set a list of regular expression requirements on the route. - * - * @param array $wheres - * @return $this - */ - protected function whereArray(array $wheres) - { - foreach ($wheres as $name => $expression) - { - $this->where($name, $expression); - } - - return $this; - } - - /** - * Add a prefix to the route URI. - * - * @param string $prefix - * @return $this - */ - public function prefix($prefix) - { - $this->uri = trim($prefix, '/').'/'.trim($this->uri, '/'); - - return $this; - } - - /** - * Get the URI associated with the route. - * - * @return string - */ - public function getPath() - { - return $this->uri(); - } - - /** - * Get the URI associated with the route. - * - * @return string - */ - public function uri() - { - return $this->uri; - } - - /** - * Get the HTTP verbs the route responds to. - * - * @return array - */ - public function getMethods() - { - return $this->methods(); - } - - /** - * Get the HTTP verbs the route responds to. - * - * @return array - */ - public function methods() - { - return $this->methods; - } - - /** - * Determine if the route only responds to HTTP requests. - * - * @return bool - */ - public function httpOnly() - { - return in_array('http', $this->action, true); - } - - /** - * Determine if the route only responds to HTTPS requests. - * - * @return bool - */ - public function httpsOnly() - { - return $this->secure(); - } - - /** - * Determine if the route only responds to HTTPS requests. - * - * @return bool - */ - public function secure() - { - return in_array('https', $this->action, true); - } - - /** - * Get the domain defined for the route. - * - * @return string|null - */ - public function domain() - { - return isset($this->action['domain']) ? $this->action['domain'] : null; - } - - /** - * Get the URI that the route responds to. - * - * @return string - */ - public function getUri() - { - return $this->uri; - } - - /** - * Set the URI that the route responds to. - * - * @param string $uri - * @return \Illuminate\Routing\Route - */ - public function setUri($uri) - { - $this->uri = $uri; - - return $this; - } - - /** - * Get the prefix of the route instance. - * - * @return string - */ - public function getPrefix() - { - return isset($this->action['prefix']) ? $this->action['prefix'] : null; - } - - /** - * Get the name of the route instance. - * - * @return string - */ - public function getName() - { - return isset($this->action['as']) ? $this->action['as'] : null; - } - - /** - * Get the action name for the route. - * - * @return string - */ - public function getActionName() - { - return isset($this->action['controller']) ? $this->action['controller'] : 'Closure'; - } - - /** - * Get the action array for the route. - * - * @return array - */ - public function getAction() - { - return $this->action; - } - - /** - * Set the action array for the route. - * - * @param array $action - * @return $this - */ - public function setAction(array $action) - { - $this->action = $action; - - return $this; - } - - /** - * Get the compiled version of the route. - * - * @return \Symfony\Component\Routing\CompiledRoute - */ - public function getCompiled() - { - return $this->compiled; - } - - /** - * Set the container instance on the route. - * - * @param \Illuminate\Container\Container $container - * @return $this - */ - public function setContainer(Container $container) - { - $this->container = $container; - - return $this; - } - - /** - * Prepare the route instance for serialization. - * - * @return void - * - * @throws LogicException - */ - public function prepareForSerialization() - { - if ($this->action['uses'] instanceof Closure) - { - throw new LogicException("Unable to prepare route [{$this->uri}] for serialization. Uses Closure."); - } - - unset($this->container, $this->compiled); - } - - /** - * Dynamically access route parameters. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this->parameter($key); - } - +class Route +{ + use RouteDependencyResolverTrait; + + /** + * The URI pattern the route responds to. + * + * @var string + */ + protected $uri; + + /** + * The HTTP methods the route responds to. + * + * @var array + */ + protected $methods; + + /** + * The route action array. + * + * @var array + */ + protected $action; + + /** + * The default values for the route. + * + * @var array + */ + protected $defaults = []; + + /** + * The regular expression requirements. + * + * @var array + */ + protected $wheres = []; + + /** + * The array of matched parameters. + * + * @var array + */ + protected $parameters; + + /** + * The parameter names for the route. + * + * @var array|null + */ + protected $parameterNames; + + /** + * The compiled version of the route. + * + * @var \Symfony\Component\Routing\CompiledRoute + */ + protected $compiled; + + /** + * The container instance used by the route. + * + * @var \Illuminate\Container\Container + */ + protected $container; + + /** + * The validators used by the routes. + * + * @var array + */ + public static $validators; + + /** + * Create a new Route instance. + * + * @param array $methods + * @param string $uri + * @param \Closure|array $action + * @return void + */ + public function __construct($methods, $uri, $action) + { + $this->uri = $uri; + $this->methods = (array) $methods; + $this->action = $this->parseAction($action); + + if (in_array('GET', $this->methods) && ! in_array('HEAD', $this->methods)) { + $this->methods[] = 'HEAD'; + } + + if (isset($this->action['prefix'])) { + $this->prefix($this->action['prefix']); + } + } + + /** + * Run the route action and return the response. + * + * @param \Illuminate\Http\Request $request + * @return mixed + */ + public function run(Request $request) + { + $this->container = $this->container ?: new Container; + + try { + if (! is_string($this->action['uses'])) { + return $this->runCallable($request); + } + + if ($this->customDispatcherIsBound()) { + return $this->runWithCustomDispatcher($request); + } + + return $this->runController($request); + } catch (HttpResponseException $e) { + return $e->getResponse(); + } + } + + /** + * Run the route action and return the response. + * + * @param \Illuminate\Http\Request $request + * @return mixed + */ + protected function runCallable(Request $request) + { + $parameters = $this->resolveMethodDependencies( + $this->parametersWithoutNulls(), new ReflectionFunction($this->action['uses']) + ); + + return call_user_func_array($this->action['uses'], $parameters); + } + + /** + * Run the route action and return the response. + * + * @param \Illuminate\Http\Request $request + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + protected function runController(Request $request) + { + list($class, $method) = explode('@', $this->action['uses']); + + $parameters = $this->resolveClassMethodDependencies( + $this->parametersWithoutNulls(), $class, $method + ); + + if (! method_exists($instance = $this->container->make($class), $method)) { + throw new NotFoundHttpException; + } + + return call_user_func_array([$instance, $method], $parameters); + } + + /** + * Determine if a custom route dispatcher is bound in the container. + * + * @return bool + */ + protected function customDispatcherIsBound() + { + return $this->container->bound('illuminate.route.dispatcher'); + } + + /** + * Send the request and route to a custom dispatcher for handling. + * + * @param \Illuminate\Http\Request $request + * @return mixed + */ + protected function runWithCustomDispatcher(Request $request) + { + list($class, $method) = explode('@', $this->action['uses']); + + $dispatcher = $this->container->make('illuminate.route.dispatcher'); + + return $dispatcher->dispatch($this, $request, $class, $method); + } + + /** + * Determine if the route matches given request. + * + * @param \Illuminate\Http\Request $request + * @param bool $includingMethod + * @return bool + */ + public function matches(Request $request, $includingMethod = true) + { + $this->compileRoute(); + + foreach ($this->getValidators() as $validator) { + if (! $includingMethod && $validator instanceof MethodValidator) { + continue; + } + + if (! $validator->matches($this, $request)) { + return false; + } + } + + return true; + } + + /** + * Compile the route into a Symfony CompiledRoute instance. + * + * @return void + */ + protected function compileRoute() + { + $optionals = $this->extractOptionalParameters(); + + $uri = preg_replace('/\{(\w+?)\?\}/', '{$1}', $this->uri); + + $this->compiled = with( + + new SymfonyRoute($uri, $optionals, $this->wheres, [], $this->domain() ?: '') + + )->compile(); + } + + /** + * Get the optional parameters for the route. + * + * @return array + */ + protected function extractOptionalParameters() + { + preg_match_all('/\{(\w+?)\?\}/', $this->uri, $matches); + + return isset($matches[1]) ? array_fill_keys($matches[1], null) : []; + } + + /** + * Get or set the middlewares attached to the route. + * + * @param array|string|null $middleware + * @return $this|array + */ + public function middleware($middleware = null) + { + if (is_null($middleware)) { + return (array) Arr::get($this->action, 'middleware', []); + } + + if (is_string($middleware)) { + $middleware = [$middleware]; + } + + $this->action['middleware'] = array_merge( + (array) Arr::get($this->action, 'middleware', []), $middleware + ); + + return $this; + } + + /** + * Get the "before" filters for the route. + * + * @return array + * + * @deprecated since version 5.1. + */ + public function beforeFilters() + { + if (! isset($this->action['before'])) { + return []; + } + + return $this->parseFilters($this->action['before']); + } + + /** + * Get the "after" filters for the route. + * + * @return array + * + * @deprecated since version 5.1. + */ + public function afterFilters() + { + if (! isset($this->action['after'])) { + return []; + } + + return $this->parseFilters($this->action['after']); + } + + /** + * Parse the given filter string. + * + * @param string $filters + * @return array + * + * @deprecated since version 5.1. + */ + public static function parseFilters($filters) + { + return Arr::build(static::explodeFilters($filters), function ($key, $value) { + return Route::parseFilter($value); + }); + } + + /** + * Turn the filters into an array if they aren't already. + * + * @param array|string $filters + * @return array + */ + protected static function explodeFilters($filters) + { + if (is_array($filters)) { + return static::explodeArrayFilters($filters); + } + + return array_map('trim', explode('|', $filters)); + } + + /** + * Flatten out an array of filter declarations. + * + * @param array $filters + * @return array + */ + protected static function explodeArrayFilters(array $filters) + { + $results = []; + + foreach ($filters as $filter) { + $results = array_merge($results, array_map('trim', explode('|', $filter))); + } + + return $results; + } + + /** + * Parse the given filter into name and parameters. + * + * @param string $filter + * @return array + * + * @deprecated since version 5.1. + */ + public static function parseFilter($filter) + { + if (! Str::contains($filter, ':')) { + return [$filter, []]; + } + + return static::parseParameterFilter($filter); + } + + /** + * Parse a filter with parameters. + * + * @param string $filter + * @return array + */ + protected static function parseParameterFilter($filter) + { + list($name, $parameters) = explode(':', $filter, 2); + + return [$name, explode(',', $parameters)]; + } + + /** + * Determine a given parameter exists from the route. + * + * @param string $name + * @return bool + */ + public function hasParameter($name) + { + return array_key_exists($name, $this->parameters()); + } + + /** + * Get a given parameter from the route. + * + * @param string $name + * @param mixed $default + * @return string|object + */ + public function getParameter($name, $default = null) + { + return $this->parameter($name, $default); + } + + /** + * Get a given parameter from the route. + * + * @param string $name + * @param mixed $default + * @return string|object + */ + public function parameter($name, $default = null) + { + return Arr::get($this->parameters(), $name, $default); + } + + /** + * Set a parameter to the given value. + * + * @param string $name + * @param mixed $value + * @return void + */ + public function setParameter($name, $value) + { + $this->parameters(); + + $this->parameters[$name] = $value; + } + + /** + * Unset a parameter on the route if it is set. + * + * @param string $name + * @return void + */ + public function forgetParameter($name) + { + $this->parameters(); + + unset($this->parameters[$name]); + } + + /** + * Get the key / value list of parameters for the route. + * + * @return array + * + * @throws \LogicException + */ + public function parameters() + { + if (isset($this->parameters)) { + return array_map(function ($value) { + return is_string($value) ? rawurldecode($value) : $value; + }, $this->parameters); + } + + throw new LogicException('Route is not bound.'); + } + + /** + * Get the key / value list of parameters without null values. + * + * @return array + */ + public function parametersWithoutNulls() + { + return array_filter($this->parameters(), function ($p) { + return ! is_null($p); + }); + } + + /** + * Get all of the parameter names for the route. + * + * @return array + */ + public function parameterNames() + { + if (isset($this->parameterNames)) { + return $this->parameterNames; + } + + return $this->parameterNames = $this->compileParameterNames(); + } + + /** + * Get the parameter names for the route. + * + * @return array + */ + protected function compileParameterNames() + { + preg_match_all('/\{(.*?)\}/', $this->domain().$this->uri, $matches); + + return array_map(function ($m) { + return trim($m, '?'); + }, $matches[1]); + } + + /** + * Bind the route to a given request for execution. + * + * @param \Illuminate\Http\Request $request + * @return $this + */ + public function bind(Request $request) + { + $this->compileRoute(); + + $this->bindParameters($request); + + return $this; + } + + /** + * Extract the parameter list from the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function bindParameters(Request $request) + { + // If the route has a regular expression for the host part of the URI, we will + // compile that and get the parameter matches for this domain. We will then + // merge them into this parameters array so that this array is completed. + $params = $this->matchToKeys( + + array_slice($this->bindPathParameters($request), 1) + + ); + + // If the route has a regular expression for the host part of the URI, we will + // compile that and get the parameter matches for this domain. We will then + // merge them into this parameters array so that this array is completed. + if (! is_null($this->compiled->getHostRegex())) { + $params = $this->bindHostParameters( + $request, $params + ); + } + + return $this->parameters = $this->replaceDefaults($params); + } + + /** + * Get the parameter matches for the path portion of the URI. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function bindPathParameters(Request $request) + { + preg_match($this->compiled->getRegex(), '/'.$request->decodedPath(), $matches); + + return $matches; + } + + /** + * Extract the parameter list from the host part of the request. + * + * @param \Illuminate\Http\Request $request + * @param array $parameters + * @return array + */ + protected function bindHostParameters(Request $request, $parameters) + { + preg_match($this->compiled->getHostRegex(), $request->getHost(), $matches); + + return array_merge($this->matchToKeys(array_slice($matches, 1)), $parameters); + } + + /** + * Combine a set of parameter matches with the route's keys. + * + * @param array $matches + * @return array + */ + protected function matchToKeys(array $matches) + { + if (count($this->parameterNames()) == 0) { + return []; + } + + $parameters = array_intersect_key($matches, array_flip($this->parameterNames())); + + return array_filter($parameters, function ($value) { + return is_string($value) && strlen($value) > 0; + }); + } + + /** + * Replace null parameters with their defaults. + * + * @param array $parameters + * @return array + */ + protected function replaceDefaults(array $parameters) + { + foreach ($parameters as $key => &$value) { + $value = isset($value) ? $value : Arr::get($this->defaults, $key); + } + + foreach ($this->defaults as $key => $value) { + if (! isset($parameters[$key])) { + $parameters[$key] = $value; + } + } + + return $parameters; + } + + /** + * Parse the route action into a standard array. + * + * @param callable|array $action + * @return array + * + * @throws \UnexpectedValueException + */ + protected function parseAction($action) + { + // If the action is already a Closure instance, we will just set that instance + // as the "uses" property, because there is nothing else we need to do when + // it is available. Otherwise we will need to find it in the action list. + if (is_callable($action)) { + return ['uses' => $action]; + } + + // If no "uses" property has been set, we will dig through the array to find a + // Closure instance within this list. We will set the first Closure we come + // across into the "uses" property that will get fired off by this route. + elseif (! isset($action['uses'])) { + $action['uses'] = $this->findCallable($action); + } + + if (is_string($action['uses']) && ! Str::contains($action['uses'], '@')) { + throw new UnexpectedValueException(sprintf( + 'Invalid route action: [%s]', $action['uses'] + )); + } + + return $action; + } + + /** + * Find the callable in an action array. + * + * @param array $action + * @return callable + */ + protected function findCallable(array $action) + { + return Arr::first($action, function ($key, $value) { + return is_callable($value) && is_numeric($key); + }); + } + + /** + * Get the route validators for the instance. + * + * @return array + */ + public static function getValidators() + { + if (isset(static::$validators)) { + return static::$validators; + } + + // To match the route, we will use a chain of responsibility pattern with the + // validator implementations. We will spin through each one making sure it + // passes and then we will know if the route as a whole matches request. + return static::$validators = [ + new MethodValidator, new SchemeValidator, + new HostValidator, new UriValidator, + ]; + } + + /** + * Add before filters to the route. + * + * @param string $filters + * @return $this + * + * @deprecated since version 5.1. + */ + public function before($filters) + { + return $this->addFilters('before', $filters); + } + + /** + * Add after filters to the route. + * + * @param string $filters + * @return $this + * + * @deprecated since version 5.1. + */ + public function after($filters) + { + return $this->addFilters('after', $filters); + } + + /** + * Add the given filters to the route by type. + * + * @param string $type + * @param string $filters + * @return $this + */ + protected function addFilters($type, $filters) + { + $filters = static::explodeFilters($filters); + + if (isset($this->action[$type])) { + $existing = static::explodeFilters($this->action[$type]); + + $this->action[$type] = array_merge($existing, $filters); + } else { + $this->action[$type] = $filters; + } + + return $this; + } + + /** + * Set a default value for the route. + * + * @param string $key + * @param mixed $value + * @return $this + */ + public function defaults($key, $value) + { + $this->defaults[$key] = $value; + + return $this; + } + + /** + * Set a regular expression requirement on the route. + * + * @param array|string $name + * @param string $expression + * @return $this + */ + public function where($name, $expression = null) + { + foreach ($this->parseWhere($name, $expression) as $name => $expression) { + $this->wheres[$name] = $expression; + } + + return $this; + } + + /** + * Parse arguments to the where method into an array. + * + * @param array|string $name + * @param string $expression + * @return array + */ + protected function parseWhere($name, $expression) + { + return is_array($name) ? $name : [$name => $expression]; + } + + /** + * Set a list of regular expression requirements on the route. + * + * @param array $wheres + * @return $this + */ + protected function whereArray(array $wheres) + { + foreach ($wheres as $name => $expression) { + $this->where($name, $expression); + } + + return $this; + } + + /** + * Add a prefix to the route URI. + * + * @param string $prefix + * @return $this + */ + public function prefix($prefix) + { + $uri = rtrim($prefix, '/').'/'.ltrim($this->uri, '/'); + + $this->uri = trim($uri, '/'); + + return $this; + } + + /** + * Get the URI associated with the route. + * + * @return string + */ + public function getPath() + { + return $this->uri(); + } + + /** + * Get the URI associated with the route. + * + * @return string + */ + public function uri() + { + return $this->uri; + } + + /** + * Get the HTTP verbs the route responds to. + * + * @return array + */ + public function getMethods() + { + return $this->methods(); + } + + /** + * Get the HTTP verbs the route responds to. + * + * @return array + */ + public function methods() + { + return $this->methods; + } + + /** + * Determine if the route only responds to HTTP requests. + * + * @return bool + */ + public function httpOnly() + { + return in_array('http', $this->action, true); + } + + /** + * Determine if the route only responds to HTTPS requests. + * + * @return bool + */ + public function httpsOnly() + { + return $this->secure(); + } + + /** + * Determine if the route only responds to HTTPS requests. + * + * @return bool + */ + public function secure() + { + return in_array('https', $this->action, true); + } + + /** + * Get the domain defined for the route. + * + * @return string|null + */ + public function domain() + { + return isset($this->action['domain']) ? $this->action['domain'] : null; + } + + /** + * Get the URI that the route responds to. + * + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Set the URI that the route responds to. + * + * @param string $uri + * @return \Illuminate\Routing\Route + */ + public function setUri($uri) + { + $this->uri = $uri; + + return $this; + } + + /** + * Get the prefix of the route instance. + * + * @return string + */ + public function getPrefix() + { + return isset($this->action['prefix']) ? $this->action['prefix'] : null; + } + + /** + * Get the name of the route instance. + * + * @return string + */ + public function getName() + { + return isset($this->action['as']) ? $this->action['as'] : null; + } + + /** + * Add or change the route name. + * + * @param string $name + * @return $this + */ + public function name($name) + { + $this->action['as'] = isset($this->action['as']) ? $this->action['as'].$name : $name; + + return $this; + } + + /** + * Get the action name for the route. + * + * @return string + */ + public function getActionName() + { + return isset($this->action['controller']) ? $this->action['controller'] : 'Closure'; + } + + /** + * Get the action array for the route. + * + * @return array + */ + public function getAction() + { + return $this->action; + } + + /** + * Set the action array for the route. + * + * @param array $action + * @return $this + */ + public function setAction(array $action) + { + $this->action = $action; + + return $this; + } + + /** + * Get the compiled version of the route. + * + * @return \Symfony\Component\Routing\CompiledRoute + */ + public function getCompiled() + { + return $this->compiled; + } + + /** + * Set the container instance on the route. + * + * @param \Illuminate\Container\Container $container + * @return $this + */ + public function setContainer(Container $container) + { + $this->container = $container; + + return $this; + } + + /** + * Prepare the route instance for serialization. + * + * @return void + * + * @throws \LogicException + */ + public function prepareForSerialization() + { + if ($this->action['uses'] instanceof Closure) { + throw new LogicException("Unable to prepare route [{$this->uri}] for serialization. Uses Closure."); + } + + unset($this->container, $this->compiled); + } + + /** + * Dynamically access route parameters. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->parameter($key); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php b/application/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php index ebe74b6..4821a1f 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php @@ -1,302 +1,313 @@ -addToCollections($route); - - $this->addLookups($route); - - return $route; - } - - /** - * Add the given route to the arrays of routes. - * - * @param \Illuminate\Routing\Route $route - * @return void - */ - protected function addToCollections($route) - { - $domainAndUri = $route->domain().$route->getUri(); - - foreach ($route->methods() as $method) - { - $this->routes[$method][$domainAndUri] = $route; - } - - $this->allRoutes[$method.$domainAndUri] = $route; - } - - /** - * Add the route to any look-up tables if necessary. - * - * @param \Illuminate\Routing\Route $route - * @return void - */ - protected function addLookups($route) - { - // If the route has a name, we will add it to the name look-up table so that we - // will quickly be able to find any route associate with a name and not have - // to iterate through every route every time we need to perform a look-up. - $action = $route->getAction(); - - if (isset($action['as'])) - { - $this->nameList[$action['as']] = $route; - } - - // When the route is routing to a controller we will also store the action that - // is used by the route. This will let us reverse route to controllers while - // processing a request and easily generate URLs to the given controllers. - if (isset($action['controller'])) - { - $this->addToActionList($action, $route); - } - } - - /** - * Add a route to the controller action dictionary. - * - * @param array $action - * @param \Illuminate\Routing\Route $route - * @return void - */ - protected function addToActionList($action, $route) - { - $this->actionList[$action['controller']] = $route; - } - - /** - * Find the first route matching a given request. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Routing\Route - * - * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException - */ - public function match(Request $request) - { - $routes = $this->get($request->getMethod()); - - // First, we will see if we can find a matching route for this current request - // method. If we can, great, we can just return it so that it can be called - // by the consumer. Otherwise we will check for routes with another verb. - $route = $this->check($routes, $request); - - if ( ! is_null($route)) - { - return $route->bind($request); - } - - // If no route was found, we will check if a matching is route is specified on - // another HTTP verb. If it is we will need to throw a MethodNotAllowed and - // inform the user agent of which HTTP verb it should use for this route. - $others = $this->checkForAlternateVerbs($request); - - if (count($others) > 0) - { - return $this->getRouteForMethods($request, $others); - } - - throw new NotFoundHttpException; - } - - /** - * Determine if any routes match on another HTTP verb. - * - * @param \Illuminate\Http\Request $request - * @return array - */ - protected function checkForAlternateVerbs($request) - { - $methods = array_diff(Router::$verbs, array($request->getMethod())); - - // Here we will spin through all verbs except for the current request verb and - // check to see if any routes respond to them. If they do, we will return a - // proper error response with the correct headers on the response string. - $others = array(); - - foreach ($methods as $method) - { - if ( ! is_null($this->check($this->get($method), $request, false))) - { - $others[] = $method; - } - } - - return $others; - } - - /** - * Get a route (if necessary) that responds when other available methods are present. - * - * @param \Illuminate\Http\Request $request - * @param array $methods - * @return \Illuminate\Routing\Route - * - * @throws \Symfony\Component\Routing\Exception\MethodNotAllowedHttpException - */ - protected function getRouteForMethods($request, array $methods) - { - if ($request->method() == 'OPTIONS') - { - return (new Route('OPTIONS', $request->path(), function() use ($methods) - { - return new Response('', 200, array('Allow' => implode(',', $methods))); - - }))->bind($request); - } - - $this->methodNotAllowed($methods); - } - - /** - * Throw a method not allowed HTTP exception. - * - * @param array $others - * @return void - * - * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException - */ - protected function methodNotAllowed(array $others) - { - throw new MethodNotAllowedHttpException($others); - } - - /** - * Determine if a route in the array matches the request. - * - * @param array $routes - * @param \Illuminate\http\Request $request - * @param bool $includingMethod - * @return \Illuminate\Routing\Route|null - */ - protected function check(array $routes, $request, $includingMethod = true) - { - return array_first($routes, function($key, $value) use ($request, $includingMethod) - { - return $value->matches($request, $includingMethod); - }); - } - - /** - * Get all of the routes in the collection. - * - * @param string|null $method - * @return array - */ - protected function get($method = null) - { - if (is_null($method)) return $this->getRoutes(); - - return array_get($this->routes, $method, array()); - } - - /** - * Determine if the route collection contains a given named route. - * - * @param string $name - * @return bool - */ - public function hasNamedRoute($name) - { - return ! is_null($this->getByName($name)); - } - - /** - * Get a route instance by its name. - * - * @param string $name - * @return \Illuminate\Routing\Route|null - */ - public function getByName($name) - { - return isset($this->nameList[$name]) ? $this->nameList[$name] : null; - } - - /** - * Get a route instance by its controller action. - * - * @param string $action - * @return \Illuminate\Routing\Route|null - */ - public function getByAction($action) - { - return isset($this->actionList[$action]) ? $this->actionList[$action] : null; - } - - /** - * Get all of the routes in the collection. - * - * @return array - */ - public function getRoutes() - { - return array_values($this->allRoutes); - } - - /** - * Get an iterator for the items. - * - * @return \ArrayIterator - */ - public function getIterator() - { - return new ArrayIterator($this->getRoutes()); - } - - /** - * Count the number of items in the collection. - * - * @return int - */ - public function count() - { - return count($this->getRoutes()); - } - +class RouteCollection implements Countable, IteratorAggregate +{ + /** + * An array of the routes keyed by method. + * + * @var array + */ + protected $routes = []; + + /** + * An flattened array of all of the routes. + * + * @var array + */ + protected $allRoutes = []; + + /** + * A look-up table of routes by their names. + * + * @var array + */ + protected $nameList = []; + + /** + * A look-up table of routes by controller action. + * + * @var array + */ + protected $actionList = []; + + /** + * Add a Route instance to the collection. + * + * @param \Illuminate\Routing\Route $route + * @return \Illuminate\Routing\Route + */ + public function add(Route $route) + { + $this->addToCollections($route); + + $this->addLookups($route); + + return $route; + } + + /** + * Add the given route to the arrays of routes. + * + * @param \Illuminate\Routing\Route $route + * @return void + */ + protected function addToCollections($route) + { + $domainAndUri = $route->domain().$route->getUri(); + + foreach ($route->methods() as $method) { + $this->routes[$method][$domainAndUri] = $route; + } + + $this->allRoutes[$method.$domainAndUri] = $route; + } + + /** + * Add the route to any look-up tables if necessary. + * + * @param \Illuminate\Routing\Route $route + * @return void + */ + protected function addLookups($route) + { + // If the route has a name, we will add it to the name look-up table so that we + // will quickly be able to find any route associate with a name and not have + // to iterate through every route every time we need to perform a look-up. + $action = $route->getAction(); + + if (isset($action['as'])) { + $this->nameList[$action['as']] = $route; + } + + // When the route is routing to a controller we will also store the action that + // is used by the route. This will let us reverse route to controllers while + // processing a request and easily generate URLs to the given controllers. + if (isset($action['controller'])) { + $this->addToActionList($action, $route); + } + } + + /** + * Refresh the name look-up table. + * + * This is done in case any names are fluently defined. + * + * @return void + */ + public function refreshNameLookups() + { + $this->nameList = []; + + foreach ($this->allRoutes as $route) { + if ($route->getName()) { + $this->nameList[$route->getName()] = $route; + } + } + } + + /** + * Add a route to the controller action dictionary. + * + * @param array $action + * @param \Illuminate\Routing\Route $route + * @return void + */ + protected function addToActionList($action, $route) + { + $this->actionList[trim($action['controller'], '\\')] = $route; + } + + /** + * Find the first route matching a given request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Routing\Route + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + public function match(Request $request) + { + $routes = $this->get($request->getMethod()); + + // First, we will see if we can find a matching route for this current request + // method. If we can, great, we can just return it so that it can be called + // by the consumer. Otherwise we will check for routes with another verb. + $route = $this->check($routes, $request); + + if (! is_null($route)) { + return $route->bind($request); + } + + // If no route was found we will now check if a matching route is specified by + // another HTTP verb. If it is we will need to throw a MethodNotAllowed and + // inform the user agent of which HTTP verb it should use for this route. + $others = $this->checkForAlternateVerbs($request); + + if (count($others) > 0) { + return $this->getRouteForMethods($request, $others); + } + + throw new NotFoundHttpException; + } + + /** + * Determine if any routes match on another HTTP verb. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function checkForAlternateVerbs($request) + { + $methods = array_diff(Router::$verbs, [$request->getMethod()]); + + // Here we will spin through all verbs except for the current request verb and + // check to see if any routes respond to them. If they do, we will return a + // proper error response with the correct headers on the response string. + $others = []; + + foreach ($methods as $method) { + if (! is_null($this->check($this->get($method), $request, false))) { + $others[] = $method; + } + } + + return $others; + } + + /** + * Get a route (if necessary) that responds when other available methods are present. + * + * @param \Illuminate\Http\Request $request + * @param array $methods + * @return \Illuminate\Routing\Route + * + * @throws \Symfony\Component\Routing\Exception\MethodNotAllowedHttpException + */ + protected function getRouteForMethods($request, array $methods) + { + if ($request->method() == 'OPTIONS') { + return (new Route('OPTIONS', $request->path(), function () use ($methods) { + return new Response('', 200, ['Allow' => implode(',', $methods)]); + }))->bind($request); + } + + $this->methodNotAllowed($methods); + } + + /** + * Throw a method not allowed HTTP exception. + * + * @param array $others + * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException + */ + protected function methodNotAllowed(array $others) + { + throw new MethodNotAllowedHttpException($others); + } + + /** + * Determine if a route in the array matches the request. + * + * @param array $routes + * @param \Illuminate\http\Request $request + * @param bool $includingMethod + * @return \Illuminate\Routing\Route|null + */ + protected function check(array $routes, $request, $includingMethod = true) + { + return Arr::first($routes, function ($key, $value) use ($request, $includingMethod) { + return $value->matches($request, $includingMethod); + }); + } + + /** + * Get all of the routes in the collection. + * + * @param string|null $method + * @return array + */ + protected function get($method = null) + { + if (is_null($method)) { + return $this->getRoutes(); + } + + return Arr::get($this->routes, $method, []); + } + + /** + * Determine if the route collection contains a given named route. + * + * @param string $name + * @return bool + */ + public function hasNamedRoute($name) + { + return ! is_null($this->getByName($name)); + } + + /** + * Get a route instance by its name. + * + * @param string $name + * @return \Illuminate\Routing\Route|null + */ + public function getByName($name) + { + return isset($this->nameList[$name]) ? $this->nameList[$name] : null; + } + + /** + * Get a route instance by its controller action. + * + * @param string $action + * @return \Illuminate\Routing\Route|null + */ + public function getByAction($action) + { + return isset($this->actionList[$action]) ? $this->actionList[$action] : null; + } + + /** + * Get all of the routes in the collection. + * + * @return array + */ + public function getRoutes() + { + return array_values($this->allRoutes); + } + + /** + * Get an iterator for the items. + * + * @return \ArrayIterator + */ + public function getIterator() + { + return new ArrayIterator($this->getRoutes()); + } + + /** + * Count the number of items in the collection. + * + * @return int + */ + public function count() + { + return count($this->getRoutes()); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php b/application/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php index 088b23c..9ab742a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php @@ -1,81 +1,149 @@ -resolveClassMethodDependencies([], $instance, $method) + ); + } + + /** + * Resolve the object method's type-hinted dependencies. + * + * @param array $parameters + * @param object $instance + * @param string $method + * @return array + */ + protected function resolveClassMethodDependencies(array $parameters, $instance, $method) + { + if (! method_exists($instance, $method)) { + return $parameters; + } + + return $this->resolveMethodDependencies( + $parameters, new ReflectionMethod($instance, $method) + ); + } + + /** + * Resolve the given method's type-hinted dependencies. + * + * @param array $parameters + * @param \ReflectionFunctionAbstract $reflector + * @return array + */ + public function resolveMethodDependencies(array $parameters, ReflectionFunctionAbstract $reflector) + { + $originalParameters = $parameters; -trait RouteDependencyResolverTrait { + foreach ($reflector->getParameters() as $key => $parameter) { + $instance = $this->transformDependency( + $parameter, $parameters, $originalParameters + ); - /** - * Call a class method with the resolved dependencies. - * - * @param object $instance - * @param string $method - * @return mixed - */ - protected function callWithDependencies($instance, $method) - { - return call_user_func_array( - [$instance, $method], $this->resolveClassMethodDependencies([], $instance, $method) - ); - } + if (! is_null($instance)) { + $this->spliceIntoParameters($parameters, $key, $instance); + } + } - /** - * Resolve the object method's type-hinted dependencies. - * - * @param array $parameters - * @param object $instance - * @param string $method - * @return array - */ - protected function resolveClassMethodDependencies(array $parameters, $instance, $method) - { - if ( ! method_exists($instance, $method)) return $parameters; + return $parameters; + } - return $this->resolveMethodDependencies( - $parameters, new ReflectionMethod($instance, $method) - ); - } + /** + * Attempt to transform the given parameter into a class instance. + * + * @param \ReflectionParameter $parameter + * @param array $parameters + * @param array $originalParameters + * @return mixed + */ + protected function transformDependency(ReflectionParameter $parameter, $parameters, $originalParameters) + { + $class = $parameter->getClass(); - /** - * Resolve the given method's type-hinted dependencies. - * - * @param array $parameters - * @param \ReflectionFunctionAbstract $reflector - * @return array - */ - public function resolveMethodDependencies(array $parameters, ReflectionFunctionAbstract $reflector) - { - foreach ($reflector->getParameters() as $key => $parameter) - { - // If the parameter has a type-hinted class, we will check to see if it is already in - // the list of parameters. If it is we will just skip it as it is probably a model - // binding and we do not want to mess with those; otherwise, we resolve it here. - $class = $parameter->getClass(); + // If the parameter has a type-hinted class, we will check to see if it is already in + // the list of parameters. If it is we will just skip it as it is probably a model + // binding and we do not want to mess with those; otherwise, we resolve it here. + if ($class && ! $this->alreadyInParameters($class->name, $parameters)) { + return $this->container->make($class->name); + } + } - if ($class && ! $this->alreadyInParameters($class->name, $parameters)) - { - array_splice( - $parameters, $key, 0, [$this->container->make($class->name)] - ); - } - } + /** + * Determine if the given type-hinted class is an implict Eloquent binding. + * + * Must not already be resolved in the parameter list by an explicit model binding. + * + * @param \ReflectionClass $class + * @param array $parameters + * @return bool + */ + protected function vacantEloquentParameter(ReflectionClass $class, array $parameters) + { + return $class->isSubclassOf(Model::class) && + ! $this->alreadyInParameters($class->name, $parameters); + } - return $parameters; - } + /** + * Extract an implicit model binding's key out of the parameter list. + * + * @param \ReflectionParameter $parameter + * @param array $originalParameters + * + * @return mixed + */ + protected function extractModelIdentifier(ReflectionParameter $parameter, array $originalParameters) + { + return Arr::first($originalParameters, function ($parameterKey) use ($parameter) { + return $parameterKey === $parameter->name; + }); + } - /** - * Determine if an object of the given class is in a list of parameters. - * - * @param string $class - * @param array $parameters - * @return bool - */ - protected function alreadyInParameters($class, array $parameters) - { - return ! is_null(array_first($parameters, function($key, $value) use ($class) - { - return $value instanceof $class; - })); - } + /** + * Determine if an object of the given class is in a list of parameters. + * + * @param string $class + * @param array $parameters + * @return bool + */ + protected function alreadyInParameters($class, array $parameters) + { + return ! is_null(Arr::first($parameters, function ($key, $value) use ($class) { + return $value instanceof $class; + })); + } + /** + * Splice the given value into the parameter list. + * + * @param array $parameters + * @param string $key + * @param mixed $instance + * @return void + */ + protected function spliceIntoParameters(array &$parameters, $key, $instance) + { + array_splice( + $parameters, $key, 0, [$instance] + ); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/Router.php b/application/vendor/laravel/framework/src/Illuminate/Routing/Router.php index f9ef877..d6aacb4 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/Router.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/Router.php @@ -1,6 +1,10 @@ -events = $events; - $this->routes = new RouteCollection; - $this->container = $container ?: new Container; - } - - /** - * Register a new GET route with the router. - * - * @param string $uri - * @param \Closure|array|string $action - * @return \Illuminate\Routing\Route - */ - public function get($uri, $action) - { - return $this->addRoute(['GET', 'HEAD'], $uri, $action); - } - - /** - * Register a new POST route with the router. - * - * @param string $uri - * @param \Closure|array|string $action - * @return \Illuminate\Routing\Route - */ - public function post($uri, $action) - { - return $this->addRoute('POST', $uri, $action); - } - - /** - * Register a new PUT route with the router. - * - * @param string $uri - * @param \Closure|array|string $action - * @return \Illuminate\Routing\Route - */ - public function put($uri, $action) - { - return $this->addRoute('PUT', $uri, $action); - } - - /** - * Register a new PATCH route with the router. - * - * @param string $uri - * @param \Closure|array|string $action - * @return \Illuminate\Routing\Route - */ - public function patch($uri, $action) - { - return $this->addRoute('PATCH', $uri, $action); - } - - /** - * Register a new DELETE route with the router. - * - * @param string $uri - * @param \Closure|array|string $action - * @return \Illuminate\Routing\Route - */ - public function delete($uri, $action) - { - return $this->addRoute('DELETE', $uri, $action); - } - - /** - * Register a new OPTIONS route with the router. - * - * @param string $uri - * @param \Closure|array|string $action - * @return \Illuminate\Routing\Route - */ - public function options($uri, $action) - { - return $this->addRoute('OPTIONS', $uri, $action); - } - - /** - * Register a new route responding to all verbs. - * - * @param string $uri - * @param \Closure|array|string $action - * @return \Illuminate\Routing\Route - */ - public function any($uri, $action) - { - $verbs = array('GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE'); - - return $this->addRoute($verbs, $uri, $action); - } - - /** - * Register a new route with the given verbs. - * - * @param array|string $methods - * @param string $uri - * @param \Closure|array|string $action - * @return \Illuminate\Routing\Route - */ - public function match($methods, $uri, $action) - { - return $this->addRoute(array_map('strtoupper', (array) $methods), $uri, $action); - } - - /** - * Register an array of controllers with wildcard routing. - * - * @param array $controllers - * @return void - */ - public function controllers(array $controllers) - { - foreach ($controllers as $uri => $controller) - { - $this->controller($uri, $controller); - } - } - - /** - * Route a controller to a URI with wildcard routing. - * - * @param string $uri - * @param string $controller - * @param array $names - * @return void - */ - public function controller($uri, $controller, $names = array()) - { - $prepended = $controller; - - // First, we will check to see if a controller prefix has been registered in - // the route group. If it has, we will need to prefix it before trying to - // reflect into the class instance and pull out the method for routing. - if ( ! empty($this->groupStack)) - { - $prepended = $this->prependGroupUses($controller); - } - - $routable = (new ControllerInspector) - ->getRoutable($prepended, $uri); - - // When a controller is routed using this method, we use Reflection to parse - // out all of the routable methods for the controller, then register each - // route explicitly for the developers, so reverse routing is possible. - foreach ($routable as $method => $routes) - { - foreach ($routes as $route) - { - $this->registerInspected($route, $controller, $method, $names); - } - } - - $this->addFallthroughRoute($controller, $uri); - } - - /** - * Register an inspected controller route. - * - * @param array $route - * @param string $controller - * @param string $method - * @param array $names - * @return void - */ - protected function registerInspected($route, $controller, $method, &$names) - { - $action = array('uses' => $controller.'@'.$method); - - // If a given controller method has been named, we will assign the name to the - // controller action array, which provides for a short-cut to method naming - // so you don't have to define an individual route for these controllers. - $action['as'] = array_get($names, $method); - - $this->{$route['verb']}($route['uri'], $action); - } - - /** - * Add a fallthrough route for a controller. - * - * @param string $controller - * @param string $uri - * @return void - */ - protected function addFallthroughRoute($controller, $uri) - { - $missing = $this->any($uri.'/{_missing}', $controller.'@missingMethod'); - - $missing->where('_missing', '(.*)'); - } - - /** - * Register an array of resource controllers. - * - * @param array $resources - * @return void - */ - public function resources(array $resources) - { - foreach ($resources as $name => $controller) - { - $this->resource($name, $controller); - } - } - - /** - * Route a resource to a controller. - * - * @param string $name - * @param string $controller - * @param array $options - * @return void - */ - public function resource($name, $controller, array $options = array()) - { - if ($this->container && $this->container->bound('Illuminate\Routing\ResourceRegistrar')) - { - $registrar = $this->container->make('Illuminate\Routing\ResourceRegistrar'); - } - else - { - $registrar = new ResourceRegistrar($this); - } - - $registrar->register($name, $controller, $options); - } - - /** - * Create a route group with shared attributes. - * - * @param array $attributes - * @param \Closure $callback - * @return void - */ - public function group(array $attributes, Closure $callback) - { - $this->updateGroupStack($attributes); - - // Once we have updated the group stack, we will execute the user Closure and - // merge in the groups attributes when the route is created. After we have - // run the callback, we will pop the attributes off of this group stack. - call_user_func($callback, $this); - - array_pop($this->groupStack); - } - - /** - * Update the group stack with the given attributes. - * - * @param array $attributes - * @return void - */ - protected function updateGroupStack(array $attributes) - { - if ( ! empty($this->groupStack)) - { - $attributes = $this->mergeGroup($attributes, last($this->groupStack)); - } - - $this->groupStack[] = $attributes; - } - - /** - * Merge the given array with the last group stack. - * - * @param array $new - * @return array - */ - public function mergeWithLastGroup($new) - { - return $this->mergeGroup($new, last($this->groupStack)); - } - - /** - * Merge the given group attributes. - * - * @param array $new - * @param array $old - * @return array - */ - public static function mergeGroup($new, $old) - { - $new['namespace'] = static::formatUsesPrefix($new, $old); - - $new['prefix'] = static::formatGroupPrefix($new, $old); - - if (isset($new['domain'])) unset($old['domain']); - - $new['where'] = array_merge(array_get($old, 'where', []), array_get($new, 'where', [])); - - return array_merge_recursive(array_except($old, array('namespace', 'prefix', 'where')), $new); - } - - /** - * Format the uses prefix for the new group attributes. - * - * @param array $new - * @param array $old - * @return string - */ - protected static function formatUsesPrefix($new, $old) - { - if (isset($new['namespace']) && isset($old['namespace'])) - { - return trim(array_get($old, 'namespace'), '\\').'\\'.trim($new['namespace'], '\\'); - } - elseif (isset($new['namespace'])) - { - return trim($new['namespace'], '\\'); - } - - return array_get($old, 'namespace'); - } - - /** - * Format the prefix for the new group attributes. - * - * @param array $new - * @param array $old - * @return string - */ - protected static function formatGroupPrefix($new, $old) - { - if (isset($new['prefix'])) - { - return trim(array_get($old, 'prefix'), '/').'/'.trim($new['prefix'], '/'); - } - - return array_get($old, 'prefix'); - } - - /** - * Get the prefix from the last group on the stack. - * - * @return string - */ - public function getLastGroupPrefix() - { - if ( ! empty($this->groupStack)) - { - $last = end($this->groupStack); - - return isset($last['prefix']) ? $last['prefix'] : ''; - } - - return ''; - } - - /** - * Add a route to the underlying route collection. - * - * @param array|string $methods - * @param string $uri - * @param \Closure|array|string $action - * @return \Illuminate\Routing\Route - */ - protected function addRoute($methods, $uri, $action) - { - return $this->routes->add($this->createRoute($methods, $uri, $action)); - } - - /** - * Create a new route instance. - * - * @param array|string $methods - * @param string $uri - * @param mixed $action - * @return \Illuminate\Routing\Route - */ - protected function createRoute($methods, $uri, $action) - { - // If the route is routing to a controller we will parse the route action into - // an acceptable array format before registering it and creating this route - // instance itself. We need to build the Closure that will call this out. - if ($this->actionReferencesController($action)) - { - $action = $this->convertToControllerAction($action); - } - - $route = $this->newRoute( - $methods, $this->prefix($uri), $action - ); - - // If we have groups that need to be merged, we will merge them now after this - // route has already been created and is ready to go. After we're done with - // the merge we will be ready to return the route back out to the caller. - if ($this->hasGroupStack()) - { - $this->mergeGroupAttributesIntoRoute($route); - } - - $this->addWhereClausesToRoute($route); - - return $route; - } - - /** - * Create a new Route object. - * - * @param array|string $methods - * @param string $uri - * @param mixed $action - * @return \Illuminate\Routing\Route - */ - protected function newRoute($methods, $uri, $action) - { - return (new Route($methods, $uri, $action))->setContainer($this->container); - } - - /** - * Prefix the given URI with the last prefix. - * - * @param string $uri - * @return string - */ - protected function prefix($uri) - { - return trim(trim($this->getLastGroupPrefix(), '/').'/'.trim($uri, '/'), '/') ?: '/'; - } - - /** - * Add the necessary where clauses to the route based on its initial registration. - * - * @param \Illuminate\Routing\Route $route - * @return \Illuminate\Routing\Route - */ - protected function addWhereClausesToRoute($route) - { - $route->where( - array_merge($this->patterns, array_get($route->getAction(), 'where', [])) - ); - - return $route; - } - - /** - * Merge the group stack with the controller action. - * - * @param \Illuminate\Routing\Route $route - * @return void - */ - protected function mergeGroupAttributesIntoRoute($route) - { - $action = $this->mergeWithLastGroup($route->getAction()); - - $route->setAction($action); - } - - /** - * Determine if the action is routing to a controller. - * - * @param array $action - * @return bool - */ - protected function actionReferencesController($action) - { - if ($action instanceof Closure) return false; - - return is_string($action) || is_string(array_get($action, 'uses')); - } - - /** - * Add a controller based route action to the action array. - * - * @param array|string $action - * @return array - */ - protected function convertToControllerAction($action) - { - if (is_string($action)) $action = array('uses' => $action); - - // Here we'll merge any group "uses" statement if necessary so that the action - // has the proper clause for this property. Then we can simply set the name - // of the controller on the action and return the action array for usage. - if ( ! empty($this->groupStack)) - { - $action['uses'] = $this->prependGroupUses($action['uses']); - } - - // Here we will set this controller name on the action array just so we always - // have a copy of it for reference if we need it. This can be used while we - // search for a controller name or do some other type of fetch operation. - $action['controller'] = $action['uses']; - - return $action; - } - - /** - * Prepend the last group uses onto the use clause. - * - * @param string $uses - * @return string - */ - protected function prependGroupUses($uses) - { - $group = last($this->groupStack); - - return isset($group['namespace']) && strpos($uses, '\\') !== 0 ? $group['namespace'].'\\'.$uses : $uses; - } - - /** - * Dispatch the request to the application. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function dispatch(Request $request) - { - $this->currentRequest = $request; - - // If no response was returned from the before filter, we will call the proper - // route instance to get the response. If no route is found a response will - // still get returned based on why no routes were found for this request. - $response = $this->callFilter('before', $request); - - if (is_null($response)) - { - $response = $this->dispatchToRoute($request); - } - - // Once this route has run and the response has been prepared, we will run the - // after filter to do any last work on the response or for this application - // before we will return the response back to the consuming code for use. - $response = $this->prepareResponse($request, $response); - - $this->callFilter('after', $request, $response); - - return $response; - } - - /** - * Dispatch the request to a route and return the response. - * - * @param \Illuminate\Http\Request $request - * @return mixed - */ - public function dispatchToRoute(Request $request) - { - // First we will find a route that matches this request. We will also set the - // route resolver on the request so middlewares assigned to the route will - // receive access to this route instance for checking of the parameters. - $route = $this->findRoute($request); - - $request->setRouteResolver(function() use ($route) - { - return $route; - }); - - $this->events->fire('router.matched', [$route, $request]); - - // Once we have successfully matched the incoming request to a given route we - // can call the before filters on that route. This works similar to global - // filters in that if a response is returned we will not call the route. - $response = $this->callRouteBefore($route, $request); - - if (is_null($response)) - { - $response = $this->runRouteWithinStack( - $route, $request - ); - } - - $response = $this->prepareResponse($request, $response); - - // After we have a prepared response from the route or filter we will call to - // the "after" filters to do any last minute processing on this request or - // response object before the response is returned back to the consumer. - $this->callRouteAfter($route, $request, $response); - - return $response; - } - - /** - * Run the given route within a Stack "onion" instance. - * - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @return mixed - */ - protected function runRouteWithinStack(Route $route, Request $request) - { - $middleware = $this->gatherRouteMiddlewares($route); - - return (new Pipeline($this->container)) - ->send($request) - ->through($middleware) - ->then(function($request) use ($route) - { - return $this->prepareResponse( - $request, - $route->run($request) - ); - }); - } - - /** - * Gather the middleware for the given route. - * - * @param \Illuminate\Routing\Route $route - * @return array - */ - public function gatherRouteMiddlewares(Route $route) - { - return Collection::make($route->middleware())->map(function($m) - { - return Collection::make(array_get($this->middleware, $m, $m)); - - })->collapse()->all(); - } - - /** - * Find the route matching a given request. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Routing\Route - */ - protected function findRoute($request) - { - $this->current = $route = $this->routes->match($request); - - $this->container->instance('Illuminate\Routing\Route', $route); - - return $this->substituteBindings($route); - } - - /** - * Substitute the route bindings onto the route. - * - * @param \Illuminate\Routing\Route $route - * @return \Illuminate\Routing\Route - */ - protected function substituteBindings($route) - { - foreach ($route->parameters() as $key => $value) - { - if (isset($this->binders[$key])) - { - $route->setParameter($key, $this->performBinding($key, $value, $route)); - } - } - - return $route; - } - - /** - * Call the binding callback for the given key. - * - * @param string $key - * @param string $value - * @param \Illuminate\Routing\Route $route - * @return mixed - */ - protected function performBinding($key, $value, $route) - { - return call_user_func($this->binders[$key], $value, $route); - } - - /** - * Register a route matched event listener. - * - * @param string|callable $callback - * @return void - */ - public function matched($callback) - { - $this->events->listen('router.matched', $callback); - } - - /** - * Register a new "before" filter with the router. - * - * @param string|callable $callback - * @return void - */ - public function before($callback) - { - $this->addGlobalFilter('before', $callback); - } - - /** - * Register a new "after" filter with the router. - * - * @param string|callable $callback - * @return void - */ - public function after($callback) - { - $this->addGlobalFilter('after', $callback); - } - - /** - * Register a new global filter with the router. - * - * @param string $filter - * @param string|callable $callback - * @return void - */ - protected function addGlobalFilter($filter, $callback) - { - $this->events->listen('router.'.$filter, $this->parseFilter($callback)); - } - - /** - * Get all of the defined middleware short-hand names. - * - * @return array - */ - public function getMiddleware() - { - return $this->middleware; - } - - /** - * Register a short-hand name for a middleware. - * - * @param string $name - * @param string $class - * @return $this - */ - public function middleware($name, $class) - { - $this->middleware[$name] = $class; - - return $this; - } - - /** - * Register a new filter with the router. - * - * @param string $name - * @param string|callable $callback - * @return void - */ - public function filter($name, $callback) - { - $this->events->listen('router.filter: '.$name, $this->parseFilter($callback)); - } - - /** - * Parse the registered filter. - * - * @param callable|string $callback - * @return mixed - */ - protected function parseFilter($callback) - { - if (is_string($callback) && ! str_contains($callback, '@')) - { - return $callback.'@filter'; - } - - return $callback; - } - - /** - * Register a pattern-based filter with the router. - * - * @param string $pattern - * @param string $name - * @param array|null $methods - * @return void - */ - public function when($pattern, $name, $methods = null) - { - if ( ! is_null($methods)) $methods = array_map('strtoupper', (array) $methods); - - $this->patternFilters[$pattern][] = compact('name', 'methods'); - } - - /** - * Register a regular expression based filter with the router. - * - * @param string $pattern - * @param string $name - * @param array|null $methods - * @return void - */ - public function whenRegex($pattern, $name, $methods = null) - { - if ( ! is_null($methods)) $methods = array_map('strtoupper', (array) $methods); - - $this->regexFilters[$pattern][] = compact('name', 'methods'); - } - - /** - * Register a model binder for a wildcard. - * - * @param string $key - * @param string $class - * @param \Closure|null $callback - * @return void - * - * @throws NotFoundHttpException - */ - public function model($key, $class, Closure $callback = null) - { - $this->bind($key, function($value) use ($class, $callback) - { - if (is_null($value)) return; - - // For model binders, we will attempt to retrieve the models using the first - // method on the model instance. If we cannot retrieve the models we'll - // throw a not found exception otherwise we will return the instance. - if ($model = (new $class)->find($value)) - { - return $model; - } - - // If a callback was supplied to the method we will call that to determine - // what we should do when the model is not found. This just gives these - // developer a little greater flexibility to decide what will happen. - if ($callback instanceof Closure) - { - return call_user_func($callback, $value); - } - - throw new NotFoundHttpException; - }); - } - - /** - * Add a new route parameter binder. - * - * @param string $key - * @param string|callable $binder - * @return void - */ - public function bind($key, $binder) - { - if (is_string($binder)) - { - $binder = $this->createClassBinding($binder); - } - - $this->binders[str_replace('-', '_', $key)] = $binder; - } - - /** - * Create a class based binding using the IoC container. - * - * @param string $binding - * @return \Closure - */ - public function createClassBinding($binding) - { - return function($value, $route) use ($binding) - { - // If the binding has an @ sign, we will assume it's being used to delimit - // the class name from the bind method name. This allows for bindings - // to run multiple bind methods in a single class for convenience. - $segments = explode('@', $binding); - - $method = count($segments) == 2 ? $segments[1] : 'bind'; - - $callable = [$this->container->make($segments[0]), $method]; - - return call_user_func($callable, $value, $route); - }; - } - - /** - * Set a global where pattern on all routes. - * - * @param string $key - * @param string $pattern - * @return void - */ - public function pattern($key, $pattern) - { - $this->patterns[$key] = $pattern; - } - - /** - * Set a group of global where patterns on all routes. - * - * @param array $patterns - * @return void - */ - public function patterns($patterns) - { - foreach ($patterns as $key => $pattern) - { - $this->pattern($key, $pattern); - } - } - - /** - * Call the given filter with the request and response. - * - * @param string $filter - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Http\Response $response - * @return mixed - */ - protected function callFilter($filter, $request, $response = null) - { - return $this->events->until('router.'.$filter, array($request, $response)); - } - - /** - * Call the given route's before filters. - * - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @return mixed - */ - public function callRouteBefore($route, $request) - { - $response = $this->callPatternFilters($route, $request); - - return $response ?: $this->callAttachedBefores($route, $request); - } - - /** - * Call the pattern based filters for the request. - * - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @return mixed|null - */ - protected function callPatternFilters($route, $request) - { - foreach ($this->findPatternFilters($request) as $filter => $parameters) - { - $response = $this->callRouteFilter($filter, $parameters, $route, $request); - - if ( ! is_null($response)) return $response; - } - } - - /** - * Find the patterned filters matching a request. - * - * @param \Illuminate\Http\Request $request - * @return array - */ - public function findPatternFilters($request) - { - $results = array(); - - list($path, $method) = array($request->path(), $request->getMethod()); - - foreach ($this->patternFilters as $pattern => $filters) - { - // To find the patterned middlewares for a request, we just need to check these - // registered patterns against the path info for the current request to this - // applications, and when it matches we will merge into these middlewares. - if (str_is($pattern, $path)) - { - $merge = $this->patternsByMethod($method, $filters); - - $results = array_merge($results, $merge); - } - } - - foreach ($this->regexFilters as $pattern => $filters) - { - // To find the patterned middlewares for a request, we just need to check these - // registered patterns against the path info for the current request to this - // applications, and when it matches we will merge into these middlewares. - if (preg_match($pattern, $path)) - { - $merge = $this->patternsByMethod($method, $filters); - - $results = array_merge($results, $merge); - } - } - - return $results; - } - - /** - * Filter pattern filters that don't apply to the request verb. - * - * @param string $method - * @param array $filters - * @return array - */ - protected function patternsByMethod($method, $filters) - { - $results = array(); - - foreach ($filters as $filter) - { - // The idea here is to check and see if the pattern filter applies to this HTTP - // request based on the request methods. Pattern filters might be limited by - // the request verb to make it simply to assign to the given verb at once. - if ($this->filterSupportsMethod($filter, $method)) - { - $parsed = Route::parseFilters($filter['name']); - - $results = array_merge($results, $parsed); - } - } - - return $results; - } - - /** - * Determine if the given pattern filters applies to a given method. - * - * @param array $filter - * @param array $method - * @return bool - */ - protected function filterSupportsMethod($filter, $method) - { - $methods = $filter['methods']; - - return is_null($methods) || in_array($method, $methods); - } - - /** - * Call the given route's before (non-pattern) filters. - * - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @return mixed - */ - protected function callAttachedBefores($route, $request) - { - foreach ($route->beforeFilters() as $filter => $parameters) - { - $response = $this->callRouteFilter($filter, $parameters, $route, $request); - - if ( ! is_null($response)) return $response; - } - } - - /** - * Call the given route's after filters. - * - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Http\Response $response - * @return mixed - */ - public function callRouteAfter($route, $request, $response) - { - foreach ($route->afterFilters() as $filter => $parameters) - { - $this->callRouteFilter($filter, $parameters, $route, $request, $response); - } - } - - /** - * Call the given route filter. - * - * @param string $filter - * @param array $parameters - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Http\Response|null $response - * @return mixed - */ - public function callRouteFilter($filter, $parameters, $route, $request, $response = null) - { - $data = array_merge(array($route, $request, $response), $parameters); - - return $this->events->until('router.filter: '.$filter, $this->cleanFilterParameters($data)); - } - - /** - * Clean the parameters being passed to a filter callback. - * - * @param array $parameters - * @return array - */ - protected function cleanFilterParameters(array $parameters) - { - return array_filter($parameters, function($p) - { - return ! is_null($p) && $p !== ''; - }); - } - - /** - * Create a response instance from the given value. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param mixed $response - * @return \Illuminate\Http\Response - */ - protected function prepareResponse($request, $response) - { - if ( ! $response instanceof SymfonyResponse) - { - $response = new Response($response); - } - - return $response->prepare($request); - } - - /** - * Determine if the router currently has a group stack. - * - * @return bool - */ - public function hasGroupStack() - { - return ! empty($this->groupStack); - } - - /** - * Get the current group stack for the router. - * - * @return array - */ - public function getGroupStack() - { - return $this->groupStack; - } - - /** - * Get a route parameter for the current route. - * - * @param string $key - * @param string $default - * @return mixed - */ - public function input($key, $default = null) - { - return $this->current()->parameter($key, $default); - } - - /** - * Get the currently dispatched route instance. - * - * @return \Illuminate\Routing\Route - */ - public function getCurrentRoute() - { - return $this->current(); - } - - /** - * Get the currently dispatched route instance. - * - * @return \Illuminate\Routing\Route - */ - public function current() - { - return $this->current; - } - - /** - * Check if a route with the given name exists. - * - * @param string $name - * @return bool - */ - public function has($name) - { - return $this->routes->hasNamedRoute($name); - } - - /** - * Get the current route name. - * - * @return string|null - */ - public function currentRouteName() - { - return $this->current() ? $this->current()->getName() : null; - } - - /** - * Alias for the "currentRouteNamed" method. - * - * @param mixed string - * @return bool - */ - public function is() - { - foreach (func_get_args() as $pattern) - { - if (str_is($pattern, $this->currentRouteName())) - { - return true; - } - } - - return false; - } - - /** - * Determine if the current route matches a given name. - * - * @param string $name - * @return bool - */ - public function currentRouteNamed($name) - { - return $this->current() ? $this->current()->getName() == $name : false; - } - - /** - * Get the current route action. - * - * @return string|null - */ - public function currentRouteAction() - { - if ( ! $this->current()) return; - - $action = $this->current()->getAction(); - - return isset($action['controller']) ? $action['controller'] : null; - } - - /** - * Alias for the "currentRouteUses" method. - * - * @param mixed string - * @return bool - */ - public function uses() - { - foreach (func_get_args() as $pattern) - { - if (str_is($pattern, $this->currentRouteAction())) - { - return true; - } - } - - return false; - } - - /** - * Determine if the current route action matches a given action. - * - * @param string $action - * @return bool - */ - public function currentRouteUses($action) - { - return $this->currentRouteAction() == $action; - } - - /** - * Get the request currently being dispatched. - * - * @return \Illuminate\Http\Request - */ - public function getCurrentRequest() - { - return $this->currentRequest; - } - - /** - * Get the underlying route collection. - * - * @return \Illuminate\Routing\RouteCollection - */ - public function getRoutes() - { - return $this->routes; - } - - /** - * Set the route collection instance. - * - * @param \Illuminate\Routing\RouteCollection $routes - * @return void - */ - public function setRoutes(RouteCollection $routes) - { - foreach ($routes as $route) - { - $route->setContainer($this->container); - } - - $this->routes = $routes; - - $this->container->instance('routes', $this->routes); - } - - /** - * Get the global "where" patterns. - * - * @return array - */ - public function getPatterns() - { - return $this->patterns; - } - +class Router implements RegistrarContract +{ + use Macroable; + + /** + * The event dispatcher instance. + * + * @var \Illuminate\Contracts\Events\Dispatcher + */ + protected $events; + + /** + * The IoC container instance. + * + * @var \Illuminate\Container\Container + */ + protected $container; + + /** + * The route collection instance. + * + * @var \Illuminate\Routing\RouteCollection + */ + protected $routes; + + /** + * The currently dispatched route instance. + * + * @var \Illuminate\Routing\Route + */ + protected $current; + + /** + * The request currently being dispatched. + * + * @var \Illuminate\Http\Request + */ + protected $currentRequest; + + /** + * All of the short-hand keys for middlewares. + * + * @var array + */ + protected $middleware = []; + + /** + * The registered pattern based filters. + * + * @var array + */ + protected $patternFilters = []; + + /** + * The registered regular expression based filters. + * + * @var array + */ + protected $regexFilters = []; + + /** + * The registered route value binders. + * + * @var array + */ + protected $binders = []; + + /** + * The globally available parameter patterns. + * + * @var array + */ + protected $patterns = []; + + /** + * The route group attribute stack. + * + * @var array + */ + protected $groupStack = []; + + /** + * All of the verbs supported by the router. + * + * @var array + */ + public static $verbs = ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS']; + + /** + * Create a new Router instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @param \Illuminate\Container\Container $container + * @return void + */ + public function __construct(Dispatcher $events, Container $container = null) + { + $this->events = $events; + $this->routes = new RouteCollection; + $this->container = $container ?: new Container; + + $this->bind('_missing', function ($v) { + return explode('/', $v); + }); + } + + /** + * Register a new GET route with the router. + * + * @param string $uri + * @param \Closure|array|string $action + * @return \Illuminate\Routing\Route + */ + public function get($uri, $action) + { + return $this->addRoute(['GET', 'HEAD'], $uri, $action); + } + + /** + * Register a new POST route with the router. + * + * @param string $uri + * @param \Closure|array|string $action + * @return \Illuminate\Routing\Route + */ + public function post($uri, $action) + { + return $this->addRoute('POST', $uri, $action); + } + + /** + * Register a new PUT route with the router. + * + * @param string $uri + * @param \Closure|array|string $action + * @return \Illuminate\Routing\Route + */ + public function put($uri, $action) + { + return $this->addRoute('PUT', $uri, $action); + } + + /** + * Register a new PATCH route with the router. + * + * @param string $uri + * @param \Closure|array|string $action + * @return \Illuminate\Routing\Route + */ + public function patch($uri, $action) + { + return $this->addRoute('PATCH', $uri, $action); + } + + /** + * Register a new DELETE route with the router. + * + * @param string $uri + * @param \Closure|array|string $action + * @return \Illuminate\Routing\Route + */ + public function delete($uri, $action) + { + return $this->addRoute('DELETE', $uri, $action); + } + + /** + * Register a new OPTIONS route with the router. + * + * @param string $uri + * @param \Closure|array|string $action + * @return \Illuminate\Routing\Route + */ + public function options($uri, $action) + { + return $this->addRoute('OPTIONS', $uri, $action); + } + + /** + * Register a new route responding to all verbs. + * + * @param string $uri + * @param \Closure|array|string $action + * @return \Illuminate\Routing\Route + */ + public function any($uri, $action) + { + $verbs = ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE']; + + return $this->addRoute($verbs, $uri, $action); + } + + /** + * Register a new route with the given verbs. + * + * @param array|string $methods + * @param string $uri + * @param \Closure|array|string $action + * @return \Illuminate\Routing\Route + */ + public function match($methods, $uri, $action) + { + return $this->addRoute(array_map('strtoupper', (array) $methods), $uri, $action); + } + + /** + * Register an array of controllers with wildcard routing. + * + * @param array $controllers + * @return void + */ + public function controllers(array $controllers) + { + foreach ($controllers as $uri => $controller) { + $this->controller($uri, $controller); + } + } + + /** + * Route a controller to a URI with wildcard routing. + * + * @param string $uri + * @param string $controller + * @param array $names + * @return void + */ + public function controller($uri, $controller, $names = []) + { + $prepended = $controller; + + // First, we will check to see if a controller prefix has been registered in + // the route group. If it has, we will need to prefix it before trying to + // reflect into the class instance and pull out the method for routing. + if (! empty($this->groupStack)) { + $prepended = $this->prependGroupUses($controller); + } + + $routable = (new ControllerInspector) + ->getRoutable($prepended, $uri); + + // When a controller is routed using this method, we use Reflection to parse + // out all of the routable methods for the controller, then register each + // route explicitly for the developers, so reverse routing is possible. + foreach ($routable as $method => $routes) { + foreach ($routes as $route) { + $this->registerInspected($route, $controller, $method, $names); + } + } + + $this->addFallthroughRoute($controller, $uri); + } + + /** + * Register an inspected controller route. + * + * @param array $route + * @param string $controller + * @param string $method + * @param array $names + * @return void + */ + protected function registerInspected($route, $controller, $method, &$names) + { + $action = ['uses' => $controller.'@'.$method]; + + // If a given controller method has been named, we will assign the name to the + // controller action array, which provides for a short-cut to method naming + // so you don't have to define an individual route for these controllers. + $action['as'] = Arr::get($names, $method); + + $this->{$route['verb']}($route['uri'], $action); + } + + /** + * Add a fallthrough route for a controller. + * + * @param string $controller + * @param string $uri + * @return void + */ + protected function addFallthroughRoute($controller, $uri) + { + $missing = $this->any($uri.'/{_missing}', $controller.'@missingMethod'); + + $missing->where('_missing', '(.*)'); + } + + /** + * Register an array of resource controllers. + * + * @param array $resources + * @return void + */ + public function resources(array $resources) + { + foreach ($resources as $name => $controller) { + $this->resource($name, $controller); + } + } + + /** + * Route a resource to a controller. + * + * @param string $name + * @param string $controller + * @param array $options + * @return void + */ + public function resource($name, $controller, array $options = []) + { + if ($this->container && $this->container->bound('Illuminate\Routing\ResourceRegistrar')) { + $registrar = $this->container->make('Illuminate\Routing\ResourceRegistrar'); + } else { + $registrar = new ResourceRegistrar($this); + } + + $registrar->register($name, $controller, $options); + } + + /** + * Create a route group with shared attributes. + * + * @param array $attributes + * @param \Closure $callback + * @return void + */ + public function group(array $attributes, Closure $callback) + { + $this->updateGroupStack($attributes); + + // Once we have updated the group stack, we will execute the user Closure and + // merge in the groups attributes when the route is created. After we have + // run the callback, we will pop the attributes off of this group stack. + call_user_func($callback, $this); + + array_pop($this->groupStack); + } + + /** + * Update the group stack with the given attributes. + * + * @param array $attributes + * @return void + */ + protected function updateGroupStack(array $attributes) + { + if (! empty($this->groupStack)) { + $attributes = $this->mergeGroup($attributes, end($this->groupStack)); + } + + $this->groupStack[] = $attributes; + } + + /** + * Merge the given array with the last group stack. + * + * @param array $new + * @return array + */ + public function mergeWithLastGroup($new) + { + return $this->mergeGroup($new, end($this->groupStack)); + } + + /** + * Merge the given group attributes. + * + * @param array $new + * @param array $old + * @return array + */ + public static function mergeGroup($new, $old) + { + $new['namespace'] = static::formatUsesPrefix($new, $old); + + $new['prefix'] = static::formatGroupPrefix($new, $old); + + if (isset($new['domain'])) { + unset($old['domain']); + } + + $new['where'] = array_merge( + isset($old['where']) ? $old['where'] : [], + isset($new['where']) ? $new['where'] : [] + ); + + if (isset($old['as'])) { + $new['as'] = $old['as'].(isset($new['as']) ? $new['as'] : ''); + } + + return array_merge_recursive(Arr::except($old, ['namespace', 'prefix', 'where', 'as']), $new); + } + + /** + * Format the uses prefix for the new group attributes. + * + * @param array $new + * @param array $old + * @return string|null + */ + protected static function formatUsesPrefix($new, $old) + { + if (isset($new['namespace'])) { + return isset($old['namespace']) + ? trim($old['namespace'], '\\').'\\'.trim($new['namespace'], '\\') + : trim($new['namespace'], '\\'); + } + + return isset($old['namespace']) ? $old['namespace'] : null; + } + + /** + * Format the prefix for the new group attributes. + * + * @param array $new + * @param array $old + * @return string|null + */ + protected static function formatGroupPrefix($new, $old) + { + $oldPrefix = isset($old['prefix']) ? $old['prefix'] : null; + + if (isset($new['prefix'])) { + return trim($oldPrefix, '/').'/'.trim($new['prefix'], '/'); + } + + return $oldPrefix; + } + + /** + * Get the prefix from the last group on the stack. + * + * @return string + */ + public function getLastGroupPrefix() + { + if (! empty($this->groupStack)) { + $last = end($this->groupStack); + + return isset($last['prefix']) ? $last['prefix'] : ''; + } + + return ''; + } + + /** + * Add a route to the underlying route collection. + * + * @param array|string $methods + * @param string $uri + * @param \Closure|array|string $action + * @return \Illuminate\Routing\Route + */ + protected function addRoute($methods, $uri, $action) + { + return $this->routes->add($this->createRoute($methods, $uri, $action)); + } + + /** + * Create a new route instance. + * + * @param array|string $methods + * @param string $uri + * @param mixed $action + * @return \Illuminate\Routing\Route + */ + protected function createRoute($methods, $uri, $action) + { + // If the route is routing to a controller we will parse the route action into + // an acceptable array format before registering it and creating this route + // instance itself. We need to build the Closure that will call this out. + if ($this->actionReferencesController($action)) { + $action = $this->convertToControllerAction($action); + } + + $route = $this->newRoute( + $methods, $this->prefix($uri), $action + ); + + // If we have groups that need to be merged, we will merge them now after this + // route has already been created and is ready to go. After we're done with + // the merge we will be ready to return the route back out to the caller. + if ($this->hasGroupStack()) { + $this->mergeGroupAttributesIntoRoute($route); + } + + $this->addWhereClausesToRoute($route); + + return $route; + } + + /** + * Create a new Route object. + * + * @param array|string $methods + * @param string $uri + * @param mixed $action + * @return \Illuminate\Routing\Route + */ + protected function newRoute($methods, $uri, $action) + { + return (new Route($methods, $uri, $action))->setContainer($this->container); + } + + /** + * Prefix the given URI with the last prefix. + * + * @param string $uri + * @return string + */ + protected function prefix($uri) + { + return trim(trim($this->getLastGroupPrefix(), '/').'/'.trim($uri, '/'), '/') ?: '/'; + } + + /** + * Add the necessary where clauses to the route based on its initial registration. + * + * @param \Illuminate\Routing\Route $route + * @return \Illuminate\Routing\Route + */ + protected function addWhereClausesToRoute($route) + { + $where = isset($route->getAction()['where']) ? $route->getAction()['where'] : []; + + $route->where(array_merge($this->patterns, $where)); + + return $route; + } + + /** + * Merge the group stack with the controller action. + * + * @param \Illuminate\Routing\Route $route + * @return void + */ + protected function mergeGroupAttributesIntoRoute($route) + { + $action = $this->mergeWithLastGroup($route->getAction()); + + $route->setAction($action); + } + + /** + * Determine if the action is routing to a controller. + * + * @param array $action + * @return bool + */ + protected function actionReferencesController($action) + { + if ($action instanceof Closure) { + return false; + } + + return is_string($action) || is_string(isset($action['uses']) ? $action['uses'] : null); + } + + /** + * Add a controller based route action to the action array. + * + * @param array|string $action + * @return array + */ + protected function convertToControllerAction($action) + { + if (is_string($action)) { + $action = ['uses' => $action]; + } + + // Here we'll merge any group "uses" statement if necessary so that the action + // has the proper clause for this property. Then we can simply set the name + // of the controller on the action and return the action array for usage. + if (! empty($this->groupStack)) { + $action['uses'] = $this->prependGroupUses($action['uses']); + } + + // Here we will set this controller name on the action array just so we always + // have a copy of it for reference if we need it. This can be used while we + // search for a controller name or do some other type of fetch operation. + $action['controller'] = $action['uses']; + + return $action; + } + + /** + * Prepend the last group uses onto the use clause. + * + * @param string $uses + * @return string + */ + protected function prependGroupUses($uses) + { + $group = end($this->groupStack); + + return isset($group['namespace']) && strpos($uses, '\\') !== 0 ? $group['namespace'].'\\'.$uses : $uses; + } + + /** + * Dispatch the request to the application. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function dispatch(Request $request) + { + $this->currentRequest = $request; + + // If no response was returned from the before filter, we will call the proper + // route instance to get the response. If no route is found a response will + // still get returned based on why no routes were found for this request. + $response = $this->callFilter('before', $request); + + if (is_null($response)) { + $response = $this->dispatchToRoute($request); + } + + // Once this route has run and the response has been prepared, we will run the + // after filter to do any last work on the response or for this application + // before we will return the response back to the consuming code for use. + $response = $this->prepareResponse($request, $response); + + $this->callFilter('after', $request, $response); + + return $response; + } + + /** + * Dispatch the request to a route and return the response. + * + * @param \Illuminate\Http\Request $request + * @return mixed + */ + public function dispatchToRoute(Request $request) + { + // First we will find a route that matches this request. We will also set the + // route resolver on the request so middlewares assigned to the route will + // receive access to this route instance for checking of the parameters. + $route = $this->findRoute($request); + + $request->setRouteResolver(function () use ($route) { + return $route; + }); + + $this->events->fire('router.matched', [$route, $request]); + + // Once we have successfully matched the incoming request to a given route we + // can call the before filters on that route. This works similar to global + // filters in that if a response is returned we will not call the route. + $response = $this->callRouteBefore($route, $request); + + if (is_null($response)) { + $response = $this->runRouteWithinStack( + $route, $request + ); + } + + $response = $this->prepareResponse($request, $response); + + // After we have a prepared response from the route or filter we will call to + // the "after" filters to do any last minute processing on this request or + // response object before the response is returned back to the consumer. + $this->callRouteAfter($route, $request, $response); + + return $response; + } + + /** + * Run the given route within a Stack "onion" instance. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return mixed + */ + protected function runRouteWithinStack(Route $route, Request $request) + { + $shouldSkipMiddleware = $this->container->bound('middleware.disable') && + $this->container->make('middleware.disable') === true; + + $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddlewares($route); + + return (new Pipeline($this->container)) + ->send($request) + ->through($middleware) + ->then(function ($request) use ($route) { + return $this->prepareResponse( + $request, + $route->run($request) + ); + }); + } + + /** + * Gather the middleware for the given route. + * + * @param \Illuminate\Routing\Route $route + * @return array + */ + public function gatherRouteMiddlewares(Route $route) + { + return Collection::make($route->middleware())->map(function ($name) { + return Collection::make($this->resolveMiddlewareClassName($name)); + }) + ->collapse()->all(); + } + + /** + * Resolve the middleware name to a class name preserving passed parameters. + * + * @param string $name + * @return string + */ + public function resolveMiddlewareClassName($name) + { + $map = $this->middleware; + + list($name, $parameters) = array_pad(explode(':', $name, 2), 2, null); + + return (isset($map[$name]) ? $map[$name] : $name).($parameters !== null ? ':'.$parameters : ''); + } + + /** + * Find the route matching a given request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Routing\Route + */ + protected function findRoute($request) + { + $this->current = $route = $this->routes->match($request); + + $this->container->instance('Illuminate\Routing\Route', $route); + + return $this->substituteBindings($route); + } + + /** + * Substitute the route bindings onto the route. + * + * @param \Illuminate\Routing\Route $route + * @return \Illuminate\Routing\Route + */ + protected function substituteBindings($route) + { + foreach ($route->parameters() as $key => $value) { + if (isset($this->binders[$key])) { + $route->setParameter($key, $this->performBinding($key, $value, $route)); + } + } + + return $route; + } + + /** + * Call the binding callback for the given key. + * + * @param string $key + * @param string $value + * @param \Illuminate\Routing\Route $route + * @return mixed + */ + protected function performBinding($key, $value, $route) + { + return call_user_func($this->binders[$key], $value, $route); + } + + /** + * Register a route matched event listener. + * + * @param string|callable $callback + * @return void + */ + public function matched($callback) + { + $this->events->listen('router.matched', $callback); + } + + /** + * Register a new "before" filter with the router. + * + * @param string|callable $callback + * @return void + * + * @deprecated since version 5.1. + */ + public function before($callback) + { + $this->addGlobalFilter('before', $callback); + } + + /** + * Register a new "after" filter with the router. + * + * @param string|callable $callback + * @return void + * + * @deprecated since version 5.1. + */ + public function after($callback) + { + $this->addGlobalFilter('after', $callback); + } + + /** + * Register a new global filter with the router. + * + * @param string $filter + * @param string|callable $callback + * @return void + */ + protected function addGlobalFilter($filter, $callback) + { + $this->events->listen('router.'.$filter, $this->parseFilter($callback)); + } + + /** + * Get all of the defined middleware short-hand names. + * + * @return array + */ + public function getMiddleware() + { + return $this->middleware; + } + + /** + * Register a short-hand name for a middleware. + * + * @param string $name + * @param string $class + * @return $this + */ + public function middleware($name, $class) + { + $this->middleware[$name] = $class; + + return $this; + } + + /** + * Register a new filter with the router. + * + * @param string $name + * @param string|callable $callback + * @return void + * + * @deprecated since version 5.1. + */ + public function filter($name, $callback) + { + $this->events->listen('router.filter: '.$name, $this->parseFilter($callback)); + } + + /** + * Parse the registered filter. + * + * @param callable|string $callback + * @return mixed + */ + protected function parseFilter($callback) + { + if (is_string($callback) && ! Str::contains($callback, '@')) { + return $callback.'@filter'; + } + + return $callback; + } + + /** + * Register a pattern-based filter with the router. + * + * @param string $pattern + * @param string $name + * @param array|null $methods + * @return void + * + * @deprecated since version 5.1. + */ + public function when($pattern, $name, $methods = null) + { + if (! is_null($methods)) { + $methods = array_map('strtoupper', (array) $methods); + } + + $this->patternFilters[$pattern][] = compact('name', 'methods'); + } + + /** + * Register a regular expression based filter with the router. + * + * @param string $pattern + * @param string $name + * @param array|null $methods + * @return void + * + * @deprecated since version 5.1. + */ + public function whenRegex($pattern, $name, $methods = null) + { + if (! is_null($methods)) { + $methods = array_map('strtoupper', (array) $methods); + } + + $this->regexFilters[$pattern][] = compact('name', 'methods'); + } + + /** + * Register a model binder for a wildcard. + * + * @param string $key + * @param string $class + * @param \Closure|null $callback + * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + public function model($key, $class, Closure $callback = null) + { + $this->bind($key, function ($value) use ($class, $callback) { + if (is_null($value)) { + return; + } + + // For model binders, we will attempt to retrieve the models using the first + // method on the model instance. If we cannot retrieve the models we'll + // throw a not found exception otherwise we will return the instance. + $instance = $this->container->make($class); + + if ($model = $instance->where($instance->getRouteKeyName(), $value)->first()) { + return $model; + } + + // If a callback was supplied to the method we will call that to determine + // what we should do when the model is not found. This just gives these + // developer a little greater flexibility to decide what will happen. + if ($callback instanceof Closure) { + return call_user_func($callback, $value); + } + + throw new NotFoundHttpException; + }); + } + + /** + * Add a new route parameter binder. + * + * @param string $key + * @param string|callable $binder + * @return void + */ + public function bind($key, $binder) + { + if (is_string($binder)) { + $binder = $this->createClassBinding($binder); + } + + $this->binders[str_replace('-', '_', $key)] = $binder; + } + + /** + * Create a class based binding using the IoC container. + * + * @param string $binding + * @return \Closure + */ + public function createClassBinding($binding) + { + return function ($value, $route) use ($binding) { + // If the binding has an @ sign, we will assume it's being used to delimit + // the class name from the bind method name. This allows for bindings + // to run multiple bind methods in a single class for convenience. + $segments = explode('@', $binding); + + $method = count($segments) == 2 ? $segments[1] : 'bind'; + + $callable = [$this->container->make($segments[0]), $method]; + + return call_user_func($callable, $value, $route); + }; + } + + /** + * Set a global where pattern on all routes. + * + * @param string $key + * @param string $pattern + * @return void + */ + public function pattern($key, $pattern) + { + $this->patterns[$key] = $pattern; + } + + /** + * Set a group of global where patterns on all routes. + * + * @param array $patterns + * @return void + */ + public function patterns($patterns) + { + foreach ($patterns as $key => $pattern) { + $this->pattern($key, $pattern); + } + } + + /** + * Call the given filter with the request and response. + * + * @param string $filter + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Response $response + * @return mixed + */ + protected function callFilter($filter, $request, $response = null) + { + return $this->events->until('router.'.$filter, [$request, $response]); + } + + /** + * Call the given route's before filters. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return mixed + */ + public function callRouteBefore($route, $request) + { + $response = $this->callPatternFilters($route, $request); + + return $response ?: $this->callAttachedBefores($route, $request); + } + + /** + * Call the pattern based filters for the request. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return mixed + */ + protected function callPatternFilters($route, $request) + { + foreach ($this->findPatternFilters($request) as $filter => $parameters) { + $response = $this->callRouteFilter($filter, $parameters, $route, $request); + + if (! is_null($response)) { + return $response; + } + } + } + + /** + * Find the patterned filters matching a request. + * + * @param \Illuminate\Http\Request $request + * @return array + * + * @deprecated since version 5.1. + */ + public function findPatternFilters($request) + { + $results = []; + + list($path, $method) = [$request->path(), $request->getMethod()]; + + foreach ($this->patternFilters as $pattern => $filters) { + // To find the patterned middlewares for a request, we just need to check these + // registered patterns against the path info for the current request to this + // applications, and when it matches we will merge into these middlewares. + if (Str::is($pattern, $path)) { + $merge = $this->patternsByMethod($method, $filters); + + $results = array_merge($results, $merge); + } + } + + foreach ($this->regexFilters as $pattern => $filters) { + // To find the patterned middlewares for a request, we just need to check these + // registered patterns against the path info for the current request to this + // applications, and when it matches we will merge into these middlewares. + if (preg_match($pattern, $path)) { + $merge = $this->patternsByMethod($method, $filters); + + $results = array_merge($results, $merge); + } + } + + return $results; + } + + /** + * Filter pattern filters that don't apply to the request verb. + * + * @param string $method + * @param array $filters + * @return array + */ + protected function patternsByMethod($method, $filters) + { + $results = []; + + foreach ($filters as $filter) { + // The idea here is to check and see if the pattern filter applies to this HTTP + // request based on the request methods. Pattern filters might be limited by + // the request verb to make it simply to assign to the given verb at once. + if ($this->filterSupportsMethod($filter, $method)) { + $parsed = Route::parseFilters($filter['name']); + + $results = array_merge($results, $parsed); + } + } + + return $results; + } + + /** + * Determine if the given pattern filters applies to a given method. + * + * @param array $filter + * @param array $method + * @return bool + */ + protected function filterSupportsMethod($filter, $method) + { + $methods = $filter['methods']; + + return is_null($methods) || in_array($method, $methods); + } + + /** + * Call the given route's before (non-pattern) filters. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return mixed + */ + protected function callAttachedBefores($route, $request) + { + foreach ($route->beforeFilters() as $filter => $parameters) { + $response = $this->callRouteFilter($filter, $parameters, $route, $request); + + if (! is_null($response)) { + return $response; + } + } + } + + /** + * Call the given route's after filters. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Response $response + * @return mixed + * + * @deprecated since version 5.1. + */ + public function callRouteAfter($route, $request, $response) + { + foreach ($route->afterFilters() as $filter => $parameters) { + $this->callRouteFilter($filter, $parameters, $route, $request, $response); + } + } + + /** + * Call the given route filter. + * + * @param string $filter + * @param array $parameters + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Response|null $response + * @return mixed + * + * @deprecated since version 5.1. + */ + public function callRouteFilter($filter, $parameters, $route, $request, $response = null) + { + $data = array_merge([$route, $request, $response], $parameters); + + return $this->events->until('router.filter: '.$filter, $this->cleanFilterParameters($data)); + } + + /** + * Clean the parameters being passed to a filter callback. + * + * @param array $parameters + * @return array + */ + protected function cleanFilterParameters(array $parameters) + { + return array_filter($parameters, function ($p) { + return ! is_null($p) && $p !== ''; + }); + } + + /** + * Create a response instance from the given value. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param mixed $response + * @return \Illuminate\Http\Response + */ + public function prepareResponse($request, $response) + { + if ($response instanceof PsrResponseInterface) { + $response = (new HttpFoundationFactory)->createResponse($response); + } elseif (! $response instanceof SymfonyResponse) { + $response = new Response($response); + } + + return $response->prepare($request); + } + + /** + * Determine if the router currently has a group stack. + * + * @return bool + */ + public function hasGroupStack() + { + return ! empty($this->groupStack); + } + + /** + * Get the current group stack for the router. + * + * @return array + */ + public function getGroupStack() + { + return $this->groupStack; + } + + /** + * Get a route parameter for the current route. + * + * @param string $key + * @param string $default + * @return mixed + */ + public function input($key, $default = null) + { + return $this->current()->parameter($key, $default); + } + + /** + * Get the currently dispatched route instance. + * + * @return \Illuminate\Routing\Route + */ + public function getCurrentRoute() + { + return $this->current(); + } + + /** + * Get the currently dispatched route instance. + * + * @return \Illuminate\Routing\Route + */ + public function current() + { + return $this->current; + } + + /** + * Check if a route with the given name exists. + * + * @param string $name + * @return bool + */ + public function has($name) + { + return $this->routes->hasNamedRoute($name); + } + + /** + * Get the current route name. + * + * @return string|null + */ + public function currentRouteName() + { + return $this->current() ? $this->current()->getName() : null; + } + + /** + * Alias for the "currentRouteNamed" method. + * + * @param mixed string + * @return bool + */ + public function is() + { + foreach (func_get_args() as $pattern) { + if (Str::is($pattern, $this->currentRouteName())) { + return true; + } + } + + return false; + } + + /** + * Determine if the current route matches a given name. + * + * @param string $name + * @return bool + */ + public function currentRouteNamed($name) + { + return $this->current() ? $this->current()->getName() == $name : false; + } + + /** + * Get the current route action. + * + * @return string|null + */ + public function currentRouteAction() + { + if (! $this->current()) { + return; + } + + $action = $this->current()->getAction(); + + return isset($action['controller']) ? $action['controller'] : null; + } + + /** + * Alias for the "currentRouteUses" method. + * + * @param mixed string + * @return bool + */ + public function uses() + { + foreach (func_get_args() as $pattern) { + if (Str::is($pattern, $this->currentRouteAction())) { + return true; + } + } + + return false; + } + + /** + * Determine if the current route action matches a given action. + * + * @param string $action + * @return bool + */ + public function currentRouteUses($action) + { + return $this->currentRouteAction() == $action; + } + + /** + * Get the request currently being dispatched. + * + * @return \Illuminate\Http\Request + */ + public function getCurrentRequest() + { + return $this->currentRequest; + } + + /** + * Get the underlying route collection. + * + * @return \Illuminate\Routing\RouteCollection + */ + public function getRoutes() + { + return $this->routes; + } + + /** + * Set the route collection instance. + * + * @param \Illuminate\Routing\RouteCollection $routes + * @return void + */ + public function setRoutes(RouteCollection $routes) + { + foreach ($routes as $route) { + $route->setContainer($this->container); + } + + $this->routes = $routes; + + $this->container->instance('routes', $this->routes); + } + + /** + * Get the global "where" patterns. + * + * @return array + */ + public function getPatterns() + { + return $this->patterns; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php index 1cdf592..e8e7bfb 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php @@ -1,124 +1,147 @@ -registerRouter(); - - $this->registerUrlGenerator(); - - $this->registerRedirector(); - - $this->registerResponseFactory(); - } - - /** - * Register the router instance. - * - * @return void - */ - protected function registerRouter() - { - $this->app['router'] = $this->app->share(function($app) - { - return new Router($app['events'], $app); - }); - } - - /** - * Register the URL generator service. - * - * @return void - */ - protected function registerUrlGenerator() - { - $this->app['url'] = $this->app->share(function($app) - { - $routes = $app['router']->getRoutes(); - - // The URL generator needs the route collection that exists on the router. - // Keep in mind this is an object, so we're passing by references here - // and all the registered routes will be available to the generator. - $app->instance('routes', $routes); - - $url = new UrlGenerator( - $routes, $app->rebinding( - 'request', $this->requestRebinder() - ) - ); - - $url->setSessionResolver(function() - { - return $this->app['session']; - }); - - // If the route collection is "rebound", for example, when the routes stay - // cached for the application, we will need to rebind the routes on the - // URL generator instance so it has the latest version of the routes. - $app->rebinding('routes', function($app, $routes) - { - $app['url']->setRoutes($routes); - }); - - return $url; - }); - } - - /** - * Get the URL generator request rebinder. - * - * @return \Closure - */ - protected function requestRebinder() - { - return function($app, $request) - { - $app['url']->setRequest($request); - }; - } - - /** - * Register the Redirector service. - * - * @return void - */ - protected function registerRedirector() - { - $this->app['redirect'] = $this->app->share(function($app) - { - $redirector = new Redirector($app['url']); - - // If the session is set on the application instance, we'll inject it into - // the redirector instance. This allows the redirect responses to allow - // for the quite convenient "with" methods that flash to the session. - if (isset($app['session.store'])) - { - $redirector->setSession($app['session.store']); - } - - return $redirector; - }); - } - - /** - * Register the response factory implementation. - * - * @return void - */ - protected function registerResponseFactory() - { - $this->app->singleton('Illuminate\Contracts\Routing\ResponseFactory', function($app) - { - return new ResponseFactory($app['Illuminate\Contracts\View\Factory'], $app['redirect']); - }); - } +namespace Illuminate\Routing; +use Illuminate\Support\ServiceProvider; +use Zend\Diactoros\Response as PsrResponse; +use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory; + +class RoutingServiceProvider extends ServiceProvider +{ + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerRouter(); + + $this->registerUrlGenerator(); + + $this->registerRedirector(); + + $this->registerPsrRequest(); + + $this->registerPsrResponse(); + + $this->registerResponseFactory(); + } + + /** + * Register the router instance. + * + * @return void + */ + protected function registerRouter() + { + $this->app['router'] = $this->app->share(function ($app) { + return new Router($app['events'], $app); + }); + } + + /** + * Register the URL generator service. + * + * @return void + */ + protected function registerUrlGenerator() + { + $this->app['url'] = $this->app->share(function ($app) { + $routes = $app['router']->getRoutes(); + + // The URL generator needs the route collection that exists on the router. + // Keep in mind this is an object, so we're passing by references here + // and all the registered routes will be available to the generator. + $app->instance('routes', $routes); + + $url = new UrlGenerator( + $routes, $app->rebinding( + 'request', $this->requestRebinder() + ) + ); + + $url->setSessionResolver(function () { + return $this->app['session']; + }); + + // If the route collection is "rebound", for example, when the routes stay + // cached for the application, we will need to rebind the routes on the + // URL generator instance so it has the latest version of the routes. + $app->rebinding('routes', function ($app, $routes) { + $app['url']->setRoutes($routes); + }); + + return $url; + }); + } + + /** + * Get the URL generator request rebinder. + * + * @return \Closure + */ + protected function requestRebinder() + { + return function ($app, $request) { + $app['url']->setRequest($request); + }; + } + + /** + * Register the Redirector service. + * + * @return void + */ + protected function registerRedirector() + { + $this->app['redirect'] = $this->app->share(function ($app) { + $redirector = new Redirector($app['url']); + + // If the session is set on the application instance, we'll inject it into + // the redirector instance. This allows the redirect responses to allow + // for the quite convenient "with" methods that flash to the session. + if (isset($app['session.store'])) { + $redirector->setSession($app['session.store']); + } + + return $redirector; + }); + } + + /** + * Register a binding for the PSR-7 request implementation. + * + * @return void + */ + protected function registerPsrRequest() + { + $this->app->bind('Psr\Http\Message\ServerRequestInterface', function ($app) { + return (new DiactorosFactory)->createRequest($app->make('request')); + }); + } + + /** + * Register a binding for the PSR-7 response implementation. + * + * @return void + */ + protected function registerPsrResponse() + { + $this->app->bind('Psr\Http\Message\ResponseInterface', function ($app) { + return new PsrResponse(); + }); + } + + /** + * Register the response factory implementation. + * + * @return void + */ + protected function registerResponseFactory() + { + $this->app->singleton('Illuminate\Contracts\Routing\ResponseFactory', function ($app) { + return new ResponseFactory($app['Illuminate\Contracts\View\Factory'], $app['redirect']); + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php b/application/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php index 1da7803..c09c010 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php @@ -1,711 +1,740 @@ - '/', - '%40' => '@', - '%3A' => ':', - '%3B' => ';', - '%2C' => ',', - '%3D' => '=', - '%2B' => '+', - '%21' => '!', - '%2A' => '*', - '%7C' => '|', - '%3F' => '?', - '%26' => '&', - '%23' => '#', - '%25' => '%', - ); - - /** - * Create a new URL Generator instance. - * - * @param \Illuminate\Routing\RouteCollection $routes - * @param \Illuminate\Http\Request $request - * @return void - */ - public function __construct(RouteCollection $routes, Request $request) - { - $this->routes = $routes; - - $this->setRequest($request); - } - - /** - * Get the full URL for the current request. - * - * @return string - */ - public function full() - { - return $this->request->fullUrl(); - } - - /** - * Get the current URL for the request. - * - * @return string - */ - public function current() - { - return $this->to($this->request->getPathInfo()); - } - - /** - * Get the URL for the previous request. - * - * @return string - */ - public function previous() - { - $referrer = $this->request->headers->get('referer'); - - $url = $referrer ? $this->to($referrer) : $this->getPreviousUrlFromSession(); - - return $url ?: $this->to('/'); - } - - /** - * Generate a absolute URL to the given path. - * - * @param string $path - * @param mixed $extra - * @param bool|null $secure - * @return string - */ - public function to($path, $extra = array(), $secure = null) - { - // First we will check if the URL is already a valid URL. If it is we will not - // try to generate a new one but will simply return the URL as is, which is - // convenient since developers do not always have to check if it's valid. - if ($this->isValidUrl($path)) return $path; - - $scheme = $this->getScheme($secure); - - $extra = $this->formatParameters($extra); - - $tail = implode('/', array_map( - 'rawurlencode', (array) $extra) - ); - - // Once we have the scheme we will compile the "tail" by collapsing the values - // into a single string delimited by slashes. This just makes it convenient - // for passing the array of parameters to this URL as a list of segments. - $root = $this->getRootUrl($scheme); - - return $this->trimUrl($root, $path, $tail); - } - - /** - * Generate a secure, absolute URL to the given path. - * - * @param string $path - * @param array $parameters - * @return string - */ - public function secure($path, $parameters = array()) - { - return $this->to($path, $parameters, true); - } - - /** - * Generate a URL to an application asset. - * - * @param string $path - * @param bool|null $secure - * @return string - */ - public function asset($path, $secure = null) - { - if ($this->isValidUrl($path)) return $path; - - // Once we get the root URL, we will check to see if it contains an index.php - // file in the paths. If it does, we will remove it since it is not needed - // for asset paths, but only for routes to endpoints in the application. - $root = $this->getRootUrl($this->getScheme($secure)); - - return $this->removeIndex($root).'/'.trim($path, '/'); - } - - /** - * Remove the index.php file from a path. - * - * @param string $root - * @return string - */ - protected function removeIndex($root) - { - $i = 'index.php'; - - return str_contains($root, $i) ? str_replace('/'.$i, '', $root) : $root; - } - - /** - * Generate a URL to a secure asset. - * - * @param string $path - * @return string - */ - public function secureAsset($path) - { - return $this->asset($path, true); - } - - /** - * Get the scheme for a raw URL. - * - * @param bool|null $secure - * @return string - */ - protected function getScheme($secure) - { - if (is_null($secure)) - { - if (is_null($this->cachedSchema)) - { - $this->cachedSchema = $this->forceSchema ?: $this->request->getScheme().'://'; - } - - return $this->cachedSchema; - } - - return $secure ? 'https://' : 'http://'; - } - - /** - * Force the schema for URLs. - * - * @param string $schema - * @return void - */ - public function forceSchema($schema) - { - $this->cachedSchema = null; - - $this->forceSchema = $schema.'://'; - } - - /** - * Get the URL to a named route. - * - * @param string $name - * @param mixed $parameters - * @param bool $absolute - * @return string - * - * @throws \InvalidArgumentException - */ - public function route($name, $parameters = array(), $absolute = true) - { - if ( ! is_null($route = $this->routes->getByName($name))) - { - return $this->toRoute($route, $parameters, $absolute); - } - - throw new InvalidArgumentException("Route [{$name}] not defined."); - } - - /** - * Get the URL for a given route instance. - * - * @param \Illuminate\Routing\Route $route - * @param mixed $parameters - * @param bool $absolute - * @return string - */ - protected function toRoute($route, $parameters, $absolute) - { - $parameters = $this->formatParameters($parameters); - - $domain = $this->getRouteDomain($route, $parameters); - - $uri = strtr(rawurlencode($this->addQueryString($this->trimUrl( - $root = $this->replaceRoot($route, $domain, $parameters), - $this->replaceRouteParameters($route->uri(), $parameters) - ), $parameters)), $this->dontEncode); - - return $absolute ? $uri : '/'.ltrim(str_replace($root, '', $uri), '/'); - } - - /** - * Replace the parameters on the root path. - * - * @param \Illuminate\Routing\Route $route - * @param string $domain - * @param array $parameters - * @return string - */ - protected function replaceRoot($route, $domain, &$parameters) - { - return $this->replaceRouteParameters($this->getRouteRoot($route, $domain), $parameters); - } - - /** - * Replace all of the wildcard parameters for a route path. - * - * @param string $path - * @param array $parameters - * @return string - */ - protected function replaceRouteParameters($path, array &$parameters) - { - if (count($parameters)) - { - $path = preg_replace_sub( - '/\{.*?\}/', $parameters, $this->replaceNamedParameters($path, $parameters) - ); - } - - return trim(preg_replace('/\{.*?\?\}/', '', $path), '/'); - } - - /** - * Replace all of the named parameters in the path. - * - * @param string $path - * @param array $parameters - * @return string - */ - protected function replaceNamedParameters($path, &$parameters) - { - return preg_replace_callback('/\{(.*?)\??\}/', function($m) use (&$parameters) - { - return isset($parameters[$m[1]]) ? array_pull($parameters, $m[1]) : $m[0]; - - }, $path); - } - - /** - * Add a query string to the URI. - * - * @param string $uri - * @param array $parameters - * @return mixed|string - */ - protected function addQueryString($uri, array $parameters) - { - // If the URI has a fragment, we will move it to the end of the URI since it will - // need to come after any query string that may be added to the URL else it is - // not going to be available. We will remove it then append it back on here. - if ( ! is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) - { - $uri = preg_replace('/#.*/', '', $uri); - } - - $uri .= $this->getRouteQueryString($parameters); - - return is_null($fragment) ? $uri : $uri."#{$fragment}"; - } - - /** - * Format the array of URL parameters. - * - * @param mixed|array $parameters - * @return array - */ - protected function formatParameters($parameters) - { - return $this->replaceRoutableParameters($parameters); - } - - /** - * Replace UrlRoutable parameters with their route parameter. - * - * @param array $parameters - * @return array - */ - protected function replaceRoutableParameters($parameters = array()) - { - $parameters = is_array($parameters) ? $parameters : array($parameters); - - foreach ($parameters as $key => $parameter) - { - if ($parameter instanceof UrlRoutable) - { - $parameters[$key] = $parameter->getRouteKey(); - } - } - - return $parameters; - } - - /** - * Get the query string for a given route. - * - * @param array $parameters - * @return string - */ - protected function getRouteQueryString(array $parameters) - { - // First we will get all of the string parameters that are remaining after we - // have replaced the route wildcards. We'll then build a query string from - // these string parameters then use it as a starting point for the rest. - if (count($parameters) == 0) return ''; - - $query = http_build_query( - $keyed = $this->getStringParameters($parameters) - ); - - // Lastly, if there are still parameters remaining, we will fetch the numeric - // parameters that are in the array and add them to the query string or we - // will make the initial query string if it wasn't started with strings. - if (count($keyed) < count($parameters)) - { - $query .= '&'.implode( - '&', $this->getNumericParameters($parameters) - ); - } - - return '?'.trim($query, '&'); - } - - /** - * Get the string parameters from a given list. - * - * @param array $parameters - * @return array - */ - protected function getStringParameters(array $parameters) - { - return array_where($parameters, function($k, $v) { return is_string($k); }); - } - - /** - * Get the numeric parameters from a given list. - * - * @param array $parameters - * @return array - */ - protected function getNumericParameters(array $parameters) - { - return array_where($parameters, function($k, $v) { return is_numeric($k); }); - } - - /** - * Get the formatted domain for a given route. - * - * @param \Illuminate\Routing\Route $route - * @param array $parameters - * @return string - */ - protected function getRouteDomain($route, &$parameters) - { - return $route->domain() ? $this->formatDomain($route, $parameters) : null; - } - - /** - * Format the domain and port for the route and request. - * - * @param \Illuminate\Routing\Route $route - * @param array $parameters - * @return string - */ - protected function formatDomain($route, &$parameters) - { - return $this->addPortToDomain($this->getDomainAndScheme($route)); - } - - /** - * Get the domain and scheme for the route. - * - * @param \Illuminate\Routing\Route $route - * @return string - */ - protected function getDomainAndScheme($route) - { - return $this->getRouteScheme($route).$route->domain(); - } - - /** - * Add the port to the domain if necessary. - * - * @param string $domain - * @return string - */ - protected function addPortToDomain($domain) - { - if (in_array($this->request->getPort(), array('80', '443'))) - { - return $domain; - } - - return $domain.':'.$this->request->getPort(); - } - - /** - * Get the root of the route URL. - * - * @param \Illuminate\Routing\Route $route - * @param string $domain - * @return string - */ - protected function getRouteRoot($route, $domain) - { - return $this->getRootUrl($this->getRouteScheme($route), $domain); - } - - /** - * Get the scheme for the given route. - * - * @param \Illuminate\Routing\Route $route - * @return string - */ - protected function getRouteScheme($route) - { - if ($route->httpOnly()) - { - return $this->getScheme(false); - } - elseif ($route->httpsOnly()) - { - return $this->getScheme(true); - } - - return $this->getScheme(null); - } - - /** - * Get the URL to a controller action. - * - * @param string $action - * @param mixed $parameters - * @param bool $absolute - * @return string - * - * @throws \InvalidArgumentException - */ - public function action($action, $parameters = array(), $absolute = true) - { - if ($this->rootNamespace && ! (strpos($action, '\\') === 0)) - { - $action = $this->rootNamespace.'\\'.$action; - } - else - { - $action = trim($action, '\\'); - } - - if ( ! is_null($route = $this->routes->getByAction($action))) - { - return $this->toRoute($route, $parameters, $absolute); - } - - throw new InvalidArgumentException("Action {$action} not defined."); - } - - /** - * Get the base URL for the request. - * - * @param string $scheme - * @param string $root - * @return string - */ - protected function getRootUrl($scheme, $root = null) - { - if (is_null($root)) - { - if (is_null($this->cachedRoot)) - { - $this->cachedRoot = $this->forcedRoot ?: $this->request->root(); - } - - $root = $this->cachedRoot; - } - - $start = starts_with($root, 'http://') ? 'http://' : 'https://'; - - return preg_replace('~'.$start.'~', $scheme, $root, 1); - } - - /** - * Set the forced root URL. - * - * @param string $root - * @return void - */ - public function forceRootUrl($root) - { - $this->forcedRoot = rtrim($root, '/'); - $this->cachedRoot = null; - } - - /** - * Determine if the given path is a valid URL. - * - * @param string $path - * @return bool - */ - public function isValidUrl($path) - { - if (starts_with($path, ['#', '//', 'mailto:', 'tel:', 'http://', 'https://'])) return true; - - return filter_var($path, FILTER_VALIDATE_URL) !== false; - } - - /** - * Format the given URL segments into a single URL. - * - * @param string $root - * @param string $path - * @param string $tail - * @return string - */ - protected function trimUrl($root, $path, $tail = '') - { - return trim($root.'/'.trim($path.'/'.$tail, '/'), '/'); - } - - /** - * Get the request instance. - * - * @return \Symfony\Component\HttpFoundation\Request - */ - public function getRequest() - { - return $this->request; - } - - /** - * Set the current request instance. - * - * @param \Illuminate\Http\Request $request - * @return void - */ - public function setRequest(Request $request) - { - $this->request = $request; - - $this->cachedRoot = null; - $this->cachedSchema = null; - } - - /** - * Set the route collection. - * - * @param \Illuminate\Routing\RouteCollection $routes - * @return $this - */ - public function setRoutes(RouteCollection $routes) - { - $this->routes = $routes; - - return $this; - } - - /** - * Get the previous URL from the session if possible. - * - * @return string|null - */ - protected function getPreviousUrlFromSession() - { - $session = $this->getSession(); - - return $session ? $session->previousUrl() : null; - } - - /** - * Get the session implementation from the resolver. - * - * @return \Illuminate\Session\Store - */ - protected function getSession() - { - return call_user_func($this->sessionResolver ?: function() {}); - } - - /** - * Set the session resolver for the generator. - * - * @param callable $sessionResolver - * @return $this - */ - public function setSessionResolver(callable $sessionResolver) - { - $this->sessionResolver = $sessionResolver; - - return $this; - } - - /** - * Set the root controller namespace. - * - * @param string $rootNamespace - * @return $this - */ - public function setRootControllerNamespace($rootNamespace) - { - $this->rootNamespace = $rootNamespace; - - return $this; - } - +class UrlGenerator implements UrlGeneratorContract +{ + use Macroable; + + /** + * The route collection. + * + * @var \Illuminate\Routing\RouteCollection + */ + protected $routes; + + /** + * The request instance. + * + * @var \Illuminate\Http\Request + */ + protected $request; + + /** + * The forced URL root. + * + * @var string + */ + protected $forcedRoot; + + /** + * The forced schema for URLs. + * + * @var string + */ + protected $forceSchema; + + /** + * A cached copy of the URL root for the current request. + * + * @var string|null + */ + protected $cachedRoot; + + /** + * A cached copy of the URL schema for the current request. + * + * @var string|null + */ + protected $cachedSchema; + + /** + * The root namespace being applied to controller actions. + * + * @var string + */ + protected $rootNamespace; + + /** + * The session resolver callable. + * + * @var callable + */ + protected $sessionResolver; + + /** + * Characters that should not be URL encoded. + * + * @var array + */ + protected $dontEncode = [ + '%2F' => '/', + '%40' => '@', + '%3A' => ':', + '%3B' => ';', + '%2C' => ',', + '%3D' => '=', + '%2B' => '+', + '%21' => '!', + '%2A' => '*', + '%7C' => '|', + '%3F' => '?', + '%26' => '&', + '%23' => '#', + '%25' => '%', + ]; + + /** + * Create a new URL Generator instance. + * + * @param \Illuminate\Routing\RouteCollection $routes + * @param \Illuminate\Http\Request $request + * @return void + */ + public function __construct(RouteCollection $routes, Request $request) + { + $this->routes = $routes; + + $this->setRequest($request); + } + + /** + * Get the full URL for the current request. + * + * @return string + */ + public function full() + { + return $this->request->fullUrl(); + } + + /** + * Get the current URL for the request. + * + * @return string + */ + public function current() + { + return $this->to($this->request->getPathInfo()); + } + + /** + * Get the URL for the previous request. + * + * @return string + */ + public function previous() + { + $referrer = $this->request->headers->get('referer'); + + $url = $referrer ? $this->to($referrer) : $this->getPreviousUrlFromSession(); + + return $url ?: $this->to('/'); + } + + /** + * Generate an absolute URL to the given path. + * + * @param string $path + * @param mixed $extra + * @param bool|null $secure + * @return string + */ + public function to($path, $extra = [], $secure = null) + { + // First we will check if the URL is already a valid URL. If it is we will not + // try to generate a new one but will simply return the URL as is, which is + // convenient since developers do not always have to check if it's valid. + if ($this->isValidUrl($path)) { + return $path; + } + + $scheme = $this->getScheme($secure); + + $extra = $this->formatParameters($extra); + + $tail = implode('/', array_map( + 'rawurlencode', (array) $extra) + ); + + // Once we have the scheme we will compile the "tail" by collapsing the values + // into a single string delimited by slashes. This just makes it convenient + // for passing the array of parameters to this URL as a list of segments. + $root = $this->getRootUrl($scheme); + + if (($queryPosition = strpos($path, '?')) !== false) { + $query = substr($path, $queryPosition); + $path = substr($path, 0, $queryPosition); + } else { + $query = ''; + } + + return $this->trimUrl($root, $path, $tail).$query; + } + + /** + * Generate a secure, absolute URL to the given path. + * + * @param string $path + * @param array $parameters + * @return string + */ + public function secure($path, $parameters = []) + { + return $this->to($path, $parameters, true); + } + + /** + * Generate a URL to an application asset. + * + * @param string $path + * @param bool|null $secure + * @return string + */ + public function asset($path, $secure = null) + { + if ($this->isValidUrl($path)) { + return $path; + } + + // Once we get the root URL, we will check to see if it contains an index.php + // file in the paths. If it does, we will remove it since it is not needed + // for asset paths, but only for routes to endpoints in the application. + $root = $this->getRootUrl($this->getScheme($secure)); + + return $this->removeIndex($root).'/'.trim($path, '/'); + } + + /** + * Generate a URL to an asset from a custom root domain such as CDN, etc. + * + * @param string $root + * @param string $path + * @param bool|null $secure + * @return string + */ + public function assetFrom($root, $path, $secure = null) + { + // Once we get the root URL, we will check to see if it contains an index.php + // file in the paths. If it does, we will remove it since it is not needed + // for asset paths, but only for routes to endpoints in the application. + $root = $this->getRootUrl($this->getScheme($secure), $root); + + return $this->removeIndex($root).'/'.trim($path, '/'); + } + + /** + * Remove the index.php file from a path. + * + * @param string $root + * @return string + */ + protected function removeIndex($root) + { + $i = 'index.php'; + + return Str::contains($root, $i) ? str_replace('/'.$i, '', $root) : $root; + } + + /** + * Generate a URL to a secure asset. + * + * @param string $path + * @return string + */ + public function secureAsset($path) + { + return $this->asset($path, true); + } + + /** + * Get the scheme for a raw URL. + * + * @param bool|null $secure + * @return string + */ + protected function getScheme($secure) + { + if (is_null($secure)) { + if (is_null($this->cachedSchema)) { + $this->cachedSchema = $this->forceSchema ?: $this->request->getScheme().'://'; + } + + return $this->cachedSchema; + } + + return $secure ? 'https://' : 'http://'; + } + + /** + * Force the schema for URLs. + * + * @param string $schema + * @return void + */ + public function forceSchema($schema) + { + $this->cachedSchema = null; + + $this->forceSchema = $schema.'://'; + } + + /** + * Get the URL to a named route. + * + * @param string $name + * @param mixed $parameters + * @param bool $absolute + * @return string + * + * @throws \InvalidArgumentException + */ + public function route($name, $parameters = [], $absolute = true) + { + if (! is_null($route = $this->routes->getByName($name))) { + return $this->toRoute($route, $parameters, $absolute); + } + + throw new InvalidArgumentException("Route [{$name}] not defined."); + } + + /** + * Get the URL for a given route instance. + * + * @param \Illuminate\Routing\Route $route + * @param mixed $parameters + * @param bool $absolute + * @return string + */ + protected function toRoute($route, $parameters, $absolute) + { + $parameters = $this->formatParameters($parameters); + + $domain = $this->getRouteDomain($route, $parameters); + + $uri = strtr(rawurlencode($this->addQueryString($this->trimUrl( + $root = $this->replaceRoot($route, $domain, $parameters), + $this->replaceRouteParameters($route->uri(), $parameters) + ), $parameters)), $this->dontEncode); + + return $absolute ? $uri : '/'.ltrim(str_replace($root, '', $uri), '/'); + } + + /** + * Replace the parameters on the root path. + * + * @param \Illuminate\Routing\Route $route + * @param string $domain + * @param array $parameters + * @return string + */ + protected function replaceRoot($route, $domain, &$parameters) + { + return $this->replaceRouteParameters($this->getRouteRoot($route, $domain), $parameters); + } + + /** + * Replace all of the wildcard parameters for a route path. + * + * @param string $path + * @param array $parameters + * @return string + */ + protected function replaceRouteParameters($path, array &$parameters) + { + if (count($parameters)) { + $path = preg_replace_sub( + '/\{.*?\}/', $parameters, $this->replaceNamedParameters($path, $parameters) + ); + } + + return trim(preg_replace('/\{.*?\?\}/', '', $path), '/'); + } + + /** + * Replace all of the named parameters in the path. + * + * @param string $path + * @param array $parameters + * @return string + */ + protected function replaceNamedParameters($path, &$parameters) + { + return preg_replace_callback('/\{(.*?)\??\}/', function ($m) use (&$parameters) { + return isset($parameters[$m[1]]) ? Arr::pull($parameters, $m[1]) : $m[0]; + }, $path); + } + + /** + * Add a query string to the URI. + * + * @param string $uri + * @param array $parameters + * @return mixed|string + */ + protected function addQueryString($uri, array $parameters) + { + // If the URI has a fragment, we will move it to the end of the URI since it will + // need to come after any query string that may be added to the URL else it is + // not going to be available. We will remove it then append it back on here. + if (! is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) { + $uri = preg_replace('/#.*/', '', $uri); + } + + $uri .= $this->getRouteQueryString($parameters); + + return is_null($fragment) ? $uri : $uri."#{$fragment}"; + } + + /** + * Format the array of URL parameters. + * + * @param mixed|array $parameters + * @return array + */ + protected function formatParameters($parameters) + { + return $this->replaceRoutableParameters($parameters); + } + + /** + * Replace UrlRoutable parameters with their route parameter. + * + * @param array $parameters + * @return array + */ + protected function replaceRoutableParameters($parameters = []) + { + $parameters = is_array($parameters) ? $parameters : [$parameters]; + + foreach ($parameters as $key => $parameter) { + if ($parameter instanceof UrlRoutable) { + $parameters[$key] = $parameter->getRouteKey(); + } + } + + return $parameters; + } + + /** + * Get the query string for a given route. + * + * @param array $parameters + * @return string + */ + protected function getRouteQueryString(array $parameters) + { + // First we will get all of the string parameters that are remaining after we + // have replaced the route wildcards. We'll then build a query string from + // these string parameters then use it as a starting point for the rest. + if (count($parameters) == 0) { + return ''; + } + + $query = http_build_query( + $keyed = $this->getStringParameters($parameters) + ); + + // Lastly, if there are still parameters remaining, we will fetch the numeric + // parameters that are in the array and add them to the query string or we + // will make the initial query string if it wasn't started with strings. + if (count($keyed) < count($parameters)) { + $query .= '&'.implode( + '&', $this->getNumericParameters($parameters) + ); + } + + return '?'.trim($query, '&'); + } + + /** + * Get the string parameters from a given list. + * + * @param array $parameters + * @return array + */ + protected function getStringParameters(array $parameters) + { + return Arr::where($parameters, function ($k) { + return is_string($k); + }); + } + + /** + * Get the numeric parameters from a given list. + * + * @param array $parameters + * @return array + */ + protected function getNumericParameters(array $parameters) + { + return Arr::where($parameters, function ($k) { + return is_numeric($k); + }); + } + + /** + * Get the formatted domain for a given route. + * + * @param \Illuminate\Routing\Route $route + * @param array $parameters + * @return string + */ + protected function getRouteDomain($route, &$parameters) + { + return $route->domain() ? $this->formatDomain($route, $parameters) : null; + } + + /** + * Format the domain and port for the route and request. + * + * @param \Illuminate\Routing\Route $route + * @param array $parameters + * @return string + */ + protected function formatDomain($route, &$parameters) + { + return $this->addPortToDomain($this->getDomainAndScheme($route)); + } + + /** + * Get the domain and scheme for the route. + * + * @param \Illuminate\Routing\Route $route + * @return string + */ + protected function getDomainAndScheme($route) + { + return $this->getRouteScheme($route).$route->domain(); + } + + /** + * Add the port to the domain if necessary. + * + * @param string $domain + * @return string + */ + protected function addPortToDomain($domain) + { + $secure = $this->request->isSecure(); + + $port = (int) $this->request->getPort(); + + if (($secure && $port === 443) || (! $secure && $port === 80)) { + return $domain; + } + + return $domain.':'.$port; + } + + /** + * Get the root of the route URL. + * + * @param \Illuminate\Routing\Route $route + * @param string $domain + * @return string + */ + protected function getRouteRoot($route, $domain) + { + return $this->getRootUrl($this->getRouteScheme($route), $domain); + } + + /** + * Get the scheme for the given route. + * + * @param \Illuminate\Routing\Route $route + * @return string + */ + protected function getRouteScheme($route) + { + if ($route->httpOnly()) { + return $this->getScheme(false); + } elseif ($route->httpsOnly()) { + return $this->getScheme(true); + } + + return $this->getScheme(null); + } + + /** + * Get the URL to a controller action. + * + * @param string $action + * @param mixed $parameters + * @param bool $absolute + * @return string + * + * @throws \InvalidArgumentException + */ + public function action($action, $parameters = [], $absolute = true) + { + if ($this->rootNamespace && ! (strpos($action, '\\') === 0)) { + $action = $this->rootNamespace.'\\'.$action; + } else { + $action = trim($action, '\\'); + } + + if (! is_null($route = $this->routes->getByAction($action))) { + return $this->toRoute($route, $parameters, $absolute); + } + + throw new InvalidArgumentException("Action {$action} not defined."); + } + + /** + * Get the base URL for the request. + * + * @param string $scheme + * @param string $root + * @return string + */ + protected function getRootUrl($scheme, $root = null) + { + if (is_null($root)) { + if (is_null($this->cachedRoot)) { + $this->cachedRoot = $this->forcedRoot ?: $this->request->root(); + } + + $root = $this->cachedRoot; + } + + $start = Str::startsWith($root, 'http://') ? 'http://' : 'https://'; + + return preg_replace('~'.$start.'~', $scheme, $root, 1); + } + + /** + * Set the forced root URL. + * + * @param string $root + * @return void + */ + public function forceRootUrl($root) + { + $this->forcedRoot = rtrim($root, '/'); + $this->cachedRoot = null; + } + + /** + * Determine if the given path is a valid URL. + * + * @param string $path + * @return bool + */ + public function isValidUrl($path) + { + if (Str::startsWith($path, ['#', '//', 'mailto:', 'tel:', 'http://', 'https://'])) { + return true; + } + + return filter_var($path, FILTER_VALIDATE_URL) !== false; + } + + /** + * Format the given URL segments into a single URL. + * + * @param string $root + * @param string $path + * @param string $tail + * @return string + */ + protected function trimUrl($root, $path, $tail = '') + { + return trim($root.'/'.trim($path.'/'.$tail, '/'), '/'); + } + + /** + * Get the request instance. + * + * @return \Illuminate\Http\Request + */ + public function getRequest() + { + return $this->request; + } + + /** + * Set the current request instance. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + public function setRequest(Request $request) + { + $this->request = $request; + + $this->cachedRoot = null; + $this->cachedSchema = null; + } + + /** + * Set the route collection. + * + * @param \Illuminate\Routing\RouteCollection $routes + * @return $this + */ + public function setRoutes(RouteCollection $routes) + { + $this->routes = $routes; + + return $this; + } + + /** + * Get the previous URL from the session if possible. + * + * @return string|null + */ + protected function getPreviousUrlFromSession() + { + $session = $this->getSession(); + + return $session ? $session->previousUrl() : null; + } + + /** + * Get the session implementation from the resolver. + * + * @return \Illuminate\Session\Store|null + */ + protected function getSession() + { + if ($this->sessionResolver) { + return call_user_func($this->sessionResolver); + } + } + + /** + * Set the session resolver for the generator. + * + * @param callable $sessionResolver + * @return $this + */ + public function setSessionResolver(callable $sessionResolver) + { + $this->sessionResolver = $sessionResolver; + + return $this; + } + + /** + * Set the root controller namespace. + * + * @param string $rootNamespace + * @return $this + */ + public function setRootControllerNamespace($rootNamespace) + { + $this->rootNamespace = $rootNamespace; + + return $this; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Routing/composer.json b/application/vendor/laravel/framework/src/Illuminate/Routing/composer.json index f2d2d1f..af0a63b 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Routing/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Routing/composer.json @@ -14,16 +14,16 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/container": "5.0.*", - "illuminate/contracts": "5.0.*", - "illuminate/http": "5.0.*", - "illuminate/pipeline": "5.0.*", - "illuminate/session": "5.0.*", - "illuminate/support": "5.0.*", - "symfony/http-foundation": "2.6.*", - "symfony/http-kernel": "2.6.*", - "symfony/routing": "2.6.*" + "php": ">=5.5.9", + "illuminate/container": "5.1.*", + "illuminate/contracts": "5.1.*", + "illuminate/http": "5.1.*", + "illuminate/pipeline": "5.1.*", + "illuminate/session": "5.1.*", + "illuminate/support": "5.1.*", + "symfony/http-foundation": "2.7.*", + "symfony/http-kernel": "2.7.*", + "symfony/routing": "2.7.*" }, "autoload": { "psr-4": { @@ -32,11 +32,12 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "suggest": { - "illuminate/console": "Required to use the make commands (5.0.*)." + "illuminate/console": "Required to use the make commands (5.1.*).", + "symfony/psr-http-message-bridge": "Required to psr7 bridging features (0.2.*)." }, "minimum-stability": "dev" } diff --git a/application/vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php b/application/vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php index fce32e6..a2990bd 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php +++ b/application/vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php @@ -1,93 +1,94 @@ -cache = $cache; - $this->minutes = $minutes; - } + /** + * The number of minutes to store the data in the cache. + * + * @var int + */ + protected $minutes; - /** - * {@inheritDoc} - */ - public function open($savePath, $sessionName) - { - return true; - } + /** + * Create a new cache driven handler instance. + * + * @param \Illuminate\Contracts\Cache\Repository $cache + * @param int $minutes + * @return void + */ + public function __construct(CacheContract $cache, $minutes) + { + $this->cache = $cache; + $this->minutes = $minutes; + } - /** - * {@inheritDoc} - */ - public function close() - { - return true; - } + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + return true; + } - /** - * {@inheritDoc} - */ - public function read($sessionId) - { - return $this->cache->get($sessionId, ''); - } + /** + * {@inheritdoc} + */ + public function close() + { + return true; + } - /** - * {@inheritDoc} - */ - public function write($sessionId, $data) - { - return $this->cache->put($sessionId, $data, $this->minutes); - } + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + return $this->cache->get($sessionId, ''); + } - /** - * {@inheritDoc} - */ - public function destroy($sessionId) - { - return $this->cache->forget($sessionId); - } + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + return $this->cache->put($sessionId, $data, $this->minutes); + } - /** - * {@inheritDoc} - */ - public function gc($lifetime) - { - return true; - } + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + return $this->cache->forget($sessionId); + } - /** - * Get the underlying cache repository. - * - * @return \Illuminate\Contracts\Cache\Repository - */ - public function getCache() - { - return $this->cache; - } + /** + * {@inheritdoc} + */ + public function gc($lifetime) + { + return true; + } + /** + * Get the underlying cache repository. + * + * @return \Illuminate\Contracts\Cache\Repository + */ + public function getCache() + { + return $this->cache; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Session/CommandsServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Session/CommandsServiceProvider.php index 9f9c897..9514c4f 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Session/CommandsServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Session/CommandsServiceProvider.php @@ -1,39 +1,40 @@ -app->singleton('command.session.database', function($app) - { - return new Console\SessionTableCommand($app['files'], $app['composer']); - }); +class CommandsServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; - $this->commands('command.session.database'); - } + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton('command.session.database', function ($app) { + return new SessionTableCommand($app['files'], $app['composer']); + }); - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array('command.session.database'); - } + $this->commands('command.session.database'); + } + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['command.session.database']; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Session/Console/SessionTableCommand.php b/application/vendor/laravel/framework/src/Illuminate/Session/Console/SessionTableCommand.php index 455b5fa..2290d3c 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Session/Console/SessionTableCommand.php +++ b/application/vendor/laravel/framework/src/Illuminate/Session/Console/SessionTableCommand.php @@ -1,80 +1,81 @@ -files = $files; - $this->composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function fire() - { - $fullPath = $this->createBaseMigration(); - - $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/database.stub')); - - $this->info('Migration created successfully!'); - - $this->composer->dumpAutoloads(); - } - - /** - * Create a base migration file for the session. - * - * @return string - */ - protected function createBaseMigration() - { - $name = 'create_session_table'; - - $path = $this->laravel->databasePath().'/migrations'; - - return $this->laravel['migration.creator']->create($name, $path); - } - +class SessionTableCommand extends Command +{ + /** + * The console command name. + * + * @var string + */ + protected $name = 'session:table'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Create a migration for the session database table'; + + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * @var \Illuminate\Foundation\Composer + */ + protected $composer; + + /** + * Create a new session table command instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @param \Illuminate\Foundation\Composer $composer + * @return void + */ + public function __construct(Filesystem $files, Composer $composer) + { + parent::__construct(); + + $this->files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + $fullPath = $this->createBaseMigration(); + + $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/database.stub')); + + $this->info('Migration created successfully!'); + + $this->composer->dumpAutoloads(); + } + + /** + * Create a base migration file for the session. + * + * @return string + */ + protected function createBaseMigration() + { + $name = 'create_sessions_table'; + + $path = $this->laravel->databasePath().'/migrations'; + + return $this->laravel['migration.creator']->create($name, $path); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Session/Console/stubs/database.stub b/application/vendor/laravel/framework/src/Illuminate/Session/Console/stubs/database.stub index 2aac433..0529755 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Session/Console/stubs/database.stub +++ b/application/vendor/laravel/framework/src/Illuminate/Session/Console/stubs/database.stub @@ -1,32 +1,31 @@ string('id')->unique(); - $t->text('payload'); - $t->integer('last_activity'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('sessions'); - } +class CreateSessionsTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('sessions', function (Blueprint $table) { + $table->string('id')->unique(); + $table->text('payload'); + $table->integer('last_activity'); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('sessions'); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Session/CookieSessionHandler.php b/application/vendor/laravel/framework/src/Illuminate/Session/CookieSessionHandler.php index 7fc6ffa..0a9bac6 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Session/CookieSessionHandler.php +++ b/application/vendor/laravel/framework/src/Illuminate/Session/CookieSessionHandler.php @@ -1,95 +1,108 @@ -cookie = $cookie; + $this->minutes = $minutes; + } - /** - * Create a new cookie driven handler instance. - * - * @param \Illuminate\Contracts\Cookie\QueueingFactory $cookie - * @param int $minutes - * @return void - */ - public function __construct(CookieJar $cookie, $minutes) - { - $this->cookie = $cookie; - $this->minutes = $minutes; - } + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + return true; + } - /** - * {@inheritDoc} - */ - public function open($savePath, $sessionName) - { - return true; - } + /** + * {@inheritdoc} + */ + public function close() + { + return true; + } - /** - * {@inheritDoc} - */ - public function close() - { - return true; - } + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + $value = $this->request->cookies->get($sessionId) ?: ''; - /** - * {@inheritDoc} - */ - public function read($sessionId) - { - return $this->request->cookies->get($sessionId) ?: ''; - } + if (! is_null($decoded = json_decode($value, true)) && is_array($decoded)) { + if (isset($decoded['expires']) && time() <= $decoded['expires']) { + return $decoded['data']; + } + } - /** - * {@inheritDoc} - */ - public function write($sessionId, $data) - { - $this->cookie->queue($sessionId, $data, $this->minutes); - } + return ''; + } - /** - * {@inheritDoc} - */ - public function destroy($sessionId) - { - $this->cookie->queue($this->cookie->forget($sessionId)); - } + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + $this->cookie->queue($sessionId, json_encode([ + 'data' => $data, + 'expires' => Carbon::now()->addMinutes($this->minutes)->getTimestamp(), + ]), $this->minutes); + } - /** - * {@inheritDoc} - */ - public function gc($lifetime) - { - return true; - } + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + $this->cookie->queue($this->cookie->forget($sessionId)); + } - /** - * Set the request instance. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @return void - */ - public function setRequest(Request $request) - { - $this->request = $request; - } + /** + * {@inheritdoc} + */ + public function gc($lifetime) + { + return true; + } + /** + * Set the request instance. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return void + */ + public function setRequest(Request $request) + { + $this->request = $request; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Session/DatabaseSessionHandler.php b/application/vendor/laravel/framework/src/Illuminate/Session/DatabaseSessionHandler.php index 15d4912..d08d1a1 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Session/DatabaseSessionHandler.php +++ b/application/vendor/laravel/framework/src/Illuminate/Session/DatabaseSessionHandler.php @@ -1,133 +1,177 @@ -table = $table; - $this->connection = $connection; - } - - /** - * {@inheritDoc} - */ - public function open($savePath, $sessionName) - { - return true; - } - - /** - * {@inheritDoc} - */ - public function close() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function read($sessionId) - { - $session = (object) $this->getQuery()->find($sessionId); - - if (isset($session->payload)) - { - $this->exists = true; - - return base64_decode($session->payload); - } - } - - /** - * {@inheritDoc} - */ - public function write($sessionId, $data) - { - if ($this->exists) - { - $this->getQuery()->where('id', $sessionId)->update([ - 'payload' => base64_encode($data), 'last_activity' => time(), - ]); - } - else - { - $this->getQuery()->insert([ - 'id' => $sessionId, 'payload' => base64_encode($data), 'last_activity' => time(), - ]); - } - - $this->exists = true; - } - - /** - * {@inheritDoc} - */ - public function destroy($sessionId) - { - $this->getQuery()->where('id', $sessionId)->delete(); - } - - /** - * {@inheritDoc} - */ - public function gc($lifetime) - { - $this->getQuery()->where('last_activity', '<=', time() - $lifetime)->delete(); - } - - /** - * Get a fresh query builder instance for the table. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function getQuery() - { - return $this->connection->table($this->table); - } - - /** - * Set the existence state for the session. - * - * @param bool $value - * @return $this - */ - public function setExists($value) - { - $this->exists = $value; - - return $this; - } - +class DatabaseSessionHandler implements SessionHandlerInterface, ExistenceAwareInterface +{ + /** + * The database connection instance. + * + * @var \Illuminate\Database\ConnectionInterface + */ + protected $connection; + + /** + * The name of the session table. + * + * @var string + */ + protected $table; + + /** + * The number of minutes the session should be valid. + * + * @var int + */ + protected $minutes; + + /** + * The existence state of the session. + * + * @var bool + */ + protected $exists; + + /** + * Create a new database session handler instance. + * + * @param \Illuminate\Database\ConnectionInterface $connection + * @param string $table + * @param int $minutes + * @return void + */ + public function __construct(ConnectionInterface $connection, $table, $minutes) + { + $this->table = $table; + $this->minutes = $minutes; + $this->connection = $connection; + } + + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + return true; + } + + /** + * {@inheritdoc} + */ + public function close() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + $session = (object) $this->getQuery()->find($sessionId); + + if (isset($session->last_activity)) { + if ($session->last_activity < Carbon::now()->subMinutes($this->minutes)->getTimestamp()) { + $this->exists = true; + + return; + } + } + + if (isset($session->payload)) { + $this->exists = true; + + return base64_decode($session->payload); + } + } + + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + if ($this->exists) { + $this->performUpdate($sessionId, $data); + } else { + $this->performInsert($sessionId, $data); + } + + $this->exists = true; + } + + /** + * Perform an insert operation on the session ID. + * + * @param string $sessionId + * @param string $data + * @return void + */ + protected function performInsert($sessionId, $data) + { + try { + return $this->getQuery()->insert([ + 'id' => $sessionId, 'payload' => base64_encode($data), 'last_activity' => time(), + ]); + } catch (QueryException $e) { + $this->performUpdate($sessionId, $data); + } + } + + /** + * Perform an update operation on the session ID. + * + * @param string $sessionId + * @param string $data + * @return int + */ + protected function performUpdate($sessionId, $data) + { + return $this->getQuery()->where('id', $sessionId)->update([ + 'payload' => base64_encode($data), 'last_activity' => time(), + ]); + } + + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + $this->getQuery()->where('id', $sessionId)->delete(); + } + + /** + * {@inheritdoc} + */ + public function gc($lifetime) + { + $this->getQuery()->where('last_activity', '<=', time() - $lifetime)->delete(); + } + + /** + * Get a fresh query builder instance for the table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function getQuery() + { + return $this->connection->table($this->table); + } + + /** + * Set the existence state for the session. + * + * @param bool $value + * @return $this + */ + public function setExists($value) + { + $this->exists = $value; + + return $this; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php b/application/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php index edf34b8..9811d97 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php +++ b/application/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php @@ -1,72 +1,69 @@ -encrypter = $encrypter; - - parent::__construct($name, $handler, $id); +class EncryptedStore extends Store +{ + /** + * The encrypter instance. + * + * @var \Illuminate\Contracts\Encryption\Encrypter + */ + protected $encrypter; - } + /** + * Create a new session instance. + * + * @param string $name + * @param \SessionHandlerInterface $handler + * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter + * @param string|null $id + * @return void + */ + public function __construct($name, SessionHandlerInterface $handler, EncrypterContract $encrypter, $id = null) + { + $this->encrypter = $encrypter; - /** - * Prepare the raw string data from the session for unserialization. - * - * @param string $data - * @return string - */ - protected function prepareForUnserialize($data) - { - try - { - return $this->encrypter->decrypt($data); - } - catch (DecryptException $e) - { - return serialize([]); - } - } + parent::__construct($name, $handler, $id); + } - /** - * Prepare the serialized session data for storage. - * - * @param string $data - * @return string - */ - protected function prepareForStorage($data) - { - return $this->encrypter->encrypt($data); - } + /** + * Prepare the raw string data from the session for unserialization. + * + * @param string $data + * @return string + */ + protected function prepareForUnserialize($data) + { + try { + return $this->encrypter->decrypt($data); + } catch (DecryptException $e) { + return json_encode([]); + } + } - /** - * Get the encrypter instance. - * - * @return \Illuminate\Contracts\Encryption\Encrypter - */ - public function getEncrypter() - { - return $this->encrypter; - } + /** + * Prepare the serialized session data for storage. + * + * @param string $data + * @return string + */ + protected function prepareForStorage($data) + { + return $this->encrypter->encrypt($data); + } + /** + * Get the encrypter instance. + * + * @return \Illuminate\Contracts\Encryption\Encrypter + */ + public function getEncrypter() + { + return $this->encrypter; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Session/ExistenceAwareInterface.php b/application/vendor/laravel/framework/src/Illuminate/Session/ExistenceAwareInterface.php index 8826531..4a6bd98 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Session/ExistenceAwareInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/Session/ExistenceAwareInterface.php @@ -1,13 +1,14 @@ -path = $path; - $this->files = $files; - } + /** + * The number of minutes the session should be valid. + * + * @var int + */ + protected $minutes; - /** - * {@inheritDoc} - */ - public function open($savePath, $sessionName) - { - return true; - } + /** + * Create a new file driven handler instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @param string $path + * @param int $minutes + * @return void + */ + public function __construct(Filesystem $files, $path, $minutes) + { + $this->path = $path; + $this->files = $files; + $this->minutes = $minutes; + } - /** - * {@inheritDoc} - */ - public function close() - { - return true; - } + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + return true; + } - /** - * {@inheritDoc} - */ - public function read($sessionId) - { - if ($this->files->exists($path = $this->path.'/'.$sessionId)) - { - return $this->files->get($path); - } + /** + * {@inheritdoc} + */ + public function close() + { + return true; + } - return ''; - } + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + if ($this->files->exists($path = $this->path.'/'.$sessionId)) { + if (filemtime($path) >= Carbon::now()->subMinutes($this->minutes)->getTimestamp()) { + return $this->files->get($path); + } + } - /** - * {@inheritDoc} - */ - public function write($sessionId, $data) - { - $this->files->put($this->path.'/'.$sessionId, $data, true); - } + return ''; + } - /** - * {@inheritDoc} - */ - public function destroy($sessionId) - { - $this->files->delete($this->path.'/'.$sessionId); - } + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + $this->files->put($this->path.'/'.$sessionId, $data, true); + } - /** - * {@inheritDoc} - */ - public function gc($lifetime) - { - $files = Finder::create() - ->in($this->path) - ->files() - ->ignoreDotFiles(true) - ->date('<= now - '.$lifetime.' seconds'); + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + $this->files->delete($this->path.'/'.$sessionId); + } - foreach ($files as $file) - { - $this->files->delete($file->getRealPath()); - } - } + /** + * {@inheritdoc} + */ + public function gc($lifetime) + { + $files = Finder::create() + ->in($this->path) + ->files() + ->ignoreDotFiles(true) + ->date('<= now - '.$lifetime.' seconds'); + foreach ($files as $file) { + $this->files->delete($file->getRealPath()); + } + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php b/application/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php index 318e28f..5372024 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php +++ b/application/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php @@ -1,248 +1,244 @@ -manager = $manager; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - $this->sessionHandled = true; - - // If a session driver has been configured, we will need to start the session here - // so that the data is ready for an application. Note that the Laravel sessions - // do not make use of PHP "native" sessions in any way since they are crappy. - if ($this->sessionConfigured()) - { - $session = $this->startSession($request); - - $request->setSession($session); - } - - $response = $next($request); - - // Again, if the session has been configured we will need to close out the session - // so that the attributes may be persisted to some storage medium. We will also - // add the session identifier cookie to the application response headers now. - if ($this->sessionConfigured()) - { - $this->storeCurrentUrl($request, $session); - - $this->collectGarbage($session); - - $this->addCookieToResponse($response, $session); - } - - return $response; - } - - /** - * Perform any final actions for the request lifecycle. - * - * @param \Illuminate\Http\Request $request - * @param \Symfony\Component\HttpFoundation\Response $response - * @return void - */ - public function terminate($request, $response) - { - if ($this->sessionHandled && $this->sessionConfigured() && ! $this->usingCookieSessions()) - { - $this->manager->driver()->save(); - } - } - - /** - * Start the session for the given request. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Session\SessionInterface - */ - protected function startSession(Request $request) - { - with($session = $this->getSession($request))->setRequestOnHandler($request); - - $session->start(); - - return $session; - } - - /** - * Get the session implementation from the manager. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Session\SessionInterface - */ - public function getSession(Request $request) - { - $session = $this->manager->driver(); - - $session->setId($request->cookies->get($session->getName())); - - return $session; - } - - /** - * Store the current URL for the request if necessary. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Session\SessionInterface $session - * @return void - */ - protected function storeCurrentUrl(Request $request, $session) - { - if ($request->method() === 'GET' && $request->route() && ! $request->ajax()) - { - $session->setPreviousUrl($request->fullUrl()); - } - } - - /** - * Remove the garbage from the session if necessary. - * - * @param \Illuminate\Session\SessionInterface $session - * @return void - */ - protected function collectGarbage(SessionInterface $session) - { - $config = $this->manager->getSessionConfig(); - - // Here we will see if this request hits the garbage collection lottery by hitting - // the odds needed to perform garbage collection on any given request. If we do - // hit it, we'll call this handler to let it delete all the expired sessions. - if ($this->configHitsLottery($config)) - { - $session->getHandler()->gc($this->getSessionLifetimeInSeconds()); - } - } - - /** - * Determine if the configuration odds hit the lottery. - * - * @param array $config - * @return bool - */ - protected function configHitsLottery(array $config) - { - return mt_rand(1, $config['lottery'][1]) <= $config['lottery'][0]; - } - - /** - * Add the session cookie to the application response. - * - * @param \Symfony\Component\HttpFoundation\Response $response - * @param \Illuminate\Session\SessionInterface $session - * @return void - */ - protected function addCookieToResponse(Response $response, SessionInterface $session) - { - if ($this->usingCookieSessions()) - { - $this->manager->driver()->save(); - } - - if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) - { - $response->headers->setCookie(new Cookie( - $session->getName(), $session->getId(), $this->getCookieExpirationDate(), - $config['path'], $config['domain'], array_get($config, 'secure', false) - )); - } - } - - /** - * Get the session lifetime in seconds. - * - * @return int - */ - protected function getSessionLifetimeInSeconds() - { - return array_get($this->manager->getSessionConfig(), 'lifetime') * 60; - } - - /** - * Get the cookie lifetime in seconds. - * - * @return int - */ - protected function getCookieExpirationDate() - { - $config = $this->manager->getSessionConfig(); - - return $config['expire_on_close'] ? 0 : Carbon::now()->addMinutes($config['lifetime']); - } - - /** - * Determine if a session driver has been configured. - * - * @return bool - */ - protected function sessionConfigured() - { - return ! is_null(array_get($this->manager->getSessionConfig(), 'driver')); - } - - /** - * Determine if the configured session driver is persistent. - * - * @param array|null $config - * @return bool - */ - protected function sessionIsPersistent(array $config = null) - { - $config = $config ?: $this->manager->getSessionConfig(); - - return ! in_array($config['driver'], array(null, 'array')); - } - - /** - * Determine if the session is using cookie sessions. - * - * @return bool - */ - protected function usingCookieSessions() - { - if ( ! $this->sessionConfigured()) return false; - - return $this->manager->driver()->getHandler() instanceof CookieSessionHandler; - } +class StartSession +{ + /** + * The session manager. + * + * @var \Illuminate\Session\SessionManager + */ + protected $manager; + + /** + * Indicates if the session was handled for the current request. + * + * @var bool + */ + protected $sessionHandled = false; + + /** + * Create a new session middleware. + * + * @param \Illuminate\Session\SessionManager $manager + * @return void + */ + public function __construct(SessionManager $manager) + { + $this->manager = $manager; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + $this->sessionHandled = true; + + // If a session driver has been configured, we will need to start the session here + // so that the data is ready for an application. Note that the Laravel sessions + // do not make use of PHP "native" sessions in any way since they are crappy. + if ($this->sessionConfigured()) { + $session = $this->startSession($request); + + $request->setSession($session); + } + + $response = $next($request); + + // Again, if the session has been configured we will need to close out the session + // so that the attributes may be persisted to some storage medium. We will also + // add the session identifier cookie to the application response headers now. + if ($this->sessionConfigured()) { + $this->storeCurrentUrl($request, $session); + + $this->collectGarbage($session); + + $this->addCookieToResponse($response, $session); + } + + return $response; + } + + /** + * Perform any final actions for the request lifecycle. + * + * @param \Illuminate\Http\Request $request + * @param \Symfony\Component\HttpFoundation\Response $response + * @return void + */ + public function terminate($request, $response) + { + if ($this->sessionHandled && $this->sessionConfigured() && ! $this->usingCookieSessions()) { + $this->manager->driver()->save(); + } + } + + /** + * Start the session for the given request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Session\SessionInterface + */ + protected function startSession(Request $request) + { + with($session = $this->getSession($request))->setRequestOnHandler($request); + + $session->start(); + + return $session; + } + + /** + * Get the session implementation from the manager. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Session\SessionInterface + */ + public function getSession(Request $request) + { + $session = $this->manager->driver(); + + $session->setId($request->cookies->get($session->getName())); + + return $session; + } + + /** + * Store the current URL for the request if necessary. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Session\SessionInterface $session + * @return void + */ + protected function storeCurrentUrl(Request $request, $session) + { + if ($request->method() === 'GET' && $request->route() && ! $request->ajax()) { + $session->setPreviousUrl($request->fullUrl()); + } + } + + /** + * Remove the garbage from the session if necessary. + * + * @param \Illuminate\Session\SessionInterface $session + * @return void + */ + protected function collectGarbage(SessionInterface $session) + { + $config = $this->manager->getSessionConfig(); + + // Here we will see if this request hits the garbage collection lottery by hitting + // the odds needed to perform garbage collection on any given request. If we do + // hit it, we'll call this handler to let it delete all the expired sessions. + if ($this->configHitsLottery($config)) { + $session->getHandler()->gc($this->getSessionLifetimeInSeconds()); + } + } + + /** + * Determine if the configuration odds hit the lottery. + * + * @param array $config + * @return bool + */ + protected function configHitsLottery(array $config) + { + return mt_rand(1, $config['lottery'][1]) <= $config['lottery'][0]; + } + + /** + * Add the session cookie to the application response. + * + * @param \Symfony\Component\HttpFoundation\Response $response + * @param \Illuminate\Session\SessionInterface $session + * @return void + */ + protected function addCookieToResponse(Response $response, SessionInterface $session) + { + if ($this->usingCookieSessions()) { + $this->manager->driver()->save(); + } + + if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) { + $response->headers->setCookie(new Cookie( + $session->getName(), $session->getId(), $this->getCookieExpirationDate(), + $config['path'], $config['domain'], Arr::get($config, 'secure', false) + )); + } + } + + /** + * Get the session lifetime in seconds. + * + * @return int + */ + protected function getSessionLifetimeInSeconds() + { + return Arr::get($this->manager->getSessionConfig(), 'lifetime') * 60; + } + + /** + * Get the cookie lifetime in seconds. + * + * @return int + */ + protected function getCookieExpirationDate() + { + $config = $this->manager->getSessionConfig(); + + return $config['expire_on_close'] ? 0 : Carbon::now()->addMinutes($config['lifetime']); + } + + /** + * Determine if a session driver has been configured. + * + * @return bool + */ + protected function sessionConfigured() + { + return ! is_null(Arr::get($this->manager->getSessionConfig(), 'driver')); + } + + /** + * Determine if the configured session driver is persistent. + * + * @param array|null $config + * @return bool + */ + protected function sessionIsPersistent(array $config = null) + { + $config = $config ?: $this->manager->getSessionConfig(); + + return ! in_array($config['driver'], [null, 'array']); + } + + /** + * Determine if the session is using cookie sessions. + * + * @return bool + */ + protected function usingCookieSessions() + { + if (! $this->sessionConfigured()) { + return false; + } + + return $this->manager->driver()->getHandler() instanceof CookieSessionHandler; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Session/SessionInterface.php b/application/vendor/laravel/framework/src/Illuminate/Session/SessionInterface.php index 43537d4..1d7f18d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Session/SessionInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/Session/SessionInterface.php @@ -1,30 +1,31 @@ -buildSession(parent::callCustomCreator($driver)); - } - - /** - * Create an instance of the "array" session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createArrayDriver() - { - return $this->buildSession(new NullSessionHandler); - } - - /** - * Create an instance of the "cookie" session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createCookieDriver() - { - $lifetime = $this->app['config']['session.lifetime']; - - return $this->buildSession(new CookieSessionHandler($this->app['cookie'], $lifetime)); - } - - /** - * Create an instance of the file session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createFileDriver() - { - return $this->createNativeDriver(); - } - - /** - * Create an instance of the file session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createNativeDriver() - { - $path = $this->app['config']['session.files']; - - return $this->buildSession(new FileSessionHandler($this->app['files'], $path)); - } - - /** - * Create an instance of the database session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createDatabaseDriver() - { - $connection = $this->getDatabaseConnection(); - - $table = $this->app['config']['session.table']; - - return $this->buildSession(new DatabaseSessionHandler($connection, $table)); - } - - /** - * Get the database connection for the database driver. - * - * @return \Illuminate\Database\Connection - */ - protected function getDatabaseConnection() - { - $connection = $this->app['config']['session.connection']; - - return $this->app['db']->connection($connection); - } - - /** - * Create an instance of the APC session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createApcDriver() - { - return $this->createCacheBased('apc'); - } - - /** - * Create an instance of the Memcached session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createMemcachedDriver() - { - return $this->createCacheBased('memcached'); - } - - /** - * Create an instance of the Wincache session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createWincacheDriver() - { - return $this->createCacheBased('wincache'); - } - - /** - * Create an instance of the Redis session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createRedisDriver() - { - $handler = $this->createCacheHandler('redis'); - - $handler->getCache()->getStore()->setConnection($this->app['config']['session.connection']); - - return $this->buildSession($handler); - } - - /** - * Create an instance of a cache driven driver. - * - * @param string $driver - * @return \Illuminate\Session\Store - */ - protected function createCacheBased($driver) - { - return $this->buildSession($this->createCacheHandler($driver)); - } - - /** - * Create the cache based session handler instance. - * - * @param string $driver - * @return \Illuminate\Session\CacheBasedSessionHandler - */ - protected function createCacheHandler($driver) - { - $minutes = $this->app['config']['session.lifetime']; - - return new CacheBasedSessionHandler($this->app['cache']->driver($driver), $minutes); - } - - /** - * Build the session instance. - * - * @param \SessionHandlerInterface $handler - * @return \Illuminate\Session\Store - */ - protected function buildSession($handler) - { - if ($this->app['config']['session.encrypt']) - { - return new EncryptedStore( - $this->app['config']['session.cookie'], $handler, $this->app['encrypter'] - ); - } - else - { - return new Store($this->app['config']['session.cookie'], $handler); - } - } - - /** - * Get the session configuration. - * - * @return array - */ - public function getSessionConfig() - { - return $this->app['config']['session']; - } - - /** - * Get the default session driver name. - * - * @return string - */ - public function getDefaultDriver() - { - return $this->app['config']['session.driver']; - } - - /** - * Set the default session driver name. - * - * @param string $name - * @return void - */ - public function setDefaultDriver($name) - { - $this->app['config']['session.driver'] = $name; - } - +class SessionManager extends Manager +{ + /** + * Call a custom driver creator. + * + * @param string $driver + * @return mixed + */ + protected function callCustomCreator($driver) + { + return $this->buildSession(parent::callCustomCreator($driver)); + } + + /** + * Create an instance of the "array" session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createArrayDriver() + { + return $this->buildSession(new NullSessionHandler); + } + + /** + * Create an instance of the "cookie" session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createCookieDriver() + { + $lifetime = $this->app['config']['session.lifetime']; + + return $this->buildSession(new CookieSessionHandler($this->app['cookie'], $lifetime)); + } + + /** + * Create an instance of the file session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createFileDriver() + { + return $this->createNativeDriver(); + } + + /** + * Create an instance of the file session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createNativeDriver() + { + $path = $this->app['config']['session.files']; + + $lifetime = $this->app['config']['session.lifetime']; + + return $this->buildSession(new FileSessionHandler($this->app['files'], $path, $lifetime)); + } + + /** + * Create an instance of the database session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createDatabaseDriver() + { + $connection = $this->getDatabaseConnection(); + + $table = $this->app['config']['session.table']; + + $lifetime = $this->app['config']['session.lifetime']; + + return $this->buildSession(new DatabaseSessionHandler($connection, $table, $lifetime)); + } + + /** + * Get the database connection for the database driver. + * + * @return \Illuminate\Database\Connection + */ + protected function getDatabaseConnection() + { + $connection = $this->app['config']['session.connection']; + + return $this->app['db']->connection($connection); + } + + /** + * Create an instance of the APC session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createApcDriver() + { + return $this->createCacheBased('apc'); + } + + /** + * Create an instance of the Memcached session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createMemcachedDriver() + { + return $this->createCacheBased('memcached'); + } + + /** + * Create an instance of the Wincache session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createWincacheDriver() + { + return $this->createCacheBased('wincache'); + } + + /** + * Create an instance of the Redis session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createRedisDriver() + { + $handler = $this->createCacheHandler('redis'); + + $handler->getCache()->getStore()->setConnection($this->app['config']['session.connection']); + + return $this->buildSession($handler); + } + + /** + * Create an instance of a cache driven driver. + * + * @param string $driver + * @return \Illuminate\Session\Store + */ + protected function createCacheBased($driver) + { + return $this->buildSession($this->createCacheHandler($driver)); + } + + /** + * Create the cache based session handler instance. + * + * @param string $driver + * @return \Illuminate\Session\CacheBasedSessionHandler + */ + protected function createCacheHandler($driver) + { + $minutes = $this->app['config']['session.lifetime']; + + return new CacheBasedSessionHandler(clone $this->app['cache']->driver($driver), $minutes); + } + + /** + * Build the session instance. + * + * @param \SessionHandlerInterface $handler + * @return \Illuminate\Session\Store + */ + protected function buildSession($handler) + { + if ($this->app['config']['session.encrypt']) { + return new EncryptedStore( + $this->app['config']['session.cookie'], $handler, $this->app['encrypter'] + ); + } else { + return new Store($this->app['config']['session.cookie'], $handler); + } + } + + /** + * Get the session configuration. + * + * @return array + */ + public function getSessionConfig() + { + return $this->app['config']['session']; + } + + /** + * Get the default session driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['session.driver']; + } + + /** + * Set the default session driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['session.driver'] = $name; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php index 8f89095..bc49ebc 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php @@ -1,52 +1,51 @@ -registerSessionManager(); - - $this->registerSessionDriver(); - - $this->app->singleton('Illuminate\Session\Middleware\StartSession'); - } - - /** - * Register the session manager instance. - * - * @return void - */ - protected function registerSessionManager() - { - $this->app->singleton('session', function($app) - { - return new SessionManager($app); - }); - } - - /** - * Register the session driver instance. - * - * @return void - */ - protected function registerSessionDriver() - { - $this->app->singleton('session.store', function($app) - { - // First, we will create the session manager which is responsible for the - // creation of the various session drivers when they are needed by the - // application instance, and will resolve them on a lazy load basis. - $manager = $app['session']; - - return $manager->driver(); - }); - } +use Illuminate\Support\ServiceProvider; +class SessionServiceProvider extends ServiceProvider +{ + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerSessionManager(); + + $this->registerSessionDriver(); + + $this->app->singleton('Illuminate\Session\Middleware\StartSession'); + } + + /** + * Register the session manager instance. + * + * @return void + */ + protected function registerSessionManager() + { + $this->app->singleton('session', function ($app) { + return new SessionManager($app); + }); + } + + /** + * Register the session driver instance. + * + * @return void + */ + protected function registerSessionDriver() + { + $this->app->singleton('session.store', function ($app) { + // First, we will create the session manager which is responsible for the + // creation of the various session drivers when they are needed by the + // application instance, and will resolve them on a lazy load basis. + $manager = $app['session']; + + return $manager->driver(); + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Session/Store.php b/application/vendor/laravel/framework/src/Illuminate/Session/Store.php index 2cf8e88..3419713 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Session/Store.php +++ b/application/vendor/laravel/framework/src/Illuminate/Session/Store.php @@ -1,678 +1,699 @@ -setId($id); - $this->name = $name; - $this->handler = $handler; - $this->metaBag = new MetadataBag; - } - - /** - * {@inheritdoc} - */ - public function start() - { - $this->loadSession(); - - if ( ! $this->has('_token')) $this->regenerateToken(); - - return $this->started = true; - } - - /** - * Load the session data from the handler. - * - * @return void - */ - protected function loadSession() - { - $this->attributes = array_merge($this->attributes, $this->readFromHandler()); - - foreach (array_merge($this->bags, array($this->metaBag)) as $bag) - { - $this->initializeLocalBag($bag); - - $bag->initialize($this->bagData[$bag->getStorageKey()]); - } - } - - /** - * Read the session data from the handler. - * - * @return array - */ - protected function readFromHandler() - { - $data = $this->handler->read($this->getId()); - - if ($data) - { - $data = @unserialize($this->prepareForUnserialize($data)); - - if ($data !== false) return $data; - } - - return []; - } - - /** - * Prepare the raw string data from the session for unserialization. - * - * @param string $data - * @return string - */ - protected function prepareForUnserialize($data) - { - return $data; - } - - /** - * Initialize a bag in storage if it doesn't exist. - * - * @param \Symfony\Component\HttpFoundation\Session\SessionBagInterface $bag - * @return void - */ - protected function initializeLocalBag($bag) - { - $this->bagData[$bag->getStorageKey()] = $this->pull($bag->getStorageKey(), []); - } - - /** - * {@inheritdoc} - */ - public function getId() - { - return $this->id; - } - - /** - * {@inheritdoc} - */ - public function setId($id) - { - if ( ! $this->isValidId($id)) - { - $id = $this->generateSessionId(); - } - - $this->id = $id; - } - - /** - * Determine if this is a valid session ID. - * - * @param string $id - * @return bool - */ - public function isValidId($id) - { - return is_string($id) && preg_match('/^[a-f0-9]{40}$/', $id); - } - - /** - * Get a new, random session ID. - * - * @return string - */ - protected function generateSessionId() - { - return sha1(uniqid('', true).str_random(25).microtime(true)); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - /** - * {@inheritdoc} - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * {@inheritdoc} - */ - public function invalidate($lifetime = null) - { - $this->clear(); - - return $this->migrate(true, $lifetime); - } - - /** - * {@inheritdoc} - */ - public function migrate($destroy = false, $lifetime = null) - { - if ($destroy) $this->handler->destroy($this->getId()); - - $this->setExists(false); - - $this->id = $this->generateSessionId(); - - return true; - } - - /** - * Generate a new session identifier. - * - * @param bool $destroy - * @return bool - */ - public function regenerate($destroy = false) - { - return $this->migrate($destroy); - } - - /** - * {@inheritdoc} - */ - public function save() - { - $this->addBagDataToSession(); - - $this->ageFlashData(); - - $this->handler->write($this->getId(), $this->prepareForStorage(serialize($this->attributes))); - - $this->started = false; - } - - /** - * Prepare the serialized session data for storage. - * - * @param string $data - * @return string - */ - protected function prepareForStorage($data) - { - return $data; - } - - /** - * Merge all of the bag data into the session. - * - * @return void - */ - protected function addBagDataToSession() - { - foreach (array_merge($this->bags, array($this->metaBag)) as $bag) - { - $this->put($bag->getStorageKey(), $this->bagData[$bag->getStorageKey()]); - } - } - - /** - * Age the flash data for the session. - * - * @return void - */ - public function ageFlashData() - { - foreach ($this->get('flash.old', array()) as $old) { $this->forget($old); } - - $this->put('flash.old', $this->get('flash.new', array())); - - $this->put('flash.new', array()); - } - - /** - * {@inheritdoc} - */ - public function has($name) - { - return ! is_null($this->get($name)); - } - - /** - * {@inheritdoc} - */ - public function get($name, $default = null) - { - return array_get($this->attributes, $name, $default); - } - - /** - * Get the value of a given key and then forget it. - * - * @param string $key - * @param string $default - * @return mixed - */ - public function pull($key, $default = null) - { - return array_pull($this->attributes, $key, $default); - } - - /** - * Determine if the session contains old input. - * - * @param string $key - * @return bool - */ - public function hasOldInput($key = null) - { - $old = $this->getOldInput($key); - - return is_null($key) ? count($old) > 0 : ! is_null($old); - } - - /** - * Get the requested item from the flashed input array. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function getOldInput($key = null, $default = null) - { - $input = $this->get('_old_input', array()); - - // Input that is flashed to the session can be easily retrieved by the - // developer, making repopulating old forms and the like much more - // convenient, since the request's previous input is available. - return array_get($input, $key, $default); - } - - /** - * {@inheritdoc} - */ - public function set($name, $value) - { - array_set($this->attributes, $name, $value); - } - - /** - * Put a key / value pair or array of key / value pairs in the session. - * - * @param string|array $key - * @param mixed|null $value - * @return void - */ - public function put($key, $value = null) - { - if ( ! is_array($key)) $key = array($key => $value); - - foreach ($key as $arrayKey => $arrayValue) - { - $this->set($arrayKey, $arrayValue); - } - } - - /** - * Push a value onto a session array. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function push($key, $value) - { - $array = $this->get($key, array()); - - $array[] = $value; - - $this->put($key, $array); - } - - /** - * Flash a key / value pair to the session. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function flash($key, $value) - { - $this->put($key, $value); - - $this->push('flash.new', $key); - - $this->removeFromOldFlashData(array($key)); - } - - /** - * Flash an input array to the session. - * - * @param array $value - * @return void - */ - public function flashInput(array $value) - { - $this->flash('_old_input', $value); - } - - /** - * Reflash all of the session flash data. - * - * @return void - */ - public function reflash() - { - $this->mergeNewFlashes($this->get('flash.old', array())); - - $this->put('flash.old', array()); - } - - /** - * Reflash a subset of the current flash data. - * - * @param array|mixed $keys - * @return void - */ - public function keep($keys = null) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - $this->mergeNewFlashes($keys); - - $this->removeFromOldFlashData($keys); - } - - /** - * Merge new flash keys into the new flash array. - * - * @param array $keys - * @return void - */ - protected function mergeNewFlashes(array $keys) - { - $values = array_unique(array_merge($this->get('flash.new', array()), $keys)); - - $this->put('flash.new', $values); - } - - /** - * Remove the given keys from the old flash data. - * - * @param array $keys - * @return void - */ - protected function removeFromOldFlashData(array $keys) - { - $this->put('flash.old', array_diff($this->get('flash.old', array()), $keys)); - } - - /** - * {@inheritdoc} - */ - public function all() - { - return $this->attributes; - } - - /** - * {@inheritdoc} - */ - public function replace(array $attributes) - { - $this->put($attributes); - } - - /** - * {@inheritdoc} - */ - public function remove($name) - { - return array_pull($this->attributes, $name); - } - - /** - * Remove an item from the session. - * - * @param string $key - * @return void - */ - public function forget($key) - { - array_forget($this->attributes, $key); - } - - /** - * {@inheritdoc} - */ - public function clear() - { - $this->attributes = array(); - - foreach ($this->bags as $bag) - { - $bag->clear(); - } - } - - /** - * Remove all of the items from the session. - * - * @return void - */ - public function flush() - { - $this->clear(); - } - - /** - * {@inheritdoc} - */ - public function isStarted() - { - return $this->started; - } - - /** - * {@inheritdoc} - */ - public function registerBag(SessionBagInterface $bag) - { - $this->bags[$bag->getStorageKey()] = $bag; - } - - /** - * {@inheritdoc} - */ - public function getBag($name) - { - return array_get($this->bags, $name, function() - { - throw new InvalidArgumentException("Bag not registered."); - }); - } - - /** - * {@inheritdoc} - */ - public function getMetadataBag() - { - return $this->metaBag; - } - - /** - * Get the raw bag data array for a given bag. - * - * @param string $name - * @return array - */ - public function getBagData($name) - { - return array_get($this->bagData, $name, array()); - } - - /** - * Get the CSRF token value. - * - * @return string - */ - public function token() - { - return $this->get('_token'); - } - - /** - * Get the CSRF token value. - * - * @return string - */ - public function getToken() - { - return $this->token(); - } - - /** - * Regenerate the CSRF token value. - * - * @return void - */ - public function regenerateToken() - { - $this->put('_token', str_random(40)); - } - - /** - * Get the previous URL from the session. - * - * @return string|null - */ - public function previousUrl() - { - return $this->get('_previous.url'); - } - - /** - * Set the "previous" URL in the session. - * - * @param string $url - * @return void - */ - public function setPreviousUrl($url) - { - return $this->put('_previous.url', $url); - } - - /** - * Set the existence of the session on the handler if applicable. - * - * @param bool $value - * @return void - */ - public function setExists($value) - { - if ($this->handler instanceof ExistenceAwareInterface) - { - $this->handler->setExists($value); - } - } - - /** - * Get the underlying session handler implementation. - * - * @return \SessionHandlerInterface - */ - public function getHandler() - { - return $this->handler; - } - - /** - * Determine if the session handler needs a request. - * - * @return bool - */ - public function handlerNeedsRequest() - { - return $this->handler instanceof CookieSessionHandler; - } - - /** - * Set the request on the handler instance. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @return void - */ - public function setRequestOnHandler(Request $request) - { - if ($this->handlerNeedsRequest()) - { - $this->handler->setRequest($request); - } - } - +class Store implements SessionInterface +{ + /** + * The session ID. + * + * @var string + */ + protected $id; + + /** + * The session name. + * + * @var string + */ + protected $name; + + /** + * The session attributes. + * + * @var array + */ + protected $attributes = []; + + /** + * The session bags. + * + * @var array + */ + protected $bags = []; + + /** + * The meta-data bag instance. + * + * @var \Symfony\Component\HttpFoundation\Session\Storage\MetadataBag + */ + protected $metaBag; + + /** + * Local copies of the session bag data. + * + * @var array + */ + protected $bagData = []; + + /** + * The session handler implementation. + * + * @var \SessionHandlerInterface + */ + protected $handler; + + /** + * Session store started status. + * + * @var bool + */ + protected $started = false; + + /** + * Create a new session instance. + * + * @param string $name + * @param \SessionHandlerInterface $handler + * @param string|null $id + * @return void + */ + public function __construct($name, SessionHandlerInterface $handler, $id = null) + { + $this->setId($id); + $this->name = $name; + $this->handler = $handler; + $this->metaBag = new MetadataBag; + } + + /** + * {@inheritdoc} + */ + public function start() + { + $this->loadSession(); + + if (! $this->has('_token')) { + $this->regenerateToken(); + } + + return $this->started = true; + } + + /** + * Load the session data from the handler. + * + * @return void + */ + protected function loadSession() + { + $this->attributes = array_merge($this->attributes, $this->readFromHandler()); + + foreach (array_merge($this->bags, [$this->metaBag]) as $bag) { + $this->initializeLocalBag($bag); + + $bag->initialize($this->bagData[$bag->getStorageKey()]); + } + } + + /** + * Read the session data from the handler. + * + * @return array + */ + protected function readFromHandler() + { + $data = $this->handler->read($this->getId()); + + if ($data) { + $data = @unserialize($this->prepareForUnserialize($data)); + + if ($data !== false && $data !== null && is_array($data)) { + return $data; + } + } + + return []; + } + + /** + * Prepare the raw string data from the session for unserialization. + * + * @param string $data + * @return string + */ + protected function prepareForUnserialize($data) + { + return $data; + } + + /** + * Initialize a bag in storage if it doesn't exist. + * + * @param \Symfony\Component\HttpFoundation\Session\SessionBagInterface $bag + * @return void + */ + protected function initializeLocalBag($bag) + { + $this->bagData[$bag->getStorageKey()] = $this->pull($bag->getStorageKey(), []); + } + + /** + * {@inheritdoc} + */ + public function getId() + { + return $this->id; + } + + /** + * {@inheritdoc} + */ + public function setId($id) + { + if (! $this->isValidId($id)) { + $id = $this->generateSessionId(); + } + + $this->id = $id; + } + + /** + * Determine if this is a valid session ID. + * + * @param string $id + * @return bool + */ + public function isValidId($id) + { + return is_string($id) && preg_match('/^[a-f0-9]{40}$/', $id); + } + + /** + * Get a new, random session ID. + * + * @return string + */ + protected function generateSessionId() + { + return sha1(uniqid('', true).Str::random(25).microtime(true)); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return $this->name; + } + + /** + * {@inheritdoc} + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * {@inheritdoc} + */ + public function invalidate($lifetime = null) + { + $this->clear(); + + return $this->migrate(true, $lifetime); + } + + /** + * {@inheritdoc} + */ + public function migrate($destroy = false, $lifetime = null) + { + if ($destroy) { + $this->handler->destroy($this->getId()); + } + + $this->setExists(false); + + $this->id = $this->generateSessionId(); + + return true; + } + + /** + * Generate a new session identifier. + * + * @param bool $destroy + * @return bool + */ + public function regenerate($destroy = false) + { + return $this->migrate($destroy); + } + + /** + * {@inheritdoc} + */ + public function save() + { + $this->addBagDataToSession(); + + $this->ageFlashData(); + + $this->handler->write($this->getId(), $this->prepareForStorage(serialize($this->attributes))); + + $this->started = false; + } + + /** + * Prepare the serialized session data for storage. + * + * @param string $data + * @return string + */ + protected function prepareForStorage($data) + { + return $data; + } + + /** + * Merge all of the bag data into the session. + * + * @return void + */ + protected function addBagDataToSession() + { + foreach (array_merge($this->bags, [$this->metaBag]) as $bag) { + $key = $bag->getStorageKey(); + + if (isset($this->bagData[$key])) { + $this->put($key, $this->bagData[$key]); + } + } + } + + /** + * Age the flash data for the session. + * + * @return void + */ + public function ageFlashData() + { + $this->forget($this->get('flash.old', [])); + + $this->put('flash.old', $this->get('flash.new', [])); + + $this->put('flash.new', []); + } + + /** + * {@inheritdoc} + */ + public function has($name) + { + return ! is_null($this->get($name)); + } + + /** + * {@inheritdoc} + */ + public function get($name, $default = null) + { + return Arr::get($this->attributes, $name, $default); + } + + /** + * Get the value of a given key and then forget it. + * + * @param string $key + * @param string $default + * @return mixed + */ + public function pull($key, $default = null) + { + return Arr::pull($this->attributes, $key, $default); + } + + /** + * Determine if the session contains old input. + * + * @param string $key + * @return bool + */ + public function hasOldInput($key = null) + { + $old = $this->getOldInput($key); + + return is_null($key) ? count($old) > 0 : ! is_null($old); + } + + /** + * Get the requested item from the flashed input array. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function getOldInput($key = null, $default = null) + { + $input = $this->get('_old_input', []); + + // Input that is flashed to the session can be easily retrieved by the + // developer, making repopulating old forms and the like much more + // convenient, since the request's previous input is available. + return Arr::get($input, $key, $default); + } + + /** + * {@inheritdoc} + */ + public function set($name, $value) + { + Arr::set($this->attributes, $name, $value); + } + + /** + * Put a key / value pair or array of key / value pairs in the session. + * + * @param string|array $key + * @param mixed $value + * @return void + */ + public function put($key, $value = null) + { + if (! is_array($key)) { + $key = [$key => $value]; + } + + foreach ($key as $arrayKey => $arrayValue) { + $this->set($arrayKey, $arrayValue); + } + } + + /** + * Push a value onto a session array. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function push($key, $value) + { + $array = $this->get($key, []); + + $array[] = $value; + + $this->put($key, $array); + } + + /** + * Flash a key / value pair to the session. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function flash($key, $value) + { + $this->put($key, $value); + + $this->push('flash.new', $key); + + $this->removeFromOldFlashData([$key]); + } + + /** + * Flash a key / value pair to the session + * for immediate use. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function now($key, $value) + { + $this->put($key, $value); + + $this->push('flash.old', $key); + } + + /** + * Flash an input array to the session. + * + * @param array $value + * @return void + */ + public function flashInput(array $value) + { + $this->flash('_old_input', $value); + } + + /** + * Reflash all of the session flash data. + * + * @return void + */ + public function reflash() + { + $this->mergeNewFlashes($this->get('flash.old', [])); + + $this->put('flash.old', []); + } + + /** + * Reflash a subset of the current flash data. + * + * @param array|mixed $keys + * @return void + */ + public function keep($keys = null) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + $this->mergeNewFlashes($keys); + + $this->removeFromOldFlashData($keys); + } + + /** + * Merge new flash keys into the new flash array. + * + * @param array $keys + * @return void + */ + protected function mergeNewFlashes(array $keys) + { + $values = array_unique(array_merge($this->get('flash.new', []), $keys)); + + $this->put('flash.new', $values); + } + + /** + * Remove the given keys from the old flash data. + * + * @param array $keys + * @return void + */ + protected function removeFromOldFlashData(array $keys) + { + $this->put('flash.old', array_diff($this->get('flash.old', []), $keys)); + } + + /** + * {@inheritdoc} + */ + public function all() + { + return $this->attributes; + } + + /** + * {@inheritdoc} + */ + public function replace(array $attributes) + { + $this->put($attributes); + } + + /** + * {@inheritdoc} + */ + public function remove($name) + { + return Arr::pull($this->attributes, $name); + } + + /** + * Remove one or many items from the session. + * + * @param string|array $keys + * @return void + */ + public function forget($keys) + { + Arr::forget($this->attributes, $keys); + } + + /** + * {@inheritdoc} + */ + public function clear() + { + $this->attributes = []; + + foreach ($this->bags as $bag) { + $bag->clear(); + } + } + + /** + * Remove all of the items from the session. + * + * @return void + */ + public function flush() + { + $this->clear(); + } + + /** + * {@inheritdoc} + */ + public function isStarted() + { + return $this->started; + } + + /** + * {@inheritdoc} + */ + public function registerBag(SessionBagInterface $bag) + { + $this->bags[$bag->getStorageKey()] = $bag; + } + + /** + * {@inheritdoc} + */ + public function getBag($name) + { + return Arr::get($this->bags, $name, function () { + throw new InvalidArgumentException('Bag not registered.'); + }); + } + + /** + * {@inheritdoc} + */ + public function getMetadataBag() + { + return $this->metaBag; + } + + /** + * Get the raw bag data array for a given bag. + * + * @param string $name + * @return array + */ + public function getBagData($name) + { + return Arr::get($this->bagData, $name, []); + } + + /** + * Get the CSRF token value. + * + * @return string + */ + public function token() + { + return $this->get('_token'); + } + + /** + * Get the CSRF token value. + * + * @return string + */ + public function getToken() + { + return $this->token(); + } + + /** + * Regenerate the CSRF token value. + * + * @return void + */ + public function regenerateToken() + { + $this->put('_token', Str::random(40)); + } + + /** + * Get the previous URL from the session. + * + * @return string|null + */ + public function previousUrl() + { + return $this->get('_previous.url'); + } + + /** + * Set the "previous" URL in the session. + * + * @param string $url + * @return void + */ + public function setPreviousUrl($url) + { + return $this->put('_previous.url', $url); + } + + /** + * Set the existence of the session on the handler if applicable. + * + * @param bool $value + * @return void + */ + public function setExists($value) + { + if ($this->handler instanceof ExistenceAwareInterface) { + $this->handler->setExists($value); + } + } + + /** + * Get the underlying session handler implementation. + * + * @return \SessionHandlerInterface + */ + public function getHandler() + { + return $this->handler; + } + + /** + * Determine if the session handler needs a request. + * + * @return bool + */ + public function handlerNeedsRequest() + { + return $this->handler instanceof CookieSessionHandler; + } + + /** + * Set the request on the handler instance. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return void + */ + public function setRequestOnHandler(Request $request) + { + if ($this->handlerNeedsRequest()) { + $this->handler->setRequest($request); + } + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Session/TokenMismatchException.php b/application/vendor/laravel/framework/src/Illuminate/Session/TokenMismatchException.php index a0a0060..98d99a1 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Session/TokenMismatchException.php +++ b/application/vendor/laravel/framework/src/Illuminate/Session/TokenMismatchException.php @@ -1,5 +1,10 @@ -=5.4.0", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*", - "nesbot/carbon": "~1.0", - "symfony/finder": "2.6.*", - "symfony/http-foundation": "2.6.*" + "php": ">=5.5.9", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*", + "nesbot/carbon": "~1.19", + "symfony/finder": "2.7.*", + "symfony/http-foundation": "2.7.*" }, "autoload": { "psr-4": { @@ -28,11 +28,11 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "suggest": { - "illuminate/console": "Required to use the session:table command (5.0.*)." + "illuminate/console": "Required to use the session:table command (5.1.*)." }, "minimum-stability": "dev" } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/AggregateServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Support/AggregateServiceProvider.php index 26bd250..ca5f9a8 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/AggregateServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/AggregateServiceProvider.php @@ -1,53 +1,52 @@ -instances = []; - - foreach ($this->providers as $provider) - { - $this->instances[] = $this->app->register($provider); - } - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - $provides = []; - - foreach ($this->providers as $provider) - { - $instance = $this->app->resolveProviderClass($provider); - - $provides = array_merge($provides, $instance->provides()); - } - - return $provides; - } - +instances = []; + + foreach ($this->providers as $provider) { + $this->instances[] = $this->app->register($provider); + } + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + $provides = []; + + foreach ($this->providers as $provider) { + $instance = $this->app->resolveProviderClass($provider); + + $provides = array_merge($provides, $instance->provides()); + } + + return $provides; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/Arr.php b/application/vendor/laravel/framework/src/Illuminate/Support/Arr.php index f0a708e..93e9569 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/Arr.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/Arr.php @@ -1,407 +1,486 @@ - $value) - { - list($innerKey, $innerValue) = call_user_func($callback, $key, $value); - - $results[$innerKey] = $innerValue; - } - - return $results; - } - - /** - * Collapse an array of arrays into a single array. - * - * @param array|\ArrayAccess $array - * @return array - */ - public static function collapse($array) - { - $results = []; - - foreach ($array as $values) - { - if ($values instanceof Collection) $values = $values->all(); - - $results = array_merge($results, $values); - } - - return $results; - } - - /** - * Divide an array into two arrays. One with keys and the other with values. - * - * @param array $array - * @return array - */ - public static function divide($array) - { - return [array_keys($array), array_values($array)]; - } - - /** - * Flatten a multi-dimensional associative array with dots. - * - * @param array $array - * @param string $prepend - * @return array - */ - public static function dot($array, $prepend = '') - { - $results = []; - - foreach ($array as $key => $value) - { - if (is_array($value)) - { - $results = array_merge($results, static::dot($value, $prepend.$key.'.')); - } - else - { - $results[$prepend.$key] = $value; - } - } - - return $results; - } - - /** - * Get all of the given array except for a specified array of items. - * - * @param array $array - * @param array|string $keys - * @return array - */ - public static function except($array, $keys) - { - static::forget($array, $keys); - - return $array; - } - - /** - * Fetch a flattened array of a nested array element. - * - * @param array $array - * @param string $key - * @return array - */ - public static function fetch($array, $key) - { - foreach (explode('.', $key) as $segment) - { - $results = []; - - foreach ($array as $value) - { - if (array_key_exists($segment, $value = (array) $value)) - { - $results[] = $value[$segment]; - } - } - - $array = array_values($results); - } - - return array_values($results); - } - - /** - * Return the first element in an array passing a given truth test. - * - * @param array $array - * @param callable $callback - * @param mixed $default - * @return mixed - */ - public static function first($array, callable $callback, $default = null) - { - foreach ($array as $key => $value) - { - if (call_user_func($callback, $key, $value)) return $value; - } - - return value($default); - } - - /** - * Return the last element in an array passing a given truth test. - * - * @param array $array - * @param callable $callback - * @param mixed $default - * @return mixed - */ - public static function last($array, callable $callback, $default = null) - { - return static::first(array_reverse($array), $callback, $default); - } - - /** - * Flatten a multi-dimensional array into a single level. - * - * @param array $array - * @return array - */ - public static function flatten($array) - { - $return = []; - - array_walk_recursive($array, function($x) use (&$return) { $return[] = $x; }); - - return $return; - } - - /** - * Remove one or many array items from a given array using "dot" notation. - * - * @param array $array - * @param array|string $keys - * @return void - */ - public static function forget(&$array, $keys) - { - $original =& $array; - - foreach ((array) $keys as $key) - { - $parts = explode('.', $key); - - while (count($parts) > 1) - { - $part = array_shift($parts); - - if (isset($array[$part]) && is_array($array[$part])) - { - $array =& $array[$part]; - } - } - - unset($array[array_shift($parts)]); - - // clean up after each pass - $array =& $original; - } - } - - /** - * Get an item from an array using "dot" notation. - * - * @param array $array - * @param string $key - * @param mixed $default - * @return mixed - */ - public static function get($array, $key, $default = null) - { - if (is_null($key)) return $array; - - if (isset($array[$key])) return $array[$key]; - - foreach (explode('.', $key) as $segment) - { - if ( ! is_array($array) || ! array_key_exists($segment, $array)) - { - return value($default); - } - - $array = $array[$segment]; - } - - return $array; - } - - /** - * Check if an item exists in an array using "dot" notation. - * - * @param array $array - * @param string $key - * @return bool - */ - public static function has($array, $key) - { - if (empty($array) || is_null($key)) return false; - - if (array_key_exists($key, $array)) return true; - - foreach (explode('.', $key) as $segment) - { - if ( ! is_array($array) || ! array_key_exists($segment, $array)) - { - return false; - } - - $array = $array[$segment]; - } - - return true; - } - - /** - * Get a subset of the items from the given array. - * - * @param array $array - * @param array|string $keys - * @return array - */ - public static function only($array, $keys) - { - return array_intersect_key($array, array_flip((array) $keys)); - } - - /** - * Pluck an array of values from an array. - * - * @param array $array - * @param string $value - * @param string $key - * @return array - */ - public static function pluck($array, $value, $key = null) - { - $results = []; - - foreach ($array as $item) - { - $itemValue = data_get($item, $value); - - // If the key is "null", we will just append the value to the array and keep - // looping. Otherwise we will key the array using the value of the key we - // received from the developer. Then we'll return the final array form. - if (is_null($key)) - { - $results[] = $itemValue; - } - else - { - $itemKey = data_get($item, $key); - - $results[$itemKey] = $itemValue; - } - } - - return $results; - } - - /** - * Get a value from the array, and remove it. - * - * @param array $array - * @param string $key - * @param mixed $default - * @return mixed - */ - public static function pull(&$array, $key, $default = null) - { - $value = static::get($array, $key, $default); - - static::forget($array, $key); - - return $value; - } - - /** - * Set an array item to a given value using "dot" notation. - * - * If no key is given to the method, the entire array will be replaced. - * - * @param array $array - * @param string $key - * @param mixed $value - * @return array - */ - public static function set(&$array, $key, $value) - { - if (is_null($key)) return $array = $value; - - $keys = explode('.', $key); - - while (count($keys) > 1) - { - $key = array_shift($keys); - - // If the key doesn't exist at this depth, we will just create an empty array - // to hold the next value, allowing us to create the arrays to hold final - // values at the correct depth. Then we'll keep digging into the array. - if ( ! isset($array[$key]) || ! is_array($array[$key])) - { - $array[$key] = []; - } - - $array =& $array[$key]; - } - - $array[array_shift($keys)] = $value; - - return $array; - } - - /** - * Sort the array using the given callback. - * - * @param array $array - * @param callable $callback - * @return array - */ - public static function sort($array, callable $callback) - { - return Collection::make($array)->sortBy($callback)->all(); - } - - /** - * Filter the array using the given callback. - * - * @param array $array - * @param callable $callback - * @return array - */ - public static function where($array, callable $callback) - { - $filtered = []; - - foreach ($array as $key => $value) - { - if (call_user_func($callback, $key, $value)) $filtered[$key] = $value; - } - - return $filtered; - } +use Illuminate\Support\Traits\Macroable; +class Arr +{ + use Macroable; + + /** + * Add an element to an array using "dot" notation if it doesn't exist. + * + * @param array $array + * @param string $key + * @param mixed $value + * @return array + */ + public static function add($array, $key, $value) + { + if (is_null(static::get($array, $key))) { + static::set($array, $key, $value); + } + + return $array; + } + + /** + * Build a new array using a callback. + * + * @param array $array + * @param callable $callback + * @return array + */ + public static function build($array, callable $callback) + { + $results = []; + + foreach ($array as $key => $value) { + list($innerKey, $innerValue) = call_user_func($callback, $key, $value); + + $results[$innerKey] = $innerValue; + } + + return $results; + } + + /** + * Collapse an array of arrays into a single array. + * + * @param \ArrayAccess|array $array + * @return array + */ + public static function collapse($array) + { + $results = []; + + foreach ($array as $values) { + if ($values instanceof Collection) { + $values = $values->all(); + } + + $results = array_merge($results, $values); + } + + return $results; + } + + /** + * Divide an array into two arrays. One with keys and the other with values. + * + * @param array $array + * @return array + */ + public static function divide($array) + { + return [array_keys($array), array_values($array)]; + } + + /** + * Flatten a multi-dimensional associative array with dots. + * + * @param array $array + * @param string $prepend + * @return array + */ + public static function dot($array, $prepend = '') + { + $results = []; + + foreach ($array as $key => $value) { + if (is_array($value)) { + $results = array_merge($results, static::dot($value, $prepend.$key.'.')); + } else { + $results[$prepend.$key] = $value; + } + } + + return $results; + } + + /** + * Get all of the given array except for a specified array of items. + * + * @param array $array + * @param array|string $keys + * @return array + */ + public static function except($array, $keys) + { + static::forget($array, $keys); + + return $array; + } + + /** + * Fetch a flattened array of a nested array element. + * + * @param array $array + * @param string $key + * @return array + * + * @deprecated since version 5.1. Use pluck instead. + */ + public static function fetch($array, $key) + { + foreach (explode('.', $key) as $segment) { + $results = []; + + foreach ($array as $value) { + if (array_key_exists($segment, $value = (array) $value)) { + $results[] = $value[$segment]; + } + } + + $array = array_values($results); + } + + return array_values($results); + } + + /** + * Return the first element in an array passing a given truth test. + * + * @param array $array + * @param callable $callback + * @param mixed $default + * @return mixed + */ + public static function first($array, callable $callback, $default = null) + { + foreach ($array as $key => $value) { + if (call_user_func($callback, $key, $value)) { + return $value; + } + } + + return value($default); + } + + /** + * Return the last element in an array passing a given truth test. + * + * @param array $array + * @param callable $callback + * @param mixed $default + * @return mixed + */ + public static function last($array, callable $callback, $default = null) + { + return static::first(array_reverse($array), $callback, $default); + } + + /** + * Flatten a multi-dimensional array into a single level. + * + * @param array $array + * @return array + */ + public static function flatten($array) + { + $return = []; + + array_walk_recursive($array, function ($x) use (&$return) { + $return[] = $x; + }); + + return $return; + } + + /** + * Remove one or many array items from a given array using "dot" notation. + * + * @param array $array + * @param array|string $keys + * @return void + */ + public static function forget(&$array, $keys) + { + $original = &$array; + + $keys = (array) $keys; + + if (count($keys) === 0) { + return; + } + + foreach ($keys as $key) { + $parts = explode('.', $key); + + while (count($parts) > 1) { + $part = array_shift($parts); + + if (isset($array[$part]) && is_array($array[$part])) { + $array = &$array[$part]; + } else { + $parts = []; + } + } + + unset($array[array_shift($parts)]); + + // clean up after each pass + $array = &$original; + } + } + + /** + * Get an item from an array using "dot" notation. + * + * @param array $array + * @param string $key + * @param mixed $default + * @return mixed + */ + public static function get($array, $key, $default = null) + { + if (is_null($key)) { + return $array; + } + + if (isset($array[$key])) { + return $array[$key]; + } + + foreach (explode('.', $key) as $segment) { + if (! is_array($array) || ! array_key_exists($segment, $array)) { + return value($default); + } + + $array = $array[$segment]; + } + + return $array; + } + + /** + * Check if an item exists in an array using "dot" notation. + * + * @param array $array + * @param string $key + * @return bool + */ + public static function has($array, $key) + { + if (empty($array) || is_null($key)) { + return false; + } + + if (array_key_exists($key, $array)) { + return true; + } + + foreach (explode('.', $key) as $segment) { + if (! is_array($array) || ! array_key_exists($segment, $array)) { + return false; + } + + $array = $array[$segment]; + } + + return true; + } + + /** + * Determines if an array is associative. + * + * An array is "associative" if it doesn't have sequential numerical keys beginning with zero. + * + * @param array $array + * @return bool + */ + public static function isAssoc(array $array) + { + $keys = array_keys($array); + + return array_keys($keys) !== $keys; + } + + /** + * Get a subset of the items from the given array. + * + * @param array $array + * @param array|string $keys + * @return array + */ + public static function only($array, $keys) + { + return array_intersect_key($array, array_flip((array) $keys)); + } + + /** + * Pluck an array of values from an array. + * + * @param array $array + * @param string|array $value + * @param string|array|null $key + * @return array + */ + public static function pluck($array, $value, $key = null) + { + $results = []; + + list($value, $key) = static::explodePluckParameters($value, $key); + + foreach ($array as $item) { + $itemValue = data_get($item, $value); + + // If the key is "null", we will just append the value to the array and keep + // looping. Otherwise we will key the array using the value of the key we + // received from the developer. Then we'll return the final array form. + if (is_null($key)) { + $results[] = $itemValue; + } else { + $itemKey = data_get($item, $key); + + $results[$itemKey] = $itemValue; + } + } + + return $results; + } + + /** + * Explode the "value" and "key" arguments passed to "pluck". + * + * @param string|array $value + * @param string|array|null $key + * @return array + */ + protected static function explodePluckParameters($value, $key) + { + $value = is_string($value) ? explode('.', $value) : $value; + + $key = is_null($key) || is_array($key) ? $key : explode('.', $key); + + return [$value, $key]; + } + + /** + * Push an item onto the beginning of an array. + * + * @param array $array + * @param mixed $value + * @param mixed $key + * @return array + */ + public static function prepend($array, $value, $key = null) + { + if (is_null($key)) { + array_unshift($array, $value); + } else { + $array = [$key => $value] + $array; + } + + return $array; + } + + /** + * Get a value from the array, and remove it. + * + * @param array $array + * @param string $key + * @param mixed $default + * @return mixed + */ + public static function pull(&$array, $key, $default = null) + { + $value = static::get($array, $key, $default); + + static::forget($array, $key); + + return $value; + } + + /** + * Set an array item to a given value using "dot" notation. + * + * If no key is given to the method, the entire array will be replaced. + * + * @param array $array + * @param string $key + * @param mixed $value + * @return array + */ + public static function set(&$array, $key, $value) + { + if (is_null($key)) { + return $array = $value; + } + + $keys = explode('.', $key); + + while (count($keys) > 1) { + $key = array_shift($keys); + + // If the key doesn't exist at this depth, we will just create an empty array + // to hold the next value, allowing us to create the arrays to hold final + // values at the correct depth. Then we'll keep digging into the array. + if (! isset($array[$key]) || ! is_array($array[$key])) { + $array[$key] = []; + } + + $array = &$array[$key]; + } + + $array[array_shift($keys)] = $value; + + return $array; + } + + /** + * Sort the array using the given callback. + * + * @param array $array + * @param callable $callback + * @return array + */ + public static function sort($array, callable $callback) + { + return Collection::make($array)->sortBy($callback)->all(); + } + + /** + * Recursively sort an array by keys and values. + * + * @param array $array + * @return array + */ + public static function sortRecursive($array) + { + foreach ($array as &$value) { + if (is_array($value)) { + $value = static::sortRecursive($value); + } + } + + if (static::isAssoc($array)) { + ksort($array); + } else { + sort($array); + } + + return $array; + } + + /** + * Filter the array using the given callback. + * + * @param array $array + * @param callable $callback + * @return array + */ + public static function where($array, callable $callback) + { + $filtered = []; + + foreach ($array as $key => $value) { + if (call_user_func($callback, $key, $value)) { + $filtered[$key] = $value; + } + } + + return $filtered; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/ClassLoader.php b/application/vendor/laravel/framework/src/Illuminate/Support/ClassLoader.php index 88cbde6..6a8d235 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/ClassLoader.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/ClassLoader.php @@ -1,107 +1,104 @@ -getArrayableItems($items); - - $this->items = (array) $items; - } - - /** - * Create a new collection instance if the value isn't one already. - * - * @param mixed $items - * @return static - */ - public static function make($items = null) - { - return new static($items); - } - - /** - * Get all of the items in the collection. - * - * @return array - */ - public function all() - { - return $this->items; - } - - /** - * Collapse the collection of items into a single array. - * - * @return static - */ - public function collapse() - { - return new static(array_collapse($this->items)); - } - - /** - * Determine if an item exists in the collection. - * - * @param mixed $key - * @param mixed $value - * @return bool - */ - public function contains($key, $value = null) - { - if (func_num_args() == 2) - { - return $this->contains(function($k, $item) use ($key, $value) - { - return data_get($item, $key) == $value; - }); - } - - if ($this->useAsCallable($key)) - { - return ! is_null($this->first($key)); - } - - return in_array($key, $this->items); - } - - /** - * Diff the collection with the given items. - * - * @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\Arrayable|array $items - * @return static - */ - public function diff($items) - { - return new static(array_diff($this->items, $this->getArrayableItems($items))); - } - - /** - * Execute a callback over each item. - * - * @param callable $callback - * @return $this - */ - public function each(callable $callback) - { - array_map($callback, $this->items); - - return $this; - } - - /** - * Fetch a nested element of the collection. - * - * @param string $key - * @return static - */ - public function fetch($key) - { - return new static(array_fetch($this->items, $key)); - } - - /** - * Run a filter over each of the items. - * - * @param callable $callback - * @return static - */ - public function filter(callable $callback) - { - return new static(array_filter($this->items, $callback)); - } - - /** - * Filter items by the given key value pair. - * - * @param string $key - * @param mixed $value - * @param bool $strict - * @return static - */ - public function where($key, $value, $strict = true) - { - return $this->filter(function($item) use ($key, $value, $strict) - { - return $strict ? data_get($item, $key) === $value +class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable +{ + use Macroable; + + /** + * The items contained in the collection. + * + * @var array + */ + protected $items = []; + + /** + * Create a new collection. + * + * @param mixed $items + * @return void + */ + public function __construct($items = []) + { + $this->items = is_array($items) ? $items : $this->getArrayableItems($items); + } + + /** + * Create a new collection instance if the value isn't one already. + * + * @param mixed $items + * @return static + */ + public static function make($items = []) + { + return new static($items); + } + + /** + * Get all of the items in the collection. + * + * @return array + */ + public function all() + { + return $this->items; + } + + /** + * Get the average value of a given key. + * + * @param string|null $key + * @return mixed + */ + public function avg($key = null) + { + if ($count = $this->count()) { + return $this->sum($key) / $count; + } + } + + /** + * Alias for the "avg" method. + * + * @param string|null $key + * @return mixed + */ + public function average($key = null) + { + return $this->avg($key); + } + + /** + * Collapse the collection of items into a single array. + * + * @return static + */ + public function collapse() + { + return new static(Arr::collapse($this->items)); + } + + /** + * Determine if an item exists in the collection. + * + * @param mixed $key + * @param mixed $value + * @return bool + */ + public function contains($key, $value = null) + { + if (func_num_args() == 2) { + return $this->contains(function ($k, $item) use ($key, $value) { + return data_get($item, $key) == $value; + }); + } + + if ($this->useAsCallable($key)) { + return ! is_null($this->first($key)); + } + + return in_array($key, $this->items); + } + + /** + * Get the items in the collection that are not present in the given items. + * + * @param mixed $items + * @return static + */ + public function diff($items) + { + return new static(array_diff($this->items, $this->getArrayableItems($items))); + } + + /** + * Execute a callback over each item. + * + * @param callable $callback + * @return $this + */ + public function each(callable $callback) + { + foreach ($this->items as $key => $item) { + if ($callback($item, $key) === false) { + break; + } + } + + return $this; + } + + /** + * Create a new collection consisting of every n-th element. + * + * @param int $step + * @param int $offset + * @return static + */ + public function every($step, $offset = 0) + { + $new = []; + + $position = 0; + + foreach ($this->items as $key => $item) { + if ($position % $step === $offset) { + $new[] = $item; + } + + $position++; + } + + return new static($new); + } + + /** + * Get all items except for those with the specified keys. + * + * @param mixed $keys + * @return static + */ + public function except($keys) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + return new static(Arr::except($this->items, $keys)); + } + + /** + * Fetch a nested element of the collection. + * + * @param string $key + * @return static + * + * @deprecated since version 5.1. Use pluck instead. + */ + public function fetch($key) + { + return new static(Arr::fetch($this->items, $key)); + } + + /** + * Run a filter over each of the items. + * + * @param callable|null $callback + * @return static + */ + public function filter(callable $callback = null) + { + if ($callback) { + return new static(array_filter($this->items, $callback)); + } + + return new static(array_filter($this->items)); + } + + /** + * Filter items by the given key value pair. + * + * @param string $key + * @param mixed $value + * @param bool $strict + * @return static + */ + public function where($key, $value, $strict = true) + { + return $this->filter(function ($item) use ($key, $value, $strict) { + return $strict ? data_get($item, $key) === $value : data_get($item, $key) == $value; - }); - } - - /** - * Filter items by the given key value pair using loose comparison. - * - * @param string $key - * @param mixed $value - * @return static - */ - public function whereLoose($key, $value) - { - return $this->where($key, $value, false); - } - - /** - * Get the first item from the collection. - * - * @param callable $callback - * @param mixed $default - * @return mixed|null - */ - public function first(callable $callback = null, $default = null) - { - if (is_null($callback)) - { - return count($this->items) > 0 ? reset($this->items) : null; - } - - return array_first($this->items, $callback, $default); - } - - /** - * Get a flattened array of the items in the collection. - * - * @return static - */ - public function flatten() - { - return new static(array_flatten($this->items)); - } - - /** - * Flip the items in the collection. - * - * @return static - */ - public function flip() - { - return new static(array_flip($this->items)); - } - - /** - * Remove an item from the collection by key. - * - * @param mixed $key - * @return void - */ - public function forget($key) - { - $this->offsetUnset($key); - } - - /** - * Get an item from the collection by key. - * - * @param mixed $key - * @param mixed $default - * @return mixed - */ - public function get($key, $default = null) - { - if ($this->offsetExists($key)) - { - return $this->items[$key]; - } - - return value($default); - } - - /** - * Group an associative array by a field or using a callback. - * - * @param callable|string $groupBy - * @return static - */ - public function groupBy($groupBy) - { - if ( ! $this->useAsCallable($groupBy)) - { - return $this->groupBy($this->valueRetriever($groupBy)); - } - - $results = []; - - foreach ($this->items as $key => $value) - { - $results[$groupBy($value, $key)][] = $value; - } - - return new static($results); - } - - /** - * Key an associative array by a field or using a callback. - * - * @param callable|string $keyBy - * @return static - */ - public function keyBy($keyBy) - { - if ( ! $this->useAsCallable($keyBy)) - { - return $this->keyBy($this->valueRetriever($keyBy)); - } - - $results = []; - - foreach ($this->items as $item) - { - $results[$keyBy($item)] = $item; - } - - return new static($results); - } - - /** - * Determine if an item exists in the collection by key. - * - * @param mixed $key - * @return bool - */ - public function has($key) - { - return $this->offsetExists($key); - } - - /** - * Concatenate values of a given key as a string. - * - * @param string $value - * @param string $glue - * @return string - */ - public function implode($value, $glue = null) - { - $first = $this->first(); - - if (is_array($first) || is_object($first)) - { - return implode($glue, $this->lists($value)); - } - - return implode($value, $this->items); - } - - /** - * Intersect the collection with the given items. - * - * @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\Arrayable|array $items - * @return static - */ - public function intersect($items) - { - return new static(array_intersect($this->items, $this->getArrayableItems($items))); - } - - /** - * Determine if the collection is empty or not. - * - * @return bool - */ - public function isEmpty() - { - return empty($this->items); - } - - /** - * Determine if the given value is callable, but not a string. - * - * @param mixed $value - * @return bool - */ - protected function useAsCallable($value) - { - return ! is_string($value) && is_callable($value); - } - - /** - * Get the keys of the collection items. - * - * @return static - */ - public function keys() - { - return new static(array_keys($this->items)); - } - - /** - * Get the last item from the collection. - * - * @return mixed|null - */ - public function last() - { - return count($this->items) > 0 ? end($this->items) : null; - } - - /** - * Get an array with the values of a given key. - * - * @param string $value - * @param string $key - * @return array - */ - public function lists($value, $key = null) - { - return array_pluck($this->items, $value, $key); - } - - /** - * Run a map over each of the items. - * - * @param callable $callback - * @return static - */ - public function map(callable $callback) - { - return new static(array_map($callback, $this->items, array_keys($this->items))); - } - - /** - * Merge the collection with the given items. - * - * @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\Arrayable|array $items - * @return static - */ - public function merge($items) - { - return new static(array_merge($this->items, $this->getArrayableItems($items))); - } - - /** - * "Paginate" the collection by slicing it into a smaller collection. - * - * @param int $page - * @param int $perPage - * @return static - */ - public function forPage($page, $perPage) - { - return $this->slice(($page - 1) * $perPage, $perPage); - } - - /** - * Get and remove the last item from the collection. - * - * @return mixed|null - */ - public function pop() - { - return array_pop($this->items); - } - - /** - * Push an item onto the beginning of the collection. - * - * @param mixed $value - * @return void - */ - public function prepend($value) - { - array_unshift($this->items, $value); - } - - /** - * Push an item onto the end of the collection. - * - * @param mixed $value - * @return void - */ - public function push($value) - { - $this->offsetSet(null, $value); - } - - /** - * Pulls an item from the collection. - * - * @param mixed $key - * @param mixed $default - * @return mixed - */ - public function pull($key, $default = null) - { - return array_pull($this->items, $key, $default); - } - - /** - * Put an item in the collection by key. - * - * @param mixed $key - * @param mixed $value - * @return void - */ - public function put($key, $value) - { - $this->offsetSet($key, $value); - } - - /** - * Get one or more items randomly from the collection. - * - * @param int $amount - * @return mixed - */ - public function random($amount = 1) - { - if ($this->isEmpty()) return; - - $keys = array_rand($this->items, $amount); - - return is_array($keys) ? array_intersect_key($this->items, array_flip($keys)) : $this->items[$keys]; - } - - /** - * Reduce the collection to a single value. - * - * @param callable $callback - * @param mixed $initial - * @return mixed - */ - public function reduce(callable $callback, $initial = null) - { - return array_reduce($this->items, $callback, $initial); - } - - /** - * Create a collection of all elements that do not pass a given truth test. - * - * @param callable|mixed $callback - * @return static - */ - public function reject($callback) - { - if ($this->useAsCallable($callback)) - { - return $this->filter(function($item) use ($callback) - { - return ! $callback($item); - }); - } - - return $this->filter(function($item) use ($callback) - { - return $item != $callback; - }); - } - - /** - * Reverse items order. - * - * @return static - */ - public function reverse() - { - return new static(array_reverse($this->items)); - } - - /** - * Search the collection for a given value and return the corresponding key if successful. - * - * @param mixed $value - * @param bool $strict - * @return mixed - */ - public function search($value, $strict = false) - { - if ( ! $this->useAsCallable($value)) - { - return array_search($value, $this->items, $strict); - } - - foreach ($this->items as $key => $item) - { - if ($value($item, $key)) return $key; - } - - return false; - } - - /** - * Get and remove the first item from the collection. - * - * @return mixed|null - */ - public function shift() - { - return array_shift($this->items); - } - - /** - * Shuffle the items in the collection. - * - * @return $this - */ - public function shuffle() - { - shuffle($this->items); - - return $this; - } - - /** - * Slice the underlying collection array. - * - * @param int $offset - * @param int $length - * @param bool $preserveKeys - * @return static - */ - public function slice($offset, $length = null, $preserveKeys = false) - { - return new static(array_slice($this->items, $offset, $length, $preserveKeys)); - } - - /** - * Chunk the underlying collection array. - * - * @param int $size - * @param bool $preserveKeys - * @return static - */ - public function chunk($size, $preserveKeys = false) - { - $chunks = []; - - foreach (array_chunk($this->items, $size, $preserveKeys) as $chunk) - { - $chunks[] = new static($chunk); - } - - return new static($chunks); - } - - /** - * Sort through each item with a callback. - * - * @param callable $callback - * @return $this - */ - public function sort(callable $callback) - { - uasort($this->items, $callback); - - return $this; - } - - /** - * Sort the collection using the given callback. - * - * @param callable|string $callback - * @param int $options - * @param bool $descending - * @return $this - */ - public function sortBy($callback, $options = SORT_REGULAR, $descending = false) - { - $results = []; - - if ( ! $this->useAsCallable($callback)) - { - $callback = $this->valueRetriever($callback); - } - - // First we will loop through the items and get the comparator from a callback - // function which we were given. Then, we will sort the returned values and - // and grab the corresponding values for the sorted keys from this array. - foreach ($this->items as $key => $value) - { - $results[$key] = $callback($value, $key); - } - - $descending ? arsort($results, $options) + }); + } + + /** + * Filter items by the given key value pair using loose comparison. + * + * @param string $key + * @param mixed $value + * @return static + */ + public function whereLoose($key, $value) + { + return $this->where($key, $value, false); + } + + /** + * Get the first item from the collection. + * + * @param callable|null $callback + * @param mixed $default + * @return mixed + */ + public function first(callable $callback = null, $default = null) + { + if (is_null($callback)) { + return count($this->items) > 0 ? reset($this->items) : value($default); + } + + return Arr::first($this->items, $callback, $default); + } + + /** + * Get a flattened array of the items in the collection. + * + * @return static + */ + public function flatten() + { + return new static(Arr::flatten($this->items)); + } + + /** + * Flip the items in the collection. + * + * @return static + */ + public function flip() + { + return new static(array_flip($this->items)); + } + + /** + * Remove an item from the collection by key. + * + * @param string|array $keys + * @return $this + */ + public function forget($keys) + { + foreach ((array) $keys as $key) { + $this->offsetUnset($key); + } + + return $this; + } + + /** + * Get an item from the collection by key. + * + * @param mixed $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + if ($this->offsetExists($key)) { + return $this->items[$key]; + } + + return value($default); + } + + /** + * Group an associative array by a field or using a callback. + * + * @param callable|string $groupBy + * @param bool $preserveKeys + * @return static + */ + public function groupBy($groupBy, $preserveKeys = false) + { + $groupBy = $this->valueRetriever($groupBy); + + $results = []; + + foreach ($this->items as $key => $value) { + $groupKey = $groupBy($value, $key); + + if (! array_key_exists($groupKey, $results)) { + $results[$groupKey] = new static; + } + + $results[$groupKey]->offsetSet($preserveKeys ? $key : null, $value); + } + + return new static($results); + } + + /** + * Key an associative array by a field or using a callback. + * + * @param callable|string $keyBy + * @return static + */ + public function keyBy($keyBy) + { + $keyBy = $this->valueRetriever($keyBy); + + $results = []; + + foreach ($this->items as $item) { + $results[$keyBy($item)] = $item; + } + + return new static($results); + } + + /** + * Determine if an item exists in the collection by key. + * + * @param mixed $key + * @return bool + */ + public function has($key) + { + return $this->offsetExists($key); + } + + /** + * Concatenate values of a given key as a string. + * + * @param string $value + * @param string $glue + * @return string + */ + public function implode($value, $glue = null) + { + $first = $this->first(); + + if (is_array($first) || is_object($first)) { + return implode($glue, $this->pluck($value)->all()); + } + + return implode($value, $this->items); + } + + /** + * Intersect the collection with the given items. + * + * @param mixed $items + * @return static + */ + public function intersect($items) + { + return new static(array_intersect($this->items, $this->getArrayableItems($items))); + } + + /** + * Determine if the collection is empty or not. + * + * @return bool + */ + public function isEmpty() + { + return empty($this->items); + } + + /** + * Determine if the given value is callable, but not a string. + * + * @param mixed $value + * @return bool + */ + protected function useAsCallable($value) + { + return ! is_string($value) && is_callable($value); + } + + /** + * Get the keys of the collection items. + * + * @return static + */ + public function keys() + { + return new static(array_keys($this->items)); + } + + /** + * Get the last item from the collection. + * + * @param callable|null $callback + * @param mixed $default + * @return mixed + */ + public function last(callable $callback = null, $default = null) + { + if (is_null($callback)) { + return count($this->items) > 0 ? end($this->items) : value($default); + } + + return Arr::last($this->items, $callback, $default); + } + + /** + * Get the values of a given key. + * + * @param string $value + * @param string|null $key + * @return static + */ + public function pluck($value, $key = null) + { + return new static(Arr::pluck($this->items, $value, $key)); + } + + /** + * Alias for the "pluck" method. + * + * @param string $value + * @param string|null $key + * @return static + */ + public function lists($value, $key = null) + { + return $this->pluck($value, $key); + } + + /** + * Run a map over each of the items. + * + * @param callable $callback + * @return static + */ + public function map(callable $callback) + { + $keys = array_keys($this->items); + + $items = array_map($callback, $this->items, $keys); + + return new static(array_combine($keys, $items)); + } + + /** + * Map a collection and flatten the result by a single level. + * + * @param callable $callback + * @return static + */ + public function flatMap(callable $callback) + { + return $this->map($callback)->collapse(); + } + + /** + * Get the max value of a given key. + * + * @param string|null $key + * @return mixed + */ + public function max($key = null) + { + return $this->reduce(function ($result, $item) use ($key) { + $value = data_get($item, $key); + + return is_null($result) || $value > $result ? $value : $result; + }); + } + + /** + * Merge the collection with the given items. + * + * @param mixed $items + * @return static + */ + public function merge($items) + { + return new static(array_merge($this->items, $this->getArrayableItems($items))); + } + + /** + * Get the min value of a given key. + * + * @param string|null $key + * @return mixed + */ + public function min($key = null) + { + return $this->reduce(function ($result, $item) use ($key) { + $value = data_get($item, $key); + + return is_null($result) || $value < $result ? $value : $result; + }); + } + + /** + * Get the items with the specified keys. + * + * @param mixed $keys + * @return static + */ + public function only($keys) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + return new static(Arr::only($this->items, $keys)); + } + + /** + * "Paginate" the collection by slicing it into a smaller collection. + * + * @param int $page + * @param int $perPage + * @return static + */ + public function forPage($page, $perPage) + { + return $this->slice(($page - 1) * $perPage, $perPage); + } + + /** + * Get and remove the last item from the collection. + * + * @return mixed + */ + public function pop() + { + return array_pop($this->items); + } + + /** + * Push an item onto the beginning of the collection. + * + * @param mixed $value + * @param mixed $key + * @return $this + */ + public function prepend($value, $key = null) + { + $this->items = Arr::prepend($this->items, $value, $key); + + return $this; + } + + /** + * Push an item onto the end of the collection. + * + * @param mixed $value + * @return $this + */ + public function push($value) + { + $this->offsetSet(null, $value); + + return $this; + } + + /** + * Get and remove an item from the collection. + * + * @param mixed $key + * @param mixed $default + * @return mixed + */ + public function pull($key, $default = null) + { + return Arr::pull($this->items, $key, $default); + } + + /** + * Put an item in the collection by key. + * + * @param mixed $key + * @param mixed $value + * @return $this + */ + public function put($key, $value) + { + $this->offsetSet($key, $value); + + return $this; + } + + /** + * Get one or more items randomly from the collection. + * + * @param int $amount + * @return mixed + * + * @throws \InvalidArgumentException + */ + public function random($amount = 1) + { + if ($amount > ($count = $this->count())) { + throw new InvalidArgumentException("You requested {$amount} items, but there are only {$count} items in the collection"); + } + + $keys = array_rand($this->items, $amount); + + if ($amount == 1) { + return $this->items[$keys]; + } + + return new static(array_intersect_key($this->items, array_flip($keys))); + } + + /** + * Reduce the collection to a single value. + * + * @param callable $callback + * @param mixed $initial + * @return mixed + */ + public function reduce(callable $callback, $initial = null) + { + return array_reduce($this->items, $callback, $initial); + } + + /** + * Create a collection of all elements that do not pass a given truth test. + * + * @param callable|mixed $callback + * @return static + */ + public function reject($callback) + { + if ($this->useAsCallable($callback)) { + return $this->filter(function ($item) use ($callback) { + return ! $callback($item); + }); + } + + return $this->filter(function ($item) use ($callback) { + return $item != $callback; + }); + } + + /** + * Reverse items order. + * + * @return static + */ + public function reverse() + { + return new static(array_reverse($this->items)); + } + + /** + * Search the collection for a given value and return the corresponding key if successful. + * + * @param mixed $value + * @param bool $strict + * @return mixed + */ + public function search($value, $strict = false) + { + if (! $this->useAsCallable($value)) { + return array_search($value, $this->items, $strict); + } + + foreach ($this->items as $key => $item) { + if (call_user_func($value, $item, $key)) { + return $key; + } + } + + return false; + } + + /** + * Get and remove the first item from the collection. + * + * @return mixed + */ + public function shift() + { + return array_shift($this->items); + } + + /** + * Shuffle the items in the collection. + * + * @return static + */ + public function shuffle() + { + $items = $this->items; + + shuffle($items); + + return new static($items); + } + + /** + * Slice the underlying collection array. + * + * @param int $offset + * @param int $length + * @param bool $preserveKeys + * @return static + */ + public function slice($offset, $length = null, $preserveKeys = false) + { + return new static(array_slice($this->items, $offset, $length, $preserveKeys)); + } + + /** + * Chunk the underlying collection array. + * + * @param int $size + * @param bool $preserveKeys + * @return static + */ + public function chunk($size, $preserveKeys = false) + { + $chunks = []; + + foreach (array_chunk($this->items, $size, $preserveKeys) as $chunk) { + $chunks[] = new static($chunk); + } + + return new static($chunks); + } + + /** + * Sort through each item with a callback. + * + * @param callable|null $callback + * @return static + */ + public function sort(callable $callback = null) + { + $items = $this->items; + + $callback ? uasort($items, $callback) : uasort($items, function ($a, $b) { + if ($a == $b) { + return 0; + } + + return ($a < $b) ? -1 : 1; + }); + + return new static($items); + } + + /** + * Sort the collection using the given callback. + * + * @param callable|string $callback + * @param int $options + * @param bool $descending + * @return static + */ + public function sortBy($callback, $options = SORT_REGULAR, $descending = false) + { + $results = []; + + $callback = $this->valueRetriever($callback); + + // First we will loop through the items and get the comparator from a callback + // function which we were given. Then, we will sort the returned values and + // and grab the corresponding values for the sorted keys from this array. + foreach ($this->items as $key => $value) { + $results[$key] = $callback($value, $key); + } + + $descending ? arsort($results, $options) : asort($results, $options); - // Once we have sorted all of the keys in the array, we will loop through them - // and grab the corresponding model so we can set the underlying items list - // to the sorted version. Then we'll just return the collection instance. - foreach (array_keys($results) as $key) - { - $results[$key] = $this->items[$key]; - } - - $this->items = $results; - - return $this; - } - - /** - * Sort the collection in descending order using the given callback. - * - * @param callable|string $callback - * @param int $options - * @return $this - */ - public function sortByDesc($callback, $options = SORT_REGULAR) - { - return $this->sortBy($callback, $options, true); - } - - /** - * Splice portion of the underlying collection array. - * - * @param int $offset - * @param int $length - * @param mixed $replacement - * @return static - */ - public function splice($offset, $length = 0, $replacement = []) - { - return new static(array_splice($this->items, $offset, $length, $replacement)); - } - - /** - * Get the sum of the given values. - * - * @param callable|string|null $callback - * @return mixed - */ - public function sum($callback = null) - { - if (is_null($callback)) - { - return array_sum($this->items); - } - - if ( ! $this->useAsCallable($callback)) - { - $callback = $this->valueRetriever($callback); - } - - return $this->reduce(function($result, $item) use ($callback) - { - return $result += $callback($item); - }, 0); - } - - /** - * Take the first or last {$limit} items. - * - * @param int $limit - * @return static - */ - public function take($limit = null) - { - if ($limit < 0) return $this->slice($limit, abs($limit)); - - return $this->slice(0, $limit); - } - - /** - * Transform each item in the collection using a callback. - * - * @param callable $callback - * @return $this - */ - public function transform(callable $callback) - { - $this->items = array_map($callback, $this->items); - - return $this; - } - - /** - * Return only unique items from the collection array. - * - * @return static - */ - public function unique() - { - return new static(array_unique($this->items)); - } - - /** - * Reset the keys on the underlying array. - * - * @return static - */ - public function values() - { - return new static(array_values($this->items)); - } - - /** - * Get a value retrieving callback. - * - * @param string $value - * @return \Closure - */ - protected function valueRetriever($value) - { - return function($item) use ($value) - { - return data_get($item, $value); - }; - } - - /** - * Get the collection of items as a plain array. - * - * @return array - */ - public function toArray() - { - return array_map(function($value) - { - return $value instanceof Arrayable ? $value->toArray() : $value; - - }, $this->items); - } - - /** - * Convert the object into something JSON serializable. - * - * @return array - */ - public function jsonSerialize() - { - return $this->toArray(); - } - - /** - * Get the collection of items as JSON. - * - * @param int $options - * @return string - */ - public function toJson($options = 0) - { - return json_encode($this->toArray(), $options); - } - - /** - * Get an iterator for the items. - * - * @return \ArrayIterator - */ - public function getIterator() - { - return new ArrayIterator($this->items); - } - - /** - * Get a CachingIterator instance. - * - * @param int $flags - * @return \CachingIterator - */ - public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING) - { - return new CachingIterator($this->getIterator(), $flags); - } - - /** - * Count the number of items in the collection. - * - * @return int - */ - public function count() - { - return count($this->items); - } - - /** - * Determine if an item exists at an offset. - * - * @param mixed $key - * @return bool - */ - public function offsetExists($key) - { - return array_key_exists($key, $this->items); - } - - /** - * Get an item at a given offset. - * - * @param mixed $key - * @return mixed - */ - public function offsetGet($key) - { - return $this->items[$key]; - } - - /** - * Set the item at a given offset. - * - * @param mixed $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value) - { - if (is_null($key)) - { - $this->items[] = $value; - } - else - { - $this->items[$key] = $value; - } - } - - /** - * Unset the item at a given offset. - * - * @param string $key - * @return void - */ - public function offsetUnset($key) - { - unset($this->items[$key]); - } - - /** - * Convert the collection to its string representation. - * - * @return string - */ - public function __toString() - { - return $this->toJson(); - } - - /** - * Results array of items from Collection or Arrayable. - * - * @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\Arrayable|array $items - * @return array - */ - protected function getArrayableItems($items) - { - if ($items instanceof Collection) - { - $items = $items->all(); - } - elseif ($items instanceof Arrayable) - { - $items = $items->toArray(); - } - - return $items; - } - + // Once we have sorted all of the keys in the array, we will loop through them + // and grab the corresponding model so we can set the underlying items list + // to the sorted version. Then we'll just return the collection instance. + foreach (array_keys($results) as $key) { + $results[$key] = $this->items[$key]; + } + + return new static($results); + } + + /** + * Sort the collection in descending order using the given callback. + * + * @param callable|string $callback + * @param int $options + * @return static + */ + public function sortByDesc($callback, $options = SORT_REGULAR) + { + return $this->sortBy($callback, $options, true); + } + + /** + * Splice a portion of the underlying collection array. + * + * @param int $offset + * @param int|null $length + * @param mixed $replacement + * @return static + */ + public function splice($offset, $length = null, $replacement = []) + { + if (func_num_args() == 1) { + return new static(array_splice($this->items, $offset)); + } + + return new static(array_splice($this->items, $offset, $length, $replacement)); + } + + /** + * Get the sum of the given values. + * + * @param callable|string|null $callback + * @return mixed + */ + public function sum($callback = null) + { + if (is_null($callback)) { + return array_sum($this->items); + } + + $callback = $this->valueRetriever($callback); + + return $this->reduce(function ($result, $item) use ($callback) { + return $result += $callback($item); + }, 0); + } + + /** + * Take the first or last {$limit} items. + * + * @param int $limit + * @return static + */ + public function take($limit) + { + if ($limit < 0) { + return $this->slice($limit, abs($limit)); + } + + return $this->slice(0, $limit); + } + + /** + * Transform each item in the collection using a callback. + * + * @param callable $callback + * @return $this + */ + public function transform(callable $callback) + { + $this->items = $this->map($callback)->all(); + + return $this; + } + + /** + * Return only unique items from the collection array. + * + * @param string|callable|null $key + * @return static + */ + public function unique($key = null) + { + if (is_null($key)) { + return new static(array_unique($this->items, SORT_REGULAR)); + } + + $key = $this->valueRetriever($key); + + $exists = []; + + return $this->reject(function ($item) use ($key, &$exists) { + if (in_array($id = $key($item), $exists)) { + return true; + } + + $exists[] = $id; + }); + } + + /** + * Reset the keys on the underlying array. + * + * @return static + */ + public function values() + { + return new static(array_values($this->items)); + } + + /** + * Get a value retrieving callback. + * + * @param string $value + * @return callable + */ + protected function valueRetriever($value) + { + if ($this->useAsCallable($value)) { + return $value; + } + + return function ($item) use ($value) { + return data_get($item, $value); + }; + } + + /** + * Zip the collection together with one or more arrays. + * + * e.g. new Collection([1, 2, 3])->zip([4, 5, 6]); + * => [[1, 4], [2, 5], [3, 6]] + * + * @param mixed ...$items + * @return static + */ + public function zip($items) + { + $arrayableItems = array_map(function ($items) { + return $this->getArrayableItems($items); + }, func_get_args()); + + $params = array_merge([function () { + return new static(func_get_args()); + }, $this->items], $arrayableItems); + + return new static(call_user_func_array('array_map', $params)); + } + + /** + * Get the collection of items as a plain array. + * + * @return array + */ + public function toArray() + { + return array_map(function ($value) { + return $value instanceof Arrayable ? $value->toArray() : $value; + }, $this->items); + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Get the collection of items as JSON. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->toArray(), $options); + } + + /** + * Get an iterator for the items. + * + * @return \ArrayIterator + */ + public function getIterator() + { + return new ArrayIterator($this->items); + } + + /** + * Get a CachingIterator instance. + * + * @param int $flags + * @return \CachingIterator + */ + public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING) + { + return new CachingIterator($this->getIterator(), $flags); + } + + /** + * Count the number of items in the collection. + * + * @return int + */ + public function count() + { + return count($this->items); + } + + /** + * Determine if an item exists at an offset. + * + * @param mixed $key + * @return bool + */ + public function offsetExists($key) + { + return array_key_exists($key, $this->items); + } + + /** + * Get an item at a given offset. + * + * @param mixed $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->items[$key]; + } + + /** + * Set the item at a given offset. + * + * @param mixed $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + if (is_null($key)) { + $this->items[] = $value; + } else { + $this->items[$key] = $value; + } + } + + /** + * Unset the item at a given offset. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + unset($this->items[$key]); + } + + /** + * Convert the collection to its string representation. + * + * @return string + */ + public function __toString() + { + return $this->toJson(); + } + + /** + * Results array of items from Collection or Arrayable. + * + * @param mixed $items + * @return array + */ + protected function getArrayableItems($items) + { + if ($items instanceof self) { + return $items->all(); + } elseif ($items instanceof Arrayable) { + return $items->toArray(); + } elseif ($items instanceof Jsonable) { + return json_decode($items->toJson(), true); + } + + return (array) $items; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/Debug/Dumper.php b/application/vendor/laravel/framework/src/Illuminate/Support/Debug/Dumper.php index f58b7ca..0c84a8b 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/Debug/Dumper.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/Debug/Dumper.php @@ -1,21 +1,26 @@ -dump((new VarCloner)->cloneVar($value)); - } +class Dumper +{ + /** + * Dump a value with elegance. + * + * @param mixed $value + * @return void + */ + public function dump($value) + { + if (class_exists(CliDumper::class)) { + $dumper = 'cli' === PHP_SAPI ? new CliDumper : new HtmlDumper; + $dumper->dump((new VarCloner)->cloneVar($value)); + } else { + var_dump($value); + } + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/Debug/HtmlDumper.php b/application/vendor/laravel/framework/src/Illuminate/Support/Debug/HtmlDumper.php index 263f5c5..5825ac8 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/Debug/HtmlDumper.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/Debug/HtmlDumper.php @@ -1,28 +1,29 @@ - 'background-color:#fff; color:#222; line-height:1.2em; font-weight:normal; font:12px Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:100000', - 'num' => 'color:#a71d5d', - 'const' => 'color:#795da3', - 'str' => 'color:#df5000', - 'cchr' => 'color:#222', - 'note' => 'color:#a71d5d', - 'ref' => 'color:#a0a0a0', - 'public' => 'color:#795da3', - 'protected' => 'color:#795da3', - 'private' => 'color:#795da3', - 'meta' => 'color:#b729d9', - 'key' => 'color:#df5000', - 'index' => 'color:#a71d5d', - ); +use Symfony\Component\VarDumper\Dumper\HtmlDumper as SymfonyHtmlDumper; +class HtmlDumper extends SymfonyHtmlDumper +{ + /** + * Colour definitions for output. + * + * @var array + */ + protected $styles = [ + 'default' => 'background-color:#fff; color:#222; line-height:1.2em; font-weight:normal; font:12px Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:100000', + 'num' => 'color:#a71d5d', + 'const' => 'color:#795da3', + 'str' => 'color:#df5000', + 'cchr' => 'color:#222', + 'note' => 'color:#a71d5d', + 'ref' => 'color:#a0a0a0', + 'public' => 'color:#795da3', + 'protected' => 'color:#795da3', + 'private' => 'color:#795da3', + 'meta' => 'color:#b729d9', + 'key' => 'color:#df5000', + 'index' => 'color:#a71d5d', + ]; } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php b/application/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php index 0ac6479..2675d56 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php @@ -1,18 +1,19 @@ -getEngineResolver()->resolve('blade')->getCompiler(); - } - +class Blade extends Facade +{ + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() + { + return static::$app['view']->getEngineResolver()->resolve('blade')->getCompiler(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Bus.php b/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Bus.php index 7b133d1..7c42e9e 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Bus.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Bus.php @@ -1,18 +1,19 @@ -cookie($key, null)); - } - - /** - * Retrieve a cookie from the request. - * - * @param string $key - * @param mixed $default - * @return string - */ - public static function get($key = null, $default = null) - { - return static::$app['request']->cookie($key, $default); - } +class Cookie extends Facade +{ + /** + * Determine if a cookie exists on the request. + * + * @param string $key + * @return bool + */ + public static function has($key) + { + return ! is_null(static::$app['request']->cookie($key, null)); + } - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() - { - return 'cookie'; - } + /** + * Retrieve a cookie from the request. + * + * @param string $key + * @param mixed $default + * @return string + */ + public static function get($key = null, $default = null) + { + return static::$app['request']->cookie($key, $default); + } + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() + { + return 'cookie'; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Crypt.php b/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Crypt.php index ee78888..0eef08d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Crypt.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Crypt.php @@ -1,18 +1,19 @@ -instance(static::getFacadeAccessor(), $instance); - } - - /** - * Initiate a mock expectation on the facade. - * - * @param mixed - * @return \Mockery\Expectation - */ - public static function shouldReceive() - { - $name = static::getFacadeAccessor(); - - if (static::isMock()) - { - $mock = static::$resolvedInstance[$name]; - } - else - { - $mock = static::createFreshMockInstance($name); - } - - return call_user_func_array(array($mock, 'shouldReceive'), func_get_args()); - } - - /** - * Create a fresh mock instance for the given class. - * - * @param string $name - * @return \Mockery\Expectation - */ - protected static function createFreshMockInstance($name) - { - static::$resolvedInstance[$name] = $mock = static::createMockByName($name); - - if (isset(static::$app)) - { - static::$app->instance($name, $mock); - } - - return $mock; - } - - /** - * Create a fresh mock instance for the given class. - * - * @param string $name - * @return \Mockery\Expectation - */ - protected static function createMockByName($name) - { - $class = static::getMockableClass($name); - - return $class ? Mockery::mock($class) : Mockery::mock(); - } - - /** - * Determines whether a mock is set as the instance of the facade. - * - * @return bool - */ - protected static function isMock() - { - $name = static::getFacadeAccessor(); - - return isset(static::$resolvedInstance[$name]) && static::$resolvedInstance[$name] instanceof MockInterface; - } - - /** - * Get the mockable class for the bound instance. - * - * @return string - */ - protected static function getMockableClass() - { - if ($root = static::getFacadeRoot()) return get_class($root); - } - - /** - * Get the root object behind the facade. - * - * @return mixed - */ - public static function getFacadeRoot() - { - return static::resolveFacadeInstance(static::getFacadeAccessor()); - } - - /** - * Get the registered name of the component. - * - * @return string - * - * @throws \RuntimeException - */ - protected static function getFacadeAccessor() - { - throw new RuntimeException("Facade does not implement getFacadeAccessor method."); - } - - /** - * Resolve the facade root instance from the container. - * - * @param string $name - * @return mixed - */ - protected static function resolveFacadeInstance($name) - { - if (is_object($name)) return $name; - - if (isset(static::$resolvedInstance[$name])) - { - return static::$resolvedInstance[$name]; - } - - return static::$resolvedInstance[$name] = static::$app[$name]; - } - - /** - * Clear a resolved facade instance. - * - * @param string $name - * @return void - */ - public static function clearResolvedInstance($name) - { - unset(static::$resolvedInstance[$name]); - } - - /** - * Clear all of the resolved instances. - * - * @return void - */ - public static function clearResolvedInstances() - { - static::$resolvedInstance = array(); - } - - /** - * Get the application instance behind the facade. - * - * @return \Illuminate\Contracts\Foundation\Application - */ - public static function getFacadeApplication() - { - return static::$app; - } - - /** - * Set the application instance. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return void - */ - public static function setFacadeApplication($app) - { - static::$app = $app; - } - - /** - * Handle dynamic, static calls to the object. - * - * @param string $method - * @param array $args - * @return mixed - */ - public static function __callStatic($method, $args) - { - $instance = static::getFacadeRoot(); - - switch (count($args)) - { - case 0: - return $instance->$method(); - - case 1: - return $instance->$method($args[0]); - - case 2: - return $instance->$method($args[0], $args[1]); - - case 3: - return $instance->$method($args[0], $args[1], $args[2]); - - case 4: - return $instance->$method($args[0], $args[1], $args[2], $args[3]); - - default: - return call_user_func_array(array($instance, $method), $args); - } - } - +abstract class Facade +{ + /** + * The application instance being facaded. + * + * @var \Illuminate\Contracts\Foundation\Application + */ + protected static $app; + + /** + * The resolved object instances. + * + * @var array + */ + protected static $resolvedInstance; + + /** + * Hotswap the underlying instance behind the facade. + * + * @param mixed $instance + * @return void + */ + public static function swap($instance) + { + static::$resolvedInstance[static::getFacadeAccessor()] = $instance; + + static::$app->instance(static::getFacadeAccessor(), $instance); + } + + /** + * Initiate a mock expectation on the facade. + * + * @param mixed + * @return \Mockery\Expectation + */ + public static function shouldReceive() + { + $name = static::getFacadeAccessor(); + + if (static::isMock()) { + $mock = static::$resolvedInstance[$name]; + } else { + $mock = static::createFreshMockInstance($name); + } + + return call_user_func_array([$mock, 'shouldReceive'], func_get_args()); + } + + /** + * Create a fresh mock instance for the given class. + * + * @param string $name + * @return \Mockery\Expectation + */ + protected static function createFreshMockInstance($name) + { + static::$resolvedInstance[$name] = $mock = static::createMockByName($name); + + $mock->shouldAllowMockingProtectedMethods(); + + if (isset(static::$app)) { + static::$app->instance($name, $mock); + } + + return $mock; + } + + /** + * Create a fresh mock instance for the given class. + * + * @param string $name + * @return \Mockery\Expectation + */ + protected static function createMockByName($name) + { + $class = static::getMockableClass($name); + + return $class ? Mockery::mock($class) : Mockery::mock(); + } + + /** + * Determines whether a mock is set as the instance of the facade. + * + * @return bool + */ + protected static function isMock() + { + $name = static::getFacadeAccessor(); + + return isset(static::$resolvedInstance[$name]) && static::$resolvedInstance[$name] instanceof MockInterface; + } + + /** + * Get the mockable class for the bound instance. + * + * @return string|null + */ + protected static function getMockableClass() + { + if ($root = static::getFacadeRoot()) { + return get_class($root); + } + } + + /** + * Get the root object behind the facade. + * + * @return mixed + */ + public static function getFacadeRoot() + { + return static::resolveFacadeInstance(static::getFacadeAccessor()); + } + + /** + * Get the registered name of the component. + * + * @return string + * + * @throws \RuntimeException + */ + protected static function getFacadeAccessor() + { + throw new RuntimeException('Facade does not implement getFacadeAccessor method.'); + } + + /** + * Resolve the facade root instance from the container. + * + * @param string|object $name + * @return mixed + */ + protected static function resolveFacadeInstance($name) + { + if (is_object($name)) { + return $name; + } + + if (isset(static::$resolvedInstance[$name])) { + return static::$resolvedInstance[$name]; + } + + return static::$resolvedInstance[$name] = static::$app[$name]; + } + + /** + * Clear a resolved facade instance. + * + * @param string $name + * @return void + */ + public static function clearResolvedInstance($name) + { + unset(static::$resolvedInstance[$name]); + } + + /** + * Clear all of the resolved instances. + * + * @return void + */ + public static function clearResolvedInstances() + { + static::$resolvedInstance = []; + } + + /** + * Get the application instance behind the facade. + * + * @return \Illuminate\Contracts\Foundation\Application + */ + public static function getFacadeApplication() + { + return static::$app; + } + + /** + * Set the application instance. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + public static function setFacadeApplication($app) + { + static::$app = $app; + } + + /** + * Handle dynamic, static calls to the object. + * + * @param string $method + * @param array $args + * @return mixed + */ + public static function __callStatic($method, $args) + { + $instance = static::getFacadeRoot(); + + if (! $instance) { + throw new RuntimeException('A facade root has not been set.'); + } + + switch (count($args)) { + case 0: + return $instance->$method(); + case 1: + return $instance->$method($args[0]); + case 2: + return $instance->$method($args[0], $args[1]); + case 3: + return $instance->$method($args[0], $args[1], $args[2]); + case 4: + return $instance->$method($args[0], $args[1], $args[2], $args[3]); + default: + return call_user_func_array([$instance, $method], $args); + } + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/Facades/File.php b/application/vendor/laravel/framework/src/Illuminate/Support/Facades/File.php index 122ffb2..0f81bf6 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/Facades/File.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/Facades/File.php @@ -1,18 +1,19 @@ -input($key, $default); - } - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() - { - return 'request'; - } +class Input extends Facade +{ + /** + * Get an item from the input data. + * + * This method is used for all request verbs (GET, POST, PUT, and DELETE) + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public static function get($key = null, $default = null) + { + return static::$app['request']->input($key, $default); + } + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() + { + return 'request'; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Lang.php b/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Lang.php index 5496dfa..e5862b9 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Lang.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Lang.php @@ -1,18 +1,19 @@ -connection($name)->getSchemaBuilder(); - } - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() - { - return static::$app['db']->connection()->getSchemaBuilder(); - } +class Schema extends Facade +{ + /** + * Get a schema builder instance for a connection. + * + * @param string $name + * @return \Illuminate\Database\Schema\Builder + */ + public static function connection($name) + { + return static::$app['db']->connection($name)->getSchemaBuilder(); + } + /** + * Get a schema builder instance for the default connection. + * + * @return \Illuminate\Database\Schema\Builder + */ + protected static function getFacadeAccessor() + { + return static::$app['db']->connection()->getSchemaBuilder(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Session.php b/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Session.php index cde6a87..bc9b5fd 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Session.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Session.php @@ -1,19 +1,20 @@ - $value) - { - $this->attributes[$key] = $value; - } - } - - /** - * Get an attribute from the container. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function get($key, $default = null) - { - if (array_key_exists($key, $this->attributes)) - { - return $this->attributes[$key]; - } - - return value($default); - } - - /** - * Get the attributes from the container. - * - * @return array - */ - public function getAttributes() - { - return $this->attributes; - } - - /** - * Convert the Fluent instance to an array. - * - * @return array - */ - public function toArray() - { - return $this->attributes; - } - - /** - * Convert the object into something JSON serializable. - * - * @return array - */ - public function jsonSerialize() - { - return $this->toArray(); - } - - /** - * Convert the Fluent instance to JSON. - * - * @param int $options - * @return string - */ - public function toJson($options = 0) - { - return json_encode($this->toArray(), $options); - } - - /** - * Determine if the given offset exists. - * - * @param string $offset - * @return bool - */ - public function offsetExists($offset) - { - return isset($this->{$offset}); - } - - /** - * Get the value for a given offset. - * - * @param string $offset - * @return mixed - */ - public function offsetGet($offset) - { - return $this->{$offset}; - } - - /** - * Set the value at the given offset. - * - * @param string $offset - * @param mixed $value - * @return void - */ - public function offsetSet($offset, $value) - { - $this->{$offset} = $value; - } - - /** - * Unset the value at the given offset. - * - * @param string $offset - * @return void - */ - public function offsetUnset($offset) - { - unset($this->{$offset}); - } - - /** - * Handle dynamic calls to the container to set attributes. - * - * @param string $method - * @param array $parameters - * @return $this - */ - public function __call($method, $parameters) - { - $this->attributes[$method] = count($parameters) > 0 ? $parameters[0] : true; - - return $this; - } - - /** - * Dynamically retrieve the value of an attribute. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this->get($key); - } - - /** - * Dynamically set the value of an attribute. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function __set($key, $value) - { - $this->attributes[$key] = $value; - } - - /** - * Dynamically check if an attribute is set. - * - * @param string $key - * @return void - */ - public function __isset($key) - { - return isset($this->attributes[$key]); - } - - /** - * Dynamically unset an attribute. - * - * @param string $key - * @return void - */ - public function __unset($key) - { - unset($this->attributes[$key]); - } - +class Fluent implements ArrayAccess, Arrayable, Jsonable, JsonSerializable +{ + /** + * All of the attributes set on the container. + * + * @var array + */ + protected $attributes = []; + + /** + * Create a new fluent container instance. + * + * @param array|object $attributes + * @return void + */ + public function __construct($attributes = []) + { + foreach ($attributes as $key => $value) { + $this->attributes[$key] = $value; + } + } + + /** + * Get an attribute from the container. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + if (array_key_exists($key, $this->attributes)) { + return $this->attributes[$key]; + } + + return value($default); + } + + /** + * Get the attributes from the container. + * + * @return array + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Convert the Fluent instance to an array. + * + * @return array + */ + public function toArray() + { + return $this->attributes; + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Convert the Fluent instance to JSON. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->toArray(), $options); + } + + /** + * Determine if the given offset exists. + * + * @param string $offset + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->{$offset}); + } + + /** + * Get the value for a given offset. + * + * @param string $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->{$offset}; + } + + /** + * Set the value at the given offset. + * + * @param string $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset, $value) + { + $this->{$offset} = $value; + } + + /** + * Unset the value at the given offset. + * + * @param string $offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->{$offset}); + } + + /** + * Handle dynamic calls to the container to set attributes. + * + * @param string $method + * @param array $parameters + * @return $this + */ + public function __call($method, $parameters) + { + $this->attributes[$method] = count($parameters) > 0 ? $parameters[0] : true; + + return $this; + } + + /** + * Dynamically retrieve the value of an attribute. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->get($key); + } + + /** + * Dynamically set the value of an attribute. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this->attributes[$key] = $value; + } + + /** + * Dynamically check if an attribute is set. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return isset($this->attributes[$key]); + } + + /** + * Dynamically unset an attribute. + * + * @param string $key + * @return void + */ + public function __unset($key) + { + unset($this->attributes[$key]); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/HtmlString.php b/application/vendor/laravel/framework/src/Illuminate/Support/HtmlString.php new file mode 100644 index 0000000..8d246cf --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/Support/HtmlString.php @@ -0,0 +1,46 @@ +html = $html; + } + + /** + * Get the the HTML string. + * + * @return string + */ + public function toHtml() + { + return $this->html; + } + + /** + * Get the the HTML string. + * + * @return string + */ + public function __toString() + { + return $this->toHtml(); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/Manager.php b/application/vendor/laravel/framework/src/Illuminate/Support/Manager.php index aee3c06..29154c6 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/Manager.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/Manager.php @@ -1,142 +1,139 @@ -app = $app; - } - - /** - * Get the default driver name. - * - * @return string - */ - abstract public function getDefaultDriver(); - - /** - * Get a driver instance. - * - * @param string $driver - * @return mixed - */ - public function driver($driver = null) - { - $driver = $driver ?: $this->getDefaultDriver(); - - // If the given driver has not been created before, we will create the instances - // here and cache it so we can return it next time very quickly. If there is - // already a driver created by this name, we'll just return that instance. - if ( ! isset($this->drivers[$driver])) - { - $this->drivers[$driver] = $this->createDriver($driver); - } - - return $this->drivers[$driver]; - } - - /** - * Create a new driver instance. - * - * @param string $driver - * @return mixed - * - * @throws \InvalidArgumentException - */ - protected function createDriver($driver) - { - $method = 'create'.ucfirst($driver).'Driver'; - - // We'll check to see if a creator method exists for the given driver. If not we - // will check for a custom driver creator, which allows developers to create - // drivers using their own customized driver creator Closure to create it. - if (isset($this->customCreators[$driver])) - { - return $this->callCustomCreator($driver); - } - elseif (method_exists($this, $method)) - { - return $this->$method(); - } - - throw new InvalidArgumentException("Driver [$driver] not supported."); - } - - /** - * Call a custom driver creator. - * - * @param string $driver - * @return mixed - */ - protected function callCustomCreator($driver) - { - return $this->customCreators[$driver]($this->app); - } - - /** - * Register a custom driver creator Closure. - * - * @param string $driver - * @param \Closure $callback - * @return $this - */ - public function extend($driver, Closure $callback) - { - $this->customCreators[$driver] = $callback; - - return $this; - } - - /** - * Get all of the created "drivers". - * - * @return array - */ - public function getDrivers() - { - return $this->drivers; - } - - /** - * Dynamically call the default driver instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return call_user_func_array(array($this->driver(), $method), $parameters); - } - +abstract class Manager +{ + /** + * The application instance. + * + * @var \Illuminate\Foundation\Application + */ + protected $app; + + /** + * The registered custom driver creators. + * + * @var array + */ + protected $customCreators = []; + + /** + * The array of created "drivers". + * + * @var array + */ + protected $drivers = []; + + /** + * Create a new manager instance. + * + * @param \Illuminate\Foundation\Application $app + * @return void + */ + public function __construct($app) + { + $this->app = $app; + } + + /** + * Get the default driver name. + * + * @return string + */ + abstract public function getDefaultDriver(); + + /** + * Get a driver instance. + * + * @param string $driver + * @return mixed + */ + public function driver($driver = null) + { + $driver = $driver ?: $this->getDefaultDriver(); + + // If the given driver has not been created before, we will create the instances + // here and cache it so we can return it next time very quickly. If there is + // already a driver created by this name, we'll just return that instance. + if (! isset($this->drivers[$driver])) { + $this->drivers[$driver] = $this->createDriver($driver); + } + + return $this->drivers[$driver]; + } + + /** + * Create a new driver instance. + * + * @param string $driver + * @return mixed + * + * @throws \InvalidArgumentException + */ + protected function createDriver($driver) + { + $method = 'create'.ucfirst($driver).'Driver'; + + // We'll check to see if a creator method exists for the given driver. If not we + // will check for a custom driver creator, which allows developers to create + // drivers using their own customized driver creator Closure to create it. + if (isset($this->customCreators[$driver])) { + return $this->callCustomCreator($driver); + } elseif (method_exists($this, $method)) { + return $this->$method(); + } + + throw new InvalidArgumentException("Driver [$driver] not supported."); + } + + /** + * Call a custom driver creator. + * + * @param string $driver + * @return mixed + */ + protected function callCustomCreator($driver) + { + return $this->customCreators[$driver]($this->app); + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback; + + return $this; + } + + /** + * Get all of the created "drivers". + * + * @return array + */ + public function getDrivers() + { + return $this->drivers; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return call_user_func_array([$this->driver(), $method], $parameters); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/MessageBag.php b/application/vendor/laravel/framework/src/Illuminate/Support/MessageBag.php index 770d667..a58b154 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/MessageBag.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/MessageBag.php @@ -1,4 +1,6 @@ - $value) - { - $this->messages[$key] = (array) $value; - } - } - - /** - * Get the keys present in the message bag. - * - * @return array - */ - public function keys() - { - return array_keys($this->messages); - } - - /** - * Add a message to the bag. - * - * @param string $key - * @param string $message - * @return $this - */ - public function add($key, $message) - { - if ($this->isUnique($key, $message)) - { - $this->messages[$key][] = $message; - } - - return $this; - } - - /** - * Merge a new array of messages into the bag. - * - * @param \Illuminate\Contracts\Support\MessageProvider|array $messages - * @return $this - */ - public function merge($messages) - { - if ($messages instanceof MessageProvider) - { - $messages = $messages->getMessageBag()->getMessages(); - } - - $this->messages = array_merge_recursive($this->messages, $messages); - - return $this; - } - - /** - * Determine if a key and message combination already exists. - * - * @param string $key - * @param string $message - * @return bool - */ - protected function isUnique($key, $message) - { - $messages = (array) $this->messages; - - return ! isset($messages[$key]) || ! in_array($message, $messages[$key]); - } - - /** - * Determine if messages exist for a given key. - * - * @param string $key - * @return bool - */ - public function has($key = null) - { - return $this->first($key) !== ''; - } - - /** - * Get the first message from the bag for a given key. - * - * @param string $key - * @param string $format - * @return string - */ - public function first($key = null, $format = null) - { - $messages = is_null($key) ? $this->all($format) : $this->get($key, $format); - - return count($messages) > 0 ? $messages[0] : ''; - } - - /** - * Get all of the messages from the bag for a given key. - * - * @param string $key - * @param string $format - * @return array - */ - public function get($key, $format = null) - { - // If the message exists in the container, we will transform it and return - // the message. Otherwise, we'll return an empty array since the entire - // methods is to return back an array of messages in the first place. - if (array_key_exists($key, $this->messages)) - { - return $this->transform($this->messages[$key], $this->checkFormat($format), $key); - } - - return array(); - } - - /** - * Get all of the messages for every key in the bag. - * - * @param string $format - * @return array - */ - public function all($format = null) - { - $format = $this->checkFormat($format); - - $all = array(); - - foreach ($this->messages as $key => $messages) - { - $all = array_merge($all, $this->transform($messages, $format, $key)); - } - - return $all; - } - - /** - * Format an array of messages. - * - * @param array $messages - * @param string $format - * @param string $messageKey - * @return array - */ - protected function transform($messages, $format, $messageKey) - { - $messages = (array) $messages; - - // We will simply spin through the given messages and transform each one - // replacing the :message place holder with the real message allowing - // the messages to be easily formatted to each developer's desires. - $replace = array(':message', ':key'); - - foreach ($messages as &$message) - { - $message = str_replace($replace, array($message, $messageKey), $format); - } - - return $messages; - } - - /** - * Get the appropriate format based on the given format. - * - * @param string $format - * @return string - */ - protected function checkFormat($format) - { - return $format ?: $this->format; - } - - /** - * Get the raw messages in the container. - * - * @return array - */ - public function getMessages() - { - return $this->messages; - } - - /** - * Get the messages for the instance. - * - * @return \Illuminate\Support\MessageBag - */ - public function getMessageBag() - { - return $this; - } - - /** - * Get the default message format. - * - * @return string - */ - public function getFormat() - { - return $this->format; - } - - /** - * Set the default message format. - * - * @param string $format - * @return \Illuminate\Support\MessageBag - */ - public function setFormat($format = ':message') - { - $this->format = $format; - - return $this; - } - - /** - * Determine if the message bag has any messages. - * - * @return bool - */ - public function isEmpty() - { - return ! $this->any(); - } - - /** - * Determine if the message bag has any messages. - * - * @return bool - */ - public function any() - { - return $this->count() > 0; - } - - /** - * Get the number of messages in the container. - * - * @return int - */ - public function count() - { - return count($this->messages, COUNT_RECURSIVE) - count($this->messages); - } - - /** - * Get the instance as an array. - * - * @return array - */ - public function toArray() - { - return $this->getMessages(); - } - - /** - * Convert the object into something JSON serializable. - * - * @return array - */ - public function jsonSerialize() - { - return $this->toArray(); - } - - /** - * Convert the object to its JSON representation. - * - * @param int $options - * @return string - */ - public function toJson($options = 0) - { - return json_encode($this->toArray(), $options); - } - - /** - * Convert the message bag to its string representation. - * - * @return string - */ - public function __toString() - { - return $this->toJson(); - } - +class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, MessageBagContract, MessageProvider +{ + /** + * All of the registered messages. + * + * @var array + */ + protected $messages = []; + + /** + * Default format for message output. + * + * @var string + */ + protected $format = ':message'; + + /** + * Create a new message bag instance. + * + * @param array $messages + * @return void + */ + public function __construct(array $messages = []) + { + foreach ($messages as $key => $value) { + $this->messages[$key] = (array) $value; + } + } + + /** + * Get the keys present in the message bag. + * + * @return array + */ + public function keys() + { + return array_keys($this->messages); + } + + /** + * Add a message to the bag. + * + * @param string $key + * @param string $message + * @return $this + */ + public function add($key, $message) + { + if ($this->isUnique($key, $message)) { + $this->messages[$key][] = $message; + } + + return $this; + } + + /** + * Merge a new array of messages into the bag. + * + * @param \Illuminate\Contracts\Support\MessageProvider|array $messages + * @return $this + */ + public function merge($messages) + { + if ($messages instanceof MessageProvider) { + $messages = $messages->getMessageBag()->getMessages(); + } + + $this->messages = array_merge_recursive($this->messages, $messages); + + return $this; + } + + /** + * Determine if a key and message combination already exists. + * + * @param string $key + * @param string $message + * @return bool + */ + protected function isUnique($key, $message) + { + $messages = (array) $this->messages; + + return ! isset($messages[$key]) || ! in_array($message, $messages[$key]); + } + + /** + * Determine if messages exist for a given key. + * + * @param string $key + * @return bool + */ + public function has($key = null) + { + return $this->first($key) !== ''; + } + + /** + * Get the first message from the bag for a given key. + * + * @param string $key + * @param string $format + * @return string + */ + public function first($key = null, $format = null) + { + $messages = is_null($key) ? $this->all($format) : $this->get($key, $format); + + return count($messages) > 0 ? $messages[0] : ''; + } + + /** + * Get all of the messages from the bag for a given key. + * + * @param string $key + * @param string $format + * @return array + */ + public function get($key, $format = null) + { + // If the message exists in the container, we will transform it and return + // the message. Otherwise, we'll return an empty array since the entire + // methods is to return back an array of messages in the first place. + if (array_key_exists($key, $this->messages)) { + return $this->transform($this->messages[$key], $this->checkFormat($format), $key); + } + + return []; + } + + /** + * Get all of the messages for every key in the bag. + * + * @param string $format + * @return array + */ + public function all($format = null) + { + $format = $this->checkFormat($format); + + $all = []; + + foreach ($this->messages as $key => $messages) { + $all = array_merge($all, $this->transform($messages, $format, $key)); + } + + return $all; + } + + /** + * Format an array of messages. + * + * @param array $messages + * @param string $format + * @param string $messageKey + * @return array + */ + protected function transform($messages, $format, $messageKey) + { + $messages = (array) $messages; + + // We will simply spin through the given messages and transform each one + // replacing the :message place holder with the real message allowing + // the messages to be easily formatted to each developer's desires. + $replace = [':message', ':key']; + + foreach ($messages as &$message) { + $message = str_replace($replace, [$message, $messageKey], $format); + } + + return $messages; + } + + /** + * Get the appropriate format based on the given format. + * + * @param string $format + * @return string + */ + protected function checkFormat($format) + { + return $format ?: $this->format; + } + + /** + * Get the raw messages in the container. + * + * @return array + */ + public function getMessages() + { + return $this->messages; + } + + /** + * Get the messages for the instance. + * + * @return \Illuminate\Support\MessageBag + */ + public function getMessageBag() + { + return $this; + } + + /** + * Get the default message format. + * + * @return string + */ + public function getFormat() + { + return $this->format; + } + + /** + * Set the default message format. + * + * @param string $format + * @return \Illuminate\Support\MessageBag + */ + public function setFormat($format = ':message') + { + $this->format = $format; + + return $this; + } + + /** + * Determine if the message bag has any messages. + * + * @return bool + */ + public function isEmpty() + { + return ! $this->any(); + } + + /** + * Determine if the message bag has any messages. + * + * @return bool + */ + public function any() + { + return $this->count() > 0; + } + + /** + * Get the number of messages in the container. + * + * @return int + */ + public function count() + { + return count($this->messages, COUNT_RECURSIVE) - count($this->messages); + } + + /** + * Get the instance as an array. + * + * @return array + */ + public function toArray() + { + return $this->getMessages(); + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Convert the object to its JSON representation. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->toArray(), $options); + } + + /** + * Convert the message bag to its string representation. + * + * @return string + */ + public function __toString() + { + return $this->toJson(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php b/application/vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php index 6c3366e..a111985 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php @@ -1,109 +1,104 @@ -parsed[$key])) - { - return $this->parsed[$key]; - } - - // If the key does not contain a double colon, it means the key is not in a - // namespace, and is just a regular configuration item. Namespaces are a - // tool for organizing configuration items for things such as modules. - if (strpos($key, '::') === false) - { - $segments = explode('.', $key); - - $parsed = $this->parseBasicSegments($segments); - } - else - { - $parsed = $this->parseNamespacedSegments($key); - } - - // Once we have the parsed array of this key's elements, such as its groups - // and namespace, we will cache each array inside a simple list that has - // the key and the parsed array for quick look-ups for later requests. - return $this->parsed[$key] = $parsed; - } - - /** - * Parse an array of basic segments. - * - * @param array $segments - * @return array - */ - protected function parseBasicSegments(array $segments) - { - // The first segment in a basic array will always be the group, so we can go - // ahead and grab that segment. If there is only one total segment we are - // just pulling an entire group out of the array and not a single item. - $group = $segments[0]; - - if (count($segments) == 1) - { - return array(null, $group, null); - } - - // If there is more than one segment in this group, it means we are pulling - // a specific item out of a groups and will need to return the item name - // as well as the group so we know which item to pull from the arrays. - else - { - $item = implode('.', array_slice($segments, 1)); - - return array(null, $group, $item); - } - } - - /** - * Parse an array of namespaced segments. - * - * @param string $key - * @return array - */ - protected function parseNamespacedSegments($key) - { - list($namespace, $item) = explode('::', $key); - - // First we'll just explode the first segment to get the namespace and group - // since the item should be in the remaining segments. Once we have these - // two pieces of data we can proceed with parsing out the item's value. - $itemSegments = explode('.', $item); - - $groupAndItem = array_slice($this->parseBasicSegments($itemSegments), 1); - - return array_merge(array($namespace), $groupAndItem); - } - - /** - * Set the parsed value of a key. - * - * @param string $key - * @param array $parsed - * @return void - */ - public function setParsedKey($key, $parsed) - { - $this->parsed[$key] = $parsed; - } - +parsed[$key])) { + return $this->parsed[$key]; + } + + // If the key does not contain a double colon, it means the key is not in a + // namespace, and is just a regular configuration item. Namespaces are a + // tool for organizing configuration items for things such as modules. + if (strpos($key, '::') === false) { + $segments = explode('.', $key); + + $parsed = $this->parseBasicSegments($segments); + } else { + $parsed = $this->parseNamespacedSegments($key); + } + + // Once we have the parsed array of this key's elements, such as its groups + // and namespace, we will cache each array inside a simple list that has + // the key and the parsed array for quick look-ups for later requests. + return $this->parsed[$key] = $parsed; + } + + /** + * Parse an array of basic segments. + * + * @param array $segments + * @return array + */ + protected function parseBasicSegments(array $segments) + { + // The first segment in a basic array will always be the group, so we can go + // ahead and grab that segment. If there is only one total segment we are + // just pulling an entire group out of the array and not a single item. + $group = $segments[0]; + + if (count($segments) == 1) { + return [null, $group, null]; + } + + // If there is more than one segment in this group, it means we are pulling + // a specific item out of a groups and will need to return the item name + // as well as the group so we know which item to pull from the arrays. + else { + $item = implode('.', array_slice($segments, 1)); + + return [null, $group, $item]; + } + } + + /** + * Parse an array of namespaced segments. + * + * @param string $key + * @return array + */ + protected function parseNamespacedSegments($key) + { + list($namespace, $item) = explode('::', $key); + + // First we'll just explode the first segment to get the namespace and group + // since the item should be in the remaining segments. Once we have these + // two pieces of data we can proceed with parsing out the item's value. + $itemSegments = explode('.', $item); + + $groupAndItem = array_slice($this->parseBasicSegments($itemSegments), 1); + + return array_merge([$namespace], $groupAndItem); + } + + /** + * Set the parsed value of a key. + * + * @param string $key + * @param array $parsed + * @return void + */ + public function setParsedKey($key, $parsed) + { + $this->parsed[$key] = $parsed; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php b/application/vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php index 8281dc8..7ba7a4d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php @@ -1,103 +1,104 @@ -app = $app; - } - - /** - * Register the service provider. - * - * @return void - */ - abstract public function register(); - - /** - * Merge the given configuration with the existing configuration. - * - * @param string $path - * @param string $key - * @return void - */ - protected function mergeConfigFrom($path, $key) - { - $config = $this->app['config']->get($key, []); - - $this->app['config']->set($key, array_merge(require $path, $config)); - } - - /** - * Register a view file namespace. - * - * @param string $path - * @param string $namespace - * @return void - */ - protected function loadViewsFrom($path, $namespace) - { - if (is_dir($appPath = $this->app->basePath().'/resources/views/vendor/'.$namespace)) - { - $this->app['view']->addNamespace($namespace, $appPath); - } - - $this->app['view']->addNamespace($namespace, $path); - } - - /** - * Register a translation file namespace. - * - * @param string $path - * @param string $namespace - * @return void - */ - protected function loadTranslationsFrom($path, $namespace) - { - $this->app['translator']->addNamespace($namespace, $path); - } - - /** - * Register paths to be published by the publish command. - * - * @param array $paths - * @param string $group - * @return void - */ - protected function publishes(array $paths, $group = null) - { - $class = get_class($this); - - if ( ! array_key_exists($class, static::$publishes)) - { - static::$publishes[$class] = []; - } - - static::$publishes[$class] = array_merge(static::$publishes[$class], $paths); - - if ($group) - { - static::$publishGroups[$group] = $paths; - } - } - - /** - * Get the paths to publish. - * - * @param string $provider - * @param string $group - * @return array - */ - public static function pathsToPublish($provider = null, $group = null) - { - if ($group && array_key_exists($group, static::$publishGroups)) - { - return static::$publishGroups[$group]; - } - - if ($provider && array_key_exists($provider, static::$publishes)) - { - return static::$publishes[$provider]; - } - - if ($group || $provider) - { - return []; - } - - $paths = []; - - foreach (static::$publishes as $class => $publish) - { - $paths = array_merge($paths, $publish); - } - - return $paths; - } - - /** - * Register the package's custom Artisan commands. - * - * @param array $commands - * @return void - */ - public function commands($commands) - { - $commands = is_array($commands) ? $commands : func_get_args(); - - // To register the commands with Artisan, we will grab each of the arguments - // passed into the method and listen for Artisan "start" event which will - // give us the Artisan console instance which we will give commands to. - $events = $this->app['events']; - - $events->listen('artisan.start', function($artisan) use ($commands) - { - $artisan->resolveCommands($commands); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return []; - } - - /** - * Get the events that trigger this service provider to register. - * - * @return array - */ - public function when() - { - return []; - } - - /** - * Determine if the provider is deferred. - * - * @return bool - */ - public function isDeferred() - { - return $this->defer; - } - - /** - * Get a list of files that should be compiled for the package. - * - * @return array - */ - public static function compiles() - { - return []; - } - - /** - * Dynamically handle missing method calls. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if ($method == 'boot') return; - - throw new BadMethodCallException("Call to undefined method [{$method}]"); - } +use BadMethodCallException; +abstract class ServiceProvider +{ + /** + * The application instance. + * + * @var \Illuminate\Contracts\Foundation\Application + */ + protected $app; + + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = false; + + /** + * The paths that should be published. + * + * @var array + */ + protected static $publishes = []; + + /** + * The paths that should be published by group. + * + * @var array + */ + protected static $publishGroups = []; + + /** + * Create a new service provider instance. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + public function __construct($app) + { + $this->app = $app; + } + + /** + * Register the service provider. + * + * @return void + */ + abstract public function register(); + + /** + * Merge the given configuration with the existing configuration. + * + * @param string $path + * @param string $key + * @return void + */ + protected function mergeConfigFrom($path, $key) + { + $config = $this->app['config']->get($key, []); + + $this->app['config']->set($key, array_merge(require $path, $config)); + } + + /** + * Register a view file namespace. + * + * @param string $path + * @param string $namespace + * @return void + */ + protected function loadViewsFrom($path, $namespace) + { + if (is_dir($appPath = $this->app->basePath().'/resources/views/vendor/'.$namespace)) { + $this->app['view']->addNamespace($namespace, $appPath); + } + + $this->app['view']->addNamespace($namespace, $path); + } + + /** + * Register a translation file namespace. + * + * @param string $path + * @param string $namespace + * @return void + */ + protected function loadTranslationsFrom($path, $namespace) + { + $this->app['translator']->addNamespace($namespace, $path); + } + + /** + * Register paths to be published by the publish command. + * + * @param array $paths + * @param string $group + * @return void + */ + protected function publishes(array $paths, $group = null) + { + $class = get_class($this); + + if (! array_key_exists($class, static::$publishes)) { + static::$publishes[$class] = []; + } + + static::$publishes[$class] = array_merge(static::$publishes[$class], $paths); + + if ($group) { + if (! array_key_exists($group, static::$publishGroups)) { + static::$publishGroups[$group] = []; + } + + static::$publishGroups[$group] = array_merge(static::$publishGroups[$group], $paths); + } + } + + /** + * Get the paths to publish. + * + * @param string $provider + * @param string $group + * @return array + */ + public static function pathsToPublish($provider = null, $group = null) + { + if ($provider && $group) { + if (empty(static::$publishes[$provider]) || empty(static::$publishGroups[$group])) { + return []; + } + + return array_intersect(static::$publishes[$provider], static::$publishGroups[$group]); + } + + if ($group && array_key_exists($group, static::$publishGroups)) { + return static::$publishGroups[$group]; + } + + if ($provider && array_key_exists($provider, static::$publishes)) { + return static::$publishes[$provider]; + } + + if ($group || $provider) { + return []; + } + + $paths = []; + + foreach (static::$publishes as $class => $publish) { + $paths = array_merge($paths, $publish); + } + + return $paths; + } + + /** + * Register the package's custom Artisan commands. + * + * @param array|mixed $commands + * @return void + */ + public function commands($commands) + { + $commands = is_array($commands) ? $commands : func_get_args(); + + // To register the commands with Artisan, we will grab each of the arguments + // passed into the method and listen for Artisan "start" event which will + // give us the Artisan console instance which we will give commands to. + $events = $this->app['events']; + + $events->listen('artisan.start', function ($artisan) use ($commands) { + $artisan->resolveCommands($commands); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return []; + } + + /** + * Get the events that trigger this service provider to register. + * + * @return array + */ + public function when() + { + return []; + } + + /** + * Determine if the provider is deferred. + * + * @return bool + */ + public function isDeferred() + { + return $this->defer; + } + + /** + * Get a list of files that should be compiled for the package. + * + * @return array + */ + public static function compiles() + { + return []; + } + + /** + * Dynamically handle missing method calls. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if ($method == 'boot') { + return; + } + + throw new BadMethodCallException("Call to undefined method [{$method}]"); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/Str.php b/application/vendor/laravel/framework/src/Illuminate/Support/Str.php index 37d0619..2c3a7cb 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/Str.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/Str.php @@ -1,392 +1,443 @@ -container = $container; + /** + * The container instance. + * + * @var \Illuminate\Contracts\Container\Container + */ + protected $container; - if ( ! $this->container->bound('config')) - { - $this->container->instance('config', new Fluent); - } - } + /** + * Setup the IoC container instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + protected function setupContainer(Container $container) + { + $this->container = $container; - /** - * Make this capsule instance available globally. - * - * @return void - */ - public function setAsGlobal() - { - static::$instance = $this; - } + if (! $this->container->bound('config')) { + $this->container->instance('config', new Fluent); + } + } - /** - * Get the IoC container instance. - * - * @return \Illuminate\Contracts\Container\Container - */ - public function getContainer() - { - return $this->container; - } + /** + * Make this capsule instance available globally. + * + * @return void + */ + public function setAsGlobal() + { + static::$instance = $this; + } - /** - * Set the IoC container instance. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - public function setContainer(Container $container) - { - $this->container = $container; - } + /** + * Get the IoC container instance. + * + * @return \Illuminate\Contracts\Container\Container + */ + public function getContainer() + { + return $this->container; + } + /** + * Set the IoC container instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function setContainer(Container $container) + { + $this->container = $container; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php b/application/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php index 7e8ead5..a6a54fd 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php @@ -1,90 +1,83 @@ -bindTo($this, get_class($this)), $parameters); - } - else - { - return call_user_func_array(static::$macros[$method], $parameters); - } - } + throw new BadMethodCallException("Method {$method} does not exist."); + } - throw new BadMethodCallException("Method {$method} does not exist."); - } + /** + * Dynamically handle calls to the class. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + if (static::$macros[$method] instanceof Closure) { + return call_user_func_array(static::$macros[$method]->bindTo($this, get_class($this)), $parameters); + } else { + return call_user_func_array(static::$macros[$method], $parameters); + } + } + throw new BadMethodCallException("Method {$method} does not exist."); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/ViewErrorBag.php b/application/vendor/laravel/framework/src/Illuminate/Support/ViewErrorBag.php index 23e7a1a..9fe3b96 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/ViewErrorBag.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/ViewErrorBag.php @@ -1,106 +1,107 @@ -bags[$key]); - } +class ViewErrorBag implements Countable +{ + /** + * The array of the view error bags. + * + * @var array + */ + protected $bags = []; - /** - * Get a MessageBag instance from the bags. - * - * @param string $key - * @return \Illuminate\Contracts\Support\MessageBag - */ - public function getBag($key) - { - return array_get($this->bags, $key, new MessageBag); - } + /** + * Checks if a named MessageBag exists in the bags. + * + * @param string $key + * @return bool + */ + public function hasBag($key = 'default') + { + return isset($this->bags[$key]); + } - /** - * Get all the bags. - * - * @return array - */ - public function getBags() - { - return $this->bags; - } + /** + * Get a MessageBag instance from the bags. + * + * @param string $key + * @return \Illuminate\Contracts\Support\MessageBag + */ + public function getBag($key) + { + return Arr::get($this->bags, $key) ?: new MessageBag; + } - /** - * Add a new MessageBag instance to the bags. - * - * @param string $key - * @param \Illuminate\Contracts\Support\MessageBag $bag - * @return $this - */ - public function put($key, MessageBagContract $bag) - { - $this->bags[$key] = $bag; + /** + * Get all the bags. + * + * @return array + */ + public function getBags() + { + return $this->bags; + } - return $this; - } + /** + * Add a new MessageBag instance to the bags. + * + * @param string $key + * @param \Illuminate\Contracts\Support\MessageBag $bag + * @return $this + */ + public function put($key, MessageBagContract $bag) + { + $this->bags[$key] = $bag; - /** - * Get the number of messages in the default bag. - * - * @return int - */ - public function count() - { - return $this->default->count(); - } + return $this; + } - /** - * Dynamically call methods on the default bag. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return call_user_func_array(array($this->default, $method), $parameters); - } + /** + * Get the number of messages in the default bag. + * + * @return int + */ + public function count() + { + return $this->default->count(); + } - /** - * Dynamically access a view error bag. - * - * @param string $key - * @return \Illuminate\Contracts\Support\MessageBag - */ - public function __get($key) - { - return array_get($this->bags, $key, new MessageBag); - } + /** + * Dynamically call methods on the default bag. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return call_user_func_array([$this->default, $method], $parameters); + } - /** - * Dynamically set a view error bag. - * - * @param string $key - * @param \Illuminate\Contracts\Support\MessageBag $value - * @return void - */ - public function __set($key, $value) - { - array_set($this->bags, $key, $value); - } + /** + * Dynamically access a view error bag. + * + * @param string $key + * @return \Illuminate\Contracts\Support\MessageBag + */ + public function __get($key) + { + return $this->getBag($key); + } + /** + * Dynamically set a view error bag. + * + * @param string $key + * @param \Illuminate\Contracts\Support\MessageBag $value + * @return void + */ + public function __set($key, $value) + { + $this->put($key, $value); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/composer.json b/application/vendor/laravel/framework/src/Illuminate/Support/composer.json index b08c4d9..a96f06a 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Support/composer.json @@ -14,11 +14,12 @@ } ], "require": { - "php": ">=5.4.0", + "php": ">=5.5.9", "ext-mbstring": "*", - "illuminate/contracts": "5.0.*", + "illuminate/contracts": "5.1.*", "doctrine/inflector": "~1.0", - "danielstjules/stringy": "~1.8" + "danielstjules/stringy": "~1.8", + "paragonie/random_compat": "~1.4" }, "autoload": { "psr-4": { @@ -30,12 +31,12 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "suggest": { "jeremeamia/superclosure": "Required to be able to serialize closures (~2.0).", - "symfony/var-dumper": "Required to use the dd function (2.6.*)." + "symfony/var-dumper": "Improves the dd function (2.7.*)." }, "minimum-stability": "dev" } diff --git a/application/vendor/laravel/framework/src/Illuminate/Support/helpers.php b/application/vendor/laravel/framework/src/Illuminate/Support/helpers.php index 4405cc7..3ea27f5 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Support/helpers.php +++ b/application/vendor/laravel/framework/src/Illuminate/Support/helpers.php @@ -4,797 +4,797 @@ use Illuminate\Support\Str; use Illuminate\Support\Collection; use Illuminate\Support\Debug\Dumper; - -if ( ! function_exists('append_config')) -{ - /** - * Assign high numeric IDs to a config item to force appending. - * - * @param array $array - * @return array - */ - function append_config(array $array) - { - $start = 9999; - - foreach ($array as $key => $value) - { - if (is_numeric($key)) - { - $start++; - - $array[$start] = array_pull($array, $key); - } - } - - return $array; - } -} - -if ( ! function_exists('array_add')) -{ - /** - * Add an element to an array using "dot" notation if it doesn't exist. - * - * @param array $array - * @param string $key - * @param mixed $value - * @return array - */ - function array_add($array, $key, $value) - { - return Arr::add($array, $key, $value); - } -} - -if ( ! function_exists('array_build')) -{ - /** - * Build a new array using a callback. - * - * @param array $array - * @param callable $callback - * @return array - */ - function array_build($array, callable $callback) - { - return Arr::build($array, $callback); - } -} - -if ( ! function_exists('array_collapse')) -{ - /** - * Collapse an array of arrays into a single array. - * - * @param array|\ArrayAccess $array - * @return array - */ - function array_collapse($array) - { - return Arr::collapse($array); - } -} - -if ( ! function_exists('array_divide')) -{ - /** - * Divide an array into two arrays. One with keys and the other with values. - * - * @param array $array - * @return array - */ - function array_divide($array) - { - return Arr::divide($array); - } -} - -if ( ! function_exists('array_dot')) -{ - /** - * Flatten a multi-dimensional associative array with dots. - * - * @param array $array - * @param string $prepend - * @return array - */ - function array_dot($array, $prepend = '') - { - return Arr::dot($array, $prepend); - } -} - -if ( ! function_exists('array_except')) -{ - /** - * Get all of the given array except for a specified array of items. - * - * @param array $array - * @param array|string $keys - * @return array - */ - function array_except($array, $keys) - { - return Arr::except($array, $keys); - } -} - -if ( ! function_exists('array_fetch')) -{ - /** - * Fetch a flattened array of a nested array element. - * - * @param array $array - * @param string $key - * @return array - */ - function array_fetch($array, $key) - { - return Arr::fetch($array, $key); - } -} - -if ( ! function_exists('array_first')) -{ - /** - * Return the first element in an array passing a given truth test. - * - * @param array $array - * @param callable $callback - * @param mixed $default - * @return mixed - */ - function array_first($array, callable $callback, $default = null) - { - return Arr::first($array, $callback, $default); - } -} - -if ( ! function_exists('array_last')) -{ - /** - * Return the last element in an array passing a given truth test. - * - * @param array $array - * @param callable $callback - * @param mixed $default - * @return mixed - */ - function array_last($array, $callback, $default = null) - { - return Arr::last($array, $callback, $default); - } -} - -if ( ! function_exists('array_flatten')) -{ - /** - * Flatten a multi-dimensional array into a single level. - * - * @param array $array - * @return array - */ - function array_flatten($array) - { - return Arr::flatten($array); - } -} - -if ( ! function_exists('array_forget')) -{ - /** - * Remove one or many array items from a given array using "dot" notation. - * - * @param array $array - * @param array|string $keys - * @return void - */ - function array_forget(&$array, $keys) - { - return Arr::forget($array, $keys); - } -} - -if ( ! function_exists('array_get')) -{ - /** - * Get an item from an array using "dot" notation. - * - * @param array $array - * @param string $key - * @param mixed $default - * @return mixed - */ - function array_get($array, $key, $default = null) - { - return Arr::get($array, $key, $default); - } -} - -if ( ! function_exists('array_has')) -{ - /** - * Check if an item exists in an array using "dot" notation. - * - * @param array $array - * @param string $key - * @return bool - */ - function array_has($array, $key) - { - return Arr::has($array, $key); - } -} - -if ( ! function_exists('array_only')) -{ - /** - * Get a subset of the items from the given array. - * - * @param array $array - * @param array|string $keys - * @return array - */ - function array_only($array, $keys) - { - return Arr::only($array, $keys); - } -} - -if ( ! function_exists('array_pluck')) -{ - /** - * Pluck an array of values from an array. - * - * @param array $array - * @param string $value - * @param string $key - * @return array - */ - function array_pluck($array, $value, $key = null) - { - return Arr::pluck($array, $value, $key); - } -} - -if ( ! function_exists('array_pull')) -{ - /** - * Get a value from the array, and remove it. - * - * @param array $array - * @param string $key - * @param mixed $default - * @return mixed - */ - function array_pull(&$array, $key, $default = null) - { - return Arr::pull($array, $key, $default); - } -} - -if ( ! function_exists('array_set')) -{ - /** - * Set an array item to a given value using "dot" notation. - * - * If no key is given to the method, the entire array will be replaced. - * - * @param array $array - * @param string $key - * @param mixed $value - * @return array - */ - function array_set(&$array, $key, $value) - { - return Arr::set($array, $key, $value); - } -} - -if ( ! function_exists('array_sort')) -{ - /** - * Sort the array using the given callback. - * - * @param array $array - * @param callable $callback - * @return array - */ - function array_sort($array, callable $callback) - { - return Arr::sort($array, $callback); - } -} - -if ( ! function_exists('array_where')) -{ - /** - * Filter the array using the given callback. - * - * @param array $array - * @param callable $callback - * @return array - */ - function array_where($array, callable $callback) - { - return Arr::where($array, $callback); - } -} - -if ( ! function_exists('camel_case')) -{ - /** - * Convert a value to camel case. - * - * @param string $value - * @return string - */ - function camel_case($value) - { - return Str::camel($value); - } -} - -if ( ! function_exists('class_basename')) -{ - /** - * Get the class "basename" of the given object / class. - * - * @param string|object $class - * @return string - */ - function class_basename($class) - { - $class = is_object($class) ? get_class($class) : $class; - - return basename(str_replace('\\', '/', $class)); - } -} - -if ( ! function_exists('class_uses_recursive')) -{ - /** - * Returns all traits used by a class, its subclasses and trait of their traits. - * - * @param string $class - * @return array - */ - function class_uses_recursive($class) - { - $results = []; - - foreach (array_merge([$class => $class], class_parents($class)) as $class) - { - $results += trait_uses_recursive($class); - } - - return array_unique($results); - } -} - -if ( ! function_exists('collect')) -{ - /** - * Create a collection from the given value. - * - * @param mixed $value - * @return \Illuminate\Support\Collection - */ - function collect($value = null) - { - return new Collection($value); - } -} - -if ( ! function_exists('data_get')) -{ - /** - * Get an item from an array or object using "dot" notation. - * - * @param mixed $target - * @param string $key - * @param mixed $default - * @return mixed - */ - function data_get($target, $key, $default = null) - { - if (is_null($key)) return $target; - - foreach (explode('.', $key) as $segment) - { - if (is_array($target)) - { - if ( ! array_key_exists($segment, $target)) - { - return value($default); - } - - $target = $target[$segment]; - } - elseif ($target instanceof ArrayAccess) - { - if ( ! isset($target[$segment])) - { - return value($default); - } - - $target = $target[$segment]; - } - elseif (is_object($target)) - { - if ( ! isset($target->{$segment})) - { - return value($default); - } - - $target = $target->{$segment}; - } - else - { - return value($default); - } - } - - return $target; - } -} - -if ( ! function_exists('dd')) -{ - /** - * Dump the passed variables and end the script. - * - * @param mixed - * @return void - */ - function dd() - { - array_map(function($x) { (new Dumper)->dump($x); }, func_get_args()); - - die; - } -} - -if ( ! function_exists('e')) -{ - /** - * Escape HTML entities in a string. - * - * @param string $value - * @return string - */ - function e($value) - { - return htmlentities($value, ENT_QUOTES, 'UTF-8', false); - } -} - -if ( ! function_exists('ends_with')) -{ - /** - * Determine if a given string ends with a given substring. - * - * @param string $haystack - * @param string|array $needles - * @return bool - */ - function ends_with($haystack, $needles) - { - return Str::endsWith($haystack, $needles); - } -} - -if ( ! function_exists('head')) -{ - /** - * Get the first element of an array. Useful for method chaining. - * - * @param array $array - * @return mixed - */ - function head($array) - { - return reset($array); - } -} - -if ( ! function_exists('last')) -{ - /** - * Get the last element from an array. - * - * @param array $array - * @return mixed - */ - function last($array) - { - return end($array); - } -} - -if ( ! function_exists('object_get')) -{ - /** - * Get an item from an object using "dot" notation. - * - * @param object $object - * @param string $key - * @param mixed $default - * @return mixed - */ - function object_get($object, $key, $default = null) - { - if (is_null($key) || trim($key) == '') return $object; - - foreach (explode('.', $key) as $segment) - { - if ( ! is_object($object) || ! isset($object->{$segment})) - { - return value($default); - } - - $object = $object->{$segment}; - } - - return $object; - } -} - -if ( ! function_exists('preg_replace_sub')) -{ - /** - * Replace a given pattern with each value in the array in sequentially. - * - * @param string $pattern - * @param array $replacements - * @param string $subject - * @return string - */ - function preg_replace_sub($pattern, &$replacements, $subject) - { - return preg_replace_callback($pattern, function($match) use (&$replacements) - { - foreach ($replacements as $key => $value) - { - return array_shift($replacements); - } - - }, $subject); - } -} - -if ( ! function_exists('snake_case')) -{ - /** - * Convert a string to snake case. - * - * @param string $value - * @param string $delimiter - * @return string - */ - function snake_case($value, $delimiter = '_') - { - return Str::snake($value, $delimiter); - } -} - -if ( ! function_exists('starts_with')) -{ - /** - * Determine if a given string starts with a given substring. - * - * @param string $haystack - * @param string|array $needles - * @return bool - */ - function starts_with($haystack, $needles) - { - return Str::startsWith($haystack, $needles); - } -} - -if ( ! function_exists('str_contains')) -{ - /** - * Determine if a given string contains a given substring. - * - * @param string $haystack - * @param string|array $needles - * @return bool - */ - function str_contains($haystack, $needles) - { - return Str::contains($haystack, $needles); - } -} - -if ( ! function_exists('str_finish')) -{ - /** - * Cap a string with a single instance of a given value. - * - * @param string $value - * @param string $cap - * @return string - */ - function str_finish($value, $cap) - { - return Str::finish($value, $cap); - } -} - -if ( ! function_exists('str_is')) -{ - /** - * Determine if a given string matches a given pattern. - * - * @param string $pattern - * @param string $value - * @return bool - */ - function str_is($pattern, $value) - { - return Str::is($pattern, $value); - } -} - -if ( ! function_exists('str_limit')) -{ - /** - * Limit the number of characters in a string. - * - * @param string $value - * @param int $limit - * @param string $end - * @return string - */ - function str_limit($value, $limit = 100, $end = '...') - { - return Str::limit($value, $limit, $end); - } -} - -if ( ! function_exists('str_plural')) -{ - /** - * Get the plural form of an English word. - * - * @param string $value - * @param int $count - * @return string - */ - function str_plural($value, $count = 2) - { - return Str::plural($value, $count); - } -} - -if ( ! function_exists('str_random')) -{ - /** - * Generate a more truly "random" alpha-numeric string. - * - * @param int $length - * @return string - * - * @throws \RuntimeException - */ - function str_random($length = 16) - { - return Str::random($length); - } -} - -if ( ! function_exists('str_replace_array')) -{ - /** - * Replace a given value in the string sequentially with an array. - * - * @param string $search - * @param array $replace - * @param string $subject - * @return string - */ - function str_replace_array($search, array $replace, $subject) - { - foreach ($replace as $value) - { - $subject = preg_replace('/'.$search.'/', $value, $subject, 1); - } - - return $subject; - } -} - -if ( ! function_exists('str_singular')) -{ - /** - * Get the singular form of an English word. - * - * @param string $value - * @return string - */ - function str_singular($value) - { - return Str::singular($value); - } -} - -if ( ! function_exists('str_slug')) -{ - /** - * Generate a URL friendly "slug" from a given string. - * - * @param string $title - * @param string $separator - * @return string - */ - function str_slug($title, $separator = '-') - { - return Str::slug($title, $separator); - } -} - -if ( ! function_exists('studly_case')) -{ - /** - * Convert a value to studly caps case. - * - * @param string $value - * @return string - */ - function studly_case($value) - { - return Str::studly($value); - } -} - -if ( ! function_exists('trait_uses_recursive')) -{ - /** - * Returns all traits used by a trait and its traits. - * - * @param string $trait - * @return array - */ - function trait_uses_recursive($trait) - { - $traits = class_uses($trait); - - foreach ($traits as $trait) - { - $traits += trait_uses_recursive($trait); - } - - return $traits; - } -} - -if ( ! function_exists('value')) -{ - /** - * Return the default value of the given value. - * - * @param mixed $value - * @return mixed - */ - function value($value) - { - return $value instanceof Closure ? $value() : $value; - } -} - -if ( ! function_exists('with')) -{ - /** - * Return the given object. Useful for chaining. - * - * @param mixed $object - * @return mixed - */ - function with($object) - { - return $object; - } +use Illuminate\Contracts\Support\Htmlable; + +if (! function_exists('append_config')) { + /** + * Assign high numeric IDs to a config item to force appending. + * + * @param array $array + * @return array + */ + function append_config(array $array) + { + $start = 9999; + + foreach ($array as $key => $value) { + if (is_numeric($key)) { + $start++; + + $array[$start] = Arr::pull($array, $key); + } + } + + return $array; + } +} + +if (! function_exists('array_add')) { + /** + * Add an element to an array using "dot" notation if it doesn't exist. + * + * @param array $array + * @param string $key + * @param mixed $value + * @return array + */ + function array_add($array, $key, $value) + { + return Arr::add($array, $key, $value); + } +} + +if (! function_exists('array_build')) { + /** + * Build a new array using a callback. + * + * @param array $array + * @param callable $callback + * @return array + */ + function array_build($array, callable $callback) + { + return Arr::build($array, $callback); + } +} + +if (! function_exists('array_collapse')) { + /** + * Collapse an array of arrays into a single array. + * + * @param \ArrayAccess|array $array + * @return array + */ + function array_collapse($array) + { + return Arr::collapse($array); + } +} + +if (! function_exists('array_divide')) { + /** + * Divide an array into two arrays. One with keys and the other with values. + * + * @param array $array + * @return array + */ + function array_divide($array) + { + return Arr::divide($array); + } +} + +if (! function_exists('array_dot')) { + /** + * Flatten a multi-dimensional associative array with dots. + * + * @param array $array + * @param string $prepend + * @return array + */ + function array_dot($array, $prepend = '') + { + return Arr::dot($array, $prepend); + } +} + +if (! function_exists('array_except')) { + /** + * Get all of the given array except for a specified array of items. + * + * @param array $array + * @param array|string $keys + * @return array + */ + function array_except($array, $keys) + { + return Arr::except($array, $keys); + } +} + +if (! function_exists('array_fetch')) { + /** + * Fetch a flattened array of a nested array element. + * + * @param array $array + * @param string $key + * @return array + * + * @deprecated since version 5.1. Use array_pluck instead. + */ + function array_fetch($array, $key) + { + return Arr::fetch($array, $key); + } +} + +if (! function_exists('array_first')) { + /** + * Return the first element in an array passing a given truth test. + * + * @param array $array + * @param callable $callback + * @param mixed $default + * @return mixed + */ + function array_first($array, callable $callback, $default = null) + { + return Arr::first($array, $callback, $default); + } +} + +if (! function_exists('array_flatten')) { + /** + * Flatten a multi-dimensional array into a single level. + * + * @param array $array + * @return array + */ + function array_flatten($array) + { + return Arr::flatten($array); + } +} + +if (! function_exists('array_forget')) { + /** + * Remove one or many array items from a given array using "dot" notation. + * + * @param array $array + * @param array|string $keys + * @return void + */ + function array_forget(&$array, $keys) + { + return Arr::forget($array, $keys); + } +} + +if (! function_exists('array_get')) { + /** + * Get an item from an array using "dot" notation. + * + * @param array $array + * @param string $key + * @param mixed $default + * @return mixed + */ + function array_get($array, $key, $default = null) + { + return Arr::get($array, $key, $default); + } +} + +if (! function_exists('array_has')) { + /** + * Check if an item exists in an array using "dot" notation. + * + * @param array $array + * @param string $key + * @return bool + */ + function array_has($array, $key) + { + return Arr::has($array, $key); + } +} + +if (! function_exists('array_last')) { + /** + * Return the last element in an array passing a given truth test. + * + * @param array $array + * @param callable $callback + * @param mixed $default + * @return mixed + */ + function array_last($array, $callback, $default = null) + { + return Arr::last($array, $callback, $default); + } +} + +if (! function_exists('array_only')) { + /** + * Get a subset of the items from the given array. + * + * @param array $array + * @param array|string $keys + * @return array + */ + function array_only($array, $keys) + { + return Arr::only($array, $keys); + } +} + +if (! function_exists('array_pluck')) { + /** + * Pluck an array of values from an array. + * + * @param array $array + * @param string|array $value + * @param string|array|null $key + * @return array + */ + function array_pluck($array, $value, $key = null) + { + return Arr::pluck($array, $value, $key); + } +} + +if (! function_exists('array_prepend')) { + /** + * Push an item onto the beginning of an array. + * + * @param array $array + * @param mixed $value + * @param mixed $key + * @return array + */ + function array_prepend($array, $value, $key = null) + { + return Arr::prepend($array, $value, $key); + } +} + +if (! function_exists('array_pull')) { + /** + * Get a value from the array, and remove it. + * + * @param array $array + * @param string $key + * @param mixed $default + * @return mixed + */ + function array_pull(&$array, $key, $default = null) + { + return Arr::pull($array, $key, $default); + } +} + +if (! function_exists('array_set')) { + /** + * Set an array item to a given value using "dot" notation. + * + * If no key is given to the method, the entire array will be replaced. + * + * @param array $array + * @param string $key + * @param mixed $value + * @return array + */ + function array_set(&$array, $key, $value) + { + return Arr::set($array, $key, $value); + } +} + +if (! function_exists('array_sort')) { + /** + * Sort the array using the given callback. + * + * @param array $array + * @param callable $callback + * @return array + */ + function array_sort($array, callable $callback) + { + return Arr::sort($array, $callback); + } +} + +if (! function_exists('array_sort_recursive')) { + /** + * Recursively sort an array by keys and values. + * + * @param array $array + * @return array + */ + function array_sort_recursive($array) + { + return Arr::sortRecursive($array); + } +} + +if (! function_exists('array_where')) { + /** + * Filter the array using the given callback. + * + * @param array $array + * @param callable $callback + * @return array + */ + function array_where($array, callable $callback) + { + return Arr::where($array, $callback); + } +} + +if (! function_exists('camel_case')) { + /** + * Convert a value to camel case. + * + * @param string $value + * @return string + */ + function camel_case($value) + { + return Str::camel($value); + } +} + +if (! function_exists('class_basename')) { + /** + * Get the class "basename" of the given object / class. + * + * @param string|object $class + * @return string + */ + function class_basename($class) + { + $class = is_object($class) ? get_class($class) : $class; + + return basename(str_replace('\\', '/', $class)); + } +} + +if (! function_exists('class_uses_recursive')) { + /** + * Returns all traits used by a class, its subclasses and trait of their traits. + * + * @param string $class + * @return array + */ + function class_uses_recursive($class) + { + $results = []; + + foreach (array_merge([$class => $class], class_parents($class)) as $class) { + $results += trait_uses_recursive($class); + } + + return array_unique($results); + } +} + +if (! function_exists('collect')) { + /** + * Create a collection from the given value. + * + * @param mixed $value + * @return \Illuminate\Support\Collection + */ + function collect($value = null) + { + return new Collection($value); + } +} + +if (! function_exists('data_get')) { + /** + * Get an item from an array or object using "dot" notation. + * + * @param mixed $target + * @param string|array $key + * @param mixed $default + * @return mixed + */ + function data_get($target, $key, $default = null) + { + if (is_null($key)) { + return $target; + } + + $key = is_array($key) ? $key : explode('.', $key); + + foreach ($key as $segment) { + if (is_array($target)) { + if (! array_key_exists($segment, $target)) { + return value($default); + } + + $target = $target[$segment]; + } elseif ($target instanceof ArrayAccess) { + if (! isset($target[$segment])) { + return value($default); + } + + $target = $target[$segment]; + } elseif (is_object($target)) { + if (! isset($target->{$segment})) { + return value($default); + } + + $target = $target->{$segment}; + } else { + return value($default); + } + } + + return $target; + } +} + +if (! function_exists('dd')) { + /** + * Dump the passed variables and end the script. + * + * @param mixed + * @return void + */ + function dd() + { + array_map(function ($x) { + (new Dumper)->dump($x); + }, func_get_args()); + + die(1); + } +} + +if (! function_exists('e')) { + /** + * Escape HTML entities in a string. + * + * @param \Illuminate\Contracts\Support\Htmlable|string $value + * @return string + */ + function e($value) + { + if ($value instanceof Htmlable) { + return $value->toHtml(); + } + + return htmlentities($value, ENT_QUOTES, 'UTF-8', false); + } +} + +if (! function_exists('ends_with')) { + /** + * Determine if a given string ends with a given substring. + * + * @param string $haystack + * @param string|array $needles + * @return bool + */ + function ends_with($haystack, $needles) + { + return Str::endsWith($haystack, $needles); + } +} + +if (! function_exists('head')) { + /** + * Get the first element of an array. Useful for method chaining. + * + * @param array $array + * @return mixed + */ + function head($array) + { + return reset($array); + } +} + +if (! function_exists('last')) { + /** + * Get the last element from an array. + * + * @param array $array + * @return mixed + */ + function last($array) + { + return end($array); + } +} + +if (! function_exists('object_get')) { + /** + * Get an item from an object using "dot" notation. + * + * @param object $object + * @param string $key + * @param mixed $default + * @return mixed + */ + function object_get($object, $key, $default = null) + { + if (is_null($key) || trim($key) == '') { + return $object; + } + + foreach (explode('.', $key) as $segment) { + if (! is_object($object) || ! isset($object->{$segment})) { + return value($default); + } + + $object = $object->{$segment}; + } + + return $object; + } +} + +if (! function_exists('preg_replace_sub')) { + /** + * Replace a given pattern with each value in the array in sequentially. + * + * @param string $pattern + * @param array $replacements + * @param string $subject + * @return string + */ + function preg_replace_sub($pattern, &$replacements, $subject) + { + return preg_replace_callback($pattern, function ($match) use (&$replacements) { + foreach ($replacements as $key => $value) { + return array_shift($replacements); + } + }, $subject); + } +} + +if (! function_exists('snake_case')) { + /** + * Convert a string to snake case. + * + * @param string $value + * @param string $delimiter + * @return string + */ + function snake_case($value, $delimiter = '_') + { + return Str::snake($value, $delimiter); + } +} + +if (! function_exists('starts_with')) { + /** + * Determine if a given string starts with a given substring. + * + * @param string $haystack + * @param string|array $needles + * @return bool + */ + function starts_with($haystack, $needles) + { + return Str::startsWith($haystack, $needles); + } +} + +if (! function_exists('str_contains')) { + /** + * Determine if a given string contains a given substring. + * + * @param string $haystack + * @param string|array $needles + * @return bool + */ + function str_contains($haystack, $needles) + { + return Str::contains($haystack, $needles); + } +} + +if (! function_exists('str_finish')) { + /** + * Cap a string with a single instance of a given value. + * + * @param string $value + * @param string $cap + * @return string + */ + function str_finish($value, $cap) + { + return Str::finish($value, $cap); + } +} + +if (! function_exists('str_is')) { + /** + * Determine if a given string matches a given pattern. + * + * @param string $pattern + * @param string $value + * @return bool + */ + function str_is($pattern, $value) + { + return Str::is($pattern, $value); + } +} + +if (! function_exists('str_limit')) { + /** + * Limit the number of characters in a string. + * + * @param string $value + * @param int $limit + * @param string $end + * @return string + */ + function str_limit($value, $limit = 100, $end = '...') + { + return Str::limit($value, $limit, $end); + } +} + +if (! function_exists('str_plural')) { + /** + * Get the plural form of an English word. + * + * @param string $value + * @param int $count + * @return string + */ + function str_plural($value, $count = 2) + { + return Str::plural($value, $count); + } +} + +if (! function_exists('str_random')) { + /** + * Generate a more truly "random" alpha-numeric string. + * + * @param int $length + * @return string + * + * @throws \RuntimeException + */ + function str_random($length = 16) + { + return Str::random($length); + } +} + +if (! function_exists('str_replace_array')) { + /** + * Replace a given value in the string sequentially with an array. + * + * @param string $search + * @param array $replace + * @param string $subject + * @return string + */ + function str_replace_array($search, array $replace, $subject) + { + foreach ($replace as $value) { + $subject = preg_replace('/'.$search.'/', $value, $subject, 1); + } + + return $subject; + } +} + +if (! function_exists('str_singular')) { + /** + * Get the singular form of an English word. + * + * @param string $value + * @return string + */ + function str_singular($value) + { + return Str::singular($value); + } +} + +if (! function_exists('str_slug')) { + /** + * Generate a URL friendly "slug" from a given string. + * + * @param string $title + * @param string $separator + * @return string + */ + function str_slug($title, $separator = '-') + { + return Str::slug($title, $separator); + } +} + +if (! function_exists('studly_case')) { + /** + * Convert a value to studly caps case. + * + * @param string $value + * @return string + */ + function studly_case($value) + { + return Str::studly($value); + } +} + +if (! function_exists('title_case')) { + /** + * Convert a value to title case. + * + * @param string $value + * @return string + */ + function title_case($value) + { + return Str::title($value); + } +} + +if (! function_exists('trait_uses_recursive')) { + /** + * Returns all traits used by a trait and its traits. + * + * @param string $trait + * @return array + */ + function trait_uses_recursive($trait) + { + $traits = class_uses($trait); + + foreach ($traits as $trait) { + $traits += trait_uses_recursive($trait); + } + + return $traits; + } +} + +if (! function_exists('value')) { + /** + * Return the default value of the given value. + * + * @param mixed $value + * @return mixed + */ + function value($value) + { + return $value instanceof Closure ? $value() : $value; + } +} + +if (! function_exists('windows_os')) { + /** + * Determine whether the current envrionment is Windows based. + * + * @return bool + */ + function windows_os() + { + return strtolower(substr(PHP_OS, 0, 3)) === 'win'; + } +} + +if (! function_exists('with')) { + /** + * Return the given object. Useful for chaining. + * + * @param mixed $object + * @return mixed + */ + function with($object) + { + return $object; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php b/application/vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php index f455e60..835accc 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php +++ b/application/vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php @@ -1,130 +1,127 @@ -path = $path; - $this->files = $files; - } - - /** - * Load the messages for the given locale. - * - * @param string $locale - * @param string $group - * @param string $namespace - * @return array - */ - public function load($locale, $group, $namespace = null) - { - if (is_null($namespace) || $namespace == '*') - { - return $this->loadPath($this->path, $locale, $group); - } - - return $this->loadNamespaced($locale, $group, $namespace); - } - - /** - * Load a namespaced translation group. - * - * @param string $locale - * @param string $group - * @param string $namespace - * @return array - */ - protected function loadNamespaced($locale, $group, $namespace) - { - if (isset($this->hints[$namespace])) - { - $lines = $this->loadPath($this->hints[$namespace], $locale, $group); - - return $this->loadNamespaceOverrides($lines, $locale, $group, $namespace); - } - - return array(); - } - - /** - * Load a local namespaced translation group for overrides. - * - * @param array $lines - * @param string $locale - * @param string $group - * @param string $namespace - * @return array - */ - protected function loadNamespaceOverrides(array $lines, $locale, $group, $namespace) - { - $file = "{$this->path}/packages/{$locale}/{$namespace}/{$group}.php"; - - if ($this->files->exists($file)) - { - return array_replace_recursive($lines, $this->files->getRequire($file)); - } - - return $lines; - } - - /** - * Load a locale from a given path. - * - * @param string $path - * @param string $locale - * @param string $group - * @return array - */ - protected function loadPath($path, $locale, $group) - { - if ($this->files->exists($full = "{$path}/{$locale}/{$group}.php")) - { - return $this->files->getRequire($full); - } - - return array(); - } - - /** - * Add a new namespace to the loader. - * - * @param string $namespace - * @param string $hint - * @return void - */ - public function addNamespace($namespace, $hint) - { - $this->hints[$namespace] = $hint; - } +use Illuminate\Filesystem\Filesystem; +class FileLoader implements LoaderInterface +{ + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * The default path for the loader. + * + * @var string + */ + protected $path; + + /** + * All of the namespace hints. + * + * @var array + */ + protected $hints = []; + + /** + * Create a new file loader instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @param string $path + * @return void + */ + public function __construct(Filesystem $files, $path) + { + $this->path = $path; + $this->files = $files; + } + + /** + * Load the messages for the given locale. + * + * @param string $locale + * @param string $group + * @param string $namespace + * @return array + */ + public function load($locale, $group, $namespace = null) + { + if (is_null($namespace) || $namespace == '*') { + return $this->loadPath($this->path, $locale, $group); + } + + return $this->loadNamespaced($locale, $group, $namespace); + } + + /** + * Load a namespaced translation group. + * + * @param string $locale + * @param string $group + * @param string $namespace + * @return array + */ + protected function loadNamespaced($locale, $group, $namespace) + { + if (isset($this->hints[$namespace])) { + $lines = $this->loadPath($this->hints[$namespace], $locale, $group); + + return $this->loadNamespaceOverrides($lines, $locale, $group, $namespace); + } + + return []; + } + + /** + * Load a local namespaced translation group for overrides. + * + * @param array $lines + * @param string $locale + * @param string $group + * @param string $namespace + * @return array + */ + protected function loadNamespaceOverrides(array $lines, $locale, $group, $namespace) + { + $file = "{$this->path}/vendor/{$namespace}/{$locale}/{$group}.php"; + + if ($this->files->exists($file)) { + return array_replace_recursive($lines, $this->files->getRequire($file)); + } + + return $lines; + } + + /** + * Load a locale from a given path. + * + * @param string $path + * @param string $locale + * @param string $group + * @return array + */ + protected function loadPath($path, $locale, $group) + { + if ($this->files->exists($full = "{$path}/{$locale}/{$group}.php")) { + return $this->files->getRequire($full); + } + + return []; + } + + /** + * Add a new namespace to the loader. + * + * @param string $namespace + * @param string $hint + * @return void + */ + public function addNamespace($namespace, $hint) + { + $this->hints[$namespace] = $hint; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Translation/LoaderInterface.php b/application/vendor/laravel/framework/src/Illuminate/Translation/LoaderInterface.php index f0fbac5..9e45572 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Translation/LoaderInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/Translation/LoaderInterface.php @@ -1,24 +1,25 @@ -registerLoader(); - - $this->app->singleton('translator', function($app) - { - $loader = $app['translation.loader']; - - // When registering the translator component, we'll need to set the default - // locale as well as the fallback locale. So, we'll grab the application - // configuration so we can easily get both of these values from there. - $locale = $app['config']['app.locale']; - - $trans = new Translator($loader, $locale); - - $trans->setFallback($app['config']['app.fallback_locale']); - - return $trans; - }); - } - - /** - * Register the translation line loader. - * - * @return void - */ - protected function registerLoader() - { - $this->app->singleton('translation.loader', function($app) - { - return new FileLoader($app['files'], $app['path.lang']); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array('translator', 'translation.loader'); - } +use Illuminate\Support\ServiceProvider; +class TranslationServiceProvider extends ServiceProvider +{ + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = true; + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerLoader(); + + $this->app->singleton('translator', function ($app) { + $loader = $app['translation.loader']; + + // When registering the translator component, we'll need to set the default + // locale as well as the fallback locale. So, we'll grab the application + // configuration so we can easily get both of these values from there. + $locale = $app['config']['app.locale']; + + $trans = new Translator($loader, $locale); + + $trans->setFallback($app['config']['app.fallback_locale']); + + return $trans; + }); + } + + /** + * Register the translation line loader. + * + * @return void + */ + protected function registerLoader() + { + $this->app->singleton('translation.loader', function ($app) { + return new FileLoader($app['files'], $app['path.lang']); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['translator', 'translation.loader']; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Translation/Translator.php b/application/vendor/laravel/framework/src/Illuminate/Translation/Translator.php index c5a3ace..62f09c7 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Translation/Translator.php +++ b/application/vendor/laravel/framework/src/Illuminate/Translation/Translator.php @@ -1,365 +1,383 @@ -loader = $loader; - $this->locale = $locale; - } - - /** - * Determine if a translation exists. - * - * @param string $key - * @param string $locale - * @return bool - */ - public function has($key, $locale = null) - { - return $this->get($key, array(), $locale) !== $key; - } - - /** - * Get the translation for the given key. - * - * @param string $key - * @param array $replace - * @param string $locale - * @return string - */ - public function get($key, array $replace = array(), $locale = null) - { - list($namespace, $group, $item) = $this->parseKey($key); - - // Here we will get the locale that should be used for the language line. If one - // was not passed, we will use the default locales which was given to us when - // the translator was instantiated. Then, we can load the lines and return. - foreach ($this->parseLocale($locale) as $locale) - { - $this->load($namespace, $group, $locale); - - $line = $this->getLine( - $namespace, $group, $locale, $item, $replace - ); - - if ( ! is_null($line)) break; - } - - // If the line doesn't exist, we will return back the key which was requested as - // that will be quick to spot in the UI if language keys are wrong or missing - // from the application's language files. Otherwise we can return the line. - if ( ! isset($line)) return $key; - - return $line; - } - - /** - * Retrieve a language line out the loaded array. - * - * @param string $namespace - * @param string $group - * @param string $locale - * @param string $item - * @param array $replace - * @return string|null - */ - protected function getLine($namespace, $group, $locale, $item, array $replace) - { - $line = array_get($this->loaded[$namespace][$group][$locale], $item); - - if (is_string($line)) - { - return $this->makeReplacements($line, $replace); - } - elseif (is_array($line) && count($line) > 0) - { - return $line; - } - } - - /** - * Make the place-holder replacements on a line. - * - * @param string $line - * @param array $replace - * @return string - */ - protected function makeReplacements($line, array $replace) - { - $replace = $this->sortReplacements($replace); - - foreach ($replace as $key => $value) - { - $line = str_replace(':'.$key, $value, $line); - } - - return $line; - } - - /** - * Sort the replacements array. - * - * @param array $replace - * @return array - */ - protected function sortReplacements(array $replace) - { - return (new Collection($replace))->sortBy(function($value, $key) - { - return mb_strlen($key) * -1; - }); - } - - /** - * Get a translation according to an integer value. - * - * @param string $key - * @param int $number - * @param array $replace - * @param string $locale - * @return string - */ - public function choice($key, $number, array $replace = array(), $locale = null) - { - $line = $this->get($key, $replace, $locale = $locale ?: $this->locale ?: $this->fallback); - - $replace['count'] = $number; - - return $this->makeReplacements($this->getSelector()->choose($line, $number, $locale), $replace); - } - - /** - * Get the translation for a given key. - * - * @param string $id - * @param array $parameters - * @param string $domain - * @param string $locale - * @return string - */ - public function trans($id, array $parameters = array(), $domain = 'messages', $locale = null) - { - return $this->get($id, $parameters, $locale); - } - - /** - * Get a translation according to an integer value. - * - * @param string $id - * @param int $number - * @param array $parameters - * @param string $domain - * @param string $locale - * @return string - */ - public function transChoice($id, $number, array $parameters = array(), $domain = 'messages', $locale = null) - { - return $this->choice($id, $number, $parameters, $locale); - } - - /** - * Load the specified language group. - * - * @param string $namespace - * @param string $group - * @param string $locale - * @return void - */ - public function load($namespace, $group, $locale) - { - if ($this->isLoaded($namespace, $group, $locale)) return; - - // The loader is responsible for returning the array of language lines for the - // given namespace, group, and locale. We'll set the lines in this array of - // lines that have already been loaded so that we can easily access them. - $lines = $this->loader->load($locale, $group, $namespace); - - $this->loaded[$namespace][$group][$locale] = $lines; - } - - /** - * Determine if the given group has been loaded. - * - * @param string $namespace - * @param string $group - * @param string $locale - * @return bool - */ - protected function isLoaded($namespace, $group, $locale) - { - return isset($this->loaded[$namespace][$group][$locale]); - } - - /** - * Add a new namespace to the loader. - * - * @param string $namespace - * @param string $hint - * @return void - */ - public function addNamespace($namespace, $hint) - { - $this->loader->addNamespace($namespace, $hint); - } - - /** - * Parse a key into namespace, group, and item. - * - * @param string $key - * @return array - */ - public function parseKey($key) - { - $segments = parent::parseKey($key); - - if (is_null($segments[0])) $segments[0] = '*'; - - return $segments; - } - - /** - * Get the array of locales to be checked. - * - * @param string|null $locale - * @return array - */ - protected function parseLocale($locale) - { - if ( ! is_null($locale)) - { - return array_filter(array($locale, $this->fallback)); - } - - return array_filter(array($this->locale, $this->fallback)); - } - - /** - * Get the message selector instance. - * - * @return \Symfony\Component\Translation\MessageSelector - */ - public function getSelector() - { - if ( ! isset($this->selector)) - { - $this->selector = new MessageSelector; - } - - return $this->selector; - } - - /** - * Set the message selector instance. - * - * @param \Symfony\Component\Translation\MessageSelector $selector - * @return void - */ - public function setSelector(MessageSelector $selector) - { - $this->selector = $selector; - } - - /** - * Get the language line loader implementation. - * - * @return \Illuminate\Translation\LoaderInterface - */ - public function getLoader() - { - return $this->loader; - } - - /** - * Get the default locale being used. - * - * @return string - */ - public function locale() - { - return $this->getLocale(); - } - - /** - * Get the default locale being used. - * - * @return string - */ - public function getLocale() - { - return $this->locale; - } - - /** - * Set the default locale. - * - * @param string $locale - * @return void - */ - public function setLocale($locale) - { - $this->locale = $locale; - } - - /** - * Get the fallback locale being used. - * - * @return string - */ - public function getFallback() - { - return $this->fallback; - } - - /** - * Set the fallback locale being used. - * - * @param string $fallback - * @return void - */ - public function setFallback($fallback) - { - $this->fallback = $fallback; - } - +class Translator extends NamespacedItemResolver implements TranslatorInterface +{ + /** + * The loader implementation. + * + * @var \Illuminate\Translation\LoaderInterface + */ + protected $loader; + + /** + * The default locale being used by the translator. + * + * @var string + */ + protected $locale; + + /** + * The fallback locale used by the translator. + * + * @var string + */ + protected $fallback; + + /** + * The array of loaded translation groups. + * + * @var array + */ + protected $loaded = []; + + /** + * Create a new translator instance. + * + * @param \Illuminate\Translation\LoaderInterface $loader + * @param string $locale + * @return void + */ + public function __construct(LoaderInterface $loader, $locale) + { + $this->loader = $loader; + $this->locale = $locale; + } + + /** + * Determine if a translation exists for a given locale. + * + * @param string $key + * @param string|null $locale + * @return bool + */ + public function hasForLocale($key, $locale = null) + { + return $this->has($key, $locale, false); + } + + /** + * Determine if a translation exists. + * + * @param string $key + * @param string|null $locale + * @param bool $fallback + * @return bool + */ + public function has($key, $locale = null, $fallback = true) + { + return $this->get($key, [], $locale, $fallback) !== $key; + } + + /** + * Get the translation for the given key. + * + * @param string $key + * @param array $replace + * @param string|null $locale + * @param bool $fallback + * @return string + */ + public function get($key, array $replace = [], $locale = null, $fallback = true) + { + list($namespace, $group, $item) = $this->parseKey($key); + + // Here we will get the locale that should be used for the language line. If one + // was not passed, we will use the default locales which was given to us when + // the translator was instantiated. Then, we can load the lines and return. + $locales = $fallback ? $this->parseLocale($locale) : [$locale ?: $this->locale]; + + foreach ($locales as $locale) { + $this->load($namespace, $group, $locale); + + $line = $this->getLine( + $namespace, $group, $locale, $item, $replace + ); + + if (! is_null($line)) { + break; + } + } + + // If the line doesn't exist, we will return back the key which was requested as + // that will be quick to spot in the UI if language keys are wrong or missing + // from the application's language files. Otherwise we can return the line. + if (! isset($line)) { + return $key; + } + + return $line; + } + + /** + * Retrieve a language line out the loaded array. + * + * @param string $namespace + * @param string $group + * @param string $locale + * @param string $item + * @param array $replace + * @return string|array|null + */ + protected function getLine($namespace, $group, $locale, $item, array $replace) + { + $line = Arr::get($this->loaded[$namespace][$group][$locale], $item); + + if (is_string($line)) { + return $this->makeReplacements($line, $replace); + } elseif (is_array($line) && count($line) > 0) { + return $line; + } + } + + /** + * Make the place-holder replacements on a line. + * + * @param string $line + * @param array $replace + * @return string + */ + protected function makeReplacements($line, array $replace) + { + $replace = $this->sortReplacements($replace); + + foreach ($replace as $key => $value) { + $line = str_replace(':'.$key, $value, $line); + } + + return $line; + } + + /** + * Sort the replacements array. + * + * @param array $replace + * @return array + */ + protected function sortReplacements(array $replace) + { + return (new Collection($replace))->sortBy(function ($value, $key) { + return mb_strlen($key) * -1; + }); + } + + /** + * Get a translation according to an integer value. + * + * @param string $key + * @param int $number + * @param array $replace + * @param string $locale + * @return string + */ + public function choice($key, $number, array $replace = [], $locale = null) + { + $line = $this->get($key, $replace, $locale = $locale ?: $this->locale ?: $this->fallback); + + $replace['count'] = $number; + + return $this->makeReplacements($this->getSelector()->choose($line, $number, $locale), $replace); + } + + /** + * Get the translation for a given key. + * + * @param string $id + * @param array $parameters + * @param string $domain + * @param string $locale + * @return string + */ + public function trans($id, array $parameters = [], $domain = 'messages', $locale = null) + { + return $this->get($id, $parameters, $locale); + } + + /** + * Get a translation according to an integer value. + * + * @param string $id + * @param int $number + * @param array $parameters + * @param string $domain + * @param string $locale + * @return string + */ + public function transChoice($id, $number, array $parameters = [], $domain = 'messages', $locale = null) + { + return $this->choice($id, $number, $parameters, $locale); + } + + /** + * Load the specified language group. + * + * @param string $namespace + * @param string $group + * @param string $locale + * @return void + */ + public function load($namespace, $group, $locale) + { + if ($this->isLoaded($namespace, $group, $locale)) { + return; + } + + // The loader is responsible for returning the array of language lines for the + // given namespace, group, and locale. We'll set the lines in this array of + // lines that have already been loaded so that we can easily access them. + $lines = $this->loader->load($locale, $group, $namespace); + + $this->loaded[$namespace][$group][$locale] = $lines; + } + + /** + * Determine if the given group has been loaded. + * + * @param string $namespace + * @param string $group + * @param string $locale + * @return bool + */ + protected function isLoaded($namespace, $group, $locale) + { + return isset($this->loaded[$namespace][$group][$locale]); + } + + /** + * Add a new namespace to the loader. + * + * @param string $namespace + * @param string $hint + * @return void + */ + public function addNamespace($namespace, $hint) + { + $this->loader->addNamespace($namespace, $hint); + } + + /** + * Parse a key into namespace, group, and item. + * + * @param string $key + * @return array + */ + public function parseKey($key) + { + $segments = parent::parseKey($key); + + if (is_null($segments[0])) { + $segments[0] = '*'; + } + + return $segments; + } + + /** + * Get the array of locales to be checked. + * + * @param string|null $locale + * @return array + */ + protected function parseLocale($locale) + { + if (! is_null($locale)) { + return array_filter([$locale, $this->fallback]); + } + + return array_filter([$this->locale, $this->fallback]); + } + + /** + * Get the message selector instance. + * + * @return \Symfony\Component\Translation\MessageSelector + */ + public function getSelector() + { + if (! isset($this->selector)) { + $this->selector = new MessageSelector; + } + + return $this->selector; + } + + /** + * Set the message selector instance. + * + * @param \Symfony\Component\Translation\MessageSelector $selector + * @return void + */ + public function setSelector(MessageSelector $selector) + { + $this->selector = $selector; + } + + /** + * Get the language line loader implementation. + * + * @return \Illuminate\Translation\LoaderInterface + */ + public function getLoader() + { + return $this->loader; + } + + /** + * Get the default locale being used. + * + * @return string + */ + public function locale() + { + return $this->getLocale(); + } + + /** + * Get the default locale being used. + * + * @return string + */ + public function getLocale() + { + return $this->locale; + } + + /** + * Set the default locale. + * + * @param string $locale + * @return void + */ + public function setLocale($locale) + { + $this->locale = $locale; + } + + /** + * Get the fallback locale being used. + * + * @return string + */ + public function getFallback() + { + return $this->fallback; + } + + /** + * Set the fallback locale being used. + * + * @param string $fallback + * @return void + */ + public function setFallback($fallback) + { + $this->fallback = $fallback; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Translation/composer.json b/application/vendor/laravel/framework/src/Illuminate/Translation/composer.json index e5fea87..e3e355d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Translation/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Translation/composer.json @@ -14,10 +14,10 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/filesystem": "5.0.*", - "illuminate/support": "5.0.*", - "symfony/translation": "2.6.*" + "php": ">=5.5.9", + "illuminate/filesystem": "5.1.*", + "illuminate/support": "5.1.*", + "symfony/translation": "2.7.*" }, "autoload": { "psr-4": { @@ -26,7 +26,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/src/Illuminate/Validation/DatabasePresenceVerifier.php b/application/vendor/laravel/framework/src/Illuminate/Validation/DatabasePresenceVerifier.php index 2558f62..42aa353 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Validation/DatabasePresenceVerifier.php +++ b/application/vendor/laravel/framework/src/Illuminate/Validation/DatabasePresenceVerifier.php @@ -1,127 +1,120 @@ -db = $db; - } - - /** - * Count the number of objects in a collection having the given value. - * - * @param string $collection - * @param string $column - * @param string $value - * @param int $excludeId - * @param string $idColumn - * @param array $extra - * @return int - */ - public function getCount($collection, $column, $value, $excludeId = null, $idColumn = null, array $extra = array()) - { - $query = $this->table($collection)->where($column, '=', $value); - - if ( ! is_null($excludeId) && $excludeId != 'NULL') - { - $query->where($idColumn ?: 'id', '<>', $excludeId); - } - - foreach ($extra as $key => $extraValue) - { - $this->addWhere($query, $key, $extraValue); - } +namespace Illuminate\Validation; - return $query->count(); - } - - /** - * Count the number of objects in a collection with the given values. - * - * @param string $collection - * @param string $column - * @param array $values - * @param array $extra - * @return int - */ - public function getMultiCount($collection, $column, array $values, array $extra = array()) - { - $query = $this->table($collection)->whereIn($column, $values); - - foreach ($extra as $key => $extraValue) - { - $this->addWhere($query, $key, $extraValue); - } - - return $query->count(); - } - - /** - * Add a "where" clause to the given query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $key - * @param string $extraValue - * @return void - */ - protected function addWhere($query, $key, $extraValue) - { - if ($extraValue === 'NULL') - { - $query->whereNull($key); - } - elseif ($extraValue === 'NOT_NULL') - { - $query->whereNotNull($key); - } - else - { - $query->where($key, $extraValue); - } - } - - /** - * Get a query builder for the given table. - * - * @param string $table - * @return \Illuminate\Database\Query\Builder - */ - protected function table($table) - { - return $this->db->connection($this->connection)->table($table); - } - - /** - * Set the connection to be used. - * - * @param string $connection - * @return void - */ - public function setConnection($connection) - { - $this->connection = $connection; - } +use Illuminate\Database\ConnectionResolverInterface; +class DatabasePresenceVerifier implements PresenceVerifierInterface +{ + /** + * The database connection instance. + * + * @var \Illuminate\Database\ConnectionResolverInterface + */ + protected $db; + + /** + * The database connection to use. + * + * @var string + */ + protected $connection = null; + + /** + * Create a new database presence verifier. + * + * @param \Illuminate\Database\ConnectionResolverInterface $db + * @return void + */ + public function __construct(ConnectionResolverInterface $db) + { + $this->db = $db; + } + + /** + * Count the number of objects in a collection having the given value. + * + * @param string $collection + * @param string $column + * @param string $value + * @param int $excludeId + * @param string $idColumn + * @param array $extra + * @return int + */ + public function getCount($collection, $column, $value, $excludeId = null, $idColumn = null, array $extra = []) + { + $query = $this->table($collection)->where($column, '=', $value); + + if (! is_null($excludeId) && $excludeId != 'NULL') { + $query->where($idColumn ?: 'id', '<>', $excludeId); + } + + foreach ($extra as $key => $extraValue) { + $this->addWhere($query, $key, $extraValue); + } + + return $query->count(); + } + + /** + * Count the number of objects in a collection with the given values. + * + * @param string $collection + * @param string $column + * @param array $values + * @param array $extra + * @return int + */ + public function getMultiCount($collection, $column, array $values, array $extra = []) + { + $query = $this->table($collection)->whereIn($column, $values); + + foreach ($extra as $key => $extraValue) { + $this->addWhere($query, $key, $extraValue); + } + + return $query->count(); + } + + /** + * Add a "where" clause to the given query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $key + * @param string $extraValue + * @return void + */ + protected function addWhere($query, $key, $extraValue) + { + if ($extraValue === 'NULL') { + $query->whereNull($key); + } elseif ($extraValue === 'NOT_NULL') { + $query->whereNotNull($key); + } else { + $query->where($key, $extraValue); + } + } + + /** + * Get a query builder for the given table. + * + * @param string $table + * @return \Illuminate\Database\Query\Builder + */ + protected function table($table) + { + return $this->db->connection($this->connection)->table($table)->useWritePdo(); + } + + /** + * Set the connection to be used. + * + * @param string $connection + * @return void + */ + public function setConnection($connection) + { + $this->connection = $connection; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Validation/Factory.php b/application/vendor/laravel/framework/src/Illuminate/Validation/Factory.php index b38624c..bbc5e22 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Validation/Factory.php +++ b/application/vendor/laravel/framework/src/Illuminate/Validation/Factory.php @@ -1,238 +1,241 @@ -container = $container; - $this->translator = $translator; - } - - /** - * Create a new Validator instance. - * - * @param array $data - * @param array $rules - * @param array $messages - * @param array $customAttributes - * @return \Illuminate\Validation\Validator - */ - public function make(array $data, array $rules, array $messages = array(), array $customAttributes = array()) - { - // The presence verifier is responsible for checking the unique and exists data - // for the validator. It is behind an interface so that multiple versions of - // it may be written besides database. We'll inject it into the validator. - $validator = $this->resolve($data, $rules, $messages, $customAttributes); - - if ( ! is_null($this->verifier)) - { - $validator->setPresenceVerifier($this->verifier); - } - - // Next we'll set the IoC container instance of the validator, which is used to - // resolve out class based validator extensions. If it is not set then these - // types of extensions will not be possible on these validation instances. - if ( ! is_null($this->container)) - { - $validator->setContainer($this->container); - } - - $this->addExtensions($validator); - - return $validator; - } - - /** - * Add the extensions to a validator instance. - * - * @param \Illuminate\Validation\Validator $validator - * @return void - */ - protected function addExtensions(Validator $validator) - { - $validator->addExtensions($this->extensions); - - // Next, we will add the implicit extensions, which are similar to the required - // and accepted rule in that they are run even if the attributes is not in a - // array of data that is given to a validator instances via instantiation. - $implicit = $this->implicitExtensions; - - $validator->addImplicitExtensions($implicit); - - $validator->addReplacers($this->replacers); - - $validator->setFallbackMessages($this->fallbackMessages); - } - - /** - * Resolve a new Validator instance. - * - * @param array $data - * @param array $rules - * @param array $messages - * @param array $customAttributes - * @return \Illuminate\Validation\Validator - */ - protected function resolve(array $data, array $rules, array $messages, array $customAttributes) - { - if (is_null($this->resolver)) - { - return new Validator($this->translator, $data, $rules, $messages, $customAttributes); - } - - return call_user_func($this->resolver, $this->translator, $data, $rules, $messages, $customAttributes); - } - - /** - * Register a custom validator extension. - * - * @param string $rule - * @param \Closure|string $extension - * @param string $message - * @return void - */ - public function extend($rule, $extension, $message = null) - { - $this->extensions[$rule] = $extension; - - if ($message) $this->fallbackMessages[snake_case($rule)] = $message; - } - - /** - * Register a custom implicit validator extension. - * - * @param string $rule - * @param \Closure|string $extension - * @param string $message - * @return void - */ - public function extendImplicit($rule, $extension, $message = null) - { - $this->implicitExtensions[$rule] = $extension; - - if ($message) $this->fallbackMessages[snake_case($rule)] = $message; - } - - /** - * Register a custom implicit validator message replacer. - * - * @param string $rule - * @param \Closure|string $replacer - * @return void - */ - public function replacer($rule, $replacer) - { - $this->replacers[$rule] = $replacer; - } - - /** - * Set the Validator instance resolver. - * - * @param \Closure $resolver - * @return void - */ - public function resolver(Closure $resolver) - { - $this->resolver = $resolver; - } - - /** - * Get the Translator implementation. - * - * @return \Symfony\Component\Translation\TranslatorInterface - */ - public function getTranslator() - { - return $this->translator; - } - - /** - * Get the Presence Verifier implementation. - * - * @return \Illuminate\Validation\PresenceVerifierInterface - */ - public function getPresenceVerifier() - { - return $this->verifier; - } - - /** - * Set the Presence Verifier implementation. - * - * @param \Illuminate\Validation\PresenceVerifierInterface $presenceVerifier - * @return void - */ - public function setPresenceVerifier(PresenceVerifierInterface $presenceVerifier) - { - $this->verifier = $presenceVerifier; - } - +class Factory implements FactoryContract +{ + /** + * The Translator implementation. + * + * @var \Symfony\Component\Translation\TranslatorInterface + */ + protected $translator; + + /** + * The Presence Verifier implementation. + * + * @var \Illuminate\Validation\PresenceVerifierInterface + */ + protected $verifier; + + /** + * The IoC container instance. + * + * @var \Illuminate\Contracts\Container\Container + */ + protected $container; + + /** + * All of the custom validator extensions. + * + * @var array + */ + protected $extensions = []; + + /** + * All of the custom implicit validator extensions. + * + * @var array + */ + protected $implicitExtensions = []; + + /** + * All of the custom validator message replacers. + * + * @var array + */ + protected $replacers = []; + + /** + * All of the fallback messages for custom rules. + * + * @var array + */ + protected $fallbackMessages = []; + + /** + * The Validator resolver instance. + * + * @var Closure + */ + protected $resolver; + + /** + * Create a new Validator factory instance. + * + * @param \Symfony\Component\Translation\TranslatorInterface $translator + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function __construct(TranslatorInterface $translator, Container $container = null) + { + $this->container = $container; + $this->translator = $translator; + } + + /** + * Create a new Validator instance. + * + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return \Illuminate\Validation\Validator + */ + public function make(array $data, array $rules, array $messages = [], array $customAttributes = []) + { + // The presence verifier is responsible for checking the unique and exists data + // for the validator. It is behind an interface so that multiple versions of + // it may be written besides database. We'll inject it into the validator. + $validator = $this->resolve($data, $rules, $messages, $customAttributes); + + if (! is_null($this->verifier)) { + $validator->setPresenceVerifier($this->verifier); + } + + // Next we'll set the IoC container instance of the validator, which is used to + // resolve out class based validator extensions. If it is not set then these + // types of extensions will not be possible on these validation instances. + if (! is_null($this->container)) { + $validator->setContainer($this->container); + } + + $this->addExtensions($validator); + + return $validator; + } + + /** + * Add the extensions to a validator instance. + * + * @param \Illuminate\Validation\Validator $validator + * @return void + */ + protected function addExtensions(Validator $validator) + { + $validator->addExtensions($this->extensions); + + // Next, we will add the implicit extensions, which are similar to the required + // and accepted rule in that they are run even if the attributes is not in a + // array of data that is given to a validator instances via instantiation. + $implicit = $this->implicitExtensions; + + $validator->addImplicitExtensions($implicit); + + $validator->addReplacers($this->replacers); + + $validator->setFallbackMessages($this->fallbackMessages); + } + + /** + * Resolve a new Validator instance. + * + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return \Illuminate\Validation\Validator + */ + protected function resolve(array $data, array $rules, array $messages, array $customAttributes) + { + if (is_null($this->resolver)) { + return new Validator($this->translator, $data, $rules, $messages, $customAttributes); + } + + return call_user_func($this->resolver, $this->translator, $data, $rules, $messages, $customAttributes); + } + + /** + * Register a custom validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @param string $message + * @return void + */ + public function extend($rule, $extension, $message = null) + { + $this->extensions[$rule] = $extension; + + if ($message) { + $this->fallbackMessages[Str::snake($rule)] = $message; + } + } + + /** + * Register a custom implicit validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @param string $message + * @return void + */ + public function extendImplicit($rule, $extension, $message = null) + { + $this->implicitExtensions[$rule] = $extension; + + if ($message) { + $this->fallbackMessages[Str::snake($rule)] = $message; + } + } + + /** + * Register a custom implicit validator message replacer. + * + * @param string $rule + * @param \Closure|string $replacer + * @return void + */ + public function replacer($rule, $replacer) + { + $this->replacers[$rule] = $replacer; + } + + /** + * Set the Validator instance resolver. + * + * @param \Closure $resolver + * @return void + */ + public function resolver(Closure $resolver) + { + $this->resolver = $resolver; + } + + /** + * Get the Translator implementation. + * + * @return \Symfony\Component\Translation\TranslatorInterface + */ + public function getTranslator() + { + return $this->translator; + } + + /** + * Get the Presence Verifier implementation. + * + * @return \Illuminate\Validation\PresenceVerifierInterface + */ + public function getPresenceVerifier() + { + return $this->verifier; + } + + /** + * Set the Presence Verifier implementation. + * + * @param \Illuminate\Validation\PresenceVerifierInterface $presenceVerifier + * @return void + */ + public function setPresenceVerifier(PresenceVerifierInterface $presenceVerifier) + { + $this->verifier = $presenceVerifier; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Validation/PresenceVerifierInterface.php b/application/vendor/laravel/framework/src/Illuminate/Validation/PresenceVerifierInterface.php index 32fd3f4..7449629 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Validation/PresenceVerifierInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/Validation/PresenceVerifierInterface.php @@ -1,29 +1,30 @@ -getValidatorInstance(); - - if ( ! $this->passesAuthorization()) - { - $this->failedAuthorization(); - } - elseif ( ! $instance->passes()) - { - $this->failedValidation($instance); - } - } +trait ValidatesWhenResolvedTrait +{ + /** + * Validate the class instance. + * + * @return void + */ + public function validate() + { + $instance = $this->getValidatorInstance(); - /** - * Get the validator instance for the request. - * - * @return \Illuminate\Validation\Validator - */ - protected function getValidatorInstance() - { - return $this->validator(); - } + if (! $this->passesAuthorization()) { + $this->failedAuthorization(); + } elseif (! $instance->passes()) { + $this->failedValidation($instance); + } + } - /** - * Handle a failed validation attempt. - * - * @param \Illuminate\Validation\Validator $validator - * @return mixed - */ - protected function failedValidation(Validator $validator) - { - throw new ValidationException($validator); - } + /** + * Get the validator instance for the request. + * + * @return \Illuminate\Validation\Validator + */ + protected function getValidatorInstance() + { + return $this->validator(); + } - /** - * Deteremine if the request passes the authorization check. - * - * @return bool - */ - protected function passesAuthorization() - { - if (method_exists($this, 'authorize')) - { - return $this->authorize(); - } + /** + * Handle a failed validation attempt. + * + * @param \Illuminate\Validation\Validator $validator + * @return mixed + */ + protected function failedValidation(Validator $validator) + { + throw new ValidationException($validator); + } - return true; - } + /** + * Determine if the request passes the authorization check. + * + * @return bool + */ + protected function passesAuthorization() + { + if (method_exists($this, 'authorize')) { + return $this->authorize(); + } - /** - * Handle a failed authorization attempt. - * - * @return mixed - */ - protected function failedAuthorization() - { - throw new UnauthorizedException; - } + return true; + } + /** + * Handle a failed authorization attempt. + * + * @return mixed + */ + protected function failedAuthorization() + { + throw new UnauthorizedException; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php b/application/vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php index e22f743..5eaf08f 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php +++ b/application/vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php @@ -1,71 +1,68 @@ -registerValidationResolverHook(); - - $this->registerPresenceVerifier(); +class ValidationServiceProvider extends ServiceProvider +{ + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerValidationResolverHook(); - $this->registerValidationFactory(); - } + $this->registerPresenceVerifier(); - /** - * Register the "ValidatesWhenResolved" container hook. - * - * @return void - */ - protected function registerValidationResolverHook() - { - $this->app->afterResolving(function(ValidatesWhenResolved $resolved) - { - $resolved->validate(); - }); - } + $this->registerValidationFactory(); + } - /** - * Register the validation factory. - * - * @return void - */ - protected function registerValidationFactory() - { - $this->app->singleton('validator', function($app) - { - $validator = new Factory($app['translator'], $app); + /** + * Register the "ValidatesWhenResolved" container hook. + * + * @return void + */ + protected function registerValidationResolverHook() + { + $this->app->afterResolving(function (ValidatesWhenResolved $resolved) { + $resolved->validate(); + }); + } - // The validation presence verifier is responsible for determining the existence - // of values in a given data collection, typically a relational database or - // other persistent data stores. And it is used to check for uniqueness. - if (isset($app['validation.presence'])) - { - $validator->setPresenceVerifier($app['validation.presence']); - } + /** + * Register the validation factory. + * + * @return void + */ + protected function registerValidationFactory() + { + $this->app->singleton('validator', function ($app) { + $validator = new Factory($app['translator'], $app); - return $validator; - }); - } + // The validation presence verifier is responsible for determining the existence + // of values in a given data collection, typically a relational database or + // other persistent data stores. And it is used to check for uniqueness. + if (isset($app['validation.presence'])) { + $validator->setPresenceVerifier($app['validation.presence']); + } - /** - * Register the database presence verifier. - * - * @return void - */ - protected function registerPresenceVerifier() - { - $this->app->singleton('validation.presence', function($app) - { - return new DatabasePresenceVerifier($app['db']); - }); - } + return $validator; + }); + } + /** + * Register the database presence verifier. + * + * @return void + */ + protected function registerPresenceVerifier() + { + $this->app->singleton('validation.presence', function ($app) { + return new DatabasePresenceVerifier($app['db']); + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Validation/Validator.php b/application/vendor/laravel/framework/src/Illuminate/Validation/Validator.php index 34d5cc4..9c5e74d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Validation/Validator.php +++ b/application/vendor/laravel/framework/src/Illuminate/Validation/Validator.php @@ -1,12 +1,17 @@ -translator = $translator; - $this->customMessages = $messages; - $this->data = $this->parseData($data); - $this->rules = $this->explodeRules($rules); - $this->customAttributes = $customAttributes; - } - - /** - * Parse the data and hydrate the files array. - * - * @param array $data - * @param string $arrayKey - * @return array - */ - protected function parseData(array $data, $arrayKey = null) - { - if (is_null($arrayKey)) - { - $this->files = array(); - } - - foreach ($data as $key => $value) - { - $key = ($arrayKey) ? "$arrayKey.$key" : $key; - - // If this value is an instance of the HttpFoundation File class we will - // remove it from the data array and add it to the files array, which - // we use to conveniently separate out these files from other data. - if ($value instanceof File) - { - $this->files[$key] = $value; - - unset($data[$key]); - } - elseif (is_array($value)) - { - $this->parseData($value, $key); - } - } - - return $data; - } - - /** - * Explode the rules into an array of rules. - * - * @param string|array $rules - * @return array - */ - protected function explodeRules($rules) - { - foreach ($rules as $key => &$rule) - { - $rule = (is_string($rule)) ? explode('|', $rule) : $rule; - } - - return $rules; - } - - /** - * After an after validation callback. - * - * @param callable|string $callback - * @return $this - */ - public function after($callback) - { - $this->after[] = function() use ($callback) - { - return call_user_func_array($callback, [$this]); - }; - - return $this; - } - - /** - * Add conditions to a given field based on a Closure. - * - * @param string $attribute - * @param string|array $rules - * @param callable $callback - * @return void - */ - public function sometimes($attribute, $rules, callable $callback) - { - $payload = new Fluent(array_merge($this->data, $this->files)); - - if (call_user_func($callback, $payload)) - { - foreach ((array) $attribute as $key) - { - $this->mergeRules($key, $rules); - } - } - } - - /** - * Define a set of rules that apply to each element in an array attribute. - * - * @param string $attribute - * @param string|array $rules - * @return void - * - * @throws \InvalidArgumentException - */ - public function each($attribute, $rules) - { - $data = array_get($this->data, $attribute); - - if ( ! is_array($data)) - { - if ($this->hasRule($attribute, 'Array')) return; - - throw new InvalidArgumentException('Attribute for each() must be an array.'); - } - - foreach ($data as $dataKey => $dataValue) - { - foreach ($rules as $ruleKey => $ruleValue) - { - if ( ! is_string($ruleKey)) - { - $this->mergeRules("$attribute.$dataKey", $ruleValue); - } - else - { - $this->mergeRules("$attribute.$dataKey.$ruleKey", $ruleValue); - } - } - } - } - - /** - * Merge additional rules into a given attribute. - * - * @param string $attribute - * @param string|array $rules - * @return void - */ - public function mergeRules($attribute, $rules) - { - $current = isset($this->rules[$attribute]) ? $this->rules[$attribute] : []; - - $merge = head($this->explodeRules(array($rules))); - - $this->rules[$attribute] = array_merge($current, $merge); - } - - /** - * Determine if the data passes the validation rules. - * - * @return bool - */ - public function passes() - { - $this->messages = new MessageBag; - - // We'll spin through each rule, validating the attributes attached to that - // rule. Any error messages will be added to the containers with each of - // the other error messages, returning true if we don't have messages. - foreach ($this->rules as $attribute => $rules) - { - foreach ($rules as $rule) - { - $this->validate($attribute, $rule); - } - } - - // Here we will spin through all of the "after" hooks on this validator and - // fire them off. This gives the callbacks a chance to perform all kinds - // of other validation that needs to get wrapped up in this operation. - foreach ($this->after as $after) - { - call_user_func($after); - } - - return count($this->messages->all()) === 0; - } - - /** - * Determine if the data fails the validation rules. - * - * @return bool - */ - public function fails() - { - return ! $this->passes(); - } - - /** - * Validate a given attribute against a rule. - * - * @param string $attribute - * @param string $rule - * @return void - */ - protected function validate($attribute, $rule) - { - list($rule, $parameters) = $this->parseRule($rule); - - if ($rule == '') return; - - // We will get the value for the given attribute from the array of data and then - // verify that the attribute is indeed validatable. Unless the rule implies - // that the attribute is required, rules are not run for missing values. - $value = $this->getValue($attribute); - - $validatable = $this->isValidatable($rule, $attribute, $value); - - $method = "validate{$rule}"; - - if ($validatable && ! $this->$method($attribute, $value, $parameters, $this)) - { - $this->addFailure($attribute, $rule, $parameters); - } - } - - /** - * Returns the data which was valid. - * - * @return array - */ - public function valid() - { - if ( ! $this->messages) $this->passes(); - - return array_diff_key($this->data, $this->messages()->toArray()); - } - - /** - * Returns the data which was invalid. - * - * @return array - */ - public function invalid() - { - if ( ! $this->messages) $this->passes(); - - return array_intersect_key($this->data, $this->messages()->toArray()); - } - - /** - * Get the value of a given attribute. - * - * @param string $attribute - * @return mixed - */ - protected function getValue($attribute) - { - if ( ! is_null($value = array_get($this->data, $attribute))) - { - return $value; - } - elseif ( ! is_null($value = array_get($this->files, $attribute))) - { - return $value; - } - } - - /** - * Determine if the attribute is validatable. - * - * @param string $rule - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function isValidatable($rule, $attribute, $value) - { - return $this->presentOrRuleIsImplicit($rule, $attribute, $value) && +class Validator implements ValidatorContract +{ + /** + * The Translator implementation. + * + * @var \Symfony\Component\Translation\TranslatorInterface + */ + protected $translator; + + /** + * The Presence Verifier implementation. + * + * @var \Illuminate\Validation\PresenceVerifierInterface + */ + protected $presenceVerifier; + + /** + * The container instance. + * + * @var \Illuminate\Contracts\Container\Container + */ + protected $container; + + /** + * The failed validation rules. + * + * @var array + */ + protected $failedRules = []; + + /** + * The message bag instance. + * + * @var \Illuminate\Support\MessageBag + */ + protected $messages; + + /** + * The data under validation. + * + * @var array + */ + protected $data; + + /** + * The files under validation. + * + * @var array + */ + protected $files = []; + + /** + * The rules to be applied to the data. + * + * @var array + */ + protected $rules; + + /** + * All of the registered "after" callbacks. + * + * @var array + */ + protected $after = []; + + /** + * The array of custom error messages. + * + * @var array + */ + protected $customMessages = []; + + /** + * The array of fallback error messages. + * + * @var array + */ + protected $fallbackMessages = []; + + /** + * The array of custom attribute names. + * + * @var array + */ + protected $customAttributes = []; + + /** + * The array of custom displayabled values. + * + * @var array + */ + protected $customValues = []; + + /** + * All of the custom validator extensions. + * + * @var array + */ + protected $extensions = []; + + /** + * All of the custom replacer extensions. + * + * @var array + */ + protected $replacers = []; + + /** + * The size related validation rules. + * + * @var array + */ + protected $sizeRules = ['Size', 'Between', 'Min', 'Max']; + + /** + * The numeric related validation rules. + * + * @var array + */ + protected $numericRules = ['Numeric', 'Integer']; + + /** + * The validation rules that imply the field is required. + * + * @var array + */ + protected $implicitRules = [ + 'Required', 'RequiredWith', 'RequiredWithAll', 'RequiredWithout', 'RequiredWithoutAll', 'RequiredIf', 'RequiredUnless', 'Accepted', + ]; + + /** + * Create a new Validator instance. + * + * @param \Symfony\Component\Translation\TranslatorInterface $translator + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return void + */ + public function __construct(TranslatorInterface $translator, array $data, array $rules, array $messages = [], array $customAttributes = []) + { + $this->translator = $translator; + $this->customMessages = $messages; + $this->data = $this->parseData($data); + $this->rules = $this->explodeRules($rules); + $this->customAttributes = $customAttributes; + } + + /** + * Parse the data and hydrate the files array. + * + * @param array $data + * @param string $arrayKey + * @return array + */ + protected function parseData(array $data, $arrayKey = null) + { + if (is_null($arrayKey)) { + $this->files = []; + } + + foreach ($data as $key => $value) { + $key = ($arrayKey) ? "$arrayKey.$key" : $key; + + // If this value is an instance of the HttpFoundation File class we will + // remove it from the data array and add it to the files array, which + // we use to conveniently separate out these files from other data. + if ($value instanceof File) { + $this->files[$key] = $value; + + unset($data[$key]); + } elseif (is_array($value)) { + $this->parseData($value, $key); + } + } + + return $data; + } + + /** + * Explode the rules into an array of rules. + * + * @param string|array $rules + * @return array + */ + protected function explodeRules($rules) + { + foreach ($rules as $key => &$rule) { + $rule = (is_string($rule)) ? explode('|', $rule) : $rule; + } + + return $rules; + } + + /** + * After an after validation callback. + * + * @param callable|string $callback + * @return $this + */ + public function after($callback) + { + $this->after[] = function () use ($callback) { + return call_user_func_array($callback, [$this]); + }; + + return $this; + } + + /** + * Add conditions to a given field based on a Closure. + * + * @param string $attribute + * @param string|array $rules + * @param callable $callback + * @return void + */ + public function sometimes($attribute, $rules, callable $callback) + { + $payload = new Fluent(array_merge($this->data, $this->files)); + + if (call_user_func($callback, $payload)) { + foreach ((array) $attribute as $key) { + $this->mergeRules($key, $rules); + } + } + } + + /** + * Define a set of rules that apply to each element in an array attribute. + * + * @param string $attribute + * @param string|array $rules + * @return void + * + * @throws \InvalidArgumentException + */ + public function each($attribute, $rules) + { + $data = Arr::get($this->data, $attribute); + + if (! is_array($data)) { + if ($this->hasRule($attribute, 'Array')) { + return; + } + + throw new InvalidArgumentException('Attribute for each() must be an array.'); + } + + foreach ($data as $dataKey => $dataValue) { + foreach ((array) $rules as $ruleKey => $ruleValue) { + if (! is_string($ruleKey)) { + $this->mergeRules("$attribute.$dataKey", $ruleValue); + } else { + $this->mergeRules("$attribute.$dataKey.$ruleKey", $ruleValue); + } + } + } + } + + /** + * Merge additional rules into a given attribute. + * + * @param string $attribute + * @param string|array $rules + * @return void + */ + public function mergeRules($attribute, $rules) + { + $current = isset($this->rules[$attribute]) ? $this->rules[$attribute] : []; + + $merge = head($this->explodeRules([$rules])); + + $this->rules[$attribute] = array_merge($current, $merge); + } + + /** + * Determine if the data passes the validation rules. + * + * @return bool + */ + public function passes() + { + $this->messages = new MessageBag; + + // We'll spin through each rule, validating the attributes attached to that + // rule. Any error messages will be added to the containers with each of + // the other error messages, returning true if we don't have messages. + foreach ($this->rules as $attribute => $rules) { + foreach ($rules as $rule) { + $this->validate($attribute, $rule); + } + } + + // Here we will spin through all of the "after" hooks on this validator and + // fire them off. This gives the callbacks a chance to perform all kinds + // of other validation that needs to get wrapped up in this operation. + foreach ($this->after as $after) { + call_user_func($after); + } + + return count($this->messages->all()) === 0; + } + + /** + * Determine if the data fails the validation rules. + * + * @return bool + */ + public function fails() + { + return ! $this->passes(); + } + + /** + * Validate a given attribute against a rule. + * + * @param string $attribute + * @param string $rule + * @return void + */ + protected function validate($attribute, $rule) + { + list($rule, $parameters) = $this->parseRule($rule); + + if ($rule == '') { + return; + } + + // We will get the value for the given attribute from the array of data and then + // verify that the attribute is indeed validatable. Unless the rule implies + // that the attribute is required, rules are not run for missing values. + $value = $this->getValue($attribute); + + $validatable = $this->isValidatable($rule, $attribute, $value); + + $method = "validate{$rule}"; + + if ($validatable && ! $this->$method($attribute, $value, $parameters, $this)) { + $this->addFailure($attribute, $rule, $parameters); + } + } + + /** + * Returns the data which was valid. + * + * @return array + */ + public function valid() + { + if (! $this->messages) { + $this->passes(); + } + + return array_diff_key($this->data, $this->messages()->toArray()); + } + + /** + * Returns the data which was invalid. + * + * @return array + */ + public function invalid() + { + if (! $this->messages) { + $this->passes(); + } + + return array_intersect_key($this->data, $this->messages()->toArray()); + } + + /** + * Get the value of a given attribute. + * + * @param string $attribute + * @return mixed + */ + protected function getValue($attribute) + { + if (! is_null($value = Arr::get($this->data, $attribute))) { + return $value; + } elseif (! is_null($value = Arr::get($this->files, $attribute))) { + return $value; + } + } + + /** + * Determine if the attribute is validatable. + * + * @param string $rule + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function isValidatable($rule, $attribute, $value) + { + return $this->presentOrRuleIsImplicit($rule, $attribute, $value) && $this->passesOptionalCheck($attribute) && $this->hasNotFailedPreviousRuleIfPresenceRule($rule, $attribute); - } - - /** - * Determine if the field is present, or the rule implies required. - * - * @param string $rule - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function presentOrRuleIsImplicit($rule, $attribute, $value) - { - return $this->validateRequired($attribute, $value) || $this->isImplicit($rule); - } - - /** - * Determine if the attribute passes any optional check. - * - * @param string $attribute - * @return bool - */ - protected function passesOptionalCheck($attribute) - { - if ($this->hasRule($attribute, array('Sometimes'))) - { - return array_key_exists($attribute, array_dot($this->data)) - || in_array($attribute, array_keys($this->data)) - || array_key_exists($attribute, $this->files); - } - - return true; - } - - /** - * Determine if a given rule implies the attribute is required. - * - * @param string $rule - * @return bool - */ - protected function isImplicit($rule) - { - return in_array($rule, $this->implicitRules); - } - - /** - * Determine if it's a necessary presence validation. - * - * This is to avoid possible database type comparison errors. - * - * @param string $rule - * @param string $attribute - * @return bool - */ - protected function hasNotFailedPreviousRuleIfPresenceRule($rule, $attribute) - { - return in_array($rule, ['Unique', 'Exists']) - ? ! $this->messages->has($attribute) : true; - } - - /** - * Add a failed rule and error message to the collection. - * - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return void - */ - protected function addFailure($attribute, $rule, $parameters) - { - $this->addError($attribute, $rule, $parameters); - - $this->failedRules[$attribute][$rule] = $parameters; - } - - /** - * Add an error message to the validator's collection of messages. - * - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return void - */ - protected function addError($attribute, $rule, $parameters) - { - $message = $this->getMessage($attribute, $rule); - - $message = $this->doReplacements($message, $attribute, $rule, $parameters); - - $this->messages->add($attribute, $message); - } - - /** - * "Validate" optional attributes. - * - * Always returns true, just lets us put sometimes in rules. - * - * @return bool - */ - protected function validateSometimes() - { - return true; - } - - /** - * Validate that a required attribute exists. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateRequired($attribute, $value) - { - if (is_null($value)) - { - return false; - } - elseif (is_string($value) && trim($value) === '') - { - return false; - } - elseif ((is_array($value) || $value instanceof Countable) && count($value) < 1) - { - return false; - } - elseif ($value instanceof File) - { - return (string) $value->getPath() != ''; - } - - return true; - } - - /** - * Validate the given attribute is filled if it is present. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateFilled($attribute, $value) - { - if (array_key_exists($attribute, $this->data) || array_key_exists($attribute, $this->files)) - { - return $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Determine if any of the given attributes fail the required test. - * - * @param array $attributes - * @return bool - */ - protected function anyFailingRequired(array $attributes) - { - foreach ($attributes as $key) - { - if ( ! $this->validateRequired($key, $this->getValue($key))) - { - return true; - } - } - - return false; - } - - /** - * Determine if all of the given attributes fail the required test. - * - * @param array $attributes - * @return bool - */ - protected function allFailingRequired(array $attributes) - { - foreach ($attributes as $key) - { - if ($this->validateRequired($key, $this->getValue($key))) - { - return false; - } - } - - return true; - } - - /** - * Validate that an attribute exists when any other attribute exists. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - protected function validateRequiredWith($attribute, $value, $parameters) - { - if ( ! $this->allFailingRequired($parameters)) - { - return $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Validate that an attribute exists when all other attributes exists. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - protected function validateRequiredWithAll($attribute, $value, $parameters) - { - if ( ! $this->anyFailingRequired($parameters)) - { - return $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Validate that an attribute exists when another attribute does not. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - protected function validateRequiredWithout($attribute, $value, $parameters) - { - if ($this->anyFailingRequired($parameters)) - { - return $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Validate that an attribute exists when all other attributes do not. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - protected function validateRequiredWithoutAll($attribute, $value, $parameters) - { - if ($this->allFailingRequired($parameters)) - { - return $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Validate that an attribute exists when another attribute has a given value. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - protected function validateRequiredIf($attribute, $value, $parameters) - { - $this->requireParameterCount(2, $parameters, 'required_if'); - - $data = array_get($this->data, $parameters[0]); - - $values = array_slice($parameters, 1); - - if (in_array($data, $values)) - { - return $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Get the number of attributes in a list that are present. - * - * @param array $attributes - * @return int - */ - protected function getPresentCount($attributes) - { - $count = 0; - - foreach ($attributes as $key) - { - if (array_get($this->data, $key) || array_get($this->files, $key)) - { - $count++; - } - } - - return $count; - } - - /** - * Validate that an attribute has a matching confirmation. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateConfirmed($attribute, $value) - { - return $this->validateSame($attribute, $value, array($attribute.'_confirmation')); - } - - /** - * Validate that two attributes match. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateSame($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'same'); - - $other = array_get($this->data, $parameters[0]); - - return isset($other) && $value == $other; - } - - /** - * Validate that an attribute is different from another attribute. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateDifferent($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'different'); - - $other = array_get($this->data, $parameters[0]); - - return isset($other) && $value != $other; - } - - /** - * Validate that an attribute was "accepted". - * - * This validation rule implies the attribute is "required". - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateAccepted($attribute, $value) - { - $acceptable = array('yes', 'on', '1', 1, true, 'true'); - - return $this->validateRequired($attribute, $value) && in_array($value, $acceptable, true); - } - - /** - * Validate that an attribute is an array. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateArray($attribute, $value) - { - return is_array($value); - } - - /** - * Validate that an attribute is a boolean. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateBoolean($attribute, $value) - { - $acceptable = array(true, false, 0, 1, '0', '1'); - - return in_array($value, $acceptable, true); - } - - /** - * Validate that an attribute is an integer. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateInteger($attribute, $value) - { - return filter_var($value, FILTER_VALIDATE_INT) !== false; - } - - /** - * Validate that an attribute is numeric. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateNumeric($attribute, $value) - { - return is_numeric($value); - } - - /** - * Validate that an attribute is a string. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateString($attribute, $value) - { - return is_string($value); - } - - /** - * Validate that an attribute has a given number of digits. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateDigits($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'digits'); - - return $this->validateNumeric($attribute, $value) - && strlen((string) $value) == $parameters[0]; - } - - /** - * Validate that an attribute is between a given number of digits. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateDigitsBetween($attribute, $value, $parameters) - { - $this->requireParameterCount(2, $parameters, 'digits_between'); - - $length = strlen((string) $value); - - return $this->validateNumeric($attribute, $value) - && $length >= $parameters[0] && $length <= $parameters[1]; - } - - /** - * Validate the size of an attribute. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateSize($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'size'); - - return $this->getSize($attribute, $value) == $parameters[0]; - } - - /** - * Validate the size of an attribute is between a set of values. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateBetween($attribute, $value, $parameters) - { - $this->requireParameterCount(2, $parameters, 'between'); - - $size = $this->getSize($attribute, $value); - - return $size >= $parameters[0] && $size <= $parameters[1]; - } - - /** - * Validate the size of an attribute is greater than a minimum value. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateMin($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'min'); - - return $this->getSize($attribute, $value) >= $parameters[0]; - } - - /** - * Validate the size of an attribute is less than a maximum value. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateMax($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'max'); - - if ($value instanceof UploadedFile && ! $value->isValid()) return false; - - return $this->getSize($attribute, $value) <= $parameters[0]; - } - - /** - * Get the size of an attribute. - * - * @param string $attribute - * @param mixed $value - * @return mixed - */ - protected function getSize($attribute, $value) - { - $hasNumeric = $this->hasRule($attribute, $this->numericRules); - - // This method will determine if the attribute is a number, string, or file and - // return the proper size accordingly. If it is a number, then number itself - // is the size. If it is a file, we take kilobytes, and for a string the - // entire length of the string will be considered the attribute size. - if (is_numeric($value) && $hasNumeric) - { - return array_get($this->data, $attribute); - } - elseif (is_array($value)) - { - return count($value); - } - elseif ($value instanceof File) - { - return $value->getSize() / 1024; - } - - return mb_strlen($value); - } - - /** - * Validate an attribute is contained within a list of values. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateIn($attribute, $value, $parameters) - { - return in_array((string) $value, $parameters); - } - - /** - * Validate an attribute is not contained within a list of values. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateNotIn($attribute, $value, $parameters) - { - return ! $this->validateIn($attribute, $value, $parameters); - } - - /** - * Validate the uniqueness of an attribute value on a given database table. - * - * If a database column is not specified, the attribute will be used. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateUnique($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'unique'); - - $table = $parameters[0]; - - // The second parameter position holds the name of the column that needs to - // be verified as unique. If this parameter isn't specified we will just - // assume that this column to be verified shares the attribute's name. - $column = isset($parameters[1]) ? $parameters[1] : $attribute; - - list($idColumn, $id) = array(null, null); - - if (isset($parameters[2])) - { - list($idColumn, $id) = $this->getUniqueIds($parameters); - - if (strtolower($id) == 'null') $id = null; - } - - // The presence verifier is responsible for counting rows within this store - // mechanism which might be a relational database or any other permanent - // data store like Redis, etc. We will use it to determine uniqueness. - $verifier = $this->getPresenceVerifier(); - - $extra = $this->getUniqueExtra($parameters); - - return $verifier->getCount( - - $table, $column, $value, $id, $idColumn, $extra - - ) == 0; - } - - /** - * Get the excluded ID column and value for the unique rule. - * - * @param array $parameters - * @return array - */ - protected function getUniqueIds($parameters) - { - $idColumn = isset($parameters[3]) ? $parameters[3] : 'id'; - - return array($idColumn, $parameters[2]); - } - - /** - * Get the extra conditions for a unique rule. - * - * @param array $parameters - * @return array - */ - protected function getUniqueExtra($parameters) - { - if (isset($parameters[4])) - { - return $this->getExtraConditions(array_slice($parameters, 4)); - } - - return array(); - } - - /** - * Validate the existence of an attribute value in a database table. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateExists($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'exists'); - - $table = $parameters[0]; - - // The second parameter position holds the name of the column that should be - // verified as existing. If this parameter is not specified we will guess - // that the columns being "verified" shares the given attribute's name. - $column = isset($parameters[1]) ? $parameters[1] : $attribute; - - $expected = (is_array($value)) ? count($value) : 1; - - return $this->getExistCount($table, $column, $value, $parameters) >= $expected; - } - - /** - * Get the number of records that exist in storage. - * - * @param string $table - * @param string $column - * @param mixed $value - * @param array $parameters - * @return int - */ - protected function getExistCount($table, $column, $value, $parameters) - { - $verifier = $this->getPresenceVerifier(); - - $extra = $this->getExtraExistConditions($parameters); - - if (is_array($value)) - { - return $verifier->getMultiCount($table, $column, $value, $extra); - } - - return $verifier->getCount($table, $column, $value, null, null, $extra); - } - - /** - * Get the extra exist conditions. - * - * @param array $parameters - * @return array - */ - protected function getExtraExistConditions(array $parameters) - { - return $this->getExtraConditions(array_values(array_slice($parameters, 2))); - } - - /** - * Get the extra conditions for a unique / exists rule. - * - * @param array $segments - * @return array - */ - protected function getExtraConditions(array $segments) - { - $extra = array(); - - $count = count($segments); - - for ($i = 0; $i < $count; $i = $i + 2) - { - $extra[$segments[$i]] = $segments[$i + 1]; - } - - return $extra; - } - - /** - * Validate that an attribute is a valid IP. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateIp($attribute, $value) - { - return filter_var($value, FILTER_VALIDATE_IP) !== false; - } - - /** - * Validate that an attribute is a valid e-mail address. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateEmail($attribute, $value) - { - return filter_var($value, FILTER_VALIDATE_EMAIL) !== false; - } - - /** - * Validate that an attribute is a valid URL. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateUrl($attribute, $value) - { - return filter_var($value, FILTER_VALIDATE_URL) !== false; - } - - /** - * Validate that an attribute is an active URL. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateActiveUrl($attribute, $value) - { - $url = str_replace(array('http://', 'https://', 'ftp://'), '', strtolower($value)); - - return checkdnsrr($url, 'A'); - } - - /** - * Validate the MIME type of a file is an image MIME type. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateImage($attribute, $value) - { - return $this->validateMimes($attribute, $value, array('jpeg', 'png', 'gif', 'bmp', 'svg')); - } - - /** - * Validate the MIME type of a file upload attribute is in a set of MIME types. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateMimes($attribute, $value, $parameters) - { - if ( ! $this->isAValidFileInstance($value)) - { - return false; - } - - return $value->getPath() != '' && in_array($value->guessExtension(), $parameters); - } - - /** - * Check that the given value is a valid file instance. - * - * @param mixed $value - * @return bool - */ - protected function isAValidFileInstance($value) - { - if ($value instanceof UploadedFile && ! $value->isValid()) return false; - - return $value instanceof File; - } - - /** - * Validate that an attribute contains only alphabetic characters. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateAlpha($attribute, $value) - { - return preg_match('/^[\pL\pM]+$/u', $value); - } - - /** - * Validate that an attribute contains only alpha-numeric characters. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateAlphaNum($attribute, $value) - { - return preg_match('/^[\pL\pM\pN]+$/u', $value); - } - - /** - * Validate that an attribute contains only alpha-numeric characters, dashes, and underscores. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateAlphaDash($attribute, $value) - { - return preg_match('/^[\pL\pM\pN_-]+$/u', $value); - } - - /** - * Validate that an attribute passes a regular expression check. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateRegex($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'regex'); - - return preg_match($parameters[0], $value); - } - - /** - * Validate that an attribute is a valid date. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateDate($attribute, $value) - { - if ($value instanceof DateTime) return true; - - if (strtotime($value) === false) return false; - - $date = date_parse($value); - - return checkdate($date['month'], $date['day'], $date['year']); - } - - /** - * Validate that an attribute matches a date format. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateDateFormat($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'date_format'); - - $parsed = date_parse_from_format($parameters[0], $value); - - return $parsed['error_count'] === 0 && $parsed['warning_count'] === 0; - } - - /** - * Validate the date is before a given date. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateBefore($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'before'); - - if ($format = $this->getDateFormat($attribute)) - { - return $this->validateBeforeWithFormat($format, $value, $parameters); - } - - if ( ! ($date = strtotime($parameters[0]))) - { - return strtotime($value) < strtotime($this->getValue($parameters[0])); - } - - return strtotime($value) < $date; - } - - /** - * Validate the date is before a given date with a given format. - * - * @param string $format - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateBeforeWithFormat($format, $value, $parameters) - { - $param = $this->getValue($parameters[0]) ?: $parameters[0]; - - return $this->checkDateTimeOrder($format, $value, $param); - } - - /** - * Validate the date is after a given date. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateAfter($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'after'); - - if ($format = $this->getDateFormat($attribute)) - { - return $this->validateAfterWithFormat($format, $value, $parameters); - } - - if ( ! ($date = strtotime($parameters[0]))) - { - return strtotime($value) > strtotime($this->getValue($parameters[0])); - } - - return strtotime($value) > $date; - } - - /** - * Validate the date is after a given date with a given format. - * - * @param string $format - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateAfterWithFormat($format, $value, $parameters) - { - $param = $this->getValue($parameters[0]) ?: $parameters[0]; - - return $this->checkDateTimeOrder($format, $param, $value); - } - - /** - * Given two date/time strings, check that one is after the other. - * - * @param string $format - * @param string $before - * @param string $after - * @return bool - */ - protected function checkDateTimeOrder($format, $before, $after) - { - $before = $this->getDateTimeWithOptionalFormat($format, $before); - - $after = $this->getDateTimeWithOptionalFormat($format, $after); - - return ($before && $after) && ($after > $before); - } - - /** - * Get a DateTime instance from a string. - * - * @param string $format - * @param string $value - * @return \DateTime|null - */ - protected function getDateTimeWithOptionalFormat($format, $value) - { - $date = DateTime::createFromFormat($format, $value); - - if ($date) return $date; - - try - { - return new DateTime($value); - } - catch (Exception $e) - { - return; - } - } - - /** - * Validate that an attribute is a valid timezone. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function validateTimezone($attribute, $value) - { - try - { - new DateTimeZone($value); - } - catch (Exception $e) - { - return false; - } - - return true; - } - - /** - * Get the date format for an attribute if it has one. - * - * @param string $attribute - * @return string|null - */ - protected function getDateFormat($attribute) - { - if ($result = $this->getRule($attribute, 'DateFormat')) - { - return $result[1][0]; - } - } - - /** - * Get the validation message for an attribute and rule. - * - * @param string $attribute - * @param string $rule - * @return string - */ - protected function getMessage($attribute, $rule) - { - $lowerRule = snake_case($rule); - - $inlineMessage = $this->getInlineMessage($attribute, $lowerRule); - - // First we will retrieve the custom message for the validation rule if one - // exists. If a custom validation message is being used we'll return the - // custom message, otherwise we'll keep searching for a valid message. - if ( ! is_null($inlineMessage)) - { - return $inlineMessage; - } - - $customKey = "validation.custom.{$attribute}.{$lowerRule}"; - - $customMessage = $this->translator->trans($customKey); - - // First we check for a custom defined validation message for the attribute - // and rule. This allows the developer to specify specific messages for - // only some attributes and rules that need to get specially formed. - if ($customMessage !== $customKey) - { - return $customMessage; - } - - // If the rule being validated is a "size" rule, we will need to gather the - // specific error message for the type of attribute being validated such - // as a number, file or string which all have different message types. - elseif (in_array($rule, $this->sizeRules)) - { - return $this->getSizeMessage($attribute, $rule); - } - - // Finally, if no developer specified messages have been set, and no other - // special messages apply for this rule, we will just pull the default - // messages out of the translator service for this validation rule. - $key = "validation.{$lowerRule}"; - - if ($key != ($value = $this->translator->trans($key))) - { - return $value; - } - - return $this->getInlineMessage( - $attribute, $lowerRule, $this->fallbackMessages - ) ?: $key; - } - - /** - * Get the inline message for a rule if it exists. - * - * @param string $attribute - * @param string $lowerRule - * @param array $source - * @return string - */ - protected function getInlineMessage($attribute, $lowerRule, $source = null) - { - $source = $source ?: $this->customMessages; - - $keys = array("{$attribute}.{$lowerRule}", $lowerRule); - - // First we will check for a custom message for an attribute specific rule - // message for the fields, then we will check for a general custom line - // that is not attribute specific. If we find either we'll return it. - foreach ($keys as $key) - { - if (isset($source[$key])) return $source[$key]; - } - } - - /** - * Get the proper error message for an attribute and size rule. - * - * @param string $attribute - * @param string $rule - * @return string - */ - protected function getSizeMessage($attribute, $rule) - { - $lowerRule = snake_case($rule); - - // There are three different types of size validations. The attribute may be - // either a number, file, or string so we will check a few things to know - // which type of value it is and return the correct line for that type. - $type = $this->getAttributeType($attribute); - - $key = "validation.{$lowerRule}.{$type}"; - - return $this->translator->trans($key); - } - - /** - * Get the data type of the given attribute. - * - * @param string $attribute - * @return string - */ - protected function getAttributeType($attribute) - { - // We assume that the attributes present in the file array are files so that - // means that if the attribute does not have a numeric rule and the files - // list doesn't have it we'll just consider it a string by elimination. - if ($this->hasRule($attribute, $this->numericRules)) - { - return 'numeric'; - } - elseif ($this->hasRule($attribute, array('Array'))) - { - return 'array'; - } - elseif (array_key_exists($attribute, $this->files)) - { - return 'file'; - } - - return 'string'; - } - - /** - * Replace all error message place-holders with actual values. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function doReplacements($message, $attribute, $rule, $parameters) - { - $message = str_replace(':attribute', $this->getAttribute($attribute), $message); - - if (isset($this->replacers[snake_case($rule)])) - { - $message = $this->callReplacer($message, $attribute, snake_case($rule), $parameters); - } - elseif (method_exists($this, $replacer = "replace{$rule}")) - { - $message = $this->$replacer($message, $attribute, $rule, $parameters); - } - - return $message; - } - - /** - * Transform an array of attributes to their displayable form. - * - * @param array $values - * @return array - */ - protected function getAttributeList(array $values) - { - $attributes = array(); - - // For each attribute in the list we will simply get its displayable form as - // this is convenient when replacing lists of parameters like some of the - // replacement functions do when formatting out the validation message. - foreach ($values as $key => $value) - { - $attributes[$key] = $this->getAttribute($value); - } - - return $attributes; - } - - /** - * Get the displayable name of the attribute. - * - * @param string $attribute - * @return string - */ - protected function getAttribute($attribute) - { - // The developer may dynamically specify the array of custom attributes - // on this Validator instance. If the attribute exists in this array - // it takes precedence over all other ways we can pull attributes. - if (isset($this->customAttributes[$attribute])) - { - return $this->customAttributes[$attribute]; - } - - $key = "validation.attributes.{$attribute}"; - - // We allow for the developer to specify language lines for each of the - // attributes allowing for more displayable counterparts of each of - // the attributes. This provides the ability for simple formats. - if (($line = $this->translator->trans($key)) !== $key) - { - return $line; - } - - // If no language line has been specified for the attribute all of the - // underscores are removed from the attribute name and that will be - // used as default versions of the attribute's displayable names. - return str_replace('_', ' ', snake_case($attribute)); - } - - /** - * Get the displayable name of the value. - * - * @param string $attribute - * @param mixed $value - * @return string - */ - public function getDisplayableValue($attribute, $value) - { - if (isset($this->customValues[$attribute][$value])) - { - return $this->customValues[$attribute][$value]; - } - - $key = "validation.values.{$attribute}.{$value}"; - - if (($line = $this->translator->trans($key)) !== $key) - { - return $line; - } - - return $value; - } - - /** - * Replace all place-holders for the between rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceBetween($message, $attribute, $rule, $parameters) - { - return str_replace(array(':min', ':max'), $parameters, $message); - } - - /** - * Replace all place-holders for the digits rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceDigits($message, $attribute, $rule, $parameters) - { - return str_replace(':digits', $parameters[0], $message); - } - - /** - * Replace all place-holders for the digits (between) rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceDigitsBetween($message, $attribute, $rule, $parameters) - { - return $this->replaceBetween($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the size rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceSize($message, $attribute, $rule, $parameters) - { - return str_replace(':size', $parameters[0], $message); - } - - /** - * Replace all place-holders for the min rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceMin($message, $attribute, $rule, $parameters) - { - return str_replace(':min', $parameters[0], $message); - } - - /** - * Replace all place-holders for the max rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceMax($message, $attribute, $rule, $parameters) - { - return str_replace(':max', $parameters[0], $message); - } - - /** - * Replace all place-holders for the in rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceIn($message, $attribute, $rule, $parameters) - { - foreach ($parameters as &$parameter) - { - $parameter = $this->getDisplayableValue($attribute, $parameter); - } - - return str_replace(':values', implode(', ', $parameters), $message); - } - - /** - * Replace all place-holders for the not_in rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceNotIn($message, $attribute, $rule, $parameters) - { - return $this->replaceIn($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the mimes rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceMimes($message, $attribute, $rule, $parameters) - { - return str_replace(':values', implode(', ', $parameters), $message); - } - - /** - * Replace all place-holders for the required_with rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceRequiredWith($message, $attribute, $rule, $parameters) - { - $parameters = $this->getAttributeList($parameters); - - return str_replace(':values', implode(' / ', $parameters), $message); - } - - /** - * Replace all place-holders for the required_with_all rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceRequiredWithAll($message, $attribute, $rule, $parameters) - { - return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the required_without rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceRequiredWithout($message, $attribute, $rule, $parameters) - { - return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the required_without_all rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceRequiredWithoutAll($message, $attribute, $rule, $parameters) - { - return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the required_if rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceRequiredIf($message, $attribute, $rule, $parameters) - { - $parameters[1] = $this->getDisplayableValue($parameters[0], array_get($this->data, $parameters[0])); - - $parameters[0] = $this->getAttribute($parameters[0]); - - return str_replace(array(':other', ':value'), $parameters, $message); - } - - /** - * Replace all place-holders for the same rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceSame($message, $attribute, $rule, $parameters) - { - return str_replace(':other', $this->getAttribute($parameters[0]), $message); - } - - /** - * Replace all place-holders for the different rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceDifferent($message, $attribute, $rule, $parameters) - { - return $this->replaceSame($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the date_format rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceDateFormat($message, $attribute, $rule, $parameters) - { - return str_replace(':format', $parameters[0], $message); - } - - /** - * Replace all place-holders for the before rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceBefore($message, $attribute, $rule, $parameters) - { - if ( ! (strtotime($parameters[0]))) - { - return str_replace(':date', $this->getAttribute($parameters[0]), $message); - } - - return str_replace(':date', $parameters[0], $message); - } - - /** - * Replace all place-holders for the after rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceAfter($message, $attribute, $rule, $parameters) - { - return $this->replaceBefore($message, $attribute, $rule, $parameters); - } - - /** - * Determine if the given attribute has a rule in the given set. - * - * @param string $attribute - * @param string|array $rules - * @return bool - */ - protected function hasRule($attribute, $rules) - { - return ! is_null($this->getRule($attribute, $rules)); - } - - /** - * Get a rule and its parameters for a given attribute. - * - * @param string $attribute - * @param string|array $rules - * @return array|null - */ - protected function getRule($attribute, $rules) - { - if ( ! array_key_exists($attribute, $this->rules)) - { - return; - } - - $rules = (array) $rules; - - foreach ($this->rules[$attribute] as $rule) - { - list($rule, $parameters) = $this->parseRule($rule); - - if (in_array($rule, $rules)) return [$rule, $parameters]; - } - } - - /** - * Extract the rule name and parameters from a rule. - * - * @param array|string $rules - * @return array - */ - protected function parseRule($rules) - { - if (is_array($rules)) - { - return $this->parseArrayRule($rules); - } - - return $this->parseStringRule($rules); - } - - /** - * Parse an array based rule. - * - * @param array $rules - * @return array - */ - protected function parseArrayRule(array $rules) - { - return array(studly_case(trim(array_get($rules, 0))), array_slice($rules, 1)); - } - - /** - * Parse a string based rule. - * - * @param string $rules - * @return array - */ - protected function parseStringRule($rules) - { - $parameters = []; - - // The format for specifying validation rules and parameters follows an - // easy {rule}:{parameters} formatting convention. For instance the - // rule "Max:3" states that the value may only be three letters. - if (strpos($rules, ':') !== false) - { - list($rules, $parameter) = explode(':', $rules, 2); - - $parameters = $this->parseParameters($rules, $parameter); - } - - return array(studly_case(trim($rules)), $parameters); - } - - /** - * Parse a parameter list. - * - * @param string $rule - * @param string $parameter - * @return array - */ - protected function parseParameters($rule, $parameter) - { - if (strtolower($rule) == 'regex') return array($parameter); - - return str_getcsv($parameter); - } - - /** - * Get the array of custom validator extensions. - * - * @return array - */ - public function getExtensions() - { - return $this->extensions; - } - - /** - * Register an array of custom validator extensions. - * - * @param array $extensions - * @return void - */ - public function addExtensions(array $extensions) - { - if ($extensions) - { - $keys = array_map('snake_case', array_keys($extensions)); - - $extensions = array_combine($keys, array_values($extensions)); - } - - $this->extensions = array_merge($this->extensions, $extensions); - } - - /** - * Register an array of custom implicit validator extensions. - * - * @param array $extensions - * @return void - */ - public function addImplicitExtensions(array $extensions) - { - $this->addExtensions($extensions); - - foreach ($extensions as $rule => $extension) - { - $this->implicitRules[] = studly_case($rule); - } - } - - /** - * Register a custom validator extension. - * - * @param string $rule - * @param \Closure|string $extension - * @return void - */ - public function addExtension($rule, $extension) - { - $this->extensions[snake_case($rule)] = $extension; - } - - /** - * Register a custom implicit validator extension. - * - * @param string $rule - * @param \Closure|string $extension - * @return void - */ - public function addImplicitExtension($rule, $extension) - { - $this->addExtension($rule, $extension); - - $this->implicitRules[] = studly_case($rule); - } - - /** - * Get the array of custom validator message replacers. - * - * @return array - */ - public function getReplacers() - { - return $this->replacers; - } - - /** - * Register an array of custom validator message replacers. - * - * @param array $replacers - * @return void - */ - public function addReplacers(array $replacers) - { - if ($replacers) - { - $keys = array_map('snake_case', array_keys($replacers)); - - $replacers = array_combine($keys, array_values($replacers)); - } - - $this->replacers = array_merge($this->replacers, $replacers); - } - - /** - * Register a custom validator message replacer. - * - * @param string $rule - * @param \Closure|string $replacer - * @return void - */ - public function addReplacer($rule, $replacer) - { - $this->replacers[snake_case($rule)] = $replacer; - } - - /** - * Get the data under validation. - * - * @return array - */ - public function getData() - { - return $this->data; - } - - /** - * Set the data under validation. - * - * @param array $data - * @return void - */ - public function setData(array $data) - { - $this->data = $this->parseData($data); - } - - /** - * Get the validation rules. - * - * @return array - */ - public function getRules() - { - return $this->rules; - } - - /** - * Set the validation rules. - * - * @param array $rules - * @return $this - */ - public function setRules(array $rules) - { - $this->rules = $this->explodeRules($rules); - - return $this; - } - - /** - * Set the custom attributes on the validator. - * - * @param array $attributes - * @return $this - */ - public function setAttributeNames(array $attributes) - { - $this->customAttributes = $attributes; - - return $this; - } - - /** - * Set the custom values on the validator. - * - * @param array $values - * @return $this - */ - public function setValueNames(array $values) - { - $this->customValues = $values; - - return $this; - } - - /** - * Get the files under validation. - * - * @return array - */ - public function getFiles() - { - return $this->files; - } - - /** - * Set the files under validation. - * - * @param array $files - * @return $this - */ - public function setFiles(array $files) - { - $this->files = $files; - - return $this; - } - - /** - * Get the Presence Verifier implementation. - * - * @return \Illuminate\Validation\PresenceVerifierInterface - * - * @throws \RuntimeException - */ - public function getPresenceVerifier() - { - if ( ! isset($this->presenceVerifier)) - { - throw new RuntimeException("Presence verifier has not been set."); - } - - return $this->presenceVerifier; - } - - /** - * Set the Presence Verifier implementation. - * - * @param \Illuminate\Validation\PresenceVerifierInterface $presenceVerifier - * @return void - */ - public function setPresenceVerifier(PresenceVerifierInterface $presenceVerifier) - { - $this->presenceVerifier = $presenceVerifier; - } - - /** - * Get the Translator implementation. - * - * @return \Symfony\Component\Translation\TranslatorInterface - */ - public function getTranslator() - { - return $this->translator; - } - - /** - * Set the Translator implementation. - * - * @param \Symfony\Component\Translation\TranslatorInterface $translator - * @return void - */ - public function setTranslator(TranslatorInterface $translator) - { - $this->translator = $translator; - } - - /** - * Get the custom messages for the validator. - * - * @return array - */ - public function getCustomMessages() - { - return $this->customMessages; - } - - /** - * Set the custom messages for the validator. - * - * @param array $messages - * @return void - */ - public function setCustomMessages(array $messages) - { - $this->customMessages = array_merge($this->customMessages, $messages); - } - - /** - * Get the custom attributes used by the validator. - * - * @return array - */ - public function getCustomAttributes() - { - return $this->customAttributes; - } - - /** - * Add custom attributes to the validator. - * - * @param array $customAttributes - * @return $this - */ - public function addCustomAttributes(array $customAttributes) - { - $this->customAttributes = array_merge($this->customAttributes, $customAttributes); - - return $this; - } - - /** - * Get the custom values for the validator. - * - * @return array - */ - public function getCustomValues() - { - return $this->customValues; - } - - /** - * Add the custom values for the validator. - * - * @param array $customValues - * @return $this - */ - public function addCustomValues(array $customValues) - { - $this->customValues = array_merge($this->customValues, $customValues); - - return $this; - } - - /** - * Get the fallback messages for the validator. - * - * @return array - */ - public function getFallbackMessages() - { - return $this->fallbackMessages; - } - - /** - * Set the fallback messages for the validator. - * - * @param array $messages - * @return void - */ - public function setFallbackMessages(array $messages) - { - $this->fallbackMessages = $messages; - } - - /** - * Get the failed validation rules. - * - * @return array - */ - public function failed() - { - return $this->failedRules; - } - - /** - * Get the message container for the validator. - * - * @return \Illuminate\Support\MessageBag - */ - public function messages() - { - if ( ! $this->messages) $this->passes(); - - return $this->messages; - } - - /** - * An alternative more semantic shortcut to the message container. - * - * @return \Illuminate\Support\MessageBag - */ - public function errors() - { - return $this->messages(); - } - - /** - * Get the messages for the instance. - * - * @return \Illuminate\Support\MessageBag - */ - public function getMessageBag() - { - return $this->messages(); - } - - /** - * Set the IoC container instance. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - public function setContainer(Container $container) - { - $this->container = $container; - } - - /** - * Call a custom validator extension. - * - * @param string $rule - * @param array $parameters - * @return bool - */ - protected function callExtension($rule, $parameters) - { - $callback = $this->extensions[$rule]; - - if ($callback instanceof Closure) - { - return call_user_func_array($callback, $parameters); - } - elseif (is_string($callback)) - { - return $this->callClassBasedExtension($callback, $parameters); - } - } - - /** - * Call a class based validator extension. - * - * @param string $callback - * @param array $parameters - * @return bool - */ - protected function callClassBasedExtension($callback, $parameters) - { - list($class, $method) = explode('@', $callback); - - return call_user_func_array(array($this->container->make($class), $method), $parameters); - } - - /** - * Call a custom validator message replacer. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function callReplacer($message, $attribute, $rule, $parameters) - { - $callback = $this->replacers[$rule]; - - if ($callback instanceof Closure) - { - return call_user_func_array($callback, func_get_args()); - } - elseif (is_string($callback)) - { - return $this->callClassBasedReplacer($callback, $message, $attribute, $rule, $parameters); - } - } - - /** - * Call a class based validator message replacer. - * - * @param string $callback - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function callClassBasedReplacer($callback, $message, $attribute, $rule, $parameters) - { - list($class, $method) = explode('@', $callback); - - return call_user_func_array(array($this->container->make($class), $method), array_slice(func_get_args(), 1)); - } - - /** - * Require a certain number of parameters to be present. - * - * @param int $count - * @param array $parameters - * @param string $rule - * @return void - * @throws \InvalidArgumentException - */ - protected function requireParameterCount($count, $parameters, $rule) - { - if (count($parameters) < $count) - { - throw new InvalidArgumentException("Validation rule $rule requires at least $count parameters."); - } - } - - /** - * Handle dynamic calls to class methods. - * - * @param string $method - * @param array $parameters - * @return mixed - * - * @throws \BadMethodCallException - */ - public function __call($method, $parameters) - { - $rule = snake_case(substr($method, 8)); - - if (isset($this->extensions[$rule])) - { - return $this->callExtension($rule, $parameters); - } - - throw new BadMethodCallException("Method [$method] does not exist."); - } - + } + + /** + * Determine if the field is present, or the rule implies required. + * + * @param string $rule + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function presentOrRuleIsImplicit($rule, $attribute, $value) + { + return $this->validateRequired($attribute, $value) || $this->isImplicit($rule); + } + + /** + * Determine if the attribute passes any optional check. + * + * @param string $attribute + * @return bool + */ + protected function passesOptionalCheck($attribute) + { + if ($this->hasRule($attribute, ['Sometimes'])) { + return array_key_exists($attribute, Arr::dot($this->data)) + || in_array($attribute, array_keys($this->data)) + || array_key_exists($attribute, $this->files); + } + + return true; + } + + /** + * Determine if a given rule implies the attribute is required. + * + * @param string $rule + * @return bool + */ + protected function isImplicit($rule) + { + return in_array($rule, $this->implicitRules); + } + + /** + * Determine if it's a necessary presence validation. + * + * This is to avoid possible database type comparison errors. + * + * @param string $rule + * @param string $attribute + * @return bool + */ + protected function hasNotFailedPreviousRuleIfPresenceRule($rule, $attribute) + { + return in_array($rule, ['Unique', 'Exists']) + ? ! $this->messages->has($attribute) : true; + } + + /** + * Add a failed rule and error message to the collection. + * + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return void + */ + protected function addFailure($attribute, $rule, $parameters) + { + $this->addError($attribute, $rule, $parameters); + + $this->failedRules[$attribute][$rule] = $parameters; + } + + /** + * Add an error message to the validator's collection of messages. + * + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return void + */ + protected function addError($attribute, $rule, $parameters) + { + $message = $this->getMessage($attribute, $rule); + + $message = $this->doReplacements($message, $attribute, $rule, $parameters); + + $this->messages->add($attribute, $message); + } + + /** + * "Validate" optional attributes. + * + * Always returns true, just lets us put sometimes in rules. + * + * @return bool + */ + protected function validateSometimes() + { + return true; + } + + /** + * Validate that a required attribute exists. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateRequired($attribute, $value) + { + if (is_null($value)) { + return false; + } elseif (is_string($value) && trim($value) === '') { + return false; + } elseif ((is_array($value) || $value instanceof Countable) && count($value) < 1) { + return false; + } elseif ($value instanceof File) { + return (string) $value->getPath() != ''; + } + + return true; + } + + /** + * Validate the given attribute is filled if it is present. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateFilled($attribute, $value) + { + if (array_key_exists($attribute, $this->data) || array_key_exists($attribute, $this->files)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Determine if any of the given attributes fail the required test. + * + * @param array $attributes + * @return bool + */ + protected function anyFailingRequired(array $attributes) + { + foreach ($attributes as $key) { + if (! $this->validateRequired($key, $this->getValue($key))) { + return true; + } + } + + return false; + } + + /** + * Determine if all of the given attributes fail the required test. + * + * @param array $attributes + * @return bool + */ + protected function allFailingRequired(array $attributes) + { + foreach ($attributes as $key) { + if ($this->validateRequired($key, $this->getValue($key))) { + return false; + } + } + + return true; + } + + /** + * Validate that an attribute exists when any other attribute exists. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + protected function validateRequiredWith($attribute, $value, $parameters) + { + if (! $this->allFailingRequired($parameters)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Validate that an attribute exists when all other attributes exists. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + protected function validateRequiredWithAll($attribute, $value, $parameters) + { + if (! $this->anyFailingRequired($parameters)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Validate that an attribute exists when another attribute does not. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + protected function validateRequiredWithout($attribute, $value, $parameters) + { + if ($this->anyFailingRequired($parameters)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Validate that an attribute exists when all other attributes do not. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + protected function validateRequiredWithoutAll($attribute, $value, $parameters) + { + if ($this->allFailingRequired($parameters)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Validate that an attribute exists when another attribute has a given value. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + protected function validateRequiredIf($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'required_if'); + + $data = Arr::get($this->data, $parameters[0]); + + $values = array_slice($parameters, 1); + + if (in_array($data, $values)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Validate that an attribute exists when another attribute does not have a given value. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + protected function validateRequiredUnless($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'required_unless'); + + $data = Arr::get($this->data, $parameters[0]); + + $values = array_slice($parameters, 1); + + if (! in_array($data, $values)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Get the number of attributes in a list that are present. + * + * @param array $attributes + * @return int + */ + protected function getPresentCount($attributes) + { + $count = 0; + + foreach ($attributes as $key) { + if (Arr::get($this->data, $key) || Arr::get($this->files, $key)) { + $count++; + } + } + + return $count; + } + + /** + * Validate that an attribute has a matching confirmation. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateConfirmed($attribute, $value) + { + return $this->validateSame($attribute, $value, [$attribute.'_confirmation']); + } + + /** + * Validate that two attributes match. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateSame($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'same'); + + $other = Arr::get($this->data, $parameters[0]); + + return isset($other) && $value === $other; + } + + /** + * Validate that an attribute is different from another attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateDifferent($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'different'); + + $other = Arr::get($this->data, $parameters[0]); + + return isset($other) && $value !== $other; + } + + /** + * Validate that an attribute was "accepted". + * + * This validation rule implies the attribute is "required". + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateAccepted($attribute, $value) + { + $acceptable = ['yes', 'on', '1', 1, true, 'true']; + + return $this->validateRequired($attribute, $value) && in_array($value, $acceptable, true); + } + + /** + * Validate that an attribute is an array. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateArray($attribute, $value) + { + return is_array($value); + } + + /** + * Validate that an attribute is a boolean. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateBoolean($attribute, $value) + { + $acceptable = [true, false, 0, 1, '0', '1']; + + return in_array($value, $acceptable, true); + } + + /** + * Validate that an attribute is an integer. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateInteger($attribute, $value) + { + return filter_var($value, FILTER_VALIDATE_INT) !== false; + } + + /** + * Validate that an attribute is numeric. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateNumeric($attribute, $value) + { + return is_numeric($value); + } + + /** + * Validate that an attribute is a string. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateString($attribute, $value) + { + return is_string($value); + } + + /** + * Validate the attribute is a valid JSON string. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateJson($attribute, $value) + { + json_decode($value); + + return json_last_error() === JSON_ERROR_NONE; + } + + /** + * Validate that an attribute has a given number of digits. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateDigits($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'digits'); + + return $this->validateNumeric($attribute, $value) + && strlen((string) $value) == $parameters[0]; + } + + /** + * Validate that an attribute is between a given number of digits. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateDigitsBetween($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'digits_between'); + + $length = strlen((string) $value); + + return $this->validateNumeric($attribute, $value) + && $length >= $parameters[0] && $length <= $parameters[1]; + } + + /** + * Validate the size of an attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateSize($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'size'); + + return $this->getSize($attribute, $value) == $parameters[0]; + } + + /** + * Validate the size of an attribute is between a set of values. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateBetween($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'between'); + + $size = $this->getSize($attribute, $value); + + return $size >= $parameters[0] && $size <= $parameters[1]; + } + + /** + * Validate the size of an attribute is greater than a minimum value. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateMin($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'min'); + + return $this->getSize($attribute, $value) >= $parameters[0]; + } + + /** + * Validate the size of an attribute is less than a maximum value. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateMax($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'max'); + + if ($value instanceof UploadedFile && ! $value->isValid()) { + return false; + } + + return $this->getSize($attribute, $value) <= $parameters[0]; + } + + /** + * Get the size of an attribute. + * + * @param string $attribute + * @param mixed $value + * @return mixed + */ + protected function getSize($attribute, $value) + { + $hasNumeric = $this->hasRule($attribute, $this->numericRules); + + // This method will determine if the attribute is a number, string, or file and + // return the proper size accordingly. If it is a number, then number itself + // is the size. If it is a file, we take kilobytes, and for a string the + // entire length of the string will be considered the attribute size. + if (is_numeric($value) && $hasNumeric) { + return $value; + } elseif (is_array($value)) { + return count($value); + } elseif ($value instanceof File) { + return $value->getSize() / 1024; + } + + return mb_strlen($value); + } + + /** + * Validate an attribute is contained within a list of values. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateIn($attribute, $value, $parameters) + { + if (is_array($value) && $this->hasRule($attribute, 'Array')) { + return count(array_diff($value, $parameters)) == 0; + } + + return ! is_array($value) && in_array((string) $value, $parameters); + } + + /** + * Validate an attribute is not contained within a list of values. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateNotIn($attribute, $value, $parameters) + { + return ! $this->validateIn($attribute, $value, $parameters); + } + + /** + * Validate the uniqueness of an attribute value on a given database table. + * + * If a database column is not specified, the attribute will be used. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateUnique($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'unique'); + + list($connection, $table) = $this->parseTable($parameters[0]); + + // The second parameter position holds the name of the column that needs to + // be verified as unique. If this parameter isn't specified we will just + // assume that this column to be verified shares the attribute's name. + $column = isset($parameters[1]) ? $parameters[1] : $attribute; + + list($idColumn, $id) = [null, null]; + + if (isset($parameters[2])) { + list($idColumn, $id) = $this->getUniqueIds($parameters); + + if (strtolower($id) == 'null') { + $id = null; + } + } + + // The presence verifier is responsible for counting rows within this store + // mechanism which might be a relational database or any other permanent + // data store like Redis, etc. We will use it to determine uniqueness. + $verifier = $this->getPresenceVerifier(); + + if (! is_null($connection)) { + $verifier->setConnection($connection); + } + + $extra = $this->getUniqueExtra($parameters); + + return $verifier->getCount( + $table, $column, $value, $id, $idColumn, $extra + + ) == 0; + } + + /** + * Parse the connection / table for the unique / exists rules. + * + * @param string $table + * @return array + */ + protected function parseTable($table) + { + return Str::contains($table, '.') ? explode('.', $table, 2) : [null, $table]; + } + + /** + * Get the excluded ID column and value for the unique rule. + * + * @param array $parameters + * @return array + */ + protected function getUniqueIds($parameters) + { + $idColumn = isset($parameters[3]) ? $parameters[3] : 'id'; + + return [$idColumn, $parameters[2]]; + } + + /** + * Get the extra conditions for a unique rule. + * + * @param array $parameters + * @return array + */ + protected function getUniqueExtra($parameters) + { + if (isset($parameters[4])) { + return $this->getExtraConditions(array_slice($parameters, 4)); + } + + return []; + } + + /** + * Validate the existence of an attribute value in a database table. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateExists($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'exists'); + + list($connection, $table) = $this->parseTable($parameters[0]); + + // The second parameter position holds the name of the column that should be + // verified as existing. If this parameter is not specified we will guess + // that the columns being "verified" shares the given attribute's name. + $column = isset($parameters[1]) ? $parameters[1] : $attribute; + + $expected = (is_array($value)) ? count($value) : 1; + + return $this->getExistCount($connection, $table, $column, $value, $parameters) >= $expected; + } + + /** + * Get the number of records that exist in storage. + * + * @param mixed $connection + * @param string $table + * @param string $column + * @param mixed $value + * @param array $parameters + * @return int + */ + protected function getExistCount($connection, $table, $column, $value, $parameters) + { + $verifier = $this->getPresenceVerifier(); + + if (! is_null($connection)) { + $verifier->setConnection($connection); + } + + $extra = $this->getExtraExistConditions($parameters); + + if (is_array($value)) { + return $verifier->getMultiCount($table, $column, $value, $extra); + } + + return $verifier->getCount($table, $column, $value, null, null, $extra); + } + + /** + * Get the extra exist conditions. + * + * @param array $parameters + * @return array + */ + protected function getExtraExistConditions(array $parameters) + { + return $this->getExtraConditions(array_values(array_slice($parameters, 2))); + } + + /** + * Get the extra conditions for a unique / exists rule. + * + * @param array $segments + * @return array + */ + protected function getExtraConditions(array $segments) + { + $extra = []; + + $count = count($segments); + + for ($i = 0; $i < $count; $i = $i + 2) { + $extra[$segments[$i]] = $segments[$i + 1]; + } + + return $extra; + } + + /** + * Validate that an attribute is a valid IP. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateIp($attribute, $value) + { + return filter_var($value, FILTER_VALIDATE_IP) !== false; + } + + /** + * Validate that an attribute is a valid e-mail address. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateEmail($attribute, $value) + { + return filter_var($value, FILTER_VALIDATE_EMAIL) !== false; + } + + /** + * Validate that an attribute is a valid URL. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateUrl($attribute, $value) + { + return filter_var($value, FILTER_VALIDATE_URL) !== false; + } + + /** + * Validate that an attribute is an active URL. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateActiveUrl($attribute, $value) + { + if (! is_string($value)) { + return false; + } + + if ($url = parse_url($value, PHP_URL_HOST)) { + return count(dns_get_record($url, DNS_A | DNS_AAAA)) > 0; + } + + return false; + } + + /** + * Validate the MIME type of a file is an image MIME type. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateImage($attribute, $value) + { + return $this->validateMimes($attribute, $value, ['jpeg', 'png', 'gif', 'bmp', 'svg']); + } + + /** + * Validate the guessed extension of a file upload is in a set of file extensions. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateMimes($attribute, $value, $parameters) + { + if (! $this->isAValidFileInstance($value)) { + return false; + } + + return $value->getPath() != '' && in_array($value->guessExtension(), $parameters); + } + + /** + * Validate the MIME type of a file upload attribute is in a set of MIME types. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateMimetypes($attribute, $value, $parameters) + { + if (! $this->isAValidFileInstance($value)) { + return false; + } + + return $value->getPath() != '' && in_array($value->getMimeType(), $parameters); + } + + /** + * Check that the given value is a valid file instance. + * + * @param mixed $value + * @return bool + */ + protected function isAValidFileInstance($value) + { + if ($value instanceof UploadedFile && ! $value->isValid()) { + return false; + } + + return $value instanceof File; + } + + /** + * Validate that an attribute contains only alphabetic characters. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateAlpha($attribute, $value) + { + return is_string($value) && preg_match('/^[\pL\pM]+$/u', $value); + } + + /** + * Validate that an attribute contains only alpha-numeric characters. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateAlphaNum($attribute, $value) + { + if (! is_string($value) && ! is_numeric($value)) { + return false; + } + + return preg_match('/^[\pL\pM\pN]+$/u', $value); + } + + /** + * Validate that an attribute contains only alpha-numeric characters, dashes, and underscores. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateAlphaDash($attribute, $value) + { + if (! is_string($value) && ! is_numeric($value)) { + return false; + } + + return preg_match('/^[\pL\pM\pN_-]+$/u', $value); + } + + /** + * Validate that an attribute passes a regular expression check. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateRegex($attribute, $value, $parameters) + { + if (! is_string($value) && ! is_numeric($value)) { + return false; + } + + $this->requireParameterCount(1, $parameters, 'regex'); + + return preg_match($parameters[0], $value); + } + + /** + * Validate that an attribute is a valid date. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateDate($attribute, $value) + { + if ($value instanceof DateTime) { + return true; + } + + if ((! is_string($value) && ! is_numeric($value)) || strtotime($value) === false) { + return false; + } + + $date = date_parse($value); + + return checkdate($date['month'], $date['day'], $date['year']); + } + + /** + * Validate that an attribute matches a date format. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateDateFormat($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'date_format'); + + if (! is_string($value) && ! is_numeric($value)) { + return false; + } + + $parsed = date_parse_from_format($parameters[0], $value); + + return $parsed['error_count'] === 0 && $parsed['warning_count'] === 0; + } + + /** + * Validate the date is before a given date. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateBefore($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'before'); + + if (! is_string($value) && ! is_numeric($value) && ! $value instanceof Carbon) { + return false; + } + + if ($format = $this->getDateFormat($attribute)) { + return $this->validateBeforeWithFormat($format, $value, $parameters); + } + + if (! ($date = strtotime($parameters[0]))) { + return strtotime($value) < strtotime($this->getValue($parameters[0])); + } + + return strtotime($value) < $date; + } + + /** + * Validate the date is before a given date with a given format. + * + * @param string $format + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateBeforeWithFormat($format, $value, $parameters) + { + $param = $this->getValue($parameters[0]) ?: $parameters[0]; + + return $this->checkDateTimeOrder($format, $value, $param); + } + + /** + * Validate the date is after a given date. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateAfter($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'after'); + + if (! is_string($value) && ! is_numeric($value) && ! $value instanceof Carbon) { + return false; + } + + if ($format = $this->getDateFormat($attribute)) { + return $this->validateAfterWithFormat($format, $value, $parameters); + } + + if (! ($date = strtotime($parameters[0]))) { + return strtotime($value) > strtotime($this->getValue($parameters[0])); + } + + return strtotime($value) > $date; + } + + /** + * Validate the date is after a given date with a given format. + * + * @param string $format + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function validateAfterWithFormat($format, $value, $parameters) + { + $param = $this->getValue($parameters[0]) ?: $parameters[0]; + + return $this->checkDateTimeOrder($format, $param, $value); + } + + /** + * Given two date/time strings, check that one is after the other. + * + * @param string $format + * @param string $before + * @param string $after + * @return bool + */ + protected function checkDateTimeOrder($format, $before, $after) + { + $before = $this->getDateTimeWithOptionalFormat($format, $before); + + $after = $this->getDateTimeWithOptionalFormat($format, $after); + + return ($before && $after) && ($after > $before); + } + + /** + * Get a DateTime instance from a string. + * + * @param string $format + * @param string $value + * @return \DateTime|null + */ + protected function getDateTimeWithOptionalFormat($format, $value) + { + $date = DateTime::createFromFormat($format, $value); + + if ($date) { + return $date; + } + + try { + return new DateTime($value); + } catch (Exception $e) { + // + } + } + + /** + * Validate that an attribute is a valid timezone. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function validateTimezone($attribute, $value) + { + try { + new DateTimeZone($value); + } catch (Exception $e) { + return false; + } + + return true; + } + + /** + * Get the date format for an attribute if it has one. + * + * @param string $attribute + * @return string|null + */ + protected function getDateFormat($attribute) + { + if ($result = $this->getRule($attribute, 'DateFormat')) { + return $result[1][0]; + } + } + + /** + * Get the validation message for an attribute and rule. + * + * @param string $attribute + * @param string $rule + * @return string + */ + protected function getMessage($attribute, $rule) + { + $lowerRule = Str::snake($rule); + + $inlineMessage = $this->getInlineMessage($attribute, $lowerRule); + + // First we will retrieve the custom message for the validation rule if one + // exists. If a custom validation message is being used we'll return the + // custom message, otherwise we'll keep searching for a valid message. + if (! is_null($inlineMessage)) { + return $inlineMessage; + } + + $customKey = "validation.custom.{$attribute}.{$lowerRule}"; + + $customMessage = $this->translator->trans($customKey); + + // First we check for a custom defined validation message for the attribute + // and rule. This allows the developer to specify specific messages for + // only some attributes and rules that need to get specially formed. + if ($customMessage !== $customKey) { + return $customMessage; + } + + // If the rule being validated is a "size" rule, we will need to gather the + // specific error message for the type of attribute being validated such + // as a number, file or string which all have different message types. + elseif (in_array($rule, $this->sizeRules)) { + return $this->getSizeMessage($attribute, $rule); + } + + // Finally, if no developer specified messages have been set, and no other + // special messages apply for this rule, we will just pull the default + // messages out of the translator service for this validation rule. + $key = "validation.{$lowerRule}"; + + if ($key != ($value = $this->translator->trans($key))) { + return $value; + } + + return $this->getInlineMessage( + $attribute, $lowerRule, $this->fallbackMessages + ) ?: $key; + } + + /** + * Get the inline message for a rule if it exists. + * + * @param string $attribute + * @param string $lowerRule + * @param array $source + * @return string|null + */ + protected function getInlineMessage($attribute, $lowerRule, $source = null) + { + $source = $source ?: $this->customMessages; + + $keys = ["{$attribute}.{$lowerRule}", $lowerRule]; + + // First we will check for a custom message for an attribute specific rule + // message for the fields, then we will check for a general custom line + // that is not attribute specific. If we find either we'll return it. + foreach ($keys as $key) { + if (isset($source[$key])) { + return $source[$key]; + } + } + } + + /** + * Get the proper error message for an attribute and size rule. + * + * @param string $attribute + * @param string $rule + * @return string + */ + protected function getSizeMessage($attribute, $rule) + { + $lowerRule = Str::snake($rule); + + // There are three different types of size validations. The attribute may be + // either a number, file, or string so we will check a few things to know + // which type of value it is and return the correct line for that type. + $type = $this->getAttributeType($attribute); + + $key = "validation.{$lowerRule}.{$type}"; + + return $this->translator->trans($key); + } + + /** + * Get the data type of the given attribute. + * + * @param string $attribute + * @return string + */ + protected function getAttributeType($attribute) + { + // We assume that the attributes present in the file array are files so that + // means that if the attribute does not have a numeric rule and the files + // list doesn't have it we'll just consider it a string by elimination. + if ($this->hasRule($attribute, $this->numericRules)) { + return 'numeric'; + } elseif ($this->hasRule($attribute, ['Array'])) { + return 'array'; + } elseif (array_key_exists($attribute, $this->files)) { + return 'file'; + } + + return 'string'; + } + + /** + * Replace all error message place-holders with actual values. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function doReplacements($message, $attribute, $rule, $parameters) + { + $message = str_replace(':attribute', $this->getAttribute($attribute), $message); + + if (isset($this->replacers[Str::snake($rule)])) { + $message = $this->callReplacer($message, $attribute, Str::snake($rule), $parameters); + } elseif (method_exists($this, $replacer = "replace{$rule}")) { + $message = $this->$replacer($message, $attribute, $rule, $parameters); + } + + return $message; + } + + /** + * Transform an array of attributes to their displayable form. + * + * @param array $values + * @return array + */ + protected function getAttributeList(array $values) + { + $attributes = []; + + // For each attribute in the list we will simply get its displayable form as + // this is convenient when replacing lists of parameters like some of the + // replacement functions do when formatting out the validation message. + foreach ($values as $key => $value) { + $attributes[$key] = $this->getAttribute($value); + } + + return $attributes; + } + + /** + * Get the displayable name of the attribute. + * + * @param string $attribute + * @return string + */ + protected function getAttribute($attribute) + { + // The developer may dynamically specify the array of custom attributes + // on this Validator instance. If the attribute exists in this array + // it takes precedence over all other ways we can pull attributes. + if (isset($this->customAttributes[$attribute])) { + return $this->customAttributes[$attribute]; + } + + $key = "validation.attributes.{$attribute}"; + + // We allow for the developer to specify language lines for each of the + // attributes allowing for more displayable counterparts of each of + // the attributes. This provides the ability for simple formats. + if (($line = $this->translator->trans($key)) !== $key) { + return $line; + } + + // If no language line has been specified for the attribute all of the + // underscores are removed from the attribute name and that will be + // used as default versions of the attribute's displayable names. + return str_replace('_', ' ', Str::snake($attribute)); + } + + /** + * Get the displayable name of the value. + * + * @param string $attribute + * @param mixed $value + * @return string + */ + public function getDisplayableValue($attribute, $value) + { + if (isset($this->customValues[$attribute][$value])) { + return $this->customValues[$attribute][$value]; + } + + $key = "validation.values.{$attribute}.{$value}"; + + if (($line = $this->translator->trans($key)) !== $key) { + return $line; + } + + return $value; + } + + /** + * Replace all place-holders for the between rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceBetween($message, $attribute, $rule, $parameters) + { + return str_replace([':min', ':max'], $parameters, $message); + } + + /** + * Replace all place-holders for the digits rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceDigits($message, $attribute, $rule, $parameters) + { + return str_replace(':digits', $parameters[0], $message); + } + + /** + * Replace all place-holders for the digits (between) rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceDigitsBetween($message, $attribute, $rule, $parameters) + { + return $this->replaceBetween($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the size rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceSize($message, $attribute, $rule, $parameters) + { + return str_replace(':size', $parameters[0], $message); + } + + /** + * Replace all place-holders for the min rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceMin($message, $attribute, $rule, $parameters) + { + return str_replace(':min', $parameters[0], $message); + } + + /** + * Replace all place-holders for the max rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceMax($message, $attribute, $rule, $parameters) + { + return str_replace(':max', $parameters[0], $message); + } + + /** + * Replace all place-holders for the in rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceIn($message, $attribute, $rule, $parameters) + { + foreach ($parameters as &$parameter) { + $parameter = $this->getDisplayableValue($attribute, $parameter); + } + + return str_replace(':values', implode(', ', $parameters), $message); + } + + /** + * Replace all place-holders for the not_in rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceNotIn($message, $attribute, $rule, $parameters) + { + return $this->replaceIn($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the mimes rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceMimes($message, $attribute, $rule, $parameters) + { + return str_replace(':values', implode(', ', $parameters), $message); + } + + /** + * Replace all place-holders for the required_with rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredWith($message, $attribute, $rule, $parameters) + { + $parameters = $this->getAttributeList($parameters); + + return str_replace(':values', implode(' / ', $parameters), $message); + } + + /** + * Replace all place-holders for the required_with_all rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredWithAll($message, $attribute, $rule, $parameters) + { + return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the required_without rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredWithout($message, $attribute, $rule, $parameters) + { + return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the required_without_all rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredWithoutAll($message, $attribute, $rule, $parameters) + { + return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the required_if rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredIf($message, $attribute, $rule, $parameters) + { + $parameters[1] = $this->getDisplayableValue($parameters[0], Arr::get($this->data, $parameters[0])); + + $parameters[0] = $this->getAttribute($parameters[0]); + + return str_replace([':other', ':value'], $parameters, $message); + } + + /** + * Replace all place-holders for the required_unless rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredUnless($message, $attribute, $rule, $parameters) + { + $other = $this->getAttribute(array_shift($parameters)); + + return str_replace([':other', ':values'], [$other, implode(', ', $parameters)], $message); + } + + /** + * Replace all place-holders for the same rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceSame($message, $attribute, $rule, $parameters) + { + return str_replace(':other', $this->getAttribute($parameters[0]), $message); + } + + /** + * Replace all place-holders for the different rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceDifferent($message, $attribute, $rule, $parameters) + { + return $this->replaceSame($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the date_format rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceDateFormat($message, $attribute, $rule, $parameters) + { + return str_replace(':format', $parameters[0], $message); + } + + /** + * Replace all place-holders for the before rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceBefore($message, $attribute, $rule, $parameters) + { + if (! (strtotime($parameters[0]))) { + return str_replace(':date', $this->getAttribute($parameters[0]), $message); + } + + return str_replace(':date', $parameters[0], $message); + } + + /** + * Replace all place-holders for the after rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceAfter($message, $attribute, $rule, $parameters) + { + return $this->replaceBefore($message, $attribute, $rule, $parameters); + } + + /** + * Determine if the given attribute has a rule in the given set. + * + * @param string $attribute + * @param string|array $rules + * @return bool + */ + protected function hasRule($attribute, $rules) + { + return ! is_null($this->getRule($attribute, $rules)); + } + + /** + * Get a rule and its parameters for a given attribute. + * + * @param string $attribute + * @param string|array $rules + * @return array|null + */ + protected function getRule($attribute, $rules) + { + if (! array_key_exists($attribute, $this->rules)) { + return; + } + + $rules = (array) $rules; + + foreach ($this->rules[$attribute] as $rule) { + list($rule, $parameters) = $this->parseRule($rule); + + if (in_array($rule, $rules)) { + return [$rule, $parameters]; + } + } + } + + /** + * Extract the rule name and parameters from a rule. + * + * @param array|string $rules + * @return array + */ + protected function parseRule($rules) + { + if (is_array($rules)) { + $rules = $this->parseArrayRule($rules); + } else { + $rules = $this->parseStringRule($rules); + } + + $rules[0] = $this->normalizeRule($rules[0]); + + return $rules; + } + + /** + * Parse an array based rule. + * + * @param array $rules + * @return array + */ + protected function parseArrayRule(array $rules) + { + return [Str::studly(trim(Arr::get($rules, 0))), array_slice($rules, 1)]; + } + + /** + * Parse a string based rule. + * + * @param string $rules + * @return array + */ + protected function parseStringRule($rules) + { + $parameters = []; + + // The format for specifying validation rules and parameters follows an + // easy {rule}:{parameters} formatting convention. For instance the + // rule "Max:3" states that the value may only be three letters. + if (strpos($rules, ':') !== false) { + list($rules, $parameter) = explode(':', $rules, 2); + + $parameters = $this->parseParameters($rules, $parameter); + } + + return [Str::studly(trim($rules)), $parameters]; + } + + /** + * Parse a parameter list. + * + * @param string $rule + * @param string $parameter + * @return array + */ + protected function parseParameters($rule, $parameter) + { + if (strtolower($rule) == 'regex') { + return [$parameter]; + } + + return str_getcsv($parameter); + } + + /** + * Normalizes a rule so that we can accept short types. + * + * @param string $rule + * @return string + */ + protected function normalizeRule($rule) + { + switch ($rule) { + case 'Int': + return 'Integer'; + case 'Bool': + return 'Boolean'; + default: + return $rule; + } + } + + /** + * Get the array of custom validator extensions. + * + * @return array + */ + public function getExtensions() + { + return $this->extensions; + } + + /** + * Register an array of custom validator extensions. + * + * @param array $extensions + * @return void + */ + public function addExtensions(array $extensions) + { + if ($extensions) { + $keys = array_map('\Illuminate\Support\Str::snake', array_keys($extensions)); + + $extensions = array_combine($keys, array_values($extensions)); + } + + $this->extensions = array_merge($this->extensions, $extensions); + } + + /** + * Register an array of custom implicit validator extensions. + * + * @param array $extensions + * @return void + */ + public function addImplicitExtensions(array $extensions) + { + $this->addExtensions($extensions); + + foreach ($extensions as $rule => $extension) { + $this->implicitRules[] = Str::studly($rule); + } + } + + /** + * Register a custom validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @return void + */ + public function addExtension($rule, $extension) + { + $this->extensions[Str::snake($rule)] = $extension; + } + + /** + * Register a custom implicit validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @return void + */ + public function addImplicitExtension($rule, $extension) + { + $this->addExtension($rule, $extension); + + $this->implicitRules[] = Str::studly($rule); + } + + /** + * Get the array of custom validator message replacers. + * + * @return array + */ + public function getReplacers() + { + return $this->replacers; + } + + /** + * Register an array of custom validator message replacers. + * + * @param array $replacers + * @return void + */ + public function addReplacers(array $replacers) + { + if ($replacers) { + $keys = array_map('\Illuminate\Support\Str::snake', array_keys($replacers)); + + $replacers = array_combine($keys, array_values($replacers)); + } + + $this->replacers = array_merge($this->replacers, $replacers); + } + + /** + * Register a custom validator message replacer. + * + * @param string $rule + * @param \Closure|string $replacer + * @return void + */ + public function addReplacer($rule, $replacer) + { + $this->replacers[Str::snake($rule)] = $replacer; + } + + /** + * Get the data under validation. + * + * @return array + */ + public function getData() + { + return $this->data; + } + + /** + * Set the data under validation. + * + * @param array $data + * @return void + */ + public function setData(array $data) + { + $this->data = $this->parseData($data); + } + + /** + * Get the validation rules. + * + * @return array + */ + public function getRules() + { + return $this->rules; + } + + /** + * Set the validation rules. + * + * @param array $rules + * @return $this + */ + public function setRules(array $rules) + { + $this->rules = $this->explodeRules($rules); + + return $this; + } + + /** + * Set the custom attributes on the validator. + * + * @param array $attributes + * @return $this + */ + public function setAttributeNames(array $attributes) + { + $this->customAttributes = $attributes; + + return $this; + } + + /** + * Set the custom values on the validator. + * + * @param array $values + * @return $this + */ + public function setValueNames(array $values) + { + $this->customValues = $values; + + return $this; + } + + /** + * Get the files under validation. + * + * @return array + */ + public function getFiles() + { + return $this->files; + } + + /** + * Set the files under validation. + * + * @param array $files + * @return $this + */ + public function setFiles(array $files) + { + $this->files = $files; + + return $this; + } + + /** + * Get the Presence Verifier implementation. + * + * @return \Illuminate\Validation\PresenceVerifierInterface + * + * @throws \RuntimeException + */ + public function getPresenceVerifier() + { + if (! isset($this->presenceVerifier)) { + throw new RuntimeException('Presence verifier has not been set.'); + } + + return $this->presenceVerifier; + } + + /** + * Set the Presence Verifier implementation. + * + * @param \Illuminate\Validation\PresenceVerifierInterface $presenceVerifier + * @return void + */ + public function setPresenceVerifier(PresenceVerifierInterface $presenceVerifier) + { + $this->presenceVerifier = $presenceVerifier; + } + + /** + * Get the Translator implementation. + * + * @return \Symfony\Component\Translation\TranslatorInterface + */ + public function getTranslator() + { + return $this->translator; + } + + /** + * Set the Translator implementation. + * + * @param \Symfony\Component\Translation\TranslatorInterface $translator + * @return void + */ + public function setTranslator(TranslatorInterface $translator) + { + $this->translator = $translator; + } + + /** + * Get the custom messages for the validator. + * + * @return array + */ + public function getCustomMessages() + { + return $this->customMessages; + } + + /** + * Set the custom messages for the validator. + * + * @param array $messages + * @return void + */ + public function setCustomMessages(array $messages) + { + $this->customMessages = array_merge($this->customMessages, $messages); + } + + /** + * Get the custom attributes used by the validator. + * + * @return array + */ + public function getCustomAttributes() + { + return $this->customAttributes; + } + + /** + * Add custom attributes to the validator. + * + * @param array $customAttributes + * @return $this + */ + public function addCustomAttributes(array $customAttributes) + { + $this->customAttributes = array_merge($this->customAttributes, $customAttributes); + + return $this; + } + + /** + * Get the custom values for the validator. + * + * @return array + */ + public function getCustomValues() + { + return $this->customValues; + } + + /** + * Add the custom values for the validator. + * + * @param array $customValues + * @return $this + */ + public function addCustomValues(array $customValues) + { + $this->customValues = array_merge($this->customValues, $customValues); + + return $this; + } + + /** + * Get the fallback messages for the validator. + * + * @return array + */ + public function getFallbackMessages() + { + return $this->fallbackMessages; + } + + /** + * Set the fallback messages for the validator. + * + * @param array $messages + * @return void + */ + public function setFallbackMessages(array $messages) + { + $this->fallbackMessages = $messages; + } + + /** + * Get the failed validation rules. + * + * @return array + */ + public function failed() + { + return $this->failedRules; + } + + /** + * Get the message container for the validator. + * + * @return \Illuminate\Support\MessageBag + */ + public function messages() + { + if (! $this->messages) { + $this->passes(); + } + + return $this->messages; + } + + /** + * An alternative more semantic shortcut to the message container. + * + * @return \Illuminate\Support\MessageBag + */ + public function errors() + { + return $this->messages(); + } + + /** + * Get the messages for the instance. + * + * @return \Illuminate\Support\MessageBag + */ + public function getMessageBag() + { + return $this->messages(); + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function setContainer(Container $container) + { + $this->container = $container; + } + + /** + * Call a custom validator extension. + * + * @param string $rule + * @param array $parameters + * @return bool|null + */ + protected function callExtension($rule, $parameters) + { + $callback = $this->extensions[$rule]; + + if ($callback instanceof Closure) { + return call_user_func_array($callback, $parameters); + } elseif (is_string($callback)) { + return $this->callClassBasedExtension($callback, $parameters); + } + } + + /** + * Call a class based validator extension. + * + * @param string $callback + * @param array $parameters + * @return bool + */ + protected function callClassBasedExtension($callback, $parameters) + { + list($class, $method) = explode('@', $callback); + + return call_user_func_array([$this->container->make($class), $method], $parameters); + } + + /** + * Call a custom validator message replacer. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string|null + */ + protected function callReplacer($message, $attribute, $rule, $parameters) + { + $callback = $this->replacers[$rule]; + + if ($callback instanceof Closure) { + return call_user_func_array($callback, func_get_args()); + } elseif (is_string($callback)) { + return $this->callClassBasedReplacer($callback, $message, $attribute, $rule, $parameters); + } + } + + /** + * Call a class based validator message replacer. + * + * @param string $callback + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function callClassBasedReplacer($callback, $message, $attribute, $rule, $parameters) + { + list($class, $method) = explode('@', $callback); + + return call_user_func_array([$this->container->make($class), $method], array_slice(func_get_args(), 1)); + } + + /** + * Require a certain number of parameters to be present. + * + * @param int $count + * @param array $parameters + * @param string $rule + * @return void + * @throws \InvalidArgumentException + */ + protected function requireParameterCount($count, $parameters, $rule) + { + if (count($parameters) < $count) { + throw new InvalidArgumentException("Validation rule $rule requires at least $count parameters."); + } + } + + /** + * Handle dynamic calls to class methods. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + $rule = Str::snake(substr($method, 8)); + + if (isset($this->extensions[$rule])) { + return $this->callExtension($rule, $parameters); + } + + throw new BadMethodCallException("Method [$method] does not exist."); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/Validation/composer.json b/application/vendor/laravel/framework/src/Illuminate/Validation/composer.json index 2c25c0a..3733144 100644 --- a/application/vendor/laravel/framework/src/Illuminate/Validation/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/Validation/composer.json @@ -14,12 +14,12 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/container": "5.0.*", - "illuminate/contracts": "5.0.*", - "illuminate/support": "5.0.*", - "symfony/http-foundation": "2.6.*", - "symfony/translation": "2.6.*" + "php": ">=5.5.9", + "illuminate/container": "5.1.*", + "illuminate/contracts": "5.1.*", + "illuminate/support": "5.1.*", + "symfony/http-foundation": "2.7.*", + "symfony/translation": "2.7.*" }, "autoload": { "psr-4": { @@ -28,11 +28,11 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "suggest": { - "illuminate/database": "Required to use the database presence verifier (5.0.*)." + "illuminate/database": "Required to use the database presence verifier (5.1.*)." }, "minimum-stability": "dev" } diff --git a/application/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php b/application/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php index a6d4940..c257a82 100644 --- a/application/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php +++ b/application/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php @@ -1,812 +1,889 @@ -setPath($path); - } - - $contents = $this->compileString($this->files->get($this->getPath())); - - if ( ! is_null($this->cachePath)) - { - $this->files->put($this->getCompiledPath($this->getPath()), $contents); - } - } - - /** - * Get the path currently being compiled. - * - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Set the path currently being compiled. - * - * @param string $path - * @return void - */ - public function setPath($path) - { - $this->path = $path; - } - - /** - * Compile the given Blade template contents. - * - * @param string $value - * @return string - */ - public function compileString($value) - { - $result = ''; - - $this->footer = []; - - // Here we will loop through all of the tokens returned by the Zend lexer and - // parse each one into the corresponding valid PHP. We will then have this - // template as the correctly rendered PHP that can be rendered natively. - foreach (token_get_all($value) as $token) - { - $result .= is_array($token) ? $this->parseToken($token) : $token; - } - - // If there are any footer lines that need to get added to a template we will - // add them here at the end of the template. This gets used mainly for the - // template inheritance via the extends keyword that should be appended. - if (count($this->footer) > 0) - { - $result = ltrim($result, PHP_EOL) - .PHP_EOL.implode(PHP_EOL, array_reverse($this->footer)); - } - - return $result; - } - - /** - * Parse the tokens from the template. - * - * @param array $token - * @return string - */ - protected function parseToken($token) - { - list($id, $content) = $token; - - if ($id == T_INLINE_HTML) - { - foreach ($this->compilers as $type) - { - $content = $this->{"compile{$type}"}($content); - } - } - - return $content; - } - - /** - * Execute the user defined extensions. - * - * @param string $value - * @return string - */ - protected function compileExtensions($value) - { - foreach ($this->extensions as $compiler) - { - $value = call_user_func($compiler, $value, $this); - } - - return $value; - } - - /** - * Compile Blade comments into valid PHP. - * - * @param string $value - * @return string - */ - protected function compileComments($value) - { - $pattern = sprintf('/%s--((.|\s)*?)--%s/', $this->contentTags[0], $this->contentTags[1]); - - return preg_replace($pattern, '', $value); - } - - /** - * Compile Blade echos into valid PHP. - * - * @param string $value - * @return string - */ - protected function compileEchos($value) - { - foreach ($this->getEchoMethods() as $method => $length) - { - $value = $this->$method($value); - } - - return $value; - } - - /** - * Get the echo methods in the proper order for compilation. - * - * @return array - */ - protected function getEchoMethods() - { - $methods = [ - "compileRawEchos" => strlen(stripcslashes($this->rawTags[0])), - "compileEscapedEchos" => strlen(stripcslashes($this->escapedTags[0])), - "compileRegularEchos" => strlen(stripcslashes($this->contentTags[0])), - ]; - - uksort($methods, function($method1, $method2) use ($methods) - { - // Ensure the longest tags are processed first - if ($methods[$method1] > $methods[$method2]) return -1; - if ($methods[$method1] < $methods[$method2]) return 1; - - // Otherwise give preference to raw tags (assuming they've overridden) - if ($method1 === "compileRawEchos") return -1; - if ($method2 === "compileRawEchos") return 1; - - if ($method1 === "compileEscapedEchos") return -1; - if ($method2 === "compileEscapedEchos") return 1; - }); - - return $methods; - } - - /** - * Compile Blade statements that start with "@". - * - * @param string $value - * @return mixed - */ - protected function compileStatements($value) - { - $callback = function($match) - { - if (method_exists($this, $method = 'compile'.ucfirst($match[1]))) - { - $match[0] = $this->$method(array_get($match, 3)); - } - - return isset($match[3]) ? $match[0] : $match[0].$match[2]; - }; - - return preg_replace_callback('/\B@(\w+)([ \t]*)(\( ( (?>[^()]+) | (?3) )* \))?/x', $callback, $value); - } - - /** - * Compile the "raw" echo statements. - * - * @param string $value - * @return string - */ - protected function compileRawEchos($value) - { - $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->rawTags[0], $this->rawTags[1]); - - $callback = function($matches) - { - $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; - - return $matches[1] ? substr($matches[0], 1) : 'compileEchoDefaults($matches[2]).'; ?>'.$whitespace; - }; - - return preg_replace_callback($pattern, $callback, $value); - } - - /** - * Compile the "regular" echo statements. - * - * @param string $value - * @return string - */ - protected function compileRegularEchos($value) - { - $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->contentTags[0], $this->contentTags[1]); - - $callback = function($matches) - { - $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; - - $wrapped = sprintf($this->echoFormat, $this->compileEchoDefaults($matches[2])); - - return $matches[1] ? substr($matches[0], 1) : ''.$whitespace; - }; - - return preg_replace_callback($pattern, $callback, $value); - } - - /** - * Compile the escaped echo statements. - * - * @param string $value - * @return string - */ - protected function compileEscapedEchos($value) - { - $pattern = sprintf('/%s\s*(.+?)\s*%s(\r?\n)?/s', $this->escapedTags[0], $this->escapedTags[1]); - - $callback = function($matches) - { - $whitespace = empty($matches[2]) ? '' : $matches[2].$matches[2]; - - return 'compileEchoDefaults($matches[1]).'); ?>'.$whitespace; - }; - - return preg_replace_callback($pattern, $callback, $value); - } - - /** - * Compile the default values for the echo statement. - * - * @param string $value - * @return string - */ - public function compileEchoDefaults($value) - { - return preg_replace('/^(?=\$)(.+?)(?:\s+or\s+)(.+?)$/s', 'isset($1) ? $1 : $2', $value); - } - - /** - * Compile the each statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileEach($expression) - { - return "renderEach{$expression}; ?>"; - } - - /** - * Compile the yield statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileYield($expression) - { - return "yieldContent{$expression}; ?>"; - } - - /** - * Compile the show statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileShow($expression) - { - return "yieldSection(); ?>"; - } - - /** - * Compile the section statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileSection($expression) - { - return "startSection{$expression}; ?>"; - } - - /** - * Compile the append statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileAppend($expression) - { - return "appendSection(); ?>"; - } - - /** - * Compile the end-section statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileEndsection($expression) - { - return "stopSection(); ?>"; - } - - /** - * Compile the stop statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileStop($expression) - { - return "stopSection(); ?>"; - } - - /** - * Compile the overwrite statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileOverwrite($expression) - { - return "stopSection(true); ?>"; - } - - /** - * Compile the unless statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileUnless($expression) - { - return ""; - } - - /** - * Compile the end unless statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileEndunless($expression) - { - return ""; - } - - /** - * Compile the lang statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileLang($expression) - { - return ""; - } - - /** - * Compile the choice statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileChoice($expression) - { - return ""; - } - - /** - * Compile the else statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileElse($expression) - { - return ""; - } - - /** - * Compile the for statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileFor($expression) - { - return ""; - } - - /** - * Compile the foreach statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileForeach($expression) - { - return ""; - } - - /** - * Compile the forelse statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileForelse($expression) - { - $empty = '$__empty_' . ++$this->forelseCounter; - - return ""; - } - - /** - * Compile the if statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileIf($expression) - { - return ""; - } - - /** - * Compile the else-if statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileElseif($expression) - { - return ""; - } - - /** - * Compile the forelse statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileEmpty($expression) - { - $empty = '$__empty_' . $this->forelseCounter--; - - return ""; - } - - /** - * Compile the while statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileWhile($expression) - { - return ""; - } - - /** - * Compile the end-while statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileEndwhile($expression) - { - return ""; - } - - /** - * Compile the end-for statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileEndfor($expression) - { - return ""; - } - - /** - * Compile the end-for-each statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileEndforeach($expression) - { - return ""; - } - - /** - * Compile the end-if statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileEndif($expression) - { - return ""; - } - - /** - * Compile the end-for-else statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileEndforelse($expression) - { - return ""; - } - - /** - * Compile the extends statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileExtends($expression) - { - if (starts_with($expression, '(')) - { - $expression = substr($expression, 1, -1); - } - - $data = "make($expression, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>"; - - $this->footer[] = $data; - - return ''; - } - - /** - * Compile the include statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileInclude($expression) - { - if (starts_with($expression, '(')) - { - $expression = substr($expression, 1, -1); - } - - return "make($expression, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>"; - } - - /** - * Compile the stack statements into the content. - * - * @param string $expression - * @return string - */ - protected function compileStack($expression) - { - return "yieldContent{$expression}; ?>"; - } - - /** - * Compile the push statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compilePush($expression) - { - return "startSection{$expression}; ?>"; - } - - /** - * Compile the endpush statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileEndpush($expression) - { - return "appendSection(); ?>"; - } - - /** - * Register a custom Blade compiler. - * - * @param callable $compiler - * @return void - */ - public function extend(callable $compiler) - { - $this->extensions[] = $compiler; - } - - /** - * Get the regular expression for a generic Blade function. - * - * @param string $function - * @return string - */ - public function createMatcher($function) - { - return '/(?rawTags = array(preg_quote($openTag), preg_quote($closeTag)); - } - - /** - * Sets the content tags used for the compiler. - * - * @param string $openTag - * @param string $closeTag - * @param bool $escaped - * @return void - */ - public function setContentTags($openTag, $closeTag, $escaped = false) - { - $property = ($escaped === true) ? 'escapedTags' : 'contentTags'; - - $this->{$property} = array(preg_quote($openTag), preg_quote($closeTag)); - } - - /** - * Sets the escaped content tags used for the compiler. - * - * @param string $openTag - * @param string $closeTag - * @return void - */ - public function setEscapedContentTags($openTag, $closeTag) - { - $this->setContentTags($openTag, $closeTag, true); - } - - /** - * Gets the content tags used for the compiler. - * - * @return string - */ - public function getContentTags() - { - return $this->getTags(); - } - - /** - * Gets the escaped content tags used for the compiler. - * - * @return string - */ - public function getEscapedContentTags() - { - return $this->getTags(true); - } - - /** - * Gets the tags used for the compiler. - * - * @param bool $escaped - * @return array - */ - protected function getTags($escaped = false) - { - $tags = $escaped ? $this->escapedTags : $this->contentTags; - - return array_map('stripcslashes', $tags); - } - - /** - * Set the echo format to be used by the compiler. - * - * @param string $format - * @return void - */ - public function setEchoFormat($format) - { - $this->echoFormat = $format; - } - +setPath($path); + } + + $contents = $this->compileString($this->files->get($this->getPath())); + + if (! is_null($this->cachePath)) { + $this->files->put($this->getCompiledPath($this->getPath()), $contents); + } + } + + /** + * Get the path currently being compiled. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set the path currently being compiled. + * + * @param string $path + * @return void + */ + public function setPath($path) + { + $this->path = $path; + } + + /** + * Compile the given Blade template contents. + * + * @param string $value + * @return string + */ + public function compileString($value) + { + $result = ''; + + $this->footer = []; + + // Here we will loop through all of the tokens returned by the Zend lexer and + // parse each one into the corresponding valid PHP. We will then have this + // template as the correctly rendered PHP that can be rendered natively. + foreach (token_get_all($value) as $token) { + $result .= is_array($token) ? $this->parseToken($token) : $token; + } + + // If there are any footer lines that need to get added to a template we will + // add them here at the end of the template. This gets used mainly for the + // template inheritance via the extends keyword that should be appended. + if (count($this->footer) > 0) { + $result = ltrim($result, PHP_EOL) + .PHP_EOL.implode(PHP_EOL, array_reverse($this->footer)); + } + + return $result; + } + + /** + * Parse the tokens from the template. + * + * @param array $token + * @return string + */ + protected function parseToken($token) + { + list($id, $content) = $token; + + if ($id == T_INLINE_HTML) { + foreach ($this->compilers as $type) { + $content = $this->{"compile{$type}"}($content); + } + } + + return $content; + } + + /** + * Execute the user defined extensions. + * + * @param string $value + * @return string + */ + protected function compileExtensions($value) + { + foreach ($this->extensions as $compiler) { + $value = call_user_func($compiler, $value, $this); + } + + return $value; + } + + /** + * Compile Blade comments into valid PHP. + * + * @param string $value + * @return string + */ + protected function compileComments($value) + { + $pattern = sprintf('/%s--(.*?)--%s/s', $this->contentTags[0], $this->contentTags[1]); + + return preg_replace($pattern, '', $value); + } + + /** + * Compile Blade echos into valid PHP. + * + * @param string $value + * @return string + */ + protected function compileEchos($value) + { + foreach ($this->getEchoMethods() as $method => $length) { + $value = $this->$method($value); + } + + return $value; + } + + /** + * Get the echo methods in the proper order for compilation. + * + * @return array + */ + protected function getEchoMethods() + { + $methods = [ + 'compileRawEchos' => strlen(stripcslashes($this->rawTags[0])), + 'compileEscapedEchos' => strlen(stripcslashes($this->escapedTags[0])), + 'compileRegularEchos' => strlen(stripcslashes($this->contentTags[0])), + ]; + + uksort($methods, function ($method1, $method2) use ($methods) { + // Ensure the longest tags are processed first + if ($methods[$method1] > $methods[$method2]) { + return -1; + } + if ($methods[$method1] < $methods[$method2]) { + return 1; + } + + // Otherwise give preference to raw tags (assuming they've overridden) + if ($method1 === 'compileRawEchos') { + return -1; + } + if ($method2 === 'compileRawEchos') { + return 1; + } + + if ($method1 === 'compileEscapedEchos') { + return -1; + } + if ($method2 === 'compileEscapedEchos') { + return 1; + } + }); + + return $methods; + } + + /** + * Compile Blade statements that start with "@". + * + * @param string $value + * @return mixed + */ + protected function compileStatements($value) + { + $callback = function ($match) { + if (method_exists($this, $method = 'compile'.ucfirst($match[1]))) { + $match[0] = $this->$method(Arr::get($match, 3)); + } elseif (isset($this->customDirectives[$match[1]])) { + $match[0] = call_user_func($this->customDirectives[$match[1]], Arr::get($match, 3)); + } + + return isset($match[3]) ? $match[0] : $match[0].$match[2]; + }; + + return preg_replace_callback('/\B@(\w+)([ \t]*)(\( ( (?>[^()]+) | (?3) )* \))?/x', $callback, $value); + } + + /** + * Compile the "raw" echo statements. + * + * @param string $value + * @return string + */ + protected function compileRawEchos($value) + { + $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->rawTags[0], $this->rawTags[1]); + + $callback = function ($matches) { + $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; + + return $matches[1] ? substr($matches[0], 1) : 'compileEchoDefaults($matches[2]).'; ?>'.$whitespace; + }; + + return preg_replace_callback($pattern, $callback, $value); + } + + /** + * Compile the "regular" echo statements. + * + * @param string $value + * @return string + */ + protected function compileRegularEchos($value) + { + $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->contentTags[0], $this->contentTags[1]); + + $callback = function ($matches) { + $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; + + $wrapped = sprintf($this->echoFormat, $this->compileEchoDefaults($matches[2])); + + return $matches[1] ? substr($matches[0], 1) : ''.$whitespace; + }; + + return preg_replace_callback($pattern, $callback, $value); + } + + /** + * Compile the escaped echo statements. + * + * @param string $value + * @return string + */ + protected function compileEscapedEchos($value) + { + $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->escapedTags[0], $this->escapedTags[1]); + + $callback = function ($matches) { + $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; + + return $matches[1] ? $matches[0] : 'compileEchoDefaults($matches[2]).'); ?>'.$whitespace; + }; + + return preg_replace_callback($pattern, $callback, $value); + } + + /** + * Compile the default values for the echo statement. + * + * @param string $value + * @return string + */ + public function compileEchoDefaults($value) + { + return preg_replace('/^(?=\$)(.+?)(?:\s+or\s+)(.+?)$/s', 'isset($1) ? $1 : $2', $value); + } + + /** + * Compile the each statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEach($expression) + { + return "renderEach{$expression}; ?>"; + } + + /** + * Compile the inject statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileInject($expression) + { + $segments = explode(',', preg_replace("/[\(\)\\\"\']/", '', $expression)); + + return '"; + } + + /** + * Compile the yield statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileYield($expression) + { + return "yieldContent{$expression}; ?>"; + } + + /** + * Compile the show statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileShow($expression) + { + return 'yieldSection(); ?>'; + } + + /** + * Compile the section statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileSection($expression) + { + return "startSection{$expression}; ?>"; + } + + /** + * Compile the append statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileAppend($expression) + { + return 'appendSection(); ?>'; + } + + /** + * Compile the end-section statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEndsection($expression) + { + return 'stopSection(); ?>'; + } + + /** + * Compile the stop statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileStop($expression) + { + return 'stopSection(); ?>'; + } + + /** + * Compile the overwrite statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileOverwrite($expression) + { + return 'stopSection(true); ?>'; + } + + /** + * Compile the unless statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileUnless($expression) + { + return ""; + } + + /** + * Compile the end unless statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEndunless($expression) + { + return ''; + } + + /** + * Compile the lang statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileLang($expression) + { + return "get$expression; ?>"; + } + + /** + * Compile the choice statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileChoice($expression) + { + return "choice$expression; ?>"; + } + + /** + * Compile the else statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileElse($expression) + { + return ''; + } + + /** + * Compile the for statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileFor($expression) + { + return ""; + } + + /** + * Compile the foreach statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileForeach($expression) + { + return ""; + } + + /** + * Compile the forelse statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileForelse($expression) + { + $empty = '$__empty_'.++$this->forelseCounter; + + return ""; + } + + /** + * Compile the can statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileCan($expression) + { + return "check{$expression}): ?>"; + } + + /** + * Compile the cannot statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileCannot($expression) + { + return "denies{$expression}): ?>"; + } + + /** + * Compile the if statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileIf($expression) + { + return ""; + } + + /** + * Compile the else-if statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileElseif($expression) + { + return ""; + } + + /** + * Compile the forelse statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEmpty($expression) + { + $empty = '$__empty_'.$this->forelseCounter--; + + return ""; + } + + /** + * Compile the while statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileWhile($expression) + { + return ""; + } + + /** + * Compile the end-while statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEndwhile($expression) + { + return ''; + } + + /** + * Compile the end-for statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEndfor($expression) + { + return ''; + } + + /** + * Compile the end-for-each statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEndforeach($expression) + { + return ''; + } + + /** + * Compile the end-can statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEndcan($expression) + { + return ''; + } + + /** + * Compile the end-cannot statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEndcannot($expression) + { + return ''; + } + + /** + * Compile the end-if statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEndif($expression) + { + return ''; + } + + /** + * Compile the end-for-else statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEndforelse($expression) + { + return ''; + } + + /** + * Compile the extends statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileExtends($expression) + { + if (Str::startsWith($expression, '(')) { + $expression = substr($expression, 1, -1); + } + + $data = "make($expression, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>"; + + $this->footer[] = $data; + + return ''; + } + + /** + * Compile the include statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileInclude($expression) + { + if (Str::startsWith($expression, '(')) { + $expression = substr($expression, 1, -1); + } + + return "make($expression, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>"; + } + + /** + * Compile the stack statements into the content. + * + * @param string $expression + * @return string + */ + protected function compileStack($expression) + { + return "yieldContent{$expression}; ?>"; + } + + /** + * Compile the push statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compilePush($expression) + { + return "startSection{$expression}; ?>"; + } + + /** + * Compile the endpush statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEndpush($expression) + { + return 'appendSection(); ?>'; + } + + /** + * Get the extensions used by the compiler. + * + * @return array + */ + public function getExtensions() + { + return $this->extensions; + } + + /** + * Register a custom Blade compiler. + * + * @param callable $compiler + * @return void + */ + public function extend(callable $compiler) + { + $this->extensions[] = $compiler; + } + + /** + * Register a handler for custom directives. + * + * @param string $name + * @param callable $handler + * @return void + */ + public function directive($name, callable $handler) + { + $this->customDirectives[$name] = $handler; + } + + /** + * Get the list of custom directives. + * + * @return array + */ + public function getCustomDirectives() + { + return $this->customDirectives; + } + + /** + * Gets the raw tags used by the compiler. + * + * @return array + */ + public function getRawTags() + { + return $this->rawTags; + } + + /** + * Sets the raw tags used for the compiler. + * + * @param string $openTag + * @param string $closeTag + * @return void + */ + public function setRawTags($openTag, $closeTag) + { + $this->rawTags = [preg_quote($openTag), preg_quote($closeTag)]; + } + + /** + * Sets the content tags used for the compiler. + * + * @param string $openTag + * @param string $closeTag + * @param bool $escaped + * @return void + */ + public function setContentTags($openTag, $closeTag, $escaped = false) + { + $property = ($escaped === true) ? 'escapedTags' : 'contentTags'; + + $this->{$property} = [preg_quote($openTag), preg_quote($closeTag)]; + } + + /** + * Sets the escaped content tags used for the compiler. + * + * @param string $openTag + * @param string $closeTag + * @return void + */ + public function setEscapedContentTags($openTag, $closeTag) + { + $this->setContentTags($openTag, $closeTag, true); + } + + /** + * Gets the content tags used for the compiler. + * + * @return string + */ + public function getContentTags() + { + return $this->getTags(); + } + + /** + * Gets the escaped content tags used for the compiler. + * + * @return string + */ + public function getEscapedContentTags() + { + return $this->getTags(true); + } + + /** + * Gets the tags used for the compiler. + * + * @param bool $escaped + * @return array + */ + protected function getTags($escaped = false) + { + $tags = $escaped ? $this->escapedTags : $this->contentTags; + + return array_map('stripcslashes', $tags); + } + + /** + * Set the echo format to be used by the compiler. + * + * @param string $format + * @return void + */ + public function setEchoFormat($format) + { + $this->echoFormat = $format; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php b/application/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php index 81034aa..73ded29 100644 --- a/application/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php +++ b/application/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php @@ -1,68 +1,75 @@ -files = $files; - $this->cachePath = $cachePath; - } + /** + * Create a new compiler instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @param string $cachePath + * @return void + * + * @throws \InvalidArgumentException + */ + public function __construct(Filesystem $files, $cachePath) + { + if (! $cachePath) { + throw new InvalidArgumentException('Please provide a valid cache path.'); + } - /** - * Get the path to the compiled version of a view. - * - * @param string $path - * @return string - */ - public function getCompiledPath($path) - { - return $this->cachePath.'/'.md5($path); - } + $this->files = $files; + $this->cachePath = $cachePath; + } - /** - * Determine if the view at the given path is expired. - * - * @param string $path - * @return bool - */ - public function isExpired($path) - { - $compiled = $this->getCompiledPath($path); + /** + * Get the path to the compiled version of a view. + * + * @param string $path + * @return string + */ + public function getCompiledPath($path) + { + return $this->cachePath.'/'.md5($path); + } - // If the compiled file doesn't exist we will indicate that the view is expired - // so that it can be re-compiled. Else, we will verify the last modification - // of the views is less than the modification times of the compiled views. - if ( ! $this->cachePath || ! $this->files->exists($compiled)) - { - return true; - } + /** + * Determine if the view at the given path is expired. + * + * @param string $path + * @return bool + */ + public function isExpired($path) + { + $compiled = $this->getCompiledPath($path); - $lastModified = $this->files->lastModified($path); + // If the compiled file doesn't exist we will indicate that the view is expired + // so that it can be re-compiled. Else, we will verify the last modification + // of the views is less than the modification times of the compiled views. + if (! $this->files->exists($compiled)) { + return true; + } - return $lastModified >= $this->files->lastModified($compiled); - } + $lastModified = $this->files->lastModified($path); + return $lastModified >= $this->files->lastModified($compiled); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/View/Compilers/CompilerInterface.php b/application/vendor/laravel/framework/src/Illuminate/View/Compilers/CompilerInterface.php index 85034b0..dfcb023 100644 --- a/application/vendor/laravel/framework/src/Illuminate/View/Compilers/CompilerInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/View/Compilers/CompilerInterface.php @@ -1,29 +1,30 @@ -compiler = $compiler; - } - - /** - * Get the evaluated contents of the view. - * - * @param string $path - * @param array $data - * @return string - */ - public function get($path, array $data = array()) - { - $this->lastCompiled[] = $path; - - // If this given view has expired, which means it has simply been edited since - // it was last compiled, we will re-compile the views so we can evaluate a - // fresh copy of the view. We'll pass the compiler the path of the view. - if ($this->compiler->isExpired($path)) - { - $this->compiler->compile($path); - } - - $compiled = $this->compiler->getCompiledPath($path); - - // Once we have the path to the compiled file, we will evaluate the paths with - // typical PHP just like any other templates. We also keep a stack of views - // which have been rendered for right exception messages to be generated. - $results = $this->evaluatePath($compiled, $data); - - array_pop($this->lastCompiled); - - return $results; - } - - /** - * Handle a view exception. - * - * @param \Exception $e - * @param int $obLevel - * @return void - * - * @throws $e - */ - protected function handleViewException($e, $obLevel) - { - $e = new ErrorException($this->getMessage($e), 0, 1, $e->getFile(), $e->getLine(), $e); - - parent::handleViewException($e, $obLevel); - } - - /** - * Get the exception message for an exception. - * - * @param \Exception $e - * @return string - */ - protected function getMessage($e) - { - return $e->getMessage().' (View: '.realpath(last($this->lastCompiled)).')'; - } - - /** - * Get the compiler implementation. - * - * @return \Illuminate\View\Compilers\CompilerInterface - */ - public function getCompiler() - { - return $this->compiler; - } - +class CompilerEngine extends PhpEngine +{ + /** + * The Blade compiler instance. + * + * @var \Illuminate\View\Compilers\CompilerInterface + */ + protected $compiler; + + /** + * A stack of the last compiled templates. + * + * @var array + */ + protected $lastCompiled = []; + + /** + * Create a new Blade view engine instance. + * + * @param \Illuminate\View\Compilers\CompilerInterface $compiler + * @return void + */ + public function __construct(CompilerInterface $compiler) + { + $this->compiler = $compiler; + } + + /** + * Get the evaluated contents of the view. + * + * @param string $path + * @param array $data + * @return string + */ + public function get($path, array $data = []) + { + $this->lastCompiled[] = $path; + + // If this given view has expired, which means it has simply been edited since + // it was last compiled, we will re-compile the views so we can evaluate a + // fresh copy of the view. We'll pass the compiler the path of the view. + if ($this->compiler->isExpired($path)) { + $this->compiler->compile($path); + } + + $compiled = $this->compiler->getCompiledPath($path); + + // Once we have the path to the compiled file, we will evaluate the paths with + // typical PHP just like any other templates. We also keep a stack of views + // which have been rendered for right exception messages to be generated. + $results = $this->evaluatePath($compiled, $data); + + array_pop($this->lastCompiled); + + return $results; + } + + /** + * Handle a view exception. + * + * @param \Exception $e + * @param int $obLevel + * @return void + * + * @throws $e + */ + protected function handleViewException($e, $obLevel) + { + $e = new ErrorException($this->getMessage($e), 0, 1, $e->getFile(), $e->getLine(), $e); + + parent::handleViewException($e, $obLevel); + } + + /** + * Get the exception message for an exception. + * + * @param \Exception $e + * @return string + */ + protected function getMessage($e) + { + return $e->getMessage().' (View: '.realpath(last($this->lastCompiled)).')'; + } + + /** + * Get the compiler implementation. + * + * @return \Illuminate\View\Compilers\CompilerInterface + */ + public function getCompiler() + { + return $this->compiler; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/View/Engines/Engine.php b/application/vendor/laravel/framework/src/Illuminate/View/Engines/Engine.php index 4ea9796..bf5c748 100644 --- a/application/vendor/laravel/framework/src/Illuminate/View/Engines/Engine.php +++ b/application/vendor/laravel/framework/src/Illuminate/View/Engines/Engine.php @@ -1,22 +1,23 @@ -lastRendered; - } +abstract class Engine +{ + /** + * The view that was last to be rendered. + * + * @var string + */ + protected $lastRendered; + /** + * Get the last view that was rendered. + * + * @return string + */ + public function getLastRendered() + { + return $this->lastRendered; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/View/Engines/EngineInterface.php b/application/vendor/laravel/framework/src/Illuminate/View/Engines/EngineInterface.php index 5368734..a6f71d2 100644 --- a/application/vendor/laravel/framework/src/Illuminate/View/Engines/EngineInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/View/Engines/EngineInterface.php @@ -1,14 +1,15 @@ -resolved[$engine]); - - $this->resolvers[$engine] = $resolver; - } - - /** - * Resolver an engine instance by name. - * - * @param string $engine - * @return \Illuminate\View\Engines\EngineInterface - * @throws \InvalidArgumentException - */ - public function resolve($engine) - { - if (isset($this->resolved[$engine])) - { - return $this->resolved[$engine]; - } - - if (isset($this->resolvers[$engine])) - { - return $this->resolved[$engine] = call_user_func($this->resolvers[$engine]); - } - - throw new InvalidArgumentException("Engine $engine not found."); - } - +class EngineResolver +{ + /** + * The array of engine resolvers. + * + * @var array + */ + protected $resolvers = []; + + /** + * The resolved engine instances. + * + * @var array + */ + protected $resolved = []; + + /** + * Register a new engine resolver. + * + * The engine string typically corresponds to a file extension. + * + * @param string $engine + * @param \Closure $resolver + * @return void + */ + public function register($engine, Closure $resolver) + { + unset($this->resolved[$engine]); + + $this->resolvers[$engine] = $resolver; + } + + /** + * Resolver an engine instance by name. + * + * @param string $engine + * @return \Illuminate\View\Engines\EngineInterface + * @throws \InvalidArgumentException + */ + public function resolve($engine) + { + if (isset($this->resolved[$engine])) { + return $this->resolved[$engine]; + } + + if (isset($this->resolvers[$engine])) { + return $this->resolved[$engine] = call_user_func($this->resolvers[$engine]); + } + + throw new InvalidArgumentException("Engine $engine not found."); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php b/application/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php index f43828e..7bbf3fc 100644 --- a/application/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php +++ b/application/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php @@ -1,68 +1,69 @@ -evaluatePath($path, $data); - } +use Exception; +use Throwable; +use Symfony\Component\Debug\Exception\FatalThrowableError; - /** - * Get the evaluated contents of the view at the given path. - * - * @param string $__path - * @param array $__data - * @return string - */ - protected function evaluatePath($__path, $__data) - { - $obLevel = ob_get_level(); +class PhpEngine implements EngineInterface +{ + /** + * Get the evaluated contents of the view. + * + * @param string $path + * @param array $data + * @return string + */ + public function get($path, array $data = []) + { + return $this->evaluatePath($path, $data); + } - ob_start(); + /** + * Get the evaluated contents of the view at the given path. + * + * @param string $__path + * @param array $__data + * @return string + */ + protected function evaluatePath($__path, $__data) + { + $obLevel = ob_get_level(); - extract($__data); + ob_start(); - // We'll evaluate the contents of the view inside a try/catch block so we can - // flush out any stray output that might get out before an error occurs or - // an exception is thrown. This prevents any partial views from leaking. - try - { - include $__path; - } - catch (Exception $e) - { - $this->handleViewException($e, $obLevel); - } + extract($__data, EXTR_SKIP); - return ltrim(ob_get_clean()); - } + // We'll evaluate the contents of the view inside a try/catch block so we can + // flush out any stray output that might get out before an error occurs or + // an exception is thrown. This prevents any partial views from leaking. + try { + include $__path; + } catch (Exception $e) { + $this->handleViewException($e, $obLevel); + } catch (Throwable $e) { + $this->handleViewException(new FatalThrowableError($e), $obLevel); + } - /** - * Handle a view exception. - * - * @param \Exception $e - * @param int $obLevel - * @return void - * - * @throws $e - */ - protected function handleViewException($e, $obLevel) - { - while (ob_get_level() > $obLevel) - { - ob_end_clean(); - } + return ltrim(ob_get_clean()); + } - throw $e; - } + /** + * Handle a view exception. + * + * @param \Exception $e + * @param int $obLevel + * @return void + * + * @throws $e + */ + protected function handleViewException($e, $obLevel) + { + while (ob_get_level() > $obLevel) { + ob_end_clean(); + } + throw $e; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/View/Expression.php b/application/vendor/laravel/framework/src/Illuminate/View/Expression.php new file mode 100644 index 0000000..4749b23 --- /dev/null +++ b/application/vendor/laravel/framework/src/Illuminate/View/Expression.php @@ -0,0 +1,46 @@ +html = $html; + } + + /** + * Get the the HTML string. + * + * @return string + */ + public function toHtml() + { + return $this->html; + } + + /** + * Get the the HTML string. + * + * @return string + */ + public function __toString() + { + return $this->toHtml(); + } +} diff --git a/application/vendor/laravel/framework/src/Illuminate/View/Factory.php b/application/vendor/laravel/framework/src/Illuminate/View/Factory.php index f5b341c..5c7e7b5 100644 --- a/application/vendor/laravel/framework/src/Illuminate/View/Factory.php +++ b/application/vendor/laravel/framework/src/Illuminate/View/Factory.php @@ -1,899 +1,886 @@ - 'blade', 'php' => 'php'); - - /** - * The view composer events. - * - * @var array - */ - protected $composers = array(); - - /** - * All of the finished, captured sections. - * - * @var array - */ - protected $sections = array(); - - /** - * The stack of in-progress sections. - * - * @var array - */ - protected $sectionStack = array(); - - /** - * The number of active rendering operations. - * - * @var int - */ - protected $renderCount = 0; - - /** - * Create a new view factory instance. - * - * @param \Illuminate\View\Engines\EngineResolver $engines - * @param \Illuminate\View\ViewFinderInterface $finder - * @param \Illuminate\Contracts\Events\Dispatcher $events - * @return void - */ - public function __construct(EngineResolver $engines, ViewFinderInterface $finder, Dispatcher $events) - { - $this->finder = $finder; - $this->events = $events; - $this->engines = $engines; - - $this->share('__env', $this); - } - - /** - * Get the evaluated view contents for the given view. - * - * @param string $path - * @param array $data - * @param array $mergeData - * @return \Illuminate\View\View - */ - public function file($path, $data = array(), $mergeData = array()) - { - $data = array_merge($mergeData, $this->parseData($data)); - - $this->callCreator($view = new View($this, $this->getEngineFromPath($path), $path, $path, $data)); - - return $view; - } - - /** - * Get the evaluated view contents for the given view. - * - * @param string $view - * @param array $data - * @param array $mergeData - * @return \Illuminate\View\View - */ - public function make($view, $data = array(), $mergeData = array()) - { - if (isset($this->aliases[$view])) $view = $this->aliases[$view]; - - $view = $this->normalizeName($view); - - $path = $this->finder->find($view); - - $data = array_merge($mergeData, $this->parseData($data)); - - $this->callCreator($view = new View($this, $this->getEngineFromPath($path), $view, $path, $data)); - - return $view; - } - - /** - * Normalize a view name. - * - * @param string $name - * - * @return string - */ - protected function normalizeName($name) - { - $delimiter = ViewFinderInterface::HINT_PATH_DELIMITER; - - if (strpos($name, $delimiter) === false) - { - return str_replace('/', '.', $name); - } - - list($namespace, $name) = explode($delimiter, $name); - - return $namespace . $delimiter . str_replace('/', '.', $name); - } - - /** - * Parse the given data into a raw array. - * - * @param mixed $data - * @return array - */ - protected function parseData($data) - { - return $data instanceof Arrayable ? $data->toArray() : $data; - } - - /** - * Get the evaluated view contents for a named view. - * - * @param string $view - * @param mixed $data - * @return \Illuminate\View\View - */ - public function of($view, $data = array()) - { - return $this->make($this->names[$view], $data); - } - - /** - * Register a named view. - * - * @param string $view - * @param string $name - * @return void - */ - public function name($view, $name) - { - $this->names[$name] = $view; - } - - /** - * Add an alias for a view. - * - * @param string $view - * @param string $alias - * @return void - */ - public function alias($view, $alias) - { - $this->aliases[$alias] = $view; - } - - /** - * Determine if a given view exists. - * - * @param string $view - * @return bool - */ - public function exists($view) - { - try - { - $this->finder->find($view); - } - catch (InvalidArgumentException $e) - { - return false; - } - - return true; - } - - /** - * Get the rendered contents of a partial from a loop. - * - * @param string $view - * @param array $data - * @param string $iterator - * @param string $empty - * @return string - */ - public function renderEach($view, $data, $iterator, $empty = 'raw|') - { - $result = ''; - - // If is actually data in the array, we will loop through the data and append - // an instance of the partial view to the final result HTML passing in the - // iterated value of this data array, allowing the views to access them. - if (count($data) > 0) - { - foreach ($data as $key => $value) - { - $data = array('key' => $key, $iterator => $value); - - $result .= $this->make($view, $data)->render(); - } - } - - // If there is no data in the array, we will render the contents of the empty - // view. Alternatively, the "empty view" could be a raw string that begins - // with "raw|" for convenience and to let this know that it is a string. - else - { - if (starts_with($empty, 'raw|')) - { - $result = substr($empty, 4); - } - else - { - $result = $this->make($empty)->render(); - } - } - - return $result; - } - - /** - * Get the appropriate view engine for the given path. - * - * @param string $path - * @return \Illuminate\View\Engines\EngineInterface - * - * @throws \InvalidArgumentException - */ - public function getEngineFromPath($path) - { - if ( ! $extension = $this->getExtension($path)) - { - throw new InvalidArgumentException("Unrecognized extension in file: $path"); - } - - $engine = $this->extensions[$extension]; - - return $this->engines->resolve($engine); - } - - /** - * Get the extension used by the view file. - * - * @param string $path - * @return string - */ - protected function getExtension($path) - { - $extensions = array_keys($this->extensions); - - return array_first($extensions, function($key, $value) use ($path) - { - return ends_with($path, $value); - }); - } - - /** - * Add a piece of shared data to the environment. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function share($key, $value = null) - { - if ( ! is_array($key)) return $this->shared[$key] = $value; - - foreach ($key as $innerKey => $innerValue) - { - $this->share($innerKey, $innerValue); - } - } - - /** - * Register a view creator event. - * - * @param array|string $views - * @param \Closure|string $callback - * @return array - */ - public function creator($views, $callback) - { - $creators = array(); - - foreach ((array) $views as $view) - { - $creators[] = $this->addViewEvent($view, $callback, 'creating: '); - } - - return $creators; - } - - /** - * Register multiple view composers via an array. - * - * @param array $composers - * @return array - */ - public function composers(array $composers) - { - $registered = array(); - - foreach ($composers as $callback => $views) - { - $registered = array_merge($registered, $this->composer($views, $callback)); - } - - return $registered; - } - - /** - * Register a view composer event. - * - * @param array|string $views - * @param \Closure|string $callback - * @param int|null $priority - * @return array - */ - public function composer($views, $callback, $priority = null) - { - $composers = array(); - - foreach ((array) $views as $view) - { - $composers[] = $this->addViewEvent($view, $callback, 'composing: ', $priority); - } - - return $composers; - } - - /** - * Add an event for a given view. - * - * @param string $view - * @param \Closure|string $callback - * @param string $prefix - * @param int|null $priority - * @return \Closure - */ - protected function addViewEvent($view, $callback, $prefix = 'composing: ', $priority = null) - { - $view = $this->normalizeName($view); - - if ($callback instanceof Closure) - { - $this->addEventListener($prefix.$view, $callback, $priority); - - return $callback; - } - elseif (is_string($callback)) - { - return $this->addClassEvent($view, $callback, $prefix, $priority); - } - } - - /** - * Register a class based view composer. - * - * @param string $view - * @param string $class - * @param string $prefix - * @param int|null $priority - * @return \Closure - */ - protected function addClassEvent($view, $class, $prefix, $priority = null) - { - $name = $prefix.$view; - - // When registering a class based view "composer", we will simply resolve the - // classes from the application IoC container then call the compose method - // on the instance. This allows for convenient, testable view composers. - $callback = $this->buildClassEventCallback($class, $prefix); - - $this->addEventListener($name, $callback, $priority); - - return $callback; - } - - /** - * Add a listener to the event dispatcher. - * - * @param string $name - * @param \Closure $callback - * @param int $priority - * @return void - */ - protected function addEventListener($name, $callback, $priority = null) - { - if (is_null($priority)) - { - $this->events->listen($name, $callback); - } - else - { - $this->events->listen($name, $callback, $priority); - } - } - - /** - * Build a class based container callback Closure. - * - * @param string $class - * @param string $prefix - * @return \Closure - */ - protected function buildClassEventCallback($class, $prefix) - { - list($class, $method) = $this->parseClassEvent($class, $prefix); - - // Once we have the class and method name, we can build the Closure to resolve - // the instance out of the IoC container and call the method on it with the - // given arguments that are passed to the Closure as the composer's data. - return function() use ($class, $method) - { - $callable = array($this->container->make($class), $method); - - return call_user_func_array($callable, func_get_args()); - }; - } - - /** - * Parse a class based composer name. - * - * @param string $class - * @param string $prefix - * @return array - */ - protected function parseClassEvent($class, $prefix) - { - if (str_contains($class, '@')) - { - return explode('@', $class); - } - - $method = str_contains($prefix, 'composing') ? 'compose' : 'create'; - - return array($class, $method); - } - - /** - * Call the composer for a given view. - * - * @param \Illuminate\View\View $view - * @return void - */ - public function callComposer(View $view) - { - $this->events->fire('composing: '.$view->getName(), array($view)); - } - - /** - * Call the creator for a given view. - * - * @param \Illuminate\View\View $view - * @return void - */ - public function callCreator(View $view) - { - $this->events->fire('creating: '.$view->getName(), array($view)); - } - - /** - * Start injecting content into a section. - * - * @param string $section - * @param string $content - * @return void - */ - public function startSection($section, $content = '') - { - if ($content === '') - { - if (ob_start()) - { - $this->sectionStack[] = $section; - } - } - else - { - $this->extendSection($section, $content); - } - } - - /** - * Inject inline content into a section. - * - * @param string $section - * @param string $content - * @return void - */ - public function inject($section, $content) - { - return $this->startSection($section, $content); - } - - /** - * Stop injecting content into a section and return its contents. - * - * @return string - */ - public function yieldSection() - { - return $this->yieldContent($this->stopSection()); - } - - /** - * Stop injecting content into a section. - * - * @param bool $overwrite - * @return string - */ - public function stopSection($overwrite = false) - { - $last = array_pop($this->sectionStack); - - if ($overwrite) - { - $this->sections[$last] = ob_get_clean(); - } - else - { - $this->extendSection($last, ob_get_clean()); - } - - return $last; - } - - /** - * Stop injecting content into a section and append it. - * - * @return string - */ - public function appendSection() - { - $last = array_pop($this->sectionStack); - - if (isset($this->sections[$last])) - { - $this->sections[$last] .= ob_get_clean(); - } - else - { - $this->sections[$last] = ob_get_clean(); - } - - return $last; - } - - /** - * Append content to a given section. - * - * @param string $section - * @param string $content - * @return void - */ - protected function extendSection($section, $content) - { - if (isset($this->sections[$section])) - { - $content = str_replace('@parent', $content, $this->sections[$section]); - } - - $this->sections[$section] = $content; - } - - /** - * Get the string contents of a section. - * - * @param string $section - * @param string $default - * @return string - */ - public function yieldContent($section, $default = '') - { - $sectionContent = $default; - - if (isset($this->sections[$section])) - { - $sectionContent = $this->sections[$section]; - } - - $sectionContent = str_replace('@@parent', '--parent--holder--', $sectionContent); - - return str_replace( - '--parent--holder--', '@parent', str_replace('@parent', '', $sectionContent) - ); - } - - /** - * Flush all of the section contents. - * - * @return void - */ - public function flushSections() - { - $this->sections = array(); - - $this->sectionStack = array(); - } - - /** - * Flush all of the section contents if done rendering. - * - * @return void - */ - public function flushSectionsIfDoneRendering() - { - if ($this->doneRendering()) $this->flushSections(); - } - - /** - * Increment the rendering counter. - * - * @return void - */ - public function incrementRender() - { - $this->renderCount++; - } - - /** - * Decrement the rendering counter. - * - * @return void - */ - public function decrementRender() - { - $this->renderCount--; - } - - /** - * Check if there are no active render operations. - * - * @return bool - */ - public function doneRendering() - { - return $this->renderCount == 0; - } - - /** - * Add a location to the array of view locations. - * - * @param string $location - * @return void - */ - public function addLocation($location) - { - $this->finder->addLocation($location); - } - - /** - * Add a new namespace to the loader. - * - * @param string $namespace - * @param string|array $hints - * @return void - */ - public function addNamespace($namespace, $hints) - { - $this->finder->addNamespace($namespace, $hints); - } - - /** - * Prepend a new namespace to the loader. - * - * @param string $namespace - * @param string|array $hints - * @return void - */ - public function prependNamespace($namespace, $hints) - { - $this->finder->prependNamespace($namespace, $hints); - } - - /** - * Register a valid view extension and its engine. - * - * @param string $extension - * @param string $engine - * @param \Closure $resolver - * @return void - */ - public function addExtension($extension, $engine, $resolver = null) - { - $this->finder->addExtension($extension); - - if (isset($resolver)) - { - $this->engines->register($engine, $resolver); - } - - unset($this->extensions[$extension]); - - $this->extensions = array_merge(array($extension => $engine), $this->extensions); - } - - /** - * Get the extension to engine bindings. - * - * @return array - */ - public function getExtensions() - { - return $this->extensions; - } - - /** - * Get the engine resolver instance. - * - * @return \Illuminate\View\Engines\EngineResolver - */ - public function getEngineResolver() - { - return $this->engines; - } - - /** - * Get the view finder instance. - * - * @return \Illuminate\View\ViewFinderInterface - */ - public function getFinder() - { - return $this->finder; - } - - /** - * Set the view finder instance. - * - * @param \Illuminate\View\ViewFinderInterface $finder - * @return void - */ - public function setFinder(ViewFinderInterface $finder) - { - $this->finder = $finder; - } - - /** - * Get the event dispatcher instance. - * - * @return \Illuminate\Contracts\Events\Dispatcher - */ - public function getDispatcher() - { - return $this->events; - } - - /** - * Set the event dispatcher instance. - * - * @param \Illuminate\Contracts\Events\Dispatcher - * @return void - */ - public function setDispatcher(Dispatcher $events) - { - $this->events = $events; - } - - /** - * Get the IoC container instance. - * - * @return \Illuminate\Contracts\Container\Container - */ - public function getContainer() - { - return $this->container; - } - - /** - * Set the IoC container instance. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - public function setContainer(Container $container) - { - $this->container = $container; - } - - /** - * Get an item from the shared data. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function shared($key, $default = null) - { - return array_get($this->shared, $key, $default); - } - - /** - * Get all of the shared data for the environment. - * - * @return array - */ - public function getShared() - { - return $this->shared; - } - - /** - * Check if section exists. - * - * @param string $name - * @return bool - */ - public function hasSection($name) - { - return array_key_exists($name, $this->sections); - } - - /** - * Get the entire array of sections. - * - * @return array - */ - public function getSections() - { - return $this->sections; - } - - /** - * Get all of the registered named views in environment. - * - * @return array - */ - public function getNames() - { - return $this->names; - } - +class Factory implements FactoryContract +{ + /** + * The engine implementation. + * + * @var \Illuminate\View\Engines\EngineResolver + */ + protected $engines; + + /** + * The view finder implementation. + * + * @var \Illuminate\View\ViewFinderInterface + */ + protected $finder; + + /** + * The event dispatcher instance. + * + * @var \Illuminate\Contracts\Events\Dispatcher + */ + protected $events; + + /** + * The IoC container instance. + * + * @var \Illuminate\Contracts\Container\Container + */ + protected $container; + + /** + * Data that should be available to all templates. + * + * @var array + */ + protected $shared = []; + + /** + * Array of registered view name aliases. + * + * @var array + */ + protected $aliases = []; + + /** + * All of the registered view names. + * + * @var array + */ + protected $names = []; + + /** + * The extension to engine bindings. + * + * @var array + */ + protected $extensions = ['blade.php' => 'blade', 'php' => 'php']; + + /** + * The view composer events. + * + * @var array + */ + protected $composers = []; + + /** + * All of the finished, captured sections. + * + * @var array + */ + protected $sections = []; + + /** + * The stack of in-progress sections. + * + * @var array + */ + protected $sectionStack = []; + + /** + * The number of active rendering operations. + * + * @var int + */ + protected $renderCount = 0; + + /** + * Create a new view factory instance. + * + * @param \Illuminate\View\Engines\EngineResolver $engines + * @param \Illuminate\View\ViewFinderInterface $finder + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function __construct(EngineResolver $engines, ViewFinderInterface $finder, Dispatcher $events) + { + $this->finder = $finder; + $this->events = $events; + $this->engines = $engines; + + $this->share('__env', $this); + } + + /** + * Get the evaluated view contents for the given view. + * + * @param string $path + * @param array $data + * @param array $mergeData + * @return \Illuminate\Contracts\View\View + */ + public function file($path, $data = [], $mergeData = []) + { + $data = array_merge($mergeData, $this->parseData($data)); + + $this->callCreator($view = new View($this, $this->getEngineFromPath($path), $path, $path, $data)); + + return $view; + } + + /** + * Get the evaluated view contents for the given view. + * + * @param string $view + * @param array $data + * @param array $mergeData + * @return \Illuminate\Contracts\View\View + */ + public function make($view, $data = [], $mergeData = []) + { + if (isset($this->aliases[$view])) { + $view = $this->aliases[$view]; + } + + $view = $this->normalizeName($view); + + $path = $this->finder->find($view); + + $data = array_merge($mergeData, $this->parseData($data)); + + $this->callCreator($view = new View($this, $this->getEngineFromPath($path), $view, $path, $data)); + + return $view; + } + + /** + * Normalize a view name. + * + * @param string $name + * @return string + */ + protected function normalizeName($name) + { + $delimiter = ViewFinderInterface::HINT_PATH_DELIMITER; + + if (strpos($name, $delimiter) === false) { + return str_replace('/', '.', $name); + } + + list($namespace, $name) = explode($delimiter, $name); + + return $namespace.$delimiter.str_replace('/', '.', $name); + } + + /** + * Parse the given data into a raw array. + * + * @param mixed $data + * @return array + */ + protected function parseData($data) + { + return $data instanceof Arrayable ? $data->toArray() : $data; + } + + /** + * Get the evaluated view contents for a named view. + * + * @param string $view + * @param mixed $data + * @return \Illuminate\Contracts\View\View + */ + public function of($view, $data = []) + { + return $this->make($this->names[$view], $data); + } + + /** + * Register a named view. + * + * @param string $view + * @param string $name + * @return void + */ + public function name($view, $name) + { + $this->names[$name] = $view; + } + + /** + * Add an alias for a view. + * + * @param string $view + * @param string $alias + * @return void + */ + public function alias($view, $alias) + { + $this->aliases[$alias] = $view; + } + + /** + * Determine if a given view exists. + * + * @param string $view + * @return bool + */ + public function exists($view) + { + try { + $this->finder->find($view); + } catch (InvalidArgumentException $e) { + return false; + } + + return true; + } + + /** + * Get the rendered contents of a partial from a loop. + * + * @param string $view + * @param array $data + * @param string $iterator + * @param string $empty + * @return string + */ + public function renderEach($view, $data, $iterator, $empty = 'raw|') + { + $result = ''; + + // If is actually data in the array, we will loop through the data and append + // an instance of the partial view to the final result HTML passing in the + // iterated value of this data array, allowing the views to access them. + if (count($data) > 0) { + foreach ($data as $key => $value) { + $data = ['key' => $key, $iterator => $value]; + + $result .= $this->make($view, $data)->render(); + } + } + + // If there is no data in the array, we will render the contents of the empty + // view. Alternatively, the "empty view" could be a raw string that begins + // with "raw|" for convenience and to let this know that it is a string. + else { + if (Str::startsWith($empty, 'raw|')) { + $result = substr($empty, 4); + } else { + $result = $this->make($empty)->render(); + } + } + + return $result; + } + + /** + * Get the appropriate view engine for the given path. + * + * @param string $path + * @return \Illuminate\View\Engines\EngineInterface + * + * @throws \InvalidArgumentException + */ + public function getEngineFromPath($path) + { + if (! $extension = $this->getExtension($path)) { + throw new InvalidArgumentException("Unrecognized extension in file: $path"); + } + + $engine = $this->extensions[$extension]; + + return $this->engines->resolve($engine); + } + + /** + * Get the extension used by the view file. + * + * @param string $path + * @return string + */ + protected function getExtension($path) + { + $extensions = array_keys($this->extensions); + + return Arr::first($extensions, function ($key, $value) use ($path) { + return Str::endsWith($path, '.'.$value); + }); + } + + /** + * Add a piece of shared data to the environment. + * + * @param array|string $key + * @param mixed $value + * @return mixed + */ + public function share($key, $value = null) + { + if (! is_array($key)) { + return $this->shared[$key] = $value; + } + + foreach ($key as $innerKey => $innerValue) { + $this->share($innerKey, $innerValue); + } + } + + /** + * Register a view creator event. + * + * @param array|string $views + * @param \Closure|string $callback + * @return array + */ + public function creator($views, $callback) + { + $creators = []; + + foreach ((array) $views as $view) { + $creators[] = $this->addViewEvent($view, $callback, 'creating: '); + } + + return $creators; + } + + /** + * Register multiple view composers via an array. + * + * @param array $composers + * @return array + */ + public function composers(array $composers) + { + $registered = []; + + foreach ($composers as $callback => $views) { + $registered = array_merge($registered, $this->composer($views, $callback)); + } + + return $registered; + } + + /** + * Register a view composer event. + * + * @param array|string $views + * @param \Closure|string $callback + * @param int|null $priority + * @return array + */ + public function composer($views, $callback, $priority = null) + { + $composers = []; + + foreach ((array) $views as $view) { + $composers[] = $this->addViewEvent($view, $callback, 'composing: ', $priority); + } + + return $composers; + } + + /** + * Add an event for a given view. + * + * @param string $view + * @param \Closure|string $callback + * @param string $prefix + * @param int|null $priority + * @return \Closure|null + */ + protected function addViewEvent($view, $callback, $prefix = 'composing: ', $priority = null) + { + $view = $this->normalizeName($view); + + if ($callback instanceof Closure) { + $this->addEventListener($prefix.$view, $callback, $priority); + + return $callback; + } elseif (is_string($callback)) { + return $this->addClassEvent($view, $callback, $prefix, $priority); + } + } + + /** + * Register a class based view composer. + * + * @param string $view + * @param string $class + * @param string $prefix + * @param int|null $priority + * @return \Closure + */ + protected function addClassEvent($view, $class, $prefix, $priority = null) + { + $name = $prefix.$view; + + // When registering a class based view "composer", we will simply resolve the + // classes from the application IoC container then call the compose method + // on the instance. This allows for convenient, testable view composers. + $callback = $this->buildClassEventCallback($class, $prefix); + + $this->addEventListener($name, $callback, $priority); + + return $callback; + } + + /** + * Add a listener to the event dispatcher. + * + * @param string $name + * @param \Closure $callback + * @param int|null $priority + * @return void + */ + protected function addEventListener($name, $callback, $priority = null) + { + if (is_null($priority)) { + $this->events->listen($name, $callback); + } else { + $this->events->listen($name, $callback, $priority); + } + } + + /** + * Build a class based container callback Closure. + * + * @param string $class + * @param string $prefix + * @return \Closure + */ + protected function buildClassEventCallback($class, $prefix) + { + list($class, $method) = $this->parseClassEvent($class, $prefix); + + // Once we have the class and method name, we can build the Closure to resolve + // the instance out of the IoC container and call the method on it with the + // given arguments that are passed to the Closure as the composer's data. + return function () use ($class, $method) { + $callable = [$this->container->make($class), $method]; + + return call_user_func_array($callable, func_get_args()); + }; + } + + /** + * Parse a class based composer name. + * + * @param string $class + * @param string $prefix + * @return array + */ + protected function parseClassEvent($class, $prefix) + { + if (Str::contains($class, '@')) { + return explode('@', $class); + } + + $method = Str::contains($prefix, 'composing') ? 'compose' : 'create'; + + return [$class, $method]; + } + + /** + * Call the composer for a given view. + * + * @param \Illuminate\Contracts\View\View $view + * @return void + */ + public function callComposer(View $view) + { + $this->events->fire('composing: '.$view->getName(), [$view]); + } + + /** + * Call the creator for a given view. + * + * @param \Illuminate\Contracts\View\View $view + * @return void + */ + public function callCreator(View $view) + { + $this->events->fire('creating: '.$view->getName(), [$view]); + } + + /** + * Start injecting content into a section. + * + * @param string $section + * @param string $content + * @return void + */ + public function startSection($section, $content = '') + { + if ($content === '') { + if (ob_start()) { + $this->sectionStack[] = $section; + } + } else { + $this->extendSection($section, $content); + } + } + + /** + * Inject inline content into a section. + * + * @param string $section + * @param string $content + * @return void + */ + public function inject($section, $content) + { + return $this->startSection($section, $content); + } + + /** + * Stop injecting content into a section and return its contents. + * + * @return string + */ + public function yieldSection() + { + if (empty($this->sectionStack)) { + return ''; + } + + return $this->yieldContent($this->stopSection()); + } + + /** + * Stop injecting content into a section. + * + * @param bool $overwrite + * @return string + * @throws \InvalidArgumentException + */ + public function stopSection($overwrite = false) + { + if (empty($this->sectionStack)) { + throw new InvalidArgumentException('Cannot end a section without first starting one.'); + } + + $last = array_pop($this->sectionStack); + + if ($overwrite) { + $this->sections[$last] = ob_get_clean(); + } else { + $this->extendSection($last, ob_get_clean()); + } + + return $last; + } + + /** + * Stop injecting content into a section and append it. + * + * @return string + * @throws \InvalidArgumentException + */ + public function appendSection() + { + if (empty($this->sectionStack)) { + throw new InvalidArgumentException('Cannot end a section without first starting one.'); + } + + $last = array_pop($this->sectionStack); + + if (isset($this->sections[$last])) { + $this->sections[$last] .= ob_get_clean(); + } else { + $this->sections[$last] = ob_get_clean(); + } + + return $last; + } + + /** + * Append content to a given section. + * + * @param string $section + * @param string $content + * @return void + */ + protected function extendSection($section, $content) + { + if (isset($this->sections[$section])) { + $content = str_replace('@parent', $content, $this->sections[$section]); + } + + $this->sections[$section] = $content; + } + + /** + * Get the string contents of a section. + * + * @param string $section + * @param string $default + * @return string + */ + public function yieldContent($section, $default = '') + { + $sectionContent = $default; + + if (isset($this->sections[$section])) { + $sectionContent = $this->sections[$section]; + } + + $sectionContent = str_replace('@@parent', '--parent--holder--', $sectionContent); + + return str_replace( + '--parent--holder--', '@parent', str_replace('@parent', '', $sectionContent) + ); + } + + /** + * Flush all of the section contents. + * + * @return void + */ + public function flushSections() + { + $this->renderCount = 0; + + $this->sections = []; + + $this->sectionStack = []; + } + + /** + * Flush all of the section contents if done rendering. + * + * @return void + */ + public function flushSectionsIfDoneRendering() + { + if ($this->doneRendering()) { + $this->flushSections(); + } + } + + /** + * Increment the rendering counter. + * + * @return void + */ + public function incrementRender() + { + $this->renderCount++; + } + + /** + * Decrement the rendering counter. + * + * @return void + */ + public function decrementRender() + { + $this->renderCount--; + } + + /** + * Check if there are no active render operations. + * + * @return bool + */ + public function doneRendering() + { + return $this->renderCount == 0; + } + + /** + * Add a location to the array of view locations. + * + * @param string $location + * @return void + */ + public function addLocation($location) + { + $this->finder->addLocation($location); + } + + /** + * Add a new namespace to the loader. + * + * @param string $namespace + * @param string|array $hints + * @return void + */ + public function addNamespace($namespace, $hints) + { + $this->finder->addNamespace($namespace, $hints); + } + + /** + * Prepend a new namespace to the loader. + * + * @param string $namespace + * @param string|array $hints + * @return void + */ + public function prependNamespace($namespace, $hints) + { + $this->finder->prependNamespace($namespace, $hints); + } + + /** + * Register a valid view extension and its engine. + * + * @param string $extension + * @param string $engine + * @param \Closure $resolver + * @return void + */ + public function addExtension($extension, $engine, $resolver = null) + { + $this->finder->addExtension($extension); + + if (isset($resolver)) { + $this->engines->register($engine, $resolver); + } + + unset($this->extensions[$extension]); + + $this->extensions = array_merge([$extension => $engine], $this->extensions); + } + + /** + * Get the extension to engine bindings. + * + * @return array + */ + public function getExtensions() + { + return $this->extensions; + } + + /** + * Get the engine resolver instance. + * + * @return \Illuminate\View\Engines\EngineResolver + */ + public function getEngineResolver() + { + return $this->engines; + } + + /** + * Get the view finder instance. + * + * @return \Illuminate\View\ViewFinderInterface + */ + public function getFinder() + { + return $this->finder; + } + + /** + * Set the view finder instance. + * + * @param \Illuminate\View\ViewFinderInterface $finder + * @return void + */ + public function setFinder(ViewFinderInterface $finder) + { + $this->finder = $finder; + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getDispatcher() + { + return $this->events; + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function setDispatcher(Dispatcher $events) + { + $this->events = $events; + } + + /** + * Get the IoC container instance. + * + * @return \Illuminate\Contracts\Container\Container + */ + public function getContainer() + { + return $this->container; + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function setContainer(Container $container) + { + $this->container = $container; + } + + /** + * Get an item from the shared data. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function shared($key, $default = null) + { + return Arr::get($this->shared, $key, $default); + } + + /** + * Get all of the shared data for the environment. + * + * @return array + */ + public function getShared() + { + return $this->shared; + } + + /** + * Check if section exists. + * + * @param string $name + * @return bool + */ + public function hasSection($name) + { + return array_key_exists($name, $this->sections); + } + + /** + * Get the entire array of sections. + * + * @return array + */ + public function getSections() + { + return $this->sections; + } + + /** + * Get all of the registered named views in environment. + * + * @return array + */ + public function getNames() + { + return $this->names; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php b/application/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php index 94efedb..1c976b3 100644 --- a/application/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php +++ b/application/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php @@ -1,274 +1,265 @@ -files = $files; - $this->paths = $paths; - - if (isset($extensions)) - { - $this->extensions = $extensions; - } - } - - /** - * Get the fully qualified location of the view. - * - * @param string $name - * @return string - */ - public function find($name) - { - if (isset($this->views[$name])) return $this->views[$name]; - - if ($this->hasHintInformation($name = trim($name))) - { - return $this->views[$name] = $this->findNamedPathView($name); - } - - return $this->views[$name] = $this->findInPaths($name, $this->paths); - } - - /** - * Get the path to a template with a named path. - * - * @param string $name - * @return string - */ - protected function findNamedPathView($name) - { - list($namespace, $view) = $this->getNamespaceSegments($name); - - return $this->findInPaths($view, $this->hints[$namespace]); - } - - /** - * Get the segments of a template with a named path. - * - * @param string $name - * @return array - * - * @throws \InvalidArgumentException - */ - protected function getNamespaceSegments($name) - { - $segments = explode(static::HINT_PATH_DELIMITER, $name); - - if (count($segments) != 2) - { - throw new InvalidArgumentException("View [$name] has an invalid name."); - } - - if ( ! isset($this->hints[$segments[0]])) - { - throw new InvalidArgumentException("No hint path defined for [{$segments[0]}]."); - } - - return $segments; - } - - /** - * Find the given view in the list of paths. - * - * @param string $name - * @param array $paths - * @return string - * - * @throws \InvalidArgumentException - */ - protected function findInPaths($name, $paths) - { - foreach ((array) $paths as $path) - { - foreach ($this->getPossibleViewFiles($name) as $file) - { - if ($this->files->exists($viewPath = $path.'/'.$file)) - { - return $viewPath; - } - } - } - - throw new InvalidArgumentException("View [$name] not found."); - } - - /** - * Get an array of possible view files. - * - * @param string $name - * @return array - */ - protected function getPossibleViewFiles($name) - { - return array_map(function($extension) use ($name) - { - return str_replace('.', '/', $name).'.'.$extension; - - }, $this->extensions); - } - - /** - * Add a location to the finder. - * - * @param string $location - * @return void - */ - public function addLocation($location) - { - $this->paths[] = $location; - } - - /** - * Add a namespace hint to the finder. - * - * @param string $namespace - * @param string|array $hints - * @return void - */ - public function addNamespace($namespace, $hints) - { - $hints = (array) $hints; - - if (isset($this->hints[$namespace])) - { - $hints = array_merge($this->hints[$namespace], $hints); - } - - $this->hints[$namespace] = $hints; - } - - /** - * Prepend a namespace hint to the finder. - * - * @param string $namespace - * @param string|array $hints - * @return void - */ - public function prependNamespace($namespace, $hints) - { - $hints = (array) $hints; - - if (isset($this->hints[$namespace])) - { - $hints = array_merge($hints, $this->hints[$namespace]); - } - - $this->hints[$namespace] = $hints; - } - - /** - * Register an extension with the view finder. - * - * @param string $extension - * @return void - */ - public function addExtension($extension) - { - if (($index = array_search($extension, $this->extensions)) !== false) - { - unset($this->extensions[$index]); - } - - array_unshift($this->extensions, $extension); - } - - /** - * Returns whether or not the view specify a hint information. - * - * @param string $name - * @return bool - */ - public function hasHintInformation($name) - { - return strpos($name, static::HINT_PATH_DELIMITER) > 0; - } - - /** - * Get the filesystem instance. - * - * @return \Illuminate\Filesystem\Filesystem - */ - public function getFilesystem() - { - return $this->files; - } - - /** - * Get the active view paths. - * - * @return array - */ - public function getPaths() - { - return $this->paths; - } - - /** - * Get the namespace to file path hints. - * - * @return array - */ - public function getHints() - { - return $this->hints; - } - - /** - * Get registered extensions. - * - * @return array - */ - public function getExtensions() - { - return $this->extensions; - } - +class FileViewFinder implements ViewFinderInterface +{ + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * The array of active view paths. + * + * @var array + */ + protected $paths; + + /** + * The array of views that have been located. + * + * @var array + */ + protected $views = []; + + /** + * The namespace to file path hints. + * + * @var array + */ + protected $hints = []; + + /** + * Register a view extension with the finder. + * + * @var array + */ + protected $extensions = ['blade.php', 'php']; + + /** + * Create a new file view loader instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @param array $paths + * @param array $extensions + * @return void + */ + public function __construct(Filesystem $files, array $paths, array $extensions = null) + { + $this->files = $files; + $this->paths = $paths; + + if (isset($extensions)) { + $this->extensions = $extensions; + } + } + + /** + * Get the fully qualified location of the view. + * + * @param string $name + * @return string + */ + public function find($name) + { + if (isset($this->views[$name])) { + return $this->views[$name]; + } + + if ($this->hasHintInformation($name = trim($name))) { + return $this->views[$name] = $this->findNamedPathView($name); + } + + return $this->views[$name] = $this->findInPaths($name, $this->paths); + } + + /** + * Get the path to a template with a named path. + * + * @param string $name + * @return string + */ + protected function findNamedPathView($name) + { + list($namespace, $view) = $this->getNamespaceSegments($name); + + return $this->findInPaths($view, $this->hints[$namespace]); + } + + /** + * Get the segments of a template with a named path. + * + * @param string $name + * @return array + * + * @throws \InvalidArgumentException + */ + protected function getNamespaceSegments($name) + { + $segments = explode(static::HINT_PATH_DELIMITER, $name); + + if (count($segments) != 2) { + throw new InvalidArgumentException("View [$name] has an invalid name."); + } + + if (! isset($this->hints[$segments[0]])) { + throw new InvalidArgumentException("No hint path defined for [{$segments[0]}]."); + } + + return $segments; + } + + /** + * Find the given view in the list of paths. + * + * @param string $name + * @param array $paths + * @return string + * + * @throws \InvalidArgumentException + */ + protected function findInPaths($name, $paths) + { + foreach ((array) $paths as $path) { + foreach ($this->getPossibleViewFiles($name) as $file) { + if ($this->files->exists($viewPath = $path.'/'.$file)) { + return $viewPath; + } + } + } + + throw new InvalidArgumentException("View [$name] not found."); + } + + /** + * Get an array of possible view files. + * + * @param string $name + * @return array + */ + protected function getPossibleViewFiles($name) + { + return array_map(function ($extension) use ($name) { + return str_replace('.', '/', $name).'.'.$extension; + }, $this->extensions); + } + + /** + * Add a location to the finder. + * + * @param string $location + * @return void + */ + public function addLocation($location) + { + $this->paths[] = $location; + } + + /** + * Add a namespace hint to the finder. + * + * @param string $namespace + * @param string|array $hints + * @return void + */ + public function addNamespace($namespace, $hints) + { + $hints = (array) $hints; + + if (isset($this->hints[$namespace])) { + $hints = array_merge($this->hints[$namespace], $hints); + } + + $this->hints[$namespace] = $hints; + } + + /** + * Prepend a namespace hint to the finder. + * + * @param string $namespace + * @param string|array $hints + * @return void + */ + public function prependNamespace($namespace, $hints) + { + $hints = (array) $hints; + + if (isset($this->hints[$namespace])) { + $hints = array_merge($hints, $this->hints[$namespace]); + } + + $this->hints[$namespace] = $hints; + } + + /** + * Register an extension with the view finder. + * + * @param string $extension + * @return void + */ + public function addExtension($extension) + { + if (($index = array_search($extension, $this->extensions)) !== false) { + unset($this->extensions[$index]); + } + + array_unshift($this->extensions, $extension); + } + + /** + * Returns whether or not the view specify a hint information. + * + * @param string $name + * @return bool + */ + public function hasHintInformation($name) + { + return strpos($name, static::HINT_PATH_DELIMITER) > 0; + } + + /** + * Get the filesystem instance. + * + * @return \Illuminate\Filesystem\Filesystem + */ + public function getFilesystem() + { + return $this->files; + } + + /** + * Get the active view paths. + * + * @return array + */ + public function getPaths() + { + return $this->paths; + } + + /** + * Get the namespace to file path hints. + * + * @return array + */ + public function getHints() + { + return $this->hints; + } + + /** + * Get registered extensions. + * + * @return array + */ + public function getExtensions() + { + return $this->extensions; + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php b/application/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php index 956360c..812cf61 100644 --- a/application/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php +++ b/application/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php @@ -1,58 +1,51 @@ -view = $view; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - // If the current session has an "errors" variable bound to it, we will share - // its value with all view instances so the views can easily access errors - // without having to bind. An empty bag is set when there aren't errors. - if ($request->session()->has('errors')) - { - $this->view->share( - 'errors', $request->session()->get('errors') - ); - } - - // Putting the errors in the view for every view allows the developer to just - // assume that some errors are always available, which is convenient since - // they don't have to continually run checks for the presence of errors. - else - { - $this->view->share('errors', new ViewErrorBag); - } - - return $next($request); - } - +class ShareErrorsFromSession +{ + /** + * The view factory implementation. + * + * @var \Illuminate\Contracts\View\Factory + */ + protected $view; + + /** + * Create a new error binder instance. + * + * @param \Illuminate\Contracts\View\Factory $view + * @return void + */ + public function __construct(ViewFactory $view) + { + $this->view = $view; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + // If the current session has an "errors" variable bound to it, we will share + // its value with all view instances so the views can easily access errors + // without having to bind. An empty bag is set when there aren't errors. + $this->view->share( + 'errors', $request->session()->get('errors', new ViewErrorBag) + ); + + // Putting the errors in the view for every view allows the developer to just + // assume that some errors are always available, which is convenient since + // they don't have to continually run checks for the presence of errors. + + return $next($request); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/View/View.php b/application/vendor/laravel/framework/src/Illuminate/View/View.php index c7aa1df..c748ce4 100644 --- a/application/vendor/laravel/framework/src/Illuminate/View/View.php +++ b/application/vendor/laravel/framework/src/Illuminate/View/View.php @@ -1,403 +1,404 @@ -view = $view; - $this->path = $path; - $this->engine = $engine; - $this->factory = $factory; - - $this->data = $data instanceof Arrayable ? $data->toArray() : (array) $data; - } - - /** - * Get the string contents of the view. - * - * @param \Closure|null $callback - * @return string - */ - public function render(Closure $callback = null) - { - $contents = $this->renderContents(); - - $response = isset($callback) ? $callback($this, $contents) : null; - - // Once we have the contents of the view, we will flush the sections if we are - // done rendering all views so that there is nothing left hanging over when - // another view gets rendered in the future by the application developer. - $this->factory->flushSectionsIfDoneRendering(); - - return $response ?: $contents; - } - - /** - * Get the contents of the view instance. - * - * @return string - */ - protected function renderContents() - { - // We will keep track of the amount of views being rendered so we can flush - // the section after the complete rendering operation is done. This will - // clear out the sections for any separate views that may be rendered. - $this->factory->incrementRender(); - - $this->factory->callComposer($this); - - $contents = $this->getContents(); - - // Once we've finished rendering the view, we'll decrement the render count - // so that each sections get flushed out next time a view is created and - // no old sections are staying around in the memory of an environment. - $this->factory->decrementRender(); - - return $contents; - } - - /** - * Get the sections of the rendered view. - * - * @return array - */ - public function renderSections() - { - $env = $this->factory; - - return $this->render(function($view) use ($env) - { - return $env->getSections(); - }); - } - - /** - * Get the evaluated contents of the view. - * - * @return string - */ - protected function getContents() - { - return $this->engine->get($this->path, $this->gatherData()); - } - - /** - * Get the data bound to the view instance. - * - * @return array - */ - protected function gatherData() - { - $data = array_merge($this->factory->getShared(), $this->data); - - foreach ($data as $key => $value) - { - if ($value instanceof Renderable) - { - $data[$key] = $value->render(); - } - } - - return $data; - } - - /** - * Add a piece of data to the view. - * - * @param string|array $key - * @param mixed $value - * @return $this - */ - public function with($key, $value = null) - { - if (is_array($key)) - { - $this->data = array_merge($this->data, $key); - } - else - { - $this->data[$key] = $value; - } - - return $this; - } - - /** - * Add a view instance to the view data. - * - * @param string $key - * @param string $view - * @param array $data - * @return $this - */ - public function nest($key, $view, array $data = array()) - { - return $this->with($key, $this->factory->make($view, $data)); - } - - /** - * Add validation errors to the view. - * - * @param \Illuminate\Contracts\Support\MessageProvider|array $provider - * @return $this - */ - public function withErrors($provider) - { - if ($provider instanceof MessageProvider) - { - $this->with('errors', $provider->getMessageBag()); - } - else - { - $this->with('errors', new MessageBag((array) $provider)); - } - - return $this; - } - - /** - * Get the view factory instance. - * - * @return \Illuminate\View\Factory - */ - public function getFactory() - { - return $this->factory; - } - - /** - * Get the view's rendering engine. - * - * @return \Illuminate\View\Engines\EngineInterface - */ - public function getEngine() - { - return $this->engine; - } - - /** - * Get the name of the view. - * - * @return string - */ - public function name() - { - return $this->getName(); - } - - /** - * Get the name of the view. - * - * @return string - */ - public function getName() - { - return $this->view; - } - - /** - * Get the array of view data. - * - * @return array - */ - public function getData() - { - return $this->data; - } - - /** - * Get the path to the view file. - * - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Set the path to the view. - * - * @param string $path - * @return void - */ - public function setPath($path) - { - $this->path = $path; - } - - /** - * Determine if a piece of data is bound. - * - * @param string $key - * @return bool - */ - public function offsetExists($key) - { - return array_key_exists($key, $this->data); - } - - /** - * Get a piece of bound data to the view. - * - * @param string $key - * @return mixed - */ - public function offsetGet($key) - { - return $this->data[$key]; - } - - /** - * Set a piece of data on the view. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value) - { - $this->with($key, $value); - } - - /** - * Unset a piece of data from the view. - * - * @param string $key - * @return void - */ - public function offsetUnset($key) - { - unset($this->data[$key]); - } - - /** - * Get a piece of data from the view. - * - * @param string $key - * @return mixed - */ - public function &__get($key) - { - return $this->data[$key]; - } - - /** - * Set a piece of data on the view. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function __set($key, $value) - { - $this->with($key, $value); - } - - /** - * Check if a piece of data is bound to the view. - * - * @param string $key - * @return bool - */ - public function __isset($key) - { - return isset($this->data[$key]); - } - - /** - * Remove a piece of bound data from the view. - * - * @param string $key - * @return bool - */ - public function __unset($key) - { - unset($this->data[$key]); - } - - /** - * Dynamically bind parameters to the view. - * - * @param string $method - * @param array $parameters - * @return \Illuminate\View\View - * - * @throws \BadMethodCallException - */ - public function __call($method, $parameters) - { - if (starts_with($method, 'with')) - { - return $this->with(snake_case(substr($method, 4)), $parameters[0]); - } - - throw new BadMethodCallException("Method [$method] does not exist on view."); - } - - /** - * Get the string contents of the view. - * - * @return string - */ - public function __toString() - { - return $this->render(); - } - +class View implements ArrayAccess, ViewContract +{ + /** + * The view factory instance. + * + * @var \Illuminate\View\Factory + */ + protected $factory; + + /** + * The engine implementation. + * + * @var \Illuminate\View\Engines\EngineInterface + */ + protected $engine; + + /** + * The name of the view. + * + * @var string + */ + protected $view; + + /** + * The array of view data. + * + * @var array + */ + protected $data; + + /** + * The path to the view file. + * + * @var string + */ + protected $path; + + /** + * Create a new view instance. + * + * @param \Illuminate\View\Factory $factory + * @param \Illuminate\View\Engines\EngineInterface $engine + * @param string $view + * @param string $path + * @param array $data + * @return void + */ + public function __construct(Factory $factory, EngineInterface $engine, $view, $path, $data = []) + { + $this->view = $view; + $this->path = $path; + $this->engine = $engine; + $this->factory = $factory; + + $this->data = $data instanceof Arrayable ? $data->toArray() : (array) $data; + } + + /** + * Get the string contents of the view. + * + * @param callable|null $callback + * @return string + */ + public function render(callable $callback = null) + { + try { + $contents = $this->renderContents(); + + $response = isset($callback) ? call_user_func($callback, $this, $contents) : null; + + // Once we have the contents of the view, we will flush the sections if we are + // done rendering all views so that there is nothing left hanging over when + // another view gets rendered in the future by the application developer. + $this->factory->flushSectionsIfDoneRendering(); + + return ! is_null($response) ? $response : $contents; + } catch (Exception $e) { + $this->factory->flushSections(); + + throw $e; + } catch (Throwable $e) { + $this->factory->flushSections(); + + throw $e; + } + } + + /** + * Get the contents of the view instance. + * + * @return string + */ + protected function renderContents() + { + // We will keep track of the amount of views being rendered so we can flush + // the section after the complete rendering operation is done. This will + // clear out the sections for any separate views that may be rendered. + $this->factory->incrementRender(); + + $this->factory->callComposer($this); + + $contents = $this->getContents(); + + // Once we've finished rendering the view, we'll decrement the render count + // so that each sections get flushed out next time a view is created and + // no old sections are staying around in the memory of an environment. + $this->factory->decrementRender(); + + return $contents; + } + + /** + * Get the sections of the rendered view. + * + * @return array + */ + public function renderSections() + { + return $this->render(function () { + return $this->factory->getSections(); + }); + } + + /** + * Get the evaluated contents of the view. + * + * @return string + */ + protected function getContents() + { + return $this->engine->get($this->path, $this->gatherData()); + } + + /** + * Get the data bound to the view instance. + * + * @return array + */ + protected function gatherData() + { + $data = array_merge($this->factory->getShared(), $this->data); + + foreach ($data as $key => $value) { + if ($value instanceof Renderable) { + $data[$key] = $value->render(); + } + } + + return $data; + } + + /** + * Add a piece of data to the view. + * + * @param string|array $key + * @param mixed $value + * @return $this + */ + public function with($key, $value = null) + { + if (is_array($key)) { + $this->data = array_merge($this->data, $key); + } else { + $this->data[$key] = $value; + } + + return $this; + } + + /** + * Add a view instance to the view data. + * + * @param string $key + * @param string $view + * @param array $data + * @return $this + */ + public function nest($key, $view, array $data = []) + { + return $this->with($key, $this->factory->make($view, $data)); + } + + /** + * Add validation errors to the view. + * + * @param \Illuminate\Contracts\Support\MessageProvider|array $provider + * @return $this + */ + public function withErrors($provider) + { + if ($provider instanceof MessageProvider) { + $this->with('errors', $provider->getMessageBag()); + } else { + $this->with('errors', new MessageBag((array) $provider)); + } + + return $this; + } + + /** + * Get the view factory instance. + * + * @return \Illuminate\View\Factory + */ + public function getFactory() + { + return $this->factory; + } + + /** + * Get the view's rendering engine. + * + * @return \Illuminate\View\Engines\EngineInterface + */ + public function getEngine() + { + return $this->engine; + } + + /** + * Get the name of the view. + * + * @return string + */ + public function name() + { + return $this->getName(); + } + + /** + * Get the name of the view. + * + * @return string + */ + public function getName() + { + return $this->view; + } + + /** + * Get the array of view data. + * + * @return array + */ + public function getData() + { + return $this->data; + } + + /** + * Get the path to the view file. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set the path to the view. + * + * @param string $path + * @return void + */ + public function setPath($path) + { + $this->path = $path; + } + + /** + * Determine if a piece of data is bound. + * + * @param string $key + * @return bool + */ + public function offsetExists($key) + { + return array_key_exists($key, $this->data); + } + + /** + * Get a piece of bound data to the view. + * + * @param string $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->data[$key]; + } + + /** + * Set a piece of data on the view. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->with($key, $value); + } + + /** + * Unset a piece of data from the view. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + unset($this->data[$key]); + } + + /** + * Get a piece of data from the view. + * + * @param string $key + * @return mixed + */ + public function &__get($key) + { + return $this->data[$key]; + } + + /** + * Set a piece of data on the view. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this->with($key, $value); + } + + /** + * Check if a piece of data is bound to the view. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return isset($this->data[$key]); + } + + /** + * Remove a piece of bound data from the view. + * + * @param string $key + * @return bool + */ + public function __unset($key) + { + unset($this->data[$key]); + } + + /** + * Dynamically bind parameters to the view. + * + * @param string $method + * @param array $parameters + * @return \Illuminate\View\View + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (Str::startsWith($method, 'with')) { + return $this->with(Str::snake(substr($method, 4)), $parameters[0]); + } + + throw new BadMethodCallException("Method [$method] does not exist on view."); + } + + /** + * Get the string contents of the view. + * + * @return string + */ + public function __toString() + { + return $this->render(); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/View/ViewFinderInterface.php b/application/vendor/laravel/framework/src/Illuminate/View/ViewFinderInterface.php index df287f2..4af1f9d 100644 --- a/application/vendor/laravel/framework/src/Illuminate/View/ViewFinderInterface.php +++ b/application/vendor/laravel/framework/src/Illuminate/View/ViewFinderInterface.php @@ -1,54 +1,55 @@ -registerEngineResolver(); - - $this->registerViewFinder(); - - $this->registerFactory(); - } - - /** - * Register the engine resolver instance. - * - * @return void - */ - public function registerEngineResolver() - { - $this->app->singleton('view.engine.resolver', function() - { - $resolver = new EngineResolver; - - // Next we will register the various engines with the resolver so that the - // environment can resolve the engines it needs for various views based - // on the extension of view files. We call a method for each engines. - foreach (array('php', 'blade') as $engine) - { - $this->{'register'.ucfirst($engine).'Engine'}($resolver); - } - - return $resolver; - }); - } - - /** - * Register the PHP engine implementation. - * - * @param \Illuminate\View\Engines\EngineResolver $resolver - * @return void - */ - public function registerPhpEngine($resolver) - { - $resolver->register('php', function() { return new PhpEngine; }); - } - - /** - * Register the Blade engine implementation. - * - * @param \Illuminate\View\Engines\EngineResolver $resolver - * @return void - */ - public function registerBladeEngine($resolver) - { - $app = $this->app; - - // The Compiler engine requires an instance of the CompilerInterface, which in - // this case will be the Blade compiler, so we'll first create the compiler - // instance to pass into the engine so it can compile the views properly. - $app->singleton('blade.compiler', function($app) - { - $cache = $app['config']['view.compiled']; - - return new BladeCompiler($app['files'], $cache); - }); - - $resolver->register('blade', function() use ($app) - { - return new CompilerEngine($app['blade.compiler'], $app['files']); - }); - } - - /** - * Register the view finder implementation. - * - * @return void - */ - public function registerViewFinder() - { - $this->app->bind('view.finder', function($app) - { - $paths = $app['config']['view.paths']; - - return new FileViewFinder($app['files'], $paths); - }); - } - - /** - * Register the view environment. - * - * @return void - */ - public function registerFactory() - { - $this->app->singleton('view', function($app) - { - // Next we need to grab the engine resolver instance that will be used by the - // environment. The resolver will be used by an environment to get each of - // the various engine implementations such as plain PHP or Blade engine. - $resolver = $app['view.engine.resolver']; - - $finder = $app['view.finder']; - - $env = new Factory($resolver, $finder, $app['events']); - - // We will also set the container instance on this view environment since the - // view composers may be classes registered in the container, which allows - // for great testable, flexible composers for the application developer. - $env->setContainer($app); - - $env->share('app', $app); - - return $env; - }); - } - +class ViewServiceProvider extends ServiceProvider +{ + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerEngineResolver(); + + $this->registerViewFinder(); + + $this->registerFactory(); + } + + /** + * Register the engine resolver instance. + * + * @return void + */ + public function registerEngineResolver() + { + $this->app->singleton('view.engine.resolver', function () { + $resolver = new EngineResolver; + + // Next we will register the various engines with the resolver so that the + // environment can resolve the engines it needs for various views based + // on the extension of view files. We call a method for each engines. + foreach (['php', 'blade'] as $engine) { + $this->{'register'.ucfirst($engine).'Engine'}($resolver); + } + + return $resolver; + }); + } + + /** + * Register the PHP engine implementation. + * + * @param \Illuminate\View\Engines\EngineResolver $resolver + * @return void + */ + public function registerPhpEngine($resolver) + { + $resolver->register('php', function () { + return new PhpEngine; + }); + } + + /** + * Register the Blade engine implementation. + * + * @param \Illuminate\View\Engines\EngineResolver $resolver + * @return void + */ + public function registerBladeEngine($resolver) + { + $app = $this->app; + + // The Compiler engine requires an instance of the CompilerInterface, which in + // this case will be the Blade compiler, so we'll first create the compiler + // instance to pass into the engine so it can compile the views properly. + $app->singleton('blade.compiler', function ($app) { + $cache = $app['config']['view.compiled']; + + return new BladeCompiler($app['files'], $cache); + }); + + $resolver->register('blade', function () use ($app) { + return new CompilerEngine($app['blade.compiler']); + }); + } + + /** + * Register the view finder implementation. + * + * @return void + */ + public function registerViewFinder() + { + $this->app->bind('view.finder', function ($app) { + $paths = $app['config']['view.paths']; + + return new FileViewFinder($app['files'], $paths); + }); + } + + /** + * Register the view environment. + * + * @return void + */ + public function registerFactory() + { + $this->app->singleton('view', function ($app) { + // Next we need to grab the engine resolver instance that will be used by the + // environment. The resolver will be used by an environment to get each of + // the various engine implementations such as plain PHP or Blade engine. + $resolver = $app['view.engine.resolver']; + + $finder = $app['view.finder']; + + $env = new Factory($resolver, $finder, $app['events']); + + // We will also set the container instance on this view environment since the + // view composers may be classes registered in the container, which allows + // for great testable, flexible composers for the application developer. + $env->setContainer($app); + + $env->share('app', $app); + + return $env; + }); + } } diff --git a/application/vendor/laravel/framework/src/Illuminate/View/composer.json b/application/vendor/laravel/framework/src/Illuminate/View/composer.json index cdcda58..4eb012b 100644 --- a/application/vendor/laravel/framework/src/Illuminate/View/composer.json +++ b/application/vendor/laravel/framework/src/Illuminate/View/composer.json @@ -14,11 +14,13 @@ } ], "require": { - "php": ">=5.4.0", - "illuminate/container": "5.0.*", - "illuminate/contracts": "5.0.*", - "illuminate/filesystem": "5.0.*", - "illuminate/support": "5.0.*" + "php": ">=5.5.9", + "illuminate/container": "5.1.*", + "illuminate/contracts": "5.1.*", + "illuminate/events": "5.1.*", + "illuminate/filesystem": "5.1.*", + "illuminate/support": "5.1.*", + "symfony/debug": "2.7.*" }, "autoload": { "psr-4": { @@ -27,7 +29,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "5.1-dev" } }, "minimum-stability": "dev" diff --git a/application/vendor/laravel/framework/CONTRIBUTING.md b/application/vendor/laravelcollective/html/CONTRIBUTING.md similarity index 100% rename from application/vendor/laravel/framework/CONTRIBUTING.md rename to application/vendor/laravelcollective/html/CONTRIBUTING.md diff --git a/application/vendor/laravelcollective/html/LICENSE.txt b/application/vendor/laravelcollective/html/LICENSE.txt new file mode 100644 index 0000000..40cd6a3 --- /dev/null +++ b/application/vendor/laravelcollective/html/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/application/vendor/laravelcollective/html/composer.json b/application/vendor/laravelcollective/html/composer.json new file mode 100644 index 0000000..8d70bd5 --- /dev/null +++ b/application/vendor/laravelcollective/html/composer.json @@ -0,0 +1,33 @@ +{ + "name": "laravelcollective/html", + "license": "MIT", + "authors": [ + { + "name": "Adam Engebretson", + "email": "adam@laravelcollective.com" + }, + { + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" + } + ], + "require": { + "php": ">=5.5.9", + "illuminate/http": "5.1.*", + "illuminate/routing": "5.1.*", + "illuminate/session": "5.1.*", + "illuminate/support": "5.1.*" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "phpunit/phpunit": "~4.0" + }, + "autoload": { + "psr-4": { + "Collective\\Html\\": "src/" + }, + "files": [ + "src/helpers.php" + ] + } +} diff --git a/application/vendor/laravelcollective/html/readme.md b/application/vendor/laravelcollective/html/readme.md new file mode 100644 index 0000000..4d3d9e1 --- /dev/null +++ b/application/vendor/laravelcollective/html/readme.md @@ -0,0 +1,9 @@ +# Forms & HTML + +[![Build Status](https://travis-ci.org/LaravelCollective/html.svg)](https://travis-ci.org/LaravelCollective/html) +[![Total Downloads](https://poser.pugx.org/LaravelCollective/html/downloads)](https://packagist.org/packages/laravelcollective/html) +[![Latest Stable Version](https://poser.pugx.org/LaravelCollective/html/v/stable.svg)](https://packagist.org/packages/laravelcollective/html) +[![Latest Unstable Version](https://poser.pugx.org/LaravelCollective/html/v/unstable.svg)](https://packagist.org/packages/laravelcollective/html) +[![License](https://poser.pugx.org/LaravelCollective/html/license.svg)](https://packagist.org/packages/laravelcollective/html) + +Official documentation for Forms & Html for The Laravel Framework can be found at the [LaravelCollective](http://laravelcollective.com) website. diff --git a/application/vendor/laravelcollective/html/src/FormBuilder.php b/application/vendor/laravelcollective/html/src/FormBuilder.php new file mode 100644 index 0000000..74d77de --- /dev/null +++ b/application/vendor/laravelcollective/html/src/FormBuilder.php @@ -0,0 +1,1155 @@ +url = $url; + $this->html = $html; + $this->csrfToken = $csrfToken; + } + + /** + * Open up a new HTML form. + * + * @param array $options + * + * @return string + */ + public function open(array $options = []) + { + $method = array_get($options, 'method', 'post'); + + // We need to extract the proper method from the attributes. If the method is + // something other than GET or POST we'll use POST since we will spoof the + // actual method since forms don't support the reserved methods in HTML. + $attributes['method'] = $this->getMethod($method); + + $attributes['action'] = $this->getAction($options); + + $attributes['accept-charset'] = 'UTF-8'; + + // If the method is PUT, PATCH or DELETE we will need to add a spoofer hidden + // field that will instruct the Symfony request to pretend the method is a + // different method than it actually is, for convenience from the forms. + $append = $this->getAppendage($method); + + if (isset($options['files']) && $options['files']) { + $options['enctype'] = 'multipart/form-data'; + } + + // Finally we're ready to create the final form HTML field. We will attribute + // format the array of attributes. We will also add on the appendage which + // is used to spoof requests for this PUT, PATCH, etc. methods on forms. + $attributes = array_merge( + + $attributes, array_except($options, $this->reserved) + + ); + + // Finally, we will concatenate all of the attributes into a single string so + // we can build out the final form open statement. We'll also append on an + // extra value for the hidden _method field if it's needed for the form. + $attributes = $this->html->attributes($attributes); + + return ''.$append; + } + + /** + * Create a new model based form builder. + * + * @param mixed $model + * @param array $options + * + * @return string + */ + public function model($model, array $options = []) + { + $this->model = $model; + + return $this->open($options); + } + + /** + * Set the model instance on the form builder. + * + * @param mixed $model + * + * @return void + */ + public function setModel($model) + { + $this->model = $model; + } + + /** + * Close the current form. + * + * @return string + */ + public function close() + { + $this->labels = []; + + $this->model = null; + + return ''; + } + + /** + * Generate a hidden field with the current CSRF token. + * + * @return string + */ + public function token() + { + $token = !empty($this->csrfToken) ? $this->csrfToken : $this->session->getToken(); + + return $this->hidden('_token', $token); + } + + /** + * Create a form label element. + * + * @param string $name + * @param string $value + * @param array $options + * + * @return string + */ + public function label($name, $value = null, $options = []) + { + $this->labels[] = $name; + + $options = $this->html->attributes($options); + + $value = e($this->formatLabel($name, $value)); + + return ''; + } + + /** + * Format the label value. + * + * @param string $name + * @param string|null $value + * + * @return string + */ + protected function formatLabel($name, $value) + { + return $value ?: ucwords(str_replace('_', ' ', $name)); + } + + /** + * Create a form input field. + * + * @param string $type + * @param string $name + * @param string $value + * @param array $options + * + * @return string + */ + public function input($type, $name, $value = null, $options = []) + { + if (!isset($options['name'])) { + $options['name'] = $name; + } + + // We will get the appropriate value for the given field. We will look for the + // value in the session for the value in the old input data then we'll look + // in the model instance if one is set. Otherwise we will just use empty. + $id = $this->getIdAttribute($name, $options); + + if (!in_array($type, $this->skipValueTypes)) { + $value = $this->getValueAttribute($name, $value); + } + + // Once we have the type, value, and ID we can merge them into the rest of the + // attributes array so we can convert them into their HTML attribute format + // when creating the HTML element. Then, we will return the entire input. + $merge = compact('type', 'value', 'id'); + + $options = array_merge($options, $merge); + + return 'html->attributes($options).'>'; + } + + /** + * Create a text input field. + * + * @param string $name + * @param string $value + * @param array $options + * + * @return string + */ + public function text($name, $value = null, $options = []) + { + return $this->input('text', $name, $value, $options); + } + + /** + * Create a password input field. + * + * @param string $name + * @param array $options + * + * @return string + */ + public function password($name, $options = []) + { + return $this->input('password', $name, '', $options); + } + + /** + * Create a hidden input field. + * + * @param string $name + * @param string $value + * @param array $options + * + * @return string + */ + public function hidden($name, $value = null, $options = []) + { + return $this->input('hidden', $name, $value, $options); + } + + /** + * Create an e-mail input field. + * + * @param string $name + * @param string $value + * @param array $options + * + * @return string + */ + public function email($name, $value = null, $options = []) + { + return $this->input('email', $name, $value, $options); + } + + /** + * Create a tel input field. + * + * @param string $name + * @param string $value + * @param array $options + * + * @return string + */ + public function tel($name, $value = null, $options = []) + { + return $this->input('tel', $name, $value, $options); + } + + /** + * Create a number input field. + * + * @param string $name + * @param string $value + * @param array $options + * + * @return string + */ + public function number($name, $value = null, $options = []) + { + return $this->input('number', $name, $value, $options); + } + + /** + * Create a date input field. + * + * @param string $name + * @param string $value + * @param array $options + * + * @return string + */ + public function date($name, $value = null, $options = []) + { + if ($value instanceof DateTime) { + $value = $value->format('Y-m-d'); + } + + return $this->input('date', $name, $value, $options); + } + + /** + * Create a datetime input field. + * + * @param string $name + * @param string $value + * @param array $options + * + * @return string + */ + public function datetime($name, $value = null, $options = []) + { + if ($value instanceof DateTime) { + $value = $value->format(DateTime::RFC3339); + } + + return $this->input('datetime', $name, $value, $options); + } + + /** + * Create a datetime-local input field. + * + * @param string $name + * @param string $value + * @param array $options + * + * @return string + */ + public function datetimeLocal($name, $value = null, $options = []) + { + if ($value instanceof DateTime) { + $value = $value->format('Y-m-d\TH:i'); + } + + return $this->input('datetime-local', $name, $value, $options); + } + + /** + * Create a time input field. + * + * @param string $name + * @param string $value + * @param array $options + * + * @return string + */ + public function time($name, $value = null, $options = []) + { + return $this->input('time', $name, $value, $options); + } + + /** + * Create a url input field. + * + * @param string $name + * @param string $value + * @param array $options + * + * @return string + */ + public function url($name, $value = null, $options = []) + { + return $this->input('url', $name, $value, $options); + } + + /** + * Create a file input field. + * + * @param string $name + * @param array $options + * + * @return string + */ + public function file($name, $options = []) + { + return $this->input('file', $name, null, $options); + } + + /** + * Create a textarea input field. + * + * @param string $name + * @param string $value + * @param array $options + * + * @return string + */ + public function textarea($name, $value = null, $options = []) + { + if (!isset($options['name'])) { + $options['name'] = $name; + } + + // Next we will look for the rows and cols attributes, as each of these are put + // on the textarea element definition. If they are not present, we will just + // assume some sane default values for these attributes for the developer. + $options = $this->setTextAreaSize($options); + + $options['id'] = $this->getIdAttribute($name, $options); + + $value = (string) $this->getValueAttribute($name, $value); + + unset($options['size']); + + // Next we will convert the attributes into a string form. Also we have removed + // the size attribute, as it was merely a short-cut for the rows and cols on + // the element. Then we'll create the final textarea elements HTML for us. + $options = $this->html->attributes($options); + + return ''.e($value).''; + } + + /** + * Set the text area size on the attributes. + * + * @param array $options + * + * @return array + */ + protected function setTextAreaSize($options) + { + if (isset($options['size'])) { + return $this->setQuickTextAreaSize($options); + } + + // If the "size" attribute was not specified, we will just look for the regular + // columns and rows attributes, using sane defaults if these do not exist on + // the attributes array. We'll then return this entire options array back. + $cols = array_get($options, 'cols', 50); + + $rows = array_get($options, 'rows', 10); + + return array_merge($options, compact('cols', 'rows')); + } + + /** + * Set the text area size using the quick "size" attribute. + * + * @param array $options + * + * @return array + */ + protected function setQuickTextAreaSize($options) + { + $segments = explode('x', $options['size']); + + return array_merge($options, ['cols' => $segments[0], 'rows' => $segments[1]]); + } + + /** + * Create a select box field. + * + * @param string $name + * @param array $list + * @param string $selected + * @param array $options + * + * @return string + */ + public function select($name, $list = [], $selected = null, $options = []) + { + // When building a select box the "value" attribute is really the selected one + // so we will use that when checking the model or session for a value which + // should provide a convenient method of re-populating the forms on post. + $selected = $this->getValueAttribute($name, $selected); + + $options['id'] = $this->getIdAttribute($name, $options); + + if (!isset($options['name'])) { + $options['name'] = $name; + } + + // We will simply loop through the options and build an HTML value for each of + // them until we have an array of HTML declarations. Then we will join them + // all together into one single HTML element that can be put on the form. + $html = []; + + if (isset($options['placeholder'])) { + $html[] = $this->placeholderOption($options['placeholder'], $selected); + unset($options['placeholder']); + } + + foreach ($list as $value => $display) { + $html[] = $this->getSelectOption($display, $value, $selected); + } + + // Once we have all of this HTML, we can join this into a single element after + // formatting the attributes into an HTML "attributes" string, then we will + // build out a final select statement, which will contain all the values. + $options = $this->html->attributes($options); + + $list = implode('', $html); + + return "{$list}"; + } + + /** + * Create a select range field. + * + * @param string $name + * @param string $begin + * @param string $end + * @param string $selected + * @param array $options + * + * @return string + */ + public function selectRange($name, $begin, $end, $selected = null, $options = []) + { + $range = array_combine($range = range($begin, $end), $range); + + return $this->select($name, $range, $selected, $options); + } + + /** + * Create a select year field. + * + * @param string $name + * @param string $begin + * @param string $end + * @param string $selected + * @param array $options + * + * @return string + */ + public function selectYear() + { + return call_user_func_array([$this, 'selectRange'], func_get_args()); + } + + /** + * Create a select month field. + * + * @param string $name + * @param string $selected + * @param array $options + * @param string $format + * + * @return string + */ + public function selectMonth($name, $selected = null, $options = [], $format = '%B') + { + $months = []; + + foreach (range(1, 12) as $month) { + $months[$month] = strftime($format, mktime(0, 0, 0, $month, 1)); + } + + return $this->select($name, $months, $selected, $options); + } + + /** + * Get the select option for the given value. + * + * @param string $display + * @param string $value + * @param string $selected + * + * @return string + */ + public function getSelectOption($display, $value, $selected) + { + if (is_array($display)) { + return $this->optionGroup($display, $value, $selected); + } + + return $this->option($display, $value, $selected); + } + + /** + * Create an option group form element. + * + * @param array $list + * @param string $label + * @param string $selected + * + * @return string + */ + protected function optionGroup($list, $label, $selected) + { + $html = []; + + foreach ($list as $value => $display) { + $html[] = $this->option($display, $value, $selected); + } + + return ''.implode('', $html).''; + } + + /** + * Create a select element option. + * + * @param string $display + * @param string $value + * @param string $selected + * + * @return string + */ + protected function option($display, $value, $selected) + { + $selected = $this->getSelectedValue($value, $selected); + + $options = ['value' => $value, 'selected' => $selected]; + + return 'html->attributes($options).'>'.e($display).''; + } + + /** + * Create a placeholder select element option. + * + * @param $display + * @param $selected + * + * @return string + */ + protected function placeholderOption($display, $selected) + { + $selected = $this->getSelectedValue(null, $selected); + + $options = compact('selected'); + $options['value'] = ''; + + return 'html->attributes($options).'>'.e($display).''; + } + + /** + * Determine if the value is selected. + * + * @param string $value + * @param string $selected + * + * @return string|null + */ + protected function getSelectedValue($value, $selected) + { + if (is_array($selected)) { + return in_array($value, $selected, true) || in_array((string) $value, $selected, true) + ? 'selected' + : null; + } + + return ((string) $value == (string) $selected) ? 'selected' : null; + } + + /** + * Create a checkbox input field. + * + * @param string $name + * @param mixed $value + * @param bool $checked + * @param array $options + * + * @return string + */ + public function checkbox($name, $value = 1, $checked = null, $options = []) + { + return $this->checkable('checkbox', $name, $value, $checked, $options); + } + + /** + * Create a radio button input field. + * + * @param string $name + * @param mixed $value + * @param bool $checked + * @param array $options + * + * @return string + */ + public function radio($name, $value = null, $checked = null, $options = []) + { + if (is_null($value)) { + $value = $name; + } + + return $this->checkable('radio', $name, $value, $checked, $options); + } + + /** + * Create a checkable input field. + * + * @param string $type + * @param string $name + * @param mixed $value + * @param bool $checked + * @param array $options + * + * @return string + */ + protected function checkable($type, $name, $value, $checked, $options) + { + $checked = $this->getCheckedState($type, $name, $value, $checked); + + if ($checked) { + $options['checked'] = 'checked'; + } + + return $this->input($type, $name, $value, $options); + } + + /** + * Get the check state for a checkable input. + * + * @param string $type + * @param string $name + * @param mixed $value + * @param bool $checked + * + * @return bool + */ + protected function getCheckedState($type, $name, $value, $checked) + { + switch ($type) { + case 'checkbox': + return $this->getCheckboxCheckedState($name, $value, $checked); + + case 'radio': + return $this->getRadioCheckedState($name, $value, $checked); + + default: + return $this->getValueAttribute($name) == $value; + } + } + + /** + * Get the check state for a checkbox input. + * + * @param string $name + * @param mixed $value + * @param bool $checked + * + * @return bool + */ + protected function getCheckboxCheckedState($name, $value, $checked) + { + if (isset($this->session) && !$this->oldInputIsEmpty() && is_null($this->old($name))) { + return false; + } + + if ($this->missingOldAndModel($name)) { + return $checked; + } + + $posted = $this->getValueAttribute($name, $checked); + + if (is_array($posted)) { + return in_array($value, $posted); + } elseif ($posted instanceof Collection) { + return $posted->contains('id', $value); + } else { + return (bool) $posted; + } + } + + /** + * Get the check state for a radio input. + * + * @param string $name + * @param mixed $value + * @param bool $checked + * + * @return bool + */ + protected function getRadioCheckedState($name, $value, $checked) + { + if ($this->missingOldAndModel($name)) { + return $checked; + } + + return $this->getValueAttribute($name) == $value; + } + + /** + * Determine if old input or model input exists for a key. + * + * @param string $name + * + * @return bool + */ + protected function missingOldAndModel($name) + { + return (is_null($this->old($name)) && is_null($this->getModelValueAttribute($name))); + } + + /** + * Create a HTML reset input element. + * + * @param string $value + * @param array $attributes + * + * @return string + */ + public function reset($value, $attributes = []) + { + return $this->input('reset', null, $value, $attributes); + } + + /** + * Create a HTML image input element. + * + * @param string $url + * @param string $name + * @param array $attributes + * + * @return string + */ + public function image($url, $name = null, $attributes = []) + { + $attributes['src'] = $this->url->asset($url); + + return $this->input('image', $name, null, $attributes); + } + + /** + * Create a color input field. + * + * @param string $name + * @param string $value + * @param array $options + * + * @return string + */ + public function color($name, $value = null, $options = []) + { + return $this->input('color', $name, $value, $options); + } + + /** + * Create a submit button element. + * + * @param string $value + * @param array $options + * + * @return string + */ + public function submit($value = null, $options = []) + { + return $this->input('submit', null, $value, $options); + } + + /** + * Create a button element. + * + * @param string $value + * @param array $options + * + * @return string + */ + public function button($value = null, $options = []) + { + if (!array_key_exists('type', $options)) { + $options['type'] = 'button'; + } + + return 'html->attributes($options).'>'.$value.''; + } + + /** + * Parse the form action method. + * + * @param string $method + * + * @return string + */ + protected function getMethod($method) + { + $method = strtoupper($method); + + return $method != 'GET' ? 'POST' : $method; + } + + /** + * Get the form action from the options. + * + * @param array $options + * + * @return string + */ + protected function getAction(array $options) + { + // We will also check for a "route" or "action" parameter on the array so that + // developers can easily specify a route or controller action when creating + // a form providing a convenient interface for creating the form actions. + if (isset($options['url'])) { + return $this->getUrlAction($options['url']); + } + + if (isset($options['route'])) { + return $this->getRouteAction($options['route']); + } + + // If an action is available, we are attempting to open a form to a controller + // action route. So, we will use the URL generator to get the path to these + // actions and return them from the method. Otherwise, we'll use current. + elseif (isset($options['action'])) { + return $this->getControllerAction($options['action']); + } + + return $this->url->current(); + } + + /** + * Get the action for a "url" option. + * + * @param array|string $options + * + * @return string + */ + protected function getUrlAction($options) + { + if (is_array($options)) { + return $this->url->to($options[0], array_slice($options, 1)); + } + + return $this->url->to($options); + } + + /** + * Get the action for a "route" option. + * + * @param array|string $options + * + * @return string + */ + protected function getRouteAction($options) + { + if (is_array($options)) { + return $this->url->route($options[0], array_slice($options, 1)); + } + + return $this->url->route($options); + } + + /** + * Get the action for an "action" option. + * + * @param array|string $options + * + * @return string + */ + protected function getControllerAction($options) + { + if (is_array($options)) { + return $this->url->action($options[0], array_slice($options, 1)); + } + + return $this->url->action($options); + } + + /** + * Get the form appendage for the given method. + * + * @param string $method + * + * @return string + */ + protected function getAppendage($method) + { + list($method, $appendage) = [strtoupper($method), '']; + + // If the HTTP method is in this list of spoofed methods, we will attach the + // method spoofer hidden input to the form. This allows us to use regular + // form to initiate PUT and DELETE requests in addition to the typical. + if (in_array($method, $this->spoofedMethods)) { + $appendage .= $this->hidden('_method', $method); + } + + // If the method is something other than GET we will go ahead and attach the + // CSRF token to the form, as this can't hurt and is convenient to simply + // always have available on every form the developers creates for them. + if ($method != 'GET') { + $appendage .= $this->token(); + } + + return $appendage; + } + + /** + * Get the ID attribute for a field name. + * + * @param string $name + * @param array $attributes + * + * @return string + */ + public function getIdAttribute($name, $attributes) + { + if (array_key_exists('id', $attributes)) { + return $attributes['id']; + } + + if (in_array($name, $this->labels)) { + return $name; + } + } + + /** + * Get the value that should be assigned to the field. + * + * @param string $name + * @param string $value + * + * @return mixed + */ + public function getValueAttribute($name, $value = null) + { + if (is_null($name)) { + return $value; + } + + if (!is_null($this->old($name))) { + return $this->old($name); + } + + if (!is_null($value)) { + return $value; + } + + if (isset($this->model)) { + return $this->getModelValueAttribute($name); + } + } + + /** + * Get the model value that should be assigned to the field. + * + * @param string $name + * + * @return mixed + */ + protected function getModelValueAttribute($name) + { + return data_get($this->model, $this->transformKey($name)); + } + + /** + * Get a value from the session's old input. + * + * @param string $name + * + * @return mixed + */ + public function old($name) + { + if (isset($this->session)) { + return $this->session->getOldInput($this->transformKey($name)); + } + } + + /** + * Determine if the old input is empty. + * + * @return bool + */ + public function oldInputIsEmpty() + { + return (isset($this->session) && count($this->session->getOldInput()) == 0); + } + + /** + * Transform key from array to dot syntax. + * + * @param string $key + * + * @return string + */ + protected function transformKey($key) + { + return str_replace(['.', '[]', '[', ']'], ['_', '', '.', ''], $key); + } + + /** + * Get the session store implementation. + * + * @return \Illuminate\Session\SessionInterface $session + */ + public function getSessionStore() + { + return $this->session; + } + + /** + * Set the session store implementation. + * + * @param \Illuminate\Session\SessionInterface $session + * + * @return $this + */ + public function setSessionStore(SessionInterface $session) + { + $this->session = $session; + + return $this; + } +} diff --git a/application/vendor/laravelcollective/html/src/FormFacade.php b/application/vendor/laravelcollective/html/src/FormFacade.php new file mode 100644 index 0000000..66d459f --- /dev/null +++ b/application/vendor/laravelcollective/html/src/FormFacade.php @@ -0,0 +1,21 @@ +url = $url; + } + + /** + * Convert an HTML string to entities. + * + * @param string $value + * + * @return string + */ + public function entities($value) + { + return htmlentities($value, ENT_QUOTES, 'UTF-8', false); + } + + /** + * Convert entities to HTML characters. + * + * @param string $value + * + * @return string + */ + public function decode($value) + { + return html_entity_decode($value, ENT_QUOTES, 'UTF-8'); + } + + /** + * Generate a link to a JavaScript file. + * + * @param string $url + * @param array $attributes + * @param bool $secure + * + * @return string + */ + public function script($url, $attributes = [], $secure = null) + { + $attributes['src'] = $this->url->asset($url, $secure); + + return 'attributes($attributes).'>'.PHP_EOL; + } + + /** + * Generate a link to a CSS file. + * + * @param string $url + * @param array $attributes + * @param bool $secure + * + * @return string + */ + public function style($url, $attributes = [], $secure = null) + { + $defaults = ['media' => 'all', 'type' => 'text/css', 'rel' => 'stylesheet']; + + $attributes = $attributes + $defaults; + + $attributes['href'] = $this->url->asset($url, $secure); + + return 'attributes($attributes).'>'.PHP_EOL; + } + + /** + * Generate an HTML image element. + * + * @param string $url + * @param string $alt + * @param array $attributes + * @param bool $secure + * + * @return string + */ + public function image($url, $alt = null, $attributes = [], $secure = null) + { + $attributes['alt'] = $alt; + + return 'attributes($attributes).'>'; + } + + /** + * Generate a link to a Favicon file. + * + * @param string $url + * @param array $attributes + * @param bool $secure + * + * @return string + */ + public function favicon($url, $attributes = [], $secure = null) + { + $defaults = ['rel' => 'shortcut icon', 'type' => 'image/x-icon']; + + $attributes = $attributes + $defaults; + + $attributes['href'] = $this->url->asset($url, $secure); + + return 'attributes($attributes).'>'.PHP_EOL; + } + + /** + * Generate a HTML link. + * + * @param string $url + * @param string $title + * @param array $attributes + * @param bool $secure + * + * @return string + */ + public function link($url, $title = null, $attributes = [], $secure = null) + { + $url = $this->url->to($url, [], $secure); + + if (is_null($title) || $title === false) { + $title = $url; + } + + return 'attributes($attributes).'>'.$this->entities($title).''; + } + + /** + * Generate a HTTPS HTML link. + * + * @param string $url + * @param string $title + * @param array $attributes + * + * @return string + */ + public function secureLink($url, $title = null, $attributes = []) + { + return $this->link($url, $title, $attributes, true); + } + + /** + * Generate a HTML link to an asset. + * + * @param string $url + * @param string $title + * @param array $attributes + * @param bool $secure + * + * @return string + */ + public function linkAsset($url, $title = null, $attributes = [], $secure = null) + { + $url = $this->url->asset($url, $secure); + + return $this->link($url, $title ?: $url, $attributes, $secure); + } + + /** + * Generate a HTTPS HTML link to an asset. + * + * @param string $url + * @param string $title + * @param array $attributes + * + * @return string + */ + public function linkSecureAsset($url, $title = null, $attributes = []) + { + return $this->linkAsset($url, $title, $attributes, true); + } + + /** + * Generate a HTML link to a named route. + * + * @param string $name + * @param string $title + * @param array $parameters + * @param array $attributes + * + * @return string + */ + public function linkRoute($name, $title = null, $parameters = [], $attributes = []) + { + return $this->link($this->url->route($name, $parameters), $title, $attributes); + } + + /** + * Generate a HTML link to a controller action. + * + * @param string $action + * @param string $title + * @param array $parameters + * @param array $attributes + * + * @return string + */ + public function linkAction($action, $title = null, $parameters = [], $attributes = []) + { + return $this->link($this->url->action($action, $parameters), $title, $attributes); + } + + /** + * Generate a HTML link to an email address. + * + * @param string $email + * @param string $title + * @param array $attributes + * + * @return string + */ + public function mailto($email, $title = null, $attributes = []) + { + $email = $this->email($email); + + $title = $title ?: $email; + + $email = $this->obfuscate('mailto:').$email; + + return 'attributes($attributes).'>'.$this->entities($title).''; + } + + /** + * Obfuscate an e-mail address to prevent spam-bots from sniffing it. + * + * @param string $email + * + * @return string + */ + public function email($email) + { + return str_replace('@', '@', $this->obfuscate($email)); + } + + /** + * Generate an ordered list of items. + * + * @param array $list + * @param array $attributes + * + * @return string + */ + public function ol($list, $attributes = []) + { + return $this->listing('ol', $list, $attributes); + } + + /** + * Generate an un-ordered list of items. + * + * @param array $list + * @param array $attributes + * + * @return string + */ + public function ul($list, $attributes = []) + { + return $this->listing('ul', $list, $attributes); + } + + /** + * Generate a description list of items. + * + * @param array $list + * @param array $attributes + * + * @return string + */ + public function dl(array $list, array $attributes = []) + { + $attributes = $this->attributes($attributes); + + $html = ""; + + foreach ($list as $key => $value) { + $value = (array) $value; + + $html .= "
    $key
    "; + + foreach ($value as $v_key => $v_value) { + $html .= "
    $v_value
    "; + } + } + + $html .= ''; + + return $html; + } + + /** + * Create a listing HTML element. + * + * @param string $type + * @param array $list + * @param array $attributes + * + * @return string + */ + protected function listing($type, $list, $attributes = []) + { + $html = ''; + + if (count($list) == 0) { + return $html; + } + + // Essentially we will just spin through the list and build the list of the HTML + // elements from the array. We will also handled nested lists in case that is + // present in the array. Then we will build out the final listing elements. + foreach ($list as $key => $value) { + $html .= $this->listingElement($key, $type, $value); + } + + $attributes = $this->attributes($attributes); + + return "<{$type}{$attributes}>{$html}"; + } + + /** + * Create the HTML for a listing element. + * + * @param mixed $key + * @param string $type + * @param mixed $value + * + * @return string + */ + protected function listingElement($key, $type, $value) + { + if (is_array($value)) { + return $this->nestedListing($key, $type, $value); + } else { + return '
  • '.e($value).'
  • '; + } + } + + /** + * Create the HTML for a nested listing attribute. + * + * @param mixed $key + * @param string $type + * @param mixed $value + * + * @return string + */ + protected function nestedListing($key, $type, $value) + { + if (is_int($key)) { + return $this->listing($type, $value); + } else { + return '
  • '.$key.$this->listing($type, $value).'
  • '; + } + } + + /** + * Build an HTML attribute string from an array. + * + * @param array $attributes + * + * @return string + */ + public function attributes($attributes) + { + $html = []; + + foreach ((array) $attributes as $key => $value) { + $element = $this->attributeElement($key, $value); + + if (!is_null($element)) { + $html[] = $element; + } + } + + return count($html) > 0 ? ' '.implode(' ', $html) : ''; + } + + /** + * Build a single attribute element. + * + * @param string $key + * @param string $value + * + * @return string + */ + protected function attributeElement($key, $value) + { + // For numeric keys we will assume that the key and the value are the same + // as this will convert HTML attributes such as "required" to a correct + // form like required="required" instead of using incorrect numerics. + if (is_numeric($key)) { + $key = $value; + } + + if (!is_null($value)) { + return $key.'="'.e($value).'"'; + } + } + + /** + * Obfuscate a string to prevent spam-bots from sniffing it. + * + * @param string $value + * + * @return string + */ + public function obfuscate($value) + { + $safe = ''; + + foreach (str_split($value) as $letter) { + if (ord($letter) > 128) { + return $letter; + } + + // To properly obfuscate the value, we will randomly convert each letter to + // its entity or hexadecimal representation, keeping a bot from sniffing + // the randomly obfuscated letters out of the string on the responses. + switch (rand(1, 3)) { + case 1: + $safe .= '&#'.ord($letter).';'; break; + + case 2: + $safe .= '&#x'.dechex(ord($letter)).';'; break; + + case 3: + $safe .= $letter; + } + } + + return $safe; + } + + /** + * Generate a meta tag. + * + * @param string $name + * @param string $content + * @param array $attributes + * + * @return string + */ + public function meta($name, $content, array $attributes = []) + { + $defaults = compact('name', 'content'); + + $attributes = array_merge($defaults, $attributes); + + return 'attributes($attributes).'>'.PHP_EOL; + } +} diff --git a/application/vendor/laravelcollective/html/src/HtmlFacade.php b/application/vendor/laravelcollective/html/src/HtmlFacade.php new file mode 100644 index 0000000..1202359 --- /dev/null +++ b/application/vendor/laravelcollective/html/src/HtmlFacade.php @@ -0,0 +1,21 @@ +registerHtmlBuilder(); + + $this->registerFormBuilder(); + + $this->app->alias('html', 'Collective\Html\HtmlBuilder'); + $this->app->alias('form', 'Collective\Html\FormBuilder'); + } + + /** + * Register the HTML builder instance. + * + * @return void + */ + protected function registerHtmlBuilder() + { + $this->app->singleton('html', function ($app) { + return new HtmlBuilder($app['url']); + }); + } + + /** + * Register the form builder instance. + * + * @return void + */ + protected function registerFormBuilder() + { + $this->app->singleton('form', function ($app) { + $form = new FormBuilder($app['html'], $app['url'], $app['session.store']->getToken()); + + return $form->setSessionStore($app['session.store']); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['html', 'form', 'Collective\Html\HtmlBuilder', 'Collective\Html\FormBuilder']; + } +} diff --git a/application/vendor/laravelcollective/html/src/helpers.php b/application/vendor/laravelcollective/html/src/helpers.php new file mode 100644 index 0000000..b84673b --- /dev/null +++ b/application/vendor/laravelcollective/html/src/helpers.php @@ -0,0 +1,69 @@ +link($url, $title, $attributes, $secure); + } +} + +if (!function_exists('link_to_asset')) { + /** + * Generate a HTML link to an asset. + * + * @param string $url + * @param string $title + * @param array $attributes + * @param bool $secure + * + * @return string + */ + function link_to_asset($url, $title = null, $attributes = [], $secure = null) + { + return app('html')->linkAsset($url, $title, $attributes, $secure); + } +} + +if (!function_exists('link_to_route')) { + /** + * Generate a HTML link to a named route. + * + * @param string $name + * @param string $title + * @param array $parameters + * @param array $attributes + * + * @return string + */ + function link_to_route($name, $title = null, $parameters = [], $attributes = []) + { + return app('html')->linkRoute($name, $title, $parameters, $attributes); + } +} + +if (!function_exists('link_to_action')) { + /** + * Generate a HTML link to a controller action. + * + * @param string $action + * @param string $title + * @param array $parameters + * @param array $attributes + * + * @return string + */ + function link_to_action($action, $title = null, $parameters = [], $attributes = []) + { + return app('html')->linkAction($action, $title, $parameters, $attributes); + } +} diff --git a/application/vendor/league/flysystem/LICENSE b/application/vendor/league/flysystem/LICENSE index 308972c..f2684c8 100644 --- a/application/vendor/league/flysystem/LICENSE +++ b/application/vendor/league/flysystem/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2013-2015 Frank de Jonge +Copyright (c) 2013-2019 Frank de Jonge Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/application/vendor/league/flysystem/README.md b/application/vendor/league/flysystem/README.md deleted file mode 100644 index 45b7c49..0000000 --- a/application/vendor/league/flysystem/README.md +++ /dev/null @@ -1,101 +0,0 @@ -# League\Flysystem - -[![Author](http://img.shields.io/badge/author-@frankdejonge-blue.svg?style=flat-square)](https://twitter.com/frankdejonge) -[![Build Status](https://img.shields.io/travis/thephpleague/flysystem/master.svg?style=flat-square)](https://travis-ci.org/thephpleague/flysystem) -[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/thephpleague/flysystem.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/flysystem/code-structure) -[![Quality Score](https://img.shields.io/scrutinizer/g/thephpleague/flysystem.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/flysystem) -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) -[![Packagist Version](https://img.shields.io/packagist/v/league/flysystem.svg?style=flat-square)](https://packagist.org/packages/league/flysystem) -[![Total Downloads](https://img.shields.io/packagist/dt/league/flysystem.svg?style=flat-square)](https://packagist.org/packages/league/flysystem) - -[![SensioLabsInsight](https://insight.sensiolabs.com/projects/9820f1af-2fd0-4ab6-b42a-03e0c821e0af/big.png)](https://insight.sensiolabs.com/projects/9820f1af-2fd0-4ab6-b42a-03e0c821e0af) - -Flysystem is a filesystem abstraction which allows you to easily swap out a local filesystem for a remote one. - -# Goals - -* Have a generic API for handling common tasks across multiple file storage engines. -* Have consistent output which you can rely on. -* Integrate well with other packages/frameworks. -* Be cacheable. -* Emulate directories in systems that support none, like AwsS3. -* Support third party plugins. -* Make it easy to test your filesystem interactions. -* Support streams for big file handling. - -# Installation - -Through Composer, obviously: - -``` -composer require league/flysystem -``` - -You can also use Flysystem without using Composer by registering an autoloader function: - -```php -spl_autoload_register(function($class) { - $prefix = 'League\\Flysystem\\'; - - if ( ! substr($class, 0, 17) === $prefix) { - return; - } - - $class = substr($class, strlen($prefix)); - $location = __DIR__ . 'path/to/flysystem/src/' . str_replace('\\', '/', $class) . '.php'; - - if (is_file($location)) { - require_once($location); - } -}); -``` - -## Integrations - -Want to get started quickly? Check out some of these integrations: - -* Laravel integration: https://github.com/GrahamCampbell/Laravel-Flysystem -* Symfony integration: https://github.com/1up-lab/OneupFlysystemBundle -* Zend Framework integration: https://github.com/bushbaby/BsbFlysystem -* CakePHP integration: https://github.com/WyriHaximus/FlyPie -* Silex integration: https://github.com/WyriHaximus/SliFly -* Cilex integration: https://github.com/WyriHaximus/cli-fly -* Yii 2 integration: https://github.com/creocoder/yii2-flysystem -* Backup manager: https://github.com/heybigname/backup-manager - -## Adapters - -* Local -* Amazon Web Services - S3 V2: https://github.com/thephpleague/flysystem-aws-s3-v2 -* Amazon Web Services - S3 V3: https://github.com/thephpleague/flysystem-aws-s3-v3 -* Rackspace Cloud Files: https://github.com/thephpleague/flysystem-rackspace -* Dropbox: https://github.com/thephpleague/flysystem-dropbox -* Copy: https://github.com/thephpleague/flysystem-copy -* Ftp -* Sftp (through phpseclib): https://github.com/thephpleague/flysystem-sftp -* Zip (through ZipArchive): https://github.com/thephpleague/flysystem-ziparchive -* WebDAV (through SabreDAV): https://github.com/thephpleague/flysystem-webdav -* PHPCR: https://github.com/thephpleague/flysystem-phpcr -* Azure Blob Storage -* NullAdapter - -## Caching - -* Memory (array caching) -* Redis (through Predis) -* Memcached -* Adapter -* Stash - -## Documentation - -[Check out the documentation](http://flysystem.thephpleague.com/) - -## Security - -If you discover any security related issues, please email frenky@frenky.net instead of using the issue tracker. - - -# Enjoy - -Oh and if you've come down this far, you might as well follow me on [twitter](http://twitter.com/frankdejonge). diff --git a/application/vendor/league/flysystem/composer.json b/application/vendor/league/flysystem/composer.json index dab5d14..84229e9 100644 --- a/application/vendor/league/flysystem/composer.json +++ b/application/vendor/league/flysystem/composer.json @@ -14,14 +14,12 @@ } ], "require": { - "php": ">=5.4.0" + "php": ">=5.5.9", + "ext-fileinfo": "*" }, "require-dev": { - "ext-fileinfo": "*", - "phpunit/phpunit": "~4.1", - "mockery/mockery": "~0.9", - "phpspec/phpspec": "^2.2", - "phpspec/prophecy-phpunit": "~1.0" + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7.10" }, "autoload": { "psr-4": { @@ -31,31 +29,36 @@ "autoload-dev": { "psr-4": { "League\\Flysystem\\Stub\\": "stub/" - } + }, + "files": [ + "tests/PHPUnitHacks.php" + ] }, "suggest": { "ext-fileinfo": "Required for MimeType", "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-copy": "Allows you to use Copy.com storage", "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", "league/flysystem-webdav": "Allows you to use WebDAV storage", "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-dropbox": "Allows you to use Dropbox storage", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications", "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter" }, "conflict": { "league/flysystem-sftp": "<1.0.6" }, - "config": { - "bin-dir": "bin" - }, "extra": { "branch-alias": { "dev-master": "1.1-dev" } + }, + "scripts": { + "phpstan": "php phpstan.php" } } diff --git a/application/vendor/league/flysystem/deprecations.md b/application/vendor/league/flysystem/deprecations.md new file mode 100644 index 0000000..c336a42 --- /dev/null +++ b/application/vendor/league/flysystem/deprecations.md @@ -0,0 +1,19 @@ +# Deprecations + +This document lists all the planned deprecations. + +## Handlers will be removed in 2.0 + +The `Handler` type and associated calls will be removed in version 2.0. + +### Upgrade path + +You should create your own implementation for handling OOP usage, +but it's recommended to move away from using an OOP-style wrapper entirely. + +The reason for this is that it's too easy for implementation details (for +your application this is Flysystem) to leak into the application. The most +important part for Flysystem is that it improves portability and creates a +solid boundary between your application core and the infrastructure you use. +The OOP-style handling breaks this principle, therefore I want to stop +promoting it. diff --git a/application/vendor/league/flysystem/src/Adapter/AbstractAdapter.php b/application/vendor/league/flysystem/src/Adapter/AbstractAdapter.php index 4617c95..e577ac4 100644 --- a/application/vendor/league/flysystem/src/Adapter/AbstractAdapter.php +++ b/application/vendor/league/flysystem/src/Adapter/AbstractAdapter.php @@ -7,7 +7,7 @@ abstract class AbstractAdapter implements AdapterInterface { /** - * @var string path prefix + * @var string|null path prefix */ protected $pathPrefix; @@ -21,23 +21,25 @@ abstract class AbstractAdapter implements AdapterInterface * * @param string $prefix * - * @return self + * @return void */ public function setPathPrefix($prefix) { - $is_empty = empty($prefix); + $prefix = (string) $prefix; - if (! $is_empty) { - $prefix = rtrim($prefix, $this->pathSeparator).$this->pathSeparator; + if ($prefix === '') { + $this->pathPrefix = null; + + return; } - $this->pathPrefix = $is_empty ? null : $prefix; + $this->pathPrefix = rtrim($prefix, '\\/') . $this->pathSeparator; } /** * Get the path prefix. * - * @return string path prefix + * @return string|null path prefix or null if pathPrefix is empty */ public function getPathPrefix() { @@ -53,17 +55,7 @@ public function getPathPrefix() */ public function applyPathPrefix($path) { - $path = ltrim($path, '\\/'); - - if (strlen($path) === 0) { - return $this->getPathPrefix() ?: ''; - } - - if ($prefix = $this->getPathPrefix()) { - $path = $prefix.$path; - } - - return $path; + return $this->getPathPrefix() . ltrim($path, '\\/'); } /** @@ -75,12 +67,6 @@ public function applyPathPrefix($path) */ public function removePathPrefix($path) { - $pathPrefix = $this->getPathPrefix(); - - if ($pathPrefix === null) { - return $path; - } - - return substr($path, strlen($pathPrefix)); + return substr($path, strlen($this->getPathPrefix())); } } diff --git a/application/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php b/application/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php index 102eab4..578b491 100644 --- a/application/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php +++ b/application/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php @@ -6,6 +6,8 @@ use League\Flysystem\AdapterInterface; use League\Flysystem\Config; use League\Flysystem\NotSupportedException; +use League\Flysystem\SafeStorage; +use RuntimeException; abstract class AbstractFtpAdapter extends AbstractAdapter { @@ -24,16 +26,6 @@ abstract class AbstractFtpAdapter extends AbstractAdapter */ protected $port = 21; - /** - * @var string|null - */ - protected $username; - - /** - * @var string|null - */ - protected $password; - /** * @var bool */ @@ -79,6 +71,18 @@ abstract class AbstractFtpAdapter extends AbstractAdapter */ protected $systemType; + /** + * @var SafeStorage + */ + protected $safeStorage; + + /** + * True to enable timestamps for FTP servers that return unix-style listings. + * + * @var bool + */ + protected $enableTimestampsOnUnixListings = false; + /** * Constructor. * @@ -86,6 +90,7 @@ abstract class AbstractFtpAdapter extends AbstractAdapter */ public function __construct(array $config) { + $this->safeStorage = new SafeStorage(); $this->setConfig($config); } @@ -99,11 +104,11 @@ public function __construct(array $config) public function setConfig(array $config) { foreach ($this->configurable as $setting) { - if (! isset($config[$setting])) { + if ( ! isset($config[$setting])) { continue; } - $method = 'set'.ucfirst($setting); + $method = 'set' . ucfirst($setting); if (method_exists($this, $method)) { $this->$method($config[$setting]); @@ -208,7 +213,7 @@ public function setPort($port) */ public function setRoot($root) { - $this->root = rtrim($root, '\\/').$this->separator; + $this->root = rtrim($root, '\\/') . $this->separator; return $this; } @@ -220,7 +225,9 @@ public function setRoot($root) */ public function getUsername() { - return empty($this->username) ? 'anonymous' : $this->username; + $username = $this->safeStorage->retrieveSafely('username'); + + return $username !== null ? $username : 'anonymous'; } /** @@ -232,7 +239,7 @@ public function getUsername() */ public function setUsername($username) { - $this->username = $username; + $this->safeStorage->storeSafely('username', $username); return $this; } @@ -244,7 +251,7 @@ public function setUsername($username) */ public function getPassword() { - return $this->password; + return $this->safeStorage->retrieveSafely('password'); } /** @@ -256,7 +263,7 @@ public function getPassword() */ public function setPassword($password) { - $this->password = $password; + $this->safeStorage->storeSafely('password', $password); return $this; } @@ -309,6 +316,20 @@ public function setSystemType($systemType) return $this; } + /** + * True to enable timestamps for FTP servers that return unix-style listings. + * + * @param bool $bool + * + * @return $this + */ + public function setEnableTimestampsOnUnixListings($bool = false) + { + $this->enableTimestampsOnUnixListings = $bool; + + return $this; + } + /** * @inheritdoc */ @@ -317,6 +338,8 @@ public function listContents($directory = '', $recursive = false) return $this->listDirectoryContents($directory, $recursive); } + abstract protected function listDirectoryContents($directory, $recursive = false); + /** * Normalize a directory listing. * @@ -333,7 +356,7 @@ protected function normalizeListing(array $listing, $prefix = '') while ($item = array_shift($listing)) { if (preg_match('#^.*:$#', $item)) { - $base = trim($item, ':'); + $base = preg_replace('~^\./*|:$~', '', $item); continue; } @@ -387,6 +410,18 @@ protected function normalizeObject($item, $base) /** * Normalize a Unix file entry. * + * Given $item contains: + * '-rw-r--r-- 1 ftp ftp 409 Aug 19 09:01 file1.txt' + * + * This function will return: + * [ + * 'type' => 'file', + * 'path' => 'file1.txt', + * 'visibility' => 'public', + * 'size' => 409, + * 'timestamp' => 1566205260 + * ] + * * @param string $item * @param string $base * @@ -395,9 +430,14 @@ protected function normalizeObject($item, $base) protected function normalizeUnixObject($item, $base) { $item = preg_replace('#\s+#', ' ', trim($item), 7); - list($permissions, /* $number */, /* $owner */, /* $group */, $size, /* $month */, /* $day */, /* $time*/, $name) = explode(' ', $item, 9); + + if (count(explode(' ', $item, 9)) !== 9) { + throw new RuntimeException("Metadata can't be parsed from item '$item' , not enough parts."); + } + + list($permissions, /* $number */, /* $owner */, /* $group */, $size, $month, $day, $timeOrYear, $name) = explode(' ', $item, 9); $type = $this->detectType($permissions); - $path = empty($base) ? $name : $base.$this->separator.$name; + $path = $base === '' ? $name : $base . $this->separator . $name; if ($type === 'dir') { return compact('type', 'path'); @@ -407,7 +447,44 @@ protected function normalizeUnixObject($item, $base) $visibility = $permissions & 0044 ? AdapterInterface::VISIBILITY_PUBLIC : AdapterInterface::VISIBILITY_PRIVATE; $size = (int) $size; - return compact('type', 'path', 'visibility', 'size'); + $result = compact('type', 'path', 'visibility', 'size'); + if ($this->enableTimestampsOnUnixListings) { + $timestamp = $this->normalizeUnixTimestamp($month, $day, $timeOrYear); + $result += compact('timestamp'); + } + + return $result; + } + + /** + * Only accurate to the minute (current year), or to the day. + * + * Inadequacies in timestamp accuracy are due to limitations of the FTP 'LIST' command + * + * Note: The 'MLSD' command is a machine-readable replacement for 'LIST' + * but many FTP servers do not support it :( + * + * @param string $month e.g. 'Aug' + * @param string $day e.g. '19' + * @param string $timeOrYear e.g. '09:01' OR '2015' + * + * @return int + */ + protected function normalizeUnixTimestamp($month, $day, $timeOrYear) + { + if (is_numeric($timeOrYear)) { + $year = $timeOrYear; + $hour = '00'; + $minute = '00'; + $seconds = '00'; + } else { + $year = date('Y'); + list($hour, $minute) = explode(':', $timeOrYear); + $seconds = '00'; + } + $dateTime = DateTime::createFromFormat('Y-M-j-G:i:s', "{$year}-{$month}-{$day}-{$hour}:{$minute}:{$seconds}"); + + return $dateTime->getTimestamp(); } /** @@ -421,12 +498,18 @@ protected function normalizeUnixObject($item, $base) protected function normalizeWindowsObject($item, $base) { $item = preg_replace('#\s+#', ' ', trim($item), 3); + + if (count(explode(' ', $item, 4)) !== 4) { + throw new RuntimeException("Metadata can't be parsed from item '$item' , not enough parts."); + } + list($date, $time, $size, $name) = explode(' ', $item, 4); - $path = empty($base) ? $name : $base.$this->separator.$name; + $path = $base === '' ? $name : $base . $this->separator . $name; // Check for the correct date/time format $format = strlen($date) === 8 ? 'm-d-yH:iA' : 'Y-m-dH:i'; - $timestamp = DateTime::createFromFormat($format, $date.$time)->getTimestamp(); + $dt = DateTime::createFromFormat($format, $date . $time); + $timestamp = $dt ? $dt->getTimestamp() : (int) strtotime("$date $time"); if ($size === '') { $type = 'dir'; @@ -450,11 +533,7 @@ protected function normalizeWindowsObject($item, $base) */ protected function detectSystemType($item) { - if (preg_match('/^[0-9]{2,4}-[0-9]{2}-[0-9]{2}/', $item)) { - return $this->systemType = 'windows'; - } - - return $this->systemType = 'unix'; + return preg_match('/^[0-9]{2,4}-[0-9]{2}-[0-9]{2}/', $item) ? 'windows' : 'unix'; } /** @@ -493,8 +572,8 @@ protected function normalizePermissions($permissions) return array_sum(str_split($part)); }; - // get the sum of the groups - return array_sum(array_map($mapper, $parts)); + // converts to decimal number + return octdec(implode('', array_map($mapper, $parts))); } /** @@ -507,11 +586,7 @@ protected function normalizePermissions($permissions) public function removeDotDirectories(array $list) { $filter = function ($line) { - if (! empty($line) && !preg_match('#.* \.(\.)?$|^total#', $line)) { - return true; - } - - return false; + return $line !== '' && ! preg_match('#.* \.(\.)?$|^total#', $line); }; return array_filter($list, $filter); @@ -548,7 +623,9 @@ public function getVisibility($path) */ public function ensureDirectory($dirname) { - if (! empty($dirname) && !$this->has($dirname)) { + $dirname = (string) $dirname; + + if ($dirname !== '' && ! $this->has($dirname)) { $this->createDir($dirname, new Config()); } } @@ -558,7 +635,10 @@ public function ensureDirectory($dirname) */ public function getConnection() { - if (! $this->isConnected()) { + $tries = 0; + + while ( ! $this->isConnected() && $tries < 3) { + $tries++; $this->disconnect(); $this->connect(); } diff --git a/application/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php b/application/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php new file mode 100644 index 0000000..fd8d216 --- /dev/null +++ b/application/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php @@ -0,0 +1,12 @@ +passive = $passive; } + /** + * @param bool $ignorePassiveAddress + */ + public function setIgnorePassiveAddress($ignorePassiveAddress) + { + $this->ignorePassiveAddress = $ignorePassiveAddress; + } + + /** + * @param bool $recurseManually + */ + public function setRecurseManually($recurseManually) + { + $this->recurseManually = $recurseManually; + } + + /** + * @param bool $utf8 + */ + public function setUtf8($utf8) + { + $this->utf8 = (bool) $utf8; + } + /** * Connect to the FTP server. */ @@ -84,13 +134,30 @@ public function connect() $this->connection = ftp_connect($this->getHost(), $this->getPort(), $this->getTimeout()); } - if (! $this->connection) { + if ( ! $this->connection) { throw new RuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort()); } $this->login(); + $this->setUtf8Mode(); $this->setConnectionPassiveMode(); $this->setConnectionRoot(); + $this->isPureFtpd = $this->isPureFtpdServer(); + } + + /** + * Set the connection to UTF-8 mode. + */ + protected function setUtf8Mode() + { + if ($this->utf8) { + $response = ftp_raw($this->connection, "OPTS UTF8 ON"); + if (substr($response[0], 0, 3) !== '200') { + throw new RuntimeException( + 'Could not set UTF-8 mode for connection: ' . $this->getHost() . '::' . $this->getPort() + ); + } + } } /** @@ -100,7 +167,11 @@ public function connect() */ protected function setConnectionPassiveMode() { - if (! ftp_pasv($this->connection, $this->passive)) { + if (is_bool($this->ignorePassiveAddress) && defined('FTP_USEPASVADDRESS')) { + ftp_set_option($this->connection, FTP_USEPASVADDRESS, ! $this->ignorePassiveAddress); + } + + if ( ! ftp_pasv($this->connection, $this->passive)) { throw new RuntimeException( 'Could not set passive mode for connection: ' . $this->getHost() . '::' . $this->getPort() ); @@ -115,7 +186,7 @@ protected function setConnectionRoot() $root = $this->getRoot(); $connection = $this->connection; - if (empty($root) === false && ! ftp_chdir($connection, $root)) { + if ($root && ! ftp_chdir($connection, $root)) { throw new RuntimeException('Root is invalid or does not exist: ' . $this->getRoot()); } @@ -133,14 +204,16 @@ protected function setConnectionRoot() */ protected function login() { - set_error_handler( - function () { - } + set_error_handler(function () { + }); + $isLoggedIn = ftp_login( + $this->connection, + $this->getUsername(), + $this->getPassword() ); - $isLoggedIn = ftp_login($this->connection, $this->getUsername(), $this->getPassword()); restore_error_handler(); - if (! $isLoggedIn) { + if ( ! $isLoggedIn) { $this->disconnect(); throw new RuntimeException( 'Could not login with connection: ' . $this->getHost() . '::' . $this->getPort( @@ -154,7 +227,7 @@ function () { */ public function disconnect() { - if ($this->isConnected()) { + if (is_resource($this->connection)) { ftp_close($this->connection); } @@ -177,7 +250,7 @@ public function write($path, $contents, Config $config) } $result['contents'] = $contents; - $result['mimetype'] = Util::guessMimeType($path, $contents); + $result['mimetype'] = $config->get('mimetype') ?: Util::guessMimeType($path, $contents); return $result; } @@ -189,7 +262,7 @@ public function writeStream($path, $resource, Config $config) { $this->ensureDirectory(Util::dirname($path)); - if (! ftp_fput($this->getConnection(), $path, $resource, $this->transferMode)) { + if ( ! ftp_fput($this->getConnection(), $path, $resource, $this->transferMode)) { return false; } @@ -197,7 +270,9 @@ public function writeStream($path, $resource, Config $config) $this->setVisibility($path, $visibility); } - return compact('path', 'visibility'); + $type = 'file'; + + return compact('type', 'path', 'visibility'); } /** @@ -238,14 +313,14 @@ public function delete($path) public function deleteDir($dirname) { $connection = $this->getConnection(); - $contents = array_reverse($this->listDirectoryContents($dirname)); + $contents = array_reverse($this->listDirectoryContents($dirname, false)); foreach ($contents as $object) { if ($object['type'] === 'file') { - if (! ftp_delete($connection, $object['path'])) { + if ( ! ftp_delete($connection, $object['path'])) { return false; } - } elseif (! ftp_rmdir($connection, $object['path'])) { + } elseif ( ! $this->deleteDir($object['path'])) { return false; } } @@ -273,7 +348,7 @@ public function createDir($dirname, Config $config) $this->setConnectionRoot(); - return ['path' => $dirname]; + return ['type' => 'dir', 'path' => $dirname]; } /** @@ -287,7 +362,7 @@ public function createDir($dirname, Config $config) protected function createActualDirectory($directory, $connection) { // List the current directory - $listing = ftp_nlist($connection, '.'); + $listing = ftp_nlist($connection, '.') ?: []; foreach ($listing as $key => $item) { if (preg_match('~^\./.*~', $item)) { @@ -295,7 +370,7 @@ protected function createActualDirectory($directory, $connection) } } - if (in_array($directory, $listing)) { + if (in_array($directory, $listing, true)) { return true; } @@ -307,24 +382,30 @@ protected function createActualDirectory($directory, $connection) */ public function getMetadata($path) { - $connection = $this->getConnection(); - if ($path === '') { return ['type' => 'dir', 'path' => '']; } - if (@ftp_chdir($connection, $path) === true) { + if (@ftp_chdir($this->getConnection(), $path) === true) { $this->setConnectionRoot(); return ['type' => 'dir', 'path' => $path]; } - $listing = ftp_rawlist($connection, $path); + $listing = $this->ftpRawlist('-A', str_replace('*', '\\*', $path)); + + if (empty($listing) || in_array('total 0', $listing, true)) { + return false; + } - if (empty($listing)) { + if (preg_match('/.* not found/', $listing[0])) { return false; } + if (preg_match('/^total [0-9]*$/', $listing[0])) { + array_shift($listing); + } + return $this->normalizeObject($listing[0], ''); } @@ -333,11 +414,11 @@ public function getMetadata($path) */ public function getMimetype($path) { - if (! $metadata = $this->read($path)) { + if ( ! $metadata = $this->getMetadata($path)) { return false; } - $metadata['mimetype'] = Util::guessMimeType($path, $metadata['contents']); + $metadata['mimetype'] = MimeType::detectByFilename($path); return $metadata; } @@ -349,7 +430,7 @@ public function getTimestamp($path) { $timestamp = ftp_mdtm($this->getConnection(), $path); - return ($timestamp !== -1) ? ['timestamp' => $timestamp] : false; + return ($timestamp !== -1) ? ['path' => $path, 'timestamp' => $timestamp] : false; } /** @@ -357,7 +438,7 @@ public function getTimestamp($path) */ public function read($path) { - if (! $object = $this->readStream($path)) { + if ( ! $object = $this->readStream($path)) { return false; } @@ -373,17 +454,17 @@ public function read($path) */ public function readStream($path) { - $stream = fopen('php://temp', 'w+'); + $stream = fopen('php://temp', 'w+b'); $result = ftp_fget($this->getConnection(), $stream, $path, $this->transferMode); rewind($stream); - if (! $result) { + if ( ! $result) { fclose($stream); return false; } - return compact('stream'); + return ['type' => 'file', 'path' => $path, 'stream' => $stream]; } /** @@ -393,11 +474,11 @@ public function setVisibility($path, $visibility) { $mode = $visibility === AdapterInterface::VISIBILITY_PUBLIC ? $this->getPermPublic() : $this->getPermPrivate(); - if (! ftp_chmod($this->getConnection(), $mode, $path)) { + if ( ! ftp_chmod($this->getConnection(), $mode, $path)) { return false; } - return compact('visibility'); + return compact('path', 'visibility'); } /** @@ -407,18 +488,85 @@ public function setVisibility($path, $visibility) */ protected function listDirectoryContents($directory, $recursive = true) { - $listing = ftp_rawlist($this->getConnection(), '-lna ' . $directory, $recursive); + $directory = str_replace('*', '\\*', $directory); + + if ($recursive && $this->recurseManually) { + return $this->listDirectoryContentsRecursive($directory); + } + + $options = $recursive ? '-alnR' : '-aln'; + $listing = $this->ftpRawlist($options, $directory); return $listing ? $this->normalizeListing($listing, $directory) : []; } + /** + * @inheritdoc + * + * @param string $directory + */ + protected function listDirectoryContentsRecursive($directory) + { + $listing = $this->normalizeListing($this->ftpRawlist('-aln', $directory) ?: [], $directory); + $output = []; + + foreach ($listing as $item) { + $output[] = $item; + if ($item['type'] !== 'dir') { + continue; + } + $output = array_merge($output, $this->listDirectoryContentsRecursive($item['path'])); + } + + return $output; + } + /** * Check if the connection is open. * * @return bool + * + * @throws ErrorException */ public function isConnected() { - return ! is_null($this->connection) && ftp_systype($this->connection) !== false; + try { + return is_resource($this->connection) && ftp_rawlist($this->connection, $this->getRoot()) !== false; + } catch (ErrorException $e) { + if (strpos($e->getMessage(), 'ftp_rawlist') === false) { + throw $e; + } + + return false; + } + } + + /** + * @return bool + */ + protected function isPureFtpdServer() + { + $response = ftp_raw($this->connection, 'HELP'); + + return stripos(implode(' ', $response), 'Pure-FTPd') !== false; + } + + /** + * The ftp_rawlist function with optional escaping. + * + * @param string $options + * @param string $path + * + * @return array + */ + protected function ftpRawlist($options, $path) + { + $connection = $this->getConnection(); + + if ($this->isPureFtpd) { + $path = str_replace(' ', '\ ', $path); + } + + return ftp_rawlist($connection, $options . ' ' . $path); } } diff --git a/application/vendor/league/flysystem/src/Adapter/Ftpd.php b/application/vendor/league/flysystem/src/Adapter/Ftpd.php index b7ac88d..d5349e4 100644 --- a/application/vendor/league/flysystem/src/Adapter/Ftpd.php +++ b/application/vendor/league/flysystem/src/Adapter/Ftpd.php @@ -9,7 +9,16 @@ class Ftpd extends Ftp */ public function getMetadata($path) { - if (empty($path) || !($object = ftp_raw($this->getConnection(), 'STAT '.$path)) || count($object) < 3) { + if ($path === '') { + return ['type' => 'dir', 'path' => '']; + } + if (@ftp_chdir($this->getConnection(), $path) === true) { + $this->setConnectionRoot(); + + return ['type' => 'dir', 'path' => $path]; + } + + if ( ! ($object = ftp_raw($this->getConnection(), 'STAT ' . $path)) || count($object) < 3) { return false; } @@ -27,7 +36,7 @@ protected function listDirectoryContents($directory, $recursive = true) { $listing = ftp_rawlist($this->getConnection(), $directory, $recursive); - if ($listing === false || (!empty($listing) && substr($listing[0], 0, 5) === "ftpd:")) { + if ($listing === false || ( ! empty($listing) && substr($listing[0], 0, 5) === "ftpd:")) { return []; } diff --git a/application/vendor/league/flysystem/src/Adapter/Local.php b/application/vendor/league/flysystem/src/Adapter/Local.php index f5ed5d4..c6e6fa8 100644 --- a/application/vendor/league/flysystem/src/Adapter/Local.php +++ b/application/vendor/league/flysystem/src/Adapter/Local.php @@ -4,11 +4,13 @@ use DirectoryIterator; use FilesystemIterator; -use Finfo; -use League\Flysystem\AdapterInterface; +use finfo as Finfo; use League\Flysystem\Config; +use League\Flysystem\Exception; use League\Flysystem\NotSupportedException; +use League\Flysystem\UnreadableFileException; use League\Flysystem\Util; +use LogicException; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; use SplFileInfo; @@ -30,13 +32,13 @@ class Local extends AbstractAdapter */ protected static $permissions = [ 'file' => [ - 'public' => 0744, - 'private' => 0700, + 'public' => 0644, + 'private' => 0600, ], 'dir' => [ 'public' => 0755, 'private' => 0700, - ] + ], ]; /** @@ -53,6 +55,7 @@ class Local extends AbstractAdapter * @var int */ protected $writeFlags; + /** * @var int */ @@ -65,18 +68,20 @@ class Local extends AbstractAdapter * @param int $writeFlags * @param int $linkHandling * @param array $permissions + * + * @throws LogicException */ public function __construct($root, $writeFlags = LOCK_EX, $linkHandling = self::DISALLOW_LINKS, array $permissions = []) { - // permissionMap needs to be set before ensureDirectory() is called. + $root = is_link($root) ? realpath($root) : $root; $this->permissionMap = array_replace_recursive(static::$permissions, $permissions); - $realRoot = $this->ensureDirectory($root); + $this->ensureDirectory($root); - if (! is_dir($realRoot) || !is_readable($realRoot)) { - throw new \LogicException('The root path '.$root.' is not readable.'); + if ( ! is_dir($root) || ! is_readable($root)) { + throw new LogicException('The root path ' . $root . ' is not readable.'); } - $this->setPathPrefix($realRoot); + $this->setPathPrefix($root); $this->writeFlags = $writeFlags; $this->linkHandling = $linkHandling; } @@ -86,17 +91,27 @@ public function __construct($root, $writeFlags = LOCK_EX, $linkHandling = self:: * * @param string $root root directory path * - * @return string real path to root + * @return void + * + * @throws Exception in case the root directory can not be created */ protected function ensureDirectory($root) { - if (! is_dir($root)) { + if ( ! is_dir($root)) { $umask = umask(0); - mkdir($root, $this->permissionMap['dir']['public'], true); + + if ( ! @mkdir($root, $this->permissionMap['dir']['public'], true)) { + $mkdirError = error_get_last(); + } + umask($umask); - } + clearstatcache(false, $root); - return realpath($root); + if ( ! is_dir($root)) { + $errorMessage = isset($mkdirError['message']) ? $mkdirError['message'] : ''; + throw new Exception(sprintf('Impossible to create the root directory "%s". %s', $root, $errorMessage)); + } + } } /** @@ -139,23 +154,21 @@ public function writeStream($path, $resource, Config $config) { $location = $this->applyPathPrefix($path); $this->ensureDirectory(dirname($location)); - $stream = fopen($location, 'w+'); + $stream = fopen($location, 'w+b'); - if (! $stream) { + if ( ! $stream || stream_copy_to_stream($resource, $stream) === false || ! fclose($stream)) { return false; } - stream_copy_to_stream($resource, $stream); - - if (! fclose($stream)) { - return false; - } + $type = 'file'; + $result = compact('type', 'path'); if ($visibility = $config->get('visibility')) { $this->setVisibility($path, $visibility); + $result['visibility'] = $visibility; } - return compact('path', 'visibility'); + return $result; } /** @@ -164,9 +177,9 @@ public function writeStream($path, $resource, Config $config) public function readStream($path) { $location = $this->applyPathPrefix($path); - $stream = fopen($location, 'r'); + $stream = fopen($location, 'rb'); - return compact('stream', 'path'); + return ['type' => 'file', 'path' => $path, 'stream' => $stream]; } /** @@ -183,14 +196,21 @@ public function updateStream($path, $resource, Config $config) public function update($path, $contents, Config $config) { $location = $this->applyPathPrefix($path); - $mimetype = Util::guessMimeType($path, $contents); $size = file_put_contents($location, $contents, $this->writeFlags); if ($size === false) { return false; } - return compact('path', 'size', 'contents', 'mimetype'); + $type = 'file'; + + $result = compact('type', 'path', 'size', 'contents'); + + if ($mimetype = $config->get('mimetype') ?: Util::guessMimeType($path, $contents)) { + $result['mimetype'] = $mimetype; + } + + return $result; } /** @@ -199,13 +219,13 @@ public function update($path, $contents, Config $config) public function read($path) { $location = $this->applyPathPrefix($path); - $contents = file_get_contents($location); + $contents = @file_get_contents($location); if ($contents === false) { return false; } - return compact('contents', 'path'); + return ['type' => 'file', 'path' => $path, 'contents' => $contents]; } /** @@ -240,7 +260,7 @@ public function delete($path) { $location = $this->applyPathPrefix($path); - return unlink($location); + return @unlink($location); } /** @@ -249,9 +269,9 @@ public function delete($path) public function listContents($directory = '', $recursive = false) { $result = []; - $location = $this->applyPathPrefix($directory).$this->pathSeparator; + $location = $this->applyPathPrefix($directory); - if (! is_dir($location)) { + if ( ! is_dir($location)) { return []; } @@ -276,6 +296,7 @@ public function listContents($directory = '', $recursive = false) public function getMetadata($path) { $location = $this->applyPathPrefix($path); + clearstatcache(false, $location); $info = new SplFileInfo($location); return $this->normalizeFileInfo($info); @@ -296,8 +317,13 @@ public function getMimetype($path) { $location = $this->applyPathPrefix($path); $finfo = new Finfo(FILEINFO_MIME_TYPE); + $mimetype = $finfo->file($location); - return ['mimetype' => $finfo->file($location)]; + if (in_array($mimetype, ['application/octet-stream', 'inode/x-empty', 'application/x-empty'])) { + $mimetype = Util\MimeType::detectByFilename($location); + } + + return ['path' => $path, 'type' => 'file', 'mimetype' => $mimetype]; } /** @@ -316,9 +342,17 @@ public function getVisibility($path) $location = $this->applyPathPrefix($path); clearstatcache(false, $location); $permissions = octdec(substr(sprintf('%o', fileperms($location)), -4)); - $visibility = $permissions & 0044 ? AdapterInterface::VISIBILITY_PUBLIC : AdapterInterface::VISIBILITY_PRIVATE; + $type = is_dir($location) ? 'dir' : 'file'; - return compact('visibility'); + foreach ($this->permissionMap[$type] as $visibility => $visibilityPermissions) { + if ($visibilityPermissions == $permissions) { + return compact('path', 'visibility'); + } + } + + $visibility = substr(sprintf('%o', fileperms($location)), -4); + + return compact('path', 'visibility'); } /** @@ -328,9 +362,13 @@ public function setVisibility($path, $visibility) { $location = $this->applyPathPrefix($path); $type = is_dir($location) ? 'dir' : 'file'; - chmod($location, $this->permissionMap[$type][$visibility]); + $success = chmod($location, $this->permissionMap[$type][$visibility]); + + if ($success === false) { + return false; + } - return compact('visibility'); + return compact('path', 'visibility'); } /** @@ -341,11 +379,13 @@ public function createDir($dirname, Config $config) $location = $this->applyPathPrefix($dirname); $umask = umask(0); $visibility = $config->get('visibility', 'public'); + $return = ['path' => $dirname, 'type' => 'dir']; - if (! is_dir($location) && !mkdir($location, $this->permissionMap['dir'][$visibility], true)) { - $return = false; - } else { - $return = ['path' => $dirname, 'type' => 'dir']; + if ( ! is_dir($location)) { + if (false === @mkdir($location, $this->permissionMap['dir'][$visibility], true) + || false === is_dir($location)) { + $return = false; + } } umask($umask); @@ -360,42 +400,50 @@ public function deleteDir($dirname) { $location = $this->applyPathPrefix($dirname); - if (! is_dir($location)) { + if ( ! is_dir($location)) { return false; } - $contents = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($location, FilesystemIterator::SKIP_DOTS), - RecursiveIteratorIterator::CHILD_FIRST - ); + $contents = $this->getRecursiveDirectoryIterator($location, RecursiveIteratorIterator::CHILD_FIRST); /** @var SplFileInfo $file */ foreach ($contents as $file) { - switch ($file->getType()) { - case 'dir': - rmdir($file->getRealPath()); - break; - case 'link': - unlink($file->getPathname()); - break; - default: - unlink($file->getRealPath()); - } + $this->guardAgainstUnreadableFileInfo($file); + $this->deleteFileInfoObject($file); } return rmdir($location); } + /** + * @param SplFileInfo $file + */ + protected function deleteFileInfoObject(SplFileInfo $file) + { + switch ($file->getType()) { + case 'dir': + rmdir($file->getRealPath()); + break; + case 'link': + unlink($file->getPathname()); + break; + default: + unlink($file->getRealPath()); + } + } + /** * Normalize the file info. * * @param SplFileInfo $file * - * @return array + * @return array|void + * + * @throws NotSupportedException */ protected function normalizeFileInfo(SplFileInfo $file) { - if (! $file->isLink()) { + if ( ! $file->isLink()) { return $this->mapFileInfo($file); } @@ -421,15 +469,16 @@ protected function getFilePath(SplFileInfo $file) /** * @param string $path + * @param int $mode * * @return RecursiveIteratorIterator */ - protected function getRecursiveDirectoryIterator($path) + protected function getRecursiveDirectoryIterator($path, $mode = RecursiveIteratorIterator::SELF_FIRST) { - $directory = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS); - $iterator = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST); - - return $iterator; + return new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), + $mode + ); } /** @@ -466,12 +515,14 @@ protected function mapFileInfo(SplFileInfo $file) } /** - * @inheritdoc + * @param SplFileInfo $file + * + * @throws UnreadableFileException */ - public function applyPathPrefix($path) + protected function guardAgainstUnreadableFileInfo(SplFileInfo $file) { - $prefixedPath = parent::applyPathPrefix($path); - - return str_replace('/', DIRECTORY_SEPARATOR, $prefixedPath); + if ( ! $file->isReadable()) { + throw UnreadableFileException::forFileInfo($file); + } } } diff --git a/application/vendor/league/flysystem/src/Adapter/NullAdapter.php b/application/vendor/league/flysystem/src/Adapter/NullAdapter.php index e3f4904..2527087 100644 --- a/application/vendor/league/flysystem/src/Adapter/NullAdapter.php +++ b/application/vendor/league/flysystem/src/Adapter/NullAdapter.php @@ -29,7 +29,7 @@ public function has($path) public function write($path, $contents, Config $config) { $type = 'file'; - $result = compact('contents', 'type', 'size', 'path'); + $result = compact('contents', 'type', 'path'); if ($visibility = $config->get('visibility')) { $result['visibility'] = $visibility; diff --git a/application/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php b/application/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php index 64de443..fc0a747 100644 --- a/application/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php +++ b/application/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php @@ -15,7 +15,7 @@ trait NotSupportingVisibilityTrait */ public function getVisibility($path) { - throw new LogicException(get_class($this).' does not support visibility. Path: '.$path); + throw new LogicException(get_class($this) . ' does not support visibility. Path: ' . $path); } /** @@ -28,6 +28,6 @@ public function getVisibility($path) */ public function setVisibility($path, $visibility) { - throw new LogicException(get_class($this).' does not support visibility. Path: '.$path.', visibility: '.$visibility); + throw new LogicException(get_class($this) . ' does not support visibility. Path: ' . $path . ', visibility: ' . $visibility); } } diff --git a/application/vendor/league/flysystem/src/Adapter/Polyfill/StreamedCopyTrait.php b/application/vendor/league/flysystem/src/Adapter/Polyfill/StreamedCopyTrait.php index 44ed2e0..1b491a4 100644 --- a/application/vendor/league/flysystem/src/Adapter/Polyfill/StreamedCopyTrait.php +++ b/application/vendor/league/flysystem/src/Adapter/Polyfill/StreamedCopyTrait.php @@ -18,7 +18,7 @@ public function copy($path, $newpath) { $response = $this->readStream($path); - if ($response === false || !is_resource($response['stream'])) { + if ($response === false || ! is_resource($response['stream'])) { return false; } @@ -35,11 +35,17 @@ public function copy($path, $newpath) /** * @param string $path + * + * @return resource */ abstract public function readStream($path); /** - * @param string $path + * @param string $path + * @param resource $resource + * @param Config $config + * + * @return resource */ abstract public function writeStream($path, $resource, Config $config); } diff --git a/application/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php b/application/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php index 3cd6ab4..2b31c01 100644 --- a/application/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php +++ b/application/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php @@ -2,22 +2,27 @@ namespace League\Flysystem\Adapter\Polyfill; +/** + * A helper for adapters that only handle strings to provide read streams. + */ trait StreamedReadingTrait { /** - * Get the contents of a file in a stream. + * Reads a file as a stream. * * @param string $path * - * @return resource|false false when not found, or a resource + * @return array|false + * + * @see League\Flysystem\ReadInterface::readStream() */ public function readStream($path) { - if (! $data = $this->read($path)) { + if ( ! $data = $this->read($path)) { return false; } - $stream = tmpfile(); + $stream = fopen('php://temp', 'w+b'); fwrite($stream, $data['contents']); rewind($stream); $data['stream'] = $stream; @@ -26,12 +31,14 @@ public function readStream($path) return $data; } - // Required abstract method - /** + * Reads a file. + * * @param string $path * - * @return resource + * @return array|false + * + * @see League\Flysystem\ReadInterface::read() */ abstract public function read($path); } diff --git a/application/vendor/league/flysystem/src/Config.php b/application/vendor/league/flysystem/src/Config.php index 00cf752..639f43d 100644 --- a/application/vendor/league/flysystem/src/Config.php +++ b/application/vendor/league/flysystem/src/Config.php @@ -10,7 +10,7 @@ class Config protected $settings = []; /** - * @var Config + * @var Config|null */ protected $fallback; @@ -34,7 +34,7 @@ public function __construct(array $settings = []) */ public function get($key, $default = null) { - if (! array_key_exists($key, $this->settings)) { + if ( ! array_key_exists($key, $this->settings)) { return $this->getDefault($key, $default); } @@ -50,7 +50,13 @@ public function get($key, $default = null) */ public function has($key) { - return array_key_exists($key, $this->settings); + if (array_key_exists($key, $this->settings)) { + return true; + } + + return $this->fallback instanceof Config + ? $this->fallback->has($key) + : false; } /** @@ -63,7 +69,7 @@ public function has($key) */ protected function getDefault($key, $default) { - if (! $this->fallback) { + if ( ! $this->fallback) { return $default; } diff --git a/application/vendor/league/flysystem/src/ConfigAwareTrait.php b/application/vendor/league/flysystem/src/ConfigAwareTrait.php index 2476c6a..202d605 100644 --- a/application/vendor/league/flysystem/src/ConfigAwareTrait.php +++ b/application/vendor/league/flysystem/src/ConfigAwareTrait.php @@ -19,7 +19,7 @@ trait ConfigAwareTrait */ protected function setConfig($config) { - $this->config = $config ? Util::ensureConfig($config) : null; + $this->config = $config ? Util::ensureConfig($config) : new Config; } /** @@ -29,10 +29,6 @@ protected function setConfig($config) */ public function getConfig() { - if ($this->config === null) { - return $this->config = new Config; - } - return $this->config; } diff --git a/application/vendor/league/flysystem/src/Directory.php b/application/vendor/league/flysystem/src/Directory.php index 6ba744b..d4f90a8 100644 --- a/application/vendor/league/flysystem/src/Directory.php +++ b/application/vendor/league/flysystem/src/Directory.php @@ -2,6 +2,9 @@ namespace League\Flysystem; +/** + * @deprecated + */ class Directory extends Handler { /** diff --git a/application/vendor/league/flysystem/src/File.php b/application/vendor/league/flysystem/src/File.php index 3294af5..4a4b7a0 100644 --- a/application/vendor/league/flysystem/src/File.php +++ b/application/vendor/league/flysystem/src/File.php @@ -2,6 +2,9 @@ namespace League\Flysystem; +/** + * @deprecated + */ class File extends Handler { /** @@ -17,7 +20,7 @@ public function exists() /** * Read the file. * - * @return string file contents + * @return string|false file contents */ public function read() { @@ -27,7 +30,7 @@ public function read() /** * Read the file as a stream. * - * @return resource file stream + * @return resource|false file stream */ public function readStream() { @@ -143,7 +146,7 @@ public function copy($newpath) /** * Get the file's timestamp. * - * @return int unix timestamp + * @return string|false The timestamp or false on failure. */ public function getTimestamp() { @@ -153,7 +156,7 @@ public function getTimestamp() /** * Get the file's mimetype. * - * @return string mimetime + * @return string|false The file mime-type or false on failure. */ public function getMimetype() { @@ -163,7 +166,7 @@ public function getMimetype() /** * Get the file's visibility. * - * @return string visibility + * @return string|false The visibility (public|private) or false on failure. */ public function getVisibility() { @@ -173,7 +176,7 @@ public function getVisibility() /** * Get the file's metadata. * - * @return array + * @return array|false The file metadata or false on failure. */ public function getMetadata() { @@ -183,7 +186,7 @@ public function getMetadata() /** * Get the file size. * - * @return int file size + * @return int|false The file size or false on failure. */ public function getSize() { diff --git a/application/vendor/league/flysystem/src/FileExistsException.php b/application/vendor/league/flysystem/src/FileExistsException.php index c0b63da..c82e20c 100644 --- a/application/vendor/league/flysystem/src/FileExistsException.php +++ b/application/vendor/league/flysystem/src/FileExistsException.php @@ -22,11 +22,11 @@ public function __construct($path, $code = 0, BaseException $previous = null) { $this->path = $path; - parent::__construct('File already exists at path: '.$this->getPath(), $code, $previous); + parent::__construct('File already exists at path: ' . $this->getPath(), $code, $previous); } /** - * Get the path which was not found. + * Get the path which was found. * * @return string */ diff --git a/application/vendor/league/flysystem/src/FileNotFoundException.php b/application/vendor/league/flysystem/src/FileNotFoundException.php index b66a4cc..989df69 100644 --- a/application/vendor/league/flysystem/src/FileNotFoundException.php +++ b/application/vendor/league/flysystem/src/FileNotFoundException.php @@ -22,7 +22,7 @@ public function __construct($path, $code = 0, BaseException $previous = null) { $this->path = $path; - parent::__construct('File not found at path: '.$this->getPath(), $code, $previous); + parent::__construct('File not found at path: ' . $this->getPath(), $code, $previous); } /** diff --git a/application/vendor/league/flysystem/src/Filesystem.php b/application/vendor/league/flysystem/src/Filesystem.php index 84e204b..18b590e 100644 --- a/application/vendor/league/flysystem/src/Filesystem.php +++ b/application/vendor/league/flysystem/src/Filesystem.php @@ -3,11 +3,14 @@ namespace League\Flysystem; use InvalidArgumentException; +use League\Flysystem\Adapter\CanOverwriteFiles; use League\Flysystem\Plugin\PluggableTrait; use League\Flysystem\Util\ContentListingFormatter; /** * @method array getWithMetadata(string $path, array $metadata) + * @method bool forceCopy(string $path, string $newpath) + * @method bool forceRename(string $path, string $newpath) * @method array listFiles(string $path = '', boolean $recursive = false) * @method array listPaths(string $path = '', boolean $recursive = false) * @method array listWith(array $keys = [], $directory = '', $recursive = false) @@ -51,7 +54,7 @@ public function has($path) { $path = Util::normalizePath($path); - return (bool) $this->getAdapter()->has($path); + return strlen($path) === 0 ? false : (bool) $this->getAdapter()->has($path); } /** @@ -71,7 +74,7 @@ public function write($path, $contents, array $config = []) */ public function writeStream($path, $resource, array $config = []) { - if (! is_resource($resource)) { + if ( ! is_resource($resource)) { throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); } @@ -92,7 +95,7 @@ public function put($path, $contents, array $config = []) $path = Util::normalizePath($path); $config = $this->prepareConfig($config); - if ($this->has($path)) { + if ( ! $this->getAdapter() instanceof CanOverwriteFiles && $this->has($path)) { return (bool) $this->getAdapter()->update($path, $contents, $config); } @@ -104,7 +107,7 @@ public function put($path, $contents, array $config = []) */ public function putStream($path, $resource, array $config = []) { - if (! is_resource($resource)) { + if ( ! is_resource($resource)) { throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); } @@ -112,7 +115,7 @@ public function putStream($path, $resource, array $config = []) $config = $this->prepareConfig($config); Util::rewindStream($resource); - if ($this->has($path)) { + if ( ! $this->getAdapter() instanceof CanOverwriteFiles && $this->has($path)) { return (bool) $this->getAdapter()->updateStream($path, $resource, $config); } @@ -155,7 +158,7 @@ public function update($path, $contents, array $config = []) */ public function updateStream($path, $resource, array $config = []) { - if (! is_resource($resource)) { + if ( ! is_resource($resource)) { throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); } @@ -175,7 +178,7 @@ public function read($path) $path = Util::normalizePath($path); $this->assertPresent($path); - if (! ($object = $this->getAdapter()->read($path))) { + if ( ! ($object = $this->getAdapter()->read($path))) { return false; } @@ -190,7 +193,7 @@ public function readStream($path) $path = Util::normalizePath($path); $this->assertPresent($path); - if (! $object = $this->getAdapter()->readStream($path)) { + if ( ! $object = $this->getAdapter()->readStream($path)) { return false; } @@ -267,7 +270,8 @@ public function listContents($directory = '', $recursive = false) $directory = Util::normalizePath($directory); $contents = $this->getAdapter()->listContents($directory, $recursive); - return (new ContentListingFormatter($directory, $recursive))->formatListing($contents); + return (new ContentListingFormatter($directory, $recursive, $this->config->get('case_sensitive', true))) + ->formatListing($contents); } /** @@ -278,7 +282,7 @@ public function getMimetype($path) $path = Util::normalizePath($path); $this->assertPresent($path); - if (! $object = $this->getAdapter()->getMimetype($path)) { + if (( ! $object = $this->getAdapter()->getMimetype($path)) || ! array_key_exists('mimetype', $object)) { return false; } @@ -293,7 +297,7 @@ public function getTimestamp($path) $path = Util::normalizePath($path); $this->assertPresent($path); - if (! $object = $this->getAdapter()->getTimestamp($path)) { + if (( ! $object = $this->getAdapter()->getTimestamp($path)) || ! array_key_exists('timestamp', $object)) { return false; } @@ -308,7 +312,7 @@ public function getVisibility($path) $path = Util::normalizePath($path); $this->assertPresent($path); - if (($object = $this->getAdapter()->getVisibility($path)) === false) { + if (( ! $object = $this->getAdapter()->getVisibility($path)) || ! array_key_exists('visibility', $object)) { return false; } @@ -321,8 +325,9 @@ public function getVisibility($path) public function getSize($path) { $path = Util::normalizePath($path); + $this->assertPresent($path); - if (($object = $this->getAdapter()->getSize($path)) === false || !isset($object['size'])) { + if (( ! $object = $this->getAdapter()->getSize($path)) || ! array_key_exists('size', $object)) { return false; } @@ -335,6 +340,7 @@ public function getSize($path) public function setVisibility($path, $visibility) { $path = Util::normalizePath($path); + $this->assertPresent($path); return (bool) $this->getAdapter()->setVisibility($path, $visibility); } @@ -357,7 +363,7 @@ public function get($path, Handler $handler = null) { $path = Util::normalizePath($path); - if (! $handler) { + if ( ! $handler) { $metadata = $this->getMetadata($path); $handler = $metadata['type'] === 'file' ? new File($this, $path) : new Directory($this, $path); } @@ -374,10 +380,12 @@ public function get($path, Handler $handler = null) * @param string $path path to file * * @throws FileNotFoundException + * + * @return void */ public function assertPresent($path) { - if (! $this->has($path)) { + if ($this->config->get('disable_asserts', false) === false && ! $this->has($path)) { throw new FileNotFoundException($path); } } @@ -388,10 +396,12 @@ public function assertPresent($path) * @param string $path path to file * * @throws FileExistsException + * + * @return void */ public function assertAbsent($path) { - if ($this->has($path)) { + if ($this->config->get('disable_asserts', false) === false && $this->has($path)) { throw new FileExistsException($path); } } diff --git a/application/vendor/league/flysystem/src/FilesystemInterface.php b/application/vendor/league/flysystem/src/FilesystemInterface.php index d631443..09b811b 100644 --- a/application/vendor/league/flysystem/src/FilesystemInterface.php +++ b/application/vendor/league/flysystem/src/FilesystemInterface.php @@ -2,6 +2,8 @@ namespace League\Flysystem; +use InvalidArgumentException; + interface FilesystemInterface { /** @@ -61,6 +63,8 @@ public function getMetadata($path); * * @param string $path The path to the file. * + * @throws FileNotFoundException + * * @return int|false The file size or false on failure. */ public function getSize($path); @@ -216,6 +220,8 @@ public function createDir($dirname, array $config = []); * @param string $path The path to the file. * @param string $visibility One of 'public' or 'private'. * + * @throws FileNotFoundException + * * @return bool True on success, false on failure. */ public function setVisibility($path, $visibility); @@ -258,6 +264,8 @@ public function readAndDelete($path); /** * Get a file/directory handler. * + * @deprecated + * * @param string $path The path to the file. * @param Handler $handler An optional existing handler to populate. * diff --git a/application/vendor/league/flysystem/src/FilesystemNotFoundException.php b/application/vendor/league/flysystem/src/FilesystemNotFoundException.php new file mode 100644 index 0000000..0c16aa0 --- /dev/null +++ b/application/vendor/league/flysystem/src/FilesystemNotFoundException.php @@ -0,0 +1,12 @@ + Filesystem,] + * + * @throws InvalidArgumentException */ public function __construct(array $filesystems = []) { @@ -65,7 +45,9 @@ public function __construct(array $filesystems = []) /** * Mount filesystems. * - * @param array $filesystems [:prefix => Filesystem,] + * @param FilesystemInterface[] $filesystems [:prefix => Filesystem,] + * + * @throws InvalidArgumentException * * @return $this */ @@ -84,12 +66,14 @@ public function mountFilesystems(array $filesystems) * @param string $prefix * @param FilesystemInterface $filesystem * + * @throws InvalidArgumentException + * * @return $this */ public function mountFilesystem($prefix, FilesystemInterface $filesystem) { - if (! is_string($prefix)) { - throw new InvalidArgumentException(__METHOD__.' expects argument #1 to be a string.'); + if ( ! is_string($prefix)) { + throw new InvalidArgumentException(__METHOD__ . ' expects argument #1 to be a string.'); } $this->filesystems[$prefix] = $filesystem; @@ -102,14 +86,14 @@ public function mountFilesystem($prefix, FilesystemInterface $filesystem) * * @param string $prefix * - * @throws LogicException + * @throws FilesystemNotFoundException * * @return FilesystemInterface */ public function getFilesystem($prefix) { - if (! isset($this->filesystems[$prefix])) { - throw new LogicException('No filesystem mounted with prefix '.$prefix); + if ( ! isset($this->filesystems[$prefix])) { + throw new FilesystemNotFoundException('No filesystem mounted with prefix ' . $prefix); } return $this->filesystems[$prefix]; @@ -120,25 +104,23 @@ public function getFilesystem($prefix) * * @param array $arguments * + * @throws InvalidArgumentException + * * @return array [:prefix, :arguments] */ public function filterPrefix(array $arguments) { if (empty($arguments)) { - throw new LogicException('At least one argument needed'); + throw new InvalidArgumentException('At least one argument needed'); } $path = array_shift($arguments); - if (! is_string($path)) { + if ( ! is_string($path)) { throw new InvalidArgumentException('First argument should be a string'); } - if (! preg_match('#^.+\:\/\/.*#', $path)) { - throw new InvalidArgumentException('No prefix detected in path: '.$path); - } - - list($prefix, $path) = explode('://', $path, 2); + list($prefix, $path) = $this->getPrefixAndPath($path); array_unshift($arguments, $path); return [$prefix, $arguments]; @@ -148,13 +130,15 @@ public function filterPrefix(array $arguments) * @param string $directory * @param bool $recursive * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException + * * @return array */ public function listContents($directory = '', $recursive = false) { - list($prefix, $arguments) = $this->filterPrefix([$directory]); + list($prefix, $directory) = $this->getPrefixAndPath($directory); $filesystem = $this->getFilesystem($prefix); - $directory = array_shift($arguments); $result = $filesystem->listContents($directory, $recursive); foreach ($result as &$file) { @@ -170,6 +154,9 @@ public function listContents($directory = '', $recursive = false) * @param string $method * @param array $arguments * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException + * * @return mixed */ public function __call($method, $arguments) @@ -180,26 +167,29 @@ public function __call($method, $arguments) } /** - * @param $from - * @param $to + * @param string $from + * @param string $to + * @param array $config + * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException + * @throws FileExistsException * * @return bool */ - public function copy($from, $to) + public function copy($from, $to, array $config = []) { - list($prefixFrom, $arguments) = $this->filterPrefix([$from]); + list($prefixFrom, $from) = $this->getPrefixAndPath($from); - $fsFrom = $this->getFilesystem($prefixFrom); - $buffer = call_user_func_array([$fsFrom, 'readStream'], $arguments); + $buffer = $this->getFilesystem($prefixFrom)->readStream($from); if ($buffer === false) { return false; } - list($prefixTo, $arguments) = $this->filterPrefix([$to]); + list($prefixTo, $to) = $this->getPrefixAndPath($to); - $fsTo = $this->getFilesystem($prefixTo); - $result = call_user_func_array([$fsTo, 'writeStream'], array_merge($arguments, [$buffer])); + $result = $this->getFilesystem($prefixTo)->writeStream($to, $buffer, $config); if (is_resource($buffer)) { fclose($buffer); @@ -214,11 +204,15 @@ public function copy($from, $to) * @param array $keys * @param string $directory * @param bool $recursive + * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException + * + * @return array */ public function listWith(array $keys = [], $directory = '', $recursive = false) { - list($prefix, $arguments) = $this->filterPrefix([$directory]); - $directory = $arguments[0]; + list($prefix, $directory) = $this->getPrefixAndPath($directory); $arguments = [$keys, $directory, $recursive]; return $this->invokePluginOnFilesystem('listWith', $arguments, $prefix); @@ -227,14 +221,32 @@ public function listWith(array $keys = [], $directory = '', $recursive = false) /** * Move a file. * - * @param $from - * @param $to + * @param string $from + * @param string $to + * @param array $config + * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException * * @return bool */ - public function move($from, $to) + public function move($from, $to, array $config = []) { - $copied = $this->copy($from, $to); + list($prefixFrom, $pathFrom) = $this->getPrefixAndPath($from); + list($prefixTo, $pathTo) = $this->getPrefixAndPath($to); + + if ($prefixFrom === $prefixTo) { + $filesystem = $this->getFilesystem($prefixFrom); + $renamed = $filesystem->rename($pathFrom, $pathTo); + + if ($renamed && isset($config['visibility'])) { + return $filesystem->setVisibility($pathTo, $config['visibility']); + } + + return $renamed; + } + + $copied = $this->copy($from, $to, $config); if ($copied) { return $this->delete($from); @@ -246,9 +258,11 @@ public function move($from, $to) /** * Invoke a plugin on a filesystem mounted on a given prefix. * - * @param $method - * @param $arguments - * @param $prefix + * @param string $method + * @param array $arguments + * @param string $prefix + * + * @throws FilesystemNotFoundException * * @return mixed */ @@ -266,4 +280,369 @@ public function invokePluginOnFilesystem($method, $arguments, $prefix) return call_user_func_array($callback, $arguments); } + + /** + * @param string $path + * + * @throws InvalidArgumentException + * + * @return string[] [:prefix, :path] + */ + protected function getPrefixAndPath($path) + { + if (strpos($path, '://') < 1) { + throw new InvalidArgumentException('No prefix detected in path: ' . $path); + } + + return explode('://', $path, 2); + } + + /** + * Check whether a file exists. + * + * @param string $path + * + * @return bool + */ + public function has($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->has($path); + } + + /** + * Read a file. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file contents or false on failure. + */ + public function read($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->read($path); + } + + /** + * Retrieves a read-stream for a path. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return resource|false The path resource or false on failure. + */ + public function readStream($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->readStream($path); + } + + /** + * Get a file's metadata. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return array|false The file metadata or false on failure. + */ + public function getMetadata($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getMetadata($path); + } + + /** + * Get a file's size. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return int|false The file size or false on failure. + */ + public function getSize($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getSize($path); + } + + /** + * Get a file's mime-type. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file mime-type or false on failure. + */ + public function getMimetype($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getMimetype($path); + } + + /** + * Get a file's timestamp. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The timestamp or false on failure. + */ + public function getTimestamp($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getTimestamp($path); + } + + /** + * Get a file's visibility. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The visibility (public|private) or false on failure. + */ + public function getVisibility($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getVisibility($path); + } + + /** + * Write a new file. + * + * @param string $path The path of the new file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @throws FileExistsException + * + * @return bool True on success, false on failure. + */ + public function write($path, $contents, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->write($path, $contents, $config); + } + + /** + * Write a new file using a stream. + * + * @param string $path The path of the new file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException If $resource is not a file handle. + * @throws FileExistsException + * + * @return bool True on success, false on failure. + */ + public function writeStream($path, $resource, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->writeStream($path, $resource, $config); + } + + /** + * Update an existing file. + * + * @param string $path The path of the existing file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function update($path, $contents, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->update($path, $contents, $config); + } + + /** + * Update an existing file using a stream. + * + * @param string $path The path of the existing file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException If $resource is not a file handle. + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function updateStream($path, $resource, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->updateStream($path, $resource, $config); + } + + /** + * Rename a file. + * + * @param string $path Path to the existing file. + * @param string $newpath The new path of the file. + * + * @throws FileExistsException Thrown if $newpath exists. + * @throws FileNotFoundException Thrown if $path does not exist. + * + * @return bool True on success, false on failure. + */ + public function rename($path, $newpath) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->rename($path, $newpath); + } + + /** + * Delete a file. + * + * @param string $path + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function delete($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->delete($path); + } + + /** + * Delete a directory. + * + * @param string $dirname + * + * @throws RootViolationException Thrown if $dirname is empty. + * + * @return bool True on success, false on failure. + */ + public function deleteDir($dirname) + { + list($prefix, $dirname) = $this->getPrefixAndPath($dirname); + + return $this->getFilesystem($prefix)->deleteDir($dirname); + } + + /** + * Create a directory. + * + * @param string $dirname The name of the new directory. + * @param array $config An optional configuration array. + * + * @return bool True on success, false on failure. + */ + public function createDir($dirname, array $config = []) + { + list($prefix, $dirname) = $this->getPrefixAndPath($dirname); + + return $this->getFilesystem($prefix)->createDir($dirname); + } + + /** + * Set the visibility for a file. + * + * @param string $path The path to the file. + * @param string $visibility One of 'public' or 'private'. + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function setVisibility($path, $visibility) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->setVisibility($path, $visibility); + } + + /** + * Create a file or update if exists. + * + * @param string $path The path to the file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @return bool True on success, false on failure. + */ + public function put($path, $contents, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->put($path, $contents, $config); + } + + /** + * Create a file or update if exists. + * + * @param string $path The path to the file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException Thrown if $resource is not a resource. + * + * @return bool True on success, false on failure. + */ + public function putStream($path, $resource, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->putStream($path, $resource, $config); + } + + /** + * Read and delete a file. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file contents, or false on failure. + */ + public function readAndDelete($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->readAndDelete($path); + } + + /** + * Get a file/directory handler. + * + * @deprecated + * + * @param string $path The path to the file. + * @param Handler $handler An optional existing handler to populate. + * + * @return Handler Either a file or directory handler. + */ + public function get($path, Handler $handler = null) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->get($path); + } } diff --git a/application/vendor/league/flysystem/src/NotSupportedException.php b/application/vendor/league/flysystem/src/NotSupportedException.php index 5d20839..08f47f7 100644 --- a/application/vendor/league/flysystem/src/NotSupportedException.php +++ b/application/vendor/league/flysystem/src/NotSupportedException.php @@ -18,7 +18,7 @@ public static function forLink(SplFileInfo $file) { $message = 'Links are not supported, encountered link at '; - return new static($message.$file->getPathname()); + return new static($message . $file->getPathname()); } /** diff --git a/application/vendor/league/flysystem/src/Plugin/EmptyDir.php b/application/vendor/league/flysystem/src/Plugin/EmptyDir.php index 9502333..b5ae7f5 100644 --- a/application/vendor/league/flysystem/src/Plugin/EmptyDir.php +++ b/application/vendor/league/flysystem/src/Plugin/EmptyDir.php @@ -17,7 +17,7 @@ public function getMethod() /** * Empty a directory's contents. * - * @param $dirname + * @param string $dirname */ public function handle($dirname) { diff --git a/application/vendor/league/flysystem/src/Plugin/ForcedCopy.php b/application/vendor/league/flysystem/src/Plugin/ForcedCopy.php new file mode 100644 index 0000000..a41e9f3 --- /dev/null +++ b/application/vendor/league/flysystem/src/Plugin/ForcedCopy.php @@ -0,0 +1,44 @@ +filesystem->delete($newpath); + } catch (FileNotFoundException $e) { + // The destination path does not exist. That's ok. + $deleted = true; + } + + if ($deleted) { + return $this->filesystem->copy($path, $newpath); + } + + return false; + } +} diff --git a/application/vendor/league/flysystem/src/Plugin/ForcedRename.php b/application/vendor/league/flysystem/src/Plugin/ForcedRename.php new file mode 100644 index 0000000..3f51cd6 --- /dev/null +++ b/application/vendor/league/flysystem/src/Plugin/ForcedRename.php @@ -0,0 +1,44 @@ +filesystem->delete($newpath); + } catch (FileNotFoundException $e) { + // The destination path does not exist. That's ok. + $deleted = true; + } + + if ($deleted) { + return $this->filesystem->rename($path, $newpath); + } + + return false; + } +} diff --git a/application/vendor/league/flysystem/src/Plugin/GetWithMetadata.php b/application/vendor/league/flysystem/src/Plugin/GetWithMetadata.php index b88fd68..6fe4f05 100644 --- a/application/vendor/league/flysystem/src/Plugin/GetWithMetadata.php +++ b/application/vendor/league/flysystem/src/Plugin/GetWithMetadata.php @@ -3,6 +3,7 @@ namespace League\Flysystem\Plugin; use InvalidArgumentException; +use League\Flysystem\FileNotFoundException; class GetWithMetadata extends AbstractPlugin { @@ -23,22 +24,23 @@ public function getMethod() * @param array $metadata metadata keys * * @throws InvalidArgumentException + * @throws FileNotFoundException * - * @return array metadata + * @return array|false metadata */ public function handle($path, array $metadata) { $object = $this->filesystem->getMetadata($path); - if (! $object) { + if ( ! $object) { return false; } $keys = array_diff($metadata, array_keys($object)); foreach ($keys as $key) { - if (! method_exists($this->filesystem, $method = 'get'.ucfirst($key))) { - throw new InvalidArgumentException('Could not fetch metadata: '.$key); + if ( ! method_exists($this->filesystem, $method = 'get' . ucfirst($key))) { + throw new InvalidArgumentException('Could not fetch metadata: ' . $key); } $object[$key] = $this->filesystem->{$method}($path); diff --git a/application/vendor/league/flysystem/src/Plugin/ListWith.php b/application/vendor/league/flysystem/src/Plugin/ListWith.php index 341a219..d90464e 100644 --- a/application/vendor/league/flysystem/src/Plugin/ListWith.php +++ b/application/vendor/league/flysystem/src/Plugin/ListWith.php @@ -40,17 +40,17 @@ public function handle(array $keys = [], $directory = '', $recursive = false) /** * Get a meta-data value by key name. * - * @param array $object - * @param $key + * @param array $object + * @param string $key * * @return array */ protected function getMetadataByName(array $object, $key) { - $method = 'get'.ucfirst($key); + $method = 'get' . ucfirst($key); - if (! method_exists($this->filesystem, $method)) { - throw new \InvalidArgumentException('Could not get meta-data for key: '.$key); + if ( ! method_exists($this->filesystem, $method)) { + throw new \InvalidArgumentException('Could not get meta-data for key: ' . $key); } $object[$key] = $this->filesystem->{$method}($object['path']); diff --git a/application/vendor/league/flysystem/src/Plugin/PluggableTrait.php b/application/vendor/league/flysystem/src/Plugin/PluggableTrait.php index 4f39a16..922edfe 100644 --- a/application/vendor/league/flysystem/src/Plugin/PluggableTrait.php +++ b/application/vendor/league/flysystem/src/Plugin/PluggableTrait.php @@ -19,10 +19,16 @@ trait PluggableTrait * * @param PluginInterface $plugin * + * @throws LogicException + * * @return $this */ public function addPlugin(PluginInterface $plugin) { + if ( ! method_exists($plugin, 'handle')) { + throw new LogicException(get_class($plugin) . ' does not have a handle method.'); + } + $this->plugins[$plugin->getMethod()] = $plugin; return $this; @@ -33,18 +39,14 @@ public function addPlugin(PluginInterface $plugin) * * @param string $method * - * @throws LogicException + * @throws PluginNotFoundException * - * @return PluginInterface $plugin + * @return PluginInterface */ protected function findPlugin($method) { - if (! isset($this->plugins[$method])) { - throw new PluginNotFoundException('Plugin not found for method: '.$method); - } - - if (! method_exists($this->plugins[$method], 'handle')) { - throw new LogicException(get_class($this->plugins[$method]).' does not have a handle method.'); + if ( ! isset($this->plugins[$method])) { + throw new PluginNotFoundException('Plugin not found for method: ' . $method); } return $this->plugins[$method]; @@ -53,8 +55,11 @@ protected function findPlugin($method) /** * Invoke a plugin by method name. * - * @param string $method - * @param array $arguments + * @param string $method + * @param array $arguments + * @param FilesystemInterface $filesystem + * + * @throws PluginNotFoundException * * @return mixed */ @@ -84,8 +89,8 @@ public function __call($method, array $arguments) } catch (PluginNotFoundException $e) { throw new BadMethodCallException( 'Call to undefined method ' - .get_class($this) - .'::'.$method + . get_class($this) + . '::' . $method ); } } diff --git a/application/vendor/league/flysystem/src/ReadInterface.php b/application/vendor/league/flysystem/src/ReadInterface.php index f37e0c9..898a8d5 100644 --- a/application/vendor/league/flysystem/src/ReadInterface.php +++ b/application/vendor/league/flysystem/src/ReadInterface.php @@ -51,7 +51,7 @@ public function listContents($directory = '', $recursive = false); public function getMetadata($path); /** - * Get all the meta data of a file or directory. + * Get the size of a file. * * @param string $path * @@ -69,7 +69,7 @@ public function getSize($path); public function getMimetype($path); /** - * Get the timestamp of a file. + * Get the last modified time of a file as a timestamp. * * @param string $path * diff --git a/application/vendor/league/flysystem/src/SafeStorage.php b/application/vendor/league/flysystem/src/SafeStorage.php new file mode 100644 index 0000000..5397f58 --- /dev/null +++ b/application/vendor/league/flysystem/src/SafeStorage.php @@ -0,0 +1,39 @@ +hash = spl_object_hash($this); + static::$safeStorage[$this->hash] = []; + } + + public function storeSafely($key, $value) + { + static::$safeStorage[$this->hash][$key] = $value; + } + + public function retrieveSafely($key) + { + if (array_key_exists($key, static::$safeStorage[$this->hash])) { + return static::$safeStorage[$this->hash][$key]; + } + } + + public function __destruct() + { + unset(static::$safeStorage[$this->hash]); + } +} diff --git a/application/vendor/league/flysystem/src/UnreadableFileException.php b/application/vendor/league/flysystem/src/UnreadableFileException.php new file mode 100644 index 0000000..e668033 --- /dev/null +++ b/application/vendor/league/flysystem/src/UnreadableFileException.php @@ -0,0 +1,18 @@ +getRealPath() + ) + ); + } +} diff --git a/application/vendor/league/flysystem/src/Util.php b/application/vendor/league/flysystem/src/Util.php index 5734856..2c77540 100644 --- a/application/vendor/league/flysystem/src/Util.php +++ b/application/vendor/league/flysystem/src/Util.php @@ -16,12 +16,17 @@ class Util */ public static function pathinfo($path) { - $pathinfo = pathinfo($path) + compact('path'); - $pathinfo['dirname'] = array_key_exists('dirname', $pathinfo) - ? static::normalizeDirname($pathinfo['dirname']) - : ''; + $pathinfo = compact('path'); - return $pathinfo; + if ('' !== $dirname = dirname($path)) { + $pathinfo['dirname'] = static::normalizeDirname($dirname); + } + + $pathinfo['basename'] = static::basename($path); + + $pathinfo += pathinfo($pathinfo['basename']); + + return $pathinfo + ['dirname' => '']; } /** @@ -33,11 +38,7 @@ public static function pathinfo($path) */ public static function normalizeDirname($dirname) { - if ($dirname === '.') { - return ''; - } - - return $dirname; + return $dirname === '.' ? '' : $dirname; } /** @@ -65,7 +66,7 @@ public static function map(array $object, array $map) $result = []; foreach ($map as $from => $to) { - if (! isset($object[$from])) { + if ( ! isset($object[$from])) { continue; } @@ -86,20 +87,7 @@ public static function map(array $object, array $map) */ public static function normalizePath($path) { - // Remove any kind of funky unicode whitespace - $normalized = preg_replace('#\p{C}+|^\./#u', '', $path); - $normalized = static::normalizeRelativePath($normalized); - - if (preg_match('#/\.{2}|^\.{2}/|^\.{2}$#', $normalized)) { - throw new LogicException( - 'Path is outside of the defined root, path: [' . $path . '], resolved: [' . $normalized . ']' - ); - } - - $normalized = preg_replace('#\\\{2,}#', '\\', trim($normalized, '\\')); - $normalized = preg_replace('#/{2,}#', '/', trim($normalized, '/')); - - return $normalized; + return static::normalizeRelativePath($path); } /** @@ -107,18 +95,54 @@ public static function normalizePath($path) * * @param string $path * + * @throws LogicException + * * @return string */ public static function normalizeRelativePath($path) { - // Path remove self referring paths ("/./"). - $path = preg_replace('#/\.(?=/)|^\./|/\./?$#', '', $path); + $path = str_replace('\\', '/', $path); + $path = static::removeFunkyWhiteSpace($path); + + $parts = []; + + foreach (explode('/', $path) as $part) { + switch ($part) { + case '': + case '.': + break; + + case '..': + if (empty($parts)) { + throw new LogicException( + 'Path is outside of the defined root, path: [' . $path . ']' + ); + } + array_pop($parts); + break; + + default: + $parts[] = $part; + break; + } + } - // Regex for resolving relative paths - $regex = '#/*[^/\.]+/\.\.#Uu'; + return implode('/', $parts); + } - while (preg_match($regex, $path)) { - $path = preg_replace($regex, '', $path); + /** + * Removes unprintable characters and invalid unicode characters. + * + * @param string $path + * + * @return string $path + */ + protected static function removeFunkyWhiteSpace($path) + { + // We do this check in a loop, since removing invalid unicode characters + // can lead to new characters being created. + while (preg_match('#\p{C}+|^\./#u', $path)) { + $path = preg_replace('#\p{C}+|^\./#u', '', $path); } return $path; @@ -152,8 +176,8 @@ public static function contentSize($contents) /** * Guess MIME Type based on the path of the file and it's content. * - * @param string $path - * @param string $content + * @param string $path + * @param string|resource $content * * @return string|null MIME Type or NULL if no extension detected */ @@ -161,15 +185,11 @@ public static function guessMimeType($path, $content) { $mimeType = MimeType::detectByContent($content); - if (empty($mimeType) || $mimeType === 'text/plain') { - $extension = pathinfo($path, PATHINFO_EXTENSION); - - if ($extension) { - $mimeType = MimeType::detectByFileExtension($extension) ?: 'text/plain'; - } + if ( ! (empty($mimeType) || in_array($mimeType, ['application/x-empty', 'text/plain', 'text/x-asm']))) { + return $mimeType; } - return $mimeType; + return MimeType::detectByFilename($path); } /** @@ -185,11 +205,7 @@ public static function emulateDirectories(array $listing) $listedDirectories = []; foreach ($listing as $object) { - list($directories, $listedDirectories) = static::emulateObjectDirectories( - $object, - $directories, - $listedDirectories - ); + list($directories, $listedDirectories) = static::emulateObjectDirectories($object, $directories, $listedDirectories); } $directories = array_diff(array_unique($directories), array_unique($listedDirectories)); @@ -281,7 +297,7 @@ protected static function emulateObjectDirectories(array $object, array $directo $parent = $object['dirname']; - while (! empty($parent) && ! in_array($parent, $directories)) { + while ( ! empty($parent) && ! in_array($parent, $directories)) { $directories[] = $parent; $parent = static::dirname($parent); } @@ -294,4 +310,40 @@ protected static function emulateObjectDirectories(array $object, array $directo return [$directories, $listedDirectories]; } + + /** + * Returns the trailing name component of the path. + * + * @param string $path + * + * @return string + */ + private static function basename($path) + { + $separators = DIRECTORY_SEPARATOR === '/' ? '/' : '\/'; + + $path = rtrim($path, $separators); + + $basename = preg_replace('#.*?([^' . preg_quote($separators, '#') . ']+$)#', '$1', $path); + + if (DIRECTORY_SEPARATOR === '/') { + return $basename; + } + // @codeCoverageIgnoreStart + // Extra Windows path munging. This is tested via AppVeyor, but code + // coverage is not reported. + + // Handle relative paths with drive letters. c:file.txt. + while (preg_match('#^[a-zA-Z]{1}:[^\\\/]#', $basename)) { + $basename = substr($basename, 2); + } + + // Remove colon for standalone drive letter names. + if (preg_match('#^[a-zA-Z]{1}:$#', $basename)) { + $basename = rtrim($basename, ':'); + } + + return $basename; + // @codeCoverageIgnoreEnd + } } diff --git a/application/vendor/league/flysystem/src/Util/ContentListingFormatter.php b/application/vendor/league/flysystem/src/Util/ContentListingFormatter.php index db453c4..ae0d3b9 100644 --- a/application/vendor/league/flysystem/src/Util/ContentListingFormatter.php +++ b/application/vendor/league/flysystem/src/Util/ContentListingFormatter.php @@ -13,19 +13,26 @@ class ContentListingFormatter * @var string */ private $directory; + /** * @var bool */ private $recursive; + /** + * @var bool + */ + private $caseSensitive; + /** * @param string $directory * @param bool $recursive */ - public function __construct($directory, $recursive) + public function __construct($directory, $recursive, $caseSensitive = true) { - $this->directory = $directory; + $this->directory = rtrim($directory, '/'); $this->recursive = $recursive; + $this->caseSensitive = $caseSensitive; } /** @@ -37,14 +44,9 @@ public function __construct($directory, $recursive) */ public function formatListing(array $listing) { - $listing = array_values( - array_map( - [$this, 'addPathInfo'], - array_filter($listing, [$this, 'isEntryOutOfScope']) - ) - ); - - return $this->sortListing($listing); + $listing = array_filter(array_map([$this, 'addPathInfo'], $listing), [$this, 'isEntryOutOfScope']); + + return $this->sortListing(array_values($listing)); } private function addPathInfo(array $entry) @@ -75,7 +77,7 @@ private function isEntryOutOfScope(array $entry) /** * Check if the entry resides within the parent directory. * - * @param $entry + * @param array $entry * * @return bool */ @@ -85,19 +87,23 @@ private function residesInDirectory(array $entry) return true; } - return strpos($entry['path'], $this->directory . '/') === 0; + return $this->caseSensitive + ? strpos($entry['path'], $this->directory . '/') === 0 + : stripos($entry['path'], $this->directory . '/') === 0; } /** * Check if the entry is a direct child of the directory. * - * @param $entry + * @param array $entry * * @return bool */ private function isDirectChild(array $entry) { - return Util::dirname($entry['path']) === $this->directory; + return $this->caseSensitive + ? $entry['dirname'] === $this->directory + : strcasecmp($this->directory, $entry['dirname']) === 0; } /** @@ -107,12 +113,9 @@ private function isDirectChild(array $entry) */ private function sortListing(array $listing) { - usort( - $listing, - function ($a, $b) { - return strcasecmp($a['path'], $b['path']); - } - ); + usort($listing, function ($a, $b) { + return strcasecmp($a['path'], $b['path']); + }); return $listing; } diff --git a/application/vendor/league/flysystem/src/Util/MimeType.php b/application/vendor/league/flysystem/src/Util/MimeType.php index d44d013..a4bd5e2 100644 --- a/application/vendor/league/flysystem/src/Util/MimeType.php +++ b/application/vendor/league/flysystem/src/Util/MimeType.php @@ -2,31 +2,212 @@ namespace League\Flysystem\Util; -use Finfo; +use ErrorException; +use finfo; /** * @internal */ class MimeType { + protected static $extensionToMimeTypeMap = [ + 'hqx' => 'application/mac-binhex40', + 'cpt' => 'application/mac-compactpro', + 'csv' => 'text/csv', + 'bin' => 'application/octet-stream', + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => 'application/octet-stream', + 'class' => 'application/octet-stream', + 'psd' => 'application/x-photoshop', + 'so' => 'application/octet-stream', + 'sea' => 'application/octet-stream', + 'dll' => 'application/octet-stream', + 'oda' => 'application/oda', + 'pdf' => 'application/pdf', + 'ai' => 'application/pdf', + 'eps' => 'application/postscript', + 'epub' => 'application/epub+zip', + 'ps' => 'application/postscript', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'mif' => 'application/vnd.mif', + 'xls' => 'application/vnd.ms-excel', + 'xlt' => 'application/vnd.ms-excel', + 'xla' => 'application/vnd.ms-excel', + 'ppt' => 'application/powerpoint', + 'pot' => 'application/vnd.ms-powerpoint', + 'pps' => 'application/vnd.ms-powerpoint', + 'ppa' => 'application/vnd.ms-powerpoint', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', + 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'potm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', + 'wbxml' => 'application/wbxml', + 'wmlc' => 'application/wmlc', + 'dcr' => 'application/x-director', + 'dir' => 'application/x-director', + 'dxr' => 'application/x-director', + 'dvi' => 'application/x-dvi', + 'gtar' => 'application/x-gtar', + 'gz' => 'application/x-gzip', + 'gzip' => 'application/x-gzip', + 'php' => 'application/x-httpd-php', + 'php4' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'phtml' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'js' => 'application/javascript', + 'swf' => 'application/x-shockwave-flash', + 'sit' => 'application/x-stuffit', + 'tar' => 'application/x-tar', + 'tgz' => 'application/x-tar', + 'z' => 'application/x-compress', + 'xhtml' => 'application/xhtml+xml', + 'xht' => 'application/xhtml+xml', + 'rdf' => 'application/rdf+xml', + 'zip' => 'application/x-zip', + 'rar' => 'application/x-rar', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => 'audio/mpeg', + 'aif' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'ram' => 'audio/x-pn-realaudio', + 'rm' => 'audio/x-pn-realaudio', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'ra' => 'audio/x-realaudio', + 'rv' => 'video/vnd.rn-realvideo', + 'wav' => 'audio/x-wav', + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpe' => 'image/jpeg', + 'png' => 'image/png', + 'gif' => 'image/gif', + 'bmp' => 'image/bmp', + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'svg' => 'image/svg+xml', + 'css' => 'text/css', + 'html' => 'text/html', + 'htm' => 'text/html', + 'shtml' => 'text/html', + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => 'text/plain', + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'xml' => 'application/xml', + 'xsl' => 'application/xml', + 'dmn' => 'application/octet-stream', + 'bpmn' => 'application/octet-stream', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'avi' => 'video/x-msvideo', + 'movie' => 'video/x-sgi-movie', + 'doc' => 'application/msword', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'dot' => 'application/msword', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', + 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', + 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', + 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', + 'word' => 'application/msword', + 'xl' => 'application/excel', + 'eml' => 'message/rfc822', + 'json' => 'application/json', + 'pem' => 'application/x-x509-user-cert', + 'p10' => 'application/x-pkcs10', + 'p12' => 'application/x-pkcs12', + 'p7a' => 'application/x-pkcs7-signature', + 'p7c' => 'application/pkcs7-mime', + 'p7m' => 'application/pkcs7-mime', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'crt' => 'application/x-x509-ca-cert', + 'crl' => 'application/pkix-crl', + 'der' => 'application/x-x509-ca-cert', + 'kdb' => 'application/octet-stream', + 'pgp' => 'application/pgp', + 'gpg' => 'application/gpg-keys', + 'sst' => 'application/octet-stream', + 'csr' => 'application/octet-stream', + 'rsa' => 'application/x-pkcs7', + 'cer' => 'application/pkix-cert', + '3g2' => 'video/3gpp2', + '3gp' => 'video/3gp', + 'mp4' => 'video/mp4', + 'm4a' => 'audio/x-m4a', + 'f4v' => 'video/mp4', + 'webm' => 'video/webm', + 'aac' => 'audio/x-acc', + 'm4u' => 'application/vnd.mpegurl', + 'm3u' => 'text/plain', + 'xspf' => 'application/xspf+xml', + 'vlc' => 'application/videolan', + 'wmv' => 'video/x-ms-wmv', + 'au' => 'audio/x-au', + 'ac3' => 'audio/ac3', + 'flac' => 'audio/x-flac', + 'ogg' => 'audio/ogg', + 'kmz' => 'application/vnd.google-earth.kmz', + 'kml' => 'application/vnd.google-earth.kml+xml', + 'ics' => 'text/calendar', + 'zsh' => 'text/x-scriptzsh', + '7zip' => 'application/x-7z-compressed', + 'cdr' => 'application/cdr', + 'wma' => 'audio/x-ms-wma', + 'jar' => 'application/java-archive', + 'tex' => 'application/x-tex', + 'latex' => 'application/x-latex', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + ]; + /** * Detects MIME Type based on given content. * - * @param string $content + * @param mixed $content * * @return string|null MIME Type or NULL if no mime type detected */ public static function detectByContent($content) { - if (! class_exists('Finfo')) { - return; + if ( ! class_exists('finfo') || ! is_string($content)) { + return null; } + try { + $finfo = new finfo(FILEINFO_MIME_TYPE); - $finfo = new Finfo(FILEINFO_MIME_TYPE); - $mimeType = $finfo->buffer($content); - - return $mimeType ?: null; - } + return $finfo->buffer($content) ?: null; + // @codeCoverageIgnoreStart + } catch (ErrorException $e) { + // This is caused by an array to string conversion error. + } + } // @codeCoverageIgnoreEnd /** * Detects MIME Type based on file extension. @@ -37,15 +218,21 @@ public static function detectByContent($content) */ public static function detectByFileExtension($extension) { - static $extensionToMimeTypeMap; + return isset(static::$extensionToMimeTypeMap[$extension]) + ? static::$extensionToMimeTypeMap[$extension] + : 'text/plain'; + } - if (! $extensionToMimeTypeMap) { - $extensionToMimeTypeMap = static::getExtensionToMimeTypeMap(); - } + /** + * @param string $filename + * + * @return string|null MIME Type or NULL if no extension detected + */ + public static function detectByFilename($filename) + { + $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); - if (isset($extensionToMimeTypeMap[$extension])) { - return $extensionToMimeTypeMap[$extension]; - } + return empty($extension) ? 'text/plain' : static::detectByFileExtension($extension); } /** @@ -53,146 +240,6 @@ public static function detectByFileExtension($extension) */ public static function getExtensionToMimeTypeMap() { - return [ - 'hqx' => 'application/mac-binhex40', - 'cpt' => 'application/mac-compactpro', - 'csv' => 'text/x-comma-separated-values', - 'bin' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'exe' => 'application/octet-stream', - 'class' => 'application/octet-stream', - 'psd' => 'application/x-photoshop', - 'so' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => 'application/pdf', - 'ai' => 'application/pdf', - 'eps' => 'application/postscript', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => 'application/vnd.ms-excel', - 'ppt' => 'application/powerpoint', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'wbxml' => 'application/wbxml', - 'wmlc' => 'application/wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'gz' => 'application/x-gzip', - 'gzip' => 'application/x-gzip', - 'php' => 'application/x-httpd-php', - 'php4' => 'application/x-httpd-php', - 'php3' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'js' => 'application/javascript', - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => 'application/x-tar', - 'z' => 'application/x-compress', - 'xhtml' => 'application/xhtml+xml', - 'xht' => 'application/xhtml+xml', - 'zip' => 'application/x-zip', - 'rar' => 'application/x-rar', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mpga' => 'audio/mpeg', - 'mp2' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'aif' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'rv' => 'video/vnd.rn-realvideo', - 'wav' => 'audio/x-wav', - 'jpg' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpe' => 'image/jpeg', - 'png' => 'image/png', - 'gif' => 'image/gif', - 'bmp' => 'image/bmp', - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'css' => 'text/css', - 'html' => 'text/html', - 'htm' => 'text/html', - 'shtml' => 'text/html', - 'txt' => 'text/plain', - 'text' => 'text/plain', - 'log' => 'text/plain', - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'xml' => 'application/xml', - 'xsl' => 'application/xml', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'qt' => 'video/quicktime', - 'mov' => 'video/quicktime', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie', - 'doc' => 'application/msword', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'dot' => 'application/msword', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'word' => 'application/msword', - 'xl' => 'application/excel', - 'eml' => 'message/rfc822', - 'json' => 'application/json', - 'pem' => 'application/x-x509-user-cert', - 'p10' => 'application/x-pkcs10', - 'p12' => 'application/x-pkcs12', - 'p7a' => 'application/x-pkcs7-signature', - 'p7c' => 'application/pkcs7-mime', - 'p7m' => 'application/pkcs7-mime', - 'p7r' => 'application/x-pkcs7-certreqresp', - 'p7s' => 'application/pkcs7-signature', - 'crt' => 'application/x-x509-ca-cert', - 'crl' => 'application/pkix-crl', - 'der' => 'application/x-x509-ca-cert', - 'kdb' => 'application/octet-stream', - 'pgp' => 'application/pgp', - 'gpg' => 'application/gpg-keys', - 'sst' => 'application/octet-stream', - 'csr' => 'application/octet-stream', - 'rsa' => 'application/x-pkcs7', - 'cer' => 'application/pkix-cert', - '3g2' => 'video/3gpp2', - '3gp' => 'video/3gp', - 'mp4' => 'video/mp4', - 'm4a' => 'audio/x-m4a', - 'f4v' => 'video/mp4', - 'webm' => 'video/webm', - 'aac' => 'audio/x-acc', - 'm4u' => 'application/vnd.mpegurl', - 'm3u' => 'text/plain', - 'xspf' => 'application/xspf+xml', - 'vlc' => 'application/videolan', - 'wmv' => 'video/x-ms-wmv', - 'au' => 'audio/x-au', - 'ac3' => 'audio/ac3', - 'flac' => 'audio/x-flac', - 'ogg' => 'audio/ogg', - 'kmz' => 'application/vnd.google-earth.kmz', - 'kml' => 'application/vnd.google-earth.kml+xml', - 'ics' => 'text/calendar', - 'zsh' => 'text/x-scriptzsh', - '7zip' => 'application/x-7z-compressed', - 'cdr' => 'application/cdr', - 'wma' => 'audio/x-ms-wma', - 'jar' => 'application/java-archive', - ]; + return static::$extensionToMimeTypeMap; } } diff --git a/application/vendor/league/flysystem/src/Util/StreamHasher.php b/application/vendor/league/flysystem/src/Util/StreamHasher.php new file mode 100644 index 0000000..938ec5d --- /dev/null +++ b/application/vendor/league/flysystem/src/Util/StreamHasher.php @@ -0,0 +1,36 @@ +algo = $algo; + } + + /** + * @param resource $resource + * + * @return string + */ + public function hash($resource) + { + rewind($resource); + $context = hash_init($this->algo); + hash_update_stream($context, $resource); + fclose($resource); + + return hash_final($context); + } +} diff --git a/application/vendor/monolog/monolog/.php_cs b/application/vendor/monolog/monolog/.php_cs deleted file mode 100644 index 2511e98..0000000 --- a/application/vendor/monolog/monolog/.php_cs +++ /dev/null @@ -1,15 +0,0 @@ -files() - ->name('*.php') - ->in(__DIR__.'/src') - ->in(__DIR__.'/tests') -; - -return Symfony\CS\Config\Config::create() - ->fixers(array( - 'psr0', 'encoding', 'short_tag', 'braces', 'elseif', 'eof_ending', 'function_declaration', 'indentation', 'line_after_namespace', 'linefeed', 'lowercase_constants', 'lowercase_keywords', 'multiple_use', 'php_closing_tag', 'trailing_spaces', 'visibility', 'duplicate_semicolon', 'extra_empty_lines', 'include', 'namespace_no_leading_whitespace', 'object_operator', 'operators_spaces', 'phpdoc_params', 'return', 'single_array_no_trailing_comma', 'spaces_cast', 'standardize_not_equal', 'ternary_spaces', 'unused_use', 'whitespacy_lines', - )) - ->finder($finder) -; diff --git a/application/vendor/monolog/monolog/CHANGELOG.md b/application/vendor/monolog/monolog/CHANGELOG.md new file mode 100644 index 0000000..9b0f528 --- /dev/null +++ b/application/vendor/monolog/monolog/CHANGELOG.md @@ -0,0 +1,388 @@ +### 1.25.1 (2019-09-06) + + * Fixed forward-compatible interfaces to be compatible with Monolog 1.x too. + +### 1.25.0 (2019-09-06) + + * Deprecated SlackbotHandler, use SlackWebhookHandler or SlackHandler instead + * Deprecated RavenHandler, use sentry/sentry 2.x and their Sentry\Monolog\Handler instead + * Deprecated HipChatHandler, migrate to Slack and use SlackWebhookHandler or SlackHandler instead + * Added forward-compatible interfaces and traits FormattableHandlerInterface, FormattableHandlerTrait, ProcessableHandlerInterface, ProcessableHandlerTrait. If you use modern PHP and want to make code compatible with Monolog 1 and 2 this can help. You will have to require at least Monolog 1.25 though. + * Added support for RFC3164 (outdated BSD syslog protocol) to SyslogUdpHandler + * Fixed issue in GroupHandler and WhatFailureGroupHandler where setting multiple processors would duplicate records + * Fixed issue in SignalHandler restarting syscalls functionality + * Fixed normalizers handling of exception backtraces to avoid serializing arguments in some cases + * Fixed ZendMonitorHandler to work with the latest Zend Server versions + * Fixed ChromePHPHandler to avoid sending more data than latest Chrome versions allow in headers (4KB down from 256KB). + +### 1.24.0 (2018-11-05) + + * BC Notice: If you are extending any of the Monolog's Formatters' `normalize` method, make sure you add the new `$depth = 0` argument to your function signature to avoid strict PHP warnings. + * Added a `ResettableInterface` in order to reset/reset/clear/flush handlers and processors + * Added a `ProcessorInterface` as an optional way to label a class as being a processor (mostly useful for autowiring dependency containers) + * Added a way to log signals being received using Monolog\SignalHandler + * Added ability to customize error handling at the Logger level using Logger::setExceptionHandler + * Added InsightOpsHandler to migrate users of the LogEntriesHandler + * Added protection to NormalizerHandler against circular and very deep structures, it now stops normalizing at a depth of 9 + * Added capture of stack traces to ErrorHandler when logging PHP errors + * Added RavenHandler support for a `contexts` context or extra key to forward that to Sentry's contexts + * Added forwarding of context info to FluentdFormatter + * Added SocketHandler::setChunkSize to override the default chunk size in case you must send large log lines to rsyslog for example + * Added ability to extend/override BrowserConsoleHandler + * Added SlackWebhookHandler::getWebhookUrl and SlackHandler::getToken to enable class extensibility + * Added SwiftMailerHandler::getSubjectFormatter to enable class extensibility + * Dropped official support for HHVM in test builds + * Fixed normalization of exception traces when call_user_func is used to avoid serializing objects and the data they contain + * Fixed naming of fields in Slack handler, all field names are now capitalized in all cases + * Fixed HipChatHandler bug where slack dropped messages randomly + * Fixed normalization of objects in Slack handlers + * Fixed support for PHP7's Throwable in NewRelicHandler + * Fixed race bug when StreamHandler sometimes incorrectly reported it failed to create a directory + * Fixed table row styling issues in HtmlFormatter + * Fixed RavenHandler dropping the message when logging exception + * Fixed WhatFailureGroupHandler skipping processors when using handleBatch + and implement it where possible + * Fixed display of anonymous class names + +### 1.23.0 (2017-06-19) + + * Improved SyslogUdpHandler's support for RFC5424 and added optional `$ident` argument + * Fixed GelfHandler truncation to be per field and not per message + * Fixed compatibility issue with PHP <5.3.6 + * Fixed support for headless Chrome in ChromePHPHandler + * Fixed support for latest Aws SDK in DynamoDbHandler + * Fixed support for SwiftMailer 6.0+ in SwiftMailerHandler + +### 1.22.1 (2017-03-13) + + * Fixed lots of minor issues in the new Slack integrations + * Fixed support for allowInlineLineBreaks in LineFormatter when formatting exception backtraces + +### 1.22.0 (2016-11-26) + + * Added SlackbotHandler and SlackWebhookHandler to set up Slack integration more easily + * Added MercurialProcessor to add mercurial revision and branch names to log records + * Added support for AWS SDK v3 in DynamoDbHandler + * Fixed fatal errors occuring when normalizing generators that have been fully consumed + * Fixed RollbarHandler to include a level (rollbar level), monolog_level (original name), channel and datetime (unix) + * Fixed RollbarHandler not flushing records automatically, calling close() explicitly is not necessary anymore + * Fixed SyslogUdpHandler to avoid sending empty frames + * Fixed a few PHP 7.0 and 7.1 compatibility issues + +### 1.21.0 (2016-07-29) + + * Break: Reverted the addition of $context when the ErrorHandler handles regular php errors from 1.20.0 as it was causing issues + * Added support for more formats in RotatingFileHandler::setFilenameFormat as long as they have Y, m and d in order + * Added ability to format the main line of text the SlackHandler sends by explictly setting a formatter on the handler + * Added information about SoapFault instances in NormalizerFormatter + * Added $handleOnlyReportedErrors option on ErrorHandler::registerErrorHandler (default true) to allow logging of all errors no matter the error_reporting level + +### 1.20.0 (2016-07-02) + + * Added FingersCrossedHandler::activate() to manually trigger the handler regardless of the activation policy + * Added StreamHandler::getUrl to retrieve the stream's URL + * Added ability to override addRow/addTitle in HtmlFormatter + * Added the $context to context information when the ErrorHandler handles a regular php error + * Deprecated RotatingFileHandler::setFilenameFormat to only support 3 formats: Y, Y-m and Y-m-d + * Fixed WhatFailureGroupHandler to work with PHP7 throwables + * Fixed a few minor bugs + +### 1.19.0 (2016-04-12) + + * Break: StreamHandler will not close streams automatically that it does not own. If you pass in a stream (not a path/url), then it will not close it for you. You can retrieve those using getStream() if needed + * Added DeduplicationHandler to remove duplicate records from notifications across multiple requests, useful for email or other notifications on errors + * Added ability to use `%message%` and other LineFormatter replacements in the subject line of emails sent with NativeMailHandler and SwiftMailerHandler + * Fixed HipChatHandler handling of long messages + +### 1.18.2 (2016-04-02) + + * Fixed ElasticaFormatter to use more precise dates + * Fixed GelfMessageFormatter sending too long messages + +### 1.18.1 (2016-03-13) + + * Fixed SlackHandler bug where slack dropped messages randomly + * Fixed RedisHandler issue when using with the PHPRedis extension + * Fixed AmqpHandler content-type being incorrectly set when using with the AMQP extension + * Fixed BrowserConsoleHandler regression + +### 1.18.0 (2016-03-01) + + * Added optional reduction of timestamp precision via `Logger->useMicrosecondTimestamps(false)`, disabling it gets you a bit of performance boost but reduces the precision to the second instead of microsecond + * Added possibility to skip some extra stack frames in IntrospectionProcessor if you have some library wrapping Monolog that is always adding frames + * Added `Logger->withName` to clone a logger (keeping all handlers) with a new name + * Added FluentdFormatter for the Fluentd unix socket protocol + * Added HandlerWrapper base class to ease the creation of handler wrappers, just extend it and override as needed + * Added support for replacing context sub-keys using `%context.*%` in LineFormatter + * Added support for `payload` context value in RollbarHandler + * Added setRelease to RavenHandler to describe the application version, sent with every log + * Added support for `fingerprint` context value in RavenHandler + * Fixed JSON encoding errors that would gobble up the whole log record, we now handle those more gracefully by dropping chars as needed + * Fixed write timeouts in SocketHandler and derivatives, set to 10sec by default, lower it with `setWritingTimeout()` + * Fixed PHP7 compatibility with regard to Exception/Throwable handling in a few places + +### 1.17.2 (2015-10-14) + + * Fixed ErrorHandler compatibility with non-Monolog PSR-3 loggers + * Fixed SlackHandler handling to use slack functionalities better + * Fixed SwiftMailerHandler bug when sending multiple emails they all had the same id + * Fixed 5.3 compatibility regression + +### 1.17.1 (2015-08-31) + + * Fixed RollbarHandler triggering PHP notices + +### 1.17.0 (2015-08-30) + + * Added support for `checksum` and `release` context/extra values in RavenHandler + * Added better support for exceptions in RollbarHandler + * Added UidProcessor::getUid + * Added support for showing the resource type in NormalizedFormatter + * Fixed IntrospectionProcessor triggering PHP notices + +### 1.16.0 (2015-08-09) + + * Added IFTTTHandler to notify ifttt.com triggers + * Added Logger::setHandlers() to allow setting/replacing all handlers + * Added $capSize in RedisHandler to cap the log size + * Fixed StreamHandler creation of directory to only trigger when the first log write happens + * Fixed bug in the handling of curl failures + * Fixed duplicate logging of fatal errors when both error and fatal error handlers are registered in monolog's ErrorHandler + * Fixed missing fatal errors records with handlers that need to be closed to flush log records + * Fixed TagProcessor::addTags support for associative arrays + +### 1.15.0 (2015-07-12) + + * Added addTags and setTags methods to change a TagProcessor + * Added automatic creation of directories if they are missing for a StreamHandler to open a log file + * Added retry functionality to Loggly, Cube and Mandrill handlers so they retry up to 5 times in case of network failure + * Fixed process exit code being incorrectly reset to 0 if ErrorHandler::registerExceptionHandler was used + * Fixed HTML/JS escaping in BrowserConsoleHandler + * Fixed JSON encoding errors being silently suppressed (PHP 5.5+ only) + +### 1.14.0 (2015-06-19) + + * Added PHPConsoleHandler to send record to Chrome's PHP Console extension and library + * Added support for objects implementing __toString in the NormalizerFormatter + * Added support for HipChat's v2 API in HipChatHandler + * Added Logger::setTimezone() to initialize the timezone monolog should use in case date.timezone isn't correct for your app + * Added an option to send formatted message instead of the raw record on PushoverHandler via ->useFormattedMessage(true) + * Fixed curl errors being silently suppressed + +### 1.13.1 (2015-03-09) + + * Fixed regression in HipChat requiring a new token to be created + +### 1.13.0 (2015-03-05) + + * Added Registry::hasLogger to check for the presence of a logger instance + * Added context.user support to RavenHandler + * Added HipChat API v2 support in the HipChatHandler + * Added NativeMailerHandler::addParameter to pass params to the mail() process + * Added context data to SlackHandler when $includeContextAndExtra is true + * Added ability to customize the Swift_Message per-email in SwiftMailerHandler + * Fixed SwiftMailerHandler to lazily create message instances if a callback is provided + * Fixed serialization of INF and NaN values in Normalizer and LineFormatter + +### 1.12.0 (2014-12-29) + + * Break: HandlerInterface::isHandling now receives a partial record containing only a level key. This was always the intent and does not break any Monolog handler but is strictly speaking a BC break and you should check if you relied on any other field in your own handlers. + * Added PsrHandler to forward records to another PSR-3 logger + * Added SamplingHandler to wrap around a handler and include only every Nth record + * Added MongoDBFormatter to support better storage with MongoDBHandler (it must be enabled manually for now) + * Added exception codes in the output of most formatters + * Added LineFormatter::includeStacktraces to enable exception stack traces in logs (uses more than one line) + * Added $useShortAttachment to SlackHandler to minify attachment size and $includeExtra to append extra data + * Added $host to HipChatHandler for users of private instances + * Added $transactionName to NewRelicHandler and support for a transaction_name context value + * Fixed MandrillHandler to avoid outputing API call responses + * Fixed some non-standard behaviors in SyslogUdpHandler + +### 1.11.0 (2014-09-30) + + * Break: The NewRelicHandler extra and context data are now prefixed with extra_ and context_ to avoid clashes. Watch out if you have scripts reading those from the API and rely on names + * Added WhatFailureGroupHandler to suppress any exception coming from the wrapped handlers and avoid chain failures if a logging service fails + * Added MandrillHandler to send emails via the Mandrillapp.com API + * Added SlackHandler to log records to a Slack.com account + * Added FleepHookHandler to log records to a Fleep.io account + * Added LogglyHandler::addTag to allow adding tags to an existing handler + * Added $ignoreEmptyContextAndExtra to LineFormatter to avoid empty [] at the end + * Added $useLocking to StreamHandler and RotatingFileHandler to enable flock() while writing + * Added support for PhpAmqpLib in the AmqpHandler + * Added FingersCrossedHandler::clear and BufferHandler::clear to reset them between batches in long running jobs + * Added support for adding extra fields from $_SERVER in the WebProcessor + * Fixed support for non-string values in PrsLogMessageProcessor + * Fixed SwiftMailer messages being sent with the wrong date in long running scripts + * Fixed minor PHP 5.6 compatibility issues + * Fixed BufferHandler::close being called twice + +### 1.10.0 (2014-06-04) + + * Added Logger::getHandlers() and Logger::getProcessors() methods + * Added $passthruLevel argument to FingersCrossedHandler to let it always pass some records through even if the trigger level is not reached + * Added support for extra data in NewRelicHandler + * Added $expandNewlines flag to the ErrorLogHandler to create multiple log entries when a message has multiple lines + +### 1.9.1 (2014-04-24) + + * Fixed regression in RotatingFileHandler file permissions + * Fixed initialization of the BufferHandler to make sure it gets flushed after receiving records + * Fixed ChromePHPHandler and FirePHPHandler's activation strategies to be more conservative + +### 1.9.0 (2014-04-20) + + * Added LogEntriesHandler to send logs to a LogEntries account + * Added $filePermissions to tweak file mode on StreamHandler and RotatingFileHandler + * Added $useFormatting flag to MemoryProcessor to make it send raw data in bytes + * Added support for table formatting in FirePHPHandler via the table context key + * Added a TagProcessor to add tags to records, and support for tags in RavenHandler + * Added $appendNewline flag to the JsonFormatter to enable using it when logging to files + * Added sound support to the PushoverHandler + * Fixed multi-threading support in StreamHandler + * Fixed empty headers issue when ChromePHPHandler received no records + * Fixed default format of the ErrorLogHandler + +### 1.8.0 (2014-03-23) + + * Break: the LineFormatter now strips newlines by default because this was a bug, set $allowInlineLineBreaks to true if you need them + * Added BrowserConsoleHandler to send logs to any browser's console via console.log() injection in the output + * Added FilterHandler to filter records and only allow those of a given list of levels through to the wrapped handler + * Added FlowdockHandler to send logs to a Flowdock account + * Added RollbarHandler to send logs to a Rollbar account + * Added HtmlFormatter to send prettier log emails with colors for each log level + * Added GitProcessor to add the current branch/commit to extra record data + * Added a Monolog\Registry class to allow easier global access to pre-configured loggers + * Added support for the new official graylog2/gelf-php lib for GelfHandler, upgrade if you can by replacing the mlehner/gelf-php requirement + * Added support for HHVM + * Added support for Loggly batch uploads + * Added support for tweaking the content type and encoding in NativeMailerHandler + * Added $skipClassesPartials to tweak the ignored classes in the IntrospectionProcessor + * Fixed batch request support in GelfHandler + +### 1.7.0 (2013-11-14) + + * Added ElasticSearchHandler to send logs to an Elastic Search server + * Added DynamoDbHandler and ScalarFormatter to send logs to Amazon's Dynamo DB + * Added SyslogUdpHandler to send logs to a remote syslogd server + * Added LogglyHandler to send logs to a Loggly account + * Added $level to IntrospectionProcessor so it only adds backtraces when needed + * Added $version to LogstashFormatter to allow using the new v1 Logstash format + * Added $appName to NewRelicHandler + * Added configuration of Pushover notification retries/expiry + * Added $maxColumnWidth to NativeMailerHandler to change the 70 chars default + * Added chainability to most setters for all handlers + * Fixed RavenHandler batch processing so it takes the message from the record with highest priority + * Fixed HipChatHandler batch processing so it sends all messages at once + * Fixed issues with eAccelerator + * Fixed and improved many small things + +### 1.6.0 (2013-07-29) + + * Added HipChatHandler to send logs to a HipChat chat room + * Added ErrorLogHandler to send logs to PHP's error_log function + * Added NewRelicHandler to send logs to NewRelic's service + * Added Monolog\ErrorHandler helper class to register a Logger as exception/error/fatal handler + * Added ChannelLevelActivationStrategy for the FingersCrossedHandler to customize levels by channel + * Added stack traces output when normalizing exceptions (json output & co) + * Added Monolog\Logger::API constant (currently 1) + * Added support for ChromePHP's v4.0 extension + * Added support for message priorities in PushoverHandler, see $highPriorityLevel and $emergencyLevel + * Added support for sending messages to multiple users at once with the PushoverHandler + * Fixed RavenHandler's support for batch sending of messages (when behind a Buffer or FingersCrossedHandler) + * Fixed normalization of Traversables with very large data sets, only the first 1000 items are shown now + * Fixed issue in RotatingFileHandler when an open_basedir restriction is active + * Fixed minor issues in RavenHandler and bumped the API to Raven 0.5.0 + * Fixed SyslogHandler issue when many were used concurrently with different facilities + +### 1.5.0 (2013-04-23) + + * Added ProcessIdProcessor to inject the PID in log records + * Added UidProcessor to inject a unique identifier to all log records of one request/run + * Added support for previous exceptions in the LineFormatter exception serialization + * Added Monolog\Logger::getLevels() to get all available levels + * Fixed ChromePHPHandler so it avoids sending headers larger than Chrome can handle + +### 1.4.1 (2013-04-01) + + * Fixed exception formatting in the LineFormatter to be more minimalistic + * Fixed RavenHandler's handling of context/extra data, requires Raven client >0.1.0 + * Fixed log rotation in RotatingFileHandler to work with long running scripts spanning multiple days + * Fixed WebProcessor array access so it checks for data presence + * Fixed Buffer, Group and FingersCrossed handlers to make use of their processors + +### 1.4.0 (2013-02-13) + + * Added RedisHandler to log to Redis via the Predis library or the phpredis extension + * Added ZendMonitorHandler to log to the Zend Server monitor + * Added the possibility to pass arrays of handlers and processors directly in the Logger constructor + * Added `$useSSL` option to the PushoverHandler which is enabled by default + * Fixed ChromePHPHandler and FirePHPHandler issue when multiple instances are used simultaneously + * Fixed header injection capability in the NativeMailHandler + +### 1.3.1 (2013-01-11) + + * Fixed LogstashFormatter to be usable with stream handlers + * Fixed GelfMessageFormatter levels on Windows + +### 1.3.0 (2013-01-08) + + * Added PSR-3 compliance, the `Monolog\Logger` class is now an instance of `Psr\Log\LoggerInterface` + * Added PsrLogMessageProcessor that you can selectively enable for full PSR-3 compliance + * Added LogstashFormatter (combine with SocketHandler or StreamHandler to send logs to Logstash) + * Added PushoverHandler to send mobile notifications + * Added CouchDBHandler and DoctrineCouchDBHandler + * Added RavenHandler to send data to Sentry servers + * Added support for the new MongoClient class in MongoDBHandler + * Added microsecond precision to log records' timestamps + * Added `$flushOnOverflow` param to BufferHandler to flush by batches instead of losing + the oldest entries + * Fixed normalization of objects with cyclic references + +### 1.2.1 (2012-08-29) + + * Added new $logopts arg to SyslogHandler to provide custom openlog options + * Fixed fatal error in SyslogHandler + +### 1.2.0 (2012-08-18) + + * Added AmqpHandler (for use with AMQP servers) + * Added CubeHandler + * Added NativeMailerHandler::addHeader() to send custom headers in mails + * Added the possibility to specify more than one recipient in NativeMailerHandler + * Added the possibility to specify float timeouts in SocketHandler + * Added NOTICE and EMERGENCY levels to conform with RFC 5424 + * Fixed the log records to use the php default timezone instead of UTC + * Fixed BufferHandler not being flushed properly on PHP fatal errors + * Fixed normalization of exotic resource types + * Fixed the default format of the SyslogHandler to avoid duplicating datetimes in syslog + +### 1.1.0 (2012-04-23) + + * Added Monolog\Logger::isHandling() to check if a handler will + handle the given log level + * Added ChromePHPHandler + * Added MongoDBHandler + * Added GelfHandler (for use with Graylog2 servers) + * Added SocketHandler (for use with syslog-ng for example) + * Added NormalizerFormatter + * Added the possibility to change the activation strategy of the FingersCrossedHandler + * Added possibility to show microseconds in logs + * Added `server` and `referer` to WebProcessor output + +### 1.0.2 (2011-10-24) + + * Fixed bug in IE with large response headers and FirePHPHandler + +### 1.0.1 (2011-08-25) + + * Added MemoryPeakUsageProcessor and MemoryUsageProcessor + * Added Monolog\Logger::getName() to get a logger's channel name + +### 1.0.0 (2011-07-06) + + * Added IntrospectionProcessor to get info from where the logger was called + * Fixed WebProcessor in CLI + +### 1.0.0-RC1 (2011-07-01) + + * Initial release diff --git a/application/vendor/monolog/monolog/CHANGELOG.mdown b/application/vendor/monolog/monolog/CHANGELOG.mdown deleted file mode 100644 index 2aaeec5..0000000 --- a/application/vendor/monolog/monolog/CHANGELOG.mdown +++ /dev/null @@ -1,265 +0,0 @@ -### 1.17.2 (2015-10-14) - - * Fixed ErrorHandler compatibility with non-Monolog PSR-3 loggers - * Fixed SlackHandler handling to use slack functionalities better - * Fixed SwiftMailerHandler bug when sending multiple emails they all had the same id - * Fixed 5.3 compatibility regression - -### 1.17.1 (2015-08-31) - - * Fixed RollbarHandler triggering PHP notices - -### 1.17.0 (2015-08-30) - - * Added support for `checksum` and `release` context/extra values in RavenHandler - * Added better support for exceptions in RollbarHandler - * Added UidProcessor::getUid - * Added support for showing the resource type in NormalizedFormatter - * Fixed IntrospectionProcessor triggering PHP notices - -### 1.16.0 (2015-08-09) - - * Added IFTTTHandler to notify ifttt.com triggers - * Added Logger::setHandlers() to allow setting/replacing all handlers - * Added $capSize in RedisHandler to cap the log size - * Fixed StreamHandler creation of directory to only trigger when the first log write happens - * Fixed bug in the handling of curl failures - * Fixed duplicate logging of fatal errors when both error and fatal error handlers are registered in monolog's ErrorHandler - * Fixed missing fatal errors records with handlers that need to be closed to flush log records - * Fixed TagProcessor::addTags support for associative arrays - -### 1.15.0 (2015-07-12) - - * Added addTags and setTags methods to change a TagProcessor - * Added automatic creation of directories if they are missing for a StreamHandler to open a log file - * Added retry functionality to Loggly, Cube and Mandrill handlers so they retry up to 5 times in case of network failure - * Fixed process exit code being incorrectly reset to 0 if ErrorHandler::registerExceptionHandler was used - * Fixed HTML/JS escaping in BrowserConsoleHandler - * Fixed JSON encoding errors being silently suppressed (PHP 5.5+ only) - -### 1.14.0 (2015-06-19) - - * Added PHPConsoleHandler to send record to Chrome's PHP Console extension and library - * Added support for objects implementing __toString in the NormalizerFormatter - * Added support for HipChat's v2 API in HipChatHandler - * Added Logger::setTimezone() to initialize the timezone monolog should use in case date.timezone isn't correct for your app - * Added an option to send formatted message instead of the raw record on PushoverHandler via ->useFormattedMessage(true) - * Fixed curl errors being silently suppressed - -### 1.13.1 (2015-03-09) - - * Fixed regression in HipChat requiring a new token to be created - -### 1.13.0 (2015-03-05) - - * Added Registry::hasLogger to check for the presence of a logger instance - * Added context.user support to RavenHandler - * Added HipChat API v2 support in the HipChatHandler - * Added NativeMailerHandler::addParameter to pass params to the mail() process - * Added context data to SlackHandler when $includeContextAndExtra is true - * Added ability to customize the Swift_Message per-email in SwiftMailerHandler - * Fixed SwiftMailerHandler to lazily create message instances if a callback is provided - * Fixed serialization of INF and NaN values in Normalizer and LineFormatter - -### 1.12.0 (2014-12-29) - - * Break: HandlerInterface::isHandling now receives a partial record containing only a level key. This was always the intent and does not break any Monolog handler but is strictly speaking a BC break and you should check if you relied on any other field in your own handlers. - * Added PsrHandler to forward records to another PSR-3 logger - * Added SamplingHandler to wrap around a handler and include only every Nth record - * Added MongoDBFormatter to support better storage with MongoDBHandler (it must be enabled manually for now) - * Added exception codes in the output of most formatters - * Added LineFormatter::includeStacktraces to enable exception stack traces in logs (uses more than one line) - * Added $useShortAttachment to SlackHandler to minify attachment size and $includeExtra to append extra data - * Added $host to HipChatHandler for users of private instances - * Added $transactionName to NewRelicHandler and support for a transaction_name context value - * Fixed MandrillHandler to avoid outputing API call responses - * Fixed some non-standard behaviors in SyslogUdpHandler - -### 1.11.0 (2014-09-30) - - * Break: The NewRelicHandler extra and context data are now prefixed with extra_ and context_ to avoid clashes. Watch out if you have scripts reading those from the API and rely on names - * Added WhatFailureGroupHandler to suppress any exception coming from the wrapped handlers and avoid chain failures if a logging service fails - * Added MandrillHandler to send emails via the Mandrillapp.com API - * Added SlackHandler to log records to a Slack.com account - * Added FleepHookHandler to log records to a Fleep.io account - * Added LogglyHandler::addTag to allow adding tags to an existing handler - * Added $ignoreEmptyContextAndExtra to LineFormatter to avoid empty [] at the end - * Added $useLocking to StreamHandler and RotatingFileHandler to enable flock() while writing - * Added support for PhpAmqpLib in the AmqpHandler - * Added FingersCrossedHandler::clear and BufferHandler::clear to reset them between batches in long running jobs - * Added support for adding extra fields from $_SERVER in the WebProcessor - * Fixed support for non-string values in PrsLogMessageProcessor - * Fixed SwiftMailer messages being sent with the wrong date in long running scripts - * Fixed minor PHP 5.6 compatibility issues - * Fixed BufferHandler::close being called twice - -### 1.10.0 (2014-06-04) - - * Added Logger::getHandlers() and Logger::getProcessors() methods - * Added $passthruLevel argument to FingersCrossedHandler to let it always pass some records through even if the trigger level is not reached - * Added support for extra data in NewRelicHandler - * Added $expandNewlines flag to the ErrorLogHandler to create multiple log entries when a message has multiple lines - -### 1.9.1 (2014-04-24) - - * Fixed regression in RotatingFileHandler file permissions - * Fixed initialization of the BufferHandler to make sure it gets flushed after receiving records - * Fixed ChromePHPHandler and FirePHPHandler's activation strategies to be more conservative - -### 1.9.0 (2014-04-20) - - * Added LogEntriesHandler to send logs to a LogEntries account - * Added $filePermissions to tweak file mode on StreamHandler and RotatingFileHandler - * Added $useFormatting flag to MemoryProcessor to make it send raw data in bytes - * Added support for table formatting in FirePHPHandler via the table context key - * Added a TagProcessor to add tags to records, and support for tags in RavenHandler - * Added $appendNewline flag to the JsonFormatter to enable using it when logging to files - * Added sound support to the PushoverHandler - * Fixed multi-threading support in StreamHandler - * Fixed empty headers issue when ChromePHPHandler received no records - * Fixed default format of the ErrorLogHandler - -### 1.8.0 (2014-03-23) - - * Break: the LineFormatter now strips newlines by default because this was a bug, set $allowInlineLineBreaks to true if you need them - * Added BrowserConsoleHandler to send logs to any browser's console via console.log() injection in the output - * Added FilterHandler to filter records and only allow those of a given list of levels through to the wrapped handler - * Added FlowdockHandler to send logs to a Flowdock account - * Added RollbarHandler to send logs to a Rollbar account - * Added HtmlFormatter to send prettier log emails with colors for each log level - * Added GitProcessor to add the current branch/commit to extra record data - * Added a Monolog\Registry class to allow easier global access to pre-configured loggers - * Added support for the new official graylog2/gelf-php lib for GelfHandler, upgrade if you can by replacing the mlehner/gelf-php requirement - * Added support for HHVM - * Added support for Loggly batch uploads - * Added support for tweaking the content type and encoding in NativeMailerHandler - * Added $skipClassesPartials to tweak the ignored classes in the IntrospectionProcessor - * Fixed batch request support in GelfHandler - -### 1.7.0 (2013-11-14) - - * Added ElasticSearchHandler to send logs to an Elastic Search server - * Added DynamoDbHandler and ScalarFormatter to send logs to Amazon's Dynamo DB - * Added SyslogUdpHandler to send logs to a remote syslogd server - * Added LogglyHandler to send logs to a Loggly account - * Added $level to IntrospectionProcessor so it only adds backtraces when needed - * Added $version to LogstashFormatter to allow using the new v1 Logstash format - * Added $appName to NewRelicHandler - * Added configuration of Pushover notification retries/expiry - * Added $maxColumnWidth to NativeMailerHandler to change the 70 chars default - * Added chainability to most setters for all handlers - * Fixed RavenHandler batch processing so it takes the message from the record with highest priority - * Fixed HipChatHandler batch processing so it sends all messages at once - * Fixed issues with eAccelerator - * Fixed and improved many small things - -### 1.6.0 (2013-07-29) - - * Added HipChatHandler to send logs to a HipChat chat room - * Added ErrorLogHandler to send logs to PHP's error_log function - * Added NewRelicHandler to send logs to NewRelic's service - * Added Monolog\ErrorHandler helper class to register a Logger as exception/error/fatal handler - * Added ChannelLevelActivationStrategy for the FingersCrossedHandler to customize levels by channel - * Added stack traces output when normalizing exceptions (json output & co) - * Added Monolog\Logger::API constant (currently 1) - * Added support for ChromePHP's v4.0 extension - * Added support for message priorities in PushoverHandler, see $highPriorityLevel and $emergencyLevel - * Added support for sending messages to multiple users at once with the PushoverHandler - * Fixed RavenHandler's support for batch sending of messages (when behind a Buffer or FingersCrossedHandler) - * Fixed normalization of Traversables with very large data sets, only the first 1000 items are shown now - * Fixed issue in RotatingFileHandler when an open_basedir restriction is active - * Fixed minor issues in RavenHandler and bumped the API to Raven 0.5.0 - * Fixed SyslogHandler issue when many were used concurrently with different facilities - -### 1.5.0 (2013-04-23) - - * Added ProcessIdProcessor to inject the PID in log records - * Added UidProcessor to inject a unique identifier to all log records of one request/run - * Added support for previous exceptions in the LineFormatter exception serialization - * Added Monolog\Logger::getLevels() to get all available levels - * Fixed ChromePHPHandler so it avoids sending headers larger than Chrome can handle - -### 1.4.1 (2013-04-01) - - * Fixed exception formatting in the LineFormatter to be more minimalistic - * Fixed RavenHandler's handling of context/extra data, requires Raven client >0.1.0 - * Fixed log rotation in RotatingFileHandler to work with long running scripts spanning multiple days - * Fixed WebProcessor array access so it checks for data presence - * Fixed Buffer, Group and FingersCrossed handlers to make use of their processors - -### 1.4.0 (2013-02-13) - - * Added RedisHandler to log to Redis via the Predis library or the phpredis extension - * Added ZendMonitorHandler to log to the Zend Server monitor - * Added the possibility to pass arrays of handlers and processors directly in the Logger constructor - * Added `$useSSL` option to the PushoverHandler which is enabled by default - * Fixed ChromePHPHandler and FirePHPHandler issue when multiple instances are used simultaneously - * Fixed header injection capability in the NativeMailHandler - -### 1.3.1 (2013-01-11) - - * Fixed LogstashFormatter to be usable with stream handlers - * Fixed GelfMessageFormatter levels on Windows - -### 1.3.0 (2013-01-08) - - * Added PSR-3 compliance, the `Monolog\Logger` class is now an instance of `Psr\Log\LoggerInterface` - * Added PsrLogMessageProcessor that you can selectively enable for full PSR-3 compliance - * Added LogstashFormatter (combine with SocketHandler or StreamHandler to send logs to Logstash) - * Added PushoverHandler to send mobile notifications - * Added CouchDBHandler and DoctrineCouchDBHandler - * Added RavenHandler to send data to Sentry servers - * Added support for the new MongoClient class in MongoDBHandler - * Added microsecond precision to log records' timestamps - * Added `$flushOnOverflow` param to BufferHandler to flush by batches instead of losing - the oldest entries - * Fixed normalization of objects with cyclic references - -### 1.2.1 (2012-08-29) - - * Added new $logopts arg to SyslogHandler to provide custom openlog options - * Fixed fatal error in SyslogHandler - -### 1.2.0 (2012-08-18) - - * Added AmqpHandler (for use with AMQP servers) - * Added CubeHandler - * Added NativeMailerHandler::addHeader() to send custom headers in mails - * Added the possibility to specify more than one recipient in NativeMailerHandler - * Added the possibility to specify float timeouts in SocketHandler - * Added NOTICE and EMERGENCY levels to conform with RFC 5424 - * Fixed the log records to use the php default timezone instead of UTC - * Fixed BufferHandler not being flushed properly on PHP fatal errors - * Fixed normalization of exotic resource types - * Fixed the default format of the SyslogHandler to avoid duplicating datetimes in syslog - -### 1.1.0 (2012-04-23) - - * Added Monolog\Logger::isHandling() to check if a handler will - handle the given log level - * Added ChromePHPHandler - * Added MongoDBHandler - * Added GelfHandler (for use with Graylog2 servers) - * Added SocketHandler (for use with syslog-ng for example) - * Added NormalizerFormatter - * Added the possibility to change the activation strategy of the FingersCrossedHandler - * Added possibility to show microseconds in logs - * Added `server` and `referer` to WebProcessor output - -### 1.0.2 (2011-10-24) - - * Fixed bug in IE with large response headers and FirePHPHandler - -### 1.0.1 (2011-08-25) - - * Added MemoryPeakUsageProcessor and MemoryUsageProcessor - * Added Monolog\Logger::getName() to get a logger's channel name - -### 1.0.0 (2011-07-06) - - * Added IntrospectionProcessor to get info from where the logger was called - * Fixed WebProcessor in CLI - -### 1.0.0-RC1 (2011-07-01) - - * Initial release diff --git a/application/vendor/monolog/monolog/LICENSE b/application/vendor/monolog/monolog/LICENSE index 56e08d5..1647321 100644 --- a/application/vendor/monolog/monolog/LICENSE +++ b/application/vendor/monolog/monolog/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2011-2015 Jordi Boggiano +Copyright (c) 2011-2016 Jordi Boggiano Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/application/vendor/monolog/monolog/README.md b/application/vendor/monolog/monolog/README.md new file mode 100644 index 0000000..a578eb2 --- /dev/null +++ b/application/vendor/monolog/monolog/README.md @@ -0,0 +1,94 @@ +# Monolog - Logging for PHP [![Build Status](https://img.shields.io/travis/Seldaek/monolog.svg)](https://travis-ci.org/Seldaek/monolog) + +[![Total Downloads](https://img.shields.io/packagist/dt/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog) +[![Latest Stable Version](https://img.shields.io/packagist/v/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog) + + +Monolog sends your logs to files, sockets, inboxes, databases and various +web services. See the complete list of handlers below. Special handlers +allow you to build advanced logging strategies. + +This library implements the [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) +interface that you can type-hint against in your own libraries to keep +a maximum of interoperability. You can also use it in your applications to +make sure you can always use another compatible logger at a later time. +As of 1.11.0 Monolog public APIs will also accept PSR-3 log levels. +Internally Monolog still uses its own level scheme since it predates PSR-3. + +## Installation + +Install the latest version with + +```bash +$ composer require monolog/monolog +``` + +## Basic Usage + +```php +pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING)); + +// add records to the log +$log->addWarning('Foo'); +$log->addError('Bar'); +``` + +## Documentation + +- [Usage Instructions](doc/01-usage.md) +- [Handlers, Formatters and Processors](doc/02-handlers-formatters-processors.md) +- [Utility classes](doc/03-utilities.md) +- [Extending Monolog](doc/04-extending.md) + +## Third Party Packages + +Third party handlers, formatters and processors are +[listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You +can also add your own there if you publish one. + +## About + +### Requirements + +- Monolog works with PHP 5.3 or above, and is also tested to work with HHVM. + +### Submitting bugs and feature requests + +Bugs and feature request are tracked on [GitHub](https://github.com/Seldaek/monolog/issues) + +### Framework Integrations + +- Frameworks and libraries using [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) + can be used very easily with Monolog since it implements the interface. +- [Symfony2](http://symfony.com) comes out of the box with Monolog. +- [Silex](http://silex.sensiolabs.org/) comes out of the box with Monolog. +- [Laravel 4 & 5](http://laravel.com/) come out of the box with Monolog. +- [Lumen](http://lumen.laravel.com/) comes out of the box with Monolog. +- [PPI](http://www.ppi.io/) comes out of the box with Monolog. +- [CakePHP](http://cakephp.org/) is usable with Monolog via the [cakephp-monolog](https://github.com/jadb/cakephp-monolog) plugin. +- [Slim](http://www.slimframework.com/) is usable with Monolog via the [Slim-Monolog](https://github.com/Flynsarmy/Slim-Monolog) log writer. +- [XOOPS 2.6](http://xoops.org/) comes out of the box with Monolog. +- [Aura.Web_Project](https://github.com/auraphp/Aura.Web_Project) comes out of the box with Monolog. +- [Nette Framework](http://nette.org/en/) can be used with Monolog via [Kdyby/Monolog](https://github.com/Kdyby/Monolog) extension. +- [Proton Micro Framework](https://github.com/alexbilbie/Proton) comes out of the box with Monolog. + +### Author + +Jordi Boggiano - -
    +See also the list of [contributors](https://github.com/Seldaek/monolog/contributors) which participated in this project. + +### License + +Monolog is licensed under the MIT License - see the `LICENSE` file for details + +### Acknowledgements + +This library is heavily inspired by Python's [Logbook](https://logbook.readthedocs.io/en/stable/) +library, although most concepts have been adjusted to fit to the PHP world. diff --git a/application/vendor/monolog/monolog/README.mdown b/application/vendor/monolog/monolog/README.mdown deleted file mode 100644 index 7d8ade5..0000000 --- a/application/vendor/monolog/monolog/README.mdown +++ /dev/null @@ -1,95 +0,0 @@ -# Monolog - Logging for PHP [![Build Status](https://img.shields.io/travis/Seldaek/monolog.svg)](https://travis-ci.org/Seldaek/monolog) - -[![Total Downloads](https://img.shields.io/packagist/dt/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog) -[![Latest Stable Version](https://img.shields.io/packagist/v/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog) -[![Reference Status](https://www.versioneye.com/php/monolog:monolog/reference_badge.svg)](https://www.versioneye.com/php/monolog:monolog/references) - - -Monolog sends your logs to files, sockets, inboxes, databases and various -web services. See the complete list of handlers below. Special handlers -allow you to build advanced logging strategies. - -This library implements the [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) -interface that you can type-hint against in your own libraries to keep -a maximum of interoperability. You can also use it in your applications to -make sure you can always use another compatible logger at a later time. -As of 1.11.0 Monolog public APIs will also accept PSR-3 log levels. -Internally Monolog still uses its own level scheme since it predates PSR-3. - -## Installation - -Install the latest version with - -```bash -$ composer require monolog/monolog -``` - -## Basic Usage - -```php -pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING)); - -// add records to the log -$log->addWarning('Foo'); -$log->addError('Bar'); -``` - -## Documentation - -- [Usage Instructions](doc/01-usage.md) -- [Handlers, Formatters and Processors](doc/02-handlers-formatters-processors.md) -- [Utility classes](doc/03-utilities.md) -- [Extending Monolog](doc/04-extending.md) - -## Third Party Packages - -Third party handlers, formatters and processors are -[listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You -can also add your own there if you publish one. - -## About - -### Requirements - -- Monolog works with PHP 5.3 or above, and is also tested to work with HHVM. - -### Submitting bugs and feature requests - -Bugs and feature request are tracked on [GitHub](https://github.com/Seldaek/monolog/issues) - -### Framework Integrations - -- Frameworks and libraries using [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) - can be used very easily with Monolog since it implements the interface. -- [Symfony2](http://symfony.com) comes out of the box with Monolog. -- [Silex](http://silex.sensiolabs.org/) comes out of the box with Monolog. -- [Laravel 4 & 5](http://laravel.com/) come out of the box with Monolog. -- [Lumen](http://lumen.laravel.com/) comes out of the box with Monolog. -- [PPI](http://www.ppi.io/) comes out of the box with Monolog. -- [CakePHP](http://cakephp.org/) is usable with Monolog via the [cakephp-monolog](https://github.com/jadb/cakephp-monolog) plugin. -- [Slim](http://www.slimframework.com/) is usable with Monolog via the [Slim-Monolog](https://github.com/Flynsarmy/Slim-Monolog) log writer. -- [XOOPS 2.6](http://xoops.org/) comes out of the box with Monolog. -- [Aura.Web_Project](https://github.com/auraphp/Aura.Web_Project) comes out of the box with Monolog. -- [Nette Framework](http://nette.org/en/) can be used with Monolog via [Kdyby/Monolog](https://github.com/Kdyby/Monolog) extension. -- [Proton Micro Framework](https://github.com/alexbilbie/Proton) comes out of the box with Monolog. - -### Author - -Jordi Boggiano - -
    -See also the list of [contributors](https://github.com/Seldaek/monolog/contributors) which participated in this project. - -### License - -Monolog is licensed under the MIT License - see the `LICENSE` file for details - -### Acknowledgements - -This library is heavily inspired by Python's [Logbook](http://packages.python.org/Logbook/) -library, although most concepts have been adjusted to fit to the PHP world. diff --git a/application/vendor/monolog/monolog/composer.json b/application/vendor/monolog/monolog/composer.json index 2bb9053..097df87 100644 --- a/application/vendor/monolog/monolog/composer.json +++ b/application/vendor/monolog/monolog/composer.json @@ -19,12 +19,12 @@ "require-dev": { "phpunit/phpunit": "~4.5", "graylog2/gelf-php": "~1.0", - "raven/raven": "^0.13", + "sentry/sentry": "^0.13", "ruflin/elastica": ">=0.90 <3.0", "doctrine/couchdb": "~1.0@dev", - "aws/aws-sdk-php": "^2.4.9", - "videlalvaro/php-amqplib": "~2.4", - "swiftmailer/swiftmailer": "~5.3", + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "php-amqplib/php-amqplib": "~2.4", + "swiftmailer/swiftmailer": "^5.3|^6.0", "php-console/php-console": "^3.1.3", "phpunit/phpunit-mock-objects": "2.3.0", "jakub-onderka/php-parallel-lint": "0.9" @@ -32,12 +32,13 @@ "_": "phpunit/phpunit-mock-objects required in 2.3.0 due to https://github.com/sebastianbergmann/phpunit-mock-objects/issues/223 - needs hhvm 3.8+ on travis", "suggest": { "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "raven/raven": "Allow sending log messages to a Sentry server", + "sentry/sentry": "Allow sending log messages to a Sentry server", "doctrine/couchdb": "Allow sending log messages to a CouchDB server", "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", "ext-mongo": "Allow sending log messages to a MongoDB server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", "rollbar/rollbar": "Allow sending log messages to Rollbar", "php-console/php-console": "Allow sending log messages to Google Chrome" @@ -53,12 +54,12 @@ }, "extra": { "branch-alias": { - "dev-master": "1.16.x-dev" + "dev-master": "2.0.x-dev" } }, "scripts": { "test": [ - "parallel-lint . --exclude vendor", + "parallel-lint . --exclude vendor --exclude src/Monolog/Handler/FormattableHandlerInterface.php --exclude src/Monolog/Handler/FormattableHandlerTrait.php --exclude src/Monolog/Handler/ProcessableHandlerInterface.php --exclude src/Monolog/Handler/ProcessableHandlerTrait.php", "phpunit" ] } diff --git a/application/vendor/monolog/monolog/doc/01-usage.md b/application/vendor/monolog/monolog/doc/01-usage.md deleted file mode 100644 index 75bc402..0000000 --- a/application/vendor/monolog/monolog/doc/01-usage.md +++ /dev/null @@ -1,228 +0,0 @@ -# Using Monolog - -- [Installation](#installation) -- [Core Concepts](#core-concepts) -- [Log Levels](#log-levels) -- [Configuring a logger](#configuring-a-logger) -- [Adding extra data in the records](#adding-extra-data-in-the-records) -- [Leveraging channels](#leveraging-channels) -- [Customizing the log format](#customizing-the-log-format) - -## Installation - -Monolog is available on Packagist ([monolog/monolog](http://packagist.org/packages/monolog/monolog)) -and as such installable via [Composer](http://getcomposer.org/). - -```bash -composer require monolog/monolog -``` - -If you do not use Composer, you can grab the code from GitHub, and use any -PSR-0 compatible autoloader (e.g. the [Symfony2 ClassLoader component](https://github.com/symfony/ClassLoader)) -to load Monolog classes. - -## Core Concepts - -Every `Logger` instance has a channel (name) and a stack of handlers. Whenever -you add a record to the logger, it traverses the handler stack. Each handler -decides whether it fully handled the record, and if so, the propagation of the -record ends there. - -This allows for flexible logging setups, for example having a `StreamHandler` at -the bottom of the stack that will log anything to disk, and on top of that add -a `MailHandler` that will send emails only when an error message is logged. -Handlers also have a `$bubble` property which defines whether they block the -record or not if they handled it. In this example, setting the `MailHandler`'s -`$bubble` argument to false means that records handled by the `MailHandler` will -not propagate to the `StreamHandler` anymore. - -You can create many `Logger`s, each defining a channel (e.g.: db, request, -router, ..) and each of them combining various handlers, which can be shared -or not. The channel is reflected in the logs and allows you to easily see or -filter records. - -Each Handler also has a Formatter, a default one with settings that make sense -will be created if you don't set one. The formatters normalize and format -incoming records so that they can be used by the handlers to output useful -information. - -Custom severity levels are not available. Only the eight -[RFC 5424](http://tools.ietf.org/html/rfc5424) levels (debug, info, notice, -warning, error, critical, alert, emergency) are present for basic filtering -purposes, but for sorting and other use cases that would require -flexibility, you should add Processors to the Logger that can add extra -information (tags, user ip, ..) to the records before they are handled. - -## Log Levels - -Monolog supports the logging levels described by [RFC 5424](http://tools.ietf.org/html/rfc5424). - -- **DEBUG** (100): Detailed debug information. - -- **INFO** (200): Interesting events. Examples: User logs in, SQL logs. - -- **NOTICE** (250): Normal but significant events. - -- **WARNING** (300): Exceptional occurrences that are not errors. Examples: - Use of deprecated APIs, poor use of an API, undesirable things that are not - necessarily wrong. - -- **ERROR** (400): Runtime errors that do not require immediate action but - should typically be logged and monitored. - -- **CRITICAL** (500): Critical conditions. Example: Application component - unavailable, unexpected exception. - -- **ALERT** (550): Action must be taken immediately. Example: Entire website - down, database unavailable, etc. This should trigger the SMS alerts and wake - you up. - -- **EMERGENCY** (600): Emergency: system is unusable. - -## Configuring a logger - -Here is a basic setup to log to a file and to firephp on the DEBUG level: - -```php -pushHandler(new StreamHandler(__DIR__.'/my_app.log', Logger::DEBUG)); -$logger->pushHandler(new FirePHPHandler()); - -// You can now use your logger -$logger->addInfo('My logger is now ready'); -``` - -Let's explain it. The first step is to create the logger instance which will -be used in your code. The argument is a channel name, which is useful when -you use several loggers (see below for more details about it). - -The logger itself does not know how to handle a record. It delegates it to -some handlers. The code above registers two handlers in the stack to allow -handling records in two different ways. - -Note that the FirePHPHandler is called first as it is added on top of the -stack. This allows you to temporarily add a logger with bubbling disabled if -you want to override other configured loggers. - -> If you use Monolog standalone and are looking for an easy way to -> configure many handlers, the [theorchard/monolog-cascade](https://github.com/theorchard/monolog-cascade) -> can help you build complex logging configs via PHP arrays, yaml or json configs. - -## Adding extra data in the records - -Monolog provides two different ways to add extra informations along the simple -textual message. - -### Using the logging context - -The first way is the context, allowing to pass an array of data along the -record: - -```php -addInfo('Adding a new user', array('username' => 'Seldaek')); -``` - -Simple handlers (like the StreamHandler for instance) will simply format -the array to a string but richer handlers can take advantage of the context -(FirePHP is able to display arrays in pretty way for instance). - -### Using processors - -The second way is to add extra data for all records by using a processor. -Processors can be any callable. They will get the record as parameter and -must return it after having eventually changed the `extra` part of it. Let's -write a processor adding some dummy data in the record: - -```php -pushProcessor(function ($record) { - $record['extra']['dummy'] = 'Hello world!'; - - return $record; -}); -``` - -Monolog provides some built-in processors that can be used in your project. -Look at the [dedicated chapter](https://github.com/Seldaek/monolog/blob/master/doc/02-handlers-formatters-processors.md#processors) for the list. - -> Tip: processors can also be registered on a specific handler instead of - the logger to apply only for this handler. - -## Leveraging channels - -Channels are a great way to identify to which part of the application a record -is related. This is useful in big applications (and is leveraged by -MonologBundle in Symfony2). - -Picture two loggers sharing a handler that writes to a single log file. -Channels would allow you to identify the logger that issued every record. -You can easily grep through the log files filtering this or that channel. - -```php -pushHandler($stream); -$logger->pushHandler($firephp); - -// Create a logger for the security-related stuff with a different channel -$securityLogger = new Logger('security'); -$securityLogger->pushHandler($stream); -$securityLogger->pushHandler($firephp); -``` - -## Customizing the log format - -In Monolog it's easy to customize the format of the logs written into files, -sockets, mails, databases and other handlers. Most of the handlers use the - -```php -$record['formatted'] -``` - -value to be automatically put into the log device. This value depends on the -formatter settings. You can choose between predefined formatter classes or -write your own (e.g. a multiline text file for human-readable output). - -To configure a predefined formatter class, just set it as the handler's field: - -```php -// the default date format is "Y-m-d H:i:s" -$dateFormat = "Y n j, g:i a"; -// the default output format is "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n" -$output = "%datetime% > %level_name% > %message% %context% %extra%\n"; -// finally, create a formatter -$formatter = new LineFormatter($output, $dateFormat); - -// Create a handler -$stream = new StreamHandler(__DIR__.'/my_app.log', Logger::DEBUG); -$stream->setFormatter($formatter); -// bind it to a logger object -$securityLogger = new Logger('security'); -$securityLogger->pushHandler($stream); -``` - -You may also reuse the same formatter between multiple handlers and share those -handlers between multiple loggers. - -[Handlers, Formatters and Processors](02-handlers-formatters-processors.md) → diff --git a/application/vendor/monolog/monolog/doc/02-handlers-formatters-processors.md b/application/vendor/monolog/monolog/doc/02-handlers-formatters-processors.md deleted file mode 100644 index 90f8fce..0000000 --- a/application/vendor/monolog/monolog/doc/02-handlers-formatters-processors.md +++ /dev/null @@ -1,142 +0,0 @@ -# Handlers, Formatters and Processors - -- [Handlers](#handlers) - - [Log to files and syslog](#log-to-files-and-syslog) - - [Send alerts and emails](#send-alerts-and-emails) - - [Log specific servers and networked logging](#log-specific-servers-and-networked-logging) - - [Logging in development](#logging-in-development) - - [Log to databases](#log-to-databases) - - [Wrappers / Special Handlers](#wrappers--special-handlers) -- [Formatters](#formatters) -- [Processors](#processors) -- [Third Party Packages](#third-party-packages) - -## Handlers - -### Log to files and syslog - -- _StreamHandler_: Logs records into any PHP stream, use this for log files. -- _RotatingFileHandler_: Logs records to a file and creates one logfile per day. - It will also delete files older than `$maxFiles`. You should use - [logrotate](http://linuxcommand.org/man_pages/logrotate8.html) for high profile - setups though, this is just meant as a quick and dirty solution. -- _SyslogHandler_: Logs records to the syslog. -- _ErrorLogHandler_: Logs records to PHP's - [`error_log()`](http://docs.php.net/manual/en/function.error-log.php) function. - -### Send alerts and emails - -- _NativeMailerHandler_: Sends emails using PHP's - [`mail()`](http://php.net/manual/en/function.mail.php) function. -- _SwiftMailerHandler_: Sends emails using a [`Swift_Mailer`](http://swiftmailer.org/) instance. -- _PushoverHandler_: Sends mobile notifications via the [Pushover](https://www.pushover.net/) API. -- _HipChatHandler_: Logs records to a [HipChat](http://hipchat.com) chat room using its API. -- _FlowdockHandler_: Logs records to a [Flowdock](https://www.flowdock.com/) account. -- _SlackHandler_: Logs records to a [Slack](https://www.slack.com/) account. -- _MandrillHandler_: Sends emails via the Mandrill API using a [`Swift_Message`](http://swiftmailer.org/) instance. -- _FleepHookHandler_: Logs records to a [Fleep](https://fleep.io/) conversation using Webhooks. -- _IFTTTHandler_: Notifies an [IFTTT](https://ifttt.com/maker) trigger with the log channel, level name and message. - -### Log specific servers and networked logging - -- _SocketHandler_: Logs records to [sockets](http://php.net/fsockopen), use this - for UNIX and TCP sockets. See an [example](sockets.md). -- _AmqpHandler_: Logs records to an [amqp](http://www.amqp.org/) compatible - server. Requires the [php-amqp](http://pecl.php.net/package/amqp) extension (1.0+). -- _GelfHandler_: Logs records to a [Graylog2](http://www.graylog2.org) server. -- _CubeHandler_: Logs records to a [Cube](http://square.github.com/cube/) server. -- _RavenHandler_: Logs records to a [Sentry](http://getsentry.com/) server using - [raven](https://packagist.org/packages/raven/raven). -- _ZendMonitorHandler_: Logs records to the Zend Monitor present in Zend Server. -- _NewRelicHandler_: Logs records to a [NewRelic](http://newrelic.com/) application. -- _LogglyHandler_: Logs records to a [Loggly](http://www.loggly.com/) account. -- _RollbarHandler_: Logs records to a [Rollbar](https://rollbar.com/) account. -- _SyslogUdpHandler_: Logs records to a remote [Syslogd](http://www.rsyslog.com/) server. -- _LogEntriesHandler_: Logs records to a [LogEntries](http://logentries.com/) account. - -### Logging in development - -- _FirePHPHandler_: Handler for [FirePHP](http://www.firephp.org/), providing - inline `console` messages within [FireBug](http://getfirebug.com/). -- _ChromePHPHandler_: Handler for [ChromePHP](http://www.chromephp.com/), providing - inline `console` messages within Chrome. -- _BrowserConsoleHandler_: Handler to send logs to browser's Javascript `console` with - no browser extension required. Most browsers supporting `console` API are supported. -- _PHPConsoleHandler_: Handler for [PHP Console](https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef), providing - inline `console` and notification popup messages within Chrome. - -### Log to databases - -- _RedisHandler_: Logs records to a [redis](http://redis.io) server. -- _MongoDBHandler_: Handler to write records in MongoDB via a - [Mongo](http://pecl.php.net/package/mongo) extension connection. -- _CouchDBHandler_: Logs records to a CouchDB server. -- _DoctrineCouchDBHandler_: Logs records to a CouchDB server via the Doctrine CouchDB ODM. -- _ElasticSearchHandler_: Logs records to an Elastic Search server. -- _DynamoDbHandler_: Logs records to a DynamoDB table with the [AWS SDK](https://github.com/aws/aws-sdk-php). - -### Wrappers / Special Handlers - -- _FingersCrossedHandler_: A very interesting wrapper. It takes a logger as - parameter and will accumulate log records of all levels until a record - exceeds the defined severity level. At which point it delivers all records, - including those of lower severity, to the handler it wraps. This means that - until an error actually happens you will not see anything in your logs, but - when it happens you will have the full information, including debug and info - records. This provides you with all the information you need, but only when - you need it. -- _WhatFailureGroupHandler_: This handler extends the _GroupHandler_ ignoring - exceptions raised by each child handler. This allows you to ignore issues - where a remote tcp connection may have died but you do not want your entire - application to crash and may wish to continue to log to other handlers. -- _BufferHandler_: This handler will buffer all the log records it receives - until `close()` is called at which point it will call `handleBatch()` on the - handler it wraps with all the log messages at once. This is very useful to - send an email with all records at once for example instead of having one mail - for every log record. -- _GroupHandler_: This handler groups other handlers. Every record received is - sent to all the handlers it is configured with. -- _FilterHandler_: This handler only lets records of the given levels through - to the wrapped handler. -- _SamplingHandler_: Wraps around another handler and lets you sample records - if you only want to store some of them. -- _NullHandler_: Any record it can handle will be thrown away. This can be used - to put on top of an existing handler stack to disable it temporarily. -- _PsrHandler_: Can be used to forward log records to an existing PSR-3 logger -- _TestHandler_: Used for testing, it records everything that is sent to it and - has accessors to read out the information. - -## Formatters - -- _LineFormatter_: Formats a log record into a one-line string. -- _HtmlFormatter_: Used to format log records into a human readable html table, mainly suitable for emails. -- _NormalizerFormatter_: Normalizes objects/resources down to strings so a record can easily be serialized/encoded. -- _ScalarFormatter_: Used to format log records into an associative array of scalar values. -- _JsonFormatter_: Encodes a log record into json. -- _WildfireFormatter_: Used to format log records into the Wildfire/FirePHP protocol, only useful for the FirePHPHandler. -- _ChromePHPFormatter_: Used to format log records into the ChromePHP format, only useful for the ChromePHPHandler. -- _GelfMessageFormatter_: Used to format log records into Gelf message instances, only useful for the GelfHandler. -- _LogstashFormatter_: Used to format log records into [logstash](http://logstash.net/) event json, useful for any handler listed under inputs [here](http://logstash.net/docs/latest). -- _ElasticaFormatter_: Used to format log records into an Elastica\Document object, only useful for the ElasticSearchHandler. -- _LogglyFormatter_: Used to format log records into Loggly messages, only useful for the LogglyHandler. -- _FlowdockFormatter_: Used to format log records into Flowdock messages, only useful for the FlowdockHandler. -- _MongoDBFormatter_: Converts \DateTime instances to \MongoDate and objects recursively to arrays, only useful with the MongoDBHandler. - -## Processors - -- _IntrospectionProcessor_: Adds the line/file/class/method from which the log call originated. -- _WebProcessor_: Adds the current request URI, request method and client IP to a log record. -- _MemoryUsageProcessor_: Adds the current memory usage to a log record. -- _MemoryPeakUsageProcessor_: Adds the peak memory usage to a log record. -- _ProcessIdProcessor_: Adds the process id to a log record. -- _UidProcessor_: Adds a unique identifier to a log record. -- _GitProcessor_: Adds the current git branch and commit to a log record. -- _TagProcessor_: Adds an array of predefined tags to a log record. - -## Third Party Packages - -Third party handlers, formatters and processors are -[listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You -can also add your own there if you publish one. - -← [Usage](01-usage.md) | [Utility classes](03-utilities.md) → diff --git a/application/vendor/monolog/monolog/doc/03-utilities.md b/application/vendor/monolog/monolog/doc/03-utilities.md deleted file mode 100644 index c62aa41..0000000 --- a/application/vendor/monolog/monolog/doc/03-utilities.md +++ /dev/null @@ -1,13 +0,0 @@ -# Utilities - -- _Registry_: The `Monolog\Registry` class lets you configure global loggers that you - can then statically access from anywhere. It is not really a best practice but can - help in some older codebases or for ease of use. -- _ErrorHandler_: The `Monolog\ErrorHandler` class allows you to easily register - a Logger instance as an exception handler, error handler or fatal error handler. -- _ErrorLevelActivationStrategy_: Activates a FingersCrossedHandler when a certain log - level is reached. -- _ChannelLevelActivationStrategy_: Activates a FingersCrossedHandler when a certain - log level is reached, depending on which channel received the log record. - -← [Handlers, Formatters and Processors](02-handlers-formatters-processors.md) | [Extending Monolog](04-extending.md) → diff --git a/application/vendor/monolog/monolog/doc/04-extending.md b/application/vendor/monolog/monolog/doc/04-extending.md deleted file mode 100644 index ebd9104..0000000 --- a/application/vendor/monolog/monolog/doc/04-extending.md +++ /dev/null @@ -1,76 +0,0 @@ -# Extending Monolog - -Monolog is fully extensible, allowing you to adapt your logger to your needs. - -## Writing your own handler - -Monolog provides many built-in handlers. But if the one you need does not -exist, you can write it and use it in your logger. The only requirement is -to implement `Monolog\Handler\HandlerInterface`. - -Let's write a PDOHandler to log records to a database. We will extend the -abstract class provided by Monolog to keep things DRY. - -```php -pdo = $pdo; - parent::__construct($level, $bubble); - } - - protected function write(array $record) - { - if (!$this->initialized) { - $this->initialize(); - } - - $this->statement->execute(array( - 'channel' => $record['channel'], - 'level' => $record['level'], - 'message' => $record['formatted'], - 'time' => $record['datetime']->format('U'), - )); - } - - private function initialize() - { - $this->pdo->exec( - 'CREATE TABLE IF NOT EXISTS monolog ' - .'(channel VARCHAR(255), level INTEGER, message LONGTEXT, time INTEGER UNSIGNED)' - ); - $this->statement = $this->pdo->prepare( - 'INSERT INTO monolog (channel, level, message, time) VALUES (:channel, :level, :message, :time)' - ); - - $this->initialized = true; - } -} -``` - -You can now use this handler in your logger: - -```php -pushHandler(new PDOHandler(new PDO('sqlite:logs.sqlite'))); - -// You can now use your logger -$logger->addInfo('My logger is now ready'); -``` - -The `Monolog\Handler\AbstractProcessingHandler` class provides most of the -logic needed for the handler, including the use of processors and the formatting -of the record (which is why we use ``$record['formatted']`` instead of ``$record['message']``). - -← [Utility classes](03-utilities.md) diff --git a/application/vendor/monolog/monolog/doc/sockets.md b/application/vendor/monolog/monolog/doc/sockets.md deleted file mode 100644 index ea9cf0e..0000000 --- a/application/vendor/monolog/monolog/doc/sockets.md +++ /dev/null @@ -1,39 +0,0 @@ -Sockets Handler -=============== - -This handler allows you to write your logs to sockets using [fsockopen](http://php.net/fsockopen) -or [pfsockopen](http://php.net/pfsockopen). - -Persistent sockets are mainly useful in web environments where you gain some performance not closing/opening -the connections between requests. - -You can use a `unix://` prefix to access unix sockets and `udp://` to open UDP sockets instead of the default TCP. - -Basic Example -------------- - -```php -setPersistent(true); - -// Now add the handler -$logger->pushHandler($handler, Logger::DEBUG); - -// You can now use your logger -$logger->addInfo('My logger is now ready'); - -``` - -In this example, using syslog-ng, you should see the log on the log server: - - cweb1 [2012-02-26 00:12:03] my_logger.INFO: My logger is now ready [] [] - diff --git a/application/vendor/monolog/monolog/phpunit.xml.dist b/application/vendor/monolog/monolog/phpunit.xml.dist deleted file mode 100644 index 20d82b6..0000000 --- a/application/vendor/monolog/monolog/phpunit.xml.dist +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - tests/Monolog/ - - - - - - src/Monolog/ - - - - - - - diff --git a/application/vendor/monolog/monolog/src/Monolog/ErrorHandler.php b/application/vendor/monolog/monolog/src/Monolog/ErrorHandler.php index f21eb28..adc55bd 100644 --- a/application/vendor/monolog/monolog/src/Monolog/ErrorHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/ErrorHandler.php @@ -14,6 +14,7 @@ use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; use Monolog\Handler\AbstractHandler; +use Monolog\Registry; /** * Monolog error handler @@ -33,10 +34,12 @@ class ErrorHandler private $previousErrorHandler; private $errorLevelMap; + private $handleOnlyReportedErrors; private $hasFatalErrorHandler; private $fatalLevel; private $reservedMemory; + private $lastFatalTrace; private static $fatalErrors = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR); public function __construct(LoggerInterface $logger) @@ -57,6 +60,9 @@ public function __construct(LoggerInterface $logger) */ public static function register(LoggerInterface $logger, $errorLevelMap = array(), $exceptionLevel = null, $fatalLevel = null) { + //Forces the autoloader to run for LogLevel. Fixes an autoload issue at compile-time on PHP5.3. See https://github.com/Seldaek/monolog/pull/929 + class_exists('\\Psr\\Log\\LogLevel', true); + $handler = new static($logger); if ($errorLevelMap !== false) { $handler->registerErrorHandler($errorLevelMap); @@ -80,13 +86,15 @@ public function registerExceptionHandler($level = null, $callPrevious = true) } } - public function registerErrorHandler(array $levelMap = array(), $callPrevious = true, $errorTypes = -1) + public function registerErrorHandler(array $levelMap = array(), $callPrevious = true, $errorTypes = -1, $handleOnlyReportedErrors = true) { $prev = set_error_handler(array($this, 'handleError'), $errorTypes); $this->errorLevelMap = array_replace($this->defaultErrorLevelMap(), $levelMap); if ($callPrevious) { $this->previousErrorHandler = $prev ?: true; } + + $this->handleOnlyReportedErrors = $handleOnlyReportedErrors; } public function registerFatalHandler($level = null, $reservedMemorySize = 20) @@ -126,7 +134,7 @@ public function handleException($e) { $this->logger->log( $this->uncaughtExceptionLevel === null ? LogLevel::ERROR : $this->uncaughtExceptionLevel, - sprintf('Uncaught Exception %s: "%s" at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()), + sprintf('Uncaught Exception %s: "%s" at %s line %s', Utils::getClass($e), $e->getMessage(), $e->getFile(), $e->getLine()), array('exception' => $e) ); @@ -142,7 +150,7 @@ public function handleException($e) */ public function handleError($code, $message, $file = '', $line = 0, $context = array()) { - if (!(error_reporting() & $code)) { + if ($this->handleOnlyReportedErrors && !(error_reporting() & $code)) { return; } @@ -150,6 +158,13 @@ public function handleError($code, $message, $file = '', $line = 0, $context = a if (!$this->hasFatalErrorHandler || !in_array($code, self::$fatalErrors, true)) { $level = isset($this->errorLevelMap[$code]) ? $this->errorLevelMap[$code] : LogLevel::CRITICAL; $this->logger->log($level, self::codeToString($code).': '.$message, array('code' => $code, 'message' => $message, 'file' => $file, 'line' => $line)); + } else { + // http://php.net/manual/en/function.debug-backtrace.php + // As of 5.3.6, DEBUG_BACKTRACE_IGNORE_ARGS option was added. + // Any version less than 5.3.6 must use the DEBUG_BACKTRACE_IGNORE_ARGS constant value '2'. + $trace = debug_backtrace((PHP_VERSION_ID < 50306) ? 2 : DEBUG_BACKTRACE_IGNORE_ARGS); + array_shift($trace); // Exclude handleError from trace + $this->lastFatalTrace = $trace; } if ($this->previousErrorHandler === true) { @@ -171,7 +186,7 @@ public function handleFatalError() $this->logger->log( $this->fatalLevel === null ? LogLevel::ALERT : $this->fatalLevel, 'Fatal Error ('.self::codeToString($lastError['type']).'): '.$lastError['message'], - array('code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line']) + array('code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line'], 'trace' => $this->lastFatalTrace) ); if ($this->logger instanceof Logger) { diff --git a/application/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php b/application/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php index 56d3e27..9beda1e 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php +++ b/application/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php @@ -41,10 +41,9 @@ public function format(array $record) { // Retrieve the line and file if set and remove them from the formatted extra $backtrace = 'unknown'; - if (isset($record['extra']['file']) && isset($record['extra']['line'])) { + if (isset($record['extra']['file'], $record['extra']['line'])) { $backtrace = $record['extra']['file'].' : '.$record['extra']['line']; - unset($record['extra']['file']); - unset($record['extra']['line']); + unset($record['extra']['file'], $record['extra']['line']); } $message = array('message' => $record['message']); diff --git a/application/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php b/application/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php index b0b0cf0..4c556cf 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php +++ b/application/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php @@ -36,7 +36,9 @@ class ElasticaFormatter extends NormalizerFormatter */ public function __construct($index, $type) { - parent::__construct(\DateTime::ISO8601); + // elasticsearch requires a ISO 8601 format date with optional millisecond precision. + parent::__construct('Y-m-d\TH:i:s.uP'); + $this->index = $index; $this->type = $type; } diff --git a/application/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php b/application/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php new file mode 100644 index 0000000..46a91ff --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php @@ -0,0 +1,86 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * Class FluentdFormatter + * + * Serializes a log message to Fluentd unix socket protocol + * + * Fluentd config: + * + * + * type unix + * path /var/run/td-agent/td-agent.sock + * + * + * Monolog setup: + * + * $logger = new Monolog\Logger('fluent.tag'); + * $fluentHandler = new Monolog\Handler\SocketHandler('unix:///var/run/td-agent/td-agent.sock'); + * $fluentHandler->setFormatter(new Monolog\Formatter\FluentdFormatter()); + * $logger->pushHandler($fluentHandler); + * + * @author Andrius Putna + */ +class FluentdFormatter implements FormatterInterface +{ + /** + * @var bool $levelTag should message level be a part of the fluentd tag + */ + protected $levelTag = false; + + public function __construct($levelTag = false) + { + if (!function_exists('json_encode')) { + throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s FluentdUnixFormatter'); + } + + $this->levelTag = (bool) $levelTag; + } + + public function isUsingLevelsInTag() + { + return $this->levelTag; + } + + public function format(array $record) + { + $tag = $record['channel']; + if ($this->levelTag) { + $tag .= '.' . strtolower($record['level_name']); + } + + $message = array( + 'message' => $record['message'], + 'context' => $record['context'], + 'extra' => $record['extra'], + ); + + if (!$this->levelTag) { + $message['level'] = $record['level']; + $message['level_name'] = $record['level_name']; + } + + return json_encode(array($tag, $record['datetime']->getTimestamp(), $message)); + } + + public function formatBatch(array $records) + { + $message = ''; + foreach ($records as $record) { + $message .= $this->format($record); + } + + return $message; + } +} diff --git a/application/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php b/application/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php index 1e43175..2c1b0e8 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php +++ b/application/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php @@ -22,6 +22,8 @@ */ class GelfMessageFormatter extends NormalizerFormatter { + const DEFAULT_MAX_LENGTH = 32766; + /** * @var string the name of the system for the Gelf log message */ @@ -37,6 +39,11 @@ class GelfMessageFormatter extends NormalizerFormatter */ protected $contextPrefix; + /** + * @var int max length per field + */ + protected $maxLength; + /** * Translates Monolog log levels to Graylog2 log priorities. */ @@ -51,7 +58,7 @@ class GelfMessageFormatter extends NormalizerFormatter Logger::EMERGENCY => 0, ); - public function __construct($systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_') + public function __construct($systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $maxLength = null) { parent::__construct('U.u'); @@ -59,6 +66,7 @@ public function __construct($systemName = null, $extraPrefix = null, $contextPre $this->extraPrefix = $extraPrefix; $this->contextPrefix = $contextPrefix; + $this->maxLength = is_null($maxLength) ? self::DEFAULT_MAX_LENGTH : $maxLength; } /** @@ -79,6 +87,13 @@ public function format(array $record) ->setHost($this->systemName) ->setLevel($this->logLevels[$record['level']]); + // message length + system name length + 200 for padding / metadata + $len = 200 + strlen((string) $record['message']) + strlen($this->systemName); + + if ($len > $this->maxLength) { + $message->setShortMessage(substr($record['message'], 0, $this->maxLength)); + } + if (isset($record['channel'])) { $message->setFacility($record['channel']); } @@ -92,11 +107,23 @@ public function format(array $record) } foreach ($record['extra'] as $key => $val) { - $message->setAdditional($this->extraPrefix . $key, is_scalar($val) ? $val : $this->toJson($val)); + $val = is_scalar($val) || null === $val ? $val : $this->toJson($val); + $len = strlen($this->extraPrefix . $key . $val); + if ($len > $this->maxLength) { + $message->setAdditional($this->extraPrefix . $key, substr($val, 0, $this->maxLength)); + break; + } + $message->setAdditional($this->extraPrefix . $key, $val); } foreach ($record['context'] as $key => $val) { - $message->setAdditional($this->contextPrefix . $key, is_scalar($val) ? $val : $this->toJson($val)); + $val = is_scalar($val) || null === $val ? $val : $this->toJson($val); + $len = strlen($this->contextPrefix . $key . $val); + if ($len > $this->maxLength) { + $message->setAdditional($this->contextPrefix . $key, substr($val, 0, $this->maxLength)); + break; + } + $message->setAdditional($this->contextPrefix . $key, $val); } if (null === $message->getFile() && isset($record['context']['exception']['file'])) { diff --git a/application/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php b/application/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php index 255d288..dfc0b4a 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php +++ b/application/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php @@ -24,7 +24,7 @@ class HtmlFormatter extends NormalizerFormatter /** * Translates Monolog log levels to html color priorities. */ - private $logLevels = array( + protected $logLevels = array( Logger::DEBUG => '#cccccc', Logger::INFO => '#468847', Logger::NOTICE => '#3a87ad', @@ -51,29 +51,30 @@ public function __construct($dateFormat = null) * @param bool $escapeTd false if td content must not be html escaped * @return string */ - private function addRow($th, $td = ' ', $escapeTd = true) + protected function addRow($th, $td = ' ', $escapeTd = true) { $th = htmlspecialchars($th, ENT_NOQUOTES, 'UTF-8'); if ($escapeTd) { $td = '
    '.htmlspecialchars($td, ENT_NOQUOTES, 'UTF-8').'
    '; } - return "\n$th:\n".$td."\n"; + return "\n$th:\n".$td."\n"; } /** * Create a HTML h1 tag * - * @param string $title Text to be in the h1 - * @param integer $level Error level + * @param string $title Text to be in the h1 + * @param int $level Error level * @return string */ - private function addTitle($title, $level) + protected function addTitle($title, $level) { $title = htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8'); return '

    '.$title.'

    '; } + /** * Formats a log record. * diff --git a/application/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php b/application/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php index e5a1d2c..2ff119e 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php +++ b/application/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php @@ -11,6 +11,10 @@ namespace Monolog\Formatter; +use Exception; +use Monolog\Utils; +use Throwable; + /** * Encodes whatever record data is passed to it as json * @@ -18,7 +22,7 @@ * * @author Jordi Boggiano */ -class JsonFormatter implements FormatterInterface +class JsonFormatter extends NormalizerFormatter { const BATCH_MODE_JSON = 1; const BATCH_MODE_NEWLINES = 2; @@ -26,8 +30,14 @@ class JsonFormatter implements FormatterInterface protected $batchMode; protected $appendNewline; + /** + * @var bool + */ + protected $includeStacktraces = false; + /** * @param int $batchMode + * @param bool $appendNewline */ public function __construct($batchMode = self::BATCH_MODE_JSON, $appendNewline = true) { @@ -64,7 +74,7 @@ public function isAppendingNewlines() */ public function format(array $record) { - return json_encode($record) . ($this->appendNewline ? "\n" : ''); + return $this->toJson($this->normalize($record), true) . ($this->appendNewline ? "\n" : ''); } /** @@ -82,6 +92,14 @@ public function formatBatch(array $records) } } + /** + * @param bool $include + */ + public function includeStacktraces($include = true) + { + $this->includeStacktraces = $include; + } + /** * Return a JSON-encoded array of records. * @@ -90,7 +108,7 @@ public function formatBatch(array $records) */ protected function formatBatchJson(array $records) { - return json_encode($records); + return $this->toJson($this->normalize($records), true); } /** @@ -113,4 +131,78 @@ protected function formatBatchNewlines(array $records) return implode("\n", $records); } + + /** + * Normalizes given $data. + * + * @param mixed $data + * + * @return mixed + */ + protected function normalize($data, $depth = 0) + { + if ($depth > 9) { + return 'Over 9 levels deep, aborting normalization'; + } + + if (is_array($data) || $data instanceof \Traversable) { + $normalized = array(); + + $count = 1; + foreach ($data as $key => $value) { + if ($count++ > 1000) { + $normalized['...'] = 'Over 1000 items ('.count($data).' total), aborting normalization'; + break; + } + + $normalized[$key] = $this->normalize($value, $depth+1); + } + + return $normalized; + } + + if ($data instanceof Exception || $data instanceof Throwable) { + return $this->normalizeException($data); + } + + return $data; + } + + /** + * Normalizes given exception with or without its own stack trace based on + * `includeStacktraces` property. + * + * @param Exception|Throwable $e + * + * @return array + */ + protected function normalizeException($e) + { + // TODO 2.0 only check for Throwable + if (!$e instanceof Exception && !$e instanceof Throwable) { + throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.Utils::getClass($e)); + } + + $data = array( + 'class' => Utils::getClass($e), + 'message' => $e->getMessage(), + 'code' => $e->getCode(), + 'file' => $e->getFile().':'.$e->getLine(), + ); + + if ($this->includeStacktraces) { + $trace = $e->getTrace(); + foreach ($trace as $frame) { + if (isset($frame['file'])) { + $data['trace'][] = $frame['file'].':'.$frame['line']; + } + } + } + + if ($previous = $e->getPrevious()) { + $data['previous'] = $this->normalizeException($previous); + } + + return $data; + } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php b/application/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php index 388e226..f98e1a6 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php +++ b/application/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php @@ -11,7 +11,7 @@ namespace Monolog\Formatter; -use Exception; +use Monolog\Utils; /** * Formats incoming records into a one-line string @@ -78,6 +78,14 @@ public function format(array $record) } } + + foreach ($vars['context'] as $var => $val) { + if (false !== strpos($output, '%context.'.$var.'%')) { + $output = str_replace('%context.'.$var.'%', $this->stringify($val), $output); + unset($vars['context'][$var]); + } + } + if ($this->ignoreEmptyContextAndExtra) { if (empty($vars['context'])) { unset($vars['context']); @@ -96,6 +104,11 @@ public function format(array $record) } } + // remove leftover %extra.xxx% and %context.xxx% if any + if (false !== strpos($output, '%')) { + $output = preg_replace('/%(?:extra|context)\..+?%/', '', $output); + } + return $output; } @@ -114,18 +127,23 @@ public function stringify($value) return $this->replaceNewlines($this->convertToString($value)); } - protected function normalizeException(Exception $e) + protected function normalizeException($e) { + // TODO 2.0 only check for Throwable + if (!$e instanceof \Exception && !$e instanceof \Throwable) { + throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.Utils::getClass($e)); + } + $previousText = ''; if ($previous = $e->getPrevious()) { do { - $previousText .= ', '.get_class($previous).'(code: '.$previous->getCode().'): '.$previous->getMessage().' at '.$previous->getFile().':'.$previous->getLine(); + $previousText .= ', '.Utils::getClass($previous).'(code: '.$previous->getCode().'): '.$previous->getMessage().' at '.$previous->getFile().':'.$previous->getLine(); } while ($previous = $previous->getPrevious()); } - $str = '[object] ('.get_class($e).'(code: '.$e->getCode().'): '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().$previousText.')'; + $str = '[object] ('.Utils::getClass($e).'(code: '.$e->getCode().'): '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().$previousText.')'; if ($this->includeStacktraces) { - $str .= "\n[stacktrace]\n".$e->getTraceAsString(); + $str .= "\n[stacktrace]\n".$e->getTraceAsString()."\n"; } return $str; @@ -151,6 +169,10 @@ protected function convertToString($data) protected function replaceNewlines($str) { if ($this->allowInlineLineBreaks) { + if (0 === strpos($str, '{')) { + return str_replace(array('\r', '\n'), array("\r", "\n"), $str); + } + return $str; } diff --git a/application/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php b/application/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php index f02bceb..401859b 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php +++ b/application/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php @@ -22,7 +22,7 @@ class LogglyFormatter extends JsonFormatter * Overrides the default batch mode to new lines for compatibility with the * Loggly bulk API. * - * @param integer $batchMode + * @param int $batchMode */ public function __construct($batchMode = self::BATCH_MODE_NEWLINES, $appendNewline = false) { diff --git a/application/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php b/application/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php index be21b2c..8f83bec 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php +++ b/application/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php @@ -45,16 +45,16 @@ class LogstashFormatter extends NormalizerFormatter protected $contextPrefix; /** - * @var integer logstash format version to use + * @var int logstash format version to use */ protected $version; /** - * @param string $applicationName the application that sends the data, used as the "type" field of logstash - * @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine - * @param string $extraPrefix prefix for extra keys inside logstash "fields" - * @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_ - * @param integer $version the logstash format version to use, defaults to 0 + * @param string $applicationName the application that sends the data, used as the "type" field of logstash + * @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine + * @param string $extraPrefix prefix for extra keys inside logstash "fields" + * @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_ + * @param int $version the logstash format version to use, defaults to 0 */ public function __construct($applicationName, $systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $version = self::V0) { @@ -92,7 +92,7 @@ protected function formatV0(array $record) $message = array( '@timestamp' => $record['datetime'], '@source' => $this->systemName, - '@fields' => array() + '@fields' => array(), ); if (isset($record['message'])) { $message['@message'] = $record['message']; diff --git a/application/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php b/application/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php index eb067bb..eb7be84 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php +++ b/application/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php @@ -11,6 +11,8 @@ namespace Monolog\Formatter; +use Monolog\Utils; + /** * Formats a record for use with the MongoDBHandler. * @@ -75,7 +77,7 @@ protected function formatArray(array $record, $nestingLevel = 0) protected function formatObject($value, $nestingLevel) { $objectVars = get_object_vars($value); - $objectVars['class'] = get_class($value); + $objectVars['class'] = Utils::getClass($value); return $this->formatArray($objectVars, $nestingLevel); } @@ -83,7 +85,7 @@ protected function formatObject($value, $nestingLevel) protected function formatException(\Exception $exception, $nestingLevel) { $formattedException = array( - 'class' => get_class($exception), + 'class' => Utils::getClass($exception), 'message' => $exception->getMessage(), 'code' => $exception->getCode(), 'file' => $exception->getFile() . ':' . $exception->getLine(), diff --git a/application/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php b/application/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php index 0361935..9865394 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php +++ b/application/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php @@ -12,6 +12,7 @@ namespace Monolog\Formatter; use Exception; +use Monolog\Utils; /** * Normalizes incoming records to remove objects/resources so it's easier to dump to various targets @@ -55,8 +56,12 @@ public function formatBatch(array $records) return $records; } - protected function normalize($data) + protected function normalize($data, $depth = 0) { + if ($depth > 9) { + return 'Over 9 levels deep, aborting normalization'; + } + if (null === $data || is_scalar($data)) { if (is_float($data)) { if (is_infinite($data)) { @@ -70,16 +75,17 @@ protected function normalize($data) return $data; } - if (is_array($data) || $data instanceof \Traversable) { + if (is_array($data)) { $normalized = array(); $count = 1; foreach ($data as $key => $value) { - if ($count++ >= 1000) { - $normalized['...'] = 'Over 1000 items, aborting normalization'; + if ($count++ > 1000) { + $normalized['...'] = 'Over 1000 items ('.count($data).' total), aborting normalization'; break; } - $normalized[$key] = $this->normalize($value); + + $normalized[$key] = $this->normalize($value, $depth+1); } return $normalized; @@ -90,19 +96,20 @@ protected function normalize($data) } if (is_object($data)) { - if ($data instanceof Exception) { + // TODO 2.0 only check for Throwable + if ($data instanceof Exception || (PHP_VERSION_ID > 70000 && $data instanceof \Throwable)) { return $this->normalizeException($data); } // non-serializable objects that implement __toString stringified if (method_exists($data, '__toString') && !$data instanceof \JsonSerializable) { - $value = (string) $data; + $value = $data->__toString(); } else { // the rest is json-serialized in some way $value = $this->toJson($data, true); } - return sprintf("[object] (%s: %s)", get_class($data), $value); + return sprintf("[object] (%s: %s)", Utils::getClass($data), $value); } if (is_resource($data)) { @@ -112,22 +119,38 @@ protected function normalize($data) return '[unknown('.gettype($data).')]'; } - protected function normalizeException(Exception $e) + protected function normalizeException($e) { + // TODO 2.0 only check for Throwable + if (!$e instanceof Exception && !$e instanceof \Throwable) { + throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.Utils::getClass($e)); + } + $data = array( - 'class' => get_class($e), + 'class' => Utils::getClass($e), 'message' => $e->getMessage(), 'code' => $e->getCode(), 'file' => $e->getFile().':'.$e->getLine(), ); + if ($e instanceof \SoapFault) { + if (isset($e->faultcode)) { + $data['faultcode'] = $e->faultcode; + } + + if (isset($e->faultactor)) { + $data['faultactor'] = $e->faultactor; + } + + if (isset($e->detail)) { + $data['detail'] = $e->detail; + } + } + $trace = $e->getTrace(); foreach ($trace as $frame) { if (isset($frame['file'])) { $data['trace'][] = $frame['file'].':'.$frame['line']; - } else { - // We should again normalize the frames, because it might contain invalid items - $data['trace'][] = $this->toJson($this->normalize($frame), true); } } @@ -138,23 +161,72 @@ protected function normalizeException(Exception $e) return $data; } + /** + * Return the JSON representation of a value + * + * @param mixed $data + * @param bool $ignoreErrors + * @throws \RuntimeException if encoding fails and errors are not ignored + * @return string + */ protected function toJson($data, $ignoreErrors = false) { // suppress json_encode errors since it's twitchy with some inputs if ($ignoreErrors) { - if (version_compare(PHP_VERSION, '5.4.0', '>=')) { - return @json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); - } + return @$this->jsonEncode($data); + } - return @json_encode($data); + $json = $this->jsonEncode($data); + + if ($json === false) { + $json = $this->handleJsonError(json_last_error(), $data); } + return $json; + } + + /** + * @param mixed $data + * @return string JSON encoded data or null on failure + */ + private function jsonEncode($data) + { if (version_compare(PHP_VERSION, '5.4.0', '>=')) { - $json = json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); + return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); + } + + return json_encode($data); + } + + /** + * Handle a json_encode failure. + * + * If the failure is due to invalid string encoding, try to clean the + * input and encode again. If the second encoding attempt fails, the + * inital error is not encoding related or the input can't be cleaned then + * raise a descriptive exception. + * + * @param int $code return code of json_last_error function + * @param mixed $data data that was meant to be encoded + * @throws \RuntimeException if failure can't be corrected + * @return string JSON encoded data after error correction + */ + private function handleJsonError($code, $data) + { + if ($code !== JSON_ERROR_UTF8) { + $this->throwEncodeError($code, $data); + } + + if (is_string($data)) { + $this->detectAndCleanUtf8($data); + } elseif (is_array($data)) { + array_walk_recursive($data, array($this, 'detectAndCleanUtf8')); } else { - $json = json_encode($data); + $this->throwEncodeError($code, $data); } + $json = $this->jsonEncode($data); + if ($json === false) { $this->throwEncodeError(json_last_error(), $data); } @@ -165,8 +237,8 @@ protected function toJson($data, $ignoreErrors = false) /** * Throws an exception according to a given code with a customized message * - * @param int $code return code of json_last_error function - * @param mixed $data data that was meant to be encoded + * @param int $code return code of json_last_error function + * @param mixed $data data that was meant to be encoded * @throws \RuntimeException */ private function throwEncodeError($code, $data) @@ -190,4 +262,36 @@ private function throwEncodeError($code, $data) throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true)); } + + /** + * Detect invalid UTF-8 string characters and convert to valid UTF-8. + * + * Valid UTF-8 input will be left unmodified, but strings containing + * invalid UTF-8 codepoints will be reencoded as UTF-8 with an assumed + * original encoding of ISO-8859-15. This conversion may result in + * incorrect output if the actual encoding was not ISO-8859-15, but it + * will be clean UTF-8 output and will not rely on expensive and fragile + * detection algorithms. + * + * Function converts the input in place in the passed variable so that it + * can be used as a callback for array_walk_recursive. + * + * @param mixed &$data Input to check and convert if needed + * @private + */ + public function detectAndCleanUtf8(&$data) + { + if (is_string($data) && !preg_match('//u', $data)) { + $data = preg_replace_callback( + '/[\x80-\xFF]+/', + function ($m) { return utf8_encode($m[0]); }, + $data + ); + $data = str_replace( + array('¤', '¦', '¨', '´', '¸', '¼', '½', '¾'), + array('€', 'Š', 'š', 'Ž', 'ž', 'Œ', 'œ', 'Ÿ'), + $data + ); + } + } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php b/application/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php index 654710a..65dba99 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php +++ b/application/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php @@ -102,12 +102,12 @@ public function formatBatch(array $records) throw new \BadMethodCallException('Batch formatting does not make sense for the WildfireFormatter'); } - protected function normalize($data) + protected function normalize($data, $depth = 0) { if (is_object($data) && !$data instanceof \DateTime) { return $data; } - return parent::normalize($data); + return parent::normalize($data, $depth); } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php index 69ede49..92b9d45 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php @@ -11,16 +11,17 @@ namespace Monolog\Handler; -use Monolog\Logger; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LineFormatter; +use Monolog\Logger; +use Monolog\ResettableInterface; /** * Base Handler class providing the Handler structure * * @author Jordi Boggiano */ -abstract class AbstractHandler implements HandlerInterface +abstract class AbstractHandler implements HandlerInterface, ResettableInterface { protected $level = Logger::DEBUG; protected $bubble = true; @@ -32,8 +33,8 @@ abstract class AbstractHandler implements HandlerInterface protected $processors = array(); /** - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($level = Logger::DEBUG, $bubble = true) { @@ -118,7 +119,7 @@ public function getFormatter() /** * Sets minimum logging level at which this handler will be triggered. * - * @param integer $level + * @param int|string $level Level or level name * @return self */ public function setLevel($level) @@ -131,7 +132,7 @@ public function setLevel($level) /** * Gets minimum logging level at which this handler will be triggered. * - * @return integer + * @return int */ public function getLevel() { @@ -141,8 +142,8 @@ public function getLevel() /** * Sets the bubbling behavior. * - * @param Boolean $bubble true means that this handler allows bubbling. - * false means that bubbling is not permitted. + * @param bool $bubble true means that this handler allows bubbling. + * false means that bubbling is not permitted. * @return self */ public function setBubble($bubble) @@ -155,8 +156,8 @@ public function setBubble($bubble) /** * Gets the bubbling behavior. * - * @return Boolean true means that this handler allows bubbling. - * false means that bubbling is not permitted. + * @return bool true means that this handler allows bubbling. + * false means that bubbling is not permitted. */ public function getBubble() { @@ -169,6 +170,17 @@ public function __destruct() $this->close(); } catch (\Exception $e) { // do nothing + } catch (\Throwable $e) { + // do nothing + } + } + + public function reset() + { + foreach ($this->processors as $processor) { + if ($processor instanceof ResettableInterface) { + $processor->reset(); + } } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php index 6f18f72..e1e8953 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php @@ -11,6 +11,8 @@ namespace Monolog\Handler; +use Monolog\ResettableInterface; + /** * Base Handler class providing the Handler structure * diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php index 3eb83bd..8c76aca 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php @@ -53,9 +53,9 @@ abstract class AbstractSyslogHandler extends AbstractProcessingHandler ); /** - * @param mixed $facility - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param mixed $facility + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($facility = LOG_USER, $level = Logger::DEBUG, $bubble = true) { @@ -70,6 +70,15 @@ public function __construct($facility = LOG_USER, $level = Logger::DEBUG, $bubbl $this->facilities['local5'] = LOG_LOCAL5; $this->facilities['local6'] = LOG_LOCAL6; $this->facilities['local7'] = LOG_LOCAL7; + } else { + $this->facilities['local0'] = 128; // LOG_LOCAL0 + $this->facilities['local1'] = 136; // LOG_LOCAL1 + $this->facilities['local2'] = 144; // LOG_LOCAL2 + $this->facilities['local3'] = 152; // LOG_LOCAL3 + $this->facilities['local4'] = 160; // LOG_LOCAL4 + $this->facilities['local5'] = 168; // LOG_LOCAL5 + $this->facilities['local6'] = 176; // LOG_LOCAL6 + $this->facilities['local7'] = 184; // LOG_LOCAL7 } // convert textual description of facility to syslog constant diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php index a28ba02..e5a46bc 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php @@ -55,39 +55,89 @@ public function __construct($exchange, $exchangeName = 'log', $level = Logger::D protected function write(array $record) { $data = $record["formatted"]; - - $routingKey = sprintf( - '%s.%s', - // TODO 2.0 remove substr call - substr($record['level_name'], 0, 4), - $record['channel'] - ); + $routingKey = $this->getRoutingKey($record); if ($this->exchange instanceof AMQPExchange) { $this->exchange->publish( $data, - strtolower($routingKey), + $routingKey, 0, array( 'delivery_mode' => 2, - 'Content-type' => 'application/json' + 'content_type' => 'application/json', ) ); } else { $this->exchange->basic_publish( - new AMQPMessage( - (string) $data, - array( - 'delivery_mode' => 2, - 'content_type' => 'application/json' - ) - ), + $this->createAmqpMessage($data), $this->exchangeName, - strtolower($routingKey) + $routingKey ); } } + /** + * {@inheritDoc} + */ + public function handleBatch(array $records) + { + if ($this->exchange instanceof AMQPExchange) { + parent::handleBatch($records); + + return; + } + + foreach ($records as $record) { + if (!$this->isHandling($record)) { + continue; + } + + $record = $this->processRecord($record); + $data = $this->getFormatter()->format($record); + + $this->exchange->batch_basic_publish( + $this->createAmqpMessage($data), + $this->exchangeName, + $this->getRoutingKey($record) + ); + } + + $this->exchange->publish_batch(); + } + + /** + * Gets the routing key for the AMQP exchange + * + * @param array $record + * @return string + */ + protected function getRoutingKey(array $record) + { + $routingKey = sprintf( + '%s.%s', + // TODO 2.0 remove substr call + substr($record['level_name'], 0, 4), + $record['channel'] + ); + + return strtolower($routingKey); + } + + /** + * @param string $data + * @return AMQPMessage + */ + private function createAmqpMessage($data) + { + return new AMQPMessage( + (string) $data, + array( + 'delivery_mode' => 2, + 'content_type' => 'application/json', + ) + ); + } + /** * {@inheritDoc} */ diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php index a409952..23cf23b 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php @@ -31,7 +31,6 @@ class BrowserConsoleHandler extends AbstractProcessingHandler * Example of formatted string: * * You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white} - * */ protected function getDefaultFormatter() { @@ -44,12 +43,12 @@ protected function getDefaultFormatter() protected function write(array $record) { // Accumulate records - self::$records[] = $record; + static::$records[] = $record; // Register shutdown handler if not already done - if (PHP_SAPI !== 'cli' && !self::$initialized) { - self::$initialized = true; - register_shutdown_function(array('Monolog\Handler\BrowserConsoleHandler', 'send')); + if (!static::$initialized) { + static::$initialized = true; + $this->registerShutdownFunction(); } } @@ -59,54 +58,103 @@ protected function write(array $record) */ public static function send() { - $htmlTags = true; + $format = static::getResponseFormat(); + if ($format === 'unknown') { + return; + } + + if (count(static::$records)) { + if ($format === 'html') { + static::writeOutput(''); + } elseif ($format === 'js') { + static::writeOutput(static::generateScript()); + } + static::resetStatic(); + } + } + + public function close() + { + self::resetStatic(); + } + + public function reset() + { + self::resetStatic(); + } + + /** + * Forget all logged records + */ + public static function resetStatic() + { + static::$records = array(); + } + + /** + * Wrapper for register_shutdown_function to allow overriding + */ + protected function registerShutdownFunction() + { + if (PHP_SAPI !== 'cli') { + register_shutdown_function(array('Monolog\Handler\BrowserConsoleHandler', 'send')); + } + } + + /** + * Wrapper for echo to allow overriding + * + * @param string $str + */ + protected static function writeOutput($str) + { + echo $str; + } + + /** + * Checks the format of the response + * + * If Content-Type is set to application/javascript or text/javascript -> js + * If Content-Type is set to text/html, or is unset -> html + * If Content-Type is anything else -> unknown + * + * @return string One of 'js', 'html' or 'unknown' + */ + protected static function getResponseFormat() + { // Check content type foreach (headers_list() as $header) { if (stripos($header, 'content-type:') === 0) { // This handler only works with HTML and javascript outputs // text/javascript is obsolete in favour of application/javascript, but still used if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) { - $htmlTags = false; - } elseif (stripos($header, 'text/html') === false) { - return; + return 'js'; + } + if (stripos($header, 'text/html') === false) { + return 'unknown'; } break; } } - if (count(self::$records)) { - if ($htmlTags) { - echo ''; - } else { - echo self::generateScript(); - } - self::reset(); - } - } - - /** - * Forget all logged records - */ - public static function reset() - { - self::$records = array(); + return 'html'; } private static function generateScript() { $script = array(); - foreach (self::$records as $record) { - $context = self::dump('Context', $record['context']); - $extra = self::dump('Extra', $record['extra']); + foreach (static::$records as $record) { + $context = static::dump('Context', $record['context']); + $extra = static::dump('Extra', $record['extra']); if (empty($context) && empty($extra)) { - $script[] = self::call_array('log', self::handleStyles($record['formatted'])); + $script[] = static::call_array('log', static::handleStyles($record['formatted'])); } else { $script = array_merge($script, - array(self::call_array('groupCollapsed', self::handleStyles($record['formatted']))), + array(static::call_array('groupCollapsed', static::handleStyles($record['formatted']))), $context, $extra, - array(self::call('groupEnd')) + array(static::call('groupEnd')) ); } } @@ -116,19 +164,19 @@ private static function generateScript() private static function handleStyles($formatted) { - $args = array(self::quote('font-weight: normal')); + $args = array(static::quote('font-weight: normal')); $format = '%c' . $formatted; preg_match_all('/\[\[(.*?)\]\]\{([^}]*)\}/s', $format, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); foreach (array_reverse($matches) as $match) { - $args[] = self::quote(self::handleCustomStyles($match[2][0], $match[1][0])); + $args[] = static::quote(static::handleCustomStyles($match[2][0], $match[1][0])); $args[] = '"font-weight: normal"'; $pos = $match[0][1]; $format = substr($format, 0, $pos) . '%c' . $match[1][0] . '%c' . substr($format, $pos + strlen($match[0][0])); } - array_unshift($args, self::quote($format)); + array_unshift($args, static::quote($format)); return $args; } @@ -160,13 +208,13 @@ private static function dump($title, array $dict) if (empty($dict)) { return $script; } - $script[] = self::call('log', self::quote('%c%s'), self::quote('font-weight: bold'), self::quote($title)); + $script[] = static::call('log', static::quote('%c%s'), static::quote('font-weight: bold'), static::quote($title)); foreach ($dict as $key => $value) { $value = json_encode($value); if (empty($value)) { - $value = self::quote(''); + $value = static::quote(''); } - $script[] = self::call('log', self::quote('%s: %o'), self::quote($key), $value); + $script[] = static::call('log', static::quote('%s: %o'), static::quote($key), $value); } return $script; @@ -182,7 +230,7 @@ private static function call() $args = func_get_args(); $method = array_shift($args); - return self::call_array($method, $args); + return static::call_array($method, $args); } private static function call_array($method, array $args) diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php index 6d8136f..61d1b50 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php @@ -12,6 +12,7 @@ namespace Monolog\Handler; use Monolog\Logger; +use Monolog\ResettableInterface; /** * Buffers all records until closing the handler and then pass them as batch. @@ -32,10 +33,10 @@ class BufferHandler extends AbstractHandler /** * @param HandlerInterface $handler Handler. - * @param integer $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param Boolean $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded + * @param int $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded */ public function __construct(HandlerInterface $handler, $bufferLimit = 0, $level = Logger::DEBUG, $bubble = true, $flushOnOverflow = false) { @@ -114,4 +115,15 @@ public function clear() $this->bufferSize = 0; $this->buffer = array(); } + + public function reset() + { + $this->flush(); + + parent::reset(); + + if ($this->handler instanceof ResettableInterface) { + $this->handler->reset(); + } + } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php index b3f2963..ac98d5d 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php @@ -17,6 +17,8 @@ /** * Handler sending logs to the ChromePHP extension (http://www.chromephp.com/) * + * This also works out of the box with Firefox 43+ + * * @author Christophe Coevoet */ class ChromePHPHandler extends AbstractProcessingHandler @@ -31,14 +33,19 @@ class ChromePHPHandler extends AbstractProcessingHandler */ const HEADER_NAME = 'X-ChromeLogger-Data'; + /** + * Regular expression to detect supported browsers (matches any Chrome, or Firefox 43+) + */ + const USER_AGENT_REGEX = '{\b(?:Chrome/\d+(?:\.\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}'; + protected static $initialized = false; /** * Tracks whether we sent too much data * - * Chrome limits the headers to 256KB, so when we sent 240KB we stop sending + * Chrome limits the headers to 4KB, so when we sent 3KB we stop sending * - * @var Boolean + * @var bool */ protected static $overflowed = false; @@ -51,8 +58,8 @@ class ChromePHPHandler extends AbstractProcessingHandler protected static $sendHeaders = true; /** - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($level = Logger::DEBUG, $bubble = true) { @@ -129,7 +136,7 @@ protected function send() $json = @json_encode(self::$json); $data = base64_encode(utf8_encode($json)); - if (strlen($data) > 240 * 1024) { + if (strlen($data) > 3 * 1024) { self::$overflowed = true; $record = array( @@ -167,7 +174,7 @@ protected function sendHeader($header, $content) /** * Verifies if the headers are accepted by the current user agent * - * @return Boolean + * @return bool */ protected function headersAccepted() { @@ -175,7 +182,7 @@ protected function headersAccepted() return false; } - return preg_match('{\bChrome/\d+[\.\d+]*\b}', $_SERVER['HTTP_USER_AGENT']); + return preg_match(self::USER_AGENT_REGEX, $_SERVER['HTTP_USER_AGENT']); } /** diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php index b3687c3..cc98697 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php @@ -54,7 +54,7 @@ protected function write(array $record) 'ignore_errors' => true, 'max_redirects' => 0, 'header' => 'Content-type: application/json', - ) + ), )); if (false === @file_get_contents($url, null, $context)) { diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php index e7dd854..96b3ca0 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php @@ -21,37 +21,37 @@ */ class CubeHandler extends AbstractProcessingHandler { - private $udpConnection = null; - private $httpConnection = null; - private $scheme = null; - private $host = null; - private $port = null; + private $udpConnection; + private $httpConnection; + private $scheme; + private $host; + private $port; private $acceptedSchemes = array('http', 'udp'); /** * Create a Cube handler * * @throws \UnexpectedValueException when given url is not a valid url. - * A valid url must consists of three parts : protocol://host:port - * Only valid protocol used by Cube are http and udp + * A valid url must consist of three parts : protocol://host:port + * Only valid protocols used by Cube are http and udp */ public function __construct($url, $level = Logger::DEBUG, $bubble = true) { - $urlInfos = parse_url($url); + $urlInfo = parse_url($url); - if (!isset($urlInfos['scheme']) || !isset($urlInfos['host']) || !isset($urlInfos['port'])) { + if (!isset($urlInfo['scheme'], $urlInfo['host'], $urlInfo['port'])) { throw new \UnexpectedValueException('URL "'.$url.'" is not valid'); } - if (!in_array($urlInfos['scheme'], $this->acceptedSchemes)) { + if (!in_array($urlInfo['scheme'], $this->acceptedSchemes)) { throw new \UnexpectedValueException( - 'Invalid protocol (' . $urlInfos['scheme'] . ').' + 'Invalid protocol (' . $urlInfo['scheme'] . ').' . ' Valid options are ' . implode(', ', $this->acceptedSchemes)); } - $this->scheme = $urlInfos['scheme']; - $this->host = $urlInfos['host']; - $this->port = $urlInfos['port']; + $this->scheme = $urlInfo['scheme']; + $this->host = $urlInfo['host']; + $this->port = $urlInfo['port']; parent::__construct($level, $bubble); } @@ -59,7 +59,8 @@ public function __construct($url, $level = Logger::DEBUG, $bubble = true) /** * Establish a connection to an UDP socket * - * @throws \LogicException when unable to connect to the socket + * @throws \LogicException when unable to connect to the socket + * @throws MissingExtensionException when there is no socket extension */ protected function connectUdp() { @@ -79,6 +80,7 @@ protected function connectUdp() /** * Establish a connection to a http server + * @throws \LogicException when no curl extension */ protected function connectHttp() { @@ -140,10 +142,10 @@ private function writeHttp($data) curl_setopt($this->httpConnection, CURLOPT_POSTFIELDS, '['.$data.']'); curl_setopt($this->httpConnection, CURLOPT_HTTPHEADER, array( - 'Content-Type: application/json', - 'Content-Length: ' . strlen('['.$data.']')) - ); + 'Content-Type: application/json', + 'Content-Length: ' . strlen('['.$data.']'), + )); - Curl\Util::execute($ch, 5, false); + Curl\Util::execute($this->httpConnection, 5, false); } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php b/application/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php index adbe4f4..48d30b3 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php @@ -26,7 +26,7 @@ class Util /** * Executes a CURL request with optional retries and exception on failure * - * @param resource $ch curl handler + * @param resource $ch curl handler * @throws \RuntimeException */ public static function execute($ch, $retries = 5, $closeAfterDone = true) diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php new file mode 100644 index 0000000..35b55cb --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php @@ -0,0 +1,169 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Simple handler wrapper that deduplicates log records across multiple requests + * + * It also includes the BufferHandler functionality and will buffer + * all messages until the end of the request or flush() is called. + * + * This works by storing all log records' messages above $deduplicationLevel + * to the file specified by $deduplicationStore. When further logs come in at the end of the + * request (or when flush() is called), all those above $deduplicationLevel are checked + * against the existing stored logs. If they match and the timestamps in the stored log is + * not older than $time seconds, the new log record is discarded. If no log record is new, the + * whole data set is discarded. + * + * This is mainly useful in combination with Mail handlers or things like Slack or HipChat handlers + * that send messages to people, to avoid spamming with the same message over and over in case of + * a major component failure like a database server being down which makes all requests fail in the + * same way. + * + * @author Jordi Boggiano + */ +class DeduplicationHandler extends BufferHandler +{ + /** + * @var string + */ + protected $deduplicationStore; + + /** + * @var int + */ + protected $deduplicationLevel; + + /** + * @var int + */ + protected $time; + + /** + * @var bool + */ + private $gc = false; + + /** + * @param HandlerInterface $handler Handler. + * @param string $deduplicationStore The file/path where the deduplication log should be kept + * @param int $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes + * @param int $time The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct(HandlerInterface $handler, $deduplicationStore = null, $deduplicationLevel = Logger::ERROR, $time = 60, $bubble = true) + { + parent::__construct($handler, 0, Logger::DEBUG, $bubble, false); + + $this->deduplicationStore = $deduplicationStore === null ? sys_get_temp_dir() . '/monolog-dedup-' . substr(md5(__FILE__), 0, 20) .'.log' : $deduplicationStore; + $this->deduplicationLevel = Logger::toMonologLevel($deduplicationLevel); + $this->time = $time; + } + + public function flush() + { + if ($this->bufferSize === 0) { + return; + } + + $passthru = null; + + foreach ($this->buffer as $record) { + if ($record['level'] >= $this->deduplicationLevel) { + + $passthru = $passthru || !$this->isDuplicate($record); + if ($passthru) { + $this->appendRecord($record); + } + } + } + + // default of null is valid as well as if no record matches duplicationLevel we just pass through + if ($passthru === true || $passthru === null) { + $this->handler->handleBatch($this->buffer); + } + + $this->clear(); + + if ($this->gc) { + $this->collectLogs(); + } + } + + private function isDuplicate(array $record) + { + if (!file_exists($this->deduplicationStore)) { + return false; + } + + $store = file($this->deduplicationStore, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + if (!is_array($store)) { + return false; + } + + $yesterday = time() - 86400; + $timestampValidity = $record['datetime']->getTimestamp() - $this->time; + $expectedMessage = preg_replace('{[\r\n].*}', '', $record['message']); + + for ($i = count($store) - 1; $i >= 0; $i--) { + list($timestamp, $level, $message) = explode(':', $store[$i], 3); + + if ($level === $record['level_name'] && $message === $expectedMessage && $timestamp > $timestampValidity) { + return true; + } + + if ($timestamp < $yesterday) { + $this->gc = true; + } + } + + return false; + } + + private function collectLogs() + { + if (!file_exists($this->deduplicationStore)) { + return false; + } + + $handle = fopen($this->deduplicationStore, 'rw+'); + flock($handle, LOCK_EX); + $validLogs = array(); + + $timestampValidity = time() - $this->time; + + while (!feof($handle)) { + $log = fgets($handle); + if (substr($log, 0, 10) >= $timestampValidity) { + $validLogs[] = $log; + } + } + + ftruncate($handle, 0); + rewind($handle); + foreach ($validLogs as $log) { + fwrite($handle, $log); + } + + flock($handle, LOCK_UN); + fclose($handle); + + $this->gc = false; + } + + private function appendRecord(array $record) + { + file_put_contents($this->deduplicationStore, $record['datetime']->getTimestamp() . ':' . $record['level_name'] . ':' . preg_replace('{[\r\n].*}', '', $record['message']) . "\n", FILE_APPEND); + } +} diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php index e7f843c..237b71f 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php @@ -11,8 +11,9 @@ namespace Monolog\Handler; -use Aws\Common\Aws; +use Aws\Sdk; use Aws\DynamoDb\DynamoDbClient; +use Aws\DynamoDb\Marshaler; use Monolog\Formatter\ScalarFormatter; use Monolog\Logger; @@ -36,16 +37,29 @@ class DynamoDbHandler extends AbstractProcessingHandler */ protected $table; + /** + * @var int + */ + protected $version; + + /** + * @var Marshaler + */ + protected $marshaler; + /** * @param DynamoDbClient $client * @param string $table - * @param integer $level - * @param boolean $bubble + * @param int $level + * @param bool $bubble */ public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true) { - if (!defined('Aws\Common\Aws::VERSION') || version_compare('3.0', Aws::VERSION, '<=')) { - throw new \RuntimeException('The DynamoDbHandler is only known to work with the AWS SDK 2.x releases'); + if (defined('Aws\Sdk::VERSION') && version_compare(Sdk::VERSION, '3.0', '>=')) { + $this->version = 3; + $this->marshaler = new Marshaler; + } else { + $this->version = 2; } $this->client = $client; @@ -60,11 +74,15 @@ public function __construct(DynamoDbClient $client, $table, $level = Logger::DEB protected function write(array $record) { $filtered = $this->filterEmptyFields($record['formatted']); - $formatted = $this->client->formatAttributes($filtered); + if ($this->version === 3) { + $formatted = $this->marshaler->marshalItem($filtered); + } else { + $formatted = $this->client->formatAttributes($filtered); + } $this->client->putItem(array( 'TableName' => $this->table, - 'Item' => $formatted + 'Item' => $formatted, )); } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php index 96e5d57..bb0f83e 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php @@ -46,10 +46,10 @@ class ElasticSearchHandler extends AbstractProcessingHandler protected $options = array(); /** - * @param Client $client Elastica Client object - * @param array $options Handler configuration - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param Client $client Elastica Client object + * @param array $options Handler configuration + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(Client $client, array $options = array(), $level = Logger::DEBUG, $bubble = true) { diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php index d1e1ee6..b2986b0 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php @@ -28,10 +28,10 @@ class ErrorLogHandler extends AbstractProcessingHandler protected $expandNewlines; /** - * @param integer $messageType Says where the error should go. - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param Boolean $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries + * @param int $messageType Says where the error should go. + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries */ public function __construct($messageType = self::OPERATING_SYSTEM, $level = Logger::DEBUG, $bubble = true, $expandNewlines = false) { diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php index dad8227..938c1a7 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php @@ -31,7 +31,7 @@ class FilterHandler extends AbstractHandler protected $handler; /** - * Minimum level for logs that are passes to handler + * Minimum level for logs that are passed to handler * * @var int[] */ @@ -40,7 +40,7 @@ class FilterHandler extends AbstractHandler /** * Whether the messages that are handled can bubble up the stack or not * - * @var Boolean + * @var bool */ protected $bubble; @@ -48,7 +48,7 @@ class FilterHandler extends AbstractHandler * @param callable|HandlerInterface $handler Handler or factory callable($record, $this). * @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided * @param int $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($handler, $minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY, $bubble = true) { @@ -70,8 +70,8 @@ public function getAcceptedLevels() } /** - * @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided - * @param int $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array + * @param int|string|array $minLevelOrList A list of levels to accept or a minimum level or level name if maxLevel is provided + * @param int|string $maxLevel Maximum level or level name to accept, only used if $minLevelOrList is not an array */ public function setAcceptedLevels($minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY) { diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php b/application/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php index c3e42ef..aaca12c 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php @@ -22,7 +22,7 @@ interface ActivationStrategyInterface * Returns whether the given record activates the handler. * * @param array $record - * @return Boolean + * @return bool */ public function isHandlerActivated(array $record); } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php b/application/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php index e3b403f..2a2a64d 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php @@ -2,12 +2,12 @@ /* * This file is part of the Monolog package. -* -* (c) Jordi Boggiano -* -* For the full copyright and license information, please view the LICENSE -* file that was distributed with this source code. -*/ + * + * (c) Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Monolog\Handler\FingersCrossed; diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php index 30a85dd..275fd51 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php @@ -14,6 +14,7 @@ use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy; use Monolog\Handler\FingersCrossed\ActivationStrategyInterface; use Monolog\Logger; +use Monolog\ResettableInterface; /** * Buffers all records until a certain level is reached @@ -41,8 +42,8 @@ class FingersCrossedHandler extends AbstractHandler * @param callable|HandlerInterface $handler Handler or factory callable($record, $fingersCrossedHandler). * @param int|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action * @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param Boolean $stopBuffering Whether the handler should stop buffering after being triggered (default true) + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $stopBuffering Whether the handler should stop buffering after being triggered (default true) * @param int $passthruLevel Minimum level to always flush to handler on close, even if strategy not triggered */ public function __construct($handler, $activationStrategy = null, $bufferSize = 0, $bubble = true, $stopBuffering = true, $passthruLevel = null) @@ -79,6 +80,26 @@ public function isHandling(array $record) return true; } + /** + * Manually activate this logger regardless of the activation strategy + */ + public function activate() + { + if ($this->stopBuffering) { + $this->buffering = false; + } + if (!$this->handler instanceof HandlerInterface) { + $record = end($this->buffer) ?: null; + + $this->handler = call_user_func($this->handler, $record, $this); + if (!$this->handler instanceof HandlerInterface) { + throw new \RuntimeException("The factory callable should return a HandlerInterface"); + } + } + $this->handler->handleBatch($this->buffer); + $this->buffer = array(); + } + /** * {@inheritdoc} */ @@ -96,17 +117,7 @@ public function handle(array $record) array_shift($this->buffer); } if ($this->activationStrategy->isHandlerActivated($record)) { - if ($this->stopBuffering) { - $this->buffering = false; - } - if (!$this->handler instanceof HandlerInterface) { - $this->handler = call_user_func($this->handler, $record, $this); - if (!$this->handler instanceof HandlerInterface) { - throw new \RuntimeException("The factory callable should return a HandlerInterface"); - } - } - $this->handler->handleBatch($this->buffer); - $this->buffer = array(); + $this->activate(); } } else { $this->handler->handle($record); @@ -120,24 +131,18 @@ public function handle(array $record) */ public function close() { - if (null !== $this->passthruLevel) { - $level = $this->passthruLevel; - $this->buffer = array_filter($this->buffer, function ($record) use ($level) { - return $record['level'] >= $level; - }); - if (count($this->buffer) > 0) { - $this->handler->handleBatch($this->buffer); - $this->buffer = array(); - } - } + $this->flushBuffer(); } - /** - * Resets the state of the handler. Stops forwarding records to the wrapped handler. - */ public function reset() { - $this->buffering = true; + $this->flushBuffer(); + + parent::reset(); + + if ($this->handler instanceof ResettableInterface) { + $this->handler->reset(); + } } /** @@ -150,4 +155,23 @@ public function clear() $this->buffer = array(); $this->reset(); } + + /** + * Resets the state of the handler. Stops forwarding records to the wrapped handler. + */ + private function flushBuffer() + { + if (null !== $this->passthruLevel) { + $level = $this->passthruLevel; + $this->buffer = array_filter($this->buffer, function ($record) use ($level) { + return $record['level'] >= $level; + }); + if (count($this->buffer) > 0) { + $this->handler->handleBatch($this->buffer); + } + } + + $this->buffer = array(); + $this->buffering = true; + } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php index fee4795..c30b184 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php @@ -158,7 +158,7 @@ protected function write(array $record) /** * Verifies if the headers are accepted by the current user agent * - * @return Boolean + * @return bool */ protected function headersAccepted() { diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php index 388692c..c43c013 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php @@ -118,7 +118,7 @@ private function buildHeader($content) private function buildContent($record) { $dataArray = array( - 'message' => $record['formatted'] + 'message' => $record['formatted'], ); return http_build_query($dataArray); diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php b/application/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php new file mode 100644 index 0000000..3e2f1b2 --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; + +/** + * Interface to describe loggers that have a formatter + * + * This interface is present in monolog 1.x to ease forward compatibility. + * + * @author Jordi Boggiano + */ +interface FormattableHandlerInterface +{ + /** + * Sets the formatter. + * + * @param FormatterInterface $formatter + * @return HandlerInterface self + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface; + + /** + * Gets the formatter. + * + * @return FormatterInterface + */ + public function getFormatter(): FormatterInterface; +} diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php b/application/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php new file mode 100644 index 0000000..e9ec5e7 --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\LineFormatter; + +/** + * Helper trait for implementing FormattableInterface + * + * This trait is present in monolog 1.x to ease forward compatibility. + * + * @author Jordi Boggiano + */ +trait FormattableHandlerTrait +{ + /** + * @var FormatterInterface + */ + protected $formatter; + + /** + * {@inheritdoc} + * @suppress PhanTypeMismatchReturn + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + $this->formatter = $formatter; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getFormatter(): FormatterInterface + { + if (!$this->formatter) { + $this->formatter = $this->getDefaultFormatter(); + } + + return $this->formatter; + } + + /** + * Gets the default formatter. + * + * Overwrite this if the LineFormatter is not a good default for your handler. + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new LineFormatter(); + } +} diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php index 28c7b55..71e4669 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php @@ -33,28 +33,20 @@ class GelfHandler extends AbstractProcessingHandler /** * @param PublisherInterface|IMessagePublisher|Publisher $publisher a publisher object - * @param integer $level The minimum logging level at which this handler will be triggered - * @param boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($publisher, $level = Logger::DEBUG, $bubble = true) { parent::__construct($level, $bubble); if (!$publisher instanceof Publisher && !$publisher instanceof IMessagePublisher && !$publisher instanceof PublisherInterface) { - throw new InvalidArgumentException("Invalid publisher, expected a Gelf\Publisher, Gelf\IMessagePublisher or Gelf\PublisherInterface instance"); + throw new InvalidArgumentException('Invalid publisher, expected a Gelf\Publisher, Gelf\IMessagePublisher or Gelf\PublisherInterface instance'); } $this->publisher = $publisher; } - /** - * {@inheritdoc} - */ - public function close() - { - $this->publisher = null; - } - /** * {@inheritdoc} */ diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php index 99384d3..0d461f9 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php @@ -11,6 +11,9 @@ namespace Monolog\Handler; +use Monolog\Formatter\FormatterInterface; +use Monolog\ResettableInterface; + /** * Forwards records to multiple handlers * @@ -21,8 +24,8 @@ class GroupHandler extends AbstractHandler protected $handlers; /** - * @param array $handlers Array of Handlers. - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param array $handlers Array of Handlers. + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(array $handlers, $bubble = true) { @@ -73,8 +76,42 @@ public function handle(array $record) */ public function handleBatch(array $records) { + if ($this->processors) { + $processed = array(); + foreach ($records as $record) { + foreach ($this->processors as $processor) { + $record = call_user_func($processor, $record); + } + $processed[] = $record; + } + $records = $processed; + } + foreach ($this->handlers as $handler) { $handler->handleBatch($records); } } + + public function reset() + { + parent::reset(); + + foreach ($this->handlers as $handler) { + if ($handler instanceof ResettableInterface) { + $handler->reset(); + } + } + } + + /** + * {@inheritdoc} + */ + public function setFormatter(FormatterInterface $formatter) + { + foreach ($this->handlers as $handler) { + $handler->setFormatter($formatter); + } + + return $this; + } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php b/application/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php index d920c4b..8d5a4a0 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php @@ -31,7 +31,7 @@ interface HandlerInterface * * @param array $record Partial log record containing only a level key * - * @return Boolean + * @return bool */ public function isHandling(array $record); @@ -46,7 +46,7 @@ public function isHandling(array $record); * calling further handlers in the stack with a given log record. * * @param array $record The record to handle - * @return Boolean true means that this handler handled the record, and that bubbling is not permitted. + * @return bool true means that this handler handled the record, and that bubbling is not permitted. * false means the record was either not processed or that this handler allows bubbling. */ public function handle(array $record); diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php b/application/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php new file mode 100644 index 0000000..55e6498 --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php @@ -0,0 +1,116 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\ResettableInterface; +use Monolog\Formatter\FormatterInterface; + +/** + * This simple wrapper class can be used to extend handlers functionality. + * + * Example: A custom filtering that can be applied to any handler. + * + * Inherit from this class and override handle() like this: + * + * public function handle(array $record) + * { + * if ($record meets certain conditions) { + * return false; + * } + * return $this->handler->handle($record); + * } + * + * @author Alexey Karapetov + */ +class HandlerWrapper implements HandlerInterface, ResettableInterface +{ + /** + * @var HandlerInterface + */ + protected $handler; + + /** + * HandlerWrapper constructor. + * @param HandlerInterface $handler + */ + public function __construct(HandlerInterface $handler) + { + $this->handler = $handler; + } + + /** + * {@inheritdoc} + */ + public function isHandling(array $record) + { + return $this->handler->isHandling($record); + } + + /** + * {@inheritdoc} + */ + public function handle(array $record) + { + return $this->handler->handle($record); + } + + /** + * {@inheritdoc} + */ + public function handleBatch(array $records) + { + return $this->handler->handleBatch($records); + } + + /** + * {@inheritdoc} + */ + public function pushProcessor($callback) + { + $this->handler->pushProcessor($callback); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function popProcessor() + { + return $this->handler->popProcessor(); + } + + /** + * {@inheritdoc} + */ + public function setFormatter(FormatterInterface $formatter) + { + $this->handler->setFormatter($formatter); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getFormatter() + { + return $this->handler->getFormatter(); + } + + public function reset() + { + if ($this->handler instanceof ResettableInterface) { + return $this->handler->reset(); + } + } +} diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php index 34d3437..179d626 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php @@ -84,19 +84,21 @@ class HipChatHandler extends SocketHandler private $version; /** - * @param string $token HipChat API Token - * @param string $room The room that should be alerted of the message (Id or Name) - * @param string $name Name used in the "from" field. Not used for v2 - * @param bool $notify Trigger a notification in clients or not - * @param int $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * @param bool $useSSL Whether to connect via SSL. - * @param string $format The format of the messages (default to text, can be set to html if you have html in the messages) - * @param string $host The HipChat server hostname. - * @param string $version The HipChat API version (default HipChatHandler::API_V1) + * @param string $token HipChat API Token + * @param string $room The room that should be alerted of the message (Id or Name) + * @param string $name Name used in the "from" field. + * @param bool $notify Trigger a notification in clients or not + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $useSSL Whether to connect via SSL. + * @param string $format The format of the messages (default to text, can be set to html if you have html in the messages) + * @param string $host The HipChat server hostname. + * @param string $version The HipChat API version (default HipChatHandler::API_V1) */ public function __construct($token, $room, $name = 'Monolog', $notify = false, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $format = 'text', $host = 'api.hipchat.com', $version = self::API_V1) { + @trigger_error('The Monolog\Handler\HipChatHandler class is deprecated. You should migrate to Slack and the SlackWebhookHandler / SlackbotHandler, see https://www.atlassian.com/partnerships/slack', E_USER_DEPRECATED); + if ($version == self::API_V1 && !$this->validateStringLength($name, static::MAXIMUM_NAME_LENGTH)) { throw new \InvalidArgumentException('The supplied name is too long. HipChat\'s v1 API supports names up to 15 UTF-8 characters.'); } @@ -143,10 +145,23 @@ private function buildContent($record) 'color' => $this->getAlertColor($record['level']), ); + if (!$this->validateStringLength($dataArray['message'], static::MAXIMUM_MESSAGE_LENGTH)) { + if (function_exists('mb_substr')) { + $dataArray['message'] = mb_substr($dataArray['message'], 0, static::MAXIMUM_MESSAGE_LENGTH).' [truncated]'; + } else { + $dataArray['message'] = substr($dataArray['message'], 0, static::MAXIMUM_MESSAGE_LENGTH).' [truncated]'; + } + } + // if we are using the legacy API then we need to send some additional information if ($this->version == self::API_V1) { $dataArray['room_id'] = $this->room; - $dataArray['from'] = $this->name; + } + + // append the sender name if it is set + // always append it if we use the v1 api (it is required in v1) + if ($this->version == self::API_V1 || $this->name !== null) { + $dataArray['from'] = (string) $this->name; } return http_build_query($dataArray); @@ -179,7 +194,7 @@ private function buildHeader($content) /** * Assigns a color to each level of log records. * - * @param integer $level + * @param int $level * @return string */ protected function getAlertColor($level) @@ -206,6 +221,21 @@ protected function getAlertColor($level) protected function write(array $record) { parent::write($record); + $this->finalizeWrite(); + } + + /** + * Finalizes the request by reading some bytes and then closing the socket + * + * If we do not read some but close the socket too early, hipchat sometimes + * drops the request entirely. + */ + protected function finalizeWrite() + { + $res = $this->getResource(); + if (is_resource($res)) { + @fread($res, 2048); + } $this->closeSocket(); } @@ -303,7 +333,7 @@ private function combineRecords($records) array( 'level' => $level, 'level_name' => $levelName, - 'datetime' => $datetime + 'datetime' => $datetime, ) ); } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php index bc11705..7f22622 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php @@ -30,10 +30,10 @@ class IFTTTHandler extends AbstractProcessingHandler private $secretKey; /** - * @param string $eventName The name of the IFTTT Maker event that should be triggered - * @param string $secretKey A valid IFTTT secret key - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param string $eventName The name of the IFTTT Maker event that should be triggered + * @param string $secretKey A valid IFTTT secret key + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($eventName, $secretKey, $level = Logger::ERROR, $bubble = true) { @@ -51,7 +51,7 @@ public function write(array $record) $postData = array( "value1" => $record["channel"], "value2" => $record["level_name"], - "value3" => $record["message"] + "value3" => $record["message"], ); $postString = json_encode($postData); @@ -61,7 +61,7 @@ public function write(array $record) curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); curl_setopt($ch, CURLOPT_HTTPHEADER, array( - "Content-Type: application/json" + "Content-Type: application/json", )); Curl\Util::execute($ch); diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php new file mode 100644 index 0000000..8f683dc --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + + namespace Monolog\Handler; + + use Monolog\Logger; + +/** + * Inspired on LogEntriesHandler. + * + * @author Robert Kaufmann III + * @author Gabriel Machado + */ +class InsightOpsHandler extends SocketHandler +{ + /** + * @var string + */ + protected $logToken; + + /** + * @param string $token Log token supplied by InsightOps + * @param string $region Region where InsightOps account is hosted. Could be 'us' or 'eu'. + * @param bool $useSSL Whether or not SSL encryption should be used + * @param int $level The minimum logging level to trigger this handler + * @param bool $bubble Whether or not messages that are handled should bubble up the stack. + * + * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing + */ + public function __construct($token, $region = 'us', $useSSL = true, $level = Logger::DEBUG, $bubble = true) + { + if ($useSSL && !extension_loaded('openssl')) { + throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for InsightOpsHandler'); + } + + $endpoint = $useSSL + ? 'ssl://' . $region . '.data.logs.insight.rapid7.com:443' + : $region . '.data.logs.insight.rapid7.com:80'; + + parent::__construct($endpoint, $level, $bubble); + $this->logToken = $token; + } + + /** + * {@inheritdoc} + * + * @param array $record + * @return string + */ + protected function generateDataStream($record) + { + return $this->logToken . ' ' . $record['formatted']; + } +} diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php index bd56230..ea89fb3 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php @@ -24,20 +24,20 @@ class LogEntriesHandler extends SocketHandler protected $logToken; /** - * @param string $token Log token supplied by LogEntries - * @param boolean $useSSL Whether or not SSL encryption should be used. - * @param int $level The minimum logging level to trigger this handler - * @param boolean $bubble Whether or not messages that are handled should bubble up the stack. + * @param string $token Log token supplied by LogEntries + * @param bool $useSSL Whether or not SSL encryption should be used. + * @param int $level The minimum logging level to trigger this handler + * @param bool $bubble Whether or not messages that are handled should bubble up the stack. * * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing */ - public function __construct($token, $useSSL = true, $level = Logger::DEBUG, $bubble = true) + public function __construct($token, $useSSL = true, $level = Logger::DEBUG, $bubble = true, $host = 'data.logentries.com') { if ($useSSL && !extension_loaded('openssl')) { throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for LogEntriesHandler'); } - $endpoint = $useSSL ? 'ssl://data.logentries.com:443' : 'data.logentries.com:80'; + $endpoint = $useSSL ? 'ssl://' . $host . ':443' : $host . ':80'; parent::__construct($endpoint, $level, $bubble); $this->logToken = $token; } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php index 50ed638..9e23283 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php @@ -52,4 +52,16 @@ protected function write(array $record) { $this->send((string) $record['formatted'], array($record)); } + + protected function getHighestRecord(array $records) + { + $highestRecord = null; + foreach ($records as $record) { + if ($highestRecord === null || $highestRecord['level'] < $record['level']) { + $highestRecord = $record; + } + } + + return $highestRecord; + } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php index 0ed098a..3f0956a 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php @@ -26,8 +26,8 @@ class MandrillHandler extends MailHandler /** * @param string $apiKey A valid Mandrill API key * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($apiKey, $message, $level = Logger::ERROR, $bubble = true) { diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php index 6c431f2..56fe755 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php @@ -31,8 +31,8 @@ class MongoDBHandler extends AbstractProcessingHandler public function __construct($mongo, $database, $collection, $level = Logger::DEBUG, $bubble = true) { - if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo)) { - throw new \InvalidArgumentException('MongoClient or Mongo instance required'); + if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo || $mongo instanceof \MongoDB\Client)) { + throw new \InvalidArgumentException('MongoClient, Mongo or MongoDB\Client instance required'); } $this->mongoCollection = $mongo->selectCollection($database, $collection); @@ -42,7 +42,11 @@ public function __construct($mongo, $database, $collection, $level = Logger::DEB protected function write(array $record) { - $this->mongoCollection->save($record["formatted"]); + if ($this->mongoCollection instanceof \MongoDB\Collection) { + $this->mongoCollection->insertOne($record["formatted"]); + } else { + $this->mongoCollection->save($record["formatted"]); + } } /** diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php index 5118a0e..d7807fd 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php @@ -12,6 +12,7 @@ namespace Monolog\Handler; use Monolog\Logger; +use Monolog\Formatter\LineFormatter; /** * NativeMailerHandler uses the mail() function to send the emails @@ -47,7 +48,7 @@ class NativeMailerHandler extends MailHandler /** * The wordwrap length for the message - * @var integer + * @var int */ protected $maxColumnWidth; @@ -67,8 +68,8 @@ class NativeMailerHandler extends MailHandler * @param string|array $to The receiver of the mail * @param string $subject The subject of the mail * @param string $from The sender of the mail - * @param integer $level The minimum logging level at which this handler will be triggered - * @param boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param int $maxColumnWidth The maximum column width that the message lines will have */ public function __construct($to, $subject, $from, $level = Logger::ERROR, $bubble = true, $maxColumnWidth = 70) @@ -101,7 +102,7 @@ public function addHeader($headers) /** * Add parameters to the message * - * @param string|array $parameters Custom added parameters + * @param string|array $parameters Custom added parameters * @return self */ public function addParameter($parameters) @@ -122,8 +123,16 @@ protected function send($content, array $records) if ($this->getContentType() == 'text/html' && false === strpos($headers, 'MIME-Version:')) { $headers .= 'MIME-Version: 1.0' . "\r\n"; } + + $subject = $this->subject; + if ($records) { + $subjectFormatter = new LineFormatter($this->subject); + $subject = $subjectFormatter->format($this->getHighestRecord($records)); + } + + $parameters = implode(' ', $this->parameters); foreach ($this->to as $to) { - mail($to, $this->subject, $content, $headers, implode(' ', $this->parameters)); + mail($to, $subject, $content, $headers, $parameters); } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php index 8cb4ab3..f911997 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php @@ -18,6 +18,8 @@ * Class to record a log on a NewRelic application. * Enabling New Relic High Security mode may prevent capture of useful information. * + * This handler requires a NormalizerFormatter to function and expects an array in $record['formatted'] + * * @see https://docs.newrelic.com/docs/agents/php-agent * @see https://docs.newrelic.com/docs/accounts-partnerships/accounts/security/high-security */ @@ -41,16 +43,16 @@ class NewRelicHandler extends AbstractProcessingHandler * Some context and extra data is passed into the handler as arrays of values. Do we send them as is * (useful if we are using the API), or explode them for display on the NewRelic RPM website? * - * @var boolean + * @var bool */ protected $explodeArrays; /** * {@inheritDoc} * - * @param string $appName - * @param boolean $explodeArrays - * @param string $transactionName + * @param string $appName + * @param bool $explodeArrays + * @param string $transactionName */ public function __construct( $level = Logger::ERROR, @@ -84,30 +86,34 @@ protected function write(array $record) unset($record['formatted']['context']['transaction_name']); } - if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Exception) { + if (isset($record['context']['exception']) && ($record['context']['exception'] instanceof \Exception || (PHP_VERSION_ID >= 70000 && $record['context']['exception'] instanceof \Throwable))) { newrelic_notice_error($record['message'], $record['context']['exception']); unset($record['formatted']['context']['exception']); } else { newrelic_notice_error($record['message']); } - foreach ($record['formatted']['context'] as $key => $parameter) { - if (is_array($parameter) && $this->explodeArrays) { - foreach ($parameter as $paramKey => $paramValue) { - $this->setNewRelicParameter('context_' . $key . '_' . $paramKey, $paramValue); + if (isset($record['formatted']['context']) && is_array($record['formatted']['context'])) { + foreach ($record['formatted']['context'] as $key => $parameter) { + if (is_array($parameter) && $this->explodeArrays) { + foreach ($parameter as $paramKey => $paramValue) { + $this->setNewRelicParameter('context_' . $key . '_' . $paramKey, $paramValue); + } + } else { + $this->setNewRelicParameter('context_' . $key, $parameter); } - } else { - $this->setNewRelicParameter('context_' . $key, $parameter); } } - foreach ($record['formatted']['extra'] as $key => $parameter) { - if (is_array($parameter) && $this->explodeArrays) { - foreach ($parameter as $paramKey => $paramValue) { - $this->setNewRelicParameter('extra_' . $key . '_' . $paramKey, $paramValue); + if (isset($record['formatted']['extra']) && is_array($record['formatted']['extra'])) { + foreach ($record['formatted']['extra'] as $key => $parameter) { + if (is_array($parameter) && $this->explodeArrays) { + foreach ($parameter as $paramKey => $paramValue) { + $this->setNewRelicParameter('extra_' . $key . '_' . $paramKey, $paramValue); + } + } else { + $this->setNewRelicParameter('extra_' . $key, $parameter); } - } else { - $this->setNewRelicParameter('extra_' . $key, $parameter); } } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php index 3754e45..4b84588 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php @@ -24,7 +24,7 @@ class NullHandler extends AbstractHandler { /** - * @param integer $level The minimum logging level at which this handler will be triggered + * @param int $level The minimum logging level at which this handler will be triggered */ public function __construct($level = Logger::DEBUG) { diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php index 2b7e353..1f2076a 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php @@ -66,10 +66,10 @@ class PHPConsoleHandler extends AbstractProcessingHandler private $connector; /** - * @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details - * @param Connector|null $connector Instance of \PhpConsole\Connector class (optional) - * @param int $level - * @param bool $bubble + * @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details + * @param Connector|null $connector Instance of \PhpConsole\Connector class (optional) + * @param int $level + * @param bool $bubble * @throws Exception */ public function __construct(array $options = array(), Connector $connector = null, $level = Logger::DEBUG, $bubble = true) diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php b/application/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php new file mode 100644 index 0000000..66a3d83 --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Processor\ProcessorInterface; + +/** + * Interface to describe loggers that have processors + * + * This interface is present in monolog 1.x to ease forward compatibility. + * + * @author Jordi Boggiano + */ +interface ProcessableHandlerInterface +{ + /** + * Adds a processor in the stack. + * + * @param ProcessorInterface|callable $callback + * @return HandlerInterface self + */ + public function pushProcessor($callback): HandlerInterface; + + /** + * Removes the processor on top of the stack and returns it. + * + * @throws \LogicException In case the processor stack is empty + * @return callable + */ + public function popProcessor(): callable; +} diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php b/application/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php new file mode 100644 index 0000000..09f32a1 --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\ResettableInterface; + +/** + * Helper trait for implementing ProcessableInterface + * + * This trait is present in monolog 1.x to ease forward compatibility. + * + * @author Jordi Boggiano + */ +trait ProcessableHandlerTrait +{ + /** + * @var callable[] + */ + protected $processors = []; + + /** + * {@inheritdoc} + * @suppress PhanTypeMismatchReturn + */ + public function pushProcessor($callback): HandlerInterface + { + array_unshift($this->processors, $callback); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function popProcessor(): callable + { + if (!$this->processors) { + throw new \LogicException('You tried to pop from an empty processor stack.'); + } + + return array_shift($this->processors); + } + + /** + * Processes a record. + */ + protected function processRecord(array $record): array + { + foreach ($this->processors as $processor) { + $record = $processor($record); + } + + return $record; + } + + protected function resetProcessors(): void + { + foreach ($this->processors as $processor) { + if ($processor instanceof ResettableInterface) { + $processor->reset(); + } + } + } +} diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php index 1ae8584..a99e6ab 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php @@ -31,7 +31,7 @@ class PsrHandler extends AbstractHandler /** * @param LoggerInterface $logger The underlying PSR-3 compliant logger to which messages will be proxied * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(LoggerInterface $logger, $level = Logger::DEBUG, $bubble = true) { diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php index 9917b64..f27bb3d 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php @@ -68,16 +68,16 @@ class PushoverHandler extends SocketHandler * @param string $token Pushover api token * @param string|array $users Pushover user id or array of ids the message will be sent to * @param string $title Title sent to the Pushover API - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param Boolean $useSSL Whether to connect via SSL. Required when pushing messages to users that are not + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $useSSL Whether to connect via SSL. Required when pushing messages to users that are not * the pushover.net app owner. OpenSSL is required for this option. - * @param integer $highPriorityLevel The minimum logging level at which this handler will start + * @param int $highPriorityLevel The minimum logging level at which this handler will start * sending "high priority" requests to the Pushover API - * @param integer $emergencyLevel The minimum logging level at which this handler will start + * @param int $emergencyLevel The minimum logging level at which this handler will start * sending "emergency" requests to the Pushover API - * @param integer $retry The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user. - * @param integer $expire The expire parameter specifies how many seconds your notification will continue to be retried for (every retry seconds). + * @param int $retry The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user. + * @param int $expire The expire parameter specifies how many seconds your notification will continue to be retried for (every retry seconds). */ public function __construct($token, $users, $title = null, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $highPriorityLevel = Logger::CRITICAL, $emergencyLevel = Logger::EMERGENCY, $retry = 30, $expire = 25200) { @@ -115,7 +115,7 @@ private function buildContent($record) 'user' => $this->user, 'message' => $message, 'title' => $this->title, - 'timestamp' => $timestamp + 'timestamp' => $timestamp, ); if (isset($record['level']) && $record['level'] >= $this->emergencyLevel) { @@ -176,10 +176,10 @@ public function setEmergencyLevel($value) /** * Use the formatted message? - * @param boolean $value + * @param bool $value */ public function useFormattedMessage($value) { - $this->useFormattedMessage = (boolean) $value; + $this->useFormattedMessage = (bool) $value; } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php index 1807705..1929f25 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php @@ -18,7 +18,7 @@ /** * Handler to send messages to a Sentry (https://github.com/getsentry/sentry) server - * using raven-php (https://github.com/getsentry/raven-php) + * using sentry-php (https://github.com/getsentry/sentry-php) * * @author Marc Abramowitz */ @@ -27,7 +27,7 @@ class RavenHandler extends AbstractProcessingHandler /** * Translates Monolog log levels to Raven log levels. */ - private $logLevels = array( + protected $logLevels = array( Logger::DEBUG => Raven_Client::DEBUG, Logger::INFO => Raven_Client::INFO, Logger::NOTICE => Raven_Client::INFO, @@ -38,6 +38,12 @@ class RavenHandler extends AbstractProcessingHandler Logger::EMERGENCY => Raven_Client::FATAL, ); + /** + * @var string should represent the current version of the calling + * software. Can be any string (git commit, version number) + */ + protected $release; + /** * @var Raven_Client the client object that sends the message to the server */ @@ -50,11 +56,13 @@ class RavenHandler extends AbstractProcessingHandler /** * @param Raven_Client $ravenClient - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(Raven_Client $ravenClient, $level = Logger::DEBUG, $bubble = true) { + @trigger_error('The Monolog\Handler\RavenHandler class is deprecated. You should rather upgrade to the sentry/sentry 2.x and use Sentry\Monolog\Handler, see https://github.com/getsentry/sentry-php/blob/master/src/Monolog/Handler.php', E_USER_DEPRECATED); + parent::__construct($level, $bubble); $this->ravenClient = $ravenClient; @@ -78,7 +86,7 @@ public function handleBatch(array $records) // the record with the highest severity is the "main" one $record = array_reduce($records, function ($highest, $record) { - if ($record['level'] >= $highest['level']) { + if ($record['level'] > $highest['level']) { return $record; } @@ -139,6 +147,10 @@ protected function write(array $record) $options['tags'] = array_merge($options['tags'], $record['context']['tags']); unset($record['context']['tags']); } + if (!empty($record['context']['fingerprint'])) { + $options['fingerprint'] = $record['context']['fingerprint']; + unset($record['context']['fingerprint']); + } if (!empty($record['context']['logger'])) { $options['logger'] = $record['context']['logger']; unset($record['context']['logger']); @@ -165,8 +177,12 @@ protected function write(array $record) $options['extra']['extra'] = $record['extra']; } - if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Exception) { - $options['extra']['message'] = $record['formatted']; + if (!empty($this->release) && !isset($options['release'])) { + $options['release'] = $this->release; + } + + if (isset($record['context']['exception']) && ($record['context']['exception'] instanceof \Exception || (PHP_VERSION_ID >= 70000 && $record['context']['exception'] instanceof \Throwable))) { + $options['message'] = $record['formatted']; $this->ravenClient->captureException($record['context']['exception'], $options); } else { $this->ravenClient->captureMessage($record['formatted'], array(), $options); @@ -202,6 +218,17 @@ protected function getDefaultBatchFormatter() */ protected function getExtraParameters() { - return array('checksum', 'release'); + return array('contexts', 'checksum', 'release', 'event_id'); + } + + /** + * @param string $value + * @return self + */ + public function setRelease($value) + { + $this->release = $value; + + return $this; } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php index 157e2f9..590f996 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php @@ -34,9 +34,9 @@ class RedisHandler extends AbstractProcessingHandler /** * @param \Predis\Client|\Redis $redis The redis instance * @param string $key The key name to push records to - * @param integer $level The minimum logging level at which this handler will be triggered - * @param boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param integer $capSize Number of entries to limit list size to + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $capSize Number of entries to limit list size to */ public function __construct($redis, $key, $level = Logger::DEBUG, $bubble = true, $capSize = false) { @@ -67,7 +67,7 @@ protected function write(array $record) * Write and cap the collection * Writes the record to the redis list and caps its * - * @param array $record associative record array + * @param array $record associative record array * @return void */ protected function writeCapped(array $record) @@ -76,7 +76,7 @@ protected function writeCapped(array $record) $this->redisClient->multi() ->rpush($this->redisKey, $record["formatted"]) ->ltrim($this->redisKey, -$this->capSize, -1) - ->execute(); + ->exec(); } else { $redisKey = $this->redisKey; $capSize = $this->capSize; diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php index 0ad618d..65073ff 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php @@ -18,6 +18,17 @@ /** * Sends errors to Rollbar * + * If the context data contains a `payload` key, that is used as an array + * of payload options to RollbarNotifier's report_message/report_exception methods. + * + * Rollbar's context info will contain the context + extra keys from the log record + * merged, and then on top of that a few keys: + * + * - level (rollbar level name) + * - monolog_level (monolog level name, raw level, as rollbar only has 5 but monolog 8) + * - channel + * - datetime (unix timestamp) + * * @author Paul Statezny */ class RollbarHandler extends AbstractProcessingHandler @@ -29,6 +40,17 @@ class RollbarHandler extends AbstractProcessingHandler */ protected $rollbarNotifier; + protected $levelMap = array( + Logger::DEBUG => 'debug', + Logger::INFO => 'info', + Logger::NOTICE => 'info', + Logger::WARNING => 'warning', + Logger::ERROR => 'error', + Logger::CRITICAL => 'critical', + Logger::ALERT => 'critical', + Logger::EMERGENCY => 'critical', + ); + /** * Records whether any log records have been added since the last flush of the rollbar notifier * @@ -36,10 +58,12 @@ class RollbarHandler extends AbstractProcessingHandler */ private $hasRecords = false; + protected $initialized = false; + /** * @param RollbarNotifier $rollbarNotifier RollbarNotifier object constructed with valid token - * @param integer $level The minimum logging level at which this handler will be triggered - * @param boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(RollbarNotifier $rollbarNotifier, $level = Logger::ERROR, $bubble = true) { @@ -53,43 +77,68 @@ public function __construct(RollbarNotifier $rollbarNotifier, $level = Logger::E */ protected function write(array $record) { - if (isset($record['context']['exception']) && $record['context']['exception'] instanceof Exception) { - $context = $record['context']; + if (!$this->initialized) { + // __destructor() doesn't get called on Fatal errors + register_shutdown_function(array($this, 'close')); + $this->initialized = true; + } + + $context = $record['context']; + $payload = array(); + if (isset($context['payload'])) { + $payload = $context['payload']; + unset($context['payload']); + } + $context = array_merge($context, $record['extra'], array( + 'level' => $this->levelMap[$record['level']], + 'monolog_level' => $record['level_name'], + 'channel' => $record['channel'], + 'datetime' => $record['datetime']->format('U'), + )); + + if (isset($context['exception']) && $context['exception'] instanceof Exception) { + $payload['level'] = $context['level']; $exception = $context['exception']; unset($context['exception']); - $payload = array(); - if (isset($context['payload'])) { - $payload = $context['payload']; - unset($context['payload']); - } - $this->rollbarNotifier->report_exception($exception, $context, $payload); } else { - $extraData = array( - 'level' => $record['level'], - 'channel' => $record['channel'], - 'datetime' => $record['datetime']->format('U'), - ); - $this->rollbarNotifier->report_message( $record['message'], - $record['level_name'], - array_merge($record['context'], $record['extra'], $extraData) + $context['level'], + $context, + $payload ); } $this->hasRecords = true; } - /** - * {@inheritdoc} - */ - public function close() + public function flush() { if ($this->hasRecords) { $this->rollbarNotifier->flush(); $this->hasRecords = false; } } + + /** + * {@inheritdoc} + */ + public function close() + { + $this->flush(); + } + + /** + * {@inheritdoc} + */ + public function reset() + { + $this->flush(); + + parent::reset(); + } + + } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php index 0a20377..ae2309f 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php @@ -24,6 +24,10 @@ */ class RotatingFileHandler extends StreamHandler { + const FILE_PER_DAY = 'Y-m-d'; + const FILE_PER_MONTH = 'Y-m'; + const FILE_PER_YEAR = 'Y'; + protected $filename; protected $maxFiles; protected $mustRotate; @@ -33,11 +37,11 @@ class RotatingFileHandler extends StreamHandler /** * @param string $filename - * @param integer $maxFiles The maximal amount of files to keep (0 means unlimited) - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $maxFiles The maximal amount of files to keep (0 means unlimited) + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) - * @param Boolean $useLocking Try to lock log file before doing any writes + * @param bool $useLocking Try to lock log file before doing any writes */ public function __construct($filename, $maxFiles = 0, $level = Logger::DEBUG, $bubble = true, $filePermission = null, $useLocking = false) { @@ -62,8 +66,35 @@ public function close() } } + /** + * {@inheritdoc} + */ + public function reset() + { + parent::reset(); + + if (true === $this->mustRotate) { + $this->rotate(); + } + } + public function setFilenameFormat($filenameFormat, $dateFormat) { + if (!preg_match('{^Y(([/_.-]?m)([/_.-]?d)?)?$}', $dateFormat)) { + trigger_error( + 'Invalid date format - format must be one of '. + 'RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), RotatingFileHandler::FILE_PER_MONTH ("Y-m") '. + 'or RotatingFileHandler::FILE_PER_YEAR ("Y"), or you can set one of the '. + 'date formats using slashes, underscores and/or dots instead of dashes.', + E_USER_DEPRECATED + ); + } + if (substr_count($filenameFormat, '{date}') === 0) { + trigger_error( + 'Invalid filename format - format should contain at least `{date}`, because otherwise rotating is impossible.', + E_USER_DEPRECATED + ); + } $this->filenameFormat = $filenameFormat; $this->dateFormat = $dateFormat; $this->url = $this->getTimedFilename(); @@ -115,7 +146,11 @@ protected function rotate() foreach (array_slice($logFiles, $this->maxFiles) as $file) { if (is_writable($file)) { + // suppress errors here as unlink() might fail if two processes + // are cleaning up/rotating at the same time + set_error_handler(function ($errno, $errstr, $errfile, $errline) {}); unlink($file); + restore_error_handler(); } } @@ -143,7 +178,7 @@ protected function getGlobPattern() $fileInfo = pathinfo($this->filename); $glob = str_replace( array('{filename}', '{date}'), - array($fileInfo['filename'], '*'), + array($fileInfo['filename'], '[0-9][0-9][0-9][0-9]*'), $fileInfo['dirname'] . '/' . $this->filenameFormat ); if (!empty($fileInfo['extension'])) { diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php b/application/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php new file mode 100644 index 0000000..e55e0e2 --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php @@ -0,0 +1,294 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\Slack; + +use Monolog\Logger; +use Monolog\Formatter\NormalizerFormatter; +use Monolog\Formatter\FormatterInterface; + +/** + * Slack record utility helping to log to Slack webhooks or API. + * + * @author Greg Kedzierski + * @author Haralan Dobrev + * @see https://api.slack.com/incoming-webhooks + * @see https://api.slack.com/docs/message-attachments + */ +class SlackRecord +{ + const COLOR_DANGER = 'danger'; + + const COLOR_WARNING = 'warning'; + + const COLOR_GOOD = 'good'; + + const COLOR_DEFAULT = '#e3e4e6'; + + /** + * Slack channel (encoded ID or name) + * @var string|null + */ + private $channel; + + /** + * Name of a bot + * @var string|null + */ + private $username; + + /** + * User icon e.g. 'ghost', 'http://example.com/user.png' + * @var string + */ + private $userIcon; + + /** + * Whether the message should be added to Slack as attachment (plain text otherwise) + * @var bool + */ + private $useAttachment; + + /** + * Whether the the context/extra messages added to Slack as attachments are in a short style + * @var bool + */ + private $useShortAttachment; + + /** + * Whether the attachment should include context and extra data + * @var bool + */ + private $includeContextAndExtra; + + /** + * Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] + * @var array + */ + private $excludeFields; + + /** + * @var FormatterInterface + */ + private $formatter; + + /** + * @var NormalizerFormatter + */ + private $normalizerFormatter; + + public function __construct($channel = null, $username = null, $useAttachment = true, $userIcon = null, $useShortAttachment = false, $includeContextAndExtra = false, array $excludeFields = array(), FormatterInterface $formatter = null) + { + $this->channel = $channel; + $this->username = $username; + $this->userIcon = trim($userIcon, ':'); + $this->useAttachment = $useAttachment; + $this->useShortAttachment = $useShortAttachment; + $this->includeContextAndExtra = $includeContextAndExtra; + $this->excludeFields = $excludeFields; + $this->formatter = $formatter; + + if ($this->includeContextAndExtra) { + $this->normalizerFormatter = new NormalizerFormatter(); + } + } + + public function getSlackData(array $record) + { + $dataArray = array(); + $record = $this->excludeFields($record); + + if ($this->username) { + $dataArray['username'] = $this->username; + } + + if ($this->channel) { + $dataArray['channel'] = $this->channel; + } + + if ($this->formatter && !$this->useAttachment) { + $message = $this->formatter->format($record); + } else { + $message = $record['message']; + } + + if ($this->useAttachment) { + $attachment = array( + 'fallback' => $message, + 'text' => $message, + 'color' => $this->getAttachmentColor($record['level']), + 'fields' => array(), + 'mrkdwn_in' => array('fields'), + 'ts' => $record['datetime']->getTimestamp() + ); + + if ($this->useShortAttachment) { + $attachment['title'] = $record['level_name']; + } else { + $attachment['title'] = 'Message'; + $attachment['fields'][] = $this->generateAttachmentField('Level', $record['level_name']); + } + + + if ($this->includeContextAndExtra) { + foreach (array('extra', 'context') as $key) { + if (empty($record[$key])) { + continue; + } + + if ($this->useShortAttachment) { + $attachment['fields'][] = $this->generateAttachmentField( + $key, + $record[$key] + ); + } else { + // Add all extra fields as individual fields in attachment + $attachment['fields'] = array_merge( + $attachment['fields'], + $this->generateAttachmentFields($record[$key]) + ); + } + } + } + + $dataArray['attachments'] = array($attachment); + } else { + $dataArray['text'] = $message; + } + + if ($this->userIcon) { + if (filter_var($this->userIcon, FILTER_VALIDATE_URL)) { + $dataArray['icon_url'] = $this->userIcon; + } else { + $dataArray['icon_emoji'] = ":{$this->userIcon}:"; + } + } + + return $dataArray; + } + + /** + * Returned a Slack message attachment color associated with + * provided level. + * + * @param int $level + * @return string + */ + public function getAttachmentColor($level) + { + switch (true) { + case $level >= Logger::ERROR: + return self::COLOR_DANGER; + case $level >= Logger::WARNING: + return self::COLOR_WARNING; + case $level >= Logger::INFO: + return self::COLOR_GOOD; + default: + return self::COLOR_DEFAULT; + } + } + + /** + * Stringifies an array of key/value pairs to be used in attachment fields + * + * @param array $fields + * + * @return string + */ + public function stringify($fields) + { + $normalized = $this->normalizerFormatter->format($fields); + $prettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128; + + $hasSecondDimension = count(array_filter($normalized, 'is_array')); + $hasNonNumericKeys = !count(array_filter(array_keys($normalized), 'is_numeric')); + + return $hasSecondDimension || $hasNonNumericKeys + ? json_encode($normalized, $prettyPrintFlag) + : json_encode($normalized); + } + + /** + * Sets the formatter + * + * @param FormatterInterface $formatter + */ + public function setFormatter(FormatterInterface $formatter) + { + $this->formatter = $formatter; + } + + /** + * Generates attachment field + * + * @param string $title + * @param string|array $value + * + * @return array + */ + private function generateAttachmentField($title, $value) + { + $value = is_array($value) + ? sprintf('```%s```', $this->stringify($value)) + : $value; + + return array( + 'title' => ucfirst($title), + 'value' => $value, + 'short' => false + ); + } + + /** + * Generates a collection of attachment fields from array + * + * @param array $data + * + * @return array + */ + private function generateAttachmentFields(array $data) + { + $fields = array(); + foreach ($this->normalizerFormatter->format($data) as $key => $value) { + $fields[] = $this->generateAttachmentField($key, $value); + } + + return $fields; + } + + /** + * Get a copy of record with fields excluded according to $this->excludeFields + * + * @param array $record + * + * @return array + */ + private function excludeFields(array $record) + { + foreach ($this->excludeFields as $field) { + $keys = explode('.', $field); + $node = &$record; + $lastKey = end($keys); + foreach ($keys as $key) { + if (!isset($node[$key])) { + break; + } + if ($lastKey === $key) { + unset($node[$key]); + break; + } + $node = &$node[$key]; + } + } + + return $record; + } +} diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php index 61245ff..45d634f 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php @@ -11,8 +11,9 @@ namespace Monolog\Handler; +use Monolog\Formatter\FormatterInterface; use Monolog\Logger; -use Monolog\Formatter\LineFormatter; +use Monolog\Handler\Slack\SlackRecord; /** * Sends notifications through Slack API @@ -29,58 +30,25 @@ class SlackHandler extends SocketHandler private $token; /** - * Slack channel (encoded ID or name) - * @var string - */ - private $channel; - - /** - * Name of a bot - * @var string - */ - private $username; - - /** - * Emoji icon name - * @var string - */ - private $iconEmoji; - - /** - * Whether the message should be added to Slack as attachment (plain text otherwise) - * @var bool - */ - private $useAttachment; - - /** - * Whether the the context/extra messages added to Slack as attachments are in a short style - * @var bool - */ - private $useShortAttachment; - - /** - * Whether the attachment should include context and extra data - * @var bool - */ - private $includeContextAndExtra; - - /** - * @var LineFormatter + * Instance of the SlackRecord util class preparing data for Slack API. + * @var SlackRecord */ - private $lineFormatter; + private $slackRecord; /** - * @param string $token Slack API token - * @param string $channel Slack channel (encoded ID or name) - * @param string $username Name of a bot - * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise) - * @param string|null $iconEmoji The emoji name to use (or null) - * @param int $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style - * @param bool $includeContextAndExtra Whether the attachment should include context and extra data + * @param string $token Slack API token + * @param string $channel Slack channel (encoded ID or name) + * @param string|null $username Name of a bot + * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise) + * @param string|null $iconEmoji The emoji name to use (or null) + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style + * @param bool $includeContextAndExtra Whether the attachment should include context and extra data + * @param array $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] + * @throws MissingExtensionException If no OpenSSL PHP extension configured */ - public function __construct($token, $channel, $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false) + public function __construct($token, $channel, $username = null, $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false, array $excludeFields = array()) { if (!extension_loaded('openssl')) { throw new MissingExtensionException('The OpenSSL PHP extension is required to use the SlackHandler'); @@ -88,16 +56,28 @@ public function __construct($token, $channel, $username = 'Monolog', $useAttachm parent::__construct('ssl://slack.com:443', $level, $bubble); + $this->slackRecord = new SlackRecord( + $channel, + $username, + $useAttachment, + $iconEmoji, + $useShortAttachment, + $includeContextAndExtra, + $excludeFields, + $this->formatter + ); + $this->token = $token; - $this->channel = $channel; - $this->username = $username; - $this->iconEmoji = trim($iconEmoji, ':'); - $this->useAttachment = $useAttachment; - $this->useShortAttachment = $useShortAttachment; - $this->includeContextAndExtra = $includeContextAndExtra; - if ($this->includeContextAndExtra) { - $this->lineFormatter = new LineFormatter; - } + } + + public function getSlackRecord() + { + return $this->slackRecord; + } + + public function getToken() + { + return $this->token; } /** @@ -134,81 +114,11 @@ private function buildContent($record) */ protected function prepareContentData($record) { - $dataArray = array( - 'token' => $this->token, - 'channel' => $this->channel, - 'username' => $this->username, - 'text' => '', - 'attachments' => array() - ); - - if ($this->useAttachment) { - $attachment = array( - 'fallback' => $record['message'], - 'color' => $this->getAttachmentColor($record['level']), - 'fields' => array() - ); - - if ($this->useShortAttachment) { - $attachment['title'] = $record['level_name']; - $attachment['text'] = $record['message']; - } else { - $attachment['title'] = 'Message'; - $attachment['text'] = $record['message']; - $attachment['fields'][] = array( - 'title' => 'Level', - 'value' => $record['level_name'], - 'short' => true - ); - } - - if ($this->includeContextAndExtra) { - if (!empty($record['extra'])) { - if ($this->useShortAttachment) { - $attachment['fields'][] = array( - 'title' => "Extra", - 'value' => $this->stringify($record['extra']), - 'short' => $this->useShortAttachment - ); - } else { - // Add all extra fields as individual fields in attachment - foreach ($record['extra'] as $var => $val) { - $attachment['fields'][] = array( - 'title' => $var, - 'value' => $val, - 'short' => $this->useShortAttachment - ); - } - } - } - - if (!empty($record['context'])) { - if ($this->useShortAttachment) { - $attachment['fields'][] = array( - 'title' => "Context", - 'value' => $this->stringify($record['context']), - 'short' => $this->useShortAttachment - ); - } else { - // Add all context fields as individual fields in attachment - foreach ($record['context'] as $var => $val) { - $attachment['fields'][] = array( - 'title' => $var, - 'value' => $val, - 'short' => $this->useShortAttachment - ); - } - } - } - } + $dataArray = $this->slackRecord->getSlackData($record); + $dataArray['token'] = $this->token; - $dataArray['attachments'] = json_encode(array($attachment)); - } else { - $dataArray['text'] = $record['message']; - } - - if ($this->iconEmoji) { - $dataArray['icon_emoji'] = ":{$this->iconEmoji}:"; + if (!empty($dataArray['attachments'])) { + $dataArray['attachments'] = json_encode($dataArray['attachments']); } return $dataArray; @@ -239,6 +149,21 @@ private function buildHeader($content) protected function write(array $record) { parent::write($record); + $this->finalizeWrite(); + } + + /** + * Finalizes the request by reading some bytes and then closing the socket + * + * If we do not read some but close the socket too early, slack sometimes + * drops the request entirely. + */ + protected function finalizeWrite() + { + $res = $this->getResource(); + if (is_resource($res)) { + @fread($res, 2048); + } $this->closeSocket(); } @@ -248,37 +173,48 @@ protected function write(array $record) * * @param int $level * @return string + * @deprecated Use underlying SlackRecord instead */ protected function getAttachmentColor($level) { - switch (true) { - case $level >= Logger::ERROR: - return 'danger'; - case $level >= Logger::WARNING: - return 'warning'; - case $level >= Logger::INFO: - return 'good'; - default: - return '#e3e4e6'; - } + trigger_error( + 'SlackHandler::getAttachmentColor() is deprecated. Use underlying SlackRecord instead.', + E_USER_DEPRECATED + ); + + return $this->slackRecord->getAttachmentColor($level); } /** * Stringifies an array of key/value pairs to be used in attachment fields * - * @param array $fields - * @access protected + * @param array $fields * @return string + * @deprecated Use underlying SlackRecord instead */ protected function stringify($fields) { - $string = ''; - foreach ($fields as $var => $val) { - $string .= $var.': '.$this->lineFormatter->stringify($val)." | "; - } + trigger_error( + 'SlackHandler::stringify() is deprecated. Use underlying SlackRecord instead.', + E_USER_DEPRECATED + ); - $string = rtrim($string, " |"); + return $this->slackRecord->stringify($fields); + } + + public function setFormatter(FormatterInterface $formatter) + { + parent::setFormatter($formatter); + $this->slackRecord->setFormatter($formatter); + + return $this; + } + + public function getFormatter() + { + $formatter = parent::getFormatter(); + $this->slackRecord->setFormatter($formatter); - return $string; + return $formatter; } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php new file mode 100644 index 0000000..1ef85fa --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php @@ -0,0 +1,120 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\Logger; +use Monolog\Handler\Slack\SlackRecord; + +/** + * Sends notifications through Slack Webhooks + * + * @author Haralan Dobrev + * @see https://api.slack.com/incoming-webhooks + */ +class SlackWebhookHandler extends AbstractProcessingHandler +{ + /** + * Slack Webhook token + * @var string + */ + private $webhookUrl; + + /** + * Instance of the SlackRecord util class preparing data for Slack API. + * @var SlackRecord + */ + private $slackRecord; + + /** + * @param string $webhookUrl Slack Webhook URL + * @param string|null $channel Slack channel (encoded ID or name) + * @param string|null $username Name of a bot + * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise) + * @param string|null $iconEmoji The emoji name to use (or null) + * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style + * @param bool $includeContextAndExtra Whether the attachment should include context and extra data + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param array $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] + */ + public function __construct($webhookUrl, $channel = null, $username = null, $useAttachment = true, $iconEmoji = null, $useShortAttachment = false, $includeContextAndExtra = false, $level = Logger::CRITICAL, $bubble = true, array $excludeFields = array()) + { + parent::__construct($level, $bubble); + + $this->webhookUrl = $webhookUrl; + + $this->slackRecord = new SlackRecord( + $channel, + $username, + $useAttachment, + $iconEmoji, + $useShortAttachment, + $includeContextAndExtra, + $excludeFields, + $this->formatter + ); + } + + public function getSlackRecord() + { + return $this->slackRecord; + } + + public function getWebhookUrl() + { + return $this->webhookUrl; + } + + /** + * {@inheritdoc} + * + * @param array $record + */ + protected function write(array $record) + { + $postData = $this->slackRecord->getSlackData($record); + $postString = json_encode($postData); + + $ch = curl_init(); + $options = array( + CURLOPT_URL => $this->webhookUrl, + CURLOPT_POST => true, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HTTPHEADER => array('Content-type: application/json'), + CURLOPT_POSTFIELDS => $postString + ); + if (defined('CURLOPT_SAFE_UPLOAD')) { + $options[CURLOPT_SAFE_UPLOAD] = true; + } + + curl_setopt_array($ch, $options); + + Curl\Util::execute($ch); + } + + public function setFormatter(FormatterInterface $formatter) + { + parent::setFormatter($formatter); + $this->slackRecord->setFormatter($formatter); + + return $this; + } + + public function getFormatter() + { + $formatter = parent::getFormatter(); + $this->slackRecord->setFormatter($formatter); + + return $formatter; + } +} diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php new file mode 100644 index 0000000..d3352ea --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Sends notifications through Slack's Slackbot + * + * @author Haralan Dobrev + * @see https://slack.com/apps/A0F81R8ET-slackbot + * @deprecated According to Slack the API used on this handler it is deprecated. + * Therefore this handler will be removed on 2.x + * Slack suggests to use webhooks instead. Please contact slack for more information. + */ +class SlackbotHandler extends AbstractProcessingHandler +{ + /** + * The slug of the Slack team + * @var string + */ + private $slackTeam; + + /** + * Slackbot token + * @var string + */ + private $token; + + /** + * Slack channel name + * @var string + */ + private $channel; + + /** + * @param string $slackTeam Slack team slug + * @param string $token Slackbot token + * @param string $channel Slack channel (encoded ID or name) + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct($slackTeam, $token, $channel, $level = Logger::CRITICAL, $bubble = true) + { + @trigger_error('SlackbotHandler is deprecated and will be removed on 2.x', E_USER_DEPRECATED); + parent::__construct($level, $bubble); + + $this->slackTeam = $slackTeam; + $this->token = $token; + $this->channel = $channel; + } + + /** + * {@inheritdoc} + * + * @param array $record + */ + protected function write(array $record) + { + $slackbotUrl = sprintf( + 'https://%s.slack.com/services/hooks/slackbot?token=%s&channel=%s', + $this->slackTeam, + $this->token, + $this->channel + ); + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $slackbotUrl); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $record['message']); + + Curl\Util::execute($ch); + } +} diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php index a3e7252..db50d97 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php @@ -25,14 +25,18 @@ class SocketHandler extends AbstractProcessingHandler private $connectionTimeout; private $resource; private $timeout = 0; + private $writingTimeout = 10; + private $lastSentBytes = null; + private $chunkSize = null; private $persistent = false; private $errno; private $errstr; + private $lastWritingAt; /** - * @param string $connectionString Socket connection string - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param string $connectionString Socket connection string + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($connectionString, $level = Logger::DEBUG, $bubble = true) { @@ -80,11 +84,11 @@ public function closeSocket() /** * Set socket connection to nbe persistent. It only has effect before the connection is initiated. * - * @param boolean $persistent + * @param bool $persistent */ public function setPersistent($persistent) { - $this->persistent = (boolean) $persistent; + $this->persistent = (bool) $persistent; } /** @@ -113,6 +117,27 @@ public function setTimeout($seconds) $this->timeout = (float) $seconds; } + /** + * Set writing timeout. Only has effect during connection in the writing cycle. + * + * @param float $seconds 0 for no timeout + */ + public function setWritingTimeout($seconds) + { + $this->validateTimeout($seconds); + $this->writingTimeout = (float) $seconds; + } + + /** + * Set chunk size. Only has effect during connection in the writing cycle. + * + * @param float $bytes + */ + public function setChunkSize($bytes) + { + $this->chunkSize = $bytes; + } + /** * Get current connection string * @@ -126,7 +151,7 @@ public function getConnectionString() /** * Get persistent setting * - * @return boolean + * @return bool */ public function isPersistent() { @@ -153,12 +178,32 @@ public function getTimeout() return $this->timeout; } + /** + * Get current local writing timeout + * + * @return float + */ + public function getWritingTimeout() + { + return $this->writingTimeout; + } + + /** + * Get current chunk size + * + * @return float + */ + public function getChunkSize() + { + return $this->chunkSize; + } + /** * Check to see if the socket is currently available. * * UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details. * - * @return boolean + * @return bool */ public function isConnected() { @@ -195,6 +240,16 @@ protected function streamSetTimeout() return stream_set_timeout($this->resource, $seconds, $microseconds); } + /** + * Wrapper to allow mocking + * + * @see http://php.net/manual/en/function.stream-set-chunk-size.php + */ + protected function streamSetChunkSize() + { + return stream_set_chunk_size($this->resource, $this->chunkSize); + } + /** * Wrapper to allow mocking */ @@ -232,10 +287,19 @@ protected function generateDataStream($record) return (string) $record['formatted']; } + /** + * @return resource|null + */ + protected function getResource() + { + return $this->resource; + } + private function connect() { $this->createSocketResource(); $this->setSocketTimeout(); + $this->setStreamChunkSize(); } private function createSocketResource() @@ -258,10 +322,18 @@ private function setSocketTimeout() } } + private function setStreamChunkSize() + { + if ($this->chunkSize && !$this->streamSetChunkSize()) { + throw new \UnexpectedValueException("Failed setting chunk size with stream_set_chunk_size()"); + } + } + private function writeToSocket($data) { $length = strlen($data); $sent = 0; + $this->lastSentBytes = $sent; while ($this->isConnected() && $sent < $length) { if (0 == $sent) { $chunk = $this->fwrite($data); @@ -276,9 +348,38 @@ private function writeToSocket($data) if ($socketInfo['timed_out']) { throw new \RuntimeException("Write timed-out"); } + + if ($this->writingIsTimedOut($sent)) { + throw new \RuntimeException("Write timed-out, no data sent for `{$this->writingTimeout}` seconds, probably we got disconnected (sent $sent of $length)"); + } } if (!$this->isConnected() && $sent < $length) { throw new \RuntimeException("End-of-file reached, probably we got disconnected (sent $sent of $length)"); } } + + private function writingIsTimedOut($sent) + { + $writingTimeout = (int) floor($this->writingTimeout); + if (0 === $writingTimeout) { + return false; + } + + if ($sent !== $this->lastSentBytes) { + $this->lastWritingAt = time(); + $this->lastSentBytes = $sent; + + return false; + } else { + usleep(100); + } + + if ((time() - $this->lastWritingAt) >= $writingTimeout) { + $this->closeSocket(); + + return true; + } + + return false; + } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php index 28b9b11..27d90e0 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php @@ -31,10 +31,10 @@ class StreamHandler extends AbstractProcessingHandler /** * @param resource|string $stream - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) - * @param Boolean $useLocking Try to lock log file before doing any writes + * @param bool $useLocking Try to lock log file before doing any writes * * @throws \Exception If a missing directory is not buildable * @throws \InvalidArgumentException If stream is not a resource or string @@ -59,10 +59,31 @@ public function __construct($stream, $level = Logger::DEBUG, $bubble = true, $fi */ public function close() { - if (is_resource($this->stream)) { + if ($this->url && is_resource($this->stream)) { fclose($this->stream); } $this->stream = null; + $this->dirCreated = null; + } + + /** + * Return the currently active stream if it is open + * + * @return resource|null + */ + public function getStream() + { + return $this->stream; + } + + /** + * Return the stream URL if it was configured with a URL and not an active resource + * + * @return string|null + */ + public function getUrl() + { + return $this->url; } /** @@ -71,7 +92,7 @@ public function close() protected function write(array $record) { if (!is_resource($this->stream)) { - if (!$this->url) { + if (null === $this->url || '' === $this->url) { throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().'); } $this->createDir(); @@ -93,13 +114,23 @@ protected function write(array $record) flock($this->stream, LOCK_EX); } - fwrite($this->stream, (string) $record['formatted']); + $this->streamWrite($this->stream, $record); if ($this->useLocking) { flock($this->stream, LOCK_UN); } } + /** + * Write to stream + * @param resource $stream + * @param array $record + */ + protected function streamWrite($stream, array $record) + { + fwrite($stream, (string) $record['formatted']); + } + private function customErrorHandler($code, $msg) { $this->errorMessage = preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg); @@ -137,7 +168,7 @@ private function createDir() set_error_handler(array($this, 'customErrorHandler')); $status = mkdir($dir, 0777, true); restore_error_handler(); - if (false === $status) { + if (false === $status && !is_dir($dir)) { throw new \UnexpectedValueException(sprintf('There is no existing directory at "%s" and its not buildable: '.$this->errorMessage, $dir)); } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php index 5c2b156..ac7b16f 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php @@ -12,6 +12,9 @@ namespace Monolog\Handler; use Monolog\Logger; +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\LineFormatter; +use Swift; /** * SwiftMailerHandler uses Swift_Mailer to send the emails @@ -26,8 +29,8 @@ class SwiftMailerHandler extends MailHandler /** * @param \Swift_Mailer $mailer The mailer to use * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, $bubble = true) { @@ -45,11 +48,22 @@ protected function send($content, array $records) $this->mailer->send($this->buildMessage($content, $records)); } + /** + * Gets the formatter for the Swift_Message subject. + * + * @param string $format The format of the subject + * @return FormatterInterface + */ + protected function getSubjectFormatter($format) + { + return new LineFormatter($format); + } + /** * Creates instance of Swift_Message to be sent * - * @param string $content formatted email body to be sent - * @param array $records Log records that formed the content + * @param string $content formatted email body to be sent + * @param array $records Log records that formed the content * @return \Swift_Message */ protected function buildMessage($content, array $records) @@ -66,8 +80,17 @@ protected function buildMessage($content, array $records) throw new \InvalidArgumentException('Could not resolve message as instance of Swift_Message or a callable returning it'); } + if ($records) { + $subjectFormatter = $this->getSubjectFormatter($message->getSubject()); + $message->setSubject($subjectFormatter->format($this->getHighestRecord($records))); + } + $message->setBody($content); - $message->setDate(time()); + if (version_compare(Swift::VERSION, '6.0.0', '>=')) { + $message->setDate(new \DateTimeImmutable()); + } else { + $message->setDate(time()); + } return $message; } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php index 47c73e1..f770c80 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php @@ -32,11 +32,11 @@ class SyslogHandler extends AbstractSyslogHandler protected $logopts; /** - * @param string $ident - * @param mixed $facility - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param int $logopts Option flags for the openlog() call, defaults to LOG_PID + * @param string $ident + * @param mixed $facility + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $logopts Option flags for the openlog() call, defaults to LOG_PID */ public function __construct($ident, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $logopts = LOG_PID) { diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php index 2e32fa7..4dfd5f5 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php @@ -18,22 +18,38 @@ * A Handler for logging to a remote syslogd server. * * @author Jesper Skovgaard Nielsen + * @author Dominik Kukacka */ class SyslogUdpHandler extends AbstractSyslogHandler { + const RFC3164 = 0; + const RFC5424 = 1; + + private $dateFormats = array( + self::RFC3164 => 'M d H:i:s', + self::RFC5424 => \DateTime::RFC3339, + ); + protected $socket; + protected $ident; + protected $rfc; /** - * @param string $host - * @param int $port - * @param mixed $facility - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param string $host + * @param int $port + * @param mixed $facility + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param string $ident Program name or tag for each log message. + * @param int $rfc RFC to format the message for. */ - public function __construct($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true) + public function __construct($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $ident = 'php', $rfc = self::RFC5424) { parent::__construct($facility, $level, $bubble); + $this->ident = $ident; + $this->rfc = $rfc; + $this->socket = new UdpSocket($host, $port ?: 514); } @@ -59,17 +75,43 @@ private function splitMessageIntoLines($message) $message = implode("\n", $message); } - return preg_split('/$\R?^/m', $message); + return preg_split('/$\R?^/m', $message, -1, PREG_SPLIT_NO_EMPTY); } /** - * Make common syslog header (see rfc5424) + * Make common syslog header (see rfc5424 or rfc3164) */ protected function makeCommonSyslogHeader($severity) { $priority = $severity + $this->facility; - return "<$priority>1 "; + if (!$pid = getmypid()) { + $pid = '-'; + } + + if (!$hostname = gethostname()) { + $hostname = '-'; + } + + $date = $this->getDateTime(); + + if ($this->rfc === self::RFC3164) { + return "<$priority>" . + $date . " " . + $hostname . " " . + $this->ident . "[" . $pid . "]: "; + } else { + return "<$priority>1 " . + $date . " " . + $hostname . " " . + $this->ident . " " . + $pid . " - - "; + } + } + + protected function getDateTime() + { + return date($this->dateFormats[$this->rfc]); } /** diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php index e24fa9e..478db0a 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php @@ -18,74 +18,103 @@ * * @author Jordi Boggiano * - * @method boolean hasEmergency($record) - * @method boolean hasAlert($record) - * @method boolean hasCritical($record) - * @method boolean hasError($record) - * @method boolean hasWarning($record) - * @method boolean hasNotice($record) - * @method boolean hasInfo($record) - * @method boolean hasDebug($record) + * @method bool hasEmergency($record) + * @method bool hasAlert($record) + * @method bool hasCritical($record) + * @method bool hasError($record) + * @method bool hasWarning($record) + * @method bool hasNotice($record) + * @method bool hasInfo($record) + * @method bool hasDebug($record) * - * @method boolean hasEmergencyRecords() - * @method boolean hasAlertRecords() - * @method boolean hasCriticalRecords() - * @method boolean hasErrorRecords() - * @method boolean hasWarningRecords() - * @method boolean hasNoticeRecords() - * @method boolean hasInfoRecords() - * @method boolean hasDebugRecords() + * @method bool hasEmergencyRecords() + * @method bool hasAlertRecords() + * @method bool hasCriticalRecords() + * @method bool hasErrorRecords() + * @method bool hasWarningRecords() + * @method bool hasNoticeRecords() + * @method bool hasInfoRecords() + * @method bool hasDebugRecords() * - * @method boolean hasEmergencyThatContains($message) - * @method boolean hasAlertThatContains($message) - * @method boolean hasCriticalThatContains($message) - * @method boolean hasErrorThatContains($message) - * @method boolean hasWarningThatContains($message) - * @method boolean hasNoticeThatContains($message) - * @method boolean hasInfoThatContains($message) - * @method boolean hasDebugThatContains($message) + * @method bool hasEmergencyThatContains($message) + * @method bool hasAlertThatContains($message) + * @method bool hasCriticalThatContains($message) + * @method bool hasErrorThatContains($message) + * @method bool hasWarningThatContains($message) + * @method bool hasNoticeThatContains($message) + * @method bool hasInfoThatContains($message) + * @method bool hasDebugThatContains($message) * - * @method boolean hasEmergencyThatMatches($message) - * @method boolean hasAlertThatMatches($message) - * @method boolean hasCriticalThatMatches($message) - * @method boolean hasErrorThatMatches($message) - * @method boolean hasWarningThatMatches($message) - * @method boolean hasNoticeThatMatches($message) - * @method boolean hasInfoThatMatches($message) - * @method boolean hasDebugThatMatches($message) + * @method bool hasEmergencyThatMatches($message) + * @method bool hasAlertThatMatches($message) + * @method bool hasCriticalThatMatches($message) + * @method bool hasErrorThatMatches($message) + * @method bool hasWarningThatMatches($message) + * @method bool hasNoticeThatMatches($message) + * @method bool hasInfoThatMatches($message) + * @method bool hasDebugThatMatches($message) * - * @method boolean hasEmergencyThatPasses($message) - * @method boolean hasAlertThatPasses($message) - * @method boolean hasCriticalThatPasses($message) - * @method boolean hasErrorThatPasses($message) - * @method boolean hasWarningThatPasses($message) - * @method boolean hasNoticeThatPasses($message) - * @method boolean hasInfoThatPasses($message) - * @method boolean hasDebugThatPasses($message) + * @method bool hasEmergencyThatPasses($message) + * @method bool hasAlertThatPasses($message) + * @method bool hasCriticalThatPasses($message) + * @method bool hasErrorThatPasses($message) + * @method bool hasWarningThatPasses($message) + * @method bool hasNoticeThatPasses($message) + * @method bool hasInfoThatPasses($message) + * @method bool hasDebugThatPasses($message) */ class TestHandler extends AbstractProcessingHandler { protected $records = array(); protected $recordsByLevel = array(); + private $skipReset = false; public function getRecords() { return $this->records; } - protected function hasRecordRecords($level) + public function clear() + { + $this->records = array(); + $this->recordsByLevel = array(); + } + + public function reset() + { + if (!$this->skipReset) { + $this->clear(); + } + } + + public function setSkipReset($skipReset) + { + $this->skipReset = $skipReset; + } + + public function hasRecords($level) { return isset($this->recordsByLevel[$level]); } - protected function hasRecord($record, $level) + /** + * @param string|array $record Either a message string or an array containing message and optionally context keys that will be checked against all records + * @param int $level Logger::LEVEL constant value + */ + public function hasRecord($record, $level) { - if (is_array($record)) { - $record = $record['message']; + if (is_string($record)) { + $record = array('message' => $record); } return $this->hasRecordThatPasses(function ($rec) use ($record) { - return $rec['message'] === $record; + if ($rec['message'] !== $record['message']) { + return false; + } + if (isset($record['context']) && $rec['context'] !== $record['context']) { + return false; + } + return true; }, $level); } @@ -134,7 +163,7 @@ protected function write(array $record) public function __call($method, $args) { if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { - $genericMethod = $matches[1] . 'Record' . $matches[3]; + $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; $level = constant('Monolog\Logger::' . strtoupper($matches[2])); if (method_exists($this, $genericMethod)) { $args[] = $level; diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php index 05a8817..7d7622a 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php @@ -35,6 +35,8 @@ public function handle(array $record) $handler->handle($record); } catch (\Exception $e) { // What failure? + } catch (\Throwable $e) { + // What failure? } } @@ -46,11 +48,24 @@ public function handle(array $record) */ public function handleBatch(array $records) { + if ($this->processors) { + $processed = array(); + foreach ($records as $record) { + foreach ($this->processors as $processor) { + $record = call_user_func($processor, $record); + } + $processed[] = $record; + } + $records = $processed; + } + foreach ($this->handlers as $handler) { try { $handler->handleBatch($records); } catch (\Exception $e) { // What failure? + } catch (\Throwable $e) { + // What failure? } } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php b/application/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php index f22cf21..a20aeae 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php +++ b/application/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php @@ -17,6 +17,7 @@ * Handler sending logs to Zend Monitor * * @author Christian Bergau + * @author Jason Davis */ class ZendMonitorHandler extends AbstractProcessingHandler { @@ -25,16 +26,7 @@ class ZendMonitorHandler extends AbstractProcessingHandler * * @var array */ - protected $levelMap = array( - Logger::DEBUG => 1, - Logger::INFO => 2, - Logger::NOTICE => 3, - Logger::WARNING => 4, - Logger::ERROR => 5, - Logger::CRITICAL => 6, - Logger::ALERT => 7, - Logger::EMERGENCY => 0, - ); + protected $levelMap = array(); /** * Construct @@ -46,8 +38,21 @@ class ZendMonitorHandler extends AbstractProcessingHandler public function __construct($level = Logger::DEBUG, $bubble = true) { if (!function_exists('zend_monitor_custom_event')) { - throw new MissingExtensionException('You must have Zend Server installed in order to use this handler'); + throw new MissingExtensionException( + 'You must have Zend Server installed with Zend Monitor enabled in order to use this handler' + ); } + //zend monitor constants are not defined if zend monitor is not enabled. + $this->levelMap = array( + Logger::DEBUG => \ZEND_MONITOR_EVENT_SEVERITY_INFO, + Logger::INFO => \ZEND_MONITOR_EVENT_SEVERITY_INFO, + Logger::NOTICE => \ZEND_MONITOR_EVENT_SEVERITY_INFO, + Logger::WARNING => \ZEND_MONITOR_EVENT_SEVERITY_WARNING, + Logger::ERROR => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + Logger::CRITICAL => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + Logger::ALERT => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + Logger::EMERGENCY => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + ); parent::__construct($level, $bubble); } @@ -57,22 +62,23 @@ public function __construct($level = Logger::DEBUG, $bubble = true) protected function write(array $record) { $this->writeZendMonitorCustomEvent( - $this->levelMap[$record['level']], + Logger::getLevelName($record['level']), $record['message'], - $record['formatted'] + $record['formatted'], + $this->levelMap[$record['level']] ); } /** - * Write a record to Zend Monitor - * - * @param int $level - * @param string $message - * @param array $formatted + * Write to Zend Monitor Events + * @param string $type Text displayed in "Class Name (custom)" field + * @param string $message Text displayed in "Error String" + * @param mixed $formatted Displayed in Custom Variables tab + * @param int $severity Set the event severity level (-1,0,1) */ - protected function writeZendMonitorCustomEvent($level, $message, $formatted) + protected function writeZendMonitorCustomEvent($type, $message, $formatted, $severity) { - zend_monitor_custom_event($level, $message, $formatted); + zend_monitor_custom_event($type, $message, $formatted, $severity); } /** diff --git a/application/vendor/monolog/monolog/src/Monolog/Logger.php b/application/vendor/monolog/monolog/src/Monolog/Logger.php index d31a098..05dfc81 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Logger.php +++ b/application/vendor/monolog/monolog/src/Monolog/Logger.php @@ -15,6 +15,7 @@ use Monolog\Handler\StreamHandler; use Psr\Log\LoggerInterface; use Psr\Log\InvalidArgumentException; +use Exception; /** * Monolog log channel @@ -24,7 +25,7 @@ * * @author Jordi Boggiano */ -class Logger implements LoggerInterface +class Logger implements LoggerInterface, ResettableInterface { /** * Detailed debug information @@ -92,14 +93,14 @@ class Logger implements LoggerInterface * @var array $levels Logging levels */ protected static $levels = array( - 100 => 'DEBUG', - 200 => 'INFO', - 250 => 'NOTICE', - 300 => 'WARNING', - 400 => 'ERROR', - 500 => 'CRITICAL', - 550 => 'ALERT', - 600 => 'EMERGENCY', + self::DEBUG => 'DEBUG', + self::INFO => 'INFO', + self::NOTICE => 'NOTICE', + self::WARNING => 'WARNING', + self::ERROR => 'ERROR', + self::CRITICAL => 'CRITICAL', + self::ALERT => 'ALERT', + self::EMERGENCY => 'EMERGENCY', ); /** @@ -128,6 +129,16 @@ class Logger implements LoggerInterface */ protected $processors; + /** + * @var bool + */ + protected $microsecondTimestamps = true; + + /** + * @var callable + */ + protected $exceptionHandler; + /** * @param string $name The logging channel * @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc. @@ -136,7 +147,7 @@ class Logger implements LoggerInterface public function __construct($name, array $handlers = array(), array $processors = array()) { $this->name = $name; - $this->handlers = $handlers; + $this->setHandlers($handlers); $this->processors = $processors; } @@ -148,10 +159,23 @@ public function getName() return $this->name; } + /** + * Return a new cloned instance with the name changed + * + * @return static + */ + public function withName($name) + { + $new = clone $this; + $new->name = $name; + + return $new; + } + /** * Pushes a handler on to the stack. * - * @param HandlerInterface $handler + * @param HandlerInterface $handler * @return $this */ public function pushHandler(HandlerInterface $handler) @@ -180,7 +204,7 @@ public function popHandler() * * If a map is passed, keys will be ignored. * - * @param HandlerInterface[] $handlers + * @param HandlerInterface[] $handlers * @return $this */ public function setHandlers(array $handlers) @@ -204,7 +228,7 @@ public function getHandlers() /** * Adds a processor on to the stack. * - * @param callable $callback + * @param callable $callback * @return $this */ public function pushProcessor($callback) @@ -239,13 +263,31 @@ public function getProcessors() return $this->processors; } + /** + * Control the use of microsecond resolution timestamps in the 'datetime' + * member of new records. + * + * Generating microsecond resolution timestamps by calling + * microtime(true), formatting the result via sprintf() and then parsing + * the resulting string via \DateTime::createFromFormat() can incur + * a measurable runtime overhead vs simple usage of DateTime to capture + * a second resolution timestamp in systems which generate a large number + * of log events. + * + * @param bool $micro True to use microtime() to create timestamps + */ + public function useMicrosecondTimestamps($micro) + { + $this->microsecondTimestamps = (bool) $micro; + } + /** * Adds a log record. * - * @param integer $level The logging level + * @param int $level The logging level * @param string $message The log message * @param array $context The log context - * @return Boolean Whether the record has been processed + * @return bool Whether the record has been processed */ public function addRecord($level, $message, array $context = array()) { @@ -257,11 +299,14 @@ public function addRecord($level, $message, array $context = array()) // check if any handler will handle this message so we can return early and save cycles $handlerKey = null; - foreach ($this->handlers as $key => $handler) { + reset($this->handlers); + while ($handler = current($this->handlers)) { if ($handler->isHandling(array('level' => $level))) { - $handlerKey = $key; + $handlerKey = key($this->handlers); break; } + + next($this->handlers); } if (null === $handlerKey) { @@ -272,33 +317,93 @@ public function addRecord($level, $message, array $context = array()) static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC'); } + // php7.1+ always has microseconds enabled, so we do not need this hack + if ($this->microsecondTimestamps && PHP_VERSION_ID < 70100) { + $ts = \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone); + } else { + $ts = new \DateTime(null, static::$timezone); + } + $ts->setTimezone(static::$timezone); + $record = array( 'message' => (string) $message, 'context' => $context, 'level' => $level, 'level_name' => $levelName, 'channel' => $this->name, - 'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone)->setTimezone(static::$timezone), + 'datetime' => $ts, 'extra' => array(), ); - foreach ($this->processors as $processor) { - $record = call_user_func($processor, $record); - } - while (isset($this->handlers[$handlerKey]) && - false === $this->handlers[$handlerKey]->handle($record)) { - $handlerKey++; + try { + foreach ($this->processors as $processor) { + $record = call_user_func($processor, $record); + } + + while ($handler = current($this->handlers)) { + if (true === $handler->handle($record)) { + break; + } + + next($this->handlers); + } + } catch (Exception $e) { + $this->handleException($e, $record); } return true; } + /** + * Ends a log cycle and frees all resources used by handlers. + * + * Closing a Handler means flushing all buffers and freeing any open resources/handles. + * Handlers that have been closed should be able to accept log records again and re-open + * themselves on demand, but this may not always be possible depending on implementation. + * + * This is useful at the end of a request and will be called automatically on every handler + * when they get destructed. + */ + public function close() + { + foreach ($this->handlers as $handler) { + if (method_exists($handler, 'close')) { + $handler->close(); + } + } + } + + /** + * Ends a log cycle and resets all handlers and processors to their initial state. + * + * Resetting a Handler or a Processor means flushing/cleaning all buffers, resetting internal + * state, and getting it back to a state in which it can receive log records again. + * + * This is useful in case you want to avoid logs leaking between two requests or jobs when you + * have a long running process like a worker or an application server serving multiple requests + * in one process. + */ + public function reset() + { + foreach ($this->handlers as $handler) { + if ($handler instanceof ResettableInterface) { + $handler->reset(); + } + } + + foreach ($this->processors as $processor) { + if ($processor instanceof ResettableInterface) { + $processor->reset(); + } + } + } + /** * Adds a log record at the DEBUG level. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function addDebug($message, array $context = array()) { @@ -308,9 +413,9 @@ public function addDebug($message, array $context = array()) /** * Adds a log record at the INFO level. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function addInfo($message, array $context = array()) { @@ -320,9 +425,9 @@ public function addInfo($message, array $context = array()) /** * Adds a log record at the NOTICE level. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function addNotice($message, array $context = array()) { @@ -332,9 +437,9 @@ public function addNotice($message, array $context = array()) /** * Adds a log record at the WARNING level. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function addWarning($message, array $context = array()) { @@ -344,9 +449,9 @@ public function addWarning($message, array $context = array()) /** * Adds a log record at the ERROR level. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function addError($message, array $context = array()) { @@ -356,9 +461,9 @@ public function addError($message, array $context = array()) /** * Adds a log record at the CRITICAL level. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function addCritical($message, array $context = array()) { @@ -368,9 +473,9 @@ public function addCritical($message, array $context = array()) /** * Adds a log record at the ALERT level. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function addAlert($message, array $context = array()) { @@ -380,9 +485,9 @@ public function addAlert($message, array $context = array()) /** * Adds a log record at the EMERGENCY level. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function addEmergency($message, array $context = array()) { @@ -402,7 +507,7 @@ public static function getLevels() /** * Gets the name of the logging level. * - * @param integer $level + * @param int $level * @return string */ public static function getLevelName($level) @@ -432,8 +537,8 @@ public static function toMonologLevel($level) /** * Checks whether the Logger has a handler that listens on the given level * - * @param integer $level - * @return Boolean + * @param int $level + * @return bool */ public function isHandling($level) { @@ -450,15 +555,52 @@ public function isHandling($level) return false; } + /** + * Set a custom exception handler + * + * @param callable $callback + * @return $this + */ + public function setExceptionHandler($callback) + { + if (!is_callable($callback)) { + throw new \InvalidArgumentException('Exception handler must be valid callable (callback or object with an __invoke method), '.var_export($callback, true).' given'); + } + $this->exceptionHandler = $callback; + + return $this; + } + + /** + * @return callable + */ + public function getExceptionHandler() + { + return $this->exceptionHandler; + } + + /** + * Delegates exception management to the custom exception handler, + * or throws the exception if no custom handler is set. + */ + protected function handleException(Exception $e, array $record) + { + if (!$this->exceptionHandler) { + throw $e; + } + + call_user_func($this->exceptionHandler, $e, $record); + } + /** * Adds a log record at an arbitrary level. * * This method allows for compatibility with common interfaces. * * @param mixed $level The log level - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function log($level, $message, array $context = array()) { @@ -472,9 +614,9 @@ public function log($level, $message, array $context = array()) * * This method allows for compatibility with common interfaces. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function debug($message, array $context = array()) { @@ -486,9 +628,9 @@ public function debug($message, array $context = array()) * * This method allows for compatibility with common interfaces. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function info($message, array $context = array()) { @@ -500,9 +642,9 @@ public function info($message, array $context = array()) * * This method allows for compatibility with common interfaces. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function notice($message, array $context = array()) { @@ -514,9 +656,9 @@ public function notice($message, array $context = array()) * * This method allows for compatibility with common interfaces. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function warn($message, array $context = array()) { @@ -528,9 +670,9 @@ public function warn($message, array $context = array()) * * This method allows for compatibility with common interfaces. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function warning($message, array $context = array()) { @@ -542,9 +684,9 @@ public function warning($message, array $context = array()) * * This method allows for compatibility with common interfaces. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function err($message, array $context = array()) { @@ -556,9 +698,9 @@ public function err($message, array $context = array()) * * This method allows for compatibility with common interfaces. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function error($message, array $context = array()) { @@ -570,9 +712,9 @@ public function error($message, array $context = array()) * * This method allows for compatibility with common interfaces. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function crit($message, array $context = array()) { @@ -584,9 +726,9 @@ public function crit($message, array $context = array()) * * This method allows for compatibility with common interfaces. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function critical($message, array $context = array()) { @@ -598,9 +740,9 @@ public function critical($message, array $context = array()) * * This method allows for compatibility with common interfaces. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function alert($message, array $context = array()) { @@ -612,9 +754,9 @@ public function alert($message, array $context = array()) * * This method allows for compatibility with common interfaces. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function emerg($message, array $context = array()) { @@ -626,9 +768,9 @@ public function emerg($message, array $context = array()) * * This method allows for compatibility with common interfaces. * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ public function emergency($message, array $context = array()) { diff --git a/application/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php b/application/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php index 1899400..9fc3f50 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php +++ b/application/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php @@ -19,7 +19,7 @@ * @author Nick Otter * @author Jordi Boggiano */ -class GitProcessor +class GitProcessor implements ProcessorInterface { private $level; private static $cache; diff --git a/application/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php b/application/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php index 8f553fe..6ae192a 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php +++ b/application/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php @@ -24,21 +24,24 @@ * * @author Jordi Boggiano */ -class IntrospectionProcessor +class IntrospectionProcessor implements ProcessorInterface { private $level; private $skipClassesPartials; + private $skipStackFramesCount; + private $skipFunctions = array( 'call_user_func', 'call_user_func_array', ); - public function __construct($level = Logger::DEBUG, array $skipClassesPartials = array()) + public function __construct($level = Logger::DEBUG, array $skipClassesPartials = array(), $skipStackFramesCount = 0) { $this->level = Logger::toMonologLevel($level); $this->skipClassesPartials = array_merge(array('Monolog\\'), $skipClassesPartials); + $this->skipStackFramesCount = $skipStackFramesCount; } /** @@ -52,7 +55,12 @@ public function __invoke(array $record) return $record; } - $trace = debug_backtrace(); + /* + * http://php.net/manual/en/function.debug-backtrace.php + * As of 5.3.6, DEBUG_BACKTRACE_IGNORE_ARGS option was added. + * Any version less than 5.3.6 must use the DEBUG_BACKTRACE_IGNORE_ARGS constant value '2'. + */ + $trace = debug_backtrace((PHP_VERSION_ID < 50306) ? 2 : DEBUG_BACKTRACE_IGNORE_ARGS); // skip first since it's always the current method array_shift($trace); @@ -77,6 +85,8 @@ public function __invoke(array $record) break; } + $i += $this->skipStackFramesCount; + // we should have the call source now $record['extra'] = array_merge( $record['extra'], diff --git a/application/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php b/application/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php index eb802c0..2a379a3 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php +++ b/application/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php @@ -16,26 +16,26 @@ * * @author Rob Jensen */ -abstract class MemoryProcessor +abstract class MemoryProcessor implements ProcessorInterface { /** - * @var boolean If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported. + * @var bool If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported. */ protected $realUsage; /** - * @var boolean If true, then format memory size to human readable string (MB, KB, B depending on size) + * @var bool If true, then format memory size to human readable string (MB, KB, B depending on size) */ protected $useFormatting; /** - * @param boolean $realUsage Set this to true to get the real size of memory allocated from system. - * @param boolean $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size) + * @param bool $realUsage Set this to true to get the real size of memory allocated from system. + * @param bool $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size) */ public function __construct($realUsage = true, $useFormatting = true) { - $this->realUsage = (boolean) $realUsage; - $this->useFormatting = (boolean) $useFormatting; + $this->realUsage = (bool) $realUsage; + $this->useFormatting = (bool) $useFormatting; } /** diff --git a/application/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php b/application/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php new file mode 100644 index 0000000..2f5b326 --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\Logger; + +/** + * Injects Hg branch and Hg revision number in all records + * + * @author Jonathan A. Schweder + */ +class MercurialProcessor implements ProcessorInterface +{ + private $level; + private static $cache; + + public function __construct($level = Logger::DEBUG) + { + $this->level = Logger::toMonologLevel($level); + } + + /** + * @param array $record + * @return array + */ + public function __invoke(array $record) + { + // return if the level is not high enough + if ($record['level'] < $this->level) { + return $record; + } + + $record['extra']['hg'] = self::getMercurialInfo(); + + return $record; + } + + private static function getMercurialInfo() + { + if (self::$cache) { + return self::$cache; + } + + $result = explode(' ', trim(`hg id -nb`)); + if (count($result) >= 3) { + return self::$cache = array( + 'branch' => $result[1], + 'revision' => $result[2], + ); + } + + return self::$cache = array(); + } +} diff --git a/application/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php b/application/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php index 9d3f559..66b80fb 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php +++ b/application/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php @@ -16,7 +16,7 @@ * * @author Andreas Hörnicke */ -class ProcessIdProcessor +class ProcessIdProcessor implements ProcessorInterface { /** * @param array $record diff --git a/application/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php b/application/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php new file mode 100644 index 0000000..7e64d4d --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * An optional interface to allow labelling Monolog processors. + * + * @author Nicolas Grekas + */ +interface ProcessorInterface +{ + /** + * @return array The processed records + */ + public function __invoke(array $records); +} diff --git a/application/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php b/application/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php index c2686ce..0088505 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php +++ b/application/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php @@ -11,6 +11,8 @@ namespace Monolog\Processor; +use Monolog\Utils; + /** * Processes a record's message according to PSR-3 rules * @@ -18,7 +20,7 @@ * * @author Jordi Boggiano */ -class PsrLogMessageProcessor +class PsrLogMessageProcessor implements ProcessorInterface { /** * @param array $record @@ -35,7 +37,7 @@ public function __invoke(array $record) if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) { $replacements['{'.$key.'}'] = $val; } elseif (is_object($val)) { - $replacements['{'.$key.'}'] = '[object '.get_class($val).']'; + $replacements['{'.$key.'}'] = '[object '.Utils::getClass($val).']'; } else { $replacements['{'.$key.'}'] = '['.gettype($val).']'; } diff --git a/application/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php b/application/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php index 7e2df2a..615a4d9 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php +++ b/application/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php @@ -16,7 +16,7 @@ * * @author Martijn Riemers */ -class TagProcessor +class TagProcessor implements ProcessorInterface { private $tags; diff --git a/application/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php b/application/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php index 812707c..d1f708c 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php +++ b/application/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php @@ -11,12 +11,14 @@ namespace Monolog\Processor; +use Monolog\ResettableInterface; + /** * Adds a unique identifier into records * * @author Simon Mönch */ -class UidProcessor +class UidProcessor implements ProcessorInterface, ResettableInterface { private $uid; @@ -26,7 +28,8 @@ public function __construct($length = 7) throw new \InvalidArgumentException('The uid length must be an integer between 1 and 32'); } - $this->uid = substr(hash('md5', uniqid('', true)), 0, $length); + + $this->uid = $this->generateUid($length); } public function __invoke(array $record) @@ -43,4 +46,14 @@ public function getUid() { return $this->uid; } + + public function reset() + { + $this->uid = $this->generateUid(strlen($this->uid)); + } + + private function generateUid($length) + { + return substr(hash('md5', uniqid('', true)), 0, $length); + } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php b/application/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php index 21f22a6..684188f 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php +++ b/application/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php @@ -16,7 +16,7 @@ * * @author Jordi Boggiano */ -class WebProcessor +class WebProcessor implements ProcessorInterface { /** * @var array|\ArrayAccess @@ -24,6 +24,10 @@ class WebProcessor protected $serverData; /** + * Default fields + * + * Array is structured as [key in record.extra => key in $serverData] + * * @var array */ protected $extraFields = array( @@ -36,7 +40,7 @@ class WebProcessor /** * @param array|\ArrayAccess $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data - * @param array|null $extraFields Extra field names to be added (all available by default) + * @param array|null $extraFields Field names and the related key inside $serverData to be added. If not provided it defaults to: url, ip, http_method, server, referrer */ public function __construct($serverData = null, array $extraFields = null) { @@ -49,10 +53,14 @@ public function __construct($serverData = null, array $extraFields = null) } if (null !== $extraFields) { - foreach (array_keys($this->extraFields) as $fieldName) { - if (!in_array($fieldName, $extraFields)) { - unset($this->extraFields[$fieldName]); + if (isset($extraFields[0])) { + foreach (array_keys($this->extraFields) as $fieldName) { + if (!in_array($fieldName, $extraFields)) { + unset($this->extraFields[$fieldName]); + } } + } else { + $this->extraFields = $extraFields; } } } diff --git a/application/vendor/monolog/monolog/src/Monolog/Registry.php b/application/vendor/monolog/monolog/src/Monolog/Registry.php index a33cb7c..159b751 100644 --- a/application/vendor/monolog/monolog/src/Monolog/Registry.php +++ b/application/vendor/monolog/monolog/src/Monolog/Registry.php @@ -49,7 +49,7 @@ class Registry * * @param Logger $logger Instance of the logging channel * @param string|null $name Name of the logging channel ($logger->getName() by default) - * @param boolean $overwrite Overwrite instance in the registry if the given name already exists? + * @param bool $overwrite Overwrite instance in the registry if the given name already exists? * @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists */ public static function addLogger(Logger $logger, $name = null, $overwrite = false) @@ -107,8 +107,8 @@ public static function clear() * Gets Logger instance from the registry * * @param string $name Name of the requested Logger instance - * @return Logger Requested instance of Logger * @throws \InvalidArgumentException If named Logger instance is not in the registry + * @return Logger Requested instance of Logger */ public static function getInstance($name) { @@ -124,8 +124,8 @@ public static function getInstance($name) * * @param string $name Name of the requested Logger instance * @param array $arguments Arguments passed to static method call - * @return Logger Requested instance of Logger * @throws \InvalidArgumentException If named Logger instance is not in the registry + * @return Logger Requested instance of Logger */ public static function __callStatic($name, $arguments) { diff --git a/application/vendor/monolog/monolog/src/Monolog/ResettableInterface.php b/application/vendor/monolog/monolog/src/Monolog/ResettableInterface.php new file mode 100644 index 0000000..635bc77 --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/ResettableInterface.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +/** + * Handler or Processor implementing this interface will be reset when Logger::reset() is called. + * + * Resetting ends a log cycle gets them back to their initial state. + * + * Resetting a Handler or a Processor means flushing/cleaning all buffers, resetting internal + * state, and getting it back to a state in which it can receive log records again. + * + * This is useful in case you want to avoid logs leaking between two requests or jobs when you + * have a long running process like a worker or an application server serving multiple requests + * in one process. + * + * @author Grégoire Pineau + */ +interface ResettableInterface +{ + public function reset(); +} diff --git a/application/vendor/monolog/monolog/src/Monolog/SignalHandler.php b/application/vendor/monolog/monolog/src/Monolog/SignalHandler.php new file mode 100644 index 0000000..d87018f --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/SignalHandler.php @@ -0,0 +1,115 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use Psr\Log\LoggerInterface; +use Psr\Log\LogLevel; +use ReflectionExtension; + +/** + * Monolog POSIX signal handler + * + * @author Robert Gust-Bardon + */ +class SignalHandler +{ + private $logger; + + private $previousSignalHandler = array(); + private $signalLevelMap = array(); + private $signalRestartSyscalls = array(); + + public function __construct(LoggerInterface $logger) + { + $this->logger = $logger; + } + + public function registerSignalHandler($signo, $level = LogLevel::CRITICAL, $callPrevious = true, $restartSyscalls = true, $async = true) + { + if (!extension_loaded('pcntl') || !function_exists('pcntl_signal')) { + return $this; + } + + if ($callPrevious) { + if (function_exists('pcntl_signal_get_handler')) { + $handler = pcntl_signal_get_handler($signo); + if ($handler === false) { + return $this; + } + $this->previousSignalHandler[$signo] = $handler; + } else { + $this->previousSignalHandler[$signo] = true; + } + } else { + unset($this->previousSignalHandler[$signo]); + } + $this->signalLevelMap[$signo] = $level; + $this->signalRestartSyscalls[$signo] = $restartSyscalls; + + if (function_exists('pcntl_async_signals') && $async !== null) { + pcntl_async_signals($async); + } + + pcntl_signal($signo, array($this, 'handleSignal'), $restartSyscalls); + + return $this; + } + + public function handleSignal($signo, array $siginfo = null) + { + static $signals = array(); + + if (!$signals && extension_loaded('pcntl')) { + $pcntl = new ReflectionExtension('pcntl'); + $constants = $pcntl->getConstants(); + if (!$constants) { + // HHVM 3.24.2 returns an empty array. + $constants = get_defined_constants(true); + $constants = $constants['Core']; + } + foreach ($constants as $name => $value) { + if (substr($name, 0, 3) === 'SIG' && $name[3] !== '_' && is_int($value)) { + $signals[$value] = $name; + } + } + unset($constants); + } + + $level = isset($this->signalLevelMap[$signo]) ? $this->signalLevelMap[$signo] : LogLevel::CRITICAL; + $signal = isset($signals[$signo]) ? $signals[$signo] : $signo; + $context = isset($siginfo) ? $siginfo : array(); + $this->logger->log($level, sprintf('Program received signal %s', $signal), $context); + + if (!isset($this->previousSignalHandler[$signo])) { + return; + } + + if ($this->previousSignalHandler[$signo] === true || $this->previousSignalHandler[$signo] === SIG_DFL) { + if (extension_loaded('pcntl') && function_exists('pcntl_signal') && function_exists('pcntl_sigprocmask') && function_exists('pcntl_signal_dispatch') + && extension_loaded('posix') && function_exists('posix_getpid') && function_exists('posix_kill')) { + $restartSyscalls = isset($this->signalRestartSyscalls[$signo]) ? $this->signalRestartSyscalls[$signo] : true; + pcntl_signal($signo, SIG_DFL, $restartSyscalls); + pcntl_sigprocmask(SIG_UNBLOCK, array($signo), $oldset); + posix_kill(posix_getpid(), $signo); + pcntl_signal_dispatch(); + pcntl_sigprocmask(SIG_SETMASK, $oldset); + pcntl_signal($signo, array($this, 'handleSignal'), $restartSyscalls); + } + } elseif (is_callable($this->previousSignalHandler[$signo])) { + if (PHP_VERSION_ID >= 70100) { + $this->previousSignalHandler[$signo]($signo, $siginfo); + } else { + $this->previousSignalHandler[$signo]($signo); + } + } + } +} diff --git a/application/vendor/monolog/monolog/src/Monolog/Utils.php b/application/vendor/monolog/monolog/src/Monolog/Utils.php new file mode 100644 index 0000000..eb9be86 --- /dev/null +++ b/application/vendor/monolog/monolog/src/Monolog/Utils.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +class Utils +{ + /** + * @internal + */ + public static function getClass($object) + { + $class = \get_class($object); + + return 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).'@anonymous' : $class; + } +} diff --git a/application/vendor/monolog/monolog/tests/Monolog/ErrorHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/ErrorHandlerTest.php deleted file mode 100644 index a9a3f30..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/ErrorHandlerTest.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog; - -use Monolog\Handler\TestHandler; - -class ErrorHandlerTest extends \PHPUnit_Framework_TestCase -{ - public function testHandleError() - { - $logger = new Logger('test', array($handler = new TestHandler)); - $errHandler = new ErrorHandler($logger); - - $errHandler->registerErrorHandler(array(E_USER_NOTICE => Logger::EMERGENCY), false); - trigger_error('Foo', E_USER_ERROR); - $this->assertCount(1, $handler->getRecords()); - $this->assertTrue($handler->hasErrorRecords()); - trigger_error('Foo', E_USER_NOTICE); - $this->assertCount(2, $handler->getRecords()); - $this->assertTrue($handler->hasEmergencyRecords()); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php b/application/vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php deleted file mode 100644 index e7f7334..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php +++ /dev/null @@ -1,158 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; - -class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers Monolog\Formatter\ChromePHPFormatter::format - */ - public function testDefaultFormat() - { - $formatter = new ChromePHPFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('ip' => '127.0.0.1'), - 'message' => 'log', - ); - - $message = $formatter->format($record); - - $this->assertEquals( - array( - 'meh', - array( - 'message' => 'log', - 'context' => array('from' => 'logger'), - 'extra' => array('ip' => '127.0.0.1'), - ), - 'unknown', - 'error' - ), - $message - ); - } - - /** - * @covers Monolog\Formatter\ChromePHPFormatter::format - */ - public function testFormatWithFileAndLine() - { - $formatter = new ChromePHPFormatter(); - $record = array( - 'level' => Logger::CRITICAL, - 'level_name' => 'CRITICAL', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('ip' => '127.0.0.1', 'file' => 'test', 'line' => 14), - 'message' => 'log', - ); - - $message = $formatter->format($record); - - $this->assertEquals( - array( - 'meh', - array( - 'message' => 'log', - 'context' => array('from' => 'logger'), - 'extra' => array('ip' => '127.0.0.1'), - ), - 'test : 14', - 'error' - ), - $message - ); - } - - /** - * @covers Monolog\Formatter\ChromePHPFormatter::format - */ - public function testFormatWithoutContext() - { - $formatter = new ChromePHPFormatter(); - $record = array( - 'level' => Logger::DEBUG, - 'level_name' => 'DEBUG', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $message = $formatter->format($record); - - $this->assertEquals( - array( - 'meh', - 'log', - 'unknown', - 'log' - ), - $message - ); - } - - /** - * @covers Monolog\Formatter\ChromePHPFormatter::formatBatch - */ - public function testBatchFormatThrowException() - { - $formatter = new ChromePHPFormatter(); - $records = array( - array( - 'level' => Logger::INFO, - 'level_name' => 'INFO', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ), - array( - 'level' => Logger::WARNING, - 'level_name' => 'WARNING', - 'channel' => 'foo', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log2', - ), - ); - - $this->assertEquals( - array( - array( - 'meh', - 'log', - 'unknown', - 'info' - ), - array( - 'foo', - 'log2', - 'unknown', - 'warn' - ), - ), - $formatter->formatBatch($records) - ); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php b/application/vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php deleted file mode 100644 index 546e5c2..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; - -class ElasticaFormatterTest extends \PHPUnit_Framework_TestCase -{ - public function setUp() - { - if (!class_exists("Elastica\Document")) { - $this->markTestSkipped("ruflin/elastica not installed"); - } - } - - /** - * @covers Monolog\Formatter\ElasticaFormatter::__construct - * @covers Monolog\Formatter\ElasticaFormatter::format - * @covers Monolog\Formatter\ElasticaFormatter::getDocument - */ - public function testFormat() - { - // test log message - $msg = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - // expected values - $expected = $msg; - $expected['datetime'] = '1970-01-01T00:00:00+0000'; - $expected['context'] = array( - 'class' => '[object] (stdClass: {})', - 'foo' => 7, - 0 => 'bar', - ); - - // format log message - $formatter = new ElasticaFormatter('my_index', 'doc_type'); - $doc = $formatter->format($msg); - $this->assertInstanceOf('Elastica\Document', $doc); - - // Document parameters - $params = $doc->getParams(); - $this->assertEquals('my_index', $params['_index']); - $this->assertEquals('doc_type', $params['_type']); - - // Document data values - $data = $doc->getData(); - foreach (array_keys($expected) as $key) { - $this->assertEquals($expected[$key], $data[$key]); - } - } - - /** - * @covers Monolog\Formatter\ElasticaFormatter::getIndex - * @covers Monolog\Formatter\ElasticaFormatter::getType - */ - public function testGetters() - { - $formatter = new ElasticaFormatter('my_index', 'doc_type'); - $this->assertEquals('my_index', $formatter->getIndex()); - $this->assertEquals('doc_type', $formatter->getType()); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php b/application/vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php deleted file mode 100644 index 1b2fd97..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; -use Monolog\TestCase; - -class FlowdockFormatterTest extends TestCase -{ - /** - * @covers Monolog\Formatter\FlowdockFormatter::format - */ - public function testFormat() - { - $formatter = new FlowdockFormatter('test_source', 'source@test.com'); - $record = $this->getRecord(); - - $expected = array( - 'source' => 'test_source', - 'from_address' => 'source@test.com', - 'subject' => 'in test_source: WARNING - test', - 'content' => 'test', - 'tags' => array('#logs', '#warning', '#test'), - 'project' => 'test_source', - ); - $formatted = $formatter->format($record); - - $this->assertEquals($expected, $formatted['flowdock']); - } - - /** - * @ covers Monolog\Formatter\FlowdockFormatter::formatBatch - */ - public function testFormatBatch() - { - $formatter = new FlowdockFormatter('test_source', 'source@test.com'); - $records = array( - $this->getRecord(Logger::WARNING), - $this->getRecord(Logger::DEBUG), - ); - $formatted = $formatter->formatBatch($records); - - $this->assertArrayHasKey('flowdock', $formatted[0]); - $this->assertArrayHasKey('flowdock', $formatted[1]); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php b/application/vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php deleted file mode 100644 index 6ac1485..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php +++ /dev/null @@ -1,204 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; - -class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase -{ - public function setUp() - { - if (!class_exists('\Gelf\Message')) { - $this->markTestSkipped("graylog2/gelf-php or mlehner/gelf-php is not installed"); - } - } - - /** - * @covers Monolog\Formatter\GelfMessageFormatter::format - */ - public function testDefaultFormatter() - { - $formatter = new GelfMessageFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - $this->assertEquals(0, $message->getTimestamp()); - $this->assertEquals('log', $message->getShortMessage()); - $this->assertEquals('meh', $message->getFacility()); - $this->assertEquals(null, $message->getLine()); - $this->assertEquals(null, $message->getFile()); - $this->assertEquals($this->isLegacy() ? 3 : 'error', $message->getLevel()); - $this->assertNotEmpty($message->getHost()); - - $formatter = new GelfMessageFormatter('mysystem'); - - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - $this->assertEquals('mysystem', $message->getHost()); - } - - /** - * @covers Monolog\Formatter\GelfMessageFormatter::format - */ - public function testFormatWithFileAndLine() - { - $formatter = new GelfMessageFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('file' => 'test', 'line' => 14), - 'message' => 'log', - ); - - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - $this->assertEquals('test', $message->getFile()); - $this->assertEquals(14, $message->getLine()); - } - - /** - * @covers Monolog\Formatter\GelfMessageFormatter::format - * @expectedException InvalidArgumentException - */ - public function testFormatInvalidFails() - { - $formatter = new GelfMessageFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - ); - - $formatter->format($record); - } - - /** - * @covers Monolog\Formatter\GelfMessageFormatter::format - */ - public function testFormatWithContext() - { - $formatter = new GelfMessageFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log' - ); - - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - - $message_array = $message->toArray(); - - $this->assertArrayHasKey('_ctxt_from', $message_array); - $this->assertEquals('logger', $message_array['_ctxt_from']); - - // Test with extraPrefix - $formatter = new GelfMessageFormatter(null, null, 'CTX'); - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - - $message_array = $message->toArray(); - - $this->assertArrayHasKey('_CTXfrom', $message_array); - $this->assertEquals('logger', $message_array['_CTXfrom']); - } - - /** - * @covers Monolog\Formatter\GelfMessageFormatter::format - */ - public function testFormatWithContextContainingException() - { - $formatter = new GelfMessageFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger', 'exception' => array( - 'class' => '\Exception', - 'file' => '/some/file/in/dir.php:56', - 'trace' => array('/some/file/1.php:23', '/some/file/2.php:3') - )), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log' - ); - - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - - $this->assertEquals("/some/file/in/dir.php", $message->getFile()); - $this->assertEquals("56", $message->getLine()); - } - - /** - * @covers Monolog\Formatter\GelfMessageFormatter::format - */ - public function testFormatWithExtra() - { - $formatter = new GelfMessageFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log' - ); - - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - - $message_array = $message->toArray(); - - $this->assertArrayHasKey('_key', $message_array); - $this->assertEquals('pair', $message_array['_key']); - - // Test with extraPrefix - $formatter = new GelfMessageFormatter(null, 'EXT'); - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - - $message_array = $message->toArray(); - - $this->assertArrayHasKey('_EXTkey', $message_array); - $this->assertEquals('pair', $message_array['_EXTkey']); - } - - private function isLegacy() - { - return interface_exists('\Gelf\IMessagePublisher'); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php b/application/vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php deleted file mode 100644 index 69e2007..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; -use Monolog\TestCase; - -class JsonFormatterTest extends TestCase -{ - /** - * @covers Monolog\Formatter\JsonFormatter::__construct - * @covers Monolog\Formatter\JsonFormatter::getBatchMode - * @covers Monolog\Formatter\JsonFormatter::isAppendingNewlines - */ - public function testConstruct() - { - $formatter = new JsonFormatter(); - $this->assertEquals(JsonFormatter::BATCH_MODE_JSON, $formatter->getBatchMode()); - $this->assertEquals(true, $formatter->isAppendingNewlines()); - $formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_NEWLINES, false); - $this->assertEquals(JsonFormatter::BATCH_MODE_NEWLINES, $formatter->getBatchMode()); - $this->assertEquals(false, $formatter->isAppendingNewlines()); - } - - /** - * @covers Monolog\Formatter\JsonFormatter::format - */ - public function testFormat() - { - $formatter = new JsonFormatter(); - $record = $this->getRecord(); - $this->assertEquals(json_encode($record)."\n", $formatter->format($record)); - - $formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false); - $record = $this->getRecord(); - $this->assertEquals(json_encode($record), $formatter->format($record)); - } - - /** - * @covers Monolog\Formatter\JsonFormatter::formatBatch - * @covers Monolog\Formatter\JsonFormatter::formatBatchJson - */ - public function testFormatBatch() - { - $formatter = new JsonFormatter(); - $records = array( - $this->getRecord(Logger::WARNING), - $this->getRecord(Logger::DEBUG), - ); - $this->assertEquals(json_encode($records), $formatter->formatBatch($records)); - } - - /** - * @covers Monolog\Formatter\JsonFormatter::formatBatch - * @covers Monolog\Formatter\JsonFormatter::formatBatchNewlines - */ - public function testFormatBatchNewlines() - { - $formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_NEWLINES); - $records = $expected = array( - $this->getRecord(Logger::WARNING), - $this->getRecord(Logger::DEBUG), - ); - array_walk($expected, function (&$value, $key) { - $value = json_encode($value); - }); - $this->assertEquals(implode("\n", $expected), $formatter->formatBatch($records)); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php b/application/vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php deleted file mode 100644 index 875bd57..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php +++ /dev/null @@ -1,208 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -/** - * @covers Monolog\Formatter\LineFormatter - */ -class LineFormatterTest extends \PHPUnit_Framework_TestCase -{ - public function testDefFormatWithString() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $message = $formatter->format(array( - 'level_name' => 'WARNING', - 'channel' => 'log', - 'context' => array(), - 'message' => 'foo', - 'datetime' => new \DateTime, - 'extra' => array(), - )); - $this->assertEquals('['.date('Y-m-d').'] log.WARNING: foo [] []'."\n", $message); - } - - public function testDefFormatWithArrayContext() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $message = $formatter->format(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'message' => 'foo', - 'datetime' => new \DateTime, - 'extra' => array(), - 'context' => array( - 'foo' => 'bar', - 'baz' => 'qux', - 'bool' => false, - 'null' => null, - ) - )); - $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foo {"foo":"bar","baz":"qux","bool":false,"null":null} []'."\n", $message); - } - - public function testDefFormatExtras() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $message = $formatter->format(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array('ip' => '127.0.0.1'), - 'message' => 'log', - )); - $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log [] {"ip":"127.0.0.1"}'."\n", $message); - } - - public function testFormatExtras() - { - $formatter = new LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra.file% %extra%\n", 'Y-m-d'); - $message = $formatter->format(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array('ip' => '127.0.0.1', 'file' => 'test'), - 'message' => 'log', - )); - $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log [] test {"ip":"127.0.0.1"}'."\n", $message); - } - - public function testContextAndExtraOptionallyNotShownIfEmpty() - { - $formatter = new LineFormatter(null, 'Y-m-d', false, true); - $message = $formatter->format(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array(), - 'message' => 'log', - )); - $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log '."\n", $message); - } - - public function testDefFormatWithObject() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $message = $formatter->format(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array('foo' => new TestFoo, 'bar' => new TestBar, 'baz' => array(), 'res' => fopen('php://memory', 'rb')), - 'message' => 'foobar', - )); - - $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foobar [] {"foo":"[object] (Monolog\\\\Formatter\\\\TestFoo: {\\"foo\\":\\"foo\\"})","bar":"[object] (Monolog\\\\Formatter\\\\TestBar: bar)","baz":[],"res":"[resource] (stream)"}'."\n", $message); - } - - public function testDefFormatWithException() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $message = $formatter->format(array( - 'level_name' => 'CRITICAL', - 'channel' => 'core', - 'context' => array('exception' => new \RuntimeException('Foo')), - 'datetime' => new \DateTime, - 'extra' => array(), - 'message' => 'foobar', - )); - - $path = str_replace('\\/', '/', json_encode(__FILE__)); - - $this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr($path, 1, -1).':'.(__LINE__ - 8).')"} []'."\n", $message); - } - - public function testDefFormatWithPreviousException() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $previous = new \LogicException('Wut?'); - $message = $formatter->format(array( - 'level_name' => 'CRITICAL', - 'channel' => 'core', - 'context' => array('exception' => new \RuntimeException('Foo', 0, $previous)), - 'datetime' => new \DateTime, - 'extra' => array(), - 'message' => 'foobar', - )); - - $path = str_replace('\\/', '/', json_encode(__FILE__)); - - $this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr($path, 1, -1).':'.(__LINE__ - 8).', LogicException(code: 0): Wut? at '.substr($path, 1, -1).':'.(__LINE__ - 12).')"} []'."\n", $message); - } - - public function testBatchFormat() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $message = $formatter->formatBatch(array( - array( - 'level_name' => 'CRITICAL', - 'channel' => 'test', - 'message' => 'bar', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array(), - ), - array( - 'level_name' => 'WARNING', - 'channel' => 'log', - 'message' => 'foo', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array(), - ), - )); - $this->assertEquals('['.date('Y-m-d').'] test.CRITICAL: bar [] []'."\n".'['.date('Y-m-d').'] log.WARNING: foo [] []'."\n", $message); - } - - public function testFormatShouldStripInlineLineBreaks() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $message = $formatter->format( - array( - 'message' => "foo\nbar", - 'context' => array(), - 'extra' => array(), - ) - ); - - $this->assertRegExp('/foo bar/', $message); - } - - public function testFormatShouldNotStripInlineLineBreaksWhenFlagIsSet() - { - $formatter = new LineFormatter(null, 'Y-m-d', true); - $message = $formatter->format( - array( - 'message' => "foo\nbar", - 'context' => array(), - 'extra' => array(), - ) - ); - - $this->assertRegExp('/foo\nbar/', $message); - } -} - -class TestFoo -{ - public $foo = 'foo'; -} - -class TestBar -{ - public function __toString() - { - return 'bar'; - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Formatter/LogglyFormatterTest.php b/application/vendor/monolog/monolog/tests/Monolog/Formatter/LogglyFormatterTest.php deleted file mode 100644 index 6d59b3f..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Formatter/LogglyFormatterTest.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\TestCase; - -class LogglyFormatterTest extends TestCase -{ - /** - * @covers Monolog\Formatter\LogglyFormatter::__construct - */ - public function testConstruct() - { - $formatter = new LogglyFormatter(); - $this->assertEquals(LogglyFormatter::BATCH_MODE_NEWLINES, $formatter->getBatchMode()); - $formatter = new LogglyFormatter(LogglyFormatter::BATCH_MODE_JSON); - $this->assertEquals(LogglyFormatter::BATCH_MODE_JSON, $formatter->getBatchMode()); - } - - /** - * @covers Monolog\Formatter\LogglyFormatter::format - */ - public function testFormat() - { - $formatter = new LogglyFormatter(); - $record = $this->getRecord(); - $formatted_decoded = json_decode($formatter->format($record), true); - $this->assertArrayHasKey("timestamp", $formatted_decoded); - $this->assertEquals(new \DateTime($formatted_decoded["timestamp"]), $record["datetime"]); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php b/application/vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php deleted file mode 100644 index de4a3c2..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php +++ /dev/null @@ -1,289 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; - -class LogstashFormatterTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testDefaultFormatter() - { - $formatter = new LogstashFormatter('test', 'hostname'); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertEquals("1970-01-01T00:00:00.000000+00:00", $message['@timestamp']); - $this->assertEquals('log', $message['@message']); - $this->assertEquals('meh', $message['@fields']['channel']); - $this->assertContains('meh', $message['@tags']); - $this->assertEquals(Logger::ERROR, $message['@fields']['level']); - $this->assertEquals('test', $message['@type']); - $this->assertEquals('hostname', $message['@source']); - - $formatter = new LogstashFormatter('mysystem'); - - $message = json_decode($formatter->format($record), true); - - $this->assertEquals('mysystem', $message['@type']); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testFormatWithFileAndLine() - { - $formatter = new LogstashFormatter('test'); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('file' => 'test', 'line' => 14), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertEquals('test', $message['@fields']['file']); - $this->assertEquals(14, $message['@fields']['line']); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testFormatWithContext() - { - $formatter = new LogstashFormatter('test'); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log' - ); - - $message = json_decode($formatter->format($record), true); - - $message_array = $message['@fields']; - - $this->assertArrayHasKey('ctxt_from', $message_array); - $this->assertEquals('logger', $message_array['ctxt_from']); - - // Test with extraPrefix - $formatter = new LogstashFormatter('test', null, null, 'CTX'); - $message = json_decode($formatter->format($record), true); - - $message_array = $message['@fields']; - - $this->assertArrayHasKey('CTXfrom', $message_array); - $this->assertEquals('logger', $message_array['CTXfrom']); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testFormatWithExtra() - { - $formatter = new LogstashFormatter('test'); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log' - ); - - $message = json_decode($formatter->format($record), true); - - $message_array = $message['@fields']; - - $this->assertArrayHasKey('key', $message_array); - $this->assertEquals('pair', $message_array['key']); - - // Test with extraPrefix - $formatter = new LogstashFormatter('test', null, 'EXT'); - $message = json_decode($formatter->format($record), true); - - $message_array = $message['@fields']; - - $this->assertArrayHasKey('EXTkey', $message_array); - $this->assertEquals('pair', $message_array['EXTkey']); - } - - public function testFormatWithApplicationName() - { - $formatter = new LogstashFormatter('app', 'test'); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log' - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertArrayHasKey('@type', $message); - $this->assertEquals('app', $message['@type']); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testDefaultFormatterV1() - { - $formatter = new LogstashFormatter('test', 'hostname', null, 'ctxt_', LogstashFormatter::V1); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertEquals("1970-01-01T00:00:00.000000+00:00", $message['@timestamp']); - $this->assertEquals("1", $message['@version']); - $this->assertEquals('log', $message['message']); - $this->assertEquals('meh', $message['channel']); - $this->assertEquals('ERROR', $message['level']); - $this->assertEquals('test', $message['type']); - $this->assertEquals('hostname', $message['host']); - - $formatter = new LogstashFormatter('mysystem', null, null, 'ctxt_', LogstashFormatter::V1); - - $message = json_decode($formatter->format($record), true); - - $this->assertEquals('mysystem', $message['type']); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testFormatWithFileAndLineV1() - { - $formatter = new LogstashFormatter('test', null, null, 'ctxt_', LogstashFormatter::V1); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('file' => 'test', 'line' => 14), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertEquals('test', $message['file']); - $this->assertEquals(14, $message['line']); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testFormatWithContextV1() - { - $formatter = new LogstashFormatter('test', null, null, 'ctxt_', LogstashFormatter::V1); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log' - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertArrayHasKey('ctxt_from', $message); - $this->assertEquals('logger', $message['ctxt_from']); - - // Test with extraPrefix - $formatter = new LogstashFormatter('test', null, null, 'CTX', LogstashFormatter::V1); - $message = json_decode($formatter->format($record), true); - - $this->assertArrayHasKey('CTXfrom', $message); - $this->assertEquals('logger', $message['CTXfrom']); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testFormatWithExtraV1() - { - $formatter = new LogstashFormatter('test', null, null, 'ctxt_', LogstashFormatter::V1); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log' - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertArrayHasKey('key', $message); - $this->assertEquals('pair', $message['key']); - - // Test with extraPrefix - $formatter = new LogstashFormatter('test', null, 'EXT', 'ctxt_', LogstashFormatter::V1); - $message = json_decode($formatter->format($record), true); - - $this->assertArrayHasKey('EXTkey', $message); - $this->assertEquals('pair', $message['EXTkey']); - } - - public function testFormatWithApplicationNameV1() - { - $formatter = new LogstashFormatter('app', 'test', null, 'ctxt_', LogstashFormatter::V1); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log' - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertArrayHasKey('type', $message); - $this->assertEquals('app', $message['type']); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php b/application/vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php deleted file mode 100644 index 1554ef4..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php +++ /dev/null @@ -1,253 +0,0 @@ - - */ -class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase -{ - public function setUp() - { - if (!class_exists('MongoDate')) { - $this->markTestSkipped('mongo extension not installed'); - } - } - - public function constructArgumentProvider() - { - return array( - array(1, true, 1, true), - array(0, false, 0, false), - ); - } - - /** - * @param $traceDepth - * @param $traceAsString - * @param $expectedTraceDepth - * @param $expectedTraceAsString - * - * @dataProvider constructArgumentProvider - */ - public function testConstruct($traceDepth, $traceAsString, $expectedTraceDepth, $expectedTraceAsString) - { - $formatter = new MongoDBFormatter($traceDepth, $traceAsString); - - $reflTrace = new \ReflectionProperty($formatter, 'exceptionTraceAsString'); - $reflTrace->setAccessible(true); - $this->assertEquals($expectedTraceAsString, $reflTrace->getValue($formatter)); - - $reflDepth = new\ReflectionProperty($formatter, 'maxNestingLevel'); - $reflDepth->setAccessible(true); - $this->assertEquals($expectedTraceDepth, $reflDepth->getValue($formatter)); - } - - public function testSimpleFormat() - { - $record = array( - 'message' => 'some log message', - 'context' => array(), - 'level' => Logger::WARNING, - 'level_name' => Logger::getLevelName(Logger::WARNING), - 'channel' => 'test', - 'datetime' => new \DateTime('2014-02-01 00:00:00'), - 'extra' => array(), - ); - - $formatter = new MongoDBFormatter(); - $formattedRecord = $formatter->format($record); - - $this->assertCount(7, $formattedRecord); - $this->assertEquals('some log message', $formattedRecord['message']); - $this->assertEquals(array(), $formattedRecord['context']); - $this->assertEquals(Logger::WARNING, $formattedRecord['level']); - $this->assertEquals(Logger::getLevelName(Logger::WARNING), $formattedRecord['level_name']); - $this->assertEquals('test', $formattedRecord['channel']); - $this->assertInstanceOf('\MongoDate', $formattedRecord['datetime']); - $this->assertEquals('0.00000000 1391212800', $formattedRecord['datetime']->__toString()); - $this->assertEquals(array(), $formattedRecord['extra']); - } - - public function testRecursiveFormat() - { - $someObject = new \stdClass(); - $someObject->foo = 'something'; - $someObject->bar = 'stuff'; - - $record = array( - 'message' => 'some log message', - 'context' => array( - 'stuff' => new \DateTime('2014-02-01 02:31:33'), - 'some_object' => $someObject, - 'context_string' => 'some string', - 'context_int' => 123456, - 'except' => new \Exception('exception message', 987), - ), - 'level' => Logger::WARNING, - 'level_name' => Logger::getLevelName(Logger::WARNING), - 'channel' => 'test', - 'datetime' => new \DateTime('2014-02-01 00:00:00'), - 'extra' => array(), - ); - - $formatter = new MongoDBFormatter(); - $formattedRecord = $formatter->format($record); - - $this->assertCount(5, $formattedRecord['context']); - $this->assertInstanceOf('\MongoDate', $formattedRecord['context']['stuff']); - $this->assertEquals('0.00000000 1391221893', $formattedRecord['context']['stuff']->__toString()); - $this->assertEquals( - array( - 'foo' => 'something', - 'bar' => 'stuff', - 'class' => 'stdClass', - ), - $formattedRecord['context']['some_object'] - ); - $this->assertEquals('some string', $formattedRecord['context']['context_string']); - $this->assertEquals(123456, $formattedRecord['context']['context_int']); - - $this->assertCount(5, $formattedRecord['context']['except']); - $this->assertEquals('exception message', $formattedRecord['context']['except']['message']); - $this->assertEquals(987, $formattedRecord['context']['except']['code']); - $this->assertInternalType('string', $formattedRecord['context']['except']['file']); - $this->assertInternalType('integer', $formattedRecord['context']['except']['code']); - $this->assertInternalType('string', $formattedRecord['context']['except']['trace']); - $this->assertEquals('Exception', $formattedRecord['context']['except']['class']); - } - - public function testFormatDepthArray() - { - $record = array( - 'message' => 'some log message', - 'context' => array( - 'nest2' => array( - 'property' => 'anything', - 'nest3' => array( - 'nest4' => 'value', - 'property' => 'nothing' - ) - ) - ), - 'level' => Logger::WARNING, - 'level_name' => Logger::getLevelName(Logger::WARNING), - 'channel' => 'test', - 'datetime' => new \DateTime('2014-02-01 00:00:00'), - 'extra' => array(), - ); - - $formatter = new MongoDBFormatter(2); - $formattedResult = $formatter->format($record); - - $this->assertEquals( - array( - 'nest2' => array( - 'property' => 'anything', - 'nest3' => '[...]', - ) - ), - $formattedResult['context'] - ); - } - - public function testFormatDepthArrayInfiniteNesting() - { - $record = array( - 'message' => 'some log message', - 'context' => array( - 'nest2' => array( - 'property' => 'something', - 'nest3' => array( - 'property' => 'anything', - 'nest4' => array( - 'property' => 'nothing', - ), - ) - ) - ), - 'level' => Logger::WARNING, - 'level_name' => Logger::getLevelName(Logger::WARNING), - 'channel' => 'test', - 'datetime' => new \DateTime('2014-02-01 00:00:00'), - 'extra' => array(), - ); - - $formatter = new MongoDBFormatter(0); - $formattedResult = $formatter->format($record); - - $this->assertEquals( - array( - 'nest2' => array( - 'property' => 'something', - 'nest3' => array( - 'property' => 'anything', - 'nest4' => array( - 'property' => 'nothing', - ) - ), - ) - ), - $formattedResult['context'] - ); - } - - public function testFormatDepthObjects() - { - $someObject = new \stdClass(); - $someObject->property = 'anything'; - $someObject->nest3 = new \stdClass(); - $someObject->nest3->property = 'nothing'; - $someObject->nest3->nest4 = 'invisible'; - - $record = array( - 'message' => 'some log message', - 'context' => array( - 'nest2' => $someObject - ), - 'level' => Logger::WARNING, - 'level_name' => Logger::getLevelName(Logger::WARNING), - 'channel' => 'test', - 'datetime' => new \DateTime('2014-02-01 00:00:00'), - 'extra' => array(), - ); - - $formatter = new MongoDBFormatter(2, true); - $formattedResult = $formatter->format($record); - - $this->assertEquals( - array( - 'nest2' => array( - 'property' => 'anything', - 'nest3' => '[...]', - 'class' => 'stdClass', - ), - ), - $formattedResult['context'] - ); - } - - public function testFormatDepthException() - { - $record = array( - 'message' => 'some log message', - 'context' => array( - 'nest2' => new \Exception('exception message', 987), - ), - 'level' => Logger::WARNING, - 'level_name' => Logger::getLevelName(Logger::WARNING), - 'channel' => 'test', - 'datetime' => new \DateTime('2014-02-01 00:00:00'), - 'extra' => array(), - ); - - $formatter = new MongoDBFormatter(2, false); - $formattedRecord = $formatter->format($record); - - $this->assertEquals('exception message', $formattedRecord['context']['nest2']['message']); - $this->assertEquals(987, $formattedRecord['context']['nest2']['code']); - $this->assertEquals('[...]', $formattedRecord['context']['nest2']['trace']); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php b/application/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php deleted file mode 100644 index c484dfe..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php +++ /dev/null @@ -1,270 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -/** - * @covers Monolog\Formatter\NormalizerFormatter - */ -class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase -{ - public function testFormat() - { - $formatter = new NormalizerFormatter('Y-m-d'); - $formatted = $formatter->format(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'message' => 'foo', - 'datetime' => new \DateTime, - 'extra' => array('foo' => new TestFooNorm, 'bar' => new TestBarNorm, 'baz' => array(), 'res' => fopen('php://memory', 'rb')), - 'context' => array( - 'foo' => 'bar', - 'baz' => 'qux', - 'inf' => INF, - '-inf' => -INF, - 'nan' => acos(4), - ), - )); - - $this->assertEquals(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'message' => 'foo', - 'datetime' => date('Y-m-d'), - 'extra' => array( - 'foo' => '[object] (Monolog\\Formatter\\TestFooNorm: {"foo":"foo"})', - 'bar' => '[object] (Monolog\\Formatter\\TestBarNorm: bar)', - 'baz' => array(), - 'res' => '[resource] (stream)', - ), - 'context' => array( - 'foo' => 'bar', - 'baz' => 'qux', - 'inf' => 'INF', - '-inf' => '-INF', - 'nan' => 'NaN', - ) - ), $formatted); - } - - public function testFormatExceptions() - { - $formatter = new NormalizerFormatter('Y-m-d'); - $e = new \LogicException('bar'); - $e2 = new \RuntimeException('foo', 0, $e); - $formatted = $formatter->format(array( - 'exception' => $e2, - )); - - $this->assertGreaterThan(5, count($formatted['exception']['trace'])); - $this->assertTrue(isset($formatted['exception']['previous'])); - unset($formatted['exception']['trace'], $formatted['exception']['previous']); - - $this->assertEquals(array( - 'exception' => array( - 'class' => get_class($e2), - 'message' => $e2->getMessage(), - 'code' => $e2->getCode(), - 'file' => $e2->getFile().':'.$e2->getLine(), - ) - ), $formatted); - } - - public function testBatchFormat() - { - $formatter = new NormalizerFormatter('Y-m-d'); - $formatted = $formatter->formatBatch(array( - array( - 'level_name' => 'CRITICAL', - 'channel' => 'test', - 'message' => 'bar', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array(), - ), - array( - 'level_name' => 'WARNING', - 'channel' => 'log', - 'message' => 'foo', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array(), - ), - )); - $this->assertEquals(array( - array( - 'level_name' => 'CRITICAL', - 'channel' => 'test', - 'message' => 'bar', - 'context' => array(), - 'datetime' => date('Y-m-d'), - 'extra' => array(), - ), - array( - 'level_name' => 'WARNING', - 'channel' => 'log', - 'message' => 'foo', - 'context' => array(), - 'datetime' => date('Y-m-d'), - 'extra' => array(), - ), - ), $formatted); - } - - /** - * Test issue #137 - */ - public function testIgnoresRecursiveObjectReferences() - { - // set up the recursion - $foo = new \stdClass(); - $bar = new \stdClass(); - - $foo->bar = $bar; - $bar->foo = $foo; - - // set an error handler to assert that the error is not raised anymore - $that = $this; - set_error_handler(function ($level, $message, $file, $line, $context) use ($that) { - if (error_reporting() & $level) { - restore_error_handler(); - $that->fail("$message should not be raised"); - } - }); - - $formatter = new NormalizerFormatter(); - $reflMethod = new \ReflectionMethod($formatter, 'toJson'); - $reflMethod->setAccessible(true); - $res = $reflMethod->invoke($formatter, array($foo, $bar), true); - - restore_error_handler(); - - $this->assertEquals(@json_encode(array($foo, $bar)), $res); - } - - public function testIgnoresInvalidTypes() - { - // set up the recursion - $resource = fopen(__FILE__, 'r'); - - // set an error handler to assert that the error is not raised anymore - $that = $this; - set_error_handler(function ($level, $message, $file, $line, $context) use ($that) { - if (error_reporting() & $level) { - restore_error_handler(); - $that->fail("$message should not be raised"); - } - }); - - $formatter = new NormalizerFormatter(); - $reflMethod = new \ReflectionMethod($formatter, 'toJson'); - $reflMethod->setAccessible(true); - $res = $reflMethod->invoke($formatter, array($resource), true); - - restore_error_handler(); - - $this->assertEquals(@json_encode(array($resource)), $res); - } - - /** - * @expectedException RuntimeException - */ - public function testThrowsOnInvalidEncoding() - { - $formatter = new NormalizerFormatter(); - $reflMethod = new \ReflectionMethod($formatter, 'toJson'); - $reflMethod->setAccessible(true); - - // send an invalid unicode sequence - $res = $reflMethod->invoke($formatter, array('message' => "\xB1\x31")); - if (PHP_VERSION_ID < 50500 && $res === '{"message":null}') { - throw new \RuntimeException('PHP 5.3/5.4 throw a warning and null the value instead of returning false entirely'); - } - } - - public function testExceptionTraceWithArgs() - { - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('Not supported in HHVM since it detects errors differently'); - } - - // This happens i.e. in React promises or Guzzle streams where stream wrappers are registered - // and no file or line are included in the trace because it's treated as internal function - set_error_handler(function ($errno, $errstr, $errfile, $errline) { - throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); - }); - - try { - // This will contain $resource and $wrappedResource as arguments in the trace item - $resource = fopen('php://memory', 'rw+'); - fwrite($resource, 'test_resource'); - $wrappedResource = new TestFooNorm; - $wrappedResource->foo = $resource; - // Just do something stupid with a resource/wrapped resource as argument - array_keys($wrappedResource); - } catch (\Exception $e) { - restore_error_handler(); - } - - $formatter = new NormalizerFormatter(); - $record = array('context' => array('exception' => $e)); - $result = $formatter->format($record); - - $this->assertRegExp( - '%"resource":"\[resource\] \(stream\)"%', - $result['context']['exception']['trace'][0] - ); - - if (version_compare(PHP_VERSION, '5.5.0', '>=')) { - $pattern = '%"wrappedResource":"\[object\] \(Monolog\\\\\\\\Formatter\\\\\\\\TestFooNorm: \)"%'; - } else { - $pattern = '%\\\\"foo\\\\":null%'; - } - - // Tests that the wrapped resource is ignored while encoding, only works for PHP <= 5.4 - $this->assertRegExp( - $pattern, - $result['context']['exception']['trace'][0] - ); - } -} - -class TestFooNorm -{ - public $foo = 'foo'; -} - -class TestBarNorm -{ - public function __toString() - { - return 'bar'; - } -} - -class TestStreamFoo -{ - public $foo; - public $resource; - - public function __construct($resource) - { - $this->resource = $resource; - $this->foo = 'BAR'; - } - - public function __toString() - { - fseek($this->resource, 0); - - return $this->foo . ' - ' . (string) stream_get_contents($this->resource); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php b/application/vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php deleted file mode 100644 index 2a35446..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php +++ /dev/null @@ -1,100 +0,0 @@ -formatter = new ScalarFormatter(); - } - - public function buildTrace(\Exception $e) - { - $data = array(); - $trace = $e->getTrace(); - foreach ($trace as $frame) { - if (isset($frame['file'])) { - $data[] = $frame['file'].':'.$frame['line']; - } else { - $data[] = json_encode($frame); - } - } - - return $data; - } - - public function encodeJson($data) - { - if (version_compare(PHP_VERSION, '5.4.0', '>=')) { - return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); - } - - return json_encode($data); - } - - public function testFormat() - { - $exception = new \Exception('foo'); - $formatted = $this->formatter->format(array( - 'foo' => 'string', - 'bar' => 1, - 'baz' => false, - 'bam' => array(1, 2, 3), - 'bat' => array('foo' => 'bar'), - 'bap' => \DateTime::createFromFormat(\DateTime::ISO8601, '1970-01-01T00:00:00+0000'), - 'ban' => $exception - )); - - $this->assertSame(array( - 'foo' => 'string', - 'bar' => 1, - 'baz' => false, - 'bam' => $this->encodeJson(array(1, 2, 3)), - 'bat' => $this->encodeJson(array('foo' => 'bar')), - 'bap' => '1970-01-01 00:00:00', - 'ban' => $this->encodeJson(array( - 'class' => get_class($exception), - 'message' => $exception->getMessage(), - 'code' => $exception->getCode(), - 'file' => $exception->getFile() . ':' . $exception->getLine(), - 'trace' => $this->buildTrace($exception) - )) - ), $formatted); - } - - public function testFormatWithErrorContext() - { - $context = array('file' => 'foo', 'line' => 1); - $formatted = $this->formatter->format(array( - 'context' => $context - )); - - $this->assertSame(array( - 'context' => $this->encodeJson($context) - ), $formatted); - } - - public function testFormatWithExceptionContext() - { - $exception = new \Exception('foo'); - $formatted = $this->formatter->format(array( - 'context' => array( - 'exception' => $exception - ) - )); - - $this->assertSame(array( - 'context' => $this->encodeJson(array( - 'exception' => array( - 'class' => get_class($exception), - 'message' => $exception->getMessage(), - 'code' => $exception->getCode(), - 'file' => $exception->getFile() . ':' . $exception->getLine(), - 'trace' => $this->buildTrace($exception) - ) - )) - ), $formatted); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php b/application/vendor/monolog/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php deleted file mode 100644 index 52f15a3..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php +++ /dev/null @@ -1,142 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; - -class WildfireFormatterTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers Monolog\Formatter\WildfireFormatter::format - */ - public function testDefaultFormat() - { - $wildfire = new WildfireFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('ip' => '127.0.0.1'), - 'message' => 'log', - ); - - $message = $wildfire->format($record); - - $this->assertEquals( - '125|[{"Type":"ERROR","File":"","Line":"","Label":"meh"},' - .'{"message":"log","context":{"from":"logger"},"extra":{"ip":"127.0.0.1"}}]|', - $message - ); - } - - /** - * @covers Monolog\Formatter\WildfireFormatter::format - */ - public function testFormatWithFileAndLine() - { - $wildfire = new WildfireFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('ip' => '127.0.0.1', 'file' => 'test', 'line' => 14), - 'message' => 'log', - ); - - $message = $wildfire->format($record); - - $this->assertEquals( - '129|[{"Type":"ERROR","File":"test","Line":14,"Label":"meh"},' - .'{"message":"log","context":{"from":"logger"},"extra":{"ip":"127.0.0.1"}}]|', - $message - ); - } - - /** - * @covers Monolog\Formatter\WildfireFormatter::format - */ - public function testFormatWithoutContext() - { - $wildfire = new WildfireFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $message = $wildfire->format($record); - - $this->assertEquals( - '58|[{"Type":"ERROR","File":"","Line":"","Label":"meh"},"log"]|', - $message - ); - } - - /** - * @covers Monolog\Formatter\WildfireFormatter::formatBatch - * @expectedException BadMethodCallException - */ - public function testBatchFormatThrowException() - { - $wildfire = new WildfireFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $wildfire->formatBatch(array($record)); - } - - /** - * @covers Monolog\Formatter\WildfireFormatter::format - */ - public function testTableFormat() - { - $wildfire = new WildfireFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'table-channel', - 'context' => array( - WildfireFormatter::TABLE => array( - array('col1', 'col2', 'col3'), - array('val1', 'val2', 'val3'), - array('foo1', 'foo2', 'foo3'), - array('bar1', 'bar2', 'bar3'), - ), - ), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'table-message', - ); - - $message = $wildfire->format($record); - - $this->assertEquals( - '171|[{"Type":"TABLE","File":"","Line":"","Label":"table-channel: table-message"},[["col1","col2","col3"],["val1","val2","val3"],["foo1","foo2","foo3"],["bar1","bar2","bar3"]]]|', - $message - ); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/AbstractHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/AbstractHandlerTest.php deleted file mode 100644 index 568eb9d..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/AbstractHandlerTest.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Formatter\LineFormatter; -use Monolog\Processor\WebProcessor; - -class AbstractHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\AbstractHandler::__construct - * @covers Monolog\Handler\AbstractHandler::getLevel - * @covers Monolog\Handler\AbstractHandler::setLevel - * @covers Monolog\Handler\AbstractHandler::getBubble - * @covers Monolog\Handler\AbstractHandler::setBubble - * @covers Monolog\Handler\AbstractHandler::getFormatter - * @covers Monolog\Handler\AbstractHandler::setFormatter - */ - public function testConstructAndGetSet() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array(Logger::WARNING, false)); - $this->assertEquals(Logger::WARNING, $handler->getLevel()); - $this->assertEquals(false, $handler->getBubble()); - - $handler->setLevel(Logger::ERROR); - $handler->setBubble(true); - $handler->setFormatter($formatter = new LineFormatter); - $this->assertEquals(Logger::ERROR, $handler->getLevel()); - $this->assertEquals(true, $handler->getBubble()); - $this->assertSame($formatter, $handler->getFormatter()); - } - - /** - * @covers Monolog\Handler\AbstractHandler::handleBatch - */ - public function testHandleBatch() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); - $handler->expects($this->exactly(2)) - ->method('handle'); - $handler->handleBatch(array($this->getRecord(), $this->getRecord())); - } - - /** - * @covers Monolog\Handler\AbstractHandler::isHandling - */ - public function testIsHandling() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array(Logger::WARNING, false)); - $this->assertTrue($handler->isHandling($this->getRecord())); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); - } - - /** - * @covers Monolog\Handler\AbstractHandler::__construct - */ - public function testHandlesPsrStyleLevels() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array('warning', false)); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); - $handler->setLevel('debug'); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::DEBUG))); - } - - /** - * @covers Monolog\Handler\AbstractHandler::getFormatter - * @covers Monolog\Handler\AbstractHandler::getDefaultFormatter - */ - public function testGetFormatterInitializesDefault() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); - $this->assertInstanceOf('Monolog\Formatter\LineFormatter', $handler->getFormatter()); - } - - /** - * @covers Monolog\Handler\AbstractHandler::pushProcessor - * @covers Monolog\Handler\AbstractHandler::popProcessor - * @expectedException LogicException - */ - public function testPushPopProcessor() - { - $logger = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); - $processor1 = new WebProcessor; - $processor2 = new WebProcessor; - - $logger->pushProcessor($processor1); - $logger->pushProcessor($processor2); - - $this->assertEquals($processor2, $logger->popProcessor()); - $this->assertEquals($processor1, $logger->popProcessor()); - $logger->popProcessor(); - } - - /** - * @covers Monolog\Handler\AbstractHandler::pushProcessor - * @expectedException InvalidArgumentException - */ - public function testPushProcessorWithNonCallable() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); - - $handler->pushProcessor(new \stdClass()); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php deleted file mode 100644 index 24d4f63..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Processor\WebProcessor; - -class AbstractProcessingHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\AbstractProcessingHandler::handle - */ - public function testHandleLowerLevelMessage() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::WARNING, true)); - $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG))); - } - - /** - * @covers Monolog\Handler\AbstractProcessingHandler::handle - */ - public function testHandleBubbling() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::DEBUG, true)); - $this->assertFalse($handler->handle($this->getRecord())); - } - - /** - * @covers Monolog\Handler\AbstractProcessingHandler::handle - */ - public function testHandleNotBubbling() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::DEBUG, false)); - $this->assertTrue($handler->handle($this->getRecord())); - } - - /** - * @covers Monolog\Handler\AbstractProcessingHandler::handle - */ - public function testHandleIsFalseWhenNotHandled() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::WARNING, false)); - $this->assertTrue($handler->handle($this->getRecord())); - $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG))); - } - - /** - * @covers Monolog\Handler\AbstractProcessingHandler::processRecord - */ - public function testProcessRecord() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler'); - $handler->pushProcessor(new WebProcessor(array( - 'REQUEST_URI' => '', - 'REQUEST_METHOD' => '', - 'REMOTE_ADDR' => '', - 'SERVER_NAME' => '', - 'UNIQUE_ID' => '', - ))); - $handledRecord = null; - $handler->expects($this->once()) - ->method('write') - ->will($this->returnCallback(function ($record) use (&$handledRecord) { - $handledRecord = $record; - })) - ; - $handler->handle($this->getRecord()); - $this->assertEquals(6, count($handledRecord['extra'])); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php deleted file mode 100644 index a71d625..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use PhpAmqpLib\Message\AMQPMessage; -use PhpAmqpLib\Connection\AMQPConnection; - -/** - * @covers Monolog\Handler\RotatingFileHandler - */ -class AmqpHandlerTest extends TestCase -{ - public function testHandleAmqpExt() - { - if (!class_exists('AMQPConnection') || !class_exists('AMQPExchange')) { - $this->markTestSkipped("amqp-php not installed"); - } - - if (!class_exists('AMQPChannel')) { - $this->markTestSkipped("Please update AMQP to version >= 1.0"); - } - - $messages = array(); - - $exchange = $this->getMock('AMQPExchange', array('publish', 'setName'), array(), '', false); - $exchange->expects($this->once()) - ->method('setName') - ->with('log') - ; - $exchange->expects($this->any()) - ->method('publish') - ->will($this->returnCallback(function ($message, $routing_key, $flags = 0, $attributes = array()) use (&$messages) { - $messages[] = array($message, $routing_key, $flags, $attributes); - })) - ; - - $handler = new AmqpHandler($exchange, 'log'); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $expected = array( - array( - 'message' => 'test', - 'context' => array( - 'data' => array(), - 'foo' => 34, - ), - 'level' => 300, - 'level_name' => 'WARNING', - 'channel' => 'test', - 'extra' => array(), - ), - 'warn.test', - 0, - array( - 'delivery_mode' => 2, - 'Content-type' => 'application/json' - ) - ); - - $handler->handle($record); - - $this->assertCount(1, $messages); - $messages[0][0] = json_decode($messages[0][0], true); - unset($messages[0][0]['datetime']); - $this->assertEquals($expected, $messages[0]); - } - - public function testHandlePhpAmqpLib() - { - if (!class_exists('PhpAmqpLib\Connection\AMQPConnection')) { - $this->markTestSkipped("php-amqplib not installed"); - } - - $messages = array(); - - $exchange = $this->getMock('PhpAmqpLib\Channel\AMQPChannel', array('basic_publish', '__destruct'), array(), '', false); - - $exchange->expects($this->any()) - ->method('basic_publish') - ->will($this->returnCallback(function (AMQPMessage $msg, $exchange = "", $routing_key = "", $mandatory = false, $immediate = false, $ticket = null) use (&$messages) { - $messages[] = array($msg, $exchange, $routing_key, $mandatory, $immediate, $ticket); - })) - ; - - $handler = new AmqpHandler($exchange, 'log'); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $expected = array( - array( - 'message' => 'test', - 'context' => array( - 'data' => array(), - 'foo' => 34, - ), - 'level' => 300, - 'level_name' => 'WARNING', - 'channel' => 'test', - 'extra' => array(), - ), - 'log', - 'warn.test', - false, - false, - null, - array( - 'delivery_mode' => 2, - 'content_type' => 'application/json' - ) - ); - - $handler->handle($record); - - $this->assertCount(1, $messages); - - /* @var $msg AMQPMessage */ - $msg = $messages[0][0]; - $messages[0][0] = json_decode($msg->body, true); - $messages[0][] = $msg->get_properties(); - unset($messages[0][0]['datetime']); - - $this->assertEquals($expected, $messages[0]); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php deleted file mode 100644 index ffb1d74..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php +++ /dev/null @@ -1,130 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @covers Monolog\Handler\BrowserConsoleHandlerTest - */ -class BrowserConsoleHandlerTest extends TestCase -{ - protected function setUp() - { - BrowserConsoleHandler::reset(); - } - - protected function generateScript() - { - $reflMethod = new \ReflectionMethod('Monolog\Handler\BrowserConsoleHandler', 'generateScript'); - $reflMethod->setAccessible(true); - - return $reflMethod->invoke(null); - } - - public function testStyling() - { - $handler = new BrowserConsoleHandler(); - $handler->setFormatter($this->getIdentityFormatter()); - - $handler->handle($this->getRecord(Logger::DEBUG, 'foo[[bar]]{color: red}')); - - $expected = <<assertEquals($expected, $this->generateScript()); - } - - public function testEscaping() - { - $handler = new BrowserConsoleHandler(); - $handler->setFormatter($this->getIdentityFormatter()); - - $handler->handle($this->getRecord(Logger::DEBUG, "[foo] [[\"bar\n[baz]\"]]{color: red}")); - - $expected = <<assertEquals($expected, $this->generateScript()); - } - - public function testAutolabel() - { - $handler = new BrowserConsoleHandler(); - $handler->setFormatter($this->getIdentityFormatter()); - - $handler->handle($this->getRecord(Logger::DEBUG, '[[foo]]{macro: autolabel}')); - $handler->handle($this->getRecord(Logger::DEBUG, '[[bar]]{macro: autolabel}')); - $handler->handle($this->getRecord(Logger::DEBUG, '[[foo]]{macro: autolabel}')); - - $expected = <<assertEquals($expected, $this->generateScript()); - } - - public function testContext() - { - $handler = new BrowserConsoleHandler(); - $handler->setFormatter($this->getIdentityFormatter()); - - $handler->handle($this->getRecord(Logger::DEBUG, 'test', array('foo' => 'bar'))); - - $expected = <<assertEquals($expected, $this->generateScript()); - } - - public function testConcurrentHandlers() - { - $handler1 = new BrowserConsoleHandler(); - $handler1->setFormatter($this->getIdentityFormatter()); - - $handler2 = new BrowserConsoleHandler(); - $handler2->setFormatter($this->getIdentityFormatter()); - - $handler1->handle($this->getRecord(Logger::DEBUG, 'test1')); - $handler2->handle($this->getRecord(Logger::DEBUG, 'test2')); - $handler1->handle($this->getRecord(Logger::DEBUG, 'test3')); - $handler2->handle($this->getRecord(Logger::DEBUG, 'test4')); - - $expected = <<assertEquals($expected, $this->generateScript()); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/BufferHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/BufferHandlerTest.php deleted file mode 100644 index da8b3c3..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/BufferHandlerTest.php +++ /dev/null @@ -1,158 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class BufferHandlerTest extends TestCase -{ - private $shutdownCheckHandler; - - /** - * @covers Monolog\Handler\BufferHandler::__construct - * @covers Monolog\Handler\BufferHandler::handle - * @covers Monolog\Handler\BufferHandler::close - */ - public function testHandleBuffers() - { - $test = new TestHandler(); - $handler = new BufferHandler($test); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertFalse($test->hasDebugRecords()); - $this->assertFalse($test->hasInfoRecords()); - $handler->close(); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 2); - } - - /** - * @covers Monolog\Handler\BufferHandler::close - * @covers Monolog\Handler\BufferHandler::flush - */ - public function testPropagatesRecordsAtEndOfRequest() - { - $test = new TestHandler(); - $handler = new BufferHandler($test); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $this->shutdownCheckHandler = $test; - register_shutdown_function(array($this, 'checkPropagation')); - } - - public function checkPropagation() - { - if (!$this->shutdownCheckHandler->hasWarningRecords() || !$this->shutdownCheckHandler->hasDebugRecords()) { - echo '!!! BufferHandlerTest::testPropagatesRecordsAtEndOfRequest failed to verify that the messages have been propagated' . PHP_EOL; - exit(1); - } - } - - /** - * @covers Monolog\Handler\BufferHandler::handle - */ - public function testHandleBufferLimit() - { - $test = new TestHandler(); - $handler = new BufferHandler($test, 2); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->close(); - $this->assertTrue($test->hasWarningRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertFalse($test->hasDebugRecords()); - } - - /** - * @covers Monolog\Handler\BufferHandler::handle - */ - public function testHandleBufferLimitWithFlushOnOverflow() - { - $test = new TestHandler(); - $handler = new BufferHandler($test, 3, Logger::DEBUG, true, true); - - // send two records - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $this->assertFalse($test->hasDebugRecords()); - $this->assertCount(0, $test->getRecords()); - - // overflow - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertTrue($test->hasDebugRecords()); - $this->assertCount(3, $test->getRecords()); - - // should buffer again - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertCount(3, $test->getRecords()); - - $handler->close(); - $this->assertCount(5, $test->getRecords()); - $this->assertTrue($test->hasWarningRecords()); - $this->assertTrue($test->hasInfoRecords()); - } - - /** - * @covers Monolog\Handler\BufferHandler::handle - */ - public function testHandleLevel() - { - $test = new TestHandler(); - $handler = new BufferHandler($test, 0, Logger::INFO); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->close(); - $this->assertTrue($test->hasWarningRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertFalse($test->hasDebugRecords()); - } - - /** - * @covers Monolog\Handler\BufferHandler::flush - */ - public function testFlush() - { - $test = new TestHandler(); - $handler = new BufferHandler($test, 0); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->flush(); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue($test->hasDebugRecords()); - $this->assertFalse($test->hasWarningRecords()); - } - - /** - * @covers Monolog\Handler\BufferHandler::handle - */ - public function testHandleUsesProcessors() - { - $test = new TestHandler(); - $handler = new BufferHandler($test); - $handler->pushProcessor(function ($record) { - $record['extra']['foo'] = true; - - return $record; - }); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->flush(); - $this->assertTrue($test->hasWarningRecords()); - $records = $test->getRecords(); - $this->assertTrue($records[0]['extra']['foo']); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php deleted file mode 100644 index 4d64025..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php +++ /dev/null @@ -1,141 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @covers Monolog\Handler\ChromePHPHandler - */ -class ChromePHPHandlerTest extends TestCase -{ - protected function setUp() - { - TestChromePHPHandler::reset(); - $_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; Chrome/1.0'; - } - - public function testHeaders() - { - $handler = new TestChromePHPHandler(); - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::WARNING)); - - $expected = array( - 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array( - 'version' => ChromePHPHandler::VERSION, - 'columns' => array('label', 'log', 'backtrace', 'type'), - 'rows' => array( - 'test', - 'test', - ), - 'request_uri' => '', - )))) - ); - - $this->assertEquals($expected, $handler->getHeaders()); - } - - public function testHeadersOverflow() - { - $handler = new TestChromePHPHandler(); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 150 * 1024))); - - // overflow chrome headers limit - $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 100 * 1024))); - - $expected = array( - 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array( - 'version' => ChromePHPHandler::VERSION, - 'columns' => array('label', 'log', 'backtrace', 'type'), - 'rows' => array( - array( - 'test', - 'test', - 'unknown', - 'log', - ), - array( - 'test', - str_repeat('a', 150 * 1024), - 'unknown', - 'warn', - ), - array( - 'monolog', - 'Incomplete logs, chrome header size limit reached', - 'unknown', - 'warn', - ), - ), - 'request_uri' => '', - )))) - ); - - $this->assertEquals($expected, $handler->getHeaders()); - } - - public function testConcurrentHandlers() - { - $handler = new TestChromePHPHandler(); - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::WARNING)); - - $handler2 = new TestChromePHPHandler(); - $handler2->setFormatter($this->getIdentityFormatter()); - $handler2->handle($this->getRecord(Logger::DEBUG)); - $handler2->handle($this->getRecord(Logger::WARNING)); - - $expected = array( - 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array( - 'version' => ChromePHPHandler::VERSION, - 'columns' => array('label', 'log', 'backtrace', 'type'), - 'rows' => array( - 'test', - 'test', - 'test', - 'test', - ), - 'request_uri' => '', - )))) - ); - - $this->assertEquals($expected, $handler2->getHeaders()); - } -} - -class TestChromePHPHandler extends ChromePHPHandler -{ - protected $headers = array(); - - public static function reset() - { - self::$initialized = false; - self::$overflowed = false; - self::$sendHeaders = true; - self::$json['rows'] = array(); - } - - protected function sendHeader($header, $content) - { - $this->headers[$header] = $content; - } - - public function getHeaders() - { - return $this->headers; - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/CouchDBHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/CouchDBHandlerTest.php deleted file mode 100644 index 9fc4b38..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/CouchDBHandlerTest.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class CouchDBHandlerTest extends TestCase -{ - public function testHandle() - { - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $handler = new CouchDBHandler(); - - try { - $handler->handle($record); - } catch (\RuntimeException $e) { - $this->markTestSkipped('Could not connect to couchdb server on http://localhost:5984'); - } - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/DoctrineCouchDBHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/DoctrineCouchDBHandlerTest.php deleted file mode 100644 index d67da90..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/DoctrineCouchDBHandlerTest.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class DoctrineCouchDBHandlerTest extends TestCase -{ - protected function setup() - { - if (!class_exists('Doctrine\CouchDB\CouchDBClient')) { - $this->markTestSkipped('The "doctrine/couchdb" package is not installed'); - } - } - - public function testHandle() - { - $client = $this->getMockBuilder('Doctrine\\CouchDB\\CouchDBClient') - ->setMethods(array('postDocument')) - ->disableOriginalConstructor() - ->getMock(); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $expected = array( - 'message' => 'test', - 'context' => array('data' => '[object] (stdClass: {})', 'foo' => 34), - 'level' => Logger::WARNING, - 'level_name' => 'WARNING', - 'channel' => 'test', - 'datetime' => $record['datetime']->format('Y-m-d H:i:s'), - 'extra' => array(), - ); - - $client->expects($this->once()) - ->method('postDocument') - ->with($expected); - - $handler = new DoctrineCouchDBHandler($client); - $handler->handle($record); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php deleted file mode 100644 index 42d4323..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; - -class DynamoDbHandlerTest extends TestCase -{ - private $client; - - public function setUp() - { - if (!class_exists('Aws\DynamoDb\DynamoDbClient')) { - $this->markTestSkipped('aws/aws-sdk-php not installed'); - } - - $this->client = $this->getMockBuilder('Aws\DynamoDb\DynamoDbClient') - ->setMethods(array('formatAttributes', '__call')) - ->disableOriginalConstructor()->getMock(); - } - - public function testConstruct() - { - $this->assertInstanceOf('Monolog\Handler\DynamoDbHandler', new DynamoDbHandler($this->client, 'foo')); - } - - public function testInterface() - { - $this->assertInstanceOf('Monolog\Handler\HandlerInterface', new DynamoDbHandler($this->client, 'foo')); - } - - public function testGetFormatter() - { - $handler = new DynamoDbHandler($this->client, 'foo'); - $this->assertInstanceOf('Monolog\Formatter\ScalarFormatter', $handler->getFormatter()); - } - - public function testHandle() - { - $record = $this->getRecord(); - $formatter = $this->getMock('Monolog\Formatter\FormatterInterface'); - $formatted = array('foo' => 1, 'bar' => 2); - $handler = new DynamoDbHandler($this->client, 'foo'); - $handler->setFormatter($formatter); - - $formatter - ->expects($this->once()) - ->method('format') - ->with($record) - ->will($this->returnValue($formatted)); - $this->client - ->expects($this->once()) - ->method('formatAttributes') - ->with($this->isType('array')) - ->will($this->returnValue($formatted)); - $this->client - ->expects($this->once()) - ->method('__call') - ->with('putItem', array(array( - 'TableName' => 'foo', - 'Item' => $formatted - ))); - - $handler->handle($record); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php deleted file mode 100644 index 1687074..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php +++ /dev/null @@ -1,239 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\ElasticaFormatter; -use Monolog\Formatter\NormalizerFormatter; -use Monolog\TestCase; -use Monolog\Logger; -use Elastica\Client; -use Elastica\Request; -use Elastica\Response; - -class ElasticSearchHandlerTest extends TestCase -{ - /** - * @var Client mock - */ - protected $client; - - /** - * @var array Default handler options - */ - protected $options = array( - 'index' => 'my_index', - 'type' => 'doc_type', - ); - - public function setUp() - { - // Elastica lib required - if (!class_exists("Elastica\Client")) { - $this->markTestSkipped("ruflin/elastica not installed"); - } - - // base mock Elastica Client object - $this->client = $this->getMockBuilder('Elastica\Client') - ->setMethods(array('addDocuments')) - ->disableOriginalConstructor() - ->getMock(); - } - - /** - * @covers Monolog\Handler\ElasticSearchHandler::write - * @covers Monolog\Handler\ElasticSearchHandler::handleBatch - * @covers Monolog\Handler\ElasticSearchHandler::bulkSend - * @covers Monolog\Handler\ElasticSearchHandler::getDefaultFormatter - */ - public function testHandle() - { - // log message - $msg = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - // format expected result - $formatter = new ElasticaFormatter($this->options['index'], $this->options['type']); - $expected = array($formatter->format($msg)); - - // setup ES client mock - $this->client->expects($this->any()) - ->method('addDocuments') - ->with($expected); - - // perform tests - $handler = new ElasticSearchHandler($this->client, $this->options); - $handler->handle($msg); - $handler->handleBatch(array($msg)); - } - - /** - * @covers Monolog\Handler\ElasticSearchHandler::setFormatter - */ - public function testSetFormatter() - { - $handler = new ElasticSearchHandler($this->client); - $formatter = new ElasticaFormatter('index_new', 'type_new'); - $handler->setFormatter($formatter); - $this->assertInstanceOf('Monolog\Formatter\ElasticaFormatter', $handler->getFormatter()); - $this->assertEquals('index_new', $handler->getFormatter()->getIndex()); - $this->assertEquals('type_new', $handler->getFormatter()->getType()); - } - - /** - * @covers Monolog\Handler\ElasticSearchHandler::setFormatter - * @expectedException InvalidArgumentException - * @expectedExceptionMessage ElasticSearchHandler is only compatible with ElasticaFormatter - */ - public function testSetFormatterInvalid() - { - $handler = new ElasticSearchHandler($this->client); - $formatter = new NormalizerFormatter(); - $handler->setFormatter($formatter); - } - - /** - * @covers Monolog\Handler\ElasticSearchHandler::__construct - * @covers Monolog\Handler\ElasticSearchHandler::getOptions - */ - public function testOptions() - { - $expected = array( - 'index' => $this->options['index'], - 'type' => $this->options['type'], - 'ignore_error' => false, - ); - $handler = new ElasticSearchHandler($this->client, $this->options); - $this->assertEquals($expected, $handler->getOptions()); - } - - /** - * @covers Monolog\Handler\ElasticSearchHandler::bulkSend - * @dataProvider providerTestConnectionErrors - */ - public function testConnectionErrors($ignore, $expectedError) - { - $clientOpts = array('host' => '127.0.0.1', 'port' => 1); - $client = new Client($clientOpts); - $handlerOpts = array('ignore_error' => $ignore); - $handler = new ElasticSearchHandler($client, $handlerOpts); - - if ($expectedError) { - $this->setExpectedException($expectedError[0], $expectedError[1]); - $handler->handle($this->getRecord()); - } else { - $this->assertFalse($handler->handle($this->getRecord())); - } - } - - /** - * @return array - */ - public function providerTestConnectionErrors() - { - return array( - array(false, array('RuntimeException', 'Error sending messages to Elasticsearch')), - array(true, false), - ); - } - - /** - * Integration test using localhost Elastic Search server - * - * @covers Monolog\Handler\ElasticSearchHandler::__construct - * @covers Monolog\Handler\ElasticSearchHandler::handleBatch - * @covers Monolog\Handler\ElasticSearchHandler::bulkSend - * @covers Monolog\Handler\ElasticSearchHandler::getDefaultFormatter - */ - public function testHandleIntegration() - { - $msg = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $expected = $msg; - $expected['datetime'] = $msg['datetime']->format(\DateTime::ISO8601); - $expected['context'] = array( - 'class' => '[object] (stdClass: {})', - 'foo' => 7, - 0 => 'bar', - ); - - $client = new Client(); - $handler = new ElasticSearchHandler($client, $this->options); - try { - $handler->handleBatch(array($msg)); - } catch (\RuntimeException $e) { - $this->markTestSkipped("Cannot connect to Elastic Search server on localhost"); - } - - // check document id from ES server response - $documentId = $this->getCreatedDocId($client->getLastResponse()); - $this->assertNotEmpty($documentId, 'No elastic document id received'); - - // retrieve document source from ES and validate - $document = $this->getDocSourceFromElastic( - $client, - $this->options['index'], - $this->options['type'], - $documentId - ); - $this->assertEquals($expected, $document); - - // remove test index from ES - $client->request("/{$this->options['index']}", Request::DELETE); - } - - /** - * Return last created document id from ES response - * @param Response $response Elastica Response object - * @return string|null - */ - protected function getCreatedDocId(Response $response) - { - $data = $response->getData(); - if (!empty($data['items'][0]['create']['_id'])) { - return $data['items'][0]['create']['_id']; - } - } - - /** - * Retrieve document by id from Elasticsearch - * @param Client $client Elastica client - * @param string $index - * @param string $type - * @param string $documentId - * @return array - */ - protected function getDocSourceFromElastic(Client $client, $index, $type, $documentId) - { - $resp = $client->request("/{$index}/{$type}/{$documentId}", Request::GET); - $data = $resp->getData(); - if (!empty($data['_source'])) { - return $data['_source']; - } - - return array(); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php deleted file mode 100644 index 99785cb..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Formatter\LineFormatter; - -function error_log() -{ - $GLOBALS['error_log'][] = func_get_args(); -} - -class ErrorLogHandlerTest extends TestCase -{ - protected function setUp() - { - $GLOBALS['error_log'] = array(); - } - - /** - * @covers Monolog\Handler\ErrorLogHandler::__construct - * @expectedException InvalidArgumentException - * @expectedExceptionMessage The given message type "42" is not supported - */ - public function testShouldNotAcceptAnInvalidTypeOnContructor() - { - new ErrorLogHandler(42); - } - - /** - * @covers Monolog\Handler\ErrorLogHandler::write - */ - public function testShouldLogMessagesUsingErrorLogFuncion() - { - $type = ErrorLogHandler::OPERATING_SYSTEM; - $handler = new ErrorLogHandler($type); - $handler->setFormatter(new LineFormatter('%channel%.%level_name%: %message% %context% %extra%', null, true)); - $handler->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz")); - - $this->assertSame("test.ERROR: Foo\nBar\r\n\r\nBaz [] []", $GLOBALS['error_log'][0][0]); - $this->assertSame($GLOBALS['error_log'][0][1], $type); - - $handler = new ErrorLogHandler($type, Logger::DEBUG, true, true); - $handler->setFormatter(new LineFormatter(null, null, true)); - $handler->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz")); - - $this->assertStringMatchesFormat('[%s] test.ERROR: Foo', $GLOBALS['error_log'][1][0]); - $this->assertSame($GLOBALS['error_log'][1][1], $type); - - $this->assertStringMatchesFormat('Bar', $GLOBALS['error_log'][2][0]); - $this->assertSame($GLOBALS['error_log'][2][1], $type); - - $this->assertStringMatchesFormat('Baz [] []', $GLOBALS['error_log'][3][0]); - $this->assertSame($GLOBALS['error_log'][3][1], $type); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php deleted file mode 100644 index 31b7686..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php +++ /dev/null @@ -1,170 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\TestCase; - -class FilterHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\FilterHandler::isHandling - */ - public function testIsHandling() - { - $test = new TestHandler(); - $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::INFO))); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::NOTICE))); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::WARNING))); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::ERROR))); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::CRITICAL))); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::ALERT))); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::EMERGENCY))); - } - - /** - * @covers Monolog\Handler\FilterHandler::handle - * @covers Monolog\Handler\FilterHandler::setAcceptedLevels - * @covers Monolog\Handler\FilterHandler::isHandling - */ - public function testHandleProcessOnlyNeededLevels() - { - $test = new TestHandler(); - $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE); - - $handler->handle($this->getRecord(Logger::DEBUG)); - $this->assertFalse($test->hasDebugRecords()); - - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertTrue($test->hasInfoRecords()); - $handler->handle($this->getRecord(Logger::NOTICE)); - $this->assertTrue($test->hasNoticeRecords()); - - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertFalse($test->hasWarningRecords()); - $handler->handle($this->getRecord(Logger::ERROR)); - $this->assertFalse($test->hasErrorRecords()); - $handler->handle($this->getRecord(Logger::CRITICAL)); - $this->assertFalse($test->hasCriticalRecords()); - $handler->handle($this->getRecord(Logger::ALERT)); - $this->assertFalse($test->hasAlertRecords()); - $handler->handle($this->getRecord(Logger::EMERGENCY)); - $this->assertFalse($test->hasEmergencyRecords()); - - $test = new TestHandler(); - $handler = new FilterHandler($test, array(Logger::INFO, Logger::ERROR)); - - $handler->handle($this->getRecord(Logger::DEBUG)); - $this->assertFalse($test->hasDebugRecords()); - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertTrue($test->hasInfoRecords()); - $handler->handle($this->getRecord(Logger::NOTICE)); - $this->assertFalse($test->hasNoticeRecords()); - $handler->handle($this->getRecord(Logger::ERROR)); - $this->assertTrue($test->hasErrorRecords()); - $handler->handle($this->getRecord(Logger::CRITICAL)); - $this->assertFalse($test->hasCriticalRecords()); - } - - /** - * @covers Monolog\Handler\FilterHandler::setAcceptedLevels - * @covers Monolog\Handler\FilterHandler::getAcceptedLevels - */ - public function testAcceptedLevelApi() - { - $test = new TestHandler(); - $handler = new FilterHandler($test); - - $levels = array(Logger::INFO, Logger::ERROR); - $handler->setAcceptedLevels($levels); - $this->assertSame($levels, $handler->getAcceptedLevels()); - - $handler->setAcceptedLevels(array('info', 'error')); - $this->assertSame($levels, $handler->getAcceptedLevels()); - - $levels = array(Logger::CRITICAL, Logger::ALERT, Logger::EMERGENCY); - $handler->setAcceptedLevels(Logger::CRITICAL, Logger::EMERGENCY); - $this->assertSame($levels, $handler->getAcceptedLevels()); - - $handler->setAcceptedLevels('critical', 'emergency'); - $this->assertSame($levels, $handler->getAcceptedLevels()); - } - - /** - * @covers Monolog\Handler\FilterHandler::handle - */ - public function testHandleUsesProcessors() - { - $test = new TestHandler(); - $handler = new FilterHandler($test, Logger::DEBUG, Logger::EMERGENCY); - $handler->pushProcessor( - function ($record) { - $record['extra']['foo'] = true; - - return $record; - } - ); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasWarningRecords()); - $records = $test->getRecords(); - $this->assertTrue($records[0]['extra']['foo']); - } - - /** - * @covers Monolog\Handler\FilterHandler::handle - */ - public function testHandleRespectsBubble() - { - $test = new TestHandler(); - - $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE, false); - $this->assertTrue($handler->handle($this->getRecord(Logger::INFO))); - $this->assertFalse($handler->handle($this->getRecord(Logger::WARNING))); - - $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE, true); - $this->assertFalse($handler->handle($this->getRecord(Logger::INFO))); - $this->assertFalse($handler->handle($this->getRecord(Logger::WARNING))); - } - - /** - * @covers Monolog\Handler\FilterHandler::handle - */ - public function testHandleWithCallback() - { - $test = new TestHandler(); - $handler = new FilterHandler( - function ($record, $handler) use ($test) { - return $test; - }, Logger::INFO, Logger::NOTICE, false - ); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertFalse($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - } - - /** - * @covers Monolog\Handler\FilterHandler::handle - * @expectedException \RuntimeException - */ - public function testHandleWithBadCallbackThrowsException() - { - $handler = new FilterHandler( - function ($record, $handler) { - return 'foo'; - } - ); - $handler->handle($this->getRecord(Logger::WARNING)); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php deleted file mode 100644 index 8e31e9b..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php +++ /dev/null @@ -1,255 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy; -use Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy; -use Psr\Log\LogLevel; - -class FingersCrossedHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\FingersCrossedHandler::__construct - * @covers Monolog\Handler\FingersCrossedHandler::handle - */ - public function testHandleBuffers() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertFalse($test->hasDebugRecords()); - $this->assertFalse($test->hasInfoRecords()); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->close(); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 3); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::handle - */ - public function testHandleStopsBufferingAfterTrigger() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->close(); - $this->assertTrue($test->hasWarningRecords()); - $this->assertTrue($test->hasDebugRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::handle - * @covers Monolog\Handler\FingersCrossedHandler::reset - */ - public function testHandleRestartBufferingAfterReset() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->reset(); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->close(); - $this->assertTrue($test->hasWarningRecords()); - $this->assertTrue($test->hasDebugRecords()); - $this->assertFalse($test->hasInfoRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::handle - */ - public function testHandleRestartBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, Logger::WARNING, 0, false, false); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->close(); - $this->assertTrue($test->hasWarningRecords()); - $this->assertTrue($test->hasDebugRecords()); - $this->assertFalse($test->hasInfoRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::handle - */ - public function testHandleBufferLimit() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, Logger::WARNING, 2); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasWarningRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertFalse($test->hasDebugRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::handle - */ - public function testHandleWithCallback() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler(function ($record, $handler) use ($test) { - return $test; - }); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertFalse($test->hasDebugRecords()); - $this->assertFalse($test->hasInfoRecords()); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 3); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::handle - * @expectedException RuntimeException - */ - public function testHandleWithBadCallbackThrowsException() - { - $handler = new FingersCrossedHandler(function ($record, $handler) { - return 'foo'; - }); - $handler->handle($this->getRecord(Logger::WARNING)); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::isHandling - */ - public function testIsHandlingAlways() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, Logger::ERROR); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::DEBUG))); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::__construct - * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::__construct - * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::isHandlerActivated - */ - public function testErrorLevelActivationStrategy() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $this->assertFalse($test->hasDebugRecords()); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasWarningRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::__construct - * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::__construct - * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::isHandlerActivated - */ - public function testErrorLevelActivationStrategyWithPsrLevel() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy('warning')); - $handler->handle($this->getRecord(Logger::DEBUG)); - $this->assertFalse($test->hasDebugRecords()); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasWarningRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct - * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated - */ - public function testChannelLevelActivationStrategy() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy(Logger::ERROR, array('othertest' => Logger::DEBUG))); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertFalse($test->hasWarningRecords()); - $record = $this->getRecord(Logger::DEBUG); - $record['channel'] = 'othertest'; - $handler->handle($record); - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasWarningRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct - * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated - */ - public function testChannelLevelActivationStrategyWithPsrLevels() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy('error', array('othertest' => 'debug'))); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertFalse($test->hasWarningRecords()); - $record = $this->getRecord(Logger::DEBUG); - $record['channel'] = 'othertest'; - $handler->handle($record); - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasWarningRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::handle - */ - public function testHandleUsesProcessors() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, Logger::INFO); - $handler->pushProcessor(function ($record) { - $record['extra']['foo'] = true; - - return $record; - }); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasWarningRecords()); - $records = $test->getRecords(); - $this->assertTrue($records[0]['extra']['foo']); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::close - */ - public function testPassthruOnClose() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, true, true, Logger::INFO); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->close(); - $this->assertFalse($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::close - */ - public function testPsrLevelPassthruOnClose() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, true, true, LogLevel::INFO); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->close(); - $this->assertFalse($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php deleted file mode 100644 index 0eb10a6..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @covers Monolog\Handler\FirePHPHandler - */ -class FirePHPHandlerTest extends TestCase -{ - public function setUp() - { - TestFirePHPHandler::reset(); - $_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; FirePHP/1.0'; - } - - public function testHeaders() - { - $handler = new TestFirePHPHandler; - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::WARNING)); - - $expected = array( - 'X-Wf-Protocol-1' => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2', - 'X-Wf-1-Structure-1' => 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1', - 'X-Wf-1-Plugin-1' => 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3', - 'X-Wf-1-1-1-1' => 'test', - 'X-Wf-1-1-1-2' => 'test', - ); - - $this->assertEquals($expected, $handler->getHeaders()); - } - - public function testConcurrentHandlers() - { - $handler = new TestFirePHPHandler; - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::WARNING)); - - $handler2 = new TestFirePHPHandler; - $handler2->setFormatter($this->getIdentityFormatter()); - $handler2->handle($this->getRecord(Logger::DEBUG)); - $handler2->handle($this->getRecord(Logger::WARNING)); - - $expected = array( - 'X-Wf-Protocol-1' => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2', - 'X-Wf-1-Structure-1' => 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1', - 'X-Wf-1-Plugin-1' => 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3', - 'X-Wf-1-1-1-1' => 'test', - 'X-Wf-1-1-1-2' => 'test', - ); - - $expected2 = array( - 'X-Wf-1-1-1-3' => 'test', - 'X-Wf-1-1-1-4' => 'test', - ); - - $this->assertEquals($expected, $handler->getHeaders()); - $this->assertEquals($expected2, $handler2->getHeaders()); - } -} - -class TestFirePHPHandler extends FirePHPHandler -{ - protected $headers = array(); - - public static function reset() - { - self::$initialized = false; - self::$sendHeaders = true; - self::$messageIndex = 1; - } - - protected function sendHeader($header, $content) - { - $this->headers[$header] = $content; - } - - public function getHeaders() - { - return $this->headers; - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php deleted file mode 100644 index 91cdd31..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\LineFormatter; -use Monolog\Logger; -use Monolog\TestCase; - -/** - * @coversDefaultClass \Monolog\Handler\FleepHookHandler - */ -class FleepHookHandlerTest extends TestCase -{ - /** - * Default token to use in tests - */ - const TOKEN = '123abc'; - - /** - * @var FleepHookHandler - */ - private $handler; - - public function setUp() - { - parent::setUp(); - - if (!extension_loaded('openssl')) { - $this->markTestSkipped('This test requires openssl extension to run'); - } - - // Create instances of the handler and logger for convenience - $this->handler = new FleepHookHandler(self::TOKEN); - } - - /** - * @covers ::__construct - */ - public function testConstructorSetsExpectedDefaults() - { - $this->assertEquals(Logger::DEBUG, $this->handler->getLevel()); - $this->assertEquals(true, $this->handler->getBubble()); - } - - /** - * @covers ::getDefaultFormatter - */ - public function testHandlerUsesLineFormatterWhichIgnoresEmptyArrays() - { - $record = array( - 'message' => 'msg', - 'context' => array(), - 'level' => Logger::DEBUG, - 'level_name' => Logger::getLevelName(Logger::DEBUG), - 'channel' => 'channel', - 'datetime' => new \DateTime(), - 'extra' => array(), - ); - - $expectedFormatter = new LineFormatter(null, null, true, true); - $expected = $expectedFormatter->format($record); - - $handlerFormatter = $this->handler->getFormatter(); - $actual = $handlerFormatter->format($record); - - $this->assertEquals($expected, $actual, 'Empty context and extra arrays should not be rendered'); - } - - /** - * @covers ::__construct - */ - public function testConnectionStringisConstructedCorrectly() - { - $this->assertEquals('ssl://' . FleepHookHandler::FLEEP_HOST . ':443', $this->handler->getConnectionString()); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php deleted file mode 100644 index 4b120d5..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\FlowdockFormatter; -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @author Dominik Liebler - * @see https://www.hipchat.com/docs/api - */ -class FlowdockHandlerTest extends TestCase -{ - /** - * @var resource - */ - private $res; - - /** - * @var FlowdockHandler - */ - private $handler; - - public function setUp() - { - if (!extension_loaded('openssl')) { - $this->markTestSkipped('This test requires openssl to run'); - } - } - - public function testWriteHeader() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/v1\/messages\/team_inbox\/.* HTTP\/1.1\\r\\nHost: api.flowdock.com\\r\\nContent-Type: application\/json\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - - return $content; - } - - /** - * @depends testWriteHeader - */ - public function testWriteContent($content) - { - $this->assertRegexp('/"source":"test_source"/', $content); - $this->assertRegexp('/"from_address":"source@test\.com"/', $content); - } - - private function createHandler($token = 'myToken') - { - $constructorArgs = array($token, Logger::DEBUG); - $this->res = fopen('php://memory', 'a'); - $this->handler = $this->getMock( - '\Monolog\Handler\FlowdockHandler', - array('fsockopen', 'streamSetTimeout', 'closeSocket'), - $constructorArgs - ); - - $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($this->handler, 'localhost:1234'); - - $this->handler->expects($this->any()) - ->method('fsockopen') - ->will($this->returnValue($this->res)); - $this->handler->expects($this->any()) - ->method('streamSetTimeout') - ->will($this->returnValue(true)); - $this->handler->expects($this->any()) - ->method('closeSocket') - ->will($this->returnValue(true)); - - $this->handler->setFormatter(new FlowdockFormatter('test_source', 'source@test.com')); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php deleted file mode 100644 index 9d007b1..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Gelf\Message; -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Formatter\GelfMessageFormatter; - -class GelfHandlerLegacyTest extends TestCase -{ - public function setUp() - { - if (!class_exists('Gelf\MessagePublisher') || !class_exists('Gelf\Message')) { - $this->markTestSkipped("mlehner/gelf-php not installed"); - } - - require_once __DIR__ . '/GelfMockMessagePublisher.php'; - } - - /** - * @covers Monolog\Handler\GelfHandler::__construct - */ - public function testConstruct() - { - $handler = new GelfHandler($this->getMessagePublisher()); - $this->assertInstanceOf('Monolog\Handler\GelfHandler', $handler); - } - - protected function getHandler($messagePublisher) - { - $handler = new GelfHandler($messagePublisher); - - return $handler; - } - - protected function getMessagePublisher() - { - return new GelfMockMessagePublisher('localhost'); - } - - public function testDebug() - { - $messagePublisher = $this->getMessagePublisher(); - $handler = $this->getHandler($messagePublisher); - - $record = $this->getRecord(Logger::DEBUG, "A test debug message"); - $handler->handle($record); - - $this->assertEquals(7, $messagePublisher->lastMessage->getLevel()); - $this->assertEquals('test', $messagePublisher->lastMessage->getFacility()); - $this->assertEquals($record['message'], $messagePublisher->lastMessage->getShortMessage()); - $this->assertEquals(null, $messagePublisher->lastMessage->getFullMessage()); - } - - public function testWarning() - { - $messagePublisher = $this->getMessagePublisher(); - $handler = $this->getHandler($messagePublisher); - - $record = $this->getRecord(Logger::WARNING, "A test warning message"); - $handler->handle($record); - - $this->assertEquals(4, $messagePublisher->lastMessage->getLevel()); - $this->assertEquals('test', $messagePublisher->lastMessage->getFacility()); - $this->assertEquals($record['message'], $messagePublisher->lastMessage->getShortMessage()); - $this->assertEquals(null, $messagePublisher->lastMessage->getFullMessage()); - } - - public function testInjectedGelfMessageFormatter() - { - $messagePublisher = $this->getMessagePublisher(); - $handler = $this->getHandler($messagePublisher); - - $handler->setFormatter(new GelfMessageFormatter('mysystem', 'EXT', 'CTX')); - - $record = $this->getRecord(Logger::WARNING, "A test warning message"); - $record['extra']['blarg'] = 'yep'; - $record['context']['from'] = 'logger'; - $handler->handle($record); - - $this->assertEquals('mysystem', $messagePublisher->lastMessage->getHost()); - $this->assertArrayHasKey('_EXTblarg', $messagePublisher->lastMessage->toArray()); - $this->assertArrayHasKey('_CTXfrom', $messagePublisher->lastMessage->toArray()); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php deleted file mode 100644 index 8cdd64f..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php +++ /dev/null @@ -1,117 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Gelf\Message; -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Formatter\GelfMessageFormatter; - -class GelfHandlerTest extends TestCase -{ - public function setUp() - { - if (!class_exists('Gelf\Publisher') || !class_exists('Gelf\Message')) { - $this->markTestSkipped("graylog2/gelf-php not installed"); - } - } - - /** - * @covers Monolog\Handler\GelfHandler::__construct - */ - public function testConstruct() - { - $handler = new GelfHandler($this->getMessagePublisher()); - $this->assertInstanceOf('Monolog\Handler\GelfHandler', $handler); - } - - protected function getHandler($messagePublisher) - { - $handler = new GelfHandler($messagePublisher); - - return $handler; - } - - protected function getMessagePublisher() - { - return $this->getMock('Gelf\Publisher', array('publish'), array(), '', false); - } - - public function testDebug() - { - $record = $this->getRecord(Logger::DEBUG, "A test debug message"); - $expectedMessage = new Message(); - $expectedMessage - ->setLevel(7) - ->setFacility("test") - ->setShortMessage($record['message']) - ->setTimestamp($record['datetime']) - ; - - $messagePublisher = $this->getMessagePublisher(); - $messagePublisher->expects($this->once()) - ->method('publish') - ->with($expectedMessage); - - $handler = $this->getHandler($messagePublisher); - - $handler->handle($record); - } - - public function testWarning() - { - $record = $this->getRecord(Logger::WARNING, "A test warning message"); - $expectedMessage = new Message(); - $expectedMessage - ->setLevel(4) - ->setFacility("test") - ->setShortMessage($record['message']) - ->setTimestamp($record['datetime']) - ; - - $messagePublisher = $this->getMessagePublisher(); - $messagePublisher->expects($this->once()) - ->method('publish') - ->with($expectedMessage); - - $handler = $this->getHandler($messagePublisher); - - $handler->handle($record); - } - - public function testInjectedGelfMessageFormatter() - { - $record = $this->getRecord(Logger::WARNING, "A test warning message"); - $record['extra']['blarg'] = 'yep'; - $record['context']['from'] = 'logger'; - - $expectedMessage = new Message(); - $expectedMessage - ->setLevel(4) - ->setFacility("test") - ->setHost("mysystem") - ->setShortMessage($record['message']) - ->setTimestamp($record['datetime']) - ->setAdditional("EXTblarg", 'yep') - ->setAdditional("CTXfrom", 'logger') - ; - - $messagePublisher = $this->getMessagePublisher(); - $messagePublisher->expects($this->once()) - ->method('publish') - ->with($expectedMessage); - - $handler = $this->getHandler($messagePublisher); - $handler->setFormatter(new GelfMessageFormatter('mysystem', 'EXT', 'CTX')); - $handler->handle($record); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php deleted file mode 100644 index 873d92f..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Gelf\MessagePublisher; -use Gelf\Message; - -class GelfMockMessagePublisher extends MessagePublisher -{ - public function publish(Message $message) - { - $this->lastMessage = $message; - } - - public $lastMessage = null; -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php deleted file mode 100644 index c6298a6..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class GroupHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\GroupHandler::__construct - * @expectedException InvalidArgumentException - */ - public function testConstructorOnlyTakesHandler() - { - new GroupHandler(array(new TestHandler(), "foo")); - } - - /** - * @covers Monolog\Handler\GroupHandler::__construct - * @covers Monolog\Handler\GroupHandler::handle - */ - public function testHandle() - { - $testHandlers = array(new TestHandler(), new TestHandler()); - $handler = new GroupHandler($testHandlers); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - foreach ($testHandlers as $test) { - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 2); - } - } - - /** - * @covers Monolog\Handler\GroupHandler::handleBatch - */ - public function testHandleBatch() - { - $testHandlers = array(new TestHandler(), new TestHandler()); - $handler = new GroupHandler($testHandlers); - $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO))); - foreach ($testHandlers as $test) { - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 2); - } - } - - /** - * @covers Monolog\Handler\GroupHandler::isHandling - */ - public function testIsHandling() - { - $testHandlers = array(new TestHandler(Logger::ERROR), new TestHandler(Logger::WARNING)); - $handler = new GroupHandler($testHandlers); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::ERROR))); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::WARNING))); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); - } - - /** - * @covers Monolog\Handler\GroupHandler::handle - */ - public function testHandleUsesProcessors() - { - $test = new TestHandler(); - $handler = new GroupHandler(array($test)); - $handler->pushProcessor(function ($record) { - $record['extra']['foo'] = true; - - return $record; - }); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasWarningRecords()); - $records = $test->getRecords(); - $this->assertTrue($records[0]['extra']['foo']); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php deleted file mode 100644 index 462dac8..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php +++ /dev/null @@ -1,244 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @author Rafael Dohms - * @see https://www.hipchat.com/docs/api - */ -class HipChatHandlerTest extends TestCase -{ - private $res; - private $handler; - - public function testWriteHeader() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/v1\/rooms\/message\?format=json&auth_token=.* HTTP\/1.1\\r\\nHost: api.hipchat.com\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - - return $content; - } - - public function testWriteCustomHostHeader() - { - $this->createHandler('myToken', 'room1', 'Monolog', true, 'hipchat.foo.bar'); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/v1\/rooms\/message\?format=json&auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - - return $content; - } - - public function testWriteV2() - { - $this->createHandler('myToken', 'room1', 'Monolog', false, 'hipchat.foo.bar', 'v2'); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/v2\/room\/room1\/notification\?auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - - return $content; - } - - public function testWriteV2Notify() - { - $this->createHandler('myToken', 'room1', 'Monolog', true, 'hipchat.foo.bar', 'v2'); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/v2\/room\/room1\/notification\?auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - - return $content; - } - - public function testRoomSpaces() - { - $this->createHandler('myToken', 'room name', 'Monolog', false, 'hipchat.foo.bar', 'v2'); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/v2\/room\/room%20name\/notification\?auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - - return $content; - } - - /** - * @depends testWriteHeader - */ - public function testWriteContent($content) - { - $this->assertRegexp('/notify=0&message=test1&message_format=text&color=red&room_id=room1&from=Monolog$/', $content); - } - - /** - * @depends testWriteCustomHostHeader - */ - public function testWriteContentNotify($content) - { - $this->assertRegexp('/notify=1&message=test1&message_format=text&color=red&room_id=room1&from=Monolog$/', $content); - } - - /** - * @depends testWriteV2 - */ - public function testWriteContentV2($content) - { - $this->assertRegexp('/notify=false&message=test1&message_format=text&color=red$/', $content); - } - - /** - * @depends testWriteV2Notify - */ - public function testWriteContentV2Notify($content) - { - $this->assertRegexp('/notify=true&message=test1&message_format=text&color=red$/', $content); - } - - public function testWriteWithComplexMessage() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Backup of database "example" finished in 16 minutes.')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/message=Backup\+of\+database\+%22example%22\+finished\+in\+16\+minutes\./', $content); - } - - /** - * @dataProvider provideLevelColors - */ - public function testWriteWithErrorLevelsAndColors($level, $expectedColor) - { - $this->createHandler(); - $this->handler->handle($this->getRecord($level, 'Backup of database "example" finished in 16 minutes.')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/color='.$expectedColor.'/', $content); - } - - public function provideLevelColors() - { - return array( - array(Logger::DEBUG, 'gray'), - array(Logger::INFO, 'green'), - array(Logger::WARNING, 'yellow'), - array(Logger::ERROR, 'red'), - array(Logger::CRITICAL, 'red'), - array(Logger::ALERT, 'red'), - array(Logger::EMERGENCY,'red'), - array(Logger::NOTICE, 'green'), - ); - } - - /** - * @dataProvider provideBatchRecords - */ - public function testHandleBatch($records, $expectedColor) - { - $this->createHandler(); - - $this->handler->handleBatch($records); - - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/color='.$expectedColor.'/', $content); - } - - public function provideBatchRecords() - { - return array( - array( - array( - array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()), - array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()), - array('level' => Logger::CRITICAL, 'message' => 'Everything is broken!', 'level_name' => 'critical', 'datetime' => new \DateTime()) - ), - 'red', - ), - array( - array( - array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()), - array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()), - ), - 'yellow', - ), - array( - array( - array('level' => Logger::DEBUG, 'message' => 'Just debugging.', 'level_name' => 'debug', 'datetime' => new \DateTime()), - array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()), - ), - 'green', - ), - array( - array( - array('level' => Logger::DEBUG, 'message' => 'Just debugging.', 'level_name' => 'debug', 'datetime' => new \DateTime()), - ), - 'gray', - ), - ); - } - - private function createHandler($token = 'myToken', $room = 'room1', $name = 'Monolog', $notify = false, $host = 'api.hipchat.com', $version = 'v1') - { - $constructorArgs = array($token, $room, $name, $notify, Logger::DEBUG, true, true, 'text', $host, $version); - $this->res = fopen('php://memory', 'a'); - $this->handler = $this->getMock( - '\Monolog\Handler\HipChatHandler', - array('fsockopen', 'streamSetTimeout', 'closeSocket'), - $constructorArgs - ); - - $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($this->handler, 'localhost:1234'); - - $this->handler->expects($this->any()) - ->method('fsockopen') - ->will($this->returnValue($this->res)); - $this->handler->expects($this->any()) - ->method('streamSetTimeout') - ->will($this->returnValue(true)); - $this->handler->expects($this->any()) - ->method('closeSocket') - ->will($this->returnValue(true)); - - $this->handler->setFormatter($this->getIdentityFormatter()); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testCreateWithTooLongName() - { - $hipChatHandler = new HipChatHandler('token', 'room', 'SixteenCharsHere'); - } - - public function testCreateWithTooLongNameV2() - { - // creating a handler with too long of a name but using the v2 api doesn't matter. - $hipChatHandler = new HipChatHandler('token', 'room', 'SixteenCharsHere', false, Logger::CRITICAL, true, true, 'test', 'api.hipchat.com', 'v2'); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php deleted file mode 100644 index 7af60be..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @author Robert Kaufmann III - */ -class LogEntriesHandlerTest extends TestCase -{ - /** - * @var resource - */ - private $res; - - /** - * @var LogEntriesHandler - */ - private $handler; - - public function testWriteContent() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Critical write test')); - - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] test.CRITICAL: Critical write test/', $content); - } - - public function testWriteBatchContent() - { - $records = array( - $this->getRecord(), - $this->getRecord(), - $this->getRecord() - ); - $this->createHandler(); - $this->handler->handleBatch($records); - - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/(testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] .* \[\] \[\]\n){3}/', $content); - } - - private function createHandler() - { - $useSSL = extension_loaded('openssl'); - $args = array('testToken', $useSSL, Logger::DEBUG, true); - $this->res = fopen('php://memory', 'a'); - $this->handler = $this->getMock( - '\Monolog\Handler\LogEntriesHandler', - array('fsockopen', 'streamSetTimeout', 'closeSocket'), - $args - ); - - $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($this->handler, 'localhost:1234'); - - $this->handler->expects($this->any()) - ->method('fsockopen') - ->will($this->returnValue($this->res)); - $this->handler->expects($this->any()) - ->method('streamSetTimeout') - ->will($this->returnValue(true)); - $this->handler->expects($this->any()) - ->method('closeSocket') - ->will($this->returnValue(true)); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php deleted file mode 100644 index 6754f3d..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\TestCase; - -class MailHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\MailHandler::handleBatch - */ - public function testHandleBatch() - { - $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); - $formatter->expects($this->once()) - ->method('formatBatch'); // Each record is formatted - - $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler'); - $handler->expects($this->once()) - ->method('send'); - $handler->expects($this->never()) - ->method('write'); // write is for individual records - - $handler->setFormatter($formatter); - - $handler->handleBatch($this->getMultipleRecords()); - } - - /** - * @covers Monolog\Handler\MailHandler::handleBatch - */ - public function testHandleBatchNotSendsMailIfMessagesAreBelowLevel() - { - $records = array( - $this->getRecord(Logger::DEBUG, 'debug message 1'), - $this->getRecord(Logger::DEBUG, 'debug message 2'), - $this->getRecord(Logger::INFO, 'information'), - ); - - $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler'); - $handler->expects($this->never()) - ->method('send'); - $handler->setLevel(Logger::ERROR); - - $handler->handleBatch($records); - } - - /** - * @covers Monolog\Handler\MailHandler::write - */ - public function testHandle() - { - $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler'); - - $record = $this->getRecord(); - $records = array($record); - $records[0]['formatted'] = '['.$record['datetime']->format('Y-m-d H:i:s').'] test.WARNING: test [] []'."\n"; - - $handler->expects($this->once()) - ->method('send') - ->with($records[0]['formatted'], $records); - - $handler->handle($record); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php deleted file mode 100644 index a083322..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Raven_Client; - -class MockRavenClient extends Raven_Client -{ - public function capture($data, $stack, $vars = null) - { - $data = array_merge($this->get_user_data(), $data); - $this->lastData = $data; - $this->lastStack = $stack; - } - - public $lastData; - public $lastStack; -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php deleted file mode 100644 index 0fdef63..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class MongoDBHandlerTest extends TestCase -{ - /** - * @expectedException InvalidArgumentException - */ - public function testConstructorShouldThrowExceptionForInvalidMongo() - { - new MongoDBHandler(new \stdClass(), 'DB', 'Collection'); - } - - public function testHandle() - { - $mongo = $this->getMock('Mongo', array('selectCollection'), array(), '', false); - $collection = $this->getMock('stdClass', array('save')); - - $mongo->expects($this->once()) - ->method('selectCollection') - ->with('DB', 'Collection') - ->will($this->returnValue($collection)); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $expected = array( - 'message' => 'test', - 'context' => array('data' => '[object] (stdClass: {})', 'foo' => 34), - 'level' => Logger::WARNING, - 'level_name' => 'WARNING', - 'channel' => 'test', - 'datetime' => $record['datetime']->format('Y-m-d H:i:s'), - 'extra' => array(), - ); - - $collection->expects($this->once()) - ->method('save') - ->with($expected); - - $handler = new MongoDBHandler($mongo, 'DB', 'Collection'); - $handler->handle($record); - } -} - -if (!class_exists('Mongo')) { - class Mongo - { - public function selectCollection() - { - } - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php deleted file mode 100644 index c2553ee..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; - -class NativeMailerHandlerTest extends TestCase -{ - /** - * @expectedException InvalidArgumentException - */ - public function testConstructorHeaderInjection() - { - $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', "receiver@example.org\r\nFrom: faked@attacker.org"); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testSetterHeaderInjection() - { - $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org'); - $mailer->addHeader("Content-Type: text/html\r\nFrom: faked@attacker.org"); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testSetterArrayHeaderInjection() - { - $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org'); - $mailer->addHeader(array("Content-Type: text/html\r\nFrom: faked@attacker.org")); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testSetterContentTypeInjection() - { - $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org'); - $mailer->setContentType("text/html\r\nFrom: faked@attacker.org"); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testSetterEncodingInjection() - { - $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org'); - $mailer->setEncoding("utf-8\r\nFrom: faked@attacker.org"); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php deleted file mode 100644 index 4eda615..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php +++ /dev/null @@ -1,192 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class NewRelicHandlerTest extends TestCase -{ - public static $appname; - public static $customParameters; - public static $transactionName; - - public function setUp() - { - self::$appname = null; - self::$customParameters = array(); - self::$transactionName = null; - } - - /** - * @expectedException Monolog\Handler\MissingExtensionException - */ - public function testThehandlerThrowsAnExceptionIfTheNRExtensionIsNotLoaded() - { - $handler = new StubNewRelicHandlerWithoutExtension(); - $handler->handle($this->getRecord(Logger::ERROR)); - } - - public function testThehandlerCanHandleTheRecord() - { - $handler = new StubNewRelicHandler(); - $handler->handle($this->getRecord(Logger::ERROR)); - } - - public function testThehandlerCanAddContextParamsToTheNewRelicTrace() - { - $handler = new StubNewRelicHandler(); - $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('a' => 'b'))); - $this->assertEquals(array('context_a' => 'b'), self::$customParameters); - } - - public function testThehandlerCanAddExplodedContextParamsToTheNewRelicTrace() - { - $handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true); - $handler->handle($this->getRecord( - Logger::ERROR, - 'log message', - array('a' => array('key1' => 'value1', 'key2' => 'value2')) - )); - $this->assertEquals( - array('context_a_key1' => 'value1', 'context_a_key2' => 'value2'), - self::$customParameters - ); - } - - public function testThehandlerCanAddExtraParamsToTheNewRelicTrace() - { - $record = $this->getRecord(Logger::ERROR, 'log message'); - $record['extra'] = array('c' => 'd'); - - $handler = new StubNewRelicHandler(); - $handler->handle($record); - - $this->assertEquals(array('extra_c' => 'd'), self::$customParameters); - } - - public function testThehandlerCanAddExplodedExtraParamsToTheNewRelicTrace() - { - $record = $this->getRecord(Logger::ERROR, 'log message'); - $record['extra'] = array('c' => array('key1' => 'value1', 'key2' => 'value2')); - - $handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true); - $handler->handle($record); - - $this->assertEquals( - array('extra_c_key1' => 'value1', 'extra_c_key2' => 'value2'), - self::$customParameters - ); - } - - public function testThehandlerCanAddExtraContextAndParamsToTheNewRelicTrace() - { - $record = $this->getRecord(Logger::ERROR, 'log message', array('a' => 'b')); - $record['extra'] = array('c' => 'd'); - - $handler = new StubNewRelicHandler(); - $handler->handle($record); - - $expected = array( - 'context_a' => 'b', - 'extra_c' => 'd', - ); - - $this->assertEquals($expected, self::$customParameters); - } - - public function testTheAppNameIsNullByDefault() - { - $handler = new StubNewRelicHandler(); - $handler->handle($this->getRecord(Logger::ERROR, 'log message')); - - $this->assertEquals(null, self::$appname); - } - - public function testTheAppNameCanBeInjectedFromtheConstructor() - { - $handler = new StubNewRelicHandler(Logger::DEBUG, false, 'myAppName'); - $handler->handle($this->getRecord(Logger::ERROR, 'log message')); - - $this->assertEquals('myAppName', self::$appname); - } - - public function testTheAppNameCanBeOverriddenFromEachLog() - { - $handler = new StubNewRelicHandler(Logger::DEBUG, false, 'myAppName'); - $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('appname' => 'logAppName'))); - - $this->assertEquals('logAppName', self::$appname); - } - - public function testTheTransactionNameIsNullByDefault() - { - $handler = new StubNewRelicHandler(); - $handler->handle($this->getRecord(Logger::ERROR, 'log message')); - - $this->assertEquals(null, self::$transactionName); - } - - public function testTheTransactionNameCanBeInjectedFromTheConstructor() - { - $handler = new StubNewRelicHandler(Logger::DEBUG, false, null, false, 'myTransaction'); - $handler->handle($this->getRecord(Logger::ERROR, 'log message')); - - $this->assertEquals('myTransaction', self::$transactionName); - } - - public function testTheTransactionNameCanBeOverriddenFromEachLog() - { - $handler = new StubNewRelicHandler(Logger::DEBUG, false, null, false, 'myTransaction'); - $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('transaction_name' => 'logTransactName'))); - - $this->assertEquals('logTransactName', self::$transactionName); - } -} - -class StubNewRelicHandlerWithoutExtension extends NewRelicHandler -{ - protected function isNewRelicEnabled() - { - return false; - } -} - -class StubNewRelicHandler extends NewRelicHandler -{ - protected function isNewRelicEnabled() - { - return true; - } -} - -function newrelic_notice_error() -{ - return true; -} - -function newrelic_set_appname($appname) -{ - return NewRelicHandlerTest::$appname = $appname; -} - -function newrelic_name_transaction($transactionName) -{ - return NewRelicHandlerTest::$transactionName = $transactionName; -} - -function newrelic_add_custom_parameter($key, $value) -{ - NewRelicHandlerTest::$customParameters[$key] = $value; - - return true; -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php deleted file mode 100644 index 292df78..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @covers Monolog\Handler\NullHandler::handle - */ -class NullHandlerTest extends TestCase -{ - public function testHandle() - { - $handler = new NullHandler(); - $this->assertTrue($handler->handle($this->getRecord())); - } - - public function testHandleLowerLevelRecord() - { - $handler = new NullHandler(Logger::WARNING); - $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG))); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php deleted file mode 100644 index ee95172..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php +++ /dev/null @@ -1,274 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Exception; -use Monolog\ErrorHandler; -use Monolog\Logger; -use Monolog\TestCase; -use PhpConsole\Connector; -use PhpConsole\Dispatcher\Debug as DebugDispatcher; -use PhpConsole\Dispatcher\Errors as ErrorDispatcher; -use PhpConsole\Handler; -use PHPUnit_Framework_MockObject_MockObject; - -/** - * @covers Monolog\Handler\PHPConsoleHandler - * @author Sergey Barbushin https://www.linkedin.com/in/barbushin - */ -class PHPConsoleHandlerTest extends TestCase -{ - - /** @var Connector|PHPUnit_Framework_MockObject_MockObject */ - protected $connector; - /** @var DebugDispatcher|PHPUnit_Framework_MockObject_MockObject */ - protected $debugDispatcher; - /** @var ErrorDispatcher|PHPUnit_Framework_MockObject_MockObject */ - protected $errorDispatcher; - - protected function setUp() - { - if (!class_exists('PhpConsole\Connector')) { - $this->markTestSkipped('PHP Console library not found. See https://github.com/barbushin/php-console#installation'); - } - $this->connector = $this->initConnectorMock(); - - $this->debugDispatcher = $this->initDebugDispatcherMock($this->connector); - $this->connector->setDebugDispatcher($this->debugDispatcher); - - $this->errorDispatcher = $this->initErrorDispatcherMock($this->connector); - $this->connector->setErrorsDispatcher($this->errorDispatcher); - } - - protected function initDebugDispatcherMock(Connector $connector) - { - return $this->getMockBuilder('PhpConsole\Dispatcher\Debug') - ->disableOriginalConstructor() - ->setMethods(array('dispatchDebug')) - ->setConstructorArgs(array($connector, $connector->getDumper())) - ->getMock(); - } - - protected function initErrorDispatcherMock(Connector $connector) - { - return $this->getMockBuilder('PhpConsole\Dispatcher\Errors') - ->disableOriginalConstructor() - ->setMethods(array('dispatchError', 'dispatchException')) - ->setConstructorArgs(array($connector, $connector->getDumper())) - ->getMock(); - } - - protected function initConnectorMock() - { - $connector = $this->getMockBuilder('PhpConsole\Connector') - ->disableOriginalConstructor() - ->setMethods(array( - 'sendMessage', - 'onShutDown', - 'isActiveClient', - 'setSourcesBasePath', - 'setServerEncoding', - 'setPassword', - 'enableSslOnlyMode', - 'setAllowedIpMasks', - 'setHeadersLimit', - 'startEvalRequestsListener', - )) - ->getMock(); - - $connector->expects($this->any()) - ->method('isActiveClient') - ->will($this->returnValue(true)); - - return $connector; - } - - protected function getHandlerDefaultOption($name) - { - $handler = new PHPConsoleHandler(array(), $this->connector); - $options = $handler->getOptions(); - - return $options[$name]; - } - - protected function initLogger($handlerOptions = array(), $level = Logger::DEBUG) - { - return new Logger('test', array( - new PHPConsoleHandler($handlerOptions, $this->connector, $level) - )); - } - - public function testInitWithDefaultConnector() - { - $handler = new PHPConsoleHandler(); - $this->assertEquals(spl_object_hash(Connector::getInstance()), spl_object_hash($handler->getConnector())); - } - - public function testInitWithCustomConnector() - { - $handler = new PHPConsoleHandler(array(), $this->connector); - $this->assertEquals(spl_object_hash($this->connector), spl_object_hash($handler->getConnector())); - } - - public function testDebug() - { - $this->debugDispatcher->expects($this->once())->method('dispatchDebug')->with($this->equalTo('test')); - $this->initLogger()->addDebug('test'); - } - - public function testDebugContextInMessage() - { - $message = 'test'; - $tag = 'tag'; - $context = array($tag, 'custom' => mt_rand()); - $expectedMessage = $message . ' ' . json_encode(array_slice($context, 1)); - $this->debugDispatcher->expects($this->once())->method('dispatchDebug')->with( - $this->equalTo($expectedMessage), - $this->equalTo($tag) - ); - $this->initLogger()->addDebug($message, $context); - } - - public function testDebugTags($tagsContextKeys = null) - { - $expectedTags = mt_rand(); - $logger = $this->initLogger($tagsContextKeys ? array('debugTagsKeysInContext' => $tagsContextKeys) : array()); - if (!$tagsContextKeys) { - $tagsContextKeys = $this->getHandlerDefaultOption('debugTagsKeysInContext'); - } - foreach ($tagsContextKeys as $key) { - $debugDispatcher = $this->initDebugDispatcherMock($this->connector); - $debugDispatcher->expects($this->once())->method('dispatchDebug')->with( - $this->anything(), - $this->equalTo($expectedTags) - ); - $this->connector->setDebugDispatcher($debugDispatcher); - $logger->addDebug('test', array($key => $expectedTags)); - } - } - - public function testError($classesPartialsTraceIgnore = null) - { - $code = E_USER_NOTICE; - $message = 'message'; - $file = __FILE__; - $line = __LINE__; - $this->errorDispatcher->expects($this->once())->method('dispatchError')->with( - $this->equalTo($code), - $this->equalTo($message), - $this->equalTo($file), - $this->equalTo($line), - $classesPartialsTraceIgnore ?: $this->equalTo($this->getHandlerDefaultOption('classesPartialsTraceIgnore')) - ); - $errorHandler = ErrorHandler::register($this->initLogger($classesPartialsTraceIgnore ? array('classesPartialsTraceIgnore' => $classesPartialsTraceIgnore) : array()), false); - $errorHandler->registerErrorHandler(array(), false, E_USER_WARNING); - $errorHandler->handleError($code, $message, $file, $line); - } - - public function testException() - { - $e = new Exception(); - $this->errorDispatcher->expects($this->once())->method('dispatchException')->with( - $this->equalTo($e) - ); - $handler = $this->initLogger(); - $handler->log( - \Psr\Log\LogLevel::ERROR, - sprintf('Uncaught Exception %s: "%s" at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()), - array('exception' => $e) - ); - } - - /** - * @expectedException Exception - */ - public function testWrongOptionsThrowsException() - { - new PHPConsoleHandler(array('xxx' => 1)); - } - - public function testOptionEnabled() - { - $this->debugDispatcher->expects($this->never())->method('dispatchDebug'); - $this->initLogger(array('enabled' => false))->addDebug('test'); - } - - public function testOptionClassesPartialsTraceIgnore() - { - $this->testError(array('Class', 'Namespace\\')); - } - - public function testOptionDebugTagsKeysInContext() - { - $this->testDebugTags(array('key1', 'key2')); - } - - public function testOptionUseOwnErrorsAndExceptionsHandler() - { - $this->initLogger(array('useOwnErrorsHandler' => true, 'useOwnExceptionsHandler' => true)); - $this->assertEquals(array(Handler::getInstance(), 'handleError'), set_error_handler(function () { - })); - $this->assertEquals(array(Handler::getInstance(), 'handleException'), set_exception_handler(function () { - })); - } - - public static function provideConnectorMethodsOptionsSets() - { - return array( - array('sourcesBasePath', 'setSourcesBasePath', __DIR__), - array('serverEncoding', 'setServerEncoding', 'cp1251'), - array('password', 'setPassword', '******'), - array('enableSslOnlyMode', 'enableSslOnlyMode', true, false), - array('ipMasks', 'setAllowedIpMasks', array('127.0.0.*')), - array('headersLimit', 'setHeadersLimit', 2500), - array('enableEvalListener', 'startEvalRequestsListener', true, false), - ); - } - - /** - * @dataProvider provideConnectorMethodsOptionsSets - */ - public function testOptionCallsConnectorMethod($option, $method, $value, $isArgument = true) - { - $expectCall = $this->connector->expects($this->once())->method($method); - if ($isArgument) { - $expectCall->with($value); - } - new PHPConsoleHandler(array($option => $value), $this->connector); - } - - public function testOptionDetectDumpTraceAndSource() - { - new PHPConsoleHandler(array('detectDumpTraceAndSource' => true), $this->connector); - $this->assertTrue($this->connector->getDebugDispatcher()->detectTraceAndSource); - } - - public static function provideDumperOptionsValues() - { - return array( - array('dumperLevelLimit', 'levelLimit', 1001), - array('dumperItemsCountLimit', 'itemsCountLimit', 1002), - array('dumperItemSizeLimit', 'itemSizeLimit', 1003), - array('dumperDumpSizeLimit', 'dumpSizeLimit', 1004), - array('dumperDetectCallbacks', 'detectCallbacks', true), - ); - } - - /** - * @dataProvider provideDumperOptionsValues - */ - public function testDumperOptions($option, $dumperProperty, $value) - { - new PHPConsoleHandler(array($option => $value), $this->connector); - $this->assertEquals($value, $this->connector->getDumper()->$dumperProperty); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php deleted file mode 100644 index 64eaab1..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @covers Monolog\Handler\PsrHandler::handle - */ -class PsrHandlerTest extends TestCase -{ - public function logLevelProvider() - { - $levels = array(); - $monologLogger = new Logger(''); - - foreach ($monologLogger->getLevels() as $levelName => $level) { - $levels[] = array($levelName, $level); - } - - return $levels; - } - - /** - * @dataProvider logLevelProvider - */ - public function testHandlesAllLevels($levelName, $level) - { - $message = 'Hello, world! ' . $level; - $context = array('foo' => 'bar', 'level' => $level); - - $psrLogger = $this->getMock('Psr\Log\NullLogger'); - $psrLogger->expects($this->once()) - ->method('log') - ->with(strtolower($levelName), $message, $context); - - $handler = new PsrHandler($psrLogger); - $handler->handle(array('level' => $level, 'level_name' => $levelName, 'message' => $message, 'context' => $context)); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php deleted file mode 100644 index 8940823..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php +++ /dev/null @@ -1,141 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * Almost all examples (expected header, titles, messages) taken from - * https://www.pushover.net/api - * @author Sebastian Göttschkes - * @see https://www.pushover.net/api - */ -class PushoverHandlerTest extends TestCase -{ - private $res; - private $handler; - - public function testWriteHeader() - { - $this->createHandler(); - $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/1\/messages.json HTTP\/1.1\\r\\nHost: api.pushover.net\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - - return $content; - } - - /** - * @depends testWriteHeader - */ - public function testWriteContent($content) - { - $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}$/', $content); - } - - public function testWriteWithComplexTitle() - { - $this->createHandler('myToken', 'myUser', 'Backup finished - SQL1', Logger::EMERGENCY); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/title=Backup\+finished\+-\+SQL1/', $content); - } - - public function testWriteWithComplexMessage() - { - $this->createHandler(); - $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Backup of database "example" finished in 16 minutes.')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/message=Backup\+of\+database\+%22example%22\+finished\+in\+16\+minutes\./', $content); - } - - public function testWriteWithTooLongMessage() - { - $message = str_pad('test', 520, 'a'); - $this->createHandler(); - $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications - $this->handler->handle($this->getRecord(Logger::CRITICAL, $message)); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $expectedMessage = substr($message, 0, 505); - - $this->assertRegexp('/message=' . $expectedMessage . '&title/', $content); - } - - public function testWriteWithHighPriority() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}&priority=1$/', $content); - } - - public function testWriteWithEmergencyPriority() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::EMERGENCY, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200$/', $content); - } - - public function testWriteToMultipleUsers() - { - $this->createHandler('myToken', array('userA', 'userB')); - $this->handler->handle($this->getRecord(Logger::EMERGENCY, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/token=myToken&user=userA&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200POST/', $content); - $this->assertRegexp('/token=myToken&user=userB&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200$/', $content); - } - - private function createHandler($token = 'myToken', $user = 'myUser', $title = 'Monolog') - { - $constructorArgs = array($token, $user, $title); - $this->res = fopen('php://memory', 'a'); - $this->handler = $this->getMock( - '\Monolog\Handler\PushoverHandler', - array('fsockopen', 'streamSetTimeout', 'closeSocket'), - $constructorArgs - ); - - $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($this->handler, 'localhost:1234'); - - $this->handler->expects($this->any()) - ->method('fsockopen') - ->will($this->returnValue($this->res)); - $this->handler->expects($this->any()) - ->method('streamSetTimeout') - ->will($this->returnValue(true)); - $this->handler->expects($this->any()) - ->method('closeSocket') - ->will($this->returnValue(true)); - - $this->handler->setFormatter($this->getIdentityFormatter()); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php deleted file mode 100644 index 2ca5c02..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php +++ /dev/null @@ -1,199 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Formatter\LineFormatter; - -class RavenHandlerTest extends TestCase -{ - public function setUp() - { - if (!class_exists('Raven_Client')) { - $this->markTestSkipped('raven/raven not installed'); - } - - require_once __DIR__ . '/MockRavenClient.php'; - } - - /** - * @covers Monolog\Handler\RavenHandler::__construct - */ - public function testConstruct() - { - $handler = new RavenHandler($this->getRavenClient()); - $this->assertInstanceOf('Monolog\Handler\RavenHandler', $handler); - } - - protected function getHandler($ravenClient) - { - $handler = new RavenHandler($ravenClient); - - return $handler; - } - - protected function getRavenClient() - { - $dsn = 'http://43f6017361224d098402974103bfc53d:a6a0538fc2934ba2bed32e08741b2cd3@marca.python.live.cheggnet.com:9000/1'; - - return new MockRavenClient($dsn); - } - - public function testDebug() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - $record = $this->getRecord(Logger::DEBUG, 'A test debug message'); - $handler->handle($record); - - $this->assertEquals($ravenClient::DEBUG, $ravenClient->lastData['level']); - $this->assertContains($record['message'], $ravenClient->lastData['message']); - } - - public function testWarning() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - $record = $this->getRecord(Logger::WARNING, 'A test warning message'); - $handler->handle($record); - - $this->assertEquals($ravenClient::WARNING, $ravenClient->lastData['level']); - $this->assertContains($record['message'], $ravenClient->lastData['message']); - } - - public function testTag() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - $tags = array(1, 2, 'foo'); - $record = $this->getRecord(Logger::INFO, 'test', array('tags' => $tags)); - $handler->handle($record); - - $this->assertEquals($tags, $ravenClient->lastData['tags']); - } - - public function testExtraParameters() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - $checksum = '098f6bcd4621d373cade4e832627b4f6'; - $release = '05a671c66aefea124cc08b76ea6d30bb'; - $record = $this->getRecord(Logger::INFO, 'test', array('checksum' => $checksum, 'release' => $release)); - $handler->handle($record); - - $this->assertEquals($checksum, $ravenClient->lastData['checksum']); - $this->assertEquals($release, $ravenClient->lastData['release']); - } - - public function testUserContext() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - $recordWithNoContext = $this->getRecord(Logger::INFO, 'test with default user context'); - // set user context 'externally' - - $user = array( - 'id' => '123', - 'email' => 'test@test.com' - ); - - $recordWithContext = $this->getRecord(Logger::INFO, 'test', array('user' => $user)); - - $ravenClient->user_context(array('id' => 'test_user_id')); - // handle context - $handler->handle($recordWithContext); - $this->assertEquals($user, $ravenClient->lastData['user']); - - // check to see if its reset - $handler->handle($recordWithNoContext); - $this->assertInternalType('array', $ravenClient->context->user); - $this->assertSame('test_user_id', $ravenClient->context->user['id']); - - // handle with null context - $ravenClient->user_context(null); - $handler->handle($recordWithContext); - $this->assertEquals($user, $ravenClient->lastData['user']); - - // check to see if its reset - $handler->handle($recordWithNoContext); - $this->assertNull($ravenClient->context->user); - } - - public function testException() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - try { - $this->methodThatThrowsAnException(); - } catch (\Exception $e) { - $record = $this->getRecord(Logger::ERROR, $e->getMessage(), array('exception' => $e)); - $handler->handle($record); - } - - $this->assertEquals($record['message'], $ravenClient->lastData['message']); - } - - public function testHandleBatch() - { - $records = $this->getMultipleRecords(); - $records[] = $this->getRecord(Logger::WARNING, 'warning'); - $records[] = $this->getRecord(Logger::WARNING, 'warning'); - - $logFormatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); - $logFormatter->expects($this->once())->method('formatBatch'); - - $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); - $formatter->expects($this->once())->method('format')->with($this->callback(function ($record) { - return $record['level'] == 400; - })); - - $handler = $this->getHandler($this->getRavenClient()); - $handler->setBatchFormatter($logFormatter); - $handler->setFormatter($formatter); - $handler->handleBatch($records); - } - - public function testHandleBatchDoNothingIfRecordsAreBelowLevel() - { - $records = array( - $this->getRecord(Logger::DEBUG, 'debug message 1'), - $this->getRecord(Logger::DEBUG, 'debug message 2'), - $this->getRecord(Logger::INFO, 'information'), - ); - - $handler = $this->getMock('Monolog\Handler\RavenHandler', null, array($this->getRavenClient())); - $handler->expects($this->never())->method('handle'); - $handler->setLevel(Logger::ERROR); - $handler->handleBatch($records); - } - - public function testGetSetBatchFormatter() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - $handler->setBatchFormatter($formatter = new LineFormatter()); - $this->assertSame($formatter, $handler->getBatchFormatter()); - } - - private function methodThatThrowsAnException() - { - throw new \Exception('This is an exception'); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php deleted file mode 100644 index 97e0d94..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php +++ /dev/null @@ -1,127 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Formatter\LineFormatter; - -class RedisHandlerTest extends TestCase -{ - /** - * @expectedException InvalidArgumentException - */ - public function testConstructorShouldThrowExceptionForInvalidRedis() - { - new RedisHandler(new \stdClass(), 'key'); - } - - public function testConstructorShouldWorkWithPredis() - { - $redis = $this->getMock('Predis\Client'); - $this->assertInstanceof('Monolog\Handler\RedisHandler', new RedisHandler($redis, 'key')); - } - - public function testConstructorShouldWorkWithRedis() - { - $redis = $this->getMock('Redis'); - $this->assertInstanceof('Monolog\Handler\RedisHandler', new RedisHandler($redis, 'key')); - } - - public function testPredisHandle() - { - $redis = $this->getMock('Predis\Client', array('rpush')); - - // Predis\Client uses rpush - $redis->expects($this->once()) - ->method('rpush') - ->with('key', 'test'); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $handler = new RedisHandler($redis, 'key'); - $handler->setFormatter(new LineFormatter("%message%")); - $handler->handle($record); - } - - public function testRedisHandle() - { - $redis = $this->getMock('Redis', array('rpush')); - - // Redis uses rPush - $redis->expects($this->once()) - ->method('rPush') - ->with('key', 'test'); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $handler = new RedisHandler($redis, 'key'); - $handler->setFormatter(new LineFormatter("%message%")); - $handler->handle($record); - } - - public function testRedisHandleCapped() - { - $redis = $this->getMock('Redis', array('multi', 'rpush', 'ltrim', 'execute')); - - // Redis uses multi - $redis->expects($this->once()) - ->method('multi') - ->will($this->returnSelf()); - - $redis->expects($this->once()) - ->method('rpush') - ->will($this->returnSelf()); - - $redis->expects($this->once()) - ->method('ltrim') - ->will($this->returnSelf()); - - $redis->expects($this->once()) - ->method('execute') - ->will($this->returnSelf()); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $handler = new RedisHandler($redis, 'key', Logger::DEBUG, true, 10); - $handler->setFormatter(new LineFormatter("%message%")); - $handler->handle($record); - } - - public function testPredisHandleCapped() - { - $redis = $this->getMock('Predis\Client', array('transaction')); - - $redisTransaction = $this->getMock('Predis\Client', array('rpush', 'ltrim')); - - $redisTransaction->expects($this->once()) - ->method('rpush') - ->will($this->returnSelf()); - - $redisTransaction->expects($this->once()) - ->method('ltrim') - ->will($this->returnSelf()); - - // Redis uses multi - $redis->expects($this->once()) - ->method('transaction') - ->will($this->returnCallback(function ($cb) use ($redisTransaction) { - $cb($redisTransaction); - })); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $handler = new RedisHandler($redis, 'key', Logger::DEBUG, true, 10); - $handler->setFormatter(new LineFormatter("%message%")); - $handler->handle($record); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php deleted file mode 100644 index f4cefda..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php +++ /dev/null @@ -1,99 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; - -/** - * @covers Monolog\Handler\RotatingFileHandler - */ -class RotatingFileHandlerTest extends TestCase -{ - public function setUp() - { - $dir = __DIR__.'/Fixtures'; - chmod($dir, 0777); - if (!is_writable($dir)) { - $this->markTestSkipped($dir.' must be writeable to test the RotatingFileHandler.'); - } - } - - public function testRotationCreatesNewFile() - { - touch(__DIR__.'/Fixtures/foo-'.date('Y-m-d', time() - 86400).'.rot'); - - $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot'); - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord()); - - $log = __DIR__.'/Fixtures/foo-'.date('Y-m-d').'.rot'; - $this->assertTrue(file_exists($log)); - $this->assertEquals('test', file_get_contents($log)); - } - - /** - * @dataProvider rotationTests - */ - public function testRotation($createFile) - { - touch($old1 = __DIR__.'/Fixtures/foo-'.date('Y-m-d', time() - 86400).'.rot'); - touch($old2 = __DIR__.'/Fixtures/foo-'.date('Y-m-d', time() - 86400 * 2).'.rot'); - touch($old3 = __DIR__.'/Fixtures/foo-'.date('Y-m-d', time() - 86400 * 3).'.rot'); - touch($old4 = __DIR__.'/Fixtures/foo-'.date('Y-m-d', time() - 86400 * 4).'.rot'); - - $log = __DIR__.'/Fixtures/foo-'.date('Y-m-d').'.rot'; - - if ($createFile) { - touch($log); - } - - $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2); - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord()); - - $handler->close(); - - $this->assertTrue(file_exists($log)); - $this->assertTrue(file_exists($old1)); - $this->assertEquals($createFile, file_exists($old2)); - $this->assertEquals($createFile, file_exists($old3)); - $this->assertEquals($createFile, file_exists($old4)); - $this->assertEquals('test', file_get_contents($log)); - } - - public function rotationTests() - { - return array( - 'Rotation is triggered when the file of the current day is not present' - => array(true), - 'Rotation is not triggered when the file is already present' - => array(false), - ); - } - - public function testReuseCurrentFile() - { - $log = __DIR__.'/Fixtures/foo-'.date('Y-m-d').'.rot'; - file_put_contents($log, "foo"); - $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot'); - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord()); - $this->assertEquals('footest', file_get_contents($log)); - } - - public function tearDown() - { - foreach (glob(__DIR__.'/Fixtures/*.rot') as $file) { - unlink($file); - } - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/SamplingHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/SamplingHandlerTest.php deleted file mode 100644 index b354cee..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/SamplingHandlerTest.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; - -/** - * @covers Monolog\Handler\SamplingHandler::handle - */ -class SamplingHandlerTest extends TestCase -{ - public function testHandle() - { - $testHandler = new TestHandler(); - $handler = new SamplingHandler($testHandler, 2); - for ($i = 0; $i < 10000; $i++) { - $handler->handle($this->getRecord()); - } - $count = count($testHandler->getRecords()); - // $count should be half of 10k, so between 4k and 6k - $this->assertLessThan(6000, $count); - $this->assertGreaterThan(4000, $count); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php deleted file mode 100644 index d657fae..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php +++ /dev/null @@ -1,133 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @author Greg Kedzierski - * @see https://api.slack.com/ - */ -class SlackHandlerTest extends TestCase -{ - /** - * @var resource - */ - private $res; - - /** - * @var SlackHandler - */ - private $handler; - - public function setUp() - { - if (!extension_loaded('openssl')) { - $this->markTestSkipped('This test requires openssl to run'); - } - } - - public function testWriteHeader() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/api\/chat.postMessage HTTP\/1.1\\r\\nHost: slack.com\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - } - - public function testWriteContent() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/token=myToken&channel=channel1&username=Monolog&text=&attachments=.*$/', $content); - } - - public function testWriteContentWithEmoji() - { - $this->createHandler('myToken', 'channel1', 'Monolog', true, 'alien'); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/icon_emoji=%3Aalien%3A$/', $content); - } - - /** - * @dataProvider provideLevelColors - */ - public function testWriteContentWithColors($level, $expectedColor) - { - $this->createHandler(); - $this->handler->handle($this->getRecord($level, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/color%22%3A%22'.$expectedColor.'/', $content); - } - - public function testWriteContentWithPlainTextMessage() - { - $this->createHandler('myToken', 'channel1', 'Monolog', false); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/text=test1/', $content); - } - - public function provideLevelColors() - { - return array( - array(Logger::DEBUG, '%23e3e4e6'), // escaped #e3e4e6 - array(Logger::INFO, 'good'), - array(Logger::NOTICE, 'good'), - array(Logger::WARNING, 'warning'), - array(Logger::ERROR, 'danger'), - array(Logger::CRITICAL, 'danger'), - array(Logger::ALERT, 'danger'), - array(Logger::EMERGENCY,'danger'), - ); - } - - private function createHandler($token = 'myToken', $channel = 'channel1', $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $useShortAttachment = false, $includeExtra = false) - { - $constructorArgs = array($token, $channel, $username, $useAttachment, $iconEmoji, Logger::DEBUG, true, $useShortAttachment, $includeExtra); - $this->res = fopen('php://memory', 'a'); - $this->handler = $this->getMock( - '\Monolog\Handler\SlackHandler', - array('fsockopen', 'streamSetTimeout', 'closeSocket'), - $constructorArgs - ); - - $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($this->handler, 'localhost:1234'); - - $this->handler->expects($this->any()) - ->method('fsockopen') - ->will($this->returnValue($this->res)); - $this->handler->expects($this->any()) - ->method('streamSetTimeout') - ->will($this->returnValue(true)); - $this->handler->expects($this->any()) - ->method('closeSocket') - ->will($this->returnValue(true)); - - $this->handler->setFormatter($this->getIdentityFormatter()); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php deleted file mode 100644 index 2e3d504..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php +++ /dev/null @@ -1,282 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @author Pablo de Leon Belloc - */ -class SocketHandlerTest extends TestCase -{ - /** - * @var Monolog\Handler\SocketHandler - */ - private $handler; - - /** - * @var resource - */ - private $res; - - /** - * @expectedException UnexpectedValueException - */ - public function testInvalidHostname() - { - $this->createHandler('garbage://here'); - $this->writeRecord('data'); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testBadConnectionTimeout() - { - $this->createHandler('localhost:1234'); - $this->handler->setConnectionTimeout(-1); - } - - public function testSetConnectionTimeout() - { - $this->createHandler('localhost:1234'); - $this->handler->setConnectionTimeout(10.1); - $this->assertEquals(10.1, $this->handler->getConnectionTimeout()); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testBadTimeout() - { - $this->createHandler('localhost:1234'); - $this->handler->setTimeout(-1); - } - - public function testSetTimeout() - { - $this->createHandler('localhost:1234'); - $this->handler->setTimeout(10.25); - $this->assertEquals(10.25, $this->handler->getTimeout()); - } - - public function testSetConnectionString() - { - $this->createHandler('tcp://localhost:9090'); - $this->assertEquals('tcp://localhost:9090', $this->handler->getConnectionString()); - } - - /** - * @expectedException UnexpectedValueException - */ - public function testExceptionIsThrownOnFsockopenError() - { - $this->setMockHandler(array('fsockopen')); - $this->handler->expects($this->once()) - ->method('fsockopen') - ->will($this->returnValue(false)); - $this->writeRecord('Hello world'); - } - - /** - * @expectedException UnexpectedValueException - */ - public function testExceptionIsThrownOnPfsockopenError() - { - $this->setMockHandler(array('pfsockopen')); - $this->handler->expects($this->once()) - ->method('pfsockopen') - ->will($this->returnValue(false)); - $this->handler->setPersistent(true); - $this->writeRecord('Hello world'); - } - - /** - * @expectedException UnexpectedValueException - */ - public function testExceptionIsThrownIfCannotSetTimeout() - { - $this->setMockHandler(array('streamSetTimeout')); - $this->handler->expects($this->once()) - ->method('streamSetTimeout') - ->will($this->returnValue(false)); - $this->writeRecord('Hello world'); - } - - /** - * @expectedException RuntimeException - */ - public function testWriteFailsOnIfFwriteReturnsFalse() - { - $this->setMockHandler(array('fwrite')); - - $callback = function ($arg) { - $map = array( - 'Hello world' => 6, - 'world' => false, - ); - - return $map[$arg]; - }; - - $this->handler->expects($this->exactly(2)) - ->method('fwrite') - ->will($this->returnCallback($callback)); - - $this->writeRecord('Hello world'); - } - - /** - * @expectedException RuntimeException - */ - public function testWriteFailsIfStreamTimesOut() - { - $this->setMockHandler(array('fwrite', 'streamGetMetadata')); - - $callback = function ($arg) { - $map = array( - 'Hello world' => 6, - 'world' => 5, - ); - - return $map[$arg]; - }; - - $this->handler->expects($this->exactly(1)) - ->method('fwrite') - ->will($this->returnCallback($callback)); - $this->handler->expects($this->exactly(1)) - ->method('streamGetMetadata') - ->will($this->returnValue(array('timed_out' => true))); - - $this->writeRecord('Hello world'); - } - - /** - * @expectedException RuntimeException - */ - public function testWriteFailsOnIncompleteWrite() - { - $this->setMockHandler(array('fwrite', 'streamGetMetadata')); - - $res = $this->res; - $callback = function ($string) use ($res) { - fclose($res); - - return strlen('Hello'); - }; - - $this->handler->expects($this->exactly(1)) - ->method('fwrite') - ->will($this->returnCallback($callback)); - $this->handler->expects($this->exactly(1)) - ->method('streamGetMetadata') - ->will($this->returnValue(array('timed_out' => false))); - - $this->writeRecord('Hello world'); - } - - public function testWriteWithMemoryFile() - { - $this->setMockHandler(); - $this->writeRecord('test1'); - $this->writeRecord('test2'); - $this->writeRecord('test3'); - fseek($this->res, 0); - $this->assertEquals('test1test2test3', fread($this->res, 1024)); - } - - public function testWriteWithMock() - { - $this->setMockHandler(array('fwrite')); - - $callback = function ($arg) { - $map = array( - 'Hello world' => 6, - 'world' => 5, - ); - - return $map[$arg]; - }; - - $this->handler->expects($this->exactly(2)) - ->method('fwrite') - ->will($this->returnCallback($callback)); - - $this->writeRecord('Hello world'); - } - - public function testClose() - { - $this->setMockHandler(); - $this->writeRecord('Hello world'); - $this->assertInternalType('resource', $this->res); - $this->handler->close(); - $this->assertFalse(is_resource($this->res), "Expected resource to be closed after closing handler"); - } - - public function testCloseDoesNotClosePersistentSocket() - { - $this->setMockHandler(); - $this->handler->setPersistent(true); - $this->writeRecord('Hello world'); - $this->assertTrue(is_resource($this->res)); - $this->handler->close(); - $this->assertTrue(is_resource($this->res)); - } - - private function createHandler($connectionString) - { - $this->handler = new SocketHandler($connectionString); - $this->handler->setFormatter($this->getIdentityFormatter()); - } - - private function writeRecord($string) - { - $this->handler->handle($this->getRecord(Logger::WARNING, $string)); - } - - private function setMockHandler(array $methods = array()) - { - $this->res = fopen('php://memory', 'a'); - - $defaultMethods = array('fsockopen', 'pfsockopen', 'streamSetTimeout'); - $newMethods = array_diff($methods, $defaultMethods); - - $finalMethods = array_merge($defaultMethods, $newMethods); - - $this->handler = $this->getMock( - '\Monolog\Handler\SocketHandler', $finalMethods, array('localhost:1234') - ); - - if (!in_array('fsockopen', $methods)) { - $this->handler->expects($this->any()) - ->method('fsockopen') - ->will($this->returnValue($this->res)); - } - - if (!in_array('pfsockopen', $methods)) { - $this->handler->expects($this->any()) - ->method('pfsockopen') - ->will($this->returnValue($this->res)); - } - - if (!in_array('streamSetTimeout', $methods)) { - $this->handler->expects($this->any()) - ->method('streamSetTimeout') - ->will($this->returnValue(true)); - } - - $this->handler->setFormatter($this->getIdentityFormatter()); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php deleted file mode 100644 index b1e22fb..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php +++ /dev/null @@ -1,168 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class StreamHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWrite() - { - $handle = fopen('php://memory', 'a+'); - $handler = new StreamHandler($handle); - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord(Logger::WARNING, 'test')); - $handler->handle($this->getRecord(Logger::WARNING, 'test2')); - $handler->handle($this->getRecord(Logger::WARNING, 'test3')); - fseek($handle, 0); - $this->assertEquals('testtest2test3', fread($handle, 100)); - } - - /** - * @covers Monolog\Handler\StreamHandler::close - */ - public function testClose() - { - $handle = fopen('php://memory', 'a+'); - $handler = new StreamHandler($handle); - $this->assertTrue(is_resource($handle)); - $handler->close(); - $this->assertFalse(is_resource($handle)); - } - - /** - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteCreatesTheStreamResource() - { - $handler = new StreamHandler('php://memory'); - $handler->handle($this->getRecord()); - } - - /** - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteLocking() - { - $temp = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'monolog_locked_log'; - $handler = new StreamHandler($temp, Logger::DEBUG, true, null, true); - $handler->handle($this->getRecord()); - } - - /** - * @expectedException LogicException - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteMissingResource() - { - $handler = new StreamHandler(null); - $handler->handle($this->getRecord()); - } - - public function invalidArgumentProvider() - { - return array( - array(1), - array(array()), - array(array('bogus://url')), - ); - } - - /** - * @dataProvider invalidArgumentProvider - * @expectedException InvalidArgumentException - * @covers Monolog\Handler\StreamHandler::__construct - */ - public function testWriteInvalidArgument($invalidArgument) - { - $handler = new StreamHandler($invalidArgument); - } - - /** - * @expectedException UnexpectedValueException - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteInvalidResource() - { - $handler = new StreamHandler('bogus://url'); - $handler->handle($this->getRecord()); - } - - /** - * @expectedException UnexpectedValueException - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteNonExistingResource() - { - $handler = new StreamHandler('ftp://foo/bar/baz/'.rand(0, 10000)); - $handler->handle($this->getRecord()); - } - - /** - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteNonExistingPath() - { - $handler = new StreamHandler(sys_get_temp_dir().'/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); - $handler->handle($this->getRecord()); - } - - /** - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteNonExistingFileResource() - { - $handler = new StreamHandler('file://'.sys_get_temp_dir().'/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); - $handler->handle($this->getRecord()); - } - - /** - * @expectedException Exception - * @expectedExceptionMessageRegExp /There is no existing directory at/ - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteNonExistingAndNotCreatablePath() - { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { - $this->markTestSkipped('Permissions checks can not run on windows'); - } - $handler = new StreamHandler('/foo/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); - $handler->handle($this->getRecord()); - } - - /** - * @expectedException Exception - * @expectedExceptionMessageRegExp /There is no existing directory at/ - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteNonExistingAndNotCreatableFileResource() - { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { - $this->markTestSkipped('Permissions checks can not run on windows'); - } - $handler = new StreamHandler('file:///foo/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); - $handler->handle($this->getRecord()); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php deleted file mode 100644 index 55e69c2..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php +++ /dev/null @@ -1,79 +0,0 @@ -mailer = $this - ->getMockBuilder('Swift_Mailer') - ->disableOriginalConstructor() - ->getMock(); - } - - public function testMessageCreationIsLazyWhenUsingCallback() - { - $this->mailer->expects($this->never()) - ->method('send'); - - $callback = function () { - throw new \RuntimeException('Swift_Message creation callback should not have been called in this test'); - }; - $handler = new SwiftMailerHandler($this->mailer, $callback); - - $records = array( - $this->getRecord(Logger::DEBUG), - $this->getRecord(Logger::INFO), - ); - $handler->handleBatch($records); - } - - public function testMessageCanBeCustomizedGivenLoggedData() - { - // Wire Mailer to expect a specific Swift_Message with a customized Subject - $expectedMessage = new \Swift_Message(); - $this->mailer->expects($this->once()) - ->method('send') - ->with($this->callback(function ($value) use ($expectedMessage) { - return $value instanceof \Swift_Message - && $value->getSubject() === 'Emergency' - && $value === $expectedMessage; - })); - - // Callback dynamically changes subject based on number of logged records - $callback = function ($content, array $records) use ($expectedMessage) { - $subject = count($records) > 0 ? 'Emergency' : 'Normal'; - $expectedMessage->setSubject($subject); - - return $expectedMessage; - }; - $handler = new SwiftMailerHandler($this->mailer, $callback); - - // Logging 1 record makes this an Emergency - $records = array( - $this->getRecord(Logger::EMERGENCY), - ); - $handler->handleBatch($records); - } - - public function testMessageHaveUniqueId() { - $messageTemplate = \Swift_Message::newInstance(); - $handler = new SwiftMailerHandler($this->mailer, $messageTemplate); - - $method = new \ReflectionMethod('Monolog\Handler\SwiftMailerHandler', 'buildMessage'); - $method->setAccessible(true); - $method->invokeArgs($handler, array($messageTemplate, array())); - - $builtMessage1 = $method->invoke($handler, $messageTemplate, array()); - $builtMessage2 = $method->invoke($handler, $messageTemplate, array()); - - $this->assertFalse($builtMessage1->getId() === $builtMessage2->getId(), 'Two different messages have the same id'); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/SyslogHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/SyslogHandlerTest.php deleted file mode 100644 index 8f9e46b..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/SyslogHandlerTest.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -class SyslogHandlerTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers Monolog\Handler\SyslogHandler::__construct - */ - public function testConstruct() - { - $handler = new SyslogHandler('test'); - $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler); - - $handler = new SyslogHandler('test', LOG_USER); - $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler); - - $handler = new SyslogHandler('test', 'user'); - $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler); - - $handler = new SyslogHandler('test', LOG_USER, Logger::DEBUG, true, LOG_PERROR); - $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler); - } - - /** - * @covers Monolog\Handler\SyslogHandler::__construct - */ - public function testConstructInvalidFacility() - { - $this->setExpectedException('UnexpectedValueException'); - $handler = new SyslogHandler('test', 'unknown'); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php deleted file mode 100644 index 497812b..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -/** - * @requires extension sockets - */ -class SyslogUdpHandlerTest extends \PHPUnit_Framework_TestCase -{ - /** - * @expectedException UnexpectedValueException - */ - public function testWeValidateFacilities() - { - $handler = new SyslogUdpHandler("ip", null, "invalidFacility"); - } - - public function testWeSplitIntoLines() - { - $handler = new SyslogUdpHandler("127.0.0.1", 514, "authpriv"); - $handler->setFormatter(new \Monolog\Formatter\ChromePHPFormatter()); - - $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('write'), array('lol', 'lol')); - $socket->expects($this->at(0)) - ->method('write') - ->with("lol", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 "); - $socket->expects($this->at(1)) - ->method('write') - ->with("hej", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 "); - - $handler->setSocket($socket); - - $handler->handle($this->getRecordWithMessage("hej\nlol")); - } - - protected function getRecordWithMessage($msg) - { - return array('message' => $msg, 'level' => \Monolog\Logger::WARNING, 'context' => null, 'extra' => array(), 'channel' => 'lol'); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php deleted file mode 100644 index 75cc4a8..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @covers Monolog\Handler\TestHandler - */ -class TestHandlerTest extends TestCase -{ - /** - * @dataProvider methodProvider - */ - public function testHandler($method, $level) - { - $handler = new TestHandler; - $record = $this->getRecord($level, 'test'.$method); - $this->assertFalse($handler->{'has'.$method}($record), 'has'.$method); - $this->assertFalse($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains'); - $this->assertFalse($handler->{'has'.$method.'ThatPasses'}(function ($rec) { - return true; - }), 'has'.$method.'ThatPasses'); - $this->assertFalse($handler->{'has'.$method.'ThatMatches'}('/test\w+/')); - $this->assertFalse($handler->{'has'.$method.'Records'}(), 'has'.$method.'Records'); - $handler->handle($record); - - $this->assertFalse($handler->{'has'.$method}('bar'), 'has'.$method); - $this->assertTrue($handler->{'has'.$method}($record), 'has'.$method); - $this->assertTrue($handler->{'has'.$method}('test'.$method), 'has'.$method); - $this->assertTrue($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains'); - $this->assertTrue($handler->{'has'.$method.'ThatPasses'}(function ($rec) { - return true; - }), 'has'.$method.'ThatPasses'); - $this->assertTrue($handler->{'has'.$method.'ThatMatches'}('/test\w+/')); - $this->assertTrue($handler->{'has'.$method.'Records'}(), 'has'.$method.'Records'); - - $records = $handler->getRecords(); - unset($records[0]['formatted']); - $this->assertEquals(array($record), $records); - } - - public function methodProvider() - { - return array( - array('Emergency', Logger::EMERGENCY), - array('Alert' , Logger::ALERT), - array('Critical' , Logger::CRITICAL), - array('Error' , Logger::ERROR), - array('Warning' , Logger::WARNING), - array('Info' , Logger::INFO), - array('Notice' , Logger::NOTICE), - array('Debug' , Logger::DEBUG), - ); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/UdpSocketTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/UdpSocketTest.php deleted file mode 100644 index fa524d0..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/UdpSocketTest.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Handler\SyslogUdp\UdpSocket; - -/** - * @requires extension sockets - */ -class UdpSocketTest extends TestCase -{ - public function testWeDoNotTruncateShortMessages() - { - $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('send'), array('lol', 'lol')); - - $socket->expects($this->at(0)) - ->method('send') - ->with("HEADER: The quick brown fox jumps over the lazy dog"); - - $socket->write("The quick brown fox jumps over the lazy dog", "HEADER: "); - } - - public function testLongMessagesAreTruncated() - { - $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('send'), array('lol', 'lol')); - - $truncatedString = str_repeat("derp", 16254).'d'; - - $socket->expects($this->exactly(1)) - ->method('send') - ->with("HEADER" . $truncatedString); - - $longString = str_repeat("derp", 20000); - - $socket->write($longString, "HEADER"); - } - - public function testDoubleCloseDoesNotError() - { - $socket = new UdpSocket('127.0.0.1', 514); - $socket->close(); - $socket->close(); - } - - /** - * @expectedException LogicException - */ - public function testWriteAfterCloseErrors() - { - $socket = new UdpSocket('127.0.0.1', 514); - $socket->close(); - $socket->write('foo', "HEADER"); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php deleted file mode 100644 index 8d37a1f..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php +++ /dev/null @@ -1,121 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class WhatFailureGroupHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\WhatFailureGroupHandler::__construct - * @expectedException InvalidArgumentException - */ - public function testConstructorOnlyTakesHandler() - { - new WhatFailureGroupHandler(array(new TestHandler(), "foo")); - } - - /** - * @covers Monolog\Handler\WhatFailureGroupHandler::__construct - * @covers Monolog\Handler\WhatFailureGroupHandler::handle - */ - public function testHandle() - { - $testHandlers = array(new TestHandler(), new TestHandler()); - $handler = new WhatFailureGroupHandler($testHandlers); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - foreach ($testHandlers as $test) { - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 2); - } - } - - /** - * @covers Monolog\Handler\WhatFailureGroupHandler::handleBatch - */ - public function testHandleBatch() - { - $testHandlers = array(new TestHandler(), new TestHandler()); - $handler = new WhatFailureGroupHandler($testHandlers); - $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO))); - foreach ($testHandlers as $test) { - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 2); - } - } - - /** - * @covers Monolog\Handler\WhatFailureGroupHandler::isHandling - */ - public function testIsHandling() - { - $testHandlers = array(new TestHandler(Logger::ERROR), new TestHandler(Logger::WARNING)); - $handler = new WhatFailureGroupHandler($testHandlers); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::ERROR))); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::WARNING))); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); - } - - /** - * @covers Monolog\Handler\WhatFailureGroupHandler::handle - */ - public function testHandleUsesProcessors() - { - $test = new TestHandler(); - $handler = new WhatFailureGroupHandler(array($test)); - $handler->pushProcessor(function ($record) { - $record['extra']['foo'] = true; - - return $record; - }); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasWarningRecords()); - $records = $test->getRecords(); - $this->assertTrue($records[0]['extra']['foo']); - } - - /** - * @covers Monolog\Handler\WhatFailureGroupHandler::handle - */ - public function testHandleException() - { - $test = new TestHandler(); - $exception = new ExceptionTestHandler(); - $handler = new WhatFailureGroupHandler(array($exception, $test, $exception)); - $handler->pushProcessor(function ($record) { - $record['extra']['foo'] = true; - - return $record; - }); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasWarningRecords()); - $records = $test->getRecords(); - $this->assertTrue($records[0]['extra']['foo']); - } -} - -class ExceptionTestHandler extends TestHandler -{ - /** - * {@inheritdoc} - */ - public function handle(array $record) - { - parent::handle($record); - - throw new \Exception("ExceptionTestHandler::handle"); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php b/application/vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php deleted file mode 100644 index 416039e..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; - -class ZendMonitorHandlerTest extends TestCase -{ - protected $zendMonitorHandler; - - public function setUp() - { - if (!function_exists('zend_monitor_custom_event')) { - $this->markTestSkipped('ZendServer is not installed'); - } - } - - /** - * @covers Monolog\Handler\ZendMonitorHandler::write - */ - public function testWrite() - { - $record = $this->getRecord(); - $formatterResult = array( - 'message' => $record['message'] - ); - - $zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler') - ->setMethods(array('writeZendMonitorCustomEvent', 'getDefaultFormatter')) - ->getMock(); - - $formatterMock = $this->getMockBuilder('Monolog\Formatter\NormalizerFormatter') - ->disableOriginalConstructor() - ->getMock(); - - $formatterMock->expects($this->once()) - ->method('format') - ->will($this->returnValue($formatterResult)); - - $zendMonitor->expects($this->once()) - ->method('getDefaultFormatter') - ->will($this->returnValue($formatterMock)); - - $levelMap = $zendMonitor->getLevelMap(); - - $zendMonitor->expects($this->once()) - ->method('writeZendMonitorCustomEvent') - ->with($levelMap[$record['level']], $record['message'], $formatterResult); - - $zendMonitor->handle($record); - } - - /** - * @covers Monolog\Handler\ZendMonitorHandler::getDefaultFormatter - */ - public function testGetDefaultFormatterReturnsNormalizerFormatter() - { - $zendMonitor = new ZendMonitorHandler(); - $this->assertInstanceOf('Monolog\Formatter\NormalizerFormatter', $zendMonitor->getDefaultFormatter()); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/LoggerTest.php b/application/vendor/monolog/monolog/tests/Monolog/LoggerTest.php deleted file mode 100644 index b9ba6e9..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/LoggerTest.php +++ /dev/null @@ -1,471 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog; - -use Monolog\Processor\WebProcessor; -use Monolog\Handler\TestHandler; - -class LoggerTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers Monolog\Logger::getName - */ - public function testGetName() - { - $logger = new Logger('foo'); - $this->assertEquals('foo', $logger->getName()); - } - - /** - * @covers Monolog\Logger::getLevelName - */ - public function testGetLevelName() - { - $this->assertEquals('ERROR', Logger::getLevelName(Logger::ERROR)); - } - - /** - * @covers Monolog\Logger::toMonologLevel - */ - public function testConvertPSR3ToMonologLevel() - { - $this->assertEquals(Logger::toMonologLevel('debug'), 100); - $this->assertEquals(Logger::toMonologLevel('info'), 200); - $this->assertEquals(Logger::toMonologLevel('notice'), 250); - $this->assertEquals(Logger::toMonologLevel('warning'), 300); - $this->assertEquals(Logger::toMonologLevel('error'), 400); - $this->assertEquals(Logger::toMonologLevel('critical'), 500); - $this->assertEquals(Logger::toMonologLevel('alert'), 550); - $this->assertEquals(Logger::toMonologLevel('emergency'), 600); - } - - /** - * @covers Monolog\Logger::getLevelName - * @expectedException InvalidArgumentException - */ - public function testGetLevelNameThrows() - { - Logger::getLevelName(5); - } - - /** - * @covers Monolog\Logger::__construct - */ - public function testChannel() - { - $logger = new Logger('foo'); - $handler = new TestHandler; - $logger->pushHandler($handler); - $logger->addWarning('test'); - list($record) = $handler->getRecords(); - $this->assertEquals('foo', $record['channel']); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testLog() - { - $logger = new Logger(__METHOD__); - - $handler = $this->getMock('Monolog\Handler\NullHandler', array('handle')); - $handler->expects($this->once()) - ->method('handle'); - $logger->pushHandler($handler); - - $this->assertTrue($logger->addWarning('test')); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testLogNotHandled() - { - $logger = new Logger(__METHOD__); - - $handler = $this->getMock('Monolog\Handler\NullHandler', array('handle'), array(Logger::ERROR)); - $handler->expects($this->never()) - ->method('handle'); - $logger->pushHandler($handler); - - $this->assertFalse($logger->addWarning('test')); - } - - public function testHandlersInCtor() - { - $handler1 = new TestHandler; - $handler2 = new TestHandler; - $logger = new Logger(__METHOD__, array($handler1, $handler2)); - - $this->assertEquals($handler1, $logger->popHandler()); - $this->assertEquals($handler2, $logger->popHandler()); - } - - public function testProcessorsInCtor() - { - $processor1 = new WebProcessor; - $processor2 = new WebProcessor; - $logger = new Logger(__METHOD__, array(), array($processor1, $processor2)); - - $this->assertEquals($processor1, $logger->popProcessor()); - $this->assertEquals($processor2, $logger->popProcessor()); - } - - /** - * @covers Monolog\Logger::pushHandler - * @covers Monolog\Logger::popHandler - * @expectedException LogicException - */ - public function testPushPopHandler() - { - $logger = new Logger(__METHOD__); - $handler1 = new TestHandler; - $handler2 = new TestHandler; - - $logger->pushHandler($handler1); - $logger->pushHandler($handler2); - - $this->assertEquals($handler2, $logger->popHandler()); - $this->assertEquals($handler1, $logger->popHandler()); - $logger->popHandler(); - } - - /** - * @covers Monolog\Logger::setHandlers - */ - public function testSetHandlers() - { - $logger = new Logger(__METHOD__); - $handler1 = new TestHandler; - $handler2 = new TestHandler; - - $logger->pushHandler($handler1); - $logger->setHandlers(array($handler2)); - - // handler1 has been removed - $this->assertEquals(array($handler2), $logger->getHandlers()); - - $logger->setHandlers(array( - "AMapKey" => $handler1, - "Woop" => $handler2, - )); - - // Keys have been scrubbed - $this->assertEquals(array($handler1, $handler2), $logger->getHandlers()); - } - - /** - * @covers Monolog\Logger::pushProcessor - * @covers Monolog\Logger::popProcessor - * @expectedException LogicException - */ - public function testPushPopProcessor() - { - $logger = new Logger(__METHOD__); - $processor1 = new WebProcessor; - $processor2 = new WebProcessor; - - $logger->pushProcessor($processor1); - $logger->pushProcessor($processor2); - - $this->assertEquals($processor2, $logger->popProcessor()); - $this->assertEquals($processor1, $logger->popProcessor()); - $logger->popProcessor(); - } - - /** - * @covers Monolog\Logger::pushProcessor - * @expectedException InvalidArgumentException - */ - public function testPushProcessorWithNonCallable() - { - $logger = new Logger(__METHOD__); - - $logger->pushProcessor(new \stdClass()); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testProcessorsAreExecuted() - { - $logger = new Logger(__METHOD__); - $handler = new TestHandler; - $logger->pushHandler($handler); - $logger->pushProcessor(function ($record) { - $record['extra']['win'] = true; - - return $record; - }); - $logger->addError('test'); - list($record) = $handler->getRecords(); - $this->assertTrue($record['extra']['win']); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testProcessorsAreCalledOnlyOnce() - { - $logger = new Logger(__METHOD__); - $handler = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler->expects($this->any()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - $handler->expects($this->any()) - ->method('handle') - ->will($this->returnValue(true)) - ; - $logger->pushHandler($handler); - - $processor = $this->getMockBuilder('Monolog\Processor\WebProcessor') - ->disableOriginalConstructor() - ->setMethods(array('__invoke')) - ->getMock() - ; - $processor->expects($this->once()) - ->method('__invoke') - ->will($this->returnArgument(0)) - ; - $logger->pushProcessor($processor); - - $logger->addError('test'); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testProcessorsNotCalledWhenNotHandled() - { - $logger = new Logger(__METHOD__); - $handler = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler->expects($this->once()) - ->method('isHandling') - ->will($this->returnValue(false)) - ; - $logger->pushHandler($handler); - $that = $this; - $logger->pushProcessor(function ($record) use ($that) { - $that->fail('The processor should not be called'); - }); - $logger->addAlert('test'); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testHandlersNotCalledBeforeFirstHandling() - { - $logger = new Logger(__METHOD__); - - $handler1 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler1->expects($this->never()) - ->method('isHandling') - ->will($this->returnValue(false)) - ; - $handler1->expects($this->once()) - ->method('handle') - ->will($this->returnValue(false)) - ; - $logger->pushHandler($handler1); - - $handler2 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler2->expects($this->once()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - $handler2->expects($this->once()) - ->method('handle') - ->will($this->returnValue(false)) - ; - $logger->pushHandler($handler2); - - $handler3 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler3->expects($this->once()) - ->method('isHandling') - ->will($this->returnValue(false)) - ; - $handler3->expects($this->never()) - ->method('handle') - ; - $logger->pushHandler($handler3); - - $logger->debug('test'); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testBubblingWhenTheHandlerReturnsFalse() - { - $logger = new Logger(__METHOD__); - - $handler1 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler1->expects($this->any()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - $handler1->expects($this->once()) - ->method('handle') - ->will($this->returnValue(false)) - ; - $logger->pushHandler($handler1); - - $handler2 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler2->expects($this->any()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - $handler2->expects($this->once()) - ->method('handle') - ->will($this->returnValue(false)) - ; - $logger->pushHandler($handler2); - - $logger->debug('test'); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testNotBubblingWhenTheHandlerReturnsTrue() - { - $logger = new Logger(__METHOD__); - - $handler1 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler1->expects($this->any()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - $handler1->expects($this->never()) - ->method('handle') - ; - $logger->pushHandler($handler1); - - $handler2 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler2->expects($this->any()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - $handler2->expects($this->once()) - ->method('handle') - ->will($this->returnValue(true)) - ; - $logger->pushHandler($handler2); - - $logger->debug('test'); - } - - /** - * @covers Monolog\Logger::isHandling - */ - public function testIsHandling() - { - $logger = new Logger(__METHOD__); - - $handler1 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler1->expects($this->any()) - ->method('isHandling') - ->will($this->returnValue(false)) - ; - - $logger->pushHandler($handler1); - $this->assertFalse($logger->isHandling(Logger::DEBUG)); - - $handler2 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler2->expects($this->any()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - - $logger->pushHandler($handler2); - $this->assertTrue($logger->isHandling(Logger::DEBUG)); - } - - /** - * @dataProvider logMethodProvider - * @covers Monolog\Logger::addDebug - * @covers Monolog\Logger::addInfo - * @covers Monolog\Logger::addNotice - * @covers Monolog\Logger::addWarning - * @covers Monolog\Logger::addError - * @covers Monolog\Logger::addCritical - * @covers Monolog\Logger::addAlert - * @covers Monolog\Logger::addEmergency - * @covers Monolog\Logger::debug - * @covers Monolog\Logger::info - * @covers Monolog\Logger::notice - * @covers Monolog\Logger::warn - * @covers Monolog\Logger::err - * @covers Monolog\Logger::crit - * @covers Monolog\Logger::alert - * @covers Monolog\Logger::emerg - */ - public function testLogMethods($method, $expectedLevel) - { - $logger = new Logger('foo'); - $handler = new TestHandler; - $logger->pushHandler($handler); - $logger->{$method}('test'); - list($record) = $handler->getRecords(); - $this->assertEquals($expectedLevel, $record['level']); - } - - public function logMethodProvider() - { - return array( - // monolog methods - array('addDebug', Logger::DEBUG), - array('addInfo', Logger::INFO), - array('addNotice', Logger::NOTICE), - array('addWarning', Logger::WARNING), - array('addError', Logger::ERROR), - array('addCritical', Logger::CRITICAL), - array('addAlert', Logger::ALERT), - array('addEmergency', Logger::EMERGENCY), - - // ZF/Sf2 compat methods - array('debug', Logger::DEBUG), - array('info', Logger::INFO), - array('notice', Logger::NOTICE), - array('warn', Logger::WARNING), - array('err', Logger::ERROR), - array('crit', Logger::CRITICAL), - array('alert', Logger::ALERT), - array('emerg', Logger::EMERGENCY), - ); - } - - /** - * @dataProvider setTimezoneProvider - * @covers Monolog\Logger::setTimezone - */ - public function testSetTimezone($tz) - { - Logger::setTimezone($tz); - $logger = new Logger('foo'); - $handler = new TestHandler; - $logger->pushHandler($handler); - $logger->info('test'); - list($record) = $handler->getRecords(); - $this->assertEquals($tz, $record['datetime']->getTimezone()); - } - - public function setTimezoneProvider() - { - return array_map( - function ($tz) { return array(new \DateTimeZone($tz)); }, - \DateTimeZone::listIdentifiers() - ); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php b/application/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php deleted file mode 100644 index 5adb505..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class GitProcessorTest extends TestCase -{ - /** - * @covers Monolog\Processor\GitProcessor::__invoke - */ - public function testProcessor() - { - $processor = new GitProcessor(); - $record = $processor($this->getRecord()); - - $this->assertArrayHasKey('git', $record['extra']); - $this->assertTrue(!is_array($record['extra']['git']['branch'])); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php b/application/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php deleted file mode 100644 index 0dd411d..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php +++ /dev/null @@ -1,123 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Acme; - -class Tester -{ - public function test($handler, $record) - { - $handler->handle($record); - } -} - -function tester($handler, $record) -{ - $handler->handle($record); -} - -namespace Monolog\Processor; - -use Monolog\Logger; -use Monolog\TestCase; -use Monolog\Handler\TestHandler; - -class IntrospectionProcessorTest extends TestCase -{ - public function getHandler() - { - $processor = new IntrospectionProcessor(); - $handler = new TestHandler(); - $handler->pushProcessor($processor); - - return $handler; - } - - public function testProcessorFromClass() - { - $handler = $this->getHandler(); - $tester = new \Acme\Tester; - $tester->test($handler, $this->getRecord()); - list($record) = $handler->getRecords(); - $this->assertEquals(__FILE__, $record['extra']['file']); - $this->assertEquals(18, $record['extra']['line']); - $this->assertEquals('Acme\Tester', $record['extra']['class']); - $this->assertEquals('test', $record['extra']['function']); - } - - public function testProcessorFromFunc() - { - $handler = $this->getHandler(); - \Acme\tester($handler, $this->getRecord()); - list($record) = $handler->getRecords(); - $this->assertEquals(__FILE__, $record['extra']['file']); - $this->assertEquals(24, $record['extra']['line']); - $this->assertEquals(null, $record['extra']['class']); - $this->assertEquals('Acme\tester', $record['extra']['function']); - } - - public function testLevelTooLow() - { - $input = array( - 'level' => Logger::DEBUG, - 'extra' => array(), - ); - - $expected = $input; - - $processor = new IntrospectionProcessor(Logger::CRITICAL); - $actual = $processor($input); - - $this->assertEquals($expected, $actual); - } - - public function testLevelEqual() - { - $input = array( - 'level' => Logger::CRITICAL, - 'extra' => array(), - ); - - $expected = $input; - $expected['extra'] = array( - 'file' => null, - 'line' => null, - 'class' => 'ReflectionMethod', - 'function' => 'invokeArgs', - ); - - $processor = new IntrospectionProcessor(Logger::CRITICAL); - $actual = $processor($input); - - $this->assertEquals($expected, $actual); - } - - public function testLevelHigher() - { - $input = array( - 'level' => Logger::EMERGENCY, - 'extra' => array(), - ); - - $expected = $input; - $expected['extra'] = array( - 'file' => null, - 'line' => null, - 'class' => 'ReflectionMethod', - 'function' => 'invokeArgs', - ); - - $processor = new IntrospectionProcessor(Logger::CRITICAL); - $actual = $processor($input); - - $this->assertEquals($expected, $actual); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php b/application/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php deleted file mode 100644 index eb66614..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class MemoryPeakUsageProcessorTest extends TestCase -{ - /** - * @covers Monolog\Processor\MemoryPeakUsageProcessor::__invoke - * @covers Monolog\Processor\MemoryProcessor::formatBytes - */ - public function testProcessor() - { - $processor = new MemoryPeakUsageProcessor(); - $record = $processor($this->getRecord()); - $this->assertArrayHasKey('memory_peak_usage', $record['extra']); - $this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_peak_usage']); - } - - /** - * @covers Monolog\Processor\MemoryPeakUsageProcessor::__invoke - * @covers Monolog\Processor\MemoryProcessor::formatBytes - */ - public function testProcessorWithoutFormatting() - { - $processor = new MemoryPeakUsageProcessor(true, false); - $record = $processor($this->getRecord()); - $this->assertArrayHasKey('memory_peak_usage', $record['extra']); - $this->assertInternalType('int', $record['extra']['memory_peak_usage']); - $this->assertGreaterThan(0, $record['extra']['memory_peak_usage']); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php b/application/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php deleted file mode 100644 index 4692dbf..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class MemoryUsageProcessorTest extends TestCase -{ - /** - * @covers Monolog\Processor\MemoryUsageProcessor::__invoke - * @covers Monolog\Processor\MemoryProcessor::formatBytes - */ - public function testProcessor() - { - $processor = new MemoryUsageProcessor(); - $record = $processor($this->getRecord()); - $this->assertArrayHasKey('memory_usage', $record['extra']); - $this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_usage']); - } - - /** - * @covers Monolog\Processor\MemoryUsageProcessor::__invoke - * @covers Monolog\Processor\MemoryProcessor::formatBytes - */ - public function testProcessorWithoutFormatting() - { - $processor = new MemoryUsageProcessor(true, false); - $record = $processor($this->getRecord()); - $this->assertArrayHasKey('memory_usage', $record['extra']); - $this->assertInternalType('int', $record['extra']['memory_usage']); - $this->assertGreaterThan(0, $record['extra']['memory_usage']); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php b/application/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php deleted file mode 100644 index 458d2a3..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class ProcessIdProcessorTest extends TestCase -{ - /** - * @covers Monolog\Processor\ProcessIdProcessor::__invoke - */ - public function testProcessor() - { - $processor = new ProcessIdProcessor(); - $record = $processor($this->getRecord()); - $this->assertArrayHasKey('process_id', $record['extra']); - $this->assertInternalType('int', $record['extra']['process_id']); - $this->assertGreaterThan(0, $record['extra']['process_id']); - $this->assertEquals(getmypid(), $record['extra']['process_id']); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php b/application/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php deleted file mode 100644 index 81bfbdc..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -class PsrLogMessageProcessorTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getPairs - */ - public function testReplacement($val, $expected) - { - $proc = new PsrLogMessageProcessor; - - $message = $proc(array( - 'message' => '{foo}', - 'context' => array('foo' => $val) - )); - $this->assertEquals($expected, $message['message']); - } - - public function getPairs() - { - return array( - array('foo', 'foo'), - array('3', '3'), - array(3, '3'), - array(null, ''), - array(true, '1'), - array(false, ''), - array(new \stdClass, '[object stdClass]'), - array(array(), '[array]'), - ); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php b/application/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php deleted file mode 100644 index 0d860c6..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class TagProcessorTest extends TestCase -{ - /** - * @covers Monolog\Processor\TagProcessor::__invoke - */ - public function testProcessor() - { - $tags = array(1, 2, 3); - $processor = new TagProcessor($tags); - $record = $processor($this->getRecord()); - - $this->assertEquals($tags, $record['extra']['tags']); - } - - /** - * @covers Monolog\Processor\TagProcessor::__invoke - */ - public function testProcessorTagModification() - { - $tags = array(1, 2, 3); - $processor = new TagProcessor($tags); - - $record = $processor($this->getRecord()); - $this->assertEquals($tags, $record['extra']['tags']); - - $processor->setTags(array('a', 'b')); - $record = $processor($this->getRecord()); - $this->assertEquals(array('a', 'b'), $record['extra']['tags']); - - $processor->addTags(array('a', 'c', 'foo' => 'bar')); - $record = $processor($this->getRecord()); - $this->assertEquals(array('a', 'b', 'a', 'c', 'foo' => 'bar'), $record['extra']['tags']); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php b/application/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php deleted file mode 100644 index befad95..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class UidProcessorTest extends TestCase -{ - /** - * @covers Monolog\Processor\UidProcessor::__invoke - */ - public function testProcessor() - { - $processor = new UidProcessor(); - $record = $processor($this->getRecord()); - $this->assertArrayHasKey('uid', $record['extra']); - } - public function testGetUid() - { - $processor = new UidProcessor(10); - $this->assertEquals(10, strlen($processor->getUid())); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php b/application/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php deleted file mode 100644 index dba8941..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class WebProcessorTest extends TestCase -{ - public function testProcessor() - { - $server = array( - 'REQUEST_URI' => 'A', - 'REMOTE_ADDR' => 'B', - 'REQUEST_METHOD' => 'C', - 'HTTP_REFERER' => 'D', - 'SERVER_NAME' => 'F', - 'UNIQUE_ID' => 'G', - ); - - $processor = new WebProcessor($server); - $record = $processor($this->getRecord()); - $this->assertEquals($server['REQUEST_URI'], $record['extra']['url']); - $this->assertEquals($server['REMOTE_ADDR'], $record['extra']['ip']); - $this->assertEquals($server['REQUEST_METHOD'], $record['extra']['http_method']); - $this->assertEquals($server['HTTP_REFERER'], $record['extra']['referrer']); - $this->assertEquals($server['SERVER_NAME'], $record['extra']['server']); - $this->assertEquals($server['UNIQUE_ID'], $record['extra']['unique_id']); - } - - public function testProcessorDoNothingIfNoRequestUri() - { - $server = array( - 'REMOTE_ADDR' => 'B', - 'REQUEST_METHOD' => 'C', - ); - $processor = new WebProcessor($server); - $record = $processor($this->getRecord()); - $this->assertEmpty($record['extra']); - } - - public function testProcessorReturnNullIfNoHttpReferer() - { - $server = array( - 'REQUEST_URI' => 'A', - 'REMOTE_ADDR' => 'B', - 'REQUEST_METHOD' => 'C', - 'SERVER_NAME' => 'F', - ); - $processor = new WebProcessor($server); - $record = $processor($this->getRecord()); - $this->assertNull($record['extra']['referrer']); - } - - public function testProcessorDoesNotAddUniqueIdIfNotPresent() - { - $server = array( - 'REQUEST_URI' => 'A', - 'REMOTE_ADDR' => 'B', - 'REQUEST_METHOD' => 'C', - 'SERVER_NAME' => 'F', - ); - $processor = new WebProcessor($server); - $record = $processor($this->getRecord()); - $this->assertFalse(isset($record['extra']['unique_id'])); - } - - public function testProcessorAddsOnlyRequestedExtraFields() - { - $server = array( - 'REQUEST_URI' => 'A', - 'REMOTE_ADDR' => 'B', - 'REQUEST_METHOD' => 'C', - 'SERVER_NAME' => 'F', - ); - - $processor = new WebProcessor($server, array('url', 'http_method')); - $record = $processor($this->getRecord()); - - $this->assertSame(array('url' => 'A', 'http_method' => 'C'), $record['extra']); - } - - /** - * @expectedException UnexpectedValueException - */ - public function testInvalidData() - { - new WebProcessor(new \stdClass); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/PsrLogCompatTest.php b/application/vendor/monolog/monolog/tests/Monolog/PsrLogCompatTest.php deleted file mode 100644 index ab89944..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/PsrLogCompatTest.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog; - -use Monolog\Handler\TestHandler; -use Monolog\Formatter\LineFormatter; -use Monolog\Processor\PsrLogMessageProcessor; -use Psr\Log\Test\LoggerInterfaceTest; - -class PsrLogCompatTest extends LoggerInterfaceTest -{ - private $handler; - - public function getLogger() - { - $logger = new Logger('foo'); - $logger->pushHandler($handler = new TestHandler); - $logger->pushProcessor(new PsrLogMessageProcessor); - $handler->setFormatter(new LineFormatter('%level_name% %message%')); - - $this->handler = $handler; - - return $logger; - } - - public function getLogs() - { - $convert = function ($record) { - $lower = function ($match) { - return strtolower($match[0]); - }; - - return preg_replace_callback('{^[A-Z]+}', $lower, $record['formatted']); - }; - - return array_map($convert, $this->handler->getRecords()); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/RegistryTest.php b/application/vendor/monolog/monolog/tests/Monolog/RegistryTest.php deleted file mode 100644 index 15fdfbd..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/RegistryTest.php +++ /dev/null @@ -1,153 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog; - -class RegistryTest extends \PHPUnit_Framework_TestCase -{ - protected function setUp() - { - Registry::clear(); - } - - /** - * @dataProvider hasLoggerProvider - * @covers Monolog\Registry::hasLogger - */ - public function testHasLogger(array $loggersToAdd, array $loggersToCheck, array $expectedResult) - { - foreach ($loggersToAdd as $loggerToAdd) { - Registry::addLogger($loggerToAdd); - } - foreach ($loggersToCheck as $index => $loggerToCheck) { - $this->assertSame($expectedResult[$index], Registry::hasLogger($loggerToCheck)); - } - } - - public function hasLoggerProvider() - { - $logger1 = new Logger('test1'); - $logger2 = new Logger('test2'); - $logger3 = new Logger('test3'); - - return array( - // only instances - array( - array($logger1), - array($logger1, $logger2), - array(true, false), - ), - // only names - array( - array($logger1), - array('test1', 'test2'), - array(true, false), - ), - // mixed case - array( - array($logger1, $logger2), - array('test1', $logger2, 'test3', $logger3), - array(true, true, false, false), - ), - ); - } - - /** - * @covers Monolog\Registry::clear - */ - public function testClearClears() - { - Registry::addLogger(new Logger('test1'), 'log'); - Registry::clear(); - - $this->setExpectedException('\InvalidArgumentException'); - Registry::getInstance('log'); - } - - /** - * @dataProvider removedLoggerProvider - * @covers Monolog\Registry::addLogger - * @covers Monolog\Registry::removeLogger - */ - public function testRemovesLogger($loggerToAdd, $remove) - { - Registry::addLogger($loggerToAdd); - Registry::removeLogger($remove); - - $this->setExpectedException('\InvalidArgumentException'); - Registry::getInstance($loggerToAdd->getName()); - } - - public function removedLoggerProvider() - { - $logger1 = new Logger('test1'); - - return array( - array($logger1, $logger1), - array($logger1, 'test1'), - ); - } - - /** - * @covers Monolog\Registry::addLogger - * @covers Monolog\Registry::getInstance - * @covers Monolog\Registry::__callStatic - */ - public function testGetsSameLogger() - { - $logger1 = new Logger('test1'); - $logger2 = new Logger('test2'); - - Registry::addLogger($logger1, 'test1'); - Registry::addLogger($logger2); - - $this->assertSame($logger1, Registry::getInstance('test1')); - $this->assertSame($logger2, Registry::test2()); - } - - /** - * @expectedException \InvalidArgumentException - * @covers Monolog\Registry::getInstance - */ - public function testFailsOnNonExistantLogger() - { - Registry::getInstance('test1'); - } - - /** - * @covers Monolog\Registry::addLogger - */ - public function testReplacesLogger() - { - $log1 = new Logger('test1'); - $log2 = new Logger('test2'); - - Registry::addLogger($log1, 'log'); - - Registry::addLogger($log2, 'log', true); - - $this->assertSame($log2, Registry::getInstance('log')); - } - - /** - * @expectedException \InvalidArgumentException - * @covers Monolog\Registry::addLogger - */ - public function testFailsOnUnspecifiedReplacement() - { - $log1 = new Logger('test1'); - $log2 = new Logger('test2'); - - Registry::addLogger($log1, 'log'); - - Registry::addLogger($log2, 'log'); - } -} diff --git a/application/vendor/monolog/monolog/tests/Monolog/TestCase.php b/application/vendor/monolog/monolog/tests/Monolog/TestCase.php deleted file mode 100644 index cae7934..0000000 --- a/application/vendor/monolog/monolog/tests/Monolog/TestCase.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog; - -class TestCase extends \PHPUnit_Framework_TestCase -{ - /** - * @return array Record - */ - protected function getRecord($level = Logger::WARNING, $message = 'test', $context = array()) - { - return array( - 'message' => $message, - 'context' => $context, - 'level' => $level, - 'level_name' => Logger::getLevelName($level), - 'channel' => 'test', - 'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true))), - 'extra' => array(), - ); - } - - /** - * @return array - */ - protected function getMultipleRecords() - { - return array( - $this->getRecord(Logger::DEBUG, 'debug message 1'), - $this->getRecord(Logger::DEBUG, 'debug message 2'), - $this->getRecord(Logger::INFO, 'information'), - $this->getRecord(Logger::WARNING, 'warning'), - $this->getRecord(Logger::ERROR, 'error') - ); - } - - /** - * @return Monolog\Formatter\FormatterInterface - */ - protected function getIdentityFormatter() - { - $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); - $formatter->expects($this->any()) - ->method('format') - ->will($this->returnCallback(function ($record) { return $record['message']; })); - - return $formatter; - } -} diff --git a/application/vendor/mtdowling/cron-expression/CHANGELOG.md b/application/vendor/mtdowling/cron-expression/CHANGELOG.md new file mode 100644 index 0000000..8ddab90 --- /dev/null +++ b/application/vendor/mtdowling/cron-expression/CHANGELOG.md @@ -0,0 +1,36 @@ +# Change Log + +## [1.2.0] - 2017-01-22 +### Added +- Added IDE, CodeSniffer, and StyleCI.IO support + +### Changed +- Switched to PSR-4 Autoloading + +### Fixed +- 0 step expressions are handled better +- Fixed `DayOfMonth` validation to be more strict +- Typos + +## [1.1.0] - 2016-01-26 +### Added +- Support for non-hourly offset timezones +- Checks for valid expressions + +### Changed +- Max Iterations no longer hardcoded for `getRunDate()` +- Supports DateTimeImmutable for newer PHP verions + +### Fixed +- Fixed looping bug for PHP 7 when determining the last specified weekday of a month + +## [1.0.3] - 2013-11-23 +### Added +- Now supports expressions with any number of extra spaces, tabs, or newlines + +### Changed +- Using static instead of self in `CronExpression::factory` + +### Fixed +- Fixes issue [#28](https://github.com/mtdowling/cron-expression/issues/28) where PHP increments of ranges were failing due to PHP casting hyphens to 0 +- Only set default timezone if the given $currentTime is not a DateTime instance ([#34](https://github.com/mtdowling/cron-expression/issues/34)) diff --git a/application/vendor/mtdowling/cron-expression/README.md b/application/vendor/mtdowling/cron-expression/README.md index 1571e5d..c9e3bf3 100644 --- a/application/vendor/mtdowling/cron-expression/README.md +++ b/application/vendor/mtdowling/cron-expression/README.md @@ -68,15 +68,4 @@ Requirements - PHP 5.3+ - PHPUnit is required to run the unit tests -- Composer is required to run the unit tests - -CHANGELOG -========= - -1.0.3 (2013-11-23) ------------------- - -* Only set default timezone if the given $currentTime is not a DateTime instance ([#34](https://github.com/mtdowling/cron-expression/issues/34)) -* Fixes issue [#28](https://github.com/mtdowling/cron-expression/issues/28) where PHP increments of ranges were failing due to PHP casting hyphens to 0 -* Now supports expressions with any number of extra spaces, tabs, or newlines -* Using static instead of self in `CronExpression::factory` +- Composer is required to run the unit tests \ No newline at end of file diff --git a/application/vendor/mtdowling/cron-expression/composer.json b/application/vendor/mtdowling/cron-expression/composer.json index 62c0d89..ce42d40 100644 --- a/application/vendor/mtdowling/cron-expression/composer.json +++ b/application/vendor/mtdowling/cron-expression/composer.json @@ -13,11 +13,16 @@ "php": ">=5.3.2" }, "require-dev": { - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "~4.0|~5.0" }, "autoload": { - "psr-0": { - "Cron": "src/" + "psr-4": { + "Cron\\": "src/Cron/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/Cron/" } } } \ No newline at end of file diff --git a/application/vendor/mtdowling/cron-expression/phpunit.xml.dist b/application/vendor/mtdowling/cron-expression/phpunit.xml.dist deleted file mode 100644 index fb8a552..0000000 --- a/application/vendor/mtdowling/cron-expression/phpunit.xml.dist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - ./tests - - - - - - ./src/Cron - - - - diff --git a/application/vendor/mtdowling/cron-expression/src/Cron/AbstractField.php b/application/vendor/mtdowling/cron-expression/src/Cron/AbstractField.php index c0616a2..cd2410a 100644 --- a/application/vendor/mtdowling/cron-expression/src/Cron/AbstractField.php +++ b/application/vendor/mtdowling/cron-expression/src/Cron/AbstractField.php @@ -76,8 +76,13 @@ public function isInRange($dateValue, $value) public function isInIncrementsOfRanges($dateValue, $value) { $parts = array_map('trim', explode('/', $value, 2)); - $stepSize = isset($parts[1]) ? $parts[1] : 0; - if (($parts[0] == '*' || $parts[0] === '0') && 0 !== $stepSize) { + $stepSize = isset($parts[1]) ? (int) $parts[1] : 0; + + if ($stepSize === 0) { + return false; + } + + if (($parts[0] == '*' || $parts[0] === '0')) { return (int) $dateValue % $stepSize == 0; } @@ -101,4 +106,43 @@ public function isInIncrementsOfRanges($dateValue, $value) return false; } + + /** + * Returns a range of values for the given cron expression + * + * @param string $expression The expression to evaluate + * @param int $max Maximum offset for range + * + * @return array + */ + public function getRangeForExpression($expression, $max) + { + $values = array(); + + if ($this->isRange($expression) || $this->isIncrementsOfRanges($expression)) { + if (!$this->isIncrementsOfRanges($expression)) { + list ($offset, $to) = explode('-', $expression); + $stepSize = 1; + } + else { + $range = array_map('trim', explode('/', $expression, 2)); + $stepSize = isset($range[1]) ? $range[1] : 0; + $range = $range[0]; + $range = explode('-', $range, 2); + $offset = $range[0]; + $to = isset($range[1]) ? $range[1] : $max; + } + $offset = $offset == '*' ? 0 : $offset; + for ($i = $offset; $i <= $to; $i += $stepSize) { + $values[] = $i; + } + sort($values); + } + else { + $values = array($expression); + } + + return $values; + } + } diff --git a/application/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php b/application/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php index ce90f29..d69b415 100644 --- a/application/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php +++ b/application/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php @@ -2,6 +2,13 @@ namespace Cron; +use DateTime; +use DateTimeImmutable; +use DateTimeZone; +use Exception; +use InvalidArgumentException; +use RuntimeException; + /** * CRON expression parser that can determine whether or not a CRON expression is * due to run, the next run date and previous run date of a CRON expression. @@ -33,6 +40,11 @@ class CronExpression */ private $fieldFactory; + /** + * @var int Max iteration count when searching for next run date + */ + private $maxIterationCount = 1000; + /** * @var array Order in which to test of cron parts */ @@ -72,6 +84,25 @@ public static function factory($expression, FieldFactory $fieldFactory = null) return new static($expression, $fieldFactory ?: new FieldFactory()); } + /** + * Validate a CronExpression. + * + * @param string $expression The CRON expression to validate. + * + * @return bool True if a valid CRON expression was passed. False if not. + * @see \Cron\CronExpression::factory + */ + public static function isValidExpression($expression) + { + try { + self::factory($expression); + } catch (InvalidArgumentException $e) { + return false; + } + + return true; + } + /** * Parse a CRON expression * @@ -96,7 +127,7 @@ public function setExpression($value) { $this->cronParts = preg_split('/\s/', $value, -1, PREG_SPLIT_NO_EMPTY); if (count($this->cronParts) < 5) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( $value . ' is not a valid CRON expression' ); } @@ -120,8 +151,8 @@ public function setExpression($value) public function setPart($position, $value) { if (!$this->fieldFactory->getField($position)->validate($value)) { - throw new \InvalidArgumentException( - 'Invalid CRON field value ' . $value . ' as position ' . $position + throw new InvalidArgumentException( + 'Invalid CRON field value ' . $value . ' at position ' . $position ); } @@ -130,6 +161,20 @@ public function setPart($position, $value) return $this; } + /** + * Set max iteration count for searching next run dates + * + * @param int $maxIterationCount Max iteration count when searching for next run date + * + * @return CronExpression + */ + public function setMaxIterationCount($maxIterationCount) + { + $this->maxIterationCount = $maxIterationCount; + + return $this; + } + /** * Get a next run date relative to the current date or a specific date * @@ -161,7 +206,7 @@ public function getNextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate * * @return \DateTime * @throws \RuntimeException on too many iterations - * @see Cron\CronExpression::getNextRunDate + * @see \Cron\CronExpression::getNextRunDate */ public function getPreviousRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false) { @@ -183,7 +228,11 @@ public function getMultipleRunDates($total, $currentTime = 'now', $invert = fals { $matches = array(); for ($i = 0; $i < max(0, $total); $i++) { - $matches[] = $this->getRunDate($currentTime, $i, $invert, $allowCurrentDate); + try { + $matches[] = $this->getRunDate($currentTime, $i, $invert, $allowCurrentDate); + } catch (RuntimeException $e) { + break; + } } return $matches; @@ -233,14 +282,19 @@ public function isDue($currentTime = 'now') if ('now' === $currentTime) { $currentDate = date('Y-m-d H:i'); $currentTime = strtotime($currentDate); - } elseif ($currentTime instanceof \DateTime) { + } elseif ($currentTime instanceof DateTime) { $currentDate = clone $currentTime; // Ensure time in 'current' timezone is used - $currentDate->setTimezone(new \DateTimeZone(date_default_timezone_get())); + $currentDate->setTimezone(new DateTimeZone(date_default_timezone_get())); + $currentDate = $currentDate->format('Y-m-d H:i'); + $currentTime = strtotime($currentDate); + } elseif ($currentTime instanceof DateTimeImmutable) { + $currentDate = DateTime::createFromFormat('U', $currentTime->format('U')); + $currentDate->setTimezone(new DateTimeZone(date_default_timezone_get())); $currentDate = $currentDate->format('Y-m-d H:i'); $currentTime = strtotime($currentDate); } else { - $currentTime = new \DateTime($currentTime); + $currentTime = new DateTime($currentTime); $currentTime->setTime($currentTime->format('H'), $currentTime->format('i'), 0); $currentDate = $currentTime->format('Y-m-d H:i'); $currentTime = $currentTime->getTimeStamp(); @@ -248,7 +302,7 @@ public function isDue($currentTime = 'now') try { return $this->getNextRunDate($currentDate, 0, true)->getTimestamp() == $currentTime; - } catch (\Exception $e) { + } catch (Exception $e) { return false; } } @@ -267,11 +321,14 @@ public function isDue($currentTime = 'now') */ protected function getRunDate($currentTime = null, $nth = 0, $invert = false, $allowCurrentDate = false) { - if ($currentTime instanceof \DateTime) { + if ($currentTime instanceof DateTime) { $currentDate = clone $currentTime; + } elseif ($currentTime instanceof DateTimeImmutable) { + $currentDate = DateTime::createFromFormat('U', $currentTime->format('U')); + $currentDate->setTimezone($currentTime->getTimezone()); } else { - $currentDate = new \DateTime($currentTime ?: 'now'); - $currentDate->setTimezone(new \DateTimeZone(date_default_timezone_get())); + $currentDate = new DateTime($currentTime ?: 'now'); + $currentDate->setTimezone(new DateTimeZone(date_default_timezone_get())); } $currentDate->setTime($currentDate->format('H'), $currentDate->format('i'), 0); @@ -291,7 +348,7 @@ protected function getRunDate($currentTime = null, $nth = 0, $invert = false, $a } // Set a hard limit to bail on an impossible date - for ($i = 0; $i < 1000; $i++) { + for ($i = 0; $i < $this->maxIterationCount; $i++) { foreach ($parts as $position => $part) { $satisfied = false; @@ -311,14 +368,14 @@ protected function getRunDate($currentTime = null, $nth = 0, $invert = false, $a // If the field is not satisfied, then start over if (!$satisfied) { - $field->increment($nextRun, $invert); + $field->increment($nextRun, $invert, $part); continue 2; } } // Skip this match if needed if ((!$allowCurrentDate && $nextRun == $currentDate) || --$nth > -1) { - $this->fieldFactory->getField(0)->increment($nextRun, $invert); + $this->fieldFactory->getField(0)->increment($nextRun, $invert, isset($parts[0]) ? $parts[0] : null); continue; } @@ -326,7 +383,7 @@ protected function getRunDate($currentTime = null, $nth = 0, $invert = false, $a } // @codeCoverageIgnoreStart - throw new \RuntimeException('Impossible CRON expression'); + throw new RuntimeException('Impossible CRON expression'); // @codeCoverageIgnoreEnd } } diff --git a/application/vendor/mtdowling/cron-expression/src/Cron/DayOfMonthField.php b/application/vendor/mtdowling/cron-expression/src/Cron/DayOfMonthField.php index 86129c9..53e15bc 100644 --- a/application/vendor/mtdowling/cron-expression/src/Cron/DayOfMonthField.php +++ b/application/vendor/mtdowling/cron-expression/src/Cron/DayOfMonthField.php @@ -2,6 +2,8 @@ namespace Cron; +use DateTime; + /** * Day of month field. Allows: * , / - ? L W * @@ -34,7 +36,7 @@ class DayOfMonthField extends AbstractField private static function getNearestWeekday($currentYear, $currentMonth, $targetDay) { $tday = str_pad($targetDay, 2, '0', STR_PAD_LEFT); - $target = \DateTime::createFromFormat('Y-m-d', "$currentYear-$currentMonth-$tday"); + $target = DateTime::createFromFormat('Y-m-d', "$currentYear-$currentMonth-$tday"); $currentWeekday = (int) $target->format('N'); if ($currentWeekday < 6) { @@ -54,7 +56,7 @@ private static function getNearestWeekday($currentYear, $currentMonth, $targetDa } } - public function isSatisfiedBy(\DateTime $date, $value) + public function isSatisfiedBy(DateTime $date, $value) { // ? states that the field value is to be skipped if ($value == '?') { @@ -83,7 +85,7 @@ public function isSatisfiedBy(\DateTime $date, $value) return $this->isSatisfied($date->format('d'), $value); } - public function increment(\DateTime $date, $invert = false) + public function increment(DateTime $date, $invert = false) { if ($invert) { $date->modify('previous day'); @@ -96,8 +98,76 @@ public function increment(\DateTime $date, $invert = false) return $this; } + /** + * Validates that the value is valid for the Day of the Month field + * Days of the month can contain values of 1-31, *, L, or ? by default. This can be augmented with lists via a ',', + * ranges via a '-', or with a '[0-9]W' to specify the closest weekday. + * + * @param string $value + * @return bool + */ public function validate($value) { - return (bool) preg_match('/^[\*,\/\-\?LW0-9A-Za-z]+$/', $value); + // Allow wildcards and a single L + if ($value === '?' || $value === '*' || $value === 'L') { + return true; + } + + // If you only contain numbers and are within 1-31 + if ((bool) preg_match('/^\d{1,2}$/', $value) && ($value >= 1 && $value <= 31)) { + return true; + } + + // If you have a -, we will deal with each of your chunks + if ((bool) preg_match('/-/', $value)) { + // We cannot have a range within a list or vice versa + if ((bool) preg_match('/,/', $value)) { + return false; + } + + $chunks = explode('-', $value); + foreach ($chunks as $chunk) { + if (!$this->validate($chunk)) { + return false; + } + } + + return true; + } + + // If you have a comma, we will deal with each value + if ((bool) preg_match('/,/', $value)) { + // We cannot have a range within a list or vice versa + if ((bool) preg_match('/-/', $value)) { + return false; + } + + $chunks = explode(',', $value); + foreach ($chunks as $chunk) { + if (!$this->validate($chunk)) { + return false; + } + } + + return true; + } + + // If you contain a /, we'll deal with it + if ((bool) preg_match('/\//', $value)) { + $chunks = explode('/', $value); + foreach ($chunks as $chunk) { + if (!$this->validate($chunk)) { + return false; + } + } + return true; + } + + // If you end in W, make sure that it has a numeric in front of it + if ((bool) preg_match('/^\d{1,2}W$/', $value)) { + return true; + } + + return false; } } diff --git a/application/vendor/mtdowling/cron-expression/src/Cron/DayOfWeekField.php b/application/vendor/mtdowling/cron-expression/src/Cron/DayOfWeekField.php index 8e33b19..83e2f4c 100644 --- a/application/vendor/mtdowling/cron-expression/src/Cron/DayOfWeekField.php +++ b/application/vendor/mtdowling/cron-expression/src/Cron/DayOfWeekField.php @@ -2,6 +2,10 @@ namespace Cron; +use DateTime; +use InvalidArgumentException; + + /** * Day of week field. Allows: * / , - ? L # * @@ -17,7 +21,7 @@ */ class DayOfWeekField extends AbstractField { - public function isSatisfiedBy(\DateTime $date, $value) + public function isSatisfiedBy(DateTime $date, $value) { if ($value == '?') { return true; @@ -36,7 +40,10 @@ public function isSatisfiedBy(\DateTime $date, $value) $tdate = clone $date; $tdate->setDate($currentYear, $currentMonth, $lastDayOfMonth); while ($tdate->format('w') != $weekday) { - $tdate->setDate($currentYear, $currentMonth, --$lastDayOfMonth); + $tdateClone = new DateTime(); + $tdate = $tdateClone + ->setTimezone($tdate->getTimezone()) + ->setDate($currentYear, $currentMonth, --$lastDayOfMonth); } return $date->format('j') == $lastDayOfMonth; @@ -53,10 +60,10 @@ public function isSatisfiedBy(\DateTime $date, $value) // Validate the hash fields if ($weekday < 0 || $weekday > 7) { - throw new \InvalidArgumentException("Weekday must be a value between 0 and 7. {$weekday} given"); + throw new InvalidArgumentException("Weekday must be a value between 0 and 7. {$weekday} given"); } if ($nth > 5) { - throw new \InvalidArgumentException('There are never more than 5 of a given weekday in a month'); + throw new InvalidArgumentException('There are never more than 5 of a given weekday in a month'); } // The current weekday must match the targeted weekday to proceed if ($date->format('N') != $weekday) { @@ -97,7 +104,7 @@ public function isSatisfiedBy(\DateTime $date, $value) return $this->isSatisfied($fieldValue, $value); } - public function increment(\DateTime $date, $invert = false) + public function increment(DateTime $date, $invert = false) { if ($invert) { $date->modify('-1 day'); diff --git a/application/vendor/mtdowling/cron-expression/src/Cron/FieldFactory.php b/application/vendor/mtdowling/cron-expression/src/Cron/FieldFactory.php index 5aa86f6..fa0e6fe 100644 --- a/application/vendor/mtdowling/cron-expression/src/Cron/FieldFactory.php +++ b/application/vendor/mtdowling/cron-expression/src/Cron/FieldFactory.php @@ -2,6 +2,8 @@ namespace Cron; +use InvalidArgumentException; + /** * CRON field factory implementing a flyweight factory * @link http://en.wikipedia.org/wiki/Cron @@ -44,7 +46,7 @@ public function getField($position) $this->fields[$position] = new YearField(); break; default: - throw new \InvalidArgumentException( + throw new InvalidArgumentException( $position . ' is not a valid position' ); } diff --git a/application/vendor/mtdowling/cron-expression/src/Cron/FieldInterface.php b/application/vendor/mtdowling/cron-expression/src/Cron/FieldInterface.php index 3823fbf..be37b93 100644 --- a/application/vendor/mtdowling/cron-expression/src/Cron/FieldInterface.php +++ b/application/vendor/mtdowling/cron-expression/src/Cron/FieldInterface.php @@ -1,6 +1,7 @@ isSatisfied($date->format('H'), $value); } - public function increment(\DateTime $date, $invert = false) + public function increment(DateTime $date, $invert = false, $parts = null) { // Change timezone to UTC temporarily. This will // allow us to go back or forwards and hour even // if DST will be changed between the hours. - $timezone = $date->getTimezone(); - $date->setTimezone(new \DateTimeZone('UTC')); - if ($invert) { - $date->modify('-1 hour'); - $date->setTime($date->format('H'), 59); - } else { - $date->modify('+1 hour'); - $date->setTime($date->format('H'), 0); + if (is_null($parts) || $parts == '*') { + $timezone = $date->getTimezone(); + $date->setTimezone(new DateTimeZone('UTC')); + if ($invert) { + $date->modify('-1 hour'); + } else { + $date->modify('+1 hour'); + } + $date->setTimezone($timezone); + + $date->setTime($date->format('H'), $invert ? 59 : 0); + return $this; + } + + $parts = strpos($parts, ',') !== false ? explode(',', $parts) : array($parts); + $hours = array(); + foreach ($parts as $part) { + $hours = array_merge($hours, $this->getRangeForExpression($part, 23)); + } + + $current_hour = $date->format('H'); + $position = $invert ? count($hours) - 1 : 0; + if (count($hours) > 1) { + for ($i = 0; $i < count($hours) - 1; $i++) { + if ((!$invert && $current_hour >= $hours[$i] && $current_hour < $hours[$i + 1]) || + ($invert && $current_hour > $hours[$i] && $current_hour <= $hours[$i + 1])) { + $position = $invert ? $i : $i + 1; + break; + } + } + } + + $hour = $hours[$position]; + if ((!$invert && $date->format('H') >= $hour) || ($invert && $date->format('H') <= $hour)) { + $date->modify(($invert ? '-' : '+') . '1 day'); + $date->setTime($invert ? 23 : 0, $invert ? 59 : 0); + } + else { + $date->setTime($hour, $invert ? 59 : 0); } - $date->setTimezone($timezone); return $this; } diff --git a/application/vendor/mtdowling/cron-expression/src/Cron/MinutesField.php b/application/vendor/mtdowling/cron-expression/src/Cron/MinutesField.php index cfa2b09..d8432b5 100644 --- a/application/vendor/mtdowling/cron-expression/src/Cron/MinutesField.php +++ b/application/vendor/mtdowling/cron-expression/src/Cron/MinutesField.php @@ -2,22 +2,54 @@ namespace Cron; +use DateTime; + + /** * Minutes field. Allows: * , / - */ class MinutesField extends AbstractField { - public function isSatisfiedBy(\DateTime $date, $value) + public function isSatisfiedBy(DateTime $date, $value) { return $this->isSatisfied($date->format('i'), $value); } - public function increment(\DateTime $date, $invert = false) + public function increment(DateTime $date, $invert = false, $parts = null) { - if ($invert) { - $date->modify('-1 minute'); - } else { - $date->modify('+1 minute'); + if (is_null($parts)) { + if ($invert) { + $date->modify('-1 minute'); + } else { + $date->modify('+1 minute'); + } + return $this; + } + + $parts = strpos($parts, ',') !== false ? explode(',', $parts) : array($parts); + $minutes = array(); + foreach ($parts as $part) { + $minutes = array_merge($minutes, $this->getRangeForExpression($part, 59)); + } + + $current_minute = $date->format('i'); + $position = $invert ? count($minutes) - 1 : 0; + if (count($minutes) > 1) { + for ($i = 0; $i < count($minutes) - 1; $i++) { + if ((!$invert && $current_minute >= $minutes[$i] && $current_minute < $minutes[$i + 1]) || + ($invert && $current_minute > $minutes[$i] && $current_minute <= $minutes[$i + 1])) { + $position = $invert ? $i : $i + 1; + break; + } + } + } + + if ((!$invert && $current_minute >= $minutes[$position]) || ($invert && $current_minute <= $minutes[$position])) { + $date->modify(($invert ? '-' : '+') . '1 hour'); + $date->setTime($date->format('H'), $invert ? 59 : 0); + } + else { + $date->setTime($date->format('H'), $minutes[$position]); } return $this; diff --git a/application/vendor/mtdowling/cron-expression/src/Cron/YearField.php b/application/vendor/mtdowling/cron-expression/src/Cron/YearField.php index b526dde..db244fb 100644 --- a/application/vendor/mtdowling/cron-expression/src/Cron/YearField.php +++ b/application/vendor/mtdowling/cron-expression/src/Cron/YearField.php @@ -2,17 +2,20 @@ namespace Cron; +use DateTime; + + /** * Year field. Allows: * , / - */ class YearField extends AbstractField { - public function isSatisfiedBy(\DateTime $date, $value) + public function isSatisfiedBy(DateTime $date, $value) { return $this->isSatisfied($date->format('Y'), $value); } - public function increment(\DateTime $date, $invert = false) + public function increment(DateTime $date, $invert = false) { if ($invert) { $date->modify('-1 year'); diff --git a/application/vendor/mtdowling/cron-expression/tests/Cron/AbstractFieldTest.php b/application/vendor/mtdowling/cron-expression/tests/Cron/AbstractFieldTest.php index 5272106..a1d653b 100644 --- a/application/vendor/mtdowling/cron-expression/tests/Cron/AbstractFieldTest.php +++ b/application/vendor/mtdowling/cron-expression/tests/Cron/AbstractFieldTest.php @@ -3,11 +3,12 @@ namespace Cron\Tests; use Cron\DayOfWeekField; +use PHPUnit_Framework_TestCase; /** * @author Michael Dowling */ -class AbstractFieldTest extends \PHPUnit_Framework_TestCase +class AbstractFieldTest extends PHPUnit_Framework_TestCase { /** * @covers Cron\AbstractField::isRange @@ -26,7 +27,6 @@ public function testTestsIfIncrementsOfRanges() { $f = new DayOfWeekField(); $this->assertFalse($f->isIncrementsOfRanges('1-2')); - $this->assertFalse($f->isIncrementsOfRanges('1-2')); $this->assertTrue($f->isIncrementsOfRanges('1/2')); $this->assertTrue($f->isIncrementsOfRanges('*/2')); $this->assertTrue($f->isIncrementsOfRanges('3-12/2')); @@ -38,11 +38,11 @@ public function testTestsIfIncrementsOfRanges() public function testTestsIfInRange() { $f = new DayOfWeekField(); - $this->assertTrue($f->isInRange(1, '1-2')); - $this->assertTrue($f->isInRange(2, '1-2')); - $this->assertTrue($f->isInRange(5, '4-12')); - $this->assertFalse($f->isInRange(3, '4-12')); - $this->assertFalse($f->isInRange(13, '4-12')); + $this->assertTrue($f->isInRange('1', '1-2')); + $this->assertTrue($f->isInRange('2', '1-2')); + $this->assertTrue($f->isInRange('5', '4-12')); + $this->assertFalse($f->isInRange('3', '4-12')); + $this->assertFalse($f->isInRange('13', '4-12')); } /** @@ -51,20 +51,22 @@ public function testTestsIfInRange() public function testTestsIfInIncrementsOfRanges() { $f = new DayOfWeekField(); - $this->assertTrue($f->isInIncrementsOfRanges(3, '3-59/2')); - $this->assertTrue($f->isInIncrementsOfRanges(13, '3-59/2')); - $this->assertTrue($f->isInIncrementsOfRanges(15, '3-59/2')); - $this->assertTrue($f->isInIncrementsOfRanges(14, '*/2')); - $this->assertFalse($f->isInIncrementsOfRanges(2, '3-59/13')); - $this->assertFalse($f->isInIncrementsOfRanges(14, '*/13')); - $this->assertFalse($f->isInIncrementsOfRanges(14, '3-59/2')); - $this->assertFalse($f->isInIncrementsOfRanges(3, '2-59')); - $this->assertFalse($f->isInIncrementsOfRanges(3, '2')); - $this->assertFalse($f->isInIncrementsOfRanges(3, '*')); + $this->assertTrue($f->isInIncrementsOfRanges('3', '3-59/2')); + $this->assertTrue($f->isInIncrementsOfRanges('13', '3-59/2')); + $this->assertTrue($f->isInIncrementsOfRanges('15', '3-59/2')); + $this->assertTrue($f->isInIncrementsOfRanges('14', '*/2')); + $this->assertFalse($f->isInIncrementsOfRanges('2', '3-59/13')); + $this->assertFalse($f->isInIncrementsOfRanges('14', '*/13')); + $this->assertFalse($f->isInIncrementsOfRanges('14', '3-59/2')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '2-59')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '2')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '*')); + $this->assertFalse($f->isInIncrementsOfRanges('0', '*/0')); + $this->assertFalse($f->isInIncrementsOfRanges('1', '*/0')); - $this->assertTrue($f->isInIncrementsOfRanges(4, '4/10')); - $this->assertTrue($f->isInIncrementsOfRanges(14, '4/10')); - $this->assertTrue($f->isInIncrementsOfRanges(34, '4/10')); + $this->assertTrue($f->isInIncrementsOfRanges('4', '4/10')); + $this->assertTrue($f->isInIncrementsOfRanges('14', '4/10')); + $this->assertTrue($f->isInIncrementsOfRanges('34', '4/10')); } /** diff --git a/application/vendor/mtdowling/cron-expression/tests/Cron/CronExpressionTest.php b/application/vendor/mtdowling/cron-expression/tests/Cron/CronExpressionTest.php index 013b701..f6fedb9 100644 --- a/application/vendor/mtdowling/cron-expression/tests/Cron/CronExpressionTest.php +++ b/application/vendor/mtdowling/cron-expression/tests/Cron/CronExpressionTest.php @@ -4,12 +4,14 @@ use Cron\CronExpression; use DateTime; +use DateTimeZone; use InvalidArgumentException; +use PHPUnit_Framework_TestCase; /** * @author Michael Dowling */ -class CronExpressionTest extends \PHPUnit_Framework_TestCase +class CronExpressionTest extends PHPUnit_Framework_TestCase { /** * @covers Cron\CronExpression::factory @@ -222,9 +224,9 @@ public function testIsDueHandlesDifferentTimezones() { $cron = CronExpression::factory('0 15 * * 3'); //Wednesday at 15:00 $date = '2014-01-01 15:00'; //Wednesday - $utc = new \DateTimeZone('UTC'); - $amsterdam = new \DateTimeZone('Europe/Amsterdam'); - $tokyo = new \DateTimeZone('Asia/Tokyo'); + $utc = new DateTimeZone('UTC'); + $amsterdam = new DateTimeZone('Europe/Amsterdam'); + $tokyo = new DateTimeZone('Asia/Tokyo'); date_default_timezone_set('UTC'); $this->assertTrue($cron->isDue(new DateTime($date, $utc))); @@ -277,6 +279,27 @@ public function testProvidesMultipleRunDates() ), $cron->getMultipleRunDates(4, '2008-11-09 00:00:00', false, true)); } + /** + * @covers Cron\CronExpression::getMultipleRunDates + * @covers Cron\CronExpression::setMaxIterationCount + */ + public function testProvidesMultipleRunDatesForTheFarFuture() { + // Fails with the default 1000 iteration limit + $cron = CronExpression::factory('0 0 12 1 * */2'); + $cron->setMaxIterationCount(2000); + $this->assertEquals(array( + new DateTime('2016-01-12 00:00:00'), + new DateTime('2018-01-12 00:00:00'), + new DateTime('2020-01-12 00:00:00'), + new DateTime('2022-01-12 00:00:00'), + new DateTime('2024-01-12 00:00:00'), + new DateTime('2026-01-12 00:00:00'), + new DateTime('2028-01-12 00:00:00'), + new DateTime('2030-01-12 00:00:00'), + new DateTime('2032-01-12 00:00:00'), + ), $cron->getMultipleRunDates(9, '2015-04-28 00:00:00', false, true)); + } + /** * @covers Cron\CronExpression */ @@ -368,9 +391,24 @@ public function testIssue20() { public function testKeepOriginalTime() { $now = new \DateTime; - $strNow = $now->format(\DateTime::ISO8601); + $strNow = $now->format(DateTime::ISO8601); $cron = CronExpression::factory('0 0 * * *'); $cron->getPreviousRunDate($now); - $this->assertEquals($strNow, $now->format(\DateTime::ISO8601)); + $this->assertEquals($strNow, $now->format(DateTime::ISO8601)); + } + + /** + * @covers Cron\CronExpression::__construct + * @covers Cron\CronExpression::factory + * @covers Cron\CronExpression::isValidExpression + * @covers Cron\CronExpression::setExpression + * @covers Cron\CronExpression::setPart + */ + public function testValidationWorks() + { + // Invalid. Only four values + $this->assertFalse(CronExpression::isValidExpression('* * * 1')); + // Valid + $this->assertTrue(CronExpression::isValidExpression('* * * * 1')); } } diff --git a/application/vendor/mtdowling/cron-expression/tests/Cron/DayOfMonthFieldTest.php b/application/vendor/mtdowling/cron-expression/tests/Cron/DayOfMonthFieldTest.php index 94afbb0..eff0455 100644 --- a/application/vendor/mtdowling/cron-expression/tests/Cron/DayOfMonthFieldTest.php +++ b/application/vendor/mtdowling/cron-expression/tests/Cron/DayOfMonthFieldTest.php @@ -3,23 +3,22 @@ namespace Cron\Tests; use Cron\DayOfMonthField; - use DateTime; +use PHPUnit_Framework_TestCase; /** * @author Michael Dowling */ -class DayOfMonthFieldTest extends \PHPUnit_Framework_TestCase +class DayOfMonthFieldTest extends PHPUnit_Framework_TestCase { /** * @covers Cron\DayOfMonthField::validate */ - public function testValdatesField() + public function testValidatesField() { $f = new DayOfMonthField(); $this->assertTrue($f->validate('1')); $this->assertTrue($f->validate('*')); - $this->assertTrue($f->validate('*/3,1,1-12')); $this->assertTrue($f->validate('5W,L')); $this->assertFalse($f->validate('1.')); } @@ -47,4 +46,16 @@ public function testIncrementsDate() $f->increment($d, true); $this->assertEquals('2011-03-14 23:59:00', $d->format('Y-m-d H:i:s')); } + + /** + * Day of the month cannot accept a 0 value, it must be between 1 and 31 + * See Github issue #120 + * + * @since 2017-01-22 + */ + public function testDoesNotAccept0Date() + { + $f = new DayOfMonthField(); + $this->assertFalse($f->validate(0)); + } } diff --git a/application/vendor/mtdowling/cron-expression/tests/Cron/DayOfWeekFieldTest.php b/application/vendor/mtdowling/cron-expression/tests/Cron/DayOfWeekFieldTest.php index 703a517..182d5e9 100644 --- a/application/vendor/mtdowling/cron-expression/tests/Cron/DayOfWeekFieldTest.php +++ b/application/vendor/mtdowling/cron-expression/tests/Cron/DayOfWeekFieldTest.php @@ -4,11 +4,12 @@ use Cron\DayOfWeekField; use DateTime; +use PHPUnit_Framework_TestCase; /** * @author Michael Dowling */ -class DayOfWeekFieldTest extends \PHPUnit_Framework_TestCase +class DayOfWeekFieldTest extends PHPUnit_Framework_TestCase { /** * @covers Cron\DayOfWeekField::validate diff --git a/application/vendor/mtdowling/cron-expression/tests/Cron/FieldFactoryTest.php b/application/vendor/mtdowling/cron-expression/tests/Cron/FieldFactoryTest.php index ec087b1..f34cc9b 100644 --- a/application/vendor/mtdowling/cron-expression/tests/Cron/FieldFactoryTest.php +++ b/application/vendor/mtdowling/cron-expression/tests/Cron/FieldFactoryTest.php @@ -3,11 +3,12 @@ namespace Cron\Tests; use Cron\FieldFactory; +use PHPUnit_Framework_TestCase; /** * @author Michael Dowling */ -class FieldFactoryTest extends \PHPUnit_Framework_TestCase +class FieldFactoryTest extends PHPUnit_Framework_TestCase { /** * @covers Cron\FieldFactory::getField diff --git a/application/vendor/mtdowling/cron-expression/tests/Cron/HoursFieldTest.php b/application/vendor/mtdowling/cron-expression/tests/Cron/HoursFieldTest.php index 48bd135..d2d8a22 100644 --- a/application/vendor/mtdowling/cron-expression/tests/Cron/HoursFieldTest.php +++ b/application/vendor/mtdowling/cron-expression/tests/Cron/HoursFieldTest.php @@ -4,16 +4,17 @@ use Cron\HoursField; use DateTime; +use PHPUnit_Framework_TestCase; /** * @author Michael Dowling */ -class HoursFieldTest extends \PHPUnit_Framework_TestCase +class HoursFieldTest extends PHPUnit_Framework_TestCase { /** * @covers Cron\HoursField::validate */ - public function testValdatesField() + public function testValidatesField() { $f = new HoursField(); $this->assertTrue($f->validate('1')); @@ -35,4 +36,40 @@ public function testIncrementsDate() $f->increment($d, true); $this->assertEquals('2011-03-15 10:59:00', $d->format('Y-m-d H:i:s')); } + + /** + * @covers Cron\HoursField::increment + */ + public function testIncrementsDateWithThirtyMinuteOffsetTimezone() + { + $tz = date_default_timezone_get(); + date_default_timezone_set('America/St_Johns'); + $d = new DateTime('2011-03-15 11:15:00'); + $f = new HoursField(); + $f->increment($d); + $this->assertEquals('2011-03-15 12:00:00', $d->format('Y-m-d H:i:s')); + + $d->setTime(11, 15, 0); + $f->increment($d, true); + $this->assertEquals('2011-03-15 10:59:00', $d->format('Y-m-d H:i:s')); + date_default_timezone_set($tz); + } + + /** + * @covers Cron\HoursField::increment + */ + public function testIncrementDateWithFifteenMinuteOffsetTimezone() + { + $tz = date_default_timezone_get(); + date_default_timezone_set('Asia/Kathmandu'); + $d = new DateTime('2011-03-15 11:15:00'); + $f = new HoursField(); + $f->increment($d); + $this->assertEquals('2011-03-15 12:00:00', $d->format('Y-m-d H:i:s')); + + $d->setTime(11, 15, 0); + $f->increment($d, true); + $this->assertEquals('2011-03-15 10:59:00', $d->format('Y-m-d H:i:s')); + date_default_timezone_set($tz); + } } diff --git a/application/vendor/mtdowling/cron-expression/tests/Cron/MinutesFieldTest.php b/application/vendor/mtdowling/cron-expression/tests/Cron/MinutesFieldTest.php index 82ce966..af3fef7 100644 --- a/application/vendor/mtdowling/cron-expression/tests/Cron/MinutesFieldTest.php +++ b/application/vendor/mtdowling/cron-expression/tests/Cron/MinutesFieldTest.php @@ -4,16 +4,17 @@ use Cron\MinutesField; use DateTime; +use PHPUnit_Framework_TestCase; /** * @author Michael Dowling */ -class MinutesFieldTest extends \PHPUnit_Framework_TestCase +class MinutesFieldTest extends PHPUnit_Framework_TestCase { /** * @covers Cron\MinutesField::validate */ - public function testValdatesField() + public function testValidatesField() { $f = new MinutesField(); $this->assertTrue($f->validate('1')); diff --git a/application/vendor/mtdowling/cron-expression/tests/Cron/MonthFieldTest.php b/application/vendor/mtdowling/cron-expression/tests/Cron/MonthFieldTest.php index 82878f8..2d9b0ad 100644 --- a/application/vendor/mtdowling/cron-expression/tests/Cron/MonthFieldTest.php +++ b/application/vendor/mtdowling/cron-expression/tests/Cron/MonthFieldTest.php @@ -4,16 +4,17 @@ use Cron\MonthField; use DateTime; +use PHPUnit_Framework_TestCase; /** * @author Michael Dowling */ -class MonthFieldTest extends \PHPUnit_Framework_TestCase +class MonthFieldTest extends PHPUnit_Framework_TestCase { /** * @covers Cron\MonthField::validate */ - public function testValdatesField() + public function testValidatesField() { $f = new MonthField(); $this->assertTrue($f->validate('12')); @@ -37,6 +38,25 @@ public function testIncrementsDate() $this->assertEquals('2011-02-28 23:59:00', $d->format('Y-m-d H:i:s')); } + /** + * @covers Cron\MonthField::increment + */ + public function testIncrementsDateWithThirtyMinuteTimezone() + { + $tz = date_default_timezone_get(); + date_default_timezone_set('America/St_Johns'); + $d = new DateTime('2011-03-31 11:59:59'); + $f = new MonthField(); + $f->increment($d); + $this->assertEquals('2011-04-01 00:00:00', $d->format('Y-m-d H:i:s')); + + $d = new DateTime('2011-03-15 11:15:00'); + $f->increment($d, true); + $this->assertEquals('2011-02-28 23:59:00', $d->format('Y-m-d H:i:s')); + date_default_timezone_set($tz); + } + + /** * @covers Cron\MonthField::increment */ diff --git a/application/vendor/mtdowling/cron-expression/tests/Cron/YearFieldTest.php b/application/vendor/mtdowling/cron-expression/tests/Cron/YearFieldTest.php index e7bcacb..b5059ec 100644 --- a/application/vendor/mtdowling/cron-expression/tests/Cron/YearFieldTest.php +++ b/application/vendor/mtdowling/cron-expression/tests/Cron/YearFieldTest.php @@ -4,16 +4,17 @@ use Cron\YearField; use DateTime; +use PHPUnit_Framework_TestCase; /** * @author Michael Dowling */ -class YearFieldTest extends \PHPUnit_Framework_TestCase +class YearFieldTest extends PHPUnit_Framework_TestCase { /** * @covers Cron\YearField::validate */ - public function testValdatesField() + public function testValidatesField() { $f = new YearField(); $this->assertTrue($f->validate('2011')); diff --git a/application/vendor/nesbot/carbon/bin/upgrade-carbon b/application/vendor/nesbot/carbon/bin/upgrade-carbon new file mode 100644 index 0000000..49c4c9a --- /dev/null +++ b/application/vendor/nesbot/carbon/bin/upgrade-carbon @@ -0,0 +1,34 @@ +#!/usr/bin/env php +=5.3.9", + "kylekatarnls/update-helper": "^1.1", + "symfony/translation": "~2.6 || ~3.0 || ~4.0" + }, + "require-dev": { + "composer/composer": "^1.2", + "friendsofphp/php-cs-fixer": "~2", + "phpunit/phpunit": "^4.8.35 || ^5.7" + }, + "autoload": { + "psr-4": { + "": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, + "config": { + "sort-packages": true + }, + "scripts": { + "test": [ + "@phpunit", + "@phpcs" + ], + "phpunit": "phpunit --verbose --coverage-clover=coverage.xml", + "phpcs": "php-cs-fixer fix -v --diff --dry-run", + "phpstan": "phpstan analyse --configuration phpstan.neon --level 3 src tests", + "post-autoload-dump": [ + "UpdateHelper\\UpdateHelper::check" + ], + "upgrade-carbon": [ + "Carbon\\Upgrade::upgrade" + ] + }, + "extra": { + "update-helper": "Carbon\\Upgrade", + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + } } - ], - "require": { - "php": ">=5.3.0", - "symfony/translation": "~2.6|~3.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" - }, - "autoload": { - "psr-4": { - "Carbon\\": "src/Carbon/" - } - }, - "autoload-dev": { - "psr-4": { - "Tests\\": "tests/" - } - } } diff --git a/application/vendor/nesbot/carbon/readme.md b/application/vendor/nesbot/carbon/readme.md index 545bed3..5e9d1cc 100644 --- a/application/vendor/nesbot/carbon/readme.md +++ b/application/vendor/nesbot/carbon/readme.md @@ -4,15 +4,20 @@ [![Total Downloads](https://poser.pugx.org/nesbot/carbon/downloads.png)](https://packagist.org/packages/nesbot/carbon) [![Build Status](https://travis-ci.org/briannesbitt/Carbon.svg?branch=master)](https://travis-ci.org/briannesbitt/Carbon) [![StyleCI](https://styleci.io/repos/5724990/shield?style=flat)](https://styleci.io/repos/5724990) +[![codecov.io](https://codecov.io/github/briannesbitt/Carbon/coverage.svg?branch=master)](https://codecov.io/github/briannesbitt/Carbon?branch=master) +[![PHP-Eye](https://php-eye.com/badge/nesbot/carbon/tested.svg?style=flat)](https://php-eye.com/package/nesbot/carbon) +[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan) A simple PHP API extension for DateTime. [http://carbon.nesbot.com](http://carbon.nesbot.com) ```php +use Carbon\Carbon; + printf("Right now is %s", Carbon::now()->toDateTimeString()); printf("Right now in Vancouver is %s", Carbon::now('America/Vancouver')); //implicit __toString() $tomorrow = Carbon::now()->addDay(); $lastWeek = Carbon::now()->subWeek(); -$nextSummerOlympics = Carbon::createFromDate(2012)->addYears(4); +$nextSummerOlympics = Carbon::createFromDate(2016)->addYears(4); $officialDate = Carbon::now()->toRfc2822String(); @@ -20,13 +25,13 @@ $howOldAmI = Carbon::createFromDate(1975, 5, 21)->age; $noonTodayLondonTime = Carbon::createFromTime(12, 0, 0, 'Europe/London'); -$worldWillEnd = Carbon::createFromDate(2012, 12, 21, 'GMT'); +$internetWillBlowUpOn = Carbon::create(2038, 01, 19, 3, 14, 7, 'GMT'); -// Don't really want to die so mock now +// Don't really want this to happen so mock now Carbon::setTestNow(Carbon::createFromDate(2000, 1, 1)); // comparisons are always done in UTC -if (Carbon::now()->gte($worldWillEnd)) { +if (Carbon::now()->gte($internetWillBlowUpOn)) { die(); } @@ -55,7 +60,7 @@ $ composer require nesbot/carbon ```json { "require": { - "nesbot/carbon": "~1.14" + "nesbot/carbon": "~1.21" } } ``` @@ -70,6 +75,7 @@ printf("Now: %s", Carbon::now()); ``` + ### Without Composer Why are you not using [composer](http://getcomposer.org/)? Download [Carbon.php](https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/Carbon.php) from the repo and save the file into your project path somewhere. @@ -82,3 +88,7 @@ use Carbon\Carbon; printf("Now: %s", Carbon::now()); ``` + +## Docs + +[http://carbon.nesbot.com/docs](http://carbon.nesbot.com/docs) diff --git a/application/vendor/nesbot/carbon/src/Carbon/Carbon.php b/application/vendor/nesbot/carbon/src/Carbon/Carbon.php index 2d27616..7b8a5d9 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Carbon.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Carbon.php @@ -11,14 +11,16 @@ namespace Carbon; +use Carbon\Exceptions\InvalidDateException; use Closure; +use DateInterval; +use DatePeriod; use DateTime; +use DateTimeInterface; use DateTimeZone; -use DatePeriod; use InvalidArgumentException; -use Symfony\Component\Translation\Translator; +use JsonSerializable; use Symfony\Component\Translation\TranslatorInterface; -use Symfony\Component\Translation\Loader\ArrayLoader; /** * A simple API extension for DateTime @@ -31,28 +33,47 @@ * @property int $minute * @property int $second * @property int $timestamp seconds since the Unix Epoch - * @property DateTimeZone $timezone the current timezone - * @property DateTimeZone $tz alias of timezone - * @property-read integer $micro - * @property-read integer $dayOfWeek 0 (for Sunday) through 6 (for Saturday) - * @property-read integer $dayOfYear 0 through 365 - * @property-read integer $weekOfMonth 1 through 5 - * @property-read integer $weekOfYear ISO-8601 week number of year, weeks starting on Monday - * @property-read integer $daysInMonth number of days in the given month - * @property-read integer $age does a diffInYears() with default parameters - * @property-read integer $quarter the quarter of this instance, 1 - 4 - * @property-read integer $offset the timezone offset in seconds from UTC - * @property-read integer $offsetHours the timezone offset in hours from UTC - * @property-read boolean $dst daylight savings time indicator, true if DST, false otherwise - * @property-read boolean $local checks if the timezone is local, true if local, false otherwise - * @property-read boolean $utc checks if the timezone is UTC, true if UTC, false otherwise - * @property-read string $timezoneName - * @property-read string $tzName + * @property \DateTimeZone $timezone the current timezone + * @property \DateTimeZone $tz alias of timezone + * @property-read int $micro + * @property-read int $dayOfWeek 0 (for Sunday) through 6 (for Saturday) + * @property-read int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday) + * @property-read int $dayOfYear 0 through 365 + * @property-read int $weekOfMonth 1 through 5 + * @property-read int $weekNumberInMonth 1 through 5 + * @property-read int $weekOfYear ISO-8601 week number of year, weeks starting on Monday + * @property-read int $daysInMonth number of days in the given month + * @property-read int $age does a diffInYears() with default parameters + * @property-read int $quarter the quarter of this instance, 1 - 4 + * @property-read int $offset the timezone offset in seconds from UTC + * @property-read int $offsetHours the timezone offset in hours from UTC + * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise + * @property-read bool $local checks if the timezone is local, true if local, false otherwise + * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise + * @property-read string $timezoneName + * @property-read string $tzName + * @property-read string $englishDayOfWeek the day of week in English + * @property-read string $shortEnglishDayOfWeek the abbreviated day of week in English + * @property-read string $englishMonth the day of week in English + * @property-read string $shortEnglishMonth the abbreviated day of week in English + * @property-read string $localeDayOfWeek the day of week in current locale LC_TIME + * @property-read string $shortLocaleDayOfWeek the abbreviated day of week in current locale LC_TIME + * @property-read string $localeMonth the month in current locale LC_TIME + * @property-read string $shortLocaleMonth the abbreviated month in current locale LC_TIME */ -class Carbon extends DateTime +class Carbon extends DateTime implements JsonSerializable { + const NO_ZERO_DIFF = 01; + const JUST_NOW = 02; + const ONE_DAY_WORDS = 04; + const TWO_DAY_WORDS = 010; + + // Substitutes for Carbon 2 modes + const DIFF_RELATIVE_TO_NOW = 'relative-to-now'; + const DIFF_RELATIVE_TO_OTHER = 'relative-to-other'; + /** - * The day constants + * The day constants. */ const SUNDAY = 0; const MONDAY = 1; @@ -78,34 +99,28 @@ class Carbon extends DateTime ); /** - * Terms used to detect if a time passed is a relative date for testing purposes - * - * @var array - */ - protected static $relativeKeywords = array( - 'this', - 'next', - 'last', - 'tomorrow', - 'yesterday', - '+', - '-', - 'first', - 'last', - 'ago', - ); - - /** - * Number of X in Y + * Number of X in Y. */ + const YEARS_PER_MILLENNIUM = 1000; const YEARS_PER_CENTURY = 100; const YEARS_PER_DECADE = 10; const MONTHS_PER_YEAR = 12; + const MONTHS_PER_QUARTER = 3; const WEEKS_PER_YEAR = 52; + const WEEKS_PER_MONTH = 4; const DAYS_PER_WEEK = 7; const HOURS_PER_DAY = 24; const MINUTES_PER_HOUR = 60; const SECONDS_PER_MINUTE = 60; + const MICROSECONDS_PER_MILLISECOND = 1000; + const MICROSECONDS_PER_SECOND = 1000000; + + /** + * RFC7231 DateTime format. + * + * @var string + */ + const RFC7231_FORMAT = 'D, d M Y H:i:s \G\M\T'; /** * Default format to use for __toString method when type juggling occurs. @@ -114,6 +129,20 @@ class Carbon extends DateTime */ const DEFAULT_TO_STRING_FORMAT = 'Y-m-d H:i:s'; + /** + * Format for converting mocked time, includes microseconds. + * + * @var string + */ + const MOCK_DATETIME_FORMAT = 'Y-m-d H:i:s.u'; + + /** + * Customizable PHP_INT_SIZE override. + * + * @var int + */ + public static $PHPIntSize = PHP_INT_SIZE; + /** * Format to use for __toString method when type juggling occurs. * @@ -122,48 +151,308 @@ class Carbon extends DateTime protected static $toStringFormat = self::DEFAULT_TO_STRING_FORMAT; /** - * First day of week + * First day of week. * * @var int */ protected static $weekStartsAt = self::MONDAY; /** - * Last day of week + * Last day of week. * * @var int */ protected static $weekEndsAt = self::SUNDAY; /** - * Days of weekend + * Days of weekend. + * + * @var array + */ + protected static $weekendDays = array( + self::SATURDAY, + self::SUNDAY, + ); + + /** + * Midday/noon hour. + * + * @var int + */ + protected static $midDayAt = 12; + + /** + * Format regex patterns. * * @var array */ - protected static $weekendDays = array(self::SATURDAY, self::SUNDAY); + protected static $regexFormats = array( + 'd' => '(3[01]|[12][0-9]|0[1-9])', + 'D' => '([a-zA-Z]{3})', + 'j' => '([123][0-9]|[1-9])', + 'l' => '([a-zA-Z]{2,})', + 'N' => '([1-7])', + 'S' => '([a-zA-Z]{2})', + 'w' => '([0-6])', + 'z' => '(36[0-5]|3[0-5][0-9]|[12][0-9]{2}|[1-9]?[0-9])', + 'W' => '(5[012]|[1-4][0-9]|[1-9])', + 'F' => '([a-zA-Z]{2,})', + 'm' => '(1[012]|0[1-9])', + 'M' => '([a-zA-Z]{3})', + 'n' => '(1[012]|[1-9])', + 't' => '(2[89]|3[01])', + 'L' => '(0|1)', + 'o' => '([1-9][0-9]{0,4})', + 'Y' => '([1-9]?[0-9]{4})', + 'y' => '([0-9]{2})', + 'a' => '(am|pm)', + 'A' => '(AM|PM)', + 'B' => '([0-9]{3})', + 'g' => '(1[012]|[1-9])', + 'G' => '(2[0-3]|1?[0-9])', + 'h' => '(1[012]|0[1-9])', + 'H' => '(2[0-3]|[01][0-9])', + 'i' => '([0-5][0-9])', + 's' => '([0-5][0-9])', + 'u' => '([0-9]{1,6})', + 'v' => '([0-9]{1,3})', + 'e' => '([a-zA-Z]{1,5})|([a-zA-Z]*\/[a-zA-Z]*)', + 'I' => '(0|1)', + 'O' => '([\+\-](1[012]|0[0-9])[0134][05])', + 'P' => '([\+\-](1[012]|0[0-9]):[0134][05])', + 'T' => '([a-zA-Z]{1,5})', + 'Z' => '(-?[1-5]?[0-9]{1,4})', + 'U' => '([0-9]*)', + + // The formats below are combinations of the above formats. + 'c' => '(([1-9]?[0-9]{4})\-(1[012]|0[1-9])\-(3[01]|[12][0-9]|0[1-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])[\+\-](1[012]|0[0-9]):([0134][05]))', // Y-m-dTH:i:sP + 'r' => '(([a-zA-Z]{3}), ([123][0-9]|[1-9]) ([a-zA-Z]{3}) ([1-9]?[0-9]{4}) (2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9]) [\+\-](1[012]|0[0-9])([0134][05]))', // D, j M Y H:i:s O + ); /** - * A test Carbon instance to be returned when now instances are created + * A test Carbon instance to be returned when now instances are created. * - * @var Carbon + * @var \Carbon\Carbon */ protected static $testNow; /** - * A translator to ... er ... translate stuff + * A translator to ... er ... translate stuff. * - * @var TranslatorInterface + * @var \Symfony\Component\Translation\TranslatorInterface */ protected static $translator; /** - * Creates a DateTimeZone from a string or a DateTimeZone + * The errors that can occur. + * + * @var array + */ + protected static $lastErrors; + + /** + * The custom Carbon JSON serializer. * - * @param DateTimeZone|string|null $object + * @var callable|null + */ + protected static $serializer; + + /** + * The registered string macros. * - * @throws InvalidArgumentException + * @var array + */ + protected static $localMacros = array(); + + /** + * Will UTF8 encoding be used to print localized date/time ? + * + * @var bool + */ + protected static $utf8 = false; + + /** + * Add microseconds to now on PHP < 7.1 and 7.1.3. true by default. + * + * @var bool + */ + protected static $microsecondsFallback = true; + + /** + * Indicates if months should be calculated with overflow. + * + * @var bool + */ + protected static $monthsOverflow = true; + + /** + * Indicates if years should be calculated with overflow. + * + * @var bool + */ + protected static $yearsOverflow = true; + + /** + * Indicates if years are compared with month by default so isSameMonth and isSameQuarter have $ofSameYear set + * to true by default. + * + * @var bool + */ + protected static $compareYearWithMonth = false; + + /** + * Options for diffForHumans(). + * + * @var int + */ + protected static $humanDiffOptions = self::NO_ZERO_DIFF; + + /** + * @param int $humanDiffOptions + */ + public static function setHumanDiffOptions($humanDiffOptions) + { + static::$humanDiffOptions = $humanDiffOptions; + } + + /** + * @param int $humanDiffOption + */ + public static function enableHumanDiffOption($humanDiffOption) + { + static::$humanDiffOptions = static::getHumanDiffOptions() | $humanDiffOption; + } + + /** + * @param int $humanDiffOption + */ + public static function disableHumanDiffOption($humanDiffOption) + { + static::$humanDiffOptions = static::getHumanDiffOptions() & ~$humanDiffOption; + } + + /** + * @return int + */ + public static function getHumanDiffOptions() + { + return static::$humanDiffOptions; + } + + /** + * Add microseconds to now on PHP < 7.1 and 7.1.3 if set to true, + * let microseconds to 0 on those PHP versions if false. + * + * @param bool $microsecondsFallback + */ + public static function useMicrosecondsFallback($microsecondsFallback = true) + { + static::$microsecondsFallback = $microsecondsFallback; + } + + /** + * Return true if microseconds fallback on PHP < 7.1 and 7.1.3 is + * enabled. false if disabled. + * + * @return bool + */ + public static function isMicrosecondsFallbackEnabled() + { + return static::$microsecondsFallback; + } + + /** + * Indicates if months should be calculated with overflow. + * + * @param bool $monthsOverflow + * + * @return void + */ + public static function useMonthsOverflow($monthsOverflow = true) + { + static::$monthsOverflow = $monthsOverflow; + } + + /** + * Reset the month overflow behavior. + * + * @return void + */ + public static function resetMonthsOverflow() + { + static::$monthsOverflow = true; + } + + /** + * Get the month overflow behavior. + * + * @return bool + */ + public static function shouldOverflowMonths() + { + return static::$monthsOverflow; + } + + /** + * Indicates if years should be calculated with overflow. + * + * @param bool $yearsOverflow + * + * @return void + */ + public static function useYearsOverflow($yearsOverflow = true) + { + static::$yearsOverflow = $yearsOverflow; + } + + /** + * Reset the month overflow behavior. + * + * @return void + */ + public static function resetYearsOverflow() + { + static::$yearsOverflow = true; + } + + /** + * Get the month overflow behavior. + * + * @return bool + */ + public static function shouldOverflowYears() + { + return static::$yearsOverflow; + } + + /** + * Get the month comparison default behavior. + * + * @return bool + */ + public static function compareYearWithMonth($compareYearWithMonth = true) + { + static::$compareYearWithMonth = $compareYearWithMonth; + } + + /** + * Get the month comparison default behavior. + * + * @return bool + */ + public static function shouldCompareYearWithMonth() + { + return static::$compareYearWithMonth; + } + + /** + * Creates a DateTimeZone from a string, DateTimeZone or integer offset. + * + * @param \DateTimeZone|string|int|null $object * - * @return DateTimeZone + * @throws \InvalidArgumentException + * + * @return \DateTimeZone */ protected static function safeCreateDateTimeZone($object) { @@ -176,13 +465,35 @@ protected static function safeCreateDateTimeZone($object) return $object; } - $tz = @timezone_open((string) $object); + if (is_numeric($object)) { + $tzName = timezone_name_from_abbr(null, $object * 3600, true); + + if ($tzName === false) { + throw new InvalidArgumentException('Unknown or bad timezone ('.$object.')'); + } + + $object = $tzName; + } + + $tz = @timezone_open($object = (string) $object); + + if ($tz !== false) { + return $tz; + } - if ($tz === false) { - throw new InvalidArgumentException('Unknown or bad timezone ('.$object.')'); + // Work-around for a bug fixed in PHP 5.5.10 https://bugs.php.net/bug.php?id=45528 + // See: https://stackoverflow.com/q/14068594/2646927 + // @codeCoverageIgnoreStart + if (strpos($object, ':') !== false) { + try { + return static::createFromFormat('O', $object)->getTimezone(); + } catch (InvalidArgumentException $e) { + // + } } + // @codeCoverageIgnoreEnd - return $tz; + throw new InvalidArgumentException('Unknown or bad timezone ('.$object.')'); } /////////////////////////////////////////////////////////////////// @@ -195,52 +506,86 @@ protected static function safeCreateDateTimeZone($object) * Please see the testing aids section (specifically static::setTestNow()) * for more on the possibility of this constructor returning a test instance. * - * @param string|null $time - * @param DateTimeZone|string|null $tz + * @param string|null $time + * @param \DateTimeZone|string|null $tz */ public function __construct($time = null, $tz = null) { // If the class has a test now set and we are trying to create a now() // instance then override as required - if (static::hasTestNow() && (empty($time) || $time === 'now' || static::hasRelativeKeywords($time))) { + $isNow = empty($time) || $time === 'now'; + if (static::hasTestNow() && ($isNow || static::hasRelativeKeywords($time))) { $testInstance = clone static::getTestNow(); - if (static::hasRelativeKeywords($time)) { - $testInstance->modify($time); - } //shift the time according to the given time zone - if ($tz !== null && $tz !== static::getTestNow()->tz) { + if ($tz !== null && $tz !== static::getTestNow()->getTimezone()) { $testInstance->setTimezone($tz); } else { - $tz = $testInstance->tz; + $tz = $testInstance->getTimezone(); } - $time = $testInstance->toDateTimeString(); + if (static::hasRelativeKeywords($time)) { + $testInstance->modify($time); + } + + $time = $testInstance->format(static::MOCK_DATETIME_FORMAT); } - parent::__construct($time, static::safeCreateDateTimeZone($tz)); + $timezone = static::safeCreateDateTimeZone($tz); + // @codeCoverageIgnoreStart + if ($isNow && !isset($testInstance) && static::isMicrosecondsFallbackEnabled() && ( + version_compare(PHP_VERSION, '7.1.0-dev', '<') + || + version_compare(PHP_VERSION, '7.1.3-dev', '>=') && version_compare(PHP_VERSION, '7.1.4-dev', '<') + ) + ) { + // Get microseconds from microtime() if "now" asked and PHP < 7.1 and PHP 7.1.3 if fallback enabled. + list($microTime, $timeStamp) = explode(' ', microtime()); + $dateTime = new DateTime('now', $timezone); + $dateTime->setTimestamp($timeStamp); // Use the timestamp returned by microtime as now can happen in the next second + $time = $dateTime->format(static::DEFAULT_TO_STRING_FORMAT).substr($microTime, 1, 7); + } + // @codeCoverageIgnoreEnd + + // Work-around for PHP bug https://bugs.php.net/bug.php?id=67127 + if (strpos((string) .1, '.') === false) { + $locale = setlocale(LC_NUMERIC, '0'); + setlocale(LC_NUMERIC, 'C'); + } + parent::__construct($time, $timezone); + if (isset($locale)) { + setlocale(LC_NUMERIC, $locale); + } + static::setLastErrors(parent::getLastErrors()); } /** - * Create a Carbon instance from a DateTime one + * Create a Carbon instance from a DateTime one. * - * @param DateTime $dt + * @param \DateTime|\DateTimeInterface $date * * @return static */ - public static function instance(DateTime $dt) + public static function instance($date) { - return new static($dt->format('Y-m-d H:i:s.u'), $dt->getTimeZone()); + if ($date instanceof static) { + return clone $date; + } + + static::expectDateTime($date); + + return new static($date->format('Y-m-d H:i:s.u'), $date->getTimezone()); } /** - * Create a carbon instance from a string. This is an alias for the - * constructor that allows better fluent syntax as it allows you to do - * Carbon::parse('Monday next week')->fn() rather than - * (new Carbon('Monday next week'))->fn() + * Create a carbon instance from a string. + * + * This is an alias for the constructor that allows better fluent syntax + * as it allows you to do Carbon::parse('Monday next week')->fn() rather + * than (new Carbon('Monday next week'))->fn(). * - * @param string|null $time - * @param DateTimeZone|string|null $tz + * @param string|null $time + * @param \DateTimeZone|string|null $tz * * @return static */ @@ -250,9 +595,9 @@ public static function parse($time = null, $tz = null) } /** - * Get a Carbon instance for the current date and time + * Get a Carbon instance for the current date and time. * - * @param DateTimeZone|string|null $tz + * @param \DateTimeZone|string|null $tz * * @return static */ @@ -262,51 +607,51 @@ public static function now($tz = null) } /** - * Create a Carbon instance for today + * Create a Carbon instance for today. * - * @param DateTimeZone|string|null $tz + * @param \DateTimeZone|string|null $tz * * @return static */ public static function today($tz = null) { - return static::now($tz)->startOfDay(); + return static::parse('today', $tz); } /** - * Create a Carbon instance for tomorrow + * Create a Carbon instance for tomorrow. * - * @param DateTimeZone|string|null $tz + * @param \DateTimeZone|string|null $tz * * @return static */ public static function tomorrow($tz = null) { - return static::today($tz)->addDay(); + return static::parse('tomorrow', $tz); } /** - * Create a Carbon instance for yesterday + * Create a Carbon instance for yesterday. * - * @param DateTimeZone|string|null $tz + * @param \DateTimeZone|string|null $tz * * @return static */ public static function yesterday($tz = null) { - return static::today($tz)->subDay(); + return static::parse('yesterday', $tz); } /** * Create a Carbon instance for the greatest supported date. * - * @return Carbon + * @return static */ public static function maxValue() { - if (PHP_INT_SIZE === 4) { - // 32 bit (and additionally Windows 64 bit) - return static::createFromTimestamp(PHP_INT_MAX); + if (self::$PHPIntSize === 4) { + // 32 bit + return static::createFromTimestamp(PHP_INT_MAX); // @codeCoverageIgnore } // 64 bit @@ -316,13 +661,13 @@ public static function maxValue() /** * Create a Carbon instance for the lowest supported date. * - * @return Carbon + * @return static */ public static function minValue() { - if (PHP_INT_SIZE === 4) { - // 32 bit (and additionally Windows 64 bit) - return static::createFromTimestamp(~PHP_INT_MAX); + if (self::$PHPIntSize === 4) { + // 32 bit + return static::createFromTimestamp(~PHP_INT_MAX); // @codeCoverageIgnore } // 64 bit @@ -332,175 +677,457 @@ public static function minValue() /** * Create a new Carbon instance from a specific date and time. * - * If any of $year, $month or $day are set to null their now() values - * will be used. + * If any of $year, $month or $day are set to null their now() values will + * be used. + * + * If $hour is null it will be set to its now() value and the default + * values for $minute and $second will be their now() values. * - * If $hour is null it will be set to its now() value and the default values - * for $minute and $second will be their now() values. * If $hour is not null then the default values for $minute and $second * will be 0. * - * @param int|null $year - * @param int|null $month - * @param int|null $day - * @param int|null $hour - * @param int|null $minute - * @param int|null $second - * @param DateTimeZone|string|null $tz + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param \DateTimeZone|string|null $tz + * + * @throws \InvalidArgumentException * * @return static */ public static function create($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null) { - $year = $year === null ? date('Y') : $year; - $month = $month === null ? date('n') : $month; - $day = $day === null ? date('j') : $day; + $now = static::hasTestNow() ? static::getTestNow() : static::now($tz); + + $defaults = array_combine(array( + 'year', + 'month', + 'day', + 'hour', + 'minute', + 'second', + ), explode('-', $now->format('Y-n-j-G-i-s'))); + + $year = $year === null ? $defaults['year'] : $year; + $month = $month === null ? $defaults['month'] : $month; + $day = $day === null ? $defaults['day'] : $day; if ($hour === null) { - $hour = date('G'); - $minute = $minute === null ? date('i') : $minute; - $second = $second === null ? date('s') : $second; + $hour = $defaults['hour']; + $minute = $minute === null ? $defaults['minute'] : $minute; + $second = $second === null ? $defaults['second'] : $second; } else { $minute = $minute === null ? 0 : $minute; $second = $second === null ? 0 : $second; } - return static::createFromFormat('Y-n-j G:i:s', sprintf('%s-%s-%s %s:%02s:%02s', $year, $month, $day, $hour, $minute, $second), $tz); + $fixYear = null; + + if ($year < 0) { + $fixYear = $year; + $year = 0; + } elseif ($year > 9999) { + $fixYear = $year - 9999; + $year = 9999; + } + + $instance = static::createFromFormat('!Y-n-j G:i:s', sprintf('%s-%s-%s %s:%02s:%02s', $year, $month, $day, $hour, $minute, $second), $tz); + + if ($fixYear !== null) { + $instance->addYears($fixYear); + } + + return $instance; } /** - * Create a Carbon instance from just a date. The time portion is set to now. + * Create a new safe Carbon instance from a specific date and time. * - * @param int|null $year - * @param int|null $month - * @param int|null $day - * @param DateTimeZone|string|null $tz + * If any of $year, $month or $day are set to null their now() values will + * be used. * - * @return static - */ - public static function createFromDate($year = null, $month = null, $day = null, $tz = null) - { - return static::create($year, $month, $day, null, null, null, $tz); - } - - /** - * Create a Carbon instance from just a time. The date portion is set to today. + * If $hour is null it will be set to its now() value and the default + * values for $minute and $second will be their now() values. + * + * If $hour is not null then the default values for $minute and $second + * will be 0. + * + * If one of the set values is not valid, an \InvalidArgumentException + * will be thrown. * - * @param int|null $hour - * @param int|null $minute - * @param int|null $second - * @param DateTimeZone|string|null $tz + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param \DateTimeZone|string|null $tz + * + * @throws \Carbon\Exceptions\InvalidDateException|\InvalidArgumentException * * @return static */ - public static function createFromTime($hour = null, $minute = null, $second = null, $tz = null) + public static function createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null) { - return static::create(null, null, null, $hour, $minute, $second, $tz); + $fields = array( + 'year' => array(0, 9999), + 'month' => array(0, 12), + 'day' => array(0, 31), + 'hour' => array(0, 24), + 'minute' => array(0, 59), + 'second' => array(0, 59), + ); + + foreach ($fields as $field => $range) { + if ($$field !== null && (!is_int($$field) || $$field < $range[0] || $$field > $range[1])) { + throw new InvalidDateException($field, $$field); + } + } + + $instance = static::create($year, $month, $day, $hour, $minute, $second, $tz); + + foreach (array_reverse($fields) as $field => $range) { + if ($$field !== null && (!is_int($$field) || $$field !== $instance->$field)) { + throw new InvalidDateException($field, $$field); + } + } + + return $instance; } /** - * Create a Carbon instance from a specific format + * Create a Carbon instance from just a date. The time portion is set to now. * - * @param string $format - * @param string $time - * @param DateTimeZone|string|null $tz + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param \DateTimeZone|string|null $tz * - * @throws InvalidArgumentException + * @throws \InvalidArgumentException * * @return static */ - public static function createFromFormat($format, $time, $tz = null) + public static function createFromDate($year = null, $month = null, $day = null, $tz = null) { - if ($tz !== null) { - $dt = parent::createFromFormat($format, $time, static::safeCreateDateTimeZone($tz)); - } else { - $dt = parent::createFromFormat($format, $time); - } - - if ($dt instanceof DateTime) { - return static::instance($dt); - } - - $errors = static::getLastErrors(); - throw new InvalidArgumentException(implode(PHP_EOL, $errors['errors'])); + return static::create($year, $month, $day, null, null, null, $tz); } /** - * Create a Carbon instance from a timestamp + * Create a Carbon instance from just a date. The time portion is set to midnight. * - * @param int $timestamp - * @param DateTimeZone|string|null $tz + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param \DateTimeZone|string|null $tz * * @return static */ - public static function createFromTimestamp($timestamp, $tz = null) + public static function createMidnightDate($year = null, $month = null, $day = null, $tz = null) { - return static::now($tz)->setTimestamp($timestamp); + return static::create($year, $month, $day, 0, 0, 0, $tz); } /** - * Create a Carbon instance from an UTC timestamp + * Create a Carbon instance from just a time. The date portion is set to today. * - * @param int $timestamp + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param \DateTimeZone|string|null $tz + * + * @throws \InvalidArgumentException * * @return static */ - public static function createFromTimestampUTC($timestamp) + public static function createFromTime($hour = null, $minute = null, $second = null, $tz = null) { - return new static('@'.$timestamp); + return static::create(null, null, null, $hour, $minute, $second, $tz); } /** - * Get a copy of the instance + * Create a Carbon instance from a time string. The date portion is set to today. + * + * @param string $time + * @param \DateTimeZone|string|null $tz + * + * @throws \InvalidArgumentException * * @return static */ - public function copy() + public static function createFromTimeString($time, $tz = null) { - return static::instance($this); + return static::today($tz)->setTimeFromTimeString($time); } - /////////////////////////////////////////////////////////////////// - ///////////////////////// GETTERS AND SETTERS ///////////////////// - /////////////////////////////////////////////////////////////////// + private static function createFromFormatAndTimezone($format, $time, $tz) + { + return $tz !== null + ? parent::createFromFormat($format, $time, static::safeCreateDateTimeZone($tz)) + : parent::createFromFormat($format, $time); + } /** - * Get a part of the Carbon object + * Create a Carbon instance from a specific format. * - * @param string $name + * @param string $format Datetime format + * @param string $time + * @param \DateTimeZone|string|null $tz * * @throws InvalidArgumentException * - * @return string|int|DateTimeZone + * @return static */ - public function __get($name) + public static function createFromFormat($format, $time, $tz = null) { + // First attempt to create an instance, so that error messages are based on the unmodified format. + $date = self::createFromFormatAndTimezone($format, $time, $tz); + $lastErrors = parent::getLastErrors(); + + if (($mock = static::getTestNow()) && ($date instanceof DateTime || $date instanceof DateTimeInterface)) { + // Set timezone from mock if custom timezone was neither given directly nor as a part of format. + // First let's skip the part that will be ignored by the parser. + $nonEscaped = '(?getTimezone(); + } + + // Prepend mock datetime only if the format does not contain non escaped unix epoch reset flag. + if (!preg_match("/{$nonEscaped}[!|]/", $format)) { + $format = static::MOCK_DATETIME_FORMAT.' '.$format; + $time = $mock->format(static::MOCK_DATETIME_FORMAT).' '.$time; + } + + // Regenerate date from the modified format to base result on the mocked instance instead of now. + $date = self::createFromFormatAndTimezone($format, $time, $tz); + } + + if ($date instanceof DateTime || $date instanceof DateTimeInterface) { + $instance = static::instance($date); + $instance::setLastErrors($lastErrors); + + return $instance; + } + + throw new InvalidArgumentException(implode(PHP_EOL, $lastErrors['errors'])); + } + + /** + * Set last errors. + * + * @param array $lastErrors + * + * @return void + */ + private static function setLastErrors(array $lastErrors) + { + static::$lastErrors = $lastErrors; + } + + /** + * {@inheritdoc} + */ + public static function getLastErrors() + { + return static::$lastErrors; + } + + /** + * Create a Carbon instance from a timestamp. + * + * @param int $timestamp + * @param \DateTimeZone|string|null $tz + * + * @return static + */ + public static function createFromTimestamp($timestamp, $tz = null) + { + return static::today($tz)->setTimestamp($timestamp); + } + + /** + * Create a Carbon instance from a timestamp in milliseconds. + * + * @param int $timestamp + * @param \DateTimeZone|string|null $tz + * + * @return static + */ + public static function createFromTimestampMs($timestamp, $tz = null) + { + return static::createFromFormat('U.u', sprintf('%F', $timestamp / 1000)) + ->setTimezone($tz); + } + + /** + * Create a Carbon instance from an UTC timestamp. + * + * @param int $timestamp + * + * @return static + */ + public static function createFromTimestampUTC($timestamp) + { + return new static('@'.$timestamp); + } + + /** + * Make a Carbon instance from given variable if possible. + * + * Always return a new instance. Parse only strings and only these likely to be dates (skip intervals + * and recurrences). Throw an exception for invalid format, but otherwise return null. + * + * @param mixed $var + * + * @return static|null + */ + public static function make($var) + { + if ($var instanceof DateTime || $var instanceof DateTimeInterface) { + return static::instance($var); + } + + if (is_string($var)) { + $var = trim($var); + $first = substr($var, 0, 1); + + if (is_string($var) && $first !== 'P' && $first !== 'R' && preg_match('/[a-z0-9]/i', $var)) { + return static::parse($var); + } + } + } + + /** + * Get a copy of the instance. + * + * @return static + */ + public function copy() + { + return clone $this; + } + + /** + * Returns a present instance in the same timezone. + * + * @return static + */ + public function nowWithSameTz() + { + return static::now($this->getTimezone()); + } + + /** + * Throws an exception if the given object is not a DateTime and does not implement DateTimeInterface + * and not in $other. + * + * @param mixed $date + * @param string|array $other + * + * @throws \InvalidArgumentException + */ + protected static function expectDateTime($date, $other = array()) + { + $message = 'Expected '; + foreach ((array) $other as $expect) { + $message .= "{$expect}, "; + } + + if (!$date instanceof DateTime && !$date instanceof DateTimeInterface) { + throw new InvalidArgumentException( + $message.'DateTime or DateTimeInterface, '. + (is_object($date) ? get_class($date) : gettype($date)).' given' + ); + } + } + + /** + * Return the Carbon instance passed through, a now instance in the same timezone + * if null given or parse the input if string given. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * + * @return static + */ + protected function resolveCarbon($date = null) + { + if (!$date) { + return $this->nowWithSameTz(); + } + + if (is_string($date)) { + return static::parse($date, $this->getTimezone()); + } + + static::expectDateTime($date, array('null', 'string')); + + return $date instanceof self ? $date : static::instance($date); + } + + /////////////////////////////////////////////////////////////////// + ///////////////////////// GETTERS AND SETTERS ///////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Get a part of the Carbon object + * + * @param string $name + * + * @throws \InvalidArgumentException + * + * @return string|int|bool|\DateTimeZone + */ + public function __get($name) + { + static $formats = array( + 'year' => 'Y', + 'yearIso' => 'o', + 'month' => 'n', + 'day' => 'j', + 'hour' => 'G', + 'minute' => 'i', + 'second' => 's', + 'micro' => 'u', + 'dayOfWeek' => 'w', + 'dayOfWeekIso' => 'N', + 'dayOfYear' => 'z', + 'weekOfYear' => 'W', + 'daysInMonth' => 't', + 'timestamp' => 'U', + 'englishDayOfWeek' => 'l', + 'shortEnglishDayOfWeek' => 'D', + 'englishMonth' => 'F', + 'shortEnglishMonth' => 'M', + 'localeDayOfWeek' => '%A', + 'shortLocaleDayOfWeek' => '%a', + 'localeMonth' => '%B', + 'shortLocaleMonth' => '%b', + ); + switch (true) { - case array_key_exists($name, $formats = array( - 'year' => 'Y', - 'yearIso' => 'o', - 'month' => 'n', - 'day' => 'j', - 'hour' => 'G', - 'minute' => 'i', - 'second' => 's', - 'micro' => 'u', - 'dayOfWeek' => 'w', - 'dayOfYear' => 'z', - 'weekOfYear' => 'W', - 'daysInMonth' => 't', - 'timestamp' => 'U', - )): - return (int) $this->format($formats[$name]); + case isset($formats[$name]): + $format = $formats[$name]; + $method = substr($format, 0, 1) === '%' ? 'formatLocalized' : 'format'; + $value = $this->$method($format); + + return is_numeric($value) ? (int) $value : $value; case $name === 'weekOfMonth': return (int) ceil($this->day / static::DAYS_PER_WEEK); + case $name === 'weekNumberInMonth': + return (int) ceil(($this->day + $this->copy()->startOfMonth()->dayOfWeek - 1) / static::DAYS_PER_WEEK); + case $name === 'age': - return (int) $this->diffInYears(); + return $this->diffInYears(); case $name === 'quarter': - return (int) ceil($this->month / 3); + return (int) ceil($this->month / static::MONTHS_PER_QUARTER); case $name === 'offset': return $this->getOffset(); @@ -512,10 +1139,10 @@ public function __get($name) return $this->format('I') === '1'; case $name === 'local': - return $this->offset === $this->copy()->setTimezone(date_default_timezone_get())->offset; + return $this->getOffset() === $this->copy()->setTimezone(date_default_timezone_get())->getOffset(); case $name === 'utc': - return $this->offset === 0; + return $this->getOffset() === 0; case $name === 'timezone' || $name === 'tz': return $this->getTimezone(); @@ -549,36 +1176,25 @@ public function __isset($name) /** * Set a part of the Carbon object * - * @param string $name - * @param string|int|DateTimeZone $value + * @param string $name + * @param string|int|\DateTimeZone $value * - * @throws InvalidArgumentException + * @throws \InvalidArgumentException + * + * @return void */ public function __set($name, $value) { switch ($name) { case 'year': - $this->setDate($value, $this->month, $this->day); - break; - case 'month': - $this->setDate($this->year, $value, $this->day); - break; - case 'day': - $this->setDate($this->year, $this->month, $value); - break; - case 'hour': - $this->setTime($value, $this->minute, $this->second); - break; - case 'minute': - $this->setTime($this->hour, $value, $this->second); - break; - case 'second': - $this->setTime($this->hour, $this->minute, $value); + list($year, $month, $day, $hour, $minute, $second) = explode('-', $this->format('Y-n-j-G-i-s')); + $$name = $value; + $this->setDateTime($year, $month, $day, $hour, $minute, $second); break; case 'timestamp': @@ -679,6 +1295,26 @@ public function second($value) return $this; } + /** + * Sets the current date of the DateTime object to a different date. + * Calls modify as a workaround for a php bug + * + * @param int $year + * @param int $month + * @param int $day + * + * @return static + * + * @see https://github.com/briannesbitt/Carbon/issues/539 + * @see https://bugs.php.net/bug.php?id=63863 + */ + public function setDate($year, $month, $day) + { + $this->modify('+0 day'); + + return parent::setDate($year, $month, $day); + } + /** * Set the date and time all together * @@ -705,13 +1341,11 @@ public function setDateTime($year, $month, $day, $hour, $minute, $second = 0) */ public function setTimeFromTimeString($time) { - $time = explode(":", $time); - - $hour = $time[0]; - $minute = isset($time[1]) ? $time[1] : 0; - $second = isset($time[2]) ? $time[2] : 0; + if (strpos($time, ':') === false) { + $time .= ':0'; + } - return $this->setTime($hour, $minute, $second); + return $this->modify($time); } /** @@ -723,15 +1357,13 @@ public function setTimeFromTimeString($time) */ public function timestamp($value) { - $this->timestamp = $value; - - return $this; + return $this->setTimestamp($value); } /** * Alias for setTimezone() * - * @param DateTimeZone|string $value + * @param \DateTimeZone|string $value * * @return static */ @@ -743,7 +1375,7 @@ public function timezone($value) /** * Alias for setTimezone() * - * @param DateTimeZone|string $value + * @param \DateTimeZone|string $value * * @return static */ @@ -755,17 +1387,62 @@ public function tz($value) /** * Set the instance's timezone from a string or object * - * @param DateTimeZone|string $value + * @param \DateTimeZone|string $value * * @return static */ public function setTimezone($value) { parent::setTimezone(static::safeCreateDateTimeZone($value)); + // https://bugs.php.net/bug.php?id=72338 + // just workaround on this bug + $this->getTimestamp(); + + return $this; + } + + /** + * Set the year, month, and date for this instance to that of the passed instance. + * + * @param \Carbon\Carbon|\DateTimeInterface $date + * + * @return static + */ + public function setDateFrom($date) + { + $date = static::instance($date); + + $this->setDate($date->year, $date->month, $date->day); + + return $this; + } + + /** + * Set the hour, day, and time for this instance to that of the passed instance. + * + * @param \Carbon\Carbon|\DateTimeInterface $date + * + * @return static + */ + public function setTimeFrom($date) + { + $date = static::instance($date); + + $this->setTime($date->hour, $date->minute, $date->second); return $this; } + /** + * Get the days of the week + * + * @return array + */ + public static function getDays() + { + return static::$days; + } + /////////////////////////////////////////////////////////////////// /////////////////////// WEEK SPECIAL DAYS ///////////////////////// /////////////////////////////////////////////////////////////////// @@ -783,10 +1460,18 @@ public static function getWeekStartsAt() /** * Set the first day of week * - * @param int + * @param int $day week start day + * + * @throws InvalidArgumentException + * + * @return void */ public static function setWeekStartsAt($day) { + if ($day > static::SATURDAY || $day < static::SUNDAY) { + throw new InvalidArgumentException('Day of a week should be greater than or equal to 0 and less than or equal to 6.'); + } + static::$weekStartsAt = $day; } @@ -801,12 +1486,20 @@ public static function getWeekEndsAt() } /** - * Set the first day of week + * Set the last day of week + * + * @param int $day + * + * @throws InvalidArgumentException * - * @param int + * @return void */ public static function setWeekEndsAt($day) { + if ($day > static::SATURDAY || $day < static::SUNDAY) { + throw new InvalidArgumentException('Day of a week should be greater than or equal to 0 and less than or equal to 6.'); + } + static::$weekEndsAt = $day; } @@ -823,13 +1516,37 @@ public static function getWeekendDays() /** * Set weekend days * - * @param array + * @param array $days + * + * @return void */ public static function setWeekendDays($days) { static::$weekendDays = $days; } + /** + * get midday/noon hour + * + * @return int + */ + public static function getMidDayAt() + { + return static::$midDayAt; + } + + /** + * Set midday/noon hour + * + * @param int $hour midday hour + * + * @return void + */ + public static function setMidDayAt($hour) + { + static::$midDayAt = $hour; + } + /////////////////////////////////////////////////////////////////// ///////////////////////// TESTING AIDS //////////////////////////// /////////////////////////////////////////////////////////////////// @@ -841,6 +1558,7 @@ public static function setWeekendDays($days) * - A call to the static now() method, ex. Carbon::now() * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') + * - When a string containing the desired time is passed to Carbon::parse(). * * Note the timezone parameter was left out of the examples above and * has no affect as the mock value will be returned regardless of its value. @@ -848,11 +1566,12 @@ public static function setWeekendDays($days) * To clear the test instance call this method using the default * parameter of null. * - * @param Carbon|null $testNow + * @param \Carbon\Carbon|null $testNow real or mock Carbon instance + * @param \Carbon\Carbon|string|null $testNow */ - public static function setTestNow(Carbon $testNow = null) + public static function setTestNow($testNow = null) { - static::$testNow = $testNow; + static::$testNow = is_string($testNow) ? static::parse($testNow) : $testNow; } /** @@ -878,25 +1597,24 @@ public static function hasTestNow() } /** - * Determine if there is a relative keyword in the time string, this is to - * create dates relative to now for test instances. e.g.: next tuesday + * Determine if a time string will produce a relative date. * * @param string $time * - * @return bool true if there is a keyword, otherwise false + * @return bool true if time match a relative date, false if absolute or invalid time string */ public static function hasRelativeKeywords($time) { - // skip common format with a '-' in it - if (preg_match('/[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}/', $time) !== 1) { - foreach (static::$relativeKeywords as $keyword) { - if (stripos($time, $keyword) !== false) { - return true; - } - } + if (strtotime($time) === false) { + return false; } - return false; + $date1 = new DateTime('2000-01-01T00:00:00Z'); + $date1->modify($time); + $date2 = new DateTime('2001-12-25T00:00:00Z'); + $date2->modify($time); + + return $date1 != $date2; } /////////////////////////////////////////////////////////////////// @@ -904,16 +1622,14 @@ public static function hasRelativeKeywords($time) /////////////////////////////////////////////////////////////////// /** - * Intialize the translator instance if necessary. + * Initialize the translator instance if necessary. * - * @return TranslatorInterface + * @return \Symfony\Component\Translation\TranslatorInterface */ protected static function translator() { if (static::$translator === null) { - static::$translator = new Translator('en'); - static::$translator->addLoader('array', new ArrayLoader()); - static::setLocale('en'); + static::$translator = Translator::get(); } return static::$translator; @@ -922,7 +1638,7 @@ protected static function translator() /** * Get the translator instance in use * - * @return TranslatorInterface + * @return \Symfony\Component\Translation\TranslatorInterface */ public static function getTranslator() { @@ -932,7 +1648,9 @@ public static function getTranslator() /** * Set the translator instance to use * - * @param TranslatorInterface $translator + * @param \Symfony\Component\Translation\TranslatorInterface $translator + * + * @return void */ public static function setTranslator(TranslatorInterface $translator) { @@ -950,81 +1668,233 @@ public static function getLocale() } /** - * Set the current translator locale + * Set the current translator locale and indicate if the source locale file exists * - * @param string $locale + * @param string $locale locale ex. en + * + * @return bool */ public static function setLocale($locale) { - static::translator()->setLocale($locale); - - // Ensure the locale has been loaded. - static::translator()->addResource('array', require __DIR__.'/Lang/'.$locale.'.php', $locale); + return static::translator()->setLocale($locale) !== false; } - /////////////////////////////////////////////////////////////////// - /////////////////////// STRING FORMATTING ///////////////////////// - /////////////////////////////////////////////////////////////////// - /** - * Format the instance with the current locale. You can set the current - * locale using setlocale() http://php.net/setlocale. + * Set the current locale to the given, execute the passed function, reset the locale to previous one, + * then return the result of the closure (or null if the closure was void). * - * @param string $format + * @param string $locale locale ex. en * - * @return string + * @return mixed */ - public function formatLocalized($format) + public static function executeWithLocale($locale, $func) { - // Check for Windows to find and replace the %e - // modifier correctly - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $format = preg_replace('#(?trans('y')) !== 'y' && + $y !== $translator->trans('year') + ) || ( + ($y = $translator->trans('d')) !== 'd' && + $y !== $translator->trans('day') + ) || ( + ($y = $translator->trans('h')) !== 'h' && + $y !== $translator->trans('hour') + ); + }); } /** - * Set the default format used when type juggling a Carbon instance to a string + * Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after). + * Support is considered enabled if the 4 sentences are translated in the given locale. * - * @param string $format + * @param string $locale locale ex. en + * + * @return bool */ - public static function setToStringFormat($format) + public static function localeHasDiffSyntax($locale) { - static::$toStringFormat = $format; + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('ago') !== 'ago' && + $translator->trans('from_now') !== 'from_now' && + $translator->trans('before') !== 'before' && + $translator->trans('after') !== 'after'; + }); } /** - * Format the instance as a string using the set format + * Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow). + * Support is considered enabled if the 3 words are translated in the given locale. * - * @return string + * @param string $locale locale ex. en + * + * @return bool */ - public function __toString() + public static function localeHasDiffOneDayWords($locale) { - return $this->format(static::$toStringFormat); + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('diff_now') !== 'diff_now' && + $translator->trans('diff_yesterday') !== 'diff_yesterday' && + $translator->trans('diff_tomorrow') !== 'diff_tomorrow'; + }); } /** - * Format the instance as date + * Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow). + * Support is considered enabled if the 2 words are translated in the given locale. * - * @return string + * @param string $locale locale ex. en + * + * @return bool */ - public function toDateString() + public static function localeHasDiffTwoDayWords($locale) { - return $this->format('Y-m-d'); + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('diff_before_yesterday') !== 'diff_before_yesterday' && + $translator->trans('diff_after_tomorrow') !== 'diff_after_tomorrow'; + }); } /** - * Format the instance as a readable date + * Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X). + * Support is considered enabled if the 4 sentences are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasPeriodSyntax($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('period_recurrences') !== 'period_recurrences' && + $translator->trans('period_interval') !== 'period_interval' && + $translator->trans('period_start_date') !== 'period_start_date' && + $translator->trans('period_end_date') !== 'period_end_date'; + }); + } + + /** + * Returns the list of internally available locales and already loaded custom locales. + * (It will ignore custom translator dynamic loading.) + * + * @return array + */ + public static function getAvailableLocales() + { + $translator = static::translator(); + $locales = array(); + if ($translator instanceof Translator) { + foreach (glob(__DIR__.'/Lang/*.php') as $file) { + $locales[] = substr($file, strrpos($file, '/') + 1, -4); + } + + $locales = array_unique(array_merge($locales, array_keys($translator->getMessages()))); + } + + return $locales; + } + + /////////////////////////////////////////////////////////////////// + /////////////////////// STRING FORMATTING ///////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Set if UTF8 will be used for localized date/time + * + * @param bool $utf8 + */ + public static function setUtf8($utf8) + { + static::$utf8 = $utf8; + } + + /** + * Format the instance with the current locale. You can set the current + * locale using setlocale() http://php.net/setlocale. + * + * @param string $format + * + * @return string + */ + public function formatLocalized($format) + { + // Check for Windows to find and replace the %e modifier correctly. + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $format = preg_replace('#(?toDateTimeString())); + + return static::$utf8 ? utf8_encode($formatted) : $formatted; + } + + /** + * Reset the format used to the default when type juggling a Carbon instance to a string + * + * @return void + */ + public static function resetToStringFormat() + { + static::setToStringFormat(static::DEFAULT_TO_STRING_FORMAT); + } + + /** + * Set the default format used when type juggling a Carbon instance to a string + * + * @param string|Closure $format + * + * @return void + */ + public static function setToStringFormat($format) + { + static::$toStringFormat = $format; + } + + /** + * Format the instance as a string using the set format + * + * @return string + */ + public function __toString() + { + $format = static::$toStringFormat; + + return $this->format($format instanceof Closure ? $format($this) : $format); + } + + /** + * Format the instance as date + * + * @return string + */ + public function toDateString() + { + return $this->format('Y-m-d'); + } + + /** + * Format the instance as a readable date * * @return string */ @@ -1053,6 +1923,21 @@ public function toDateTimeString() return $this->format('Y-m-d H:i:s'); } + /** + * Format the instance as date and time T-separated with no timezone + * + * @example + * ``` + * echo Carbon::now()->toDateTimeLocalString(); + * ``` + * + * @return string + */ + public function toDateTimeLocalString() + { + return $this->format('Y-m-d\TH:i:s'); + } + /** * Format the instance with day, date and time * @@ -1090,7 +1975,7 @@ public function toCookieString() */ public function toIso8601String() { - return $this->format(static::ISO8601); + return $this->toAtomString(); } /** @@ -1103,6 +1988,16 @@ public function toRfc822String() return $this->format(static::RFC822); } + /** + * Convert the instance to UTC and return as Zulu ISO8601 + * + * @return string + */ + public function toIso8601ZuluString() + { + return $this->copy()->setTimezone('UTC')->format('Y-m-d\TH:i:s\Z'); + } + /** * Format the instance as RFC850 * @@ -1173,373 +2068,1259 @@ public function toW3cString() return $this->format(static::W3C); } - /////////////////////////////////////////////////////////////////// - ////////////////////////// COMPARISONS //////////////////////////// - /////////////////////////////////////////////////////////////////// - /** - * Determines if the instance is equal to another + * Format the instance as RFC7231 * - * @param Carbon $dt - * - * @return bool + * @return string */ - public function eq(Carbon $dt) + public function toRfc7231String() { - return $this == $dt; + return $this->copy() + ->setTimezone('GMT') + ->format(static::RFC7231_FORMAT); } /** - * Determines if the instance is not equal to another + * Get default array representation * - * @param Carbon $dt - * - * @return bool + * @return array */ - public function ne(Carbon $dt) + public function toArray() { - return !$this->eq($dt); + return array( + 'year' => $this->year, + 'month' => $this->month, + 'day' => $this->day, + 'dayOfWeek' => $this->dayOfWeek, + 'dayOfYear' => $this->dayOfYear, + 'hour' => $this->hour, + 'minute' => $this->minute, + 'second' => $this->second, + 'micro' => $this->micro, + 'timestamp' => $this->timestamp, + 'formatted' => $this->format(self::DEFAULT_TO_STRING_FORMAT), + 'timezone' => $this->timezone, + ); } /** - * Determines if the instance is greater (after) than another + * Get default object representation. * - * @param Carbon $dt + * @example + * ``` + * var_dump(Carbon::now()->toObject()); + * ``` * - * @return bool + * @return object */ - public function gt(Carbon $dt) + public function toObject() { - return $this > $dt; + return (object) $this->toArray(); } /** - * Determines if the instance is greater (after) than or equal to another + * Returns english human readable complete date string. * - * @param Carbon $dt + * @example + * ``` + * echo Carbon::now()->toString(); + * ``` * - * @return bool + * @return string */ - public function gte(Carbon $dt) + public function toString() { - return $this >= $dt; + return $this->format('D M j Y H:i:s \G\M\TO'); } /** - * Determines if the instance is less (before) than another + * Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z, if $keepOffset truthy, offset will be kept: + * 1977-04-22T01:00:00-05:00). * - * @param Carbon $dt + * @example + * ``` + * echo Carbon::now('America/Toronto')->toISOString() . "\n"; + * echo Carbon::now('America/Toronto')->toISOString(true) . "\n"; + * ``` * - * @return bool + * @param bool $keepOffset Pass true to keep the date offset. Else forced to UTC. + * + * @return null|string */ - public function lt(Carbon $dt) + public function toISOString($keepOffset = false) { - return $this < $dt; + if ($this->year === 0) { + return null; + } + + $year = $this->year < 0 || $this->year > 9999 + ? ($this->year < 0 ? '-' : '+').str_pad(abs($this->year), 6, '0', STR_PAD_LEFT) + : str_pad($this->year, 4, '0', STR_PAD_LEFT); + $tz = $keepOffset ? $this->format('P') : 'Z'; + $date = $keepOffset ? $this : $this->copy()->setTimezone('UTC'); + + return $year.$date->format('-m-d\TH:i:s.u').$tz; } /** - * Determines if the instance is less (before) or equal to another + * Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z) with UTC timezone. * - * @param Carbon $dt + * @example + * ``` + * echo Carbon::now('America/Toronto')->toJSON(); + * ``` * - * @return bool + * @return null|string */ - public function lte(Carbon $dt) + public function toJSON() { - return $this <= $dt; + return $this->toISOString(); } /** - * Determines if the instance is between two others + * Return native DateTime PHP object matching the current instance. * - * @param Carbon $dt1 - * @param Carbon $dt2 - * @param bool $equal Indicates if a > and < comparison should be used or <= or >= + * @example + * ``` + * var_dump(Carbon::now()->toDateTime()); + * ``` * - * @return bool + * @return DateTime */ - public function between(Carbon $dt1, Carbon $dt2, $equal = true) + public function toDateTime() { - if ($dt1->gt($dt2)) { - $temp = $dt1; - $dt1 = $dt2; - $dt2 = $temp; - } - - if ($equal) { - return $this->gte($dt1) && $this->lte($dt2); - } - - return $this->gt($dt1) && $this->lt($dt2); + return new DateTime($this->format('Y-m-d H:i:s.u'), $this->getTimezone()); } /** - * Get the closest date from the instance. + * @alias toDateTime * - * @param Carbon $dt1 - * @param Carbon $dt2 + * Return native DateTime PHP object matching the current instance. * - * @return static + * @example + * ``` + * var_dump(Carbon::now()->toDate()); + * ``` + * + * @return DateTime */ - public function closest(Carbon $dt1, Carbon $dt2) + public function toDate() { - return $this->diffInSeconds($dt1) < $this->diffInSeconds($dt2) ? $dt1 : $dt2; + return $this->toDateTime(); } + /////////////////////////////////////////////////////////////////// + ////////////////////////// COMPARISONS //////////////////////////// + /////////////////////////////////////////////////////////////////// + /** - * Get the farthest date from the instance. + * Determines if the instance is equal to another * - * @param Carbon $dt1 - * @param Carbon $dt2 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date * - * @return static + * @return bool */ - public function farthest(Carbon $dt1, Carbon $dt2) + public function eq($date) { - return $this->diffInSeconds($dt1) > $this->diffInSeconds($dt2) ? $dt1 : $dt2; + return $this == $date; } /** - * Get the minimum instance between a given instance (default now) and the current instance. + * Determines if the instance is equal to another * - * @param Carbon|null $dt + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date * - * @return static + * @see eq() + * + * @return bool */ - public function min(Carbon $dt = null) + public function equalTo($date) { - $dt = $dt ?: static::now($this->tz); - - return $this->lt($dt) ? $this : $dt; + return $this->eq($date); } /** - * Get the maximum instance between a given instance (default now) and the current instance. + * Determines if the instance is not equal to another * - * @param Carbon|null $dt + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date * - * @return static + * @return bool */ - public function max(Carbon $dt = null) + public function ne($date) { - $dt = $dt ?: static::now($this->tz); - - return $this->gt($dt) ? $this : $dt; + return !$this->eq($date); } /** - * Determines if the instance is a weekday + * Determines if the instance is not equal to another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see ne() * * @return bool */ - public function isWeekday() + public function notEqualTo($date) { - return !$this->isWeekend(); + return $this->ne($date); } /** - * Determines if the instance is a weekend day + * Determines if the instance is greater (after) than another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date * * @return bool */ - public function isWeekend() + public function gt($date) { - return in_array($this->dayOfWeek, self::$weekendDays); + return $this > $date; } /** - * Determines if the instance is yesterday + * Determines if the instance is greater (after) than another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see gt() * * @return bool */ - public function isYesterday() + public function greaterThan($date) { - return $this->toDateString() === static::yesterday($this->tz)->toDateString(); + return $this->gt($date); } /** - * Determines if the instance is today + * Determines if the instance is greater (after) than another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see gt() * * @return bool */ - public function isToday() + public function isAfter($date) { - return $this->toDateString() === static::now($this->tz)->toDateString(); + return $this->gt($date); } /** - * Determines if the instance is tomorrow + * Determines if the instance is greater (after) than or equal to another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date * * @return bool */ - public function isTomorrow() + public function gte($date) { - return $this->toDateString() === static::tomorrow($this->tz)->toDateString(); + return $this >= $date; } /** - * Determines if the instance is in the future, ie. greater (after) than now + * Determines if the instance is greater (after) than or equal to another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see gte() * * @return bool */ - public function isFuture() + public function greaterThanOrEqualTo($date) { - return $this->gt(static::now($this->tz)); + return $this->gte($date); } /** - * Determines if the instance is in the past, ie. less (before) than now + * Determines if the instance is less (before) than another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date * * @return bool */ - public function isPast() + public function lt($date) { - return $this->lt(static::now($this->tz)); + return $this < $date; } /** - * Determines if the instance is a leap year + * Determines if the instance is less (before) than another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see lt() * * @return bool */ - public function isLeapYear() + public function lessThan($date) { - return $this->format('L') === '1'; + return $this->lt($date); } /** - * Checks if the passed in date is the same day as the instance current day. + * Determines if the instance is less (before) than another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date * - * @param Carbon $dt + * @see lt() * * @return bool */ - public function isSameDay(Carbon $dt) + public function isBefore($date) { - return $this->toDateString() === $dt->toDateString(); + return $this->lt($date); } /** - * Checks if this day is a Sunday. + * Determines if the instance is less (before) or equal to another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date * * @return bool */ - public function isSunday() + public function lte($date) { - return $this->dayOfWeek === static::SUNDAY; + return $this <= $date; } /** - * Checks if this day is a Monday. + * Determines if the instance is less (before) or equal to another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see lte() * * @return bool */ - public function isMonday() + public function lessThanOrEqualTo($date) { - return $this->dayOfWeek === static::MONDAY; + return $this->lte($date); } /** - * Checks if this day is a Tuesday. + * Determines if the instance is between two others + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * @param bool $equal Indicates if an equal to comparison should be done * * @return bool */ - public function isTuesday() + public function between($date1, $date2, $equal = true) { - return $this->dayOfWeek === static::TUESDAY; + if ($date1->gt($date2)) { + $temp = $date1; + $date1 = $date2; + $date2 = $temp; + } + + if ($equal) { + return $this->gte($date1) && $this->lte($date2); + } + + return $this->gt($date1) && $this->lt($date2); } - /** - * Checks if this day is a Wednesday. - * - * @return bool - */ - public function isWednesday() + protected function floatDiffInSeconds($date) { - return $this->dayOfWeek === static::WEDNESDAY; + $date = $this->resolveCarbon($date); + + return abs($this->diffInRealSeconds($date, false) + ($date->micro - $this->micro) / 1000000); } /** - * Checks if this day is a Thursday. + * Determines if the instance is between two others + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * @param bool $equal Indicates if a > and < comparison should be used or <= or >= * * @return bool */ - public function isThursday() + public function isBetween($date1, $date2, $equal = true) { - return $this->dayOfWeek === static::THURSDAY; + return $this->between($date1, $date2, $equal); } /** - * Checks if this day is a Friday. + * Get the closest date from the instance. * - * @return bool + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * + * @return static */ - public function isFriday() + public function closest($date1, $date2) { - return $this->dayOfWeek === static::FRIDAY; + return $this->floatDiffInSeconds($date1) < $this->floatDiffInSeconds($date2) ? $date1 : $date2; } /** - * Checks if this day is a Saturday. + * Get the farthest date from the instance. * - * @return bool + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * + * @return static */ - public function isSaturday() + public function farthest($date1, $date2) { - return $this->dayOfWeek === static::SATURDAY; + return $this->floatDiffInSeconds($date1) > $this->floatDiffInSeconds($date2) ? $date1 : $date2; } - /////////////////////////////////////////////////////////////////// - /////////////////// ADDITIONS AND SUBTRACTIONS //////////////////// - /////////////////////////////////////////////////////////////////// - /** - * Add years to the instance. Positive $value travel forward while - * negative $value travel into the past. + * Get the minimum instance between a given instance (default now) and the current instance. * - * @param int $value + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date * * @return static */ - public function addYears($value) + public function min($date = null) { - return $this->modify((int) $value.' year'); + $date = $this->resolveCarbon($date); + + return $this->lt($date) ? $this : $date; } /** - * Add a year to the instance + * Get the minimum instance between a given instance (default now) and the current instance. * - * @param int $value + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see min() * * @return static */ - public function addYear($value = 1) + public function minimum($date = null) { - return $this->addYears($value); + return $this->min($date); } /** - * Remove a year from the instance + * Get the maximum instance between a given instance (default now) and the current instance. * - * @param int $value + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * + * @return static + */ + public function max($date = null) + { + $date = $this->resolveCarbon($date); + + return $this->gt($date) ? $this : $date; + } + + /** + * Get the maximum instance between a given instance (default now) and the current instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see max() + * + * @return static + */ + public function maximum($date = null) + { + return $this->max($date); + } + + /** + * Determines if the instance is a weekday. + * + * @return bool + */ + public function isWeekday() + { + return !$this->isWeekend(); + } + + /** + * Determines if the instance is a weekend day. + * + * @return bool + */ + public function isWeekend() + { + return in_array($this->dayOfWeek, static::$weekendDays); + } + + /** + * Determines if the instance is yesterday. + * + * @return bool + */ + public function isYesterday() + { + return $this->toDateString() === static::yesterday($this->getTimezone())->toDateString(); + } + + /** + * Determines if the instance is today. + * + * @return bool + */ + public function isToday() + { + return $this->toDateString() === $this->nowWithSameTz()->toDateString(); + } + + /** + * Determines if the instance is tomorrow. + * + * @return bool + */ + public function isTomorrow() + { + return $this->toDateString() === static::tomorrow($this->getTimezone())->toDateString(); + } + + /** + * Determines if the instance is within the next week. + * + * @return bool + */ + public function isNextWeek() + { + return $this->weekOfYear === $this->nowWithSameTz()->addWeek()->weekOfYear; + } + + /** + * Determines if the instance is within the last week. + * + * @return bool + */ + public function isLastWeek() + { + return $this->weekOfYear === $this->nowWithSameTz()->subWeek()->weekOfYear; + } + + /** + * Determines if the instance is within the next quarter. + * + * @return bool + */ + public function isNextQuarter() + { + return $this->quarter === $this->nowWithSameTz()->addQuarter()->quarter; + } + + /** + * Determines if the instance is within the last quarter. + * + * @return bool + */ + public function isLastQuarter() + { + return $this->quarter === $this->nowWithSameTz()->subQuarter()->quarter; + } + + /** + * Determines if the instance is within the next month. + * + * @return bool + */ + public function isNextMonth() + { + return $this->month === $this->nowWithSameTz()->addMonthNoOverflow()->month; + } + + /** + * Determines if the instance is within the last month. + * + * @return bool + */ + public function isLastMonth() + { + return $this->month === $this->nowWithSameTz()->subMonthNoOverflow()->month; + } + + /** + * Determines if the instance is within next year. + * + * @return bool + */ + public function isNextYear() + { + return $this->year === $this->nowWithSameTz()->addYear()->year; + } + + /** + * Determines if the instance is within the previous year. + * + * @return bool + */ + public function isLastYear() + { + return $this->year === $this->nowWithSameTz()->subYear()->year; + } + + /** + * Determines if the instance is in the future, ie. greater (after) than now. + * + * @return bool + */ + public function isFuture() + { + return $this->gt($this->nowWithSameTz()); + } + + /** + * Determines if the instance is in the past, ie. less (before) than now. + * + * @return bool + */ + public function isPast() + { + return $this->lt($this->nowWithSameTz()); + } + + /** + * Determines if the instance is a leap year. + * + * @return bool + */ + public function isLeapYear() + { + return $this->format('L') === '1'; + } + + /** + * Determines if the instance is a long year + * + * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates + * + * @return bool + */ + public function isLongYear() + { + return static::create($this->year, 12, 28, 0, 0, 0, $this->tz)->weekOfYear === 53; + } + + /** + * Compares the formatted values of the two dates. + * + * @param string $format The date formats to compare. + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use current day. + * + * @throws \InvalidArgumentException + * + * @return bool + */ + public function isSameAs($format, $date = null) + { + $date = $date ?: static::now($this->tz); + + static::expectDateTime($date, 'null'); + + return $this->format($format) === $date->format($format); + } + + /** + * Determines if the instance is in the current year. + * + * @return bool + */ + public function isCurrentYear() + { + return $this->isSameYear(); + } + + /** + * Checks if the passed in date is in the same year as the instance year. + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use current day. + * + * @return bool + */ + public function isSameYear($date = null) + { + return $this->isSameAs('Y', $date); + } + + /** + * Determines if the instance is in the current month. + * + * @return bool + */ + public function isCurrentQuarter() + { + return $this->isSameQuarter(); + } + + /** + * Checks if the passed in date is in the same quarter as the instance quarter (and year if needed). + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use current day. + * @param bool $ofSameYear Check if it is the same month in the same year. + * + * @return bool + */ + public function isSameQuarter($date = null, $ofSameYear = null) + { + $date = $date ? static::instance($date) : static::now($this->tz); + + static::expectDateTime($date, 'null'); + + $ofSameYear = is_null($ofSameYear) ? static::shouldCompareYearWithMonth() : $ofSameYear; + + return $this->quarter === $date->quarter && (!$ofSameYear || $this->isSameYear($date)); + } + + /** + * Determines if the instance is in the current month. + * + * @param bool $ofSameYear Check if it is the same month in the same year. + * + * @return bool + */ + public function isCurrentMonth($ofSameYear = null) + { + return $this->isSameMonth(null, $ofSameYear); + } + + /** + * Checks if the passed in date is in the same month as the instance´s month. + * + * Note that this defaults to only comparing the month while ignoring the year. + * To test if it is the same exact month of the same year, pass in true as the second parameter. + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use the current date. + * @param bool $ofSameYear Check if it is the same month in the same year. + * + * @return bool + */ + public function isSameMonth($date = null, $ofSameYear = null) + { + $ofSameYear = is_null($ofSameYear) ? static::shouldCompareYearWithMonth() : $ofSameYear; + + return $this->isSameAs($ofSameYear ? 'Y-m' : 'm', $date); + } + + /** + * Determines if the instance is in the current day. + * + * @return bool + */ + public function isCurrentDay() + { + return $this->isSameDay(); + } + + /** + * Checks if the passed in date is the same exact day as the instance´s day. + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use the current date. + * + * @return bool + */ + public function isSameDay($date = null) + { + return $this->isSameAs('Y-m-d', $date); + } + + /** + * Determines if the instance is in the current hour. + * + * @return bool + */ + public function isCurrentHour() + { + return $this->isSameHour(); + } + + /** + * Checks if the passed in date is the same exact hour as the instance´s hour. + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use the current date. + * + * @return bool + */ + public function isSameHour($date = null) + { + return $this->isSameAs('Y-m-d H', $date); + } + + /** + * Determines if the instance is in the current minute. + * + * @return bool + */ + public function isCurrentMinute() + { + return $this->isSameMinute(); + } + + /** + * Checks if the passed in date is the same exact minute as the instance´s minute. + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use the current date. + * + * @return bool + */ + public function isSameMinute($date = null) + { + return $this->isSameAs('Y-m-d H:i', $date); + } + + /** + * Determines if the instance is in the current second. + * + * @return bool + */ + public function isCurrentSecond() + { + return $this->isSameSecond(); + } + + /** + * Checks if the passed in date is the same exact second as the instance´s second. + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use the current date. + * + * @return bool + */ + public function isSameSecond($date = null) + { + return $this->isSameAs('Y-m-d H:i:s', $date); + } + + /** + * Checks if this day is a specific day of the week. + * + * @param int $dayOfWeek + * + * @return bool + */ + public function isDayOfWeek($dayOfWeek) + { + return $this->dayOfWeek === $dayOfWeek; + } + + /** + * Checks if this day is a Sunday. + * + * @return bool + */ + public function isSunday() + { + return $this->dayOfWeek === static::SUNDAY; + } + + /** + * Checks if this day is a Monday. + * + * @return bool + */ + public function isMonday() + { + return $this->dayOfWeek === static::MONDAY; + } + + /** + * Checks if this day is a Tuesday. + * + * @return bool + */ + public function isTuesday() + { + return $this->dayOfWeek === static::TUESDAY; + } + + /** + * Checks if this day is a Wednesday. + * + * @return bool + */ + public function isWednesday() + { + return $this->dayOfWeek === static::WEDNESDAY; + } + + /** + * Checks if this day is a Thursday. + * + * @return bool + */ + public function isThursday() + { + return $this->dayOfWeek === static::THURSDAY; + } + + /** + * Checks if this day is a Friday. + * + * @return bool + */ + public function isFriday() + { + return $this->dayOfWeek === static::FRIDAY; + } + + /** + * Checks if this day is a Saturday. + * + * @return bool + */ + public function isSaturday() + { + return $this->dayOfWeek === static::SATURDAY; + } + + /** + * Check if its the birthday. Compares the date/month values of the two dates. + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use current day. + * + * @return bool + */ + public function isBirthday($date = null) + { + return $this->isSameAs('md', $date); + } + + /** + * Check if today is the last day of the Month + * + * @return bool + */ + public function isLastOfMonth() + { + return $this->day === $this->daysInMonth; + } + + /** + * Check if the instance is start of day / midnight. + * + * @param bool $checkMicroseconds check time at microseconds precision + * /!\ Warning, this is not reliable with PHP < 7.1.4 + * + * @return bool + */ + public function isStartOfDay($checkMicroseconds = false) + { + return $checkMicroseconds + ? $this->format('H:i:s.u') === '00:00:00.000000' + : $this->format('H:i:s') === '00:00:00'; + } + + /** + * Check if the instance is end of day. + * + * @param bool $checkMicroseconds check time at microseconds precision + * /!\ Warning, this is not reliable with PHP < 7.1.4 + * + * @return bool + */ + public function isEndOfDay($checkMicroseconds = false) + { + return $checkMicroseconds + ? $this->format('H:i:s.u') === '23:59:59.999999' + : $this->format('H:i:s') === '23:59:59'; + } + + /** + * Check if the instance is start of day / midnight. + * + * @return bool + */ + public function isMidnight() + { + return $this->isStartOfDay(); + } + + /** + * Check if the instance is midday. + * + * @return bool + */ + public function isMidday() + { + return $this->format('G:i:s') === static::$midDayAt.':00:00'; + } + + /** + * Checks if the (date)time string is in a given format. + * + * @param string $date + * @param string $format + * + * @return bool + */ + public static function hasFormat($date, $format) + { + try { + // Try to create a DateTime object. Throws an InvalidArgumentException if the provided time string + // doesn't match the format in any way. + static::createFromFormat($format, $date); + + // createFromFormat() is known to handle edge cases silently. + // E.g. "1975-5-1" (Y-n-j) will still be parsed correctly when "Y-m-d" is supplied as the format. + // To ensure we're really testing against our desired format, perform an additional regex validation. + $regex = strtr( + preg_quote($format, '/'), + static::$regexFormats + ); + + return (bool) preg_match('/^'.$regex.'$/', $date); + } catch (InvalidArgumentException $e) { + } + + return false; + } + + /////////////////////////////////////////////////////////////////// + /////////////////// ADDITIONS AND SUBTRACTIONS //////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Add centuries to the instance. Positive $value travels forward while + * negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addCenturies($value) + { + return $this->addYears(static::YEARS_PER_CENTURY * $value); + } + + /** + * Add a century to the instance + * + * @param int $value + * + * @return static + */ + public function addCentury($value = 1) + { + return $this->addCenturies($value); + } + + /** + * Remove centuries from the instance + * + * @param int $value + * + * @return static + */ + public function subCenturies($value) + { + return $this->addCenturies(-1 * $value); + } + + /** + * Remove a century from the instance + * + * @param int $value + * + * @return static + */ + public function subCentury($value = 1) + { + return $this->subCenturies($value); + } + + /** + * Add years to the instance. Positive $value travel forward while + * negative $value travel into the past. + * + * @param int $value + * + * @return static + */ + public function addYears($value) + { + if ($this->shouldOverflowYears()) { + return $this->addYearsWithOverflow($value); + } + + return $this->addYearsNoOverflow($value); + } + + /** + * Add a year to the instance + * + * @param int $value + * + * @return static + */ + public function addYear($value = 1) + { + return $this->addYears($value); + } + + /** + * Add years to the instance with no overflow of months + * Positive $value travel forward while + * negative $value travel into the past. + * + * @param int $value + * + * @return static + */ + public function addYearsNoOverflow($value) + { + return $this->addMonthsNoOverflow($value * static::MONTHS_PER_YEAR); + } + + /** + * Add year with overflow months set to false + * + * @param int $value + * + * @return static + */ + public function addYearNoOverflow($value = 1) + { + return $this->addYearsNoOverflow($value); + } + + /** + * Add years to the instance. + * Positive $value travel forward while + * negative $value travel into the past. + * + * @param int $value + * + * @return static + */ + public function addYearsWithOverflow($value) + { + return $this->modify((int) $value.' year'); + } + + /** + * Add year with overflow. + * + * @param int $value + * + * @return static + */ + public function addYearWithOverflow($value = 1) + { + return $this->addYearsWithOverflow($value); + } + + /** + * Remove years from the instance. + * + * @param int $value + * + * @return static + */ + public function subYears($value) + { + return $this->addYears(-1 * $value); + } + + /** + * Remove a year from the instance + * + * @param int $value * * @return static */ public function subYear($value = 1) { - return $this->subYears($value); + return $this->subYears($value); + } + + /** + * Remove years from the instance with no month overflow. + * + * @param int $value + * + * @return static + */ + public function subYearsNoOverflow($value) + { + return $this->subMonthsNoOverflow($value * static::MONTHS_PER_YEAR); + } + + /** + * Remove year from the instance with no month overflow + * + * @param int $value + * + * @return static + */ + public function subYearNoOverflow($value = 1) + { + return $this->subYearsNoOverflow($value); + } + + /** + * Remove years from the instance. + * + * @param int $value + * + * @return static + */ + public function subYearsWithOverflow($value) + { + return $this->subMonthsWithOverflow($value * static::MONTHS_PER_YEAR); + } + + /** + * Remove year from the instance. + * + * @param int $value + * + * @return static + */ + public function subYearWithOverflow($value = 1) + { + return $this->subYearsWithOverflow($value); } /** - * Remove years from the instance. + * Add quarters to the instance. Positive $value travels forward while + * negative $value travels into the past. * * @param int $value * * @return static */ - public function subYears($value) + public function addQuarters($value) { - return $this->addYears(-1 * $value); + return $this->addMonths(static::MONTHS_PER_QUARTER * $value); + } + + /** + * Add a quarter to the instance + * + * @param int $value + * + * @return static + */ + public function addQuarter($value = 1) + { + return $this->addQuarters($value); + } + + /** + * Remove quarters from the instance + * + * @param int $value + * + * @return static + */ + public function subQuarters($value) + { + return $this->addQuarters(-1 * $value); + } + + /** + * Remove a quarter from the instance + * + * @param int $value + * + * @return static + */ + public function subQuarter($value = 1) + { + return $this->subQuarters($value); } /** @@ -1552,7 +3333,11 @@ public function subYears($value) */ public function addMonths($value) { - return $this->modify((int) $value.' month'); + if (static::shouldOverflowMonths()) { + return $this->addMonthsWithOverflow($value); + } + + return $this->addMonthsNoOverflow($value); } /** @@ -1567,6 +3352,18 @@ public function addMonth($value = 1) return $this->addMonths($value); } + /** + * Remove months from the instance + * + * @param int $value + * + * @return static + */ + public function subMonths($value) + { + return $this->addMonths(-1 * $value); + } + /** * Remove a month from the instance * @@ -1579,6 +3376,31 @@ public function subMonth($value = 1) return $this->subMonths($value); } + /** + * Add months to the instance. Positive $value travels forward while + * negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addMonthsWithOverflow($value) + { + return $this->modify((int) $value.' month'); + } + + /** + * Add a month to the instance + * + * @param int $value + * + * @return static + */ + public function addMonthWithOverflow($value = 1) + { + return $this->addMonthsWithOverflow($value); + } + /** * Remove months from the instance * @@ -1586,9 +3408,21 @@ public function subMonth($value = 1) * * @return static */ - public function subMonths($value) + public function subMonthsWithOverflow($value) { - return $this->addMonths(-1 * $value); + return $this->addMonthsWithOverflow(-1 * $value); + } + + /** + * Remove a month from the instance + * + * @param int $value + * + * @return static + */ + public function subMonthWithOverflow($value = 1) + { + return $this->subMonthsWithOverflow($value); } /** @@ -1601,13 +3435,15 @@ public function subMonths($value) */ public function addMonthsNoOverflow($value) { - $date = $this->copy()->addMonths($value); + $day = $this->day; + + $this->modify((int) $value.' month'); - if ($date->day !== $this->day) { - $date->day(1)->subMonth()->day($date->daysInMonth); + if ($day !== $this->day) { + $this->modify('last day of previous month'); } - return $date; + return $this; } /** @@ -1623,27 +3459,27 @@ public function addMonthNoOverflow($value = 1) } /** - * Remove a month with no overflow from the instance + * Remove months with no overflow from the instance * * @param int $value * * @return static */ - public function subMonthNoOverflow($value = 1) + public function subMonthsNoOverflow($value) { - return $this->subMonthsNoOverflow($value); + return $this->addMonthsNoOverflow(-1 * $value); } /** - * Remove months with no overflow from the instance + * Remove a month with no overflow from the instance * * @param int $value * * @return static */ - public function subMonthsNoOverflow($value) + public function subMonthNoOverflow($value = 1) { - return $this->addMonthsNoOverflow(-1 * $value); + return $this->subMonthsNoOverflow($value); } /** @@ -1672,27 +3508,27 @@ public function addDay($value = 1) } /** - * Remove a day from the instance + * Remove days from the instance * * @param int $value * * @return static */ - public function subDay($value = 1) + public function subDays($value) { - return $this->subDays($value); + return $this->addDays(-1 * $value); } /** - * Remove days from the instance + * Remove a day from the instance * * @param int $value * * @return static */ - public function subDays($value) + public function subDay($value = 1) { - return $this->addDays(-1 * $value); + return $this->subDays($value); } /** @@ -1705,7 +3541,11 @@ public function subDays($value) */ public function addWeekdays($value) { - return $this->modify((int) $value.' weekday'); + // Fix for weekday bug https://bugs.php.net/bug.php?id=54909 + $t = $this->toTimeString(); + $this->modify((int) $value.' weekday'); + + return $this->setTimeFromTimeString($t); } /** @@ -1721,27 +3561,27 @@ public function addWeekday($value = 1) } /** - * Remove a weekday from the instance + * Remove weekdays from the instance * * @param int $value * * @return static */ - public function subWeekday($value = 1) + public function subWeekdays($value) { - return $this->subWeekdays($value); + return $this->addWeekdays(-1 * $value); } /** - * Remove weekdays from the instance + * Remove a weekday from the instance * * @param int $value * * @return static */ - public function subWeekdays($value) + public function subWeekday($value = 1) { - return $this->addWeekdays(-1 * $value); + return $this->subWeekdays($value); } /** @@ -1770,27 +3610,27 @@ public function addWeek($value = 1) } /** - * Remove a week from the instance + * Remove weeks to the instance * * @param int $value * * @return static */ - public function subWeek($value = 1) + public function subWeeks($value) { - return $this->subWeeks($value); + return $this->addWeeks(-1 * $value); } /** - * Remove weeks to the instance + * Remove a week from the instance * * @param int $value * * @return static */ - public function subWeeks($value) + public function subWeek($value = 1) { - return $this->addWeeks(-1 * $value); + return $this->subWeeks($value); } /** @@ -1807,7 +3647,20 @@ public function addHours($value) } /** - * Add an hour to the instance + * Add hours to the instance using timestamp. Positive $value travels + * forward while negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addRealHours($value) + { + return $this->addRealMinutes($value * static::MINUTES_PER_HOUR); + } + + /** + * Add an hour to the instance. * * @param int $value * @@ -1819,7 +3672,43 @@ public function addHour($value = 1) } /** - * Remove an hour from the instance + * Add an hour to the instance using timestamp. + * + * @param int $value + * + * @return static + */ + public function addRealHour($value = 1) + { + return $this->addRealHours($value); + } + + /** + * Remove hours from the instance. + * + * @param int $value + * + * @return static + */ + public function subHours($value) + { + return $this->addHours(-1 * $value); + } + + /** + * Remove hours from the instance using timestamp. + * + * @param int $value + * + * @return static + */ + public function subRealHours($value) + { + return $this->addRealHours(-1 * $value); + } + + /** + * Remove an hour from the instance. * * @param int $value * @@ -1831,89 +3720,187 @@ public function subHour($value = 1) } /** - * Remove hours from the instance + * Remove an hour from the instance. + * + * @param int $value + * + * @return static + */ + public function subRealHour($value = 1) + { + return $this->subRealHours($value); + } + + /** + * Add minutes to the instance using timestamp. Positive $value + * travels forward while negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addMinutes($value) + { + return $this->modify((int) $value.' minute'); + } + + /** + * Add minutes to the instance using timestamp. Positive $value travels + * forward while negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addRealMinutes($value) + { + return $this->addRealSeconds($value * static::SECONDS_PER_MINUTE); + } + + /** + * Add a minute to the instance. + * + * @param int $value + * + * @return static + */ + public function addMinute($value = 1) + { + return $this->addMinutes($value); + } + + /** + * Add a minute to the instance using timestamp. + * + * @param int $value + * + * @return static + */ + public function addRealMinute($value = 1) + { + return $this->addRealMinutes($value); + } + + /** + * Remove a minute from the instance. + * + * @param int $value + * + * @return static + */ + public function subMinute($value = 1) + { + return $this->subMinutes($value); + } + + /** + * Remove a minute from the instance using timestamp. + * + * @param int $value + * + * @return static + */ + public function subRealMinute($value = 1) + { + return $this->addRealMinutes(-1 * $value); + } + + /** + * Remove minutes from the instance. + * + * @param int $value + * + * @return static + */ + public function subMinutes($value) + { + return $this->addMinutes(-1 * $value); + } + + /** + * Remove a minute from the instance using timestamp. * * @param int $value * * @return static */ - public function subHours($value) + public function subRealMinutes($value = 1) { - return $this->addHours(-1 * $value); + return $this->subRealMinute($value); } /** - * Add minutes to the instance. Positive $value travels forward while + * Add seconds to the instance. Positive $value travels forward while * negative $value travels into the past. * * @param int $value * * @return static */ - public function addMinutes($value) + public function addSeconds($value) { - return $this->modify((int) $value.' minute'); + return $this->modify((int) $value.' second'); } /** - * Add a minute to the instance + * Add seconds to the instance using timestamp. Positive $value travels + * forward while negative $value travels into the past. * * @param int $value * * @return static */ - public function addMinute($value = 1) + public function addRealSeconds($value) { - return $this->addMinutes($value); + return $this->setTimestamp($this->getTimestamp() + $value); } /** - * Remove a minute from the instance + * Add a second to the instance. * * @param int $value * * @return static */ - public function subMinute($value = 1) + public function addSecond($value = 1) { - return $this->subMinutes($value); + return $this->addSeconds($value); } /** - * Remove minutes from the instance + * Add a second to the instance using timestamp. * * @param int $value * * @return static */ - public function subMinutes($value) + public function addRealSecond($value = 1) { - return $this->addMinutes(-1 * $value); + return $this->addRealSeconds($value); } /** - * Add seconds to the instance. Positive $value travels forward while - * negative $value travels into the past. + * Remove seconds from the instance. * * @param int $value * * @return static */ - public function addSeconds($value) + public function subSeconds($value) { - return $this->modify((int) $value.' second'); + return $this->addSeconds(-1 * $value); } /** - * Add a second to the instance + * Remove seconds from the instance using timestamp. * * @param int $value * * @return static */ - public function addSecond($value = 1) + public function subRealSeconds($value) { - return $this->addSeconds($value); + return $this->addRealSeconds(-1 * $value); } /** @@ -1929,121 +3916,205 @@ public function subSecond($value = 1) } /** - * Remove seconds from the instance + * Remove a second from the instance using timestamp. * * @param int $value * * @return static */ - public function subSeconds($value) + public function subRealSecond($value = 1) { - return $this->addSeconds(-1 * $value); + return $this->subRealSeconds($value); } /////////////////////////////////////////////////////////////////// /////////////////////////// DIFFERENCES /////////////////////////// /////////////////////////////////////////////////////////////////// + /** + * @param DateInterval $diff + * @param bool $absolute + * @param bool $trimMicroseconds + * + * @return CarbonInterval + */ + protected static function fixDiffInterval(DateInterval $diff, $absolute, $trimMicroseconds) + { + $diff = CarbonInterval::instance($diff, $trimMicroseconds); + + // @codeCoverageIgnoreStart + if (version_compare(PHP_VERSION, '7.1.0-dev', '<')) { + return $diff; + } + + // Work-around for https://bugs.php.net/bug.php?id=77145 + if ($diff->f > 0 && $diff->y === -1 && $diff->m === 11 && $diff->d >= 27 && $diff->h === 23 && $diff->i === 59 && $diff->s === 59) { + $diff->y = 0; + $diff->m = 0; + $diff->d = 0; + $diff->h = 0; + $diff->i = 0; + $diff->s = 0; + $diff->f = (1000000 - round($diff->f * 1000000)) / 1000000; + $diff->invert(); + } elseif ($diff->f < 0) { + if ($diff->s !== 0 || $diff->i !== 0 || $diff->h !== 0 || $diff->d !== 0 || $diff->m !== 0 || $diff->y !== 0) { + $diff->f = (round($diff->f * 1000000) + 1000000) / 1000000; + $diff->s--; + if ($diff->s < 0) { + $diff->s += 60; + $diff->i--; + if ($diff->i < 0) { + $diff->i += 60; + $diff->h--; + if ($diff->h < 0) { + $diff->h += 24; + $diff->d--; + if ($diff->d < 0) { + $diff->d += 30; + $diff->m--; + if ($diff->m < 0) { + $diff->m += 12; + $diff->y--; + } + } + } + } + } + } else { + $diff->f *= -1; + $diff->invert(); + } + } + // @codeCoverageIgnoreEnd + if ($absolute && $diff->invert) { + $diff->invert(); + } + + return $diff; + } + + /** + * Get the difference as a CarbonInterval instance. + * + * Pass false as second argument to get a microseconds-precise interval. Else + * microseconds in the original interval will not be kept. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * @param bool $trimMicroseconds (true by default) + * + * @return CarbonInterval + */ + public function diffAsCarbonInterval($date = null, $absolute = true, $trimMicroseconds = true) + { + $from = $this; + $to = $this->resolveCarbon($date); + + if ($trimMicroseconds) { + $from = $from->copy()->startOfSecond(); + $to = $to->copy()->startOfSecond(); + } + + return static::fixDiffInterval($from->diff($to, $absolute), $absolute, $trimMicroseconds); + } + /** * Get the difference in years * - * @param Carbon|null $dt - * @param bool $abs Get the absolute of the difference + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference * * @return int */ - public function diffInYears(Carbon $dt = null, $abs = true) + public function diffInYears($date = null, $absolute = true) { - $dt = $dt ?: static::now($this->tz); - - return (int) $this->diff($dt, $abs)->format('%r%y'); + return (int) $this->diff($this->resolveCarbon($date), $absolute)->format('%r%y'); } /** * Get the difference in months * - * @param Carbon|null $dt - * @param bool $abs Get the absolute of the difference + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference * * @return int */ - public function diffInMonths(Carbon $dt = null, $abs = true) + public function diffInMonths($date = null, $absolute = true) { - $dt = $dt ?: static::now($this->tz); + $date = $this->resolveCarbon($date); - return $this->diffInYears($dt, $abs) * static::MONTHS_PER_YEAR + (int) $this->diff($dt, $abs)->format('%r%m'); + return $this->diffInYears($date, $absolute) * static::MONTHS_PER_YEAR + (int) $this->diff($date, $absolute)->format('%r%m'); } /** * Get the difference in weeks * - * @param Carbon|null $dt - * @param bool $abs Get the absolute of the difference + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference * * @return int */ - public function diffInWeeks(Carbon $dt = null, $abs = true) + public function diffInWeeks($date = null, $absolute = true) { - return (int) ($this->diffInDays($dt, $abs) / static::DAYS_PER_WEEK); + return (int) ($this->diffInDays($date, $absolute) / static::DAYS_PER_WEEK); } /** * Get the difference in days * - * @param Carbon|null $dt - * @param bool $abs Get the absolute of the difference + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference * * @return int */ - public function diffInDays(Carbon $dt = null, $abs = true) + public function diffInDays($date = null, $absolute = true) { - $dt = $dt ?: static::now($this->tz); - - return (int) $this->diff($dt, $abs)->format('%r%a'); + return (int) $this->diff($this->resolveCarbon($date), $absolute)->format('%r%a'); } /** * Get the difference in days using a filter closure * - * @param Closure $callback - * @param Carbon|null $dt - * @param bool $abs Get the absolute of the difference + * @param Closure $callback + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference * * @return int */ - public function diffInDaysFiltered(Closure $callback, Carbon $dt = null, $abs = true) + public function diffInDaysFiltered(Closure $callback, $date = null, $absolute = true) { - return $this->diffFiltered(CarbonInterval::day(), $callback, $dt, $abs); + return $this->diffFiltered(CarbonInterval::day(), $callback, $date, $absolute); } /** * Get the difference in hours using a filter closure * - * @param Closure $callback - * @param Carbon|null $dt - * @param bool $abs Get the absolute of the difference + * @param Closure $callback + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference * * @return int */ - public function diffInHoursFiltered(Closure $callback, Carbon $dt = null, $abs = true) + public function diffInHoursFiltered(Closure $callback, $date = null, $absolute = true) { - return $this->diffFiltered(CarbonInterval::hour(), $callback, $dt, $abs); + return $this->diffFiltered(CarbonInterval::hour(), $callback, $date, $absolute); } /** * Get the difference by the given interval using a filter closure * - * @param CarbonInterval $ci An interval to traverse by - * @param Closure $callback - * @param Carbon|null $dt - * @param bool $abs Get the absolute of the difference + * @param CarbonInterval $ci An interval to traverse by + * @param Closure $callback + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference * * @return int */ - public function diffFiltered(CarbonInterval $ci, Closure $callback, Carbon $dt = null, $abs = true) + public function diffFiltered(CarbonInterval $ci, Closure $callback, $date = null, $absolute = true) { $start = $this; - $end = $dt ?: static::now($this->tz); + $end = $this->resolveCarbon($date); $inverse = false; if ($end < $start) { @@ -2053,85 +4124,197 @@ public function diffFiltered(CarbonInterval $ci, Closure $callback, Carbon $dt = } $period = new DatePeriod($start, $ci, $end); - $vals = array_filter(iterator_to_array($period), function (DateTime $date) use ($callback) { + $values = array_filter(iterator_to_array($period), function ($date) use ($callback) { return call_user_func($callback, Carbon::instance($date)); }); - $diff = count($vals); + $diff = count($values); - return $inverse && !$abs ? -$diff : $diff; + return $inverse && !$absolute ? -$diff : $diff; } /** * Get the difference in weekdays * - * @param Carbon|null $dt - * @param bool $abs Get the absolute of the difference + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference * * @return int */ - public function diffInWeekdays(Carbon $dt = null, $abs = true) + public function diffInWeekdays($date = null, $absolute = true) { return $this->diffInDaysFiltered(function (Carbon $date) { return $date->isWeekday(); - }, $dt, $abs); + }, $date, $absolute); } /** * Get the difference in weekend days using a filter * - * @param Carbon|null $dt - * @param bool $abs Get the absolute of the difference + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference * * @return int */ - public function diffInWeekendDays(Carbon $dt = null, $abs = true) + public function diffInWeekendDays($date = null, $absolute = true) { return $this->diffInDaysFiltered(function (Carbon $date) { return $date->isWeekend(); - }, $dt, $abs); + }, $date, $absolute); + } + + /** + * Get the difference in hours. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInHours($date = null, $absolute = true) + { + return (int) ($this->diffInSeconds($date, $absolute) / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR); + } + + /** + * Get the difference in hours using timestamps. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealHours($date = null, $absolute = true) + { + return (int) ($this->diffInRealSeconds($date, $absolute) / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR); + } + + /** + * Get the difference in minutes. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInMinutes($date = null, $absolute = true) + { + return (int) ($this->diffInSeconds($date, $absolute) / static::SECONDS_PER_MINUTE); + } + + /** + * Get the difference in minutes using timestamps. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealMinutes($date = null, $absolute = true) + { + return (int) ($this->diffInRealSeconds($date, $absolute) / static::SECONDS_PER_MINUTE); + } + + /** + * Get the difference in seconds. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInSeconds($date = null, $absolute = true) + { + $diff = $this->diff($this->resolveCarbon($date)); + if (!$diff->days && version_compare(PHP_VERSION, '5.4.0-dev', '>=')) { + $diff = static::fixDiffInterval($diff, $absolute, false); + } + $value = $diff->days * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE + + $diff->h * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE + + $diff->i * static::SECONDS_PER_MINUTE + + $diff->s; + + return $absolute || !$diff->invert ? $value : -$value; } /** - * Get the difference in hours + * Get the difference in seconds using timestamps. * - * @param Carbon|null $dt - * @param bool $abs Get the absolute of the difference + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference * * @return int */ - public function diffInHours(Carbon $dt = null, $abs = true) + public function diffInRealSeconds($date = null, $absolute = true) { - return (int) ($this->diffInSeconds($dt, $abs) / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR); + $date = $this->resolveCarbon($date); + $value = $date->getTimestamp() - $this->getTimestamp(); + + return $absolute ? abs($value) : $value; + } + + /** + * Get the difference in milliseconds. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInMilliseconds($date = null, $absolute = true) + { + return (int) ($this->diffInMicroseconds($date, $absolute) / static::MICROSECONDS_PER_MILLISECOND); + } + + /** + * Get the difference in milliseconds using timestamps. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealMilliseconds($date = null, $absolute = true) + { + return (int) ($this->diffInRealMicroseconds($date, $absolute) / static::MICROSECONDS_PER_MILLISECOND); } /** - * Get the difference in minutes + * Get the difference in microseconds. * - * @param Carbon|null $dt - * @param bool $abs Get the absolute of the difference + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference * * @return int */ - public function diffInMinutes(Carbon $dt = null, $abs = true) + public function diffInMicroseconds($date = null, $absolute = true) { - return (int) ($this->diffInSeconds($dt, $abs) / static::SECONDS_PER_MINUTE); + $diff = $this->diff($this->resolveCarbon($date)); + $micro = isset($diff->f) ? $diff->f : 0; + $value = (int) round((((($diff->days * static::HOURS_PER_DAY) + + $diff->h) * static::MINUTES_PER_HOUR + + $diff->i) * static::SECONDS_PER_MINUTE + + ($micro + $diff->s)) * static::MICROSECONDS_PER_SECOND); + + return $absolute || !$diff->invert ? $value : -$value; } /** - * Get the difference in seconds + * Get the difference in microseconds using timestamps. * - * @param Carbon|null $dt - * @param bool $abs Get the absolute of the difference + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference * * @return int */ - public function diffInSeconds(Carbon $dt = null, $abs = true) + public function diffInRealMicroseconds($date = null, $absolute = true) { - $dt = $dt ?: static::now($this->tz); - $value = $dt->getTimestamp() - $this->getTimestamp(); + /** @var Carbon $date */ + $date = $this->resolveCarbon($date); + $value = ($date->timestamp - $this->timestamp) * static::MICROSECONDS_PER_SECOND + + $date->micro - $this->micro; - return $abs ? abs($value) : $value; + return $absolute ? abs($value) : $value; } /** @@ -2145,7 +4328,7 @@ public function secondsSinceMidnight() } /** - * The number of seconds until 23:23:59. + * The number of seconds until 23:59:59. * * @return int */ @@ -2175,76 +4358,309 @@ public function secondsUntilEndOfDay() * * @param Carbon|null $other * @param bool $absolute removes time difference modifiers ago, after, etc + * @param bool $short displays short format of time units + * @param int $parts displays number of parts in the interval * * @return string */ - public function diffForHumans(Carbon $other = null, $absolute = false) + public function diffForHumans($other = null, $absolute = false, $short = false, $parts = 1) { $isNow = $other === null; + $relativeToNow = $isNow; + + if ($absolute === static::DIFF_RELATIVE_TO_NOW) { + $absolute = false; + $relativeToNow = true; + } elseif ($absolute === static::DIFF_RELATIVE_TO_OTHER) { + $absolute = false; + $relativeToNow = false; + } + + $interval = array(); + + $parts = min(6, max(1, (int) $parts)); + $count = 1; + $unit = $short ? 's' : 'second'; if ($isNow) { - $other = static::now($this->tz); + $other = $this->nowWithSameTz(); + } elseif (!$other instanceof DateTime && !$other instanceof DateTimeInterface) { + $other = static::parse($other); } $diffInterval = $this->diff($other); - switch (true) { - case ($diffInterval->y > 0): - $unit = 'year'; - $count = $diffInterval->y; - break; + $diffIntervalArray = array( + array('value' => $diffInterval->y, 'unit' => 'year', 'unitShort' => 'y'), + array('value' => $diffInterval->m, 'unit' => 'month', 'unitShort' => 'm'), + array('value' => $diffInterval->d, 'unit' => 'day', 'unitShort' => 'd'), + array('value' => $diffInterval->h, 'unit' => 'hour', 'unitShort' => 'h'), + array('value' => $diffInterval->i, 'unit' => 'minute', 'unitShort' => 'min'), + array('value' => $diffInterval->s, 'unit' => 'second', 'unitShort' => 's'), + ); + + foreach ($diffIntervalArray as $diffIntervalData) { + if ($diffIntervalData['value'] > 0) { + $unit = $short ? $diffIntervalData['unitShort'] : $diffIntervalData['unit']; + $count = $diffIntervalData['value']; + + if ($diffIntervalData['unit'] === 'day' && $count >= static::DAYS_PER_WEEK) { + $unit = $short ? 'w' : 'week'; + $count = (int) ($count / static::DAYS_PER_WEEK); + + $interval[] = static::translator()->transChoice($unit, $count, array(':count' => $count)); + + // get the count days excluding weeks (might be zero) + $numOfDaysCount = (int) ($diffIntervalData['value'] - ($count * static::DAYS_PER_WEEK)); + + if ($numOfDaysCount > 0 && count($interval) < $parts) { + $unit = $short ? 'd' : 'day'; + $count = $numOfDaysCount; + $interval[] = static::translator()->transChoice($unit, $count, array(':count' => $count)); + } + } else { + $interval[] = static::translator()->transChoice($unit, $count, array(':count' => $count)); + } + } - case ($diffInterval->m > 0): - $unit = 'month'; - $count = $diffInterval->m; + // break the loop after we get the required number of parts in array + if (count($interval) >= $parts) { break; + } + } - case ($diffInterval->d > 0): - $unit = 'day'; - $count = $diffInterval->d; - if ($count >= self::DAYS_PER_WEEK) { - $unit = 'week'; - $count = (int) ($count / self::DAYS_PER_WEEK); + if (count($interval) === 0) { + if ($isNow && static::getHumanDiffOptions() & self::JUST_NOW) { + $key = 'diff_now'; + $translation = static::translator()->trans($key); + if ($translation !== $key) { + return $translation; } - break; + } + $count = static::getHumanDiffOptions() & self::NO_ZERO_DIFF ? 1 : 0; + $unit = $short ? 's' : 'second'; + $interval[] = static::translator()->transChoice($unit, $count, array(':count' => $count)); + } - case ($diffInterval->h > 0): - $unit = 'hour'; - $count = $diffInterval->h; - break; + // join the interval parts by a space + $time = implode(' ', $interval); - case ($diffInterval->i > 0): - $unit = 'minute'; - $count = $diffInterval->i; - break; + unset($diffIntervalArray, $interval); - default: - $count = $diffInterval->s; - $unit = 'second'; - break; + if ($absolute) { + return $time; } - if ($count === 0) { - $count = 1; + $isFuture = $diffInterval->invert === 1; + + $transId = $relativeToNow ? ($isFuture ? 'from_now' : 'ago') : ($isFuture ? 'after' : 'before'); + + if ($parts === 1) { + if ($isNow && $unit === 'day') { + if ($count === 1 && static::getHumanDiffOptions() & self::ONE_DAY_WORDS) { + $key = $isFuture ? 'diff_tomorrow' : 'diff_yesterday'; + $translation = static::translator()->trans($key); + if ($translation !== $key) { + return $translation; + } + } + if ($count === 2 && static::getHumanDiffOptions() & self::TWO_DAY_WORDS) { + $key = $isFuture ? 'diff_after_tomorrow' : 'diff_before_yesterday'; + $translation = static::translator()->trans($key); + if ($translation !== $key) { + return $translation; + } + } + } + // Some languages have special pluralization for past and future tense. + $key = $unit.'_'.$transId; + if ($key !== static::translator()->transChoice($key, $count)) { + $time = static::translator()->transChoice($key, $count, array(':count' => $count)); + } } - $time = static::translator()->transChoice($unit, $count, array(':count' => $count)); + return static::translator()->trans($transId, array(':time' => $time)); + } - if ($absolute) { - return $time; + /** + * @alias diffForHumans + * + * Get the difference in a human readable format in the current locale. + * + * When comparing a value in the past to default now: + * 1 hour ago + * 5 months ago + * + * When comparing a value in the future to default now: + * 1 hour from now + * 5 months from now + * + * When comparing a value in the past to another value: + * 1 hour before + * 5 months before + * + * When comparing a value in the future to another value: + * 1 hour after + * 5 months after + * + * @param Carbon|null $other + * @param bool $absolute removes time difference modifiers ago, after, etc + * @param bool $short displays short format of time units + * @param int $parts displays number of parts in the interval + * + * @return string + */ + public function from($other = null, $absolute = false, $short = false, $parts = 1) + { + if (!$other && !$absolute) { + $absolute = static::DIFF_RELATIVE_TO_NOW; } - $isFuture = $diffInterval->invert === 1; + return $this->diffForHumans($other, $absolute, $short, $parts); + } + + /** + * @alias diffForHumans + * + * Get the difference in a human readable format in the current locale. + * + * When comparing a value in the past to default now: + * 1 hour ago + * 5 months ago + * + * When comparing a value in the future to default now: + * 1 hour from now + * 5 months from now + * + * When comparing a value in the past to another value: + * 1 hour before + * 5 months before + * + * When comparing a value in the future to another value: + * 1 hour after + * 5 months after + * + * @param Carbon|null $other + * @param bool $absolute removes time difference modifiers ago, after, etc + * @param bool $short displays short format of time units + * @param int $parts displays number of parts in the interval + * + * @return string + */ + public function since($other = null, $absolute = false, $short = false, $parts = 1) + { + return $this->diffForHumans($other, $absolute, $short, $parts); + } + + /** + * Get the difference in a human readable format in the current locale from an other + * instance given (or now if null given) to current instance. + * + * When comparing a value in the past to default now: + * 1 hour from now + * 5 months from now + * + * When comparing a value in the future to default now: + * 1 hour ago + * 5 months ago + * + * When comparing a value in the past to another value: + * 1 hour after + * 5 months after + * + * When comparing a value in the future to another value: + * 1 hour before + * 5 months before + * + * @param Carbon|null $other + * @param bool $absolute removes time difference modifiers ago, after, etc + * @param bool $short displays short format of time units + * @param int $parts displays number of parts in the interval + * + * @return string + */ + public function to($other = null, $absolute = false, $short = false, $parts = 1) + { + if (!$other && !$absolute) { + $absolute = static::DIFF_RELATIVE_TO_NOW; + } + + return $this->resolveCarbon($other)->diffForHumans($this, $absolute, $short, $parts); + } + + /** + * @alias to + * + * Get the difference in a human readable format in the current locale from an other + * instance given (or now if null given) to current instance. + * + * @param Carbon|null $other + * @param bool $absolute removes time difference modifiers ago, after, etc + * @param bool $short displays short format of time units + * @param int $parts displays number of parts in the interval + * + * @return string + */ + public function until($other = null, $absolute = false, $short = false, $parts = 1) + { + return $this->to($other, $absolute, $short, $parts); + } + + /** + * Get the difference in a human readable format in the current locale from current + * instance to now. + * + * @param bool $absolute removes time difference modifiers ago, after, etc + * @param bool $short displays short format of time units + * @param int $parts displays number of parts in the interval + * + * @return string + */ + public function fromNow($absolute = null, $short = false, $parts = 1) + { + $other = null; + + if ($absolute instanceof DateTimeInterface) { + list($other, $absolute, $short, $parts) = array_pad(func_get_args(), 5, null); + } + + return $this->from($other, $absolute, $short, $parts); + } + + /** + * Get the difference in a human readable format in the current locale from an other + * instance given to now + * + * @param bool $absolute removes time difference modifiers ago, after, etc + * @param bool $short displays short format of time units + * @param int $parts displays number of parts in the interval + * + * @return string + */ + public function toNow($absolute = null, $short = false, $parts = 1) + { + return $this->to(null, $absolute, $short, $parts); + } - $transId = $isNow ? ($isFuture ? 'from_now' : 'ago') : ($isFuture ? 'after' : 'before'); + /** + * Get the difference in a human readable format in the current locale from an other + * instance given to now + * + * @param bool $absolute removes time difference modifiers ago, after, etc + * @param bool $short displays short format of time units + * @param int $parts displays number of parts in the interval + * + * @return string + */ + public function ago($absolute = null, $short = false, $parts = 1) + { + $other = null; - // Some langs have special pluralization for past and future tense. - $tryKeyExists = $unit.'_'.$transId; - if ($tryKeyExists !== static::translator()->transChoice($tryKeyExists, $count)) { - $time = static::translator()->transChoice($tryKeyExists, $count, array(':count' => $count)); + if ($absolute instanceof DateTimeInterface) { + list($other, $absolute, $short, $parts) = array_pad(func_get_args(), 5, null); } - return static::translator()->trans($transId, array(':time' => $time)); + return $this->from($other, $absolute, $short, $parts); } /////////////////////////////////////////////////////////////////// @@ -2252,23 +4668,23 @@ public function diffForHumans(Carbon $other = null, $absolute = false) /////////////////////////////////////////////////////////////////// /** - * Resets the time to 00:00:00 + * Resets the time to 00:00:00 start of day * * @return static */ public function startOfDay() { - return $this->hour(0)->minute(0)->second(0); + return $this->modify('00:00:00.000000'); } /** - * Resets the time to 23:59:59 + * Resets the time to 23:59:59 end of day * * @return static */ public function endOfDay() { - return $this->hour(23)->minute(59)->second(59); + return $this->modify('23:59:59.999999'); } /** @@ -2278,7 +4694,7 @@ public function endOfDay() */ public function startOfMonth() { - return $this->startOfDay()->day(1); + return $this->setDate($this->year, $this->month, 1)->startOfDay(); } /** @@ -2288,7 +4704,29 @@ public function startOfMonth() */ public function endOfMonth() { - return $this->day($this->daysInMonth)->endOfDay(); + return $this->setDate($this->year, $this->month, $this->daysInMonth)->endOfDay(); + } + + /** + * Resets the date to the first day of the quarter and the time to 00:00:00 + * + * @return static + */ + public function startOfQuarter() + { + $month = ($this->quarter - 1) * static::MONTHS_PER_QUARTER + 1; + + return $this->setDate($this->year, $month, 1)->startOfDay(); + } + + /** + * Resets the date to end of the quarter and time to 23:59:59 + * + * @return static + */ + public function endOfQuarter() + { + return $this->startOfQuarter()->addMonths(static::MONTHS_PER_QUARTER - 1)->endOfMonth(); } /** @@ -2298,7 +4736,7 @@ public function endOfMonth() */ public function startOfYear() { - return $this->month(1)->startOfMonth(); + return $this->setDate($this->year, 1, 1)->startOfDay(); } /** @@ -2308,7 +4746,7 @@ public function startOfYear() */ public function endOfYear() { - return $this->month(static::MONTHS_PER_YEAR)->endOfMonth(); + return $this->setDate($this->year, 12, 31)->endOfDay(); } /** @@ -2318,7 +4756,9 @@ public function endOfYear() */ public function startOfDecade() { - return $this->startOfYear()->year($this->year - $this->year % static::YEARS_PER_DECADE); + $year = $this->year - $this->year % static::YEARS_PER_DECADE; + + return $this->setDate($year, 1, 1)->startOfDay(); } /** @@ -2328,7 +4768,9 @@ public function startOfDecade() */ public function endOfDecade() { - return $this->endOfYear()->year($this->year - $this->year % static::YEARS_PER_DECADE + static::YEARS_PER_DECADE - 1); + $year = $this->year - $this->year % static::YEARS_PER_DECADE + static::YEARS_PER_DECADE - 1; + + return $this->setDate($year, 12, 31)->endOfDay(); } /** @@ -2338,7 +4780,9 @@ public function endOfDecade() */ public function startOfCentury() { - return $this->startOfYear()->year($this->year - $this->year % static::YEARS_PER_CENTURY); + $year = $this->year - ($this->year - 1) % static::YEARS_PER_CENTURY; + + return $this->setDate($year, 1, 1)->startOfDay(); } /** @@ -2348,7 +4792,33 @@ public function startOfCentury() */ public function endOfCentury() { - return $this->endOfYear()->year($this->year - $this->year % static::YEARS_PER_CENTURY + static::YEARS_PER_CENTURY - 1); + $year = $this->year - 1 - ($this->year - 1) % static::YEARS_PER_CENTURY + static::YEARS_PER_CENTURY; + + return $this->setDate($year, 12, 31)->endOfDay(); + } + + /** + * Resets the date to the first day of the century and the time to 00:00:00 + * + * @return static + */ + public function startOfMillennium() + { + $year = $this->year - ($this->year - 1) % static::YEARS_PER_MILLENNIUM; + + return $this->setDate($year, 1, 1)->startOfDay(); + } + + /** + * Resets the date to end of the century and time to 23:59:59 + * + * @return static + */ + public function endOfMillennium() + { + $year = $this->year - 1 - ($this->year - 1) % static::YEARS_PER_MILLENNIUM + static::YEARS_PER_MILLENNIUM; + + return $this->setDate($year, 12, 31)->endOfDay(); } /** @@ -2358,8 +4828,8 @@ public function endOfCentury() */ public function startOfWeek() { - if ($this->dayOfWeek !== static::$weekStartsAt) { - $this->previous(static::$weekStartsAt); + while ($this->dayOfWeek !== static::$weekStartsAt) { + $this->subDay(); } return $this->startOfDay(); @@ -2372,17 +4842,87 @@ public function startOfWeek() */ public function endOfWeek() { - if ($this->dayOfWeek !== static::$weekEndsAt) { - $this->next(static::$weekEndsAt); + while ($this->dayOfWeek !== static::$weekEndsAt) { + $this->addDay(); } return $this->endOfDay(); } + /** + * Modify to start of current hour, minutes and seconds become 0 + * + * @return static + */ + public function startOfHour() + { + return $this->setTime($this->hour, 0, 0); + } + + /** + * Modify to end of current hour, minutes and seconds become 59 + * + * @return static + */ + public function endOfHour() + { + return $this->modify("$this->hour:59:59.999999"); + } + + /** + * Modify to start of current minute, seconds become 0 + * + * @return static + */ + public function startOfMinute() + { + return $this->setTime($this->hour, $this->minute, 0); + } + + /** + * Modify to end of current minute, seconds become 59 + * + * @return static + */ + public function endOfMinute() + { + return $this->modify("$this->hour:$this->minute:59.999999"); + } + + /** + * Modify to start of current minute, seconds become 0 + * + * @return static + */ + public function startOfSecond() + { + return $this->modify("$this->hour:$this->minute:$this->second.0"); + } + + /** + * Modify to end of current minute, seconds become 59 + * + * @return static + */ + public function endOfSecond() + { + return $this->modify("$this->hour:$this->minute:$this->second.999999"); + } + + /** + * Modify to midday, default to self::$midDayAt + * + * @return static + */ + public function midDay() + { + return $this->setTime(self::$midDayAt, 0, 0); + } + /** * Modify to the next occurrence of a given day of the week. * If no dayOfWeek is provided, modify to the next occurrence - * of the current day of the week. Use the supplied consts + * of the current day of the week. Use the supplied constants * to indicate the desired dayOfWeek, ex. static::MONDAY. * * @param int|null $dayOfWeek @@ -2398,10 +4938,69 @@ public function next($dayOfWeek = null) return $this->startOfDay()->modify('next '.static::$days[$dayOfWeek]); } + /** + * Go forward or backward to the next week- or weekend-day. + * + * @param bool $weekday + * @param bool $forward + * + * @return $this + */ + private function nextOrPreviousDay($weekday = true, $forward = true) + { + $step = $forward ? 1 : -1; + + do { + $this->addDay($step); + } while ($weekday ? $this->isWeekend() : $this->isWeekday()); + + return $this; + } + + /** + * Go forward to the next weekday. + * + * @return $this + */ + public function nextWeekday() + { + return $this->nextOrPreviousDay(); + } + + /** + * Go backward to the previous weekday. + * + * @return $this + */ + public function previousWeekday() + { + return $this->nextOrPreviousDay(true, false); + } + + /** + * Go forward to the next weekend day. + * + * @return $this + */ + public function nextWeekendDay() + { + return $this->nextOrPreviousDay(false); + } + + /** + * Go backward to the previous weekend day. + * + * @return $this + */ + public function previousWeekendDay() + { + return $this->nextOrPreviousDay(false, false); + } + /** * Modify to the previous occurrence of a given day of the week. * If no dayOfWeek is provided, modify to the previous occurrence - * of the current day of the week. Use the supplied consts + * of the current day of the week. Use the supplied constants * to indicate the desired dayOfWeek, ex. static::MONDAY. * * @param int|null $dayOfWeek @@ -2420,7 +5019,7 @@ public function previous($dayOfWeek = null) /** * Modify to the first occurrence of a given day of the week * in the current month. If no dayOfWeek is provided, modify to the - * first day of the current month. Use the supplied consts + * first day of the current month. Use the supplied constants * to indicate the desired dayOfWeek, ex. static::MONDAY. * * @param int|null $dayOfWeek @@ -2441,7 +5040,7 @@ public function firstOfMonth($dayOfWeek = null) /** * Modify to the last occurrence of a given day of the week * in the current month. If no dayOfWeek is provided, modify to the - * last day of the current month. Use the supplied consts + * last day of the current month. Use the supplied constants * to indicate the desired dayOfWeek, ex. static::MONDAY. * * @param int|null $dayOfWeek @@ -2463,7 +5062,7 @@ public function lastOfMonth($dayOfWeek = null) * Modify to the given occurrence of a given day of the week * in the current month. If the calculated occurrence is outside the scope * of the current month, then return false and no modifications are made. - * Use the supplied consts to indicate the desired dayOfWeek, ex. static::MONDAY. + * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. * * @param int $nth * @param int $dayOfWeek @@ -2472,48 +5071,48 @@ public function lastOfMonth($dayOfWeek = null) */ public function nthOfMonth($nth, $dayOfWeek) { - $dt = $this->copy()->firstOfMonth(); - $check = $dt->format('Y-m'); - $dt->modify('+'.$nth.' '.static::$days[$dayOfWeek]); + $date = $this->copy()->firstOfMonth(); + $check = $date->format('Y-m'); + $date->modify('+'.$nth.' '.static::$days[$dayOfWeek]); - return $dt->format('Y-m') === $check ? $this->modify($dt) : false; + return $date->format('Y-m') === $check ? $this->modify($date) : false; } /** * Modify to the first occurrence of a given day of the week * in the current quarter. If no dayOfWeek is provided, modify to the - * first day of the current quarter. Use the supplied consts + * first day of the current quarter. Use the supplied constants * to indicate the desired dayOfWeek, ex. static::MONDAY. * - * @param int|null $dayOfWeek + * @param int|null $dayOfWeek day of the week default null * * @return static */ public function firstOfQuarter($dayOfWeek = null) { - return $this->day(1)->month($this->quarter * 3 - 2)->firstOfMonth($dayOfWeek); + return $this->setDate($this->year, $this->quarter * static::MONTHS_PER_QUARTER - 2, 1)->firstOfMonth($dayOfWeek); } /** * Modify to the last occurrence of a given day of the week * in the current quarter. If no dayOfWeek is provided, modify to the - * last day of the current quarter. Use the supplied consts + * last day of the current quarter. Use the supplied constants * to indicate the desired dayOfWeek, ex. static::MONDAY. * - * @param int|null $dayOfWeek + * @param int|null $dayOfWeek day of the week default null * * @return static */ public function lastOfQuarter($dayOfWeek = null) { - return $this->day(1)->month($this->quarter * 3)->lastOfMonth($dayOfWeek); + return $this->setDate($this->year, $this->quarter * static::MONTHS_PER_QUARTER, 1)->lastOfMonth($dayOfWeek); } /** * Modify to the given occurrence of a given day of the week * in the current quarter. If the calculated occurrence is outside the scope * of the current quarter, then return false and no modifications are made. - * Use the supplied consts to indicate the desired dayOfWeek, ex. static::MONDAY. + * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. * * @param int $nth * @param int $dayOfWeek @@ -2522,21 +5121,21 @@ public function lastOfQuarter($dayOfWeek = null) */ public function nthOfQuarter($nth, $dayOfWeek) { - $dt = $this->copy()->day(1)->month($this->quarter * 3); - $lastMonth = $dt->month; - $year = $dt->year; - $dt->firstOfQuarter()->modify('+'.$nth.' '.static::$days[$dayOfWeek]); + $date = $this->copy()->day(1)->month($this->quarter * static::MONTHS_PER_QUARTER); + $lastMonth = $date->month; + $year = $date->year; + $date->firstOfQuarter()->modify('+'.$nth.' '.static::$days[$dayOfWeek]); - return ($lastMonth < $dt->month || $year !== $dt->year) ? false : $this->modify($dt); + return ($lastMonth < $date->month || $year !== $date->year) ? false : $this->modify($date); } /** * Modify to the first occurrence of a given day of the week * in the current year. If no dayOfWeek is provided, modify to the - * first day of the current year. Use the supplied consts + * first day of the current year. Use the supplied constants * to indicate the desired dayOfWeek, ex. static::MONDAY. * - * @param int|null $dayOfWeek + * @param int|null $dayOfWeek day of the week default null * * @return static */ @@ -2548,10 +5147,10 @@ public function firstOfYear($dayOfWeek = null) /** * Modify to the last occurrence of a given day of the week * in the current year. If no dayOfWeek is provided, modify to the - * last day of the current year. Use the supplied consts + * last day of the current year. Use the supplied constants * to indicate the desired dayOfWeek, ex. static::MONDAY. * - * @param int|null $dayOfWeek + * @param int|null $dayOfWeek day of the week default null * * @return static */ @@ -2564,7 +5163,7 @@ public function lastOfYear($dayOfWeek = null) * Modify to the given occurrence of a given day of the week * in the current year. If the calculated occurrence is outside the scope * of the current year, then return false and no modifications are made. - * Use the supplied consts to indicate the desired dayOfWeek, ex. static::MONDAY. + * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. * * @param int $nth * @param int $dayOfWeek @@ -2573,36 +5172,256 @@ public function lastOfYear($dayOfWeek = null) */ public function nthOfYear($nth, $dayOfWeek) { - $dt = $this->copy()->firstOfYear()->modify('+'.$nth.' '.static::$days[$dayOfWeek]); + $date = $this->copy()->firstOfYear()->modify('+'.$nth.' '.static::$days[$dayOfWeek]); - return $this->year === $dt->year ? $this->modify($dt) : false; + return $this->year === $date->year ? $this->modify($date) : false; } /** * Modify the current instance to the average of a given instance (default now) and the current instance. * - * @param Carbon|null $dt + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date * * @return static */ - public function average(Carbon $dt = null) + public function average($date = null) { - $dt = $dt ?: static::now($this->tz); + $date = $this->resolveCarbon($date); + $increment = $this->diffInRealSeconds($date, false) / 2; + $intIncrement = floor($increment); + $microIncrement = (int) (($date->micro - $this->micro) / 2 + 1000000 * ($increment - $intIncrement)); + $micro = (int) ($this->micro + $microIncrement); + while ($micro >= 1000000) { + $micro -= 1000000; + $intIncrement++; + } + $this->addSeconds($intIncrement); + + if (version_compare(PHP_VERSION, '7.1.8-dev', '>=')) { + $this->setTime($this->hour, $this->minute, $this->second, $micro); + } - return $this->addSeconds((int) ($this->diffInSeconds($dt, false) / 2)); + return $this; } + /////////////////////////////////////////////////////////////////// + /////////////////////////// SERIALIZATION ///////////////////////// + /////////////////////////////////////////////////////////////////// + /** - * Check if its the birthday. Compares the date/month values of the two dates. + * Return a serialized string of the instance. + * + * @return string + */ + public function serialize() + { + return serialize($this); + } + + /** + * Create an instance from a serialized string. + * + * @param string $value + * + * @throws \InvalidArgumentException + * + * @return static + */ + public static function fromSerialized($value) + { + $instance = @unserialize($value); + + if (!$instance instanceof static) { + throw new InvalidArgumentException('Invalid serialized value.'); + } + + return $instance; + } + + /** + * The __set_state handler. + * + * @param array $array + * + * @return static + */ + public static function __set_state($array) + { + return static::instance(parent::__set_state($array)); + } + + /** + * Prepare the object for JSON serialization. + * + * @return array|string + */ + public function jsonSerialize() + { + if (static::$serializer) { + return call_user_func(static::$serializer, $this); + } + + $carbon = $this; + + return call_user_func(function () use ($carbon) { + return get_object_vars($carbon); + }); + } + + /** + * JSON serialize all Carbon instances using the given callback. + * + * @param callable $callback + * + * @return void + */ + public static function serializeUsing($callback) + { + static::$serializer = $callback; + } + + /////////////////////////////////////////////////////////////////// + /////////////////////////////// MACRO ///////////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Register a custom macro. + * + * @param string $name + * @param object|callable $macro + * + * @return void + */ + public static function macro($name, $macro) + { + static::$localMacros[$name] = $macro; + } + + /** + * Remove all macros. + */ + public static function resetMacros() + { + static::$localMacros = array(); + } + + /** + * Mix another object into the class. + * + * @param object $mixin + * + * @return void + */ + public static function mixin($mixin) + { + $reflection = new \ReflectionClass($mixin); + $methods = $reflection->getMethods( + \ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED + ); + + foreach ($methods as $method) { + $method->setAccessible(true); + + static::macro($method->name, $method->invoke($mixin)); + } + } + + /** + * Checks if macro is registered. * - * @param Carbon|null $dt The instance to compare with or null to use current day. + * @param string $name * * @return bool */ - public function isBirthday(Carbon $dt = null) + public static function hasMacro($name) + { + return isset(static::$localMacros[$name]); + } + + /** + * Dynamically handle calls to the class. + * + * @param string $method + * @param array $parameters + * + * @throws \BadMethodCallException + * + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + if (!static::hasMacro($method)) { + throw new \BadMethodCallException("Method $method does not exist."); + } + + if (static::$localMacros[$method] instanceof Closure && method_exists('Closure', 'bind')) { + return call_user_func_array(Closure::bind(static::$localMacros[$method], null, get_called_class()), $parameters); + } + + return call_user_func_array(static::$localMacros[$method], $parameters); + } + + /** + * Dynamically handle calls to the class. + * + * @param string $method + * @param array $parameters + * + * @throws \BadMethodCallException|\ReflectionException + * + * @return mixed + */ + public function __call($method, $parameters) + { + if (!static::hasMacro($method)) { + throw new \BadMethodCallException("Method $method does not exist."); + } + + $macro = static::$localMacros[$method]; + + $reflexion = new \ReflectionFunction($macro); + $reflectionParameters = $reflexion->getParameters(); + $expectedCount = count($reflectionParameters); + $actualCount = count($parameters); + if ($expectedCount > $actualCount && $reflectionParameters[$expectedCount - 1]->name === 'self') { + for ($i = $actualCount; $i < $expectedCount - 1; $i++) { + $parameters[] = $reflectionParameters[$i]->getDefaultValue(); + } + $parameters[] = $this; + } + + if ($macro instanceof Closure && method_exists($macro, 'bindTo')) { + return call_user_func_array($macro->bindTo($this, get_class($this)), $parameters); + } + + return call_user_func_array($macro, $parameters); + } + + /** + * Show truthy properties on var_dump(). + * + * @return array + */ + public function __debugInfo() + { + return array_filter(get_object_vars($this), function ($var) { + return $var; + }); + } + + /** + * Cast the current instance into the given class. + * + * @param string $className The $className::instance() method will be called to cast the current object. + * + * @return object + */ + public function cast($className) { - $dt = $dt ?: static::now($this->tz); + if (!method_exists($className, 'instance')) { + throw new \InvalidArgumentException("$className has not the instance() method needed to cast the date."); + } - return $this->format('md') === $dt->format('md'); + return $className::instance($this); } } diff --git a/application/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php b/application/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php index 05f00a4..e8c6032 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php +++ b/application/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php @@ -11,15 +11,17 @@ namespace Carbon; +use Closure; use DateInterval; use InvalidArgumentException; -use Symfony\Component\Translation\Translator; +use ReflectionClass; +use ReflectionFunction; +use ReflectionMethod; use Symfony\Component\Translation\TranslatorInterface; -use Symfony\Component\Translation\Loader\ArrayLoader; /** * A simple API extension for DateInterval. - * The implemenation provides helpers to handle weeks but only days are saved. + * The implementation provides helpers to handle weeks but only days are saved. * Weeks are calculated based on the total days of the current instance. * * @property int $years Total years of the current interval. @@ -29,9 +31,16 @@ * @property int $hours Total hours of the current interval. * @property int $minutes Total minutes of the current interval. * @property int $seconds Total seconds of the current interval. - * - * @property-read integer $dayzExcludeWeeks Total days remaining in the final week of the current instance (days % 7). - * @property-read integer $daysExcludeWeeks alias of dayzExcludeWeeks + * @property-read int $dayzExcludeWeeks Total days remaining in the final week of the current instance (days % 7). + * @property-read int $daysExcludeWeeks alias of dayzExcludeWeeks + * @property-read float $totalYears Number of years equivalent to the interval. + * @property-read float $totalMonths Number of months equivalent to the interval. + * @property-read float $totalWeeks Number of weeks equivalent to the interval. + * @property-read float $totalDays Number of days equivalent to the interval. + * @property-read float $totalDayz Alias for totalDays. + * @property-read float $totalHours Number of hours equivalent to the interval. + * @property-read float $totalMinutes Number of minutes equivalent to the interval. + * @property-read float $totalSeconds Number of seconds equivalent to the interval. * * @method static CarbonInterval years($years = 1) Create instance specifying a number of years. * @method static CarbonInterval year($years = 1) Alias for years() @@ -48,21 +57,21 @@ * @method static CarbonInterval minute($minutes = 1) Alias for minutes() * @method static CarbonInterval seconds($seconds = 1) Create instance specifying a number of seconds. * @method static CarbonInterval second($seconds = 1) Alias for seconds() - * @method CarbonInterval years() years($years = 1) Set the years portion of the current interval. - * @method CarbonInterval year() year($years = 1) Alias for years(). - * @method CarbonInterval months() months($months = 1) Set the months portion of the current interval. - * @method CarbonInterval month() month($months = 1) Alias for months(). - * @method CarbonInterval weeks() weeks($weeks = 1) Set the weeks portion of the current interval. Will overwrite dayz value. - * @method CarbonInterval week() week($weeks = 1) Alias for weeks(). - * @method CarbonInterval days() days($days = 1) Set the days portion of the current interval. - * @method CarbonInterval dayz() dayz($days = 1) Alias for days(). - * @method CarbonInterval day() day($days = 1) Alias for days(). - * @method CarbonInterval hours() hours($hours = 1) Set the hours portion of the current interval. - * @method CarbonInterval hour() hour($hours = 1) Alias for hours(). - * @method CarbonInterval minutes() minutes($minutes = 1) Set the minutes portion of the current interval. - * @method CarbonInterval minute() minute($minutes = 1) Alias for minutes(). - * @method CarbonInterval seconds() seconds($seconds = 1) Set the seconds portion of the current interval. - * @method CarbonInterval second() second($seconds = 1) Alias for seconds(). + * @method CarbonInterval years($years = 1) Set the years portion of the current interval. + * @method CarbonInterval year($years = 1) Alias for years(). + * @method CarbonInterval months($months = 1) Set the months portion of the current interval. + * @method CarbonInterval month($months = 1) Alias for months(). + * @method CarbonInterval weeks($weeks = 1) Set the weeks portion of the current interval. Will overwrite dayz value. + * @method CarbonInterval week($weeks = 1) Alias for weeks(). + * @method CarbonInterval days($days = 1) Set the days portion of the current interval. + * @method CarbonInterval dayz($days = 1) Alias for days(). + * @method CarbonInterval day($days = 1) Alias for days(). + * @method CarbonInterval hours($hours = 1) Set the hours portion of the current interval. + * @method CarbonInterval hour($hours = 1) Alias for hours(). + * @method CarbonInterval minutes($minutes = 1) Set the minutes portion of the current interval. + * @method CarbonInterval minute($minutes = 1) Alias for minutes(). + * @method CarbonInterval seconds($seconds = 1) Set the seconds portion of the current interval. + * @method CarbonInterval second($seconds = 1) Alias for seconds(). */ class CarbonInterval extends DateInterval { @@ -81,16 +90,81 @@ class CarbonInterval extends DateInterval /** * A translator to ... er ... translate stuff * - * @var TranslatorInterface + * @var \Symfony\Component\Translation\TranslatorInterface */ protected static $translator; + /** + * @var array|null + */ + protected static $cascadeFactors; + + /** + * @var array|null + */ + private static $flipCascadeFactors; + + /** + * The registered macros. + * + * @var array + */ + protected static $macros = array(); + /** * Before PHP 5.4.20/5.5.4 instead of FALSE days will be set to -99999 when the interval instance - * was created by DateTime:diff(). + * was created by DateTime::diff(). */ const PHP_DAYS_FALSE = -99999; + /** + * Mapping of units and factors for cascading. + * + * Should only be modified by changing the factors or referenced constants. + * + * @return array + */ + public static function getCascadeFactors() + { + return static::$cascadeFactors ?: array( + 'minutes' => array(Carbon::SECONDS_PER_MINUTE, 'seconds'), + 'hours' => array(Carbon::MINUTES_PER_HOUR, 'minutes'), + 'dayz' => array(Carbon::HOURS_PER_DAY, 'hours'), + 'months' => array(Carbon::DAYS_PER_WEEK * Carbon::WEEKS_PER_MONTH, 'dayz'), + 'years' => array(Carbon::MONTHS_PER_YEAR, 'months'), + ); + } + + private static function standardizeUnit($unit) + { + $unit = rtrim($unit, 'sz').'s'; + + return $unit === 'days' ? 'dayz' : $unit; + } + + private static function getFlipCascadeFactors() + { + if (!self::$flipCascadeFactors) { + self::$flipCascadeFactors = array(); + foreach (static::getCascadeFactors() as $to => $tuple) { + list($factor, $from) = $tuple; + + self::$flipCascadeFactors[self::standardizeUnit($from)] = array(self::standardizeUnit($to), $factor); + } + } + + return self::$flipCascadeFactors; + } + + /** + * @param array $cascadeFactors + */ + public static function setCascadeFactors(array $cascadeFactors) + { + self::$flipCascadeFactors = null; + static::$cascadeFactors = $cascadeFactors; + } + /** * Determine if the interval was created via DateTime:diff() or not. * @@ -120,32 +194,99 @@ private static function wasCreatedFromDiff(DateInterval $interval) */ public function __construct($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null) { - $spec = static::PERIOD_PREFIX; + $spec = $years; - $spec .= $years > 0 ? $years.static::PERIOD_YEARS : ''; - $spec .= $months > 0 ? $months.static::PERIOD_MONTHS : ''; + if (!is_string($spec) || floatval($years) || preg_match('/^[0-9.]/', $years)) { + $spec = static::PERIOD_PREFIX; - $specDays = 0; - $specDays += $weeks > 0 ? $weeks * Carbon::DAYS_PER_WEEK : 0; - $specDays += $days > 0 ? $days : 0; + $spec .= $years > 0 ? $years.static::PERIOD_YEARS : ''; + $spec .= $months > 0 ? $months.static::PERIOD_MONTHS : ''; - $spec .= $specDays > 0 ? $specDays.static::PERIOD_DAYS : ''; + $specDays = 0; + $specDays += $weeks > 0 ? $weeks * static::getDaysPerWeek() : 0; + $specDays += $days > 0 ? $days : 0; - if ($hours > 0 || $minutes > 0 || $seconds > 0) { - $spec .= static::PERIOD_TIME_PREFIX; - $spec .= $hours > 0 ? $hours.static::PERIOD_HOURS : ''; - $spec .= $minutes > 0 ? $minutes.static::PERIOD_MINUTES : ''; - $spec .= $seconds > 0 ? $seconds.static::PERIOD_SECONDS : ''; - } + $spec .= $specDays > 0 ? $specDays.static::PERIOD_DAYS : ''; + + if ($hours > 0 || $minutes > 0 || $seconds > 0) { + $spec .= static::PERIOD_TIME_PREFIX; + $spec .= $hours > 0 ? $hours.static::PERIOD_HOURS : ''; + $spec .= $minutes > 0 ? $minutes.static::PERIOD_MINUTES : ''; + $spec .= $seconds > 0 ? $seconds.static::PERIOD_SECONDS : ''; + } - if ($spec === static::PERIOD_PREFIX) { - // Allow the zero interval. - $spec .= '0'.static::PERIOD_YEARS; + if ($spec === static::PERIOD_PREFIX) { + // Allow the zero interval. + $spec .= '0'.static::PERIOD_YEARS; + } } parent::__construct($spec); } + /** + * Returns the factor for a given source-to-target couple. + * + * @param string $source + * @param string $target + * + * @return int|null + */ + public static function getFactor($source, $target) + { + $source = self::standardizeUnit($source); + $target = self::standardizeUnit($target); + $factors = static::getFlipCascadeFactors(); + if (isset($factors[$source])) { + list($to, $factor) = $factors[$source]; + if ($to === $target) { + return $factor; + } + } + + return null; + } + + /** + * Returns current config for days per week. + * + * @return int + */ + public static function getDaysPerWeek() + { + return static::getFactor('dayz', 'weeks') ?: Carbon::DAYS_PER_WEEK; + } + + /** + * Returns current config for hours per day. + * + * @return int + */ + public static function getHoursPerDay() + { + return static::getFactor('hours', 'dayz') ?: Carbon::HOURS_PER_DAY; + } + + /** + * Returns current config for minutes per hour. + * + * @return int + */ + public static function getMinutesPerHours() + { + return static::getFactor('minutes', 'hours') ?: Carbon::MINUTES_PER_HOUR; + } + + /** + * Returns current config for seconds per minute. + * + * @return int + */ + public static function getSecondsPerMinutes() + { + return static::getFactor('seconds', 'minutes') ?: Carbon::SECONDS_PER_MINUTE; + } + /** * Create a new CarbonInterval instance from specific values. * This is an alias for the constructor that allows better fluent @@ -167,6 +308,19 @@ public static function create($years = 1, $months = null, $weeks = null, $days = return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds); } + /** + * Get a copy of the instance. + * + * @return static + */ + public function copy() + { + $date = new static($this->spec()); + $date->invert = $this->invert; + + return $date; + } + /** * Provide static helpers to create instances. Allows CarbonInterval::years(3). * @@ -212,6 +366,123 @@ public static function __callStatic($name, $args) case 'second': return new static(null, null, null, null, null, null, $arg); } + + if (static::hasMacro($name)) { + return call_user_func_array( + array(new static(0), $name), $args + ); + } + } + + /** + * Creates a CarbonInterval from string. + * + * Format: + * + * Suffix | Unit | Example | DateInterval expression + * -------|---------|---------|------------------------ + * y | years | 1y | P1Y + * mo | months | 3mo | P3M + * w | weeks | 2w | P2W + * d | days | 28d | P28D + * h | hours | 4h | PT4H + * m | minutes | 12m | PT12M + * s | seconds | 59s | PT59S + * + * e. g. `1w 3d 4h 32m 23s` is converted to 10 days 4 hours 32 minutes and 23 seconds. + * + * Special cases: + * - An empty string will return a zero interval + * - Fractions are allowed for weeks, days, hours and minutes and will be converted + * and rounded to the next smaller value (caution: 0.5w = 4d) + * + * @param string $intervalDefinition + * + * @return static + */ + public static function fromString($intervalDefinition) + { + if (empty($intervalDefinition)) { + return new static(0); + } + + $years = 0; + $months = 0; + $weeks = 0; + $days = 0; + $hours = 0; + $minutes = 0; + $seconds = 0; + + $pattern = '/(\d+(?:\.\d+)?)\h*([^\d\h]*)/i'; + preg_match_all($pattern, $intervalDefinition, $parts, PREG_SET_ORDER); + while ($match = array_shift($parts)) { + list($part, $value, $unit) = $match; + $intValue = intval($value); + $fraction = floatval($value) - $intValue; + switch (strtolower($unit)) { + case 'year': + case 'years': + case 'y': + $years += $intValue; + break; + + case 'month': + case 'months': + case 'mo': + $months += $intValue; + break; + + case 'week': + case 'weeks': + case 'w': + $weeks += $intValue; + if ($fraction) { + $parts[] = array(null, $fraction * static::getDaysPerWeek(), 'd'); + } + break; + + case 'day': + case 'days': + case 'd': + $days += $intValue; + if ($fraction) { + $parts[] = array(null, $fraction * static::getHoursPerDay(), 'h'); + } + break; + + case 'hour': + case 'hours': + case 'h': + $hours += $intValue; + if ($fraction) { + $parts[] = array(null, $fraction * static::getMinutesPerHours(), 'm'); + } + break; + + case 'minute': + case 'minutes': + case 'm': + $minutes += $intValue; + if ($fraction) { + $seconds += round($fraction * static::getSecondsPerMinutes()); + } + break; + + case 'second': + case 'seconds': + case 's': + $seconds += $intValue; + break; + + default: + throw new InvalidArgumentException( + sprintf('Invalid part %s in definition %s', $part, $intervalDefinition) + ); + } + } + + return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds); } /** @@ -219,49 +490,82 @@ public static function __callStatic($name, $args) * DateInterval objects created from DateTime::diff() as you can't externally * set the $days field. * - * @param DateInterval $di + * Pass false as second argument to get a microseconds-precise interval. Else + * microseconds in the original interval will not be kept. * - * @throws InvalidArgumentException + * @param DateInterval $di + * @param bool $trimMicroseconds (true by default) * * @return static */ - public static function instance(DateInterval $di) + public static function instance(DateInterval $di, $trimMicroseconds = true) { - if (static::wasCreatedFromDiff($di)) { - throw new InvalidArgumentException("Can not instance a DateInterval object created from DateTime::diff()."); + $microseconds = $trimMicroseconds || version_compare(PHP_VERSION, '7.1.0-dev', '<') ? 0 : $di->f; + $instance = new static(static::getDateIntervalSpec($di)); + if ($microseconds) { + $instance->f = $microseconds; } - - $instance = new static($di->y, $di->m, 0, $di->d, $di->h, $di->i, $di->s); $instance->invert = $di->invert; - $instance->days = $di->days; + foreach (array('y', 'm', 'd', 'h', 'i', 's') as $unit) { + if ($di->$unit < 0) { + $instance->$unit *= -1; + } + } return $instance; } + /** + * Make a CarbonInterval instance from given variable if possible. + * + * Always return a new instance. Parse only strings and only these likely to be intervals (skip dates + * and recurrences). Throw an exception for invalid format, but otherwise return null. + * + * @param mixed $var + * + * @return static|null + */ + public static function make($var) + { + if ($var instanceof DateInterval) { + return static::instance($var); + } + + if (is_string($var)) { + $var = trim($var); + + if (substr($var, 0, 1) === 'P') { + return new static($var); + } + + if (preg_match('/^(?:\h*\d+(?:\.\d+)?\h*[a-z]+)+$/i', $var)) { + return static::fromString($var); + } + } + } + /////////////////////////////////////////////////////////////////// /////////////////////// LOCALIZATION ////////////////////////////// /////////////////////////////////////////////////////////////////// /** - * Intialize the translator instance if necessary. + * Initialize the translator instance if necessary. * - * @return TranslatorInterface + * @return \Symfony\Component\Translation\TranslatorInterface */ protected static function translator() { if (static::$translator === null) { - static::$translator = new Translator('en'); - static::$translator->addLoader('array', new ArrayLoader()); - static::setLocale('en'); + static::$translator = Translator::get(); } return static::$translator; } /** - * Get the translator instance in use + * Get the translator instance in use. * - * @return TranslatorInterface + * @return \Symfony\Component\Translation\TranslatorInterface */ public static function getTranslator() { @@ -269,7 +573,7 @@ public static function getTranslator() } /** - * Set the translator instance to use + * Set the translator instance to use. * * @param TranslatorInterface $translator */ @@ -279,7 +583,7 @@ public static function setTranslator(TranslatorInterface $translator) } /** - * Get the current translator locale + * Get the current translator locale. * * @return string */ @@ -289,16 +593,13 @@ public static function getLocale() } /** - * Set the current translator locale + * Set the current translator locale. * * @param string $locale */ public static function setLocale($locale) { - static::translator()->setLocale($locale); - - // Ensure the locale has been loaded. - static::translator()->addResource('array', require __DIR__.'/Lang/'.$locale.'.php', $locale); + return static::translator()->setLocale($locale) !== false; } /////////////////////////////////////////////////////////////////// @@ -306,16 +607,20 @@ public static function setLocale($locale) /////////////////////////////////////////////////////////////////// /** - * Get a part of the CarbonInterval object + * Get a part of the CarbonInterval object. * * @param string $name * - * @throws InvalidArgumentException + * @throws \InvalidArgumentException * - * @return int + * @return int|float */ public function __get($name) { + if (substr($name, 0, 5) === 'total') { + return $this->total(substr($name, 5)); + } + switch ($name) { case 'years': return $this->y; @@ -336,11 +641,11 @@ public function __get($name) return $this->s; case 'weeks': - return (int)floor($this->d / Carbon::DAYS_PER_WEEK); + return (int) floor($this->d / static::getDaysPerWeek()); case 'daysExcludeWeeks': case 'dayzExcludeWeeks': - return $this->d % Carbon::DAYS_PER_WEEK; + return $this->d % static::getDaysPerWeek(); default: throw new InvalidArgumentException(sprintf("Unknown getter '%s'", $name)); @@ -348,12 +653,12 @@ public function __get($name) } /** - * Set a part of the CarbonInterval object + * Set a part of the CarbonInterval object. * * @param string $name * @param int $val * - * @throws InvalidArgumentException + * @throws \InvalidArgumentException */ public function __set($name, $val) { @@ -367,7 +672,7 @@ public function __set($name, $val) break; case 'weeks': - $this->d = $val * Carbon::DAYS_PER_WEEK; + $this->d = $val * static::getDaysPerWeek(); break; case 'dayz': @@ -398,11 +703,102 @@ public function __set($name, $val) */ public function weeksAndDays($weeks, $days) { - $this->dayz = ($weeks * Carbon::DAYS_PER_WEEK) + $days; + $this->dayz = ($weeks * static::getDaysPerWeek()) + $days; return $this; } + /** + * Register a custom macro. + * + * @param string $name + * @param object|callable $macro + * + * @return void + */ + public static function macro($name, $macro) + { + static::$macros[$name] = $macro; + } + + /** + * Remove all macros. + */ + public static function resetMacros() + { + static::$macros = array(); + } + + /** + * Register macros from a mixin object. + * + * @param object $mixin + * + * @throws \ReflectionException + * + * @return void + */ + public static function mixin($mixin) + { + $reflection = new ReflectionClass($mixin); + + $methods = $reflection->getMethods( + ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED + ); + + foreach ($methods as $method) { + $method->setAccessible(true); + + static::macro($method->name, $method->invoke($mixin)); + } + } + + /** + * Check if macro is registered. + * + * @param string $name + * + * @return bool + */ + public static function hasMacro($name) + { + return isset(static::$macros[$name]); + } + + /** + * Call given macro. + * + * @param string $name + * @param array $parameters + * + * @return mixed + */ + protected function callMacro($name, $parameters) + { + $macro = static::$macros[$name]; + + $reflection = new ReflectionFunction($macro); + + $reflectionParameters = $reflection->getParameters(); + + $expectedCount = count($reflectionParameters); + $actualCount = count($parameters); + + if ($expectedCount > $actualCount && $reflectionParameters[$expectedCount - 1]->name === 'self') { + for ($i = $actualCount; $i < $expectedCount - 1; $i++) { + $parameters[] = $reflectionParameters[$i]->getDefaultValue(); + } + + $parameters[] = $this; + } + + if ($macro instanceof Closure && method_exists($macro, 'bindTo')) { + $macro = $macro->bindTo($this, get_class($this)); + } + + return call_user_func_array($macro, $parameters); + } + /** * Allow fluent calls on the setters... CarbonInterval::years(3)->months(5)->day(). * @@ -416,6 +812,10 @@ public function weeksAndDays($weeks, $days) */ public function __call($name, $args) { + if (static::hasMacro($name)) { + return $this->callMacro($name, $args); + } + $arg = count($args) === 0 ? 1 : $args[0]; switch ($name) { @@ -431,7 +831,7 @@ public function __call($name, $args) case 'weeks': case 'week': - $this->dayz = $arg * Carbon::DAYS_PER_WEEK; + $this->dayz = $arg * static::getDaysPerWeek(); break; case 'days': @@ -462,24 +862,27 @@ public function __call($name, $args) /** * Get the current interval in a human readable format in the current locale. * + * @param bool $short (false by default), returns short units if true + * * @return string */ - public function forHumans() + public function forHumans($short = false) { $periods = array( - 'year' => $this->years, - 'month' => $this->months, - 'week' => $this->weeks, - 'day' => $this->daysExcludeWeeks, - 'hour' => $this->hours, - 'minute' => $this->minutes, - 'second' => $this->seconds, + 'year' => array('y', $this->years), + 'month' => array('m', $this->months), + 'week' => array('w', $this->weeks), + 'day' => array('d', $this->daysExcludeWeeks), + 'hour' => array('h', $this->hours), + 'minute' => array('min', $this->minutes), + 'second' => array('s', $this->seconds), ); $parts = array(); - foreach ($periods as $unit => $count) { + foreach ($periods as $unit => $options) { + list($shortUnit, $count) = $options; if ($count > 0) { - array_push($parts, static::translator()->transChoice($unit, $count, array(':count' => $count))); + $parts[] = static::translator()->transChoice($short ? $shortUnit : $unit, $count, array(':count' => $count)); } } @@ -497,7 +900,31 @@ public function __toString() } /** - * Add the passed interval to the current instance + * Convert the interval to a CarbonPeriod. + * + * @return CarbonPeriod + */ + public function toPeriod() + { + return CarbonPeriod::createFromArray( + array_merge(array($this), func_get_args()) + ); + } + + /** + * Invert the interval. + * + * @return $this + */ + public function invert() + { + $this->invert = $this->invert ? 0 : 1; + + return $this; + } + + /** + * Add the passed interval to the current instance. * * @param DateInterval $interval * @@ -505,19 +932,232 @@ public function __toString() */ public function add(DateInterval $interval) { - $sign = $interval->invert === 1 ? -1 : 1; + $sign = ($this->invert === 1) !== ($interval->invert === 1) ? -1 : 1; if (static::wasCreatedFromDiff($interval)) { - $this->dayz = $this->dayz + $interval->days * $sign; + $this->dayz += $interval->days * $sign; } else { - $this->years = $this->years + $interval->y * $sign; - $this->months = $this->months + $interval->m * $sign; - $this->dayz = $this->dayz + $interval->d * $sign; - $this->hours = $this->hours + $interval->h * $sign; - $this->minutes = $this->minutes + $interval->i * $sign; - $this->seconds = $this->seconds + $interval->s * $sign; + $this->years += $interval->y * $sign; + $this->months += $interval->m * $sign; + $this->dayz += $interval->d * $sign; + $this->hours += $interval->h * $sign; + $this->minutes += $interval->i * $sign; + $this->seconds += $interval->s * $sign; + } + + if (($this->years || $this->months || $this->dayz || $this->hours || $this->minutes || $this->seconds) && + $this->years <= 0 && $this->months <= 0 && $this->dayz <= 0 && $this->hours <= 0 && $this->minutes <= 0 && $this->seconds <= 0 + ) { + $this->years *= -1; + $this->months *= -1; + $this->dayz *= -1; + $this->hours *= -1; + $this->minutes *= -1; + $this->seconds *= -1; + $this->invert(); } return $this; } + + /** + * Multiply current instance given number of times + * + * @param float $factor + * + * @return $this + */ + public function times($factor) + { + if ($factor < 0) { + $this->invert = $this->invert ? 0 : 1; + $factor = -$factor; + } + + $this->years = (int) round($this->years * $factor); + $this->months = (int) round($this->months * $factor); + $this->dayz = (int) round($this->dayz * $factor); + $this->hours = (int) round($this->hours * $factor); + $this->minutes = (int) round($this->minutes * $factor); + $this->seconds = (int) round($this->seconds * $factor); + + return $this; + } + + /** + * Get the interval_spec string of a date interval. + * + * @param DateInterval $interval + * + * @return string + */ + public static function getDateIntervalSpec(DateInterval $interval) + { + $date = array_filter(array( + static::PERIOD_YEARS => abs($interval->y), + static::PERIOD_MONTHS => abs($interval->m), + static::PERIOD_DAYS => abs($interval->d), + )); + + $time = array_filter(array( + static::PERIOD_HOURS => abs($interval->h), + static::PERIOD_MINUTES => abs($interval->i), + static::PERIOD_SECONDS => abs($interval->s), + )); + + $specString = static::PERIOD_PREFIX; + + foreach ($date as $key => $value) { + $specString .= $value.$key; + } + + if (count($time) > 0) { + $specString .= static::PERIOD_TIME_PREFIX; + foreach ($time as $key => $value) { + $specString .= $value.$key; + } + } + + return $specString === static::PERIOD_PREFIX ? 'PT0S' : $specString; + } + + /** + * Get the interval_spec string. + * + * @return string + */ + public function spec() + { + return static::getDateIntervalSpec($this); + } + + /** + * Comparing 2 date intervals. + * + * @param DateInterval $a + * @param DateInterval $b + * + * @return int + */ + public static function compareDateIntervals(DateInterval $a, DateInterval $b) + { + $current = Carbon::now(); + $passed = $current->copy()->add($b); + $current->add($a); + + if ($current < $passed) { + return -1; + } + if ($current > $passed) { + return 1; + } + + return 0; + } + + /** + * Comparing with passed interval. + * + * @param DateInterval $interval + * + * @return int + */ + public function compare(DateInterval $interval) + { + return static::compareDateIntervals($this, $interval); + } + + /** + * Convert overflowed values into bigger units. + * + * @return $this + */ + public function cascade() + { + foreach (static::getFlipCascadeFactors() as $source => $cascade) { + list($target, $factor) = $cascade; + + if ($source === 'dayz' && $target === 'weeks') { + continue; + } + + $value = $this->$source; + $this->$source = $modulo = $value % $factor; + $this->$target += ($value - $modulo) / $factor; + } + + return $this; + } + + /** + * Get amount of given unit equivalent to the interval. + * + * @param string $unit + * + * @throws \InvalidArgumentException + * + * @return float + */ + public function total($unit) + { + $realUnit = $unit = strtolower($unit); + + if (in_array($unit, array('days', 'weeks'))) { + $realUnit = 'dayz'; + } elseif (!in_array($unit, array('seconds', 'minutes', 'hours', 'dayz', 'months', 'years'))) { + throw new InvalidArgumentException("Unknown unit '$unit'."); + } + + $result = 0; + $cumulativeFactor = 0; + $unitFound = false; + + foreach (static::getFlipCascadeFactors() as $source => $cascade) { + list($target, $factor) = $cascade; + + if ($source === $realUnit) { + $unitFound = true; + $result += $this->$source; + $cumulativeFactor = 1; + } + + if ($factor === false) { + if ($unitFound) { + break; + } + + $result = 0; + $cumulativeFactor = 0; + + continue; + } + + if ($target === $realUnit) { + $unitFound = true; + } + + if ($cumulativeFactor) { + $cumulativeFactor *= $factor; + $result += $this->$target * $cumulativeFactor; + + continue; + } + + $result = ($result + $this->$source) / $factor; + } + + if (isset($target) && !$cumulativeFactor) { + $result += $this->$target; + } + + if (!$unitFound) { + throw new \InvalidArgumentException("Unit $unit have no configuration to get total from other units."); + } + + if ($unit === 'weeks') { + return $result / static::getDaysPerWeek(); + } + + return $result; + } } diff --git a/application/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php b/application/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php new file mode 100644 index 0000000..808e9d6 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php @@ -0,0 +1,1453 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use BadMethodCallException; +use Closure; +use Countable; +use DateInterval; +use DateTime; +use DateTimeInterface; +use InvalidArgumentException; +use Iterator; +use ReflectionClass; +use ReflectionFunction; +use ReflectionMethod; +use RuntimeException; + +/** + * Substitution of DatePeriod with some modifications and many more features. + * Fully compatible with PHP 5.3+! + * + * @method static CarbonPeriod start($date, $inclusive = null) Create instance specifying start date. + * @method static CarbonPeriod since($date, $inclusive = null) Alias for start(). + * @method static CarbonPeriod sinceNow($inclusive = null) Create instance with start date set to now. + * @method static CarbonPeriod end($date = null, $inclusive = null) Create instance specifying end date. + * @method static CarbonPeriod until($date = null, $inclusive = null) Alias for end(). + * @method static CarbonPeriod untilNow($inclusive = null) Create instance with end date set to now. + * @method static CarbonPeriod dates($start, $end = null) Create instance with start and end date. + * @method static CarbonPeriod between($start, $end = null) Create instance with start and end date. + * @method static CarbonPeriod recurrences($recurrences = null) Create instance with maximum number of recurrences. + * @method static CarbonPeriod times($recurrences = null) Alias for recurrences(). + * @method static CarbonPeriod options($options = null) Create instance with options. + * @method static CarbonPeriod toggle($options, $state = null) Create instance with options toggled on or off. + * @method static CarbonPeriod filter($callback, $name = null) Create instance with filter added to the stack. + * @method static CarbonPeriod push($callback, $name = null) Alias for filter(). + * @method static CarbonPeriod prepend($callback, $name = null) Create instance with filter prepened to the stack. + * @method static CarbonPeriod filters(array $filters) Create instance with filters stack. + * @method static CarbonPeriod interval($interval) Create instance with given date interval. + * @method static CarbonPeriod each($interval) Create instance with given date interval. + * @method static CarbonPeriod every($interval) Create instance with given date interval. + * @method static CarbonPeriod step($interval) Create instance with given date interval. + * @method static CarbonPeriod stepBy($interval) Create instance with given date interval. + * @method static CarbonPeriod invert() Create instance with inverted date interval. + * @method static CarbonPeriod years($years = 1) Create instance specifying a number of years for date interval. + * @method static CarbonPeriod year($years = 1) Alias for years(). + * @method static CarbonPeriod months($months = 1) Create instance specifying a number of months for date interval. + * @method static CarbonPeriod month($months = 1) Alias for months(). + * @method static CarbonPeriod weeks($weeks = 1) Create instance specifying a number of weeks for date interval. + * @method static CarbonPeriod week($weeks = 1) Alias for weeks(). + * @method static CarbonPeriod days($days = 1) Create instance specifying a number of days for date interval. + * @method static CarbonPeriod dayz($days = 1) Alias for days(). + * @method static CarbonPeriod day($days = 1) Alias for days(). + * @method static CarbonPeriod hours($hours = 1) Create instance specifying a number of hours for date interval. + * @method static CarbonPeriod hour($hours = 1) Alias for hours(). + * @method static CarbonPeriod minutes($minutes = 1) Create instance specifying a number of minutes for date interval. + * @method static CarbonPeriod minute($minutes = 1) Alias for minutes(). + * @method static CarbonPeriod seconds($seconds = 1) Create instance specifying a number of seconds for date interval. + * @method static CarbonPeriod second($seconds = 1) Alias for seconds(). + * @method CarbonPeriod start($date, $inclusive = null) Change the period start date. + * @method CarbonPeriod since($date, $inclusive = null) Alias for start(). + * @method CarbonPeriod sinceNow($inclusive = null) Change the period start date to now. + * @method CarbonPeriod end($date = null, $inclusive = null) Change the period end date. + * @method CarbonPeriod until($date = null, $inclusive = null) Alias for end(). + * @method CarbonPeriod untilNow($inclusive = null) Change the period end date to now. + * @method CarbonPeriod dates($start, $end = null) Change the period start and end date. + * @method CarbonPeriod recurrences($recurrences = null) Change the maximum number of recurrences. + * @method CarbonPeriod times($recurrences = null) Alias for recurrences(). + * @method CarbonPeriod options($options = null) Change the period options. + * @method CarbonPeriod toggle($options, $state = null) Toggle given options on or off. + * @method CarbonPeriod filter($callback, $name = null) Add a filter to the stack. + * @method CarbonPeriod push($callback, $name = null) Alias for filter(). + * @method CarbonPeriod prepend($callback, $name = null) Prepend a filter to the stack. + * @method CarbonPeriod filters(array $filters = array()) Set filters stack. + * @method CarbonPeriod interval($interval) Change the period date interval. + * @method CarbonPeriod invert() Invert the period date interval. + * @method CarbonPeriod years($years = 1) Set the years portion of the date interval. + * @method CarbonPeriod year($years = 1) Alias for years(). + * @method CarbonPeriod months($months = 1) Set the months portion of the date interval. + * @method CarbonPeriod month($months = 1) Alias for months(). + * @method CarbonPeriod weeks($weeks = 1) Set the weeks portion of the date interval. + * @method CarbonPeriod week($weeks = 1) Alias for weeks(). + * @method CarbonPeriod days($days = 1) Set the days portion of the date interval. + * @method CarbonPeriod dayz($days = 1) Alias for days(). + * @method CarbonPeriod day($days = 1) Alias for days(). + * @method CarbonPeriod hours($hours = 1) Set the hours portion of the date interval. + * @method CarbonPeriod hour($hours = 1) Alias for hours(). + * @method CarbonPeriod minutes($minutes = 1) Set the minutes portion of the date interval. + * @method CarbonPeriod minute($minutes = 1) Alias for minutes(). + * @method CarbonPeriod seconds($seconds = 1) Set the seconds portion of the date interval. + * @method CarbonPeriod second($seconds = 1) Alias for seconds(). + */ +class CarbonPeriod implements Iterator, Countable +{ + /** + * Built-in filters. + * + * @var string + */ + const RECURRENCES_FILTER = 'Carbon\CarbonPeriod::filterRecurrences'; + const END_DATE_FILTER = 'Carbon\CarbonPeriod::filterEndDate'; + + /** + * Special value which can be returned by filters to end iteration. Also a filter. + * + * @var string + */ + const END_ITERATION = 'Carbon\CarbonPeriod::endIteration'; + + /** + * Available options. + * + * @var int + */ + const EXCLUDE_START_DATE = 1; + const EXCLUDE_END_DATE = 2; + + /** + * Number of maximum attempts before giving up on finding next valid date. + * + * @var int + */ + const NEXT_MAX_ATTEMPTS = 1000; + + /** + * The registered macros. + * + * @var array + */ + protected static $macros = array(); + + /** + * Underlying date interval instance. Always present, one day by default. + * + * @var CarbonInterval + */ + protected $dateInterval; + + /** + * Whether current date interval was set by default. + * + * @var bool + */ + protected $isDefaultInterval; + + /** + * The filters stack. + * + * @var array + */ + protected $filters = array(); + + /** + * Period start date. Applied on rewind. Always present, now by default. + * + * @var Carbon + */ + protected $startDate; + + /** + * Period end date. For inverted interval should be before the start date. Applied via a filter. + * + * @var Carbon|null + */ + protected $endDate; + + /** + * Limit for number of recurrences. Applied via a filter. + * + * @var int|null + */ + protected $recurrences; + + /** + * Iteration options. + * + * @var int + */ + protected $options; + + /** + * Index of current date. Always sequential, even if some dates are skipped by filters. + * Equal to null only before the first iteration. + * + * @var int + */ + protected $key; + + /** + * Current date. May temporarily hold unaccepted value when looking for a next valid date. + * Equal to null only before the first iteration. + * + * @var Carbon + */ + protected $current; + + /** + * Timezone of current date. Taken from the start date. + * + * @var \DateTimeZone|null + */ + protected $timezone; + + /** + * The cached validation result for current date. + * + * @var bool|string|null + */ + protected $validationResult; + + /** + * Create a new instance. + * + * @return static + */ + public static function create() + { + return static::createFromArray(func_get_args()); + } + + /** + * Create a new instance from an array of parameters. + * + * @param array $params + * + * @return static + */ + public static function createFromArray(array $params) + { + // PHP 5.3 equivalent of new static(...$params). + $reflection = new ReflectionClass(get_class()); + /** @var static $instance */ + $instance = $reflection->newInstanceArgs($params); + + return $instance; + } + + /** + * Create CarbonPeriod from ISO 8601 string. + * + * @param string $iso + * @param int|null $options + * + * @return static + */ + public static function createFromIso($iso, $options = null) + { + $params = static::parseIso8601($iso); + + $instance = static::createFromArray($params); + + if ($options !== null) { + $instance->setOptions($options); + } + + return $instance; + } + + /** + * Return whether given interval contains non zero value of any time unit. + * + * @param \DateInterval $interval + * + * @return bool + */ + protected static function intervalHasTime(DateInterval $interval) + { + // The array_key_exists and get_object_vars are used as a workaround to check microsecond support. + // Both isset and property_exists will fail on PHP 7.0.14 - 7.0.21 due to the following bug: + // https://bugs.php.net/bug.php?id=74852 + return $interval->h || $interval->i || $interval->s || array_key_exists('f', get_object_vars($interval)) && $interval->f; + } + + /** + * Return whether given callable is a string pointing to one of Carbon's is* methods + * and should be automatically converted to a filter callback. + * + * @param callable $callable + * + * @return bool + */ + protected static function isCarbonPredicateMethod($callable) + { + return is_string($callable) && substr($callable, 0, 2) === 'is' && (method_exists('Carbon\Carbon', $callable) || Carbon::hasMacro($callable)); + } + + /** + * Return whether given variable is an ISO 8601 specification. + * + * Note: Check is very basic, as actual validation will be done later when parsing. + * We just want to ensure that variable is not any other type of a valid parameter. + * + * @param mixed $var + * + * @return bool + */ + protected static function isIso8601($var) + { + if (!is_string($var)) { + return false; + } + + // Match slash but not within a timezone name. + $part = '[a-z]+(?:[_-][a-z]+)*'; + + preg_match("#\b$part/$part\b|(/)#i", $var, $match); + + return isset($match[1]); + } + + /** + * Parse given ISO 8601 string into an array of arguments. + * + * @param string $iso + * + * @return array + */ + protected static function parseIso8601($iso) + { + $result = array(); + + $interval = null; + $start = null; + $end = null; + + foreach (explode('/', $iso) as $key => $part) { + if ($key === 0 && preg_match('/^R([0-9]*)$/', $part, $match)) { + $parsed = strlen($match[1]) ? (int) $match[1] : null; + } elseif ($interval === null && $parsed = CarbonInterval::make($part)) { + $interval = $part; + } elseif ($start === null && $parsed = Carbon::make($part)) { + $start = $part; + } elseif ($end === null && $parsed = Carbon::make(static::addMissingParts($start, $part))) { + $end = $part; + } else { + throw new InvalidArgumentException("Invalid ISO 8601 specification: $iso."); + } + + $result[] = $parsed; + } + + return $result; + } + + /** + * Add missing parts of the target date from the soure date. + * + * @param string $source + * @param string $target + * + * @return string + */ + protected static function addMissingParts($source, $target) + { + $pattern = '/'.preg_replace('/[0-9]+/', '[0-9]+', preg_quote($target, '/')).'$/'; + + $result = preg_replace($pattern, $target, $source, 1, $count); + + return $count ? $result : $target; + } + + /** + * Register a custom macro. + * + * @param string $name + * @param object|callable $macro + * + * @return void + */ + public static function macro($name, $macro) + { + static::$macros[$name] = $macro; + } + + /** + * Remove all macros. + */ + public static function resetMacros() + { + static::$macros = array(); + } + + /** + * Register macros from a mixin object. + * + * @param object $mixin + * + * @throws \ReflectionException + * + * @return void + */ + public static function mixin($mixin) + { + $reflection = new ReflectionClass($mixin); + + $methods = $reflection->getMethods( + ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED + ); + + foreach ($methods as $method) { + $method->setAccessible(true); + + static::macro($method->name, $method->invoke($mixin)); + } + } + + /** + * Check if macro is registered. + * + * @param string $name + * + * @return bool + */ + public static function hasMacro($name) + { + return isset(static::$macros[$name]); + } + + /** + * Provide static proxy for instance aliases. + * + * @param string $method + * @param array $parameters + * + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + return call_user_func_array( + array(new static, $method), $parameters + ); + } + + /** + * CarbonPeriod constructor. + * + * @throws InvalidArgumentException + */ + public function __construct() + { + // Parse and assign arguments one by one. First argument may be an ISO 8601 spec, + // which will be first parsed into parts and then processed the same way. + $arguments = func_get_args(); + + if (count($arguments) && static::isIso8601($iso = $arguments[0])) { + array_splice($arguments, 0, 1, static::parseIso8601($iso)); + } + + foreach ($arguments as $argument) { + if ($this->dateInterval === null && $parsed = CarbonInterval::make($argument)) { + $this->setDateInterval($parsed); + } elseif ($this->startDate === null && $parsed = Carbon::make($argument)) { + $this->setStartDate($parsed); + } elseif ($this->endDate === null && $parsed = Carbon::make($argument)) { + $this->setEndDate($parsed); + } elseif ($this->recurrences === null && $this->endDate === null && is_numeric($argument)) { + $this->setRecurrences($argument); + } elseif ($this->options === null && (is_int($argument) || $argument === null)) { + $this->setOptions($argument); + } else { + throw new InvalidArgumentException('Invalid constructor parameters.'); + } + } + + if ($this->startDate === null) { + $this->setStartDate(Carbon::now()); + } + + if ($this->dateInterval === null) { + $this->setDateInterval(CarbonInterval::day()); + + $this->isDefaultInterval = true; + } + + if ($this->options === null) { + $this->setOptions(0); + } + } + + /** + * Change the period date interval. + * + * @param DateInterval|string $interval + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setDateInterval($interval) + { + if (!$interval = CarbonInterval::make($interval)) { + throw new InvalidArgumentException('Invalid interval.'); + } + + if ($interval->spec() === 'PT0S') { + throw new InvalidArgumentException('Empty interval is not accepted.'); + } + + $this->dateInterval = $interval; + + $this->isDefaultInterval = false; + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Invert the period date interval. + * + * @return $this + */ + public function invertDateInterval() + { + $interval = $this->dateInterval->invert(); + + return $this->setDateInterval($interval); + } + + /** + * Set start and end date. + * + * @param DateTime|DateTimeInterface|string $start + * @param DateTime|DateTimeInterface|string|null $end + * + * @return $this + */ + public function setDates($start, $end) + { + $this->setStartDate($start); + $this->setEndDate($end); + + return $this; + } + + /** + * Change the period options. + * + * @param int|null $options + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setOptions($options) + { + if (!is_int($options) && !is_null($options)) { + throw new InvalidArgumentException('Invalid options.'); + } + + $this->options = $options ?: 0; + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Get the period options. + * + * @return int + */ + public function getOptions() + { + return $this->options; + } + + /** + * Toggle given options on or off. + * + * @param int $options + * @param bool|null $state + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function toggleOptions($options, $state = null) + { + if ($state === null) { + $state = ($this->options & $options) !== $options; + } + + return $this->setOptions($state ? + $this->options | $options : + $this->options & ~$options + ); + } + + /** + * Toggle EXCLUDE_START_DATE option. + * + * @param bool $state + * + * @return $this + */ + public function excludeStartDate($state = true) + { + return $this->toggleOptions(static::EXCLUDE_START_DATE, $state); + } + + /** + * Toggle EXCLUDE_END_DATE option. + * + * @param bool $state + * + * @return $this + */ + public function excludeEndDate($state = true) + { + return $this->toggleOptions(static::EXCLUDE_END_DATE, $state); + } + + /** + * Get the underlying date interval. + * + * @return CarbonInterval + */ + public function getDateInterval() + { + return $this->dateInterval->copy(); + } + + /** + * Get start date of the period. + * + * @return Carbon + */ + public function getStartDate() + { + return $this->startDate->copy(); + } + + /** + * Get end date of the period. + * + * @return Carbon|null + */ + public function getEndDate() + { + if ($this->endDate) { + return $this->endDate->copy(); + } + } + + /** + * Get number of recurrences. + * + * @return int|null + */ + public function getRecurrences() + { + return $this->recurrences; + } + + /** + * Returns true if the start date should be excluded. + * + * @return bool + */ + public function isStartExcluded() + { + return ($this->options & static::EXCLUDE_START_DATE) !== 0; + } + + /** + * Returns true if the end date should be excluded. + * + * @return bool + */ + public function isEndExcluded() + { + return ($this->options & static::EXCLUDE_END_DATE) !== 0; + } + + /** + * Add a filter to the stack. + * + * @param callable $callback + * @param string $name + * + * @return $this + */ + public function addFilter($callback, $name = null) + { + $tuple = $this->createFilterTuple(func_get_args()); + + $this->filters[] = $tuple; + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Prepend a filter to the stack. + * + * @param callable $callback + * @param string $name + * + * @return $this + */ + public function prependFilter($callback, $name = null) + { + $tuple = $this->createFilterTuple(func_get_args()); + + array_unshift($this->filters, $tuple); + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Create a filter tuple from raw parameters. + * + * Will create an automatic filter callback for one of Carbon's is* methods. + * + * @param array $parameters + * + * @return array + */ + protected function createFilterTuple(array $parameters) + { + $method = array_shift($parameters); + + if (!$this->isCarbonPredicateMethod($method)) { + return array($method, array_shift($parameters)); + } + + return array(function ($date) use ($method, $parameters) { + return call_user_func_array(array($date, $method), $parameters); + }, $method); + } + + /** + * Remove a filter by instance or name. + * + * @param callable|string $filter + * + * @return $this + */ + public function removeFilter($filter) + { + $key = is_callable($filter) ? 0 : 1; + + $this->filters = array_values(array_filter( + $this->filters, + function ($tuple) use ($key, $filter) { + return $tuple[$key] !== $filter; + } + )); + + $this->updateInternalState(); + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Return whether given instance or name is in the filter stack. + * + * @param callable|string $filter + * + * @return bool + */ + public function hasFilter($filter) + { + $key = is_callable($filter) ? 0 : 1; + + foreach ($this->filters as $tuple) { + if ($tuple[$key] === $filter) { + return true; + } + } + + return false; + } + + /** + * Get filters stack. + * + * @return array + */ + public function getFilters() + { + return $this->filters; + } + + /** + * Set filters stack. + * + * @param array $filters + * + * @return $this + */ + public function setFilters(array $filters) + { + $this->filters = $filters; + + $this->updateInternalState(); + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Reset filters stack. + * + * @return $this + */ + public function resetFilters() + { + $this->filters = array(); + + if ($this->endDate !== null) { + $this->filters[] = array(static::END_DATE_FILTER, null); + } + + if ($this->recurrences !== null) { + $this->filters[] = array(static::RECURRENCES_FILTER, null); + } + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Update properties after removing built-in filters. + * + * @return void + */ + protected function updateInternalState() + { + if (!$this->hasFilter(static::END_DATE_FILTER)) { + $this->endDate = null; + } + + if (!$this->hasFilter(static::RECURRENCES_FILTER)) { + $this->recurrences = null; + } + } + + /** + * Add a recurrences filter (set maximum number of recurrences). + * + * @param int|null $recurrences + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setRecurrences($recurrences) + { + if (!is_numeric($recurrences) && !is_null($recurrences) || $recurrences < 0) { + throw new InvalidArgumentException('Invalid number of recurrences.'); + } + + if ($recurrences === null) { + return $this->removeFilter(static::RECURRENCES_FILTER); + } + + $this->recurrences = (int) $recurrences; + + if (!$this->hasFilter(static::RECURRENCES_FILTER)) { + return $this->addFilter(static::RECURRENCES_FILTER); + } + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Recurrences filter callback (limits number of recurrences). + * + * @param \Carbon\Carbon $current + * @param int $key + * + * @return bool|string + */ + protected function filterRecurrences($current, $key) + { + if ($key < $this->recurrences) { + return true; + } + + return static::END_ITERATION; + } + + /** + * Change the period start date. + * + * @param DateTime|DateTimeInterface|string $date + * @param bool|null $inclusive + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setStartDate($date, $inclusive = null) + { + if (!$date = Carbon::make($date)) { + throw new InvalidArgumentException('Invalid start date.'); + } + + $this->startDate = $date; + + if ($inclusive !== null) { + $this->toggleOptions(static::EXCLUDE_START_DATE, !$inclusive); + } + + return $this; + } + + /** + * Change the period end date. + * + * @param DateTime|DateTimeInterface|string|null $date + * @param bool|null $inclusive + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setEndDate($date, $inclusive = null) + { + if (!is_null($date) && !$date = Carbon::make($date)) { + throw new InvalidArgumentException('Invalid end date.'); + } + + if (!$date) { + return $this->removeFilter(static::END_DATE_FILTER); + } + + $this->endDate = $date; + + if ($inclusive !== null) { + $this->toggleOptions(static::EXCLUDE_END_DATE, !$inclusive); + } + + if (!$this->hasFilter(static::END_DATE_FILTER)) { + return $this->addFilter(static::END_DATE_FILTER); + } + + $this->handleChangedParameters(); + + return $this; + } + + /** + * End date filter callback. + * + * @param \Carbon\Carbon $current + * + * @return bool|string + */ + protected function filterEndDate($current) + { + if (!$this->isEndExcluded() && $current == $this->endDate) { + return true; + } + + if ($this->dateInterval->invert ? $current > $this->endDate : $current < $this->endDate) { + return true; + } + + return static::END_ITERATION; + } + + /** + * End iteration filter callback. + * + * @return string + */ + protected function endIteration() + { + return static::END_ITERATION; + } + + /** + * Handle change of the parameters. + */ + protected function handleChangedParameters() + { + $this->validationResult = null; + } + + /** + * Validate current date and stop iteration when necessary. + * + * Returns true when current date is valid, false if it is not, or static::END_ITERATION + * when iteration should be stopped. + * + * @return bool|string + */ + protected function validateCurrentDate() + { + if ($this->current === null) { + $this->rewind(); + } + + // Check after the first rewind to avoid repeating the initial validation. + if ($this->validationResult !== null) { + return $this->validationResult; + } + + return $this->validationResult = $this->checkFilters(); + } + + /** + * Check whether current value and key pass all the filters. + * + * @return bool|string + */ + protected function checkFilters() + { + $current = $this->prepareForReturn($this->current); + + foreach ($this->filters as $tuple) { + $result = call_user_func( + $tuple[0], $current->copy(), $this->key, $this + ); + + if ($result === static::END_ITERATION) { + return static::END_ITERATION; + } + + if (!$result) { + return false; + } + } + + return true; + } + + /** + * Prepare given date to be returned to the external logic. + * + * @param Carbon $date + * + * @return Carbon + */ + protected function prepareForReturn(Carbon $date) + { + $date = $date->copy(); + + if ($this->timezone) { + $date->setTimezone($this->timezone); + } + + return $date; + } + + /** + * Check if the current position is valid. + * + * @return bool + */ + public function valid() + { + return $this->validateCurrentDate() === true; + } + + /** + * Return the current key. + * + * @return int|null + */ + public function key() + { + if ($this->valid()) { + return $this->key; + } + } + + /** + * Return the current date. + * + * @return Carbon|null + */ + public function current() + { + if ($this->valid()) { + return $this->prepareForReturn($this->current); + } + } + + /** + * Move forward to the next date. + * + * @throws \RuntimeException + * + * @return void + */ + public function next() + { + if ($this->current === null) { + $this->rewind(); + } + + if ($this->validationResult !== static::END_ITERATION) { + $this->key++; + + $this->incrementCurrentDateUntilValid(); + } + } + + /** + * Rewind to the start date. + * + * Iterating over a date in the UTC timezone avoids bug during backward DST change. + * + * @see https://bugs.php.net/bug.php?id=72255 + * @see https://bugs.php.net/bug.php?id=74274 + * @see https://wiki.php.net/rfc/datetime_and_daylight_saving_time + * + * @throws \RuntimeException + * + * @return void + */ + public function rewind() + { + $this->key = 0; + $this->current = $this->startDate->copy(); + $this->timezone = static::intervalHasTime($this->dateInterval) ? $this->current->getTimezone() : null; + + if ($this->timezone) { + $this->current->setTimezone('UTC'); + } + + $this->validationResult = null; + + if ($this->isStartExcluded() || $this->validateCurrentDate() === false) { + $this->incrementCurrentDateUntilValid(); + } + } + + /** + * Skip iterations and returns iteration state (false if ended, true if still valid). + * + * @param int $count steps number to skip (1 by default) + * + * @return bool + */ + public function skip($count = 1) + { + for ($i = $count; $this->valid() && $i > 0; $i--) { + $this->next(); + } + + return $this->valid(); + } + + /** + * Keep incrementing the current date until a valid date is found or the iteration is ended. + * + * @throws \RuntimeException + * + * @return void + */ + protected function incrementCurrentDateUntilValid() + { + $attempts = 0; + + do { + $this->current->add($this->dateInterval); + + $this->validationResult = null; + + if (++$attempts > static::NEXT_MAX_ATTEMPTS) { + throw new RuntimeException('Could not find next valid date.'); + } + } while ($this->validateCurrentDate() === false); + } + + /** + * Format the date period as ISO 8601. + * + * @return string + */ + public function toIso8601String() + { + $parts = array(); + + if ($this->recurrences !== null) { + $parts[] = 'R'.$this->recurrences; + } + + $parts[] = $this->startDate->toIso8601String(); + + $parts[] = $this->dateInterval->spec(); + + if ($this->endDate !== null) { + $parts[] = $this->endDate->toIso8601String(); + } + + return implode('/', $parts); + } + + /** + * Convert the date period into a string. + * + * @return string + */ + public function toString() + { + $translator = Carbon::getTranslator(); + + $parts = array(); + + $format = !$this->startDate->isStartOfDay() || $this->endDate && !$this->endDate->isStartOfDay() + ? 'Y-m-d H:i:s' + : 'Y-m-d'; + + if ($this->recurrences !== null) { + $parts[] = $translator->transChoice('period_recurrences', $this->recurrences, array(':count' => $this->recurrences)); + } + + $parts[] = $translator->trans('period_interval', array(':interval' => $this->dateInterval->forHumans())); + + $parts[] = $translator->trans('period_start_date', array(':date' => $this->startDate->format($format))); + + if ($this->endDate !== null) { + $parts[] = $translator->trans('period_end_date', array(':date' => $this->endDate->format($format))); + } + + $result = implode(' ', $parts); + + return mb_strtoupper(mb_substr($result, 0, 1)).mb_substr($result, 1); + } + + /** + * Format the date period as ISO 8601. + * + * @return string + */ + public function spec() + { + return $this->toIso8601String(); + } + + /** + * Convert the date period into an array without changing current iteration state. + * + * @return array + */ + public function toArray() + { + $state = array( + $this->key, + $this->current ? $this->current->copy() : null, + $this->validationResult, + ); + + $result = iterator_to_array($this); + + list( + $this->key, + $this->current, + $this->validationResult + ) = $state; + + return $result; + } + + /** + * Count dates in the date period. + * + * @return int + */ + public function count() + { + return count($this->toArray()); + } + + /** + * Return the first date in the date period. + * + * @return Carbon|null + */ + public function first() + { + if ($array = $this->toArray()) { + return $array[0]; + } + } + + /** + * Return the last date in the date period. + * + * @return Carbon|null + */ + public function last() + { + if ($array = $this->toArray()) { + return $array[count($array) - 1]; + } + } + + /** + * Call given macro. + * + * @param string $name + * @param array $parameters + * + * @return mixed + */ + protected function callMacro($name, $parameters) + { + $macro = static::$macros[$name]; + + $reflection = new ReflectionFunction($macro); + + $reflectionParameters = $reflection->getParameters(); + + $expectedCount = count($reflectionParameters); + $actualCount = count($parameters); + + if ($expectedCount > $actualCount && $reflectionParameters[$expectedCount - 1]->name === 'self') { + for ($i = $actualCount; $i < $expectedCount - 1; $i++) { + $parameters[] = $reflectionParameters[$i]->getDefaultValue(); + } + + $parameters[] = $this; + } + + if ($macro instanceof Closure && method_exists($macro, 'bindTo')) { + $macro = $macro->bindTo($this, get_class($this)); + } + + return call_user_func_array($macro, $parameters); + } + + /** + * Convert the date period into a string. + * + * @return string + */ + public function __toString() + { + return $this->toString(); + } + + /** + * Add aliases for setters. + * + * CarbonPeriod::days(3)->hours(5)->invert() + * ->sinceNow()->until('2010-01-10') + * ->filter(...) + * ->count() + * + * Note: We use magic method to let static and instance aliases with the same names. + * + * @param string $method + * @param array $parameters + * + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->callMacro($method, $parameters); + } + + $first = count($parameters) >= 1 ? $parameters[0] : null; + $second = count($parameters) >= 2 ? $parameters[1] : null; + + switch ($method) { + case 'start': + case 'since': + return $this->setStartDate($first, $second); + + case 'sinceNow': + return $this->setStartDate(new Carbon, $first); + + case 'end': + case 'until': + return $this->setEndDate($first, $second); + + case 'untilNow': + return $this->setEndDate(new Carbon, $first); + + case 'dates': + case 'between': + return $this->setDates($first, $second); + + case 'recurrences': + case 'times': + return $this->setRecurrences($first); + + case 'options': + return $this->setOptions($first); + + case 'toggle': + return $this->toggleOptions($first, $second); + + case 'filter': + case 'push': + return $this->addFilter($first, $second); + + case 'prepend': + return $this->prependFilter($first, $second); + + case 'filters': + return $this->setFilters($first ?: array()); + + case 'interval': + case 'each': + case 'every': + case 'step': + case 'stepBy': + return $this->setDateInterval($first); + + case 'invert': + return $this->invertDateInterval(); + + case 'years': + case 'year': + case 'months': + case 'month': + case 'weeks': + case 'week': + case 'days': + case 'dayz': + case 'day': + case 'hours': + case 'hour': + case 'minutes': + case 'minute': + case 'seconds': + case 'second': + return $this->setDateInterval(call_user_func( + // Override default P1D when instantiating via fluent setters. + array($this->isDefaultInterval ? new CarbonInterval('PT0S') : $this->dateInterval, $method), + count($parameters) === 0 ? 1 : $first + )); + } + + throw new BadMethodCallException("Method $method does not exist."); + } +} diff --git a/application/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php b/application/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php new file mode 100644 index 0000000..1b0d473 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use Exception; +use InvalidArgumentException; + +class InvalidDateException extends InvalidArgumentException +{ + /** + * The invalid field. + * + * @var string + */ + private $field; + + /** + * The invalid value. + * + * @var mixed + */ + private $value; + + /** + * Constructor. + * + * @param string $field + * @param mixed $value + * @param int $code + * @param \Exception|null $previous + */ + public function __construct($field, $value, $code = 0, Exception $previous = null) + { + $this->field = $field; + $this->value = $value; + parent::__construct($field.' : '.$value.' is not a valid value.', $code, $previous); + } + + /** + * Get the invalid field. + * + * @return string + */ + public function getField() + { + return $this->field; + } + + /** + * Get the invalid value. + * + * @return mixed + */ + public function getValue() + { + return $this->value; + } +} diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/af.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/af.php index 86ab541..5cf6a8d 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/af.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/af.php @@ -9,20 +9,23 @@ * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ return array( - 'year' => '1 jaar|:count jare', - 'month' => '1 maand|:count maande', - 'week' => '1 week|:count weke', - 'day' => '1 dag|:count dae', - 'hour' => '1 uur|:count ure', - 'minute' => '1 minuut|:count minute', - 'second' => '1 sekond|:count sekondes', - 'ago' => ':time terug', - 'from_now' => ':time van nou af', - 'after' => ':time na', - 'before' => ':time voor', + 'year' => ':count jaar|:count jare', + 'y' => ':count jaar|:count jare', + 'month' => ':count maand|:count maande', + 'm' => ':count maand|:count maande', + 'week' => ':count week|:count weke', + 'w' => ':count week|:count weke', + 'day' => ':count dag|:count dae', + 'd' => ':count dag|:count dae', + 'hour' => ':count uur|:count ure', + 'h' => ':count uur|:count ure', + 'minute' => ':count minuut|:count minute', + 'min' => ':count minuut|:count minute', + 'second' => ':count sekond|:count sekondes', + 's' => ':count sekond|:count sekondes', + 'ago' => ':time terug', + 'from_now' => ':time van nou af', + 'after' => ':time na', + 'before' => ':time voor', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/ar.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/ar.php index 76b2772..de8f6b8 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/ar.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/ar.php @@ -8,24 +8,24 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ -/** - * Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/ar/date.php - */ return array( - 'year' => '{0}سنة|{1}سنة|{2}سنتين|[3,10]:count سنوات|[11,Inf]:count سنة', - 'month' => '{0}شهر|{1} شهر|{2}شهرين|[3,10]:count أشهر|[11,Inf]:count شهر', - 'week' => '{0}إسبوع|{1}إسبوع|{2}إسبوعين|[3,10]:count أسابيع|[11,Inf]:count إسبوع', - 'day' => '{0}يوم|{1}يوم|{2}يومين|[3,10]:count أيام|[11,Inf] يوم', - 'hour' => '{0}ساعة|{1}ساعة|{2}ساعتين|[3,10]:count ساعات|[11,Inf]:count ساعة', - 'minute' => '{0}دقيقة|{1}دقيقة|{2}دقيقتين|[3,10]:count دقائق|[11,Inf]:count دقيقة', - 'second' => '{0}ثانية|{1}ثانية|{2}ثانيتين|[3,10]:count ثوان|[11,Inf]:count ثانية', - 'ago' => 'منذ :time', - 'from_now' => 'من الآن :time', - 'after' => 'بعد :time', - 'before' => 'قبل :time', + 'year' => '{0}سنة|{1}سنة|{2}سنتين|[3,10]:count سنوات|[11,Inf]:count سنة', + 'y' => '{0}سنة|{1}سنة|{2}سنتين|[3,10]:count سنوات|[11,Inf]:count سنة', + 'month' => '{0}شهر|{1} شهر|{2}شهرين|[3,10]:count أشهر|[11,Inf]:count شهر', + 'm' => '{0}شهر|{1} شهر|{2}شهرين|[3,10]:count أشهر|[11,Inf]:count شهر', + 'week' => '{0}أسبوع|{1}أسبوع|{2}أسبوعين|[3,10]:count أسابيع|[11,Inf]:count أسبوع', + 'w' => '{0}أسبوع|{1}أسبوع|{2}أسبوعين|[3,10]:count أسابيع|[11,Inf]:count أسبوع', + 'day' => '{0}يوم|{1}يوم|{2}يومين|[3,10]:count أيام|[11,Inf] يوم', + 'd' => '{0}يوم|{1}يوم|{2}يومين|[3,10]:count أيام|[11,Inf] يوم', + 'hour' => '{0}ساعة|{1}ساعة|{2}ساعتين|[3,10]:count ساعات|[11,Inf]:count ساعة', + 'h' => '{0}ساعة|{1}ساعة|{2}ساعتين|[3,10]:count ساعات|[11,Inf]:count ساعة', + 'minute' => '{0}دقيقة|{1}دقيقة|{2}دقيقتين|[3,10]:count دقائق|[11,Inf]:count دقيقة', + 'min' => '{0}دقيقة|{1}دقيقة|{2}دقيقتين|[3,10]:count دقائق|[11,Inf]:count دقيقة', + 'second' => '{0}ثانية|{1}ثانية|{2}ثانيتين|[3,10]:count ثوان|[11,Inf]:count ثانية', + 's' => '{0}ثانية|{1}ثانية|{2}ثانيتين|[3,10]:count ثوان|[11,Inf]:count ثانية', + 'ago' => 'منذ :time', + 'from_now' => ':time من الآن', + 'after' => 'بعد :time', + 'before' => 'قبل :time', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/ar_Shakl.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/ar_Shakl.php new file mode 100644 index 0000000..846ae02 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/ar_Shakl.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '[0,1] سَنَة|{2} سَنَتَيْن|[3,10]:count سَنَوَات|[11,Inf]:count سَنَة', + 'y' => '[0,1] سَنَة|{2} سَنَتَيْن|[3,10]:count سَنَوَات|[11,Inf]:count سَنَة', + 'month' => '[0,1] شَهْرَ|{2} شَهْرَيْن|[3,10]:count أَشْهُر|[11,Inf]:count شَهْرَ', + 'm' => '[0,1] شَهْرَ|{2} شَهْرَيْن|[3,10]:count أَشْهُر|[11,Inf]:count شَهْرَ', + 'week' => '[0,1] أُسْبُوع|{2} أُسْبُوعَيْن|[3,10]:count أَسَابِيع|[11,Inf]:count أُسْبُوع', + 'w' => '[0,1] أُسْبُوع|{2} أُسْبُوعَيْن|[3,10]:count أَسَابِيع|[11,Inf]:count أُسْبُوع', + 'day' => '[0,1] يَوْم|{2} يَوْمَيْن|[3,10]:count أَيَّام|[11,Inf] يَوْم', + 'd' => '[0,1] يَوْم|{2} يَوْمَيْن|[3,10]:count أَيَّام|[11,Inf] يَوْم', + 'hour' => '[0,1] سَاعَة|{2} سَاعَتَيْن|[3,10]:count سَاعَات|[11,Inf]:count سَاعَة', + 'h' => '[0,1] سَاعَة|{2} سَاعَتَيْن|[3,10]:count سَاعَات|[11,Inf]:count سَاعَة', + 'minute' => '[0,1] دَقِيقَة|{2} دَقِيقَتَيْن|[3,10]:count دَقَائِق|[11,Inf]:count دَقِيقَة', + 'min' => '[0,1] دَقِيقَة|{2} دَقِيقَتَيْن|[3,10]:count دَقَائِق|[11,Inf]:count دَقِيقَة', + 'second' => '[0,1] ثَانِيَة|{2} ثَانِيَتَيْن|[3,10]:count ثَوَان|[11,Inf]:count ثَانِيَة', + 's' => '[0,1] ثَانِيَة|{2} ثَانِيَتَيْن|[3,10]:count ثَوَان|[11,Inf]:count ثَانِيَة', + 'ago' => 'مُنْذُ :time', + 'from_now' => 'مِنَ الْآن :time', + 'after' => 'بَعْدَ :time', + 'before' => 'قَبْلَ :time', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/az.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/az.php index 455d262..25f5c4a 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/az.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/az.php @@ -1,4 +1,5 @@ ':count il', - 'month' => ':count ay', - 'week' => ':count həftə', - 'day' => ':count gün', - 'hour' => ':count saat', - 'minute' => ':count dəqiqə', - 'second' => ':count saniyə', - 'ago' => ':time öncə', - 'from_now' => ':time sonra', - 'after' => ':time sonra', - 'before' => ':time öncə' + 'year' => ':count il', + 'y' => ':count il', + 'month' => ':count ay', + 'm' => ':count ay', + 'week' => ':count həftə', + 'w' => ':count həftə', + 'day' => ':count gün', + 'd' => ':count gün', + 'hour' => ':count saat', + 'h' => ':count saat', + 'minute' => ':count dəqiqə', + 'min' => ':count dəqiqə', + 'second' => ':count saniyə', + 's' => ':count saniyə', + 'ago' => ':time əvvəl', + 'from_now' => ':time sonra', + 'after' => ':time sonra', + 'before' => ':time əvvəl', + 'diff_now' => 'indi', + 'diff_yesterday' => 'dünən', + 'diff_tomorrow' => 'sabah', + 'diff_before_yesterday' => 'srağagün', + 'diff_after_tomorrow' => 'birisi gün', + 'period_recurrences' => ':count dəfədən bir', + 'period_interval' => 'hər :interval', + 'period_start_date' => ':date tarixindən başlayaraq', + 'period_end_date' => ':date tarixinədək', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/bg.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/bg.php index d70d780..d9e510b 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/bg.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/bg.php @@ -8,24 +8,24 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ -/** - * Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/bg/date.php - */ return array( - 'year' => '1 година|:count години', - 'month' => '1 месец|:count месеца', - 'week' => '1 седмица|:count седмици', - 'day' => '1 ден|:count дни', - 'hour' => '1 час|:count часа', - 'minute' => '1 минута|:count минути', - 'second' => '1 секунда|:count секунди', - 'ago' => 'преди :time', - 'from_now' => ':time от сега', - 'after' => 'след :time', - 'before' => 'преди :time', + 'year' => ':count година|:count години', + 'y' => ':count година|:count години', + 'month' => ':count месец|:count месеца', + 'm' => ':count месец|:count месеца', + 'week' => ':count седмица|:count седмици', + 'w' => ':count седмица|:count седмици', + 'day' => ':count ден|:count дни', + 'd' => ':count ден|:count дни', + 'hour' => ':count час|:count часа', + 'h' => ':count час|:count часа', + 'minute' => ':count минута|:count минути', + 'min' => ':count минута|:count минути', + 'second' => ':count секунда|:count секунди', + 's' => ':count секунда|:count секунди', + 'ago' => 'преди :time', + 'from_now' => ':time от сега', + 'after' => 'след :time', + 'before' => 'преди :time', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/bn.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/bn.php index 41357cd..5817599 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/bn.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/bn.php @@ -1,4 +1,5 @@ '১ বছর|:count বছর', - 'month' => '১ মাস|:count মাস', - 'week' => '১ সপ্তাহ|:count সপ্তাহ', - 'day' => '১ দিন|:count দিন', - 'hour' => '১ ঘন্টা|:count ঘন্টা', - 'minute' => '১ মিনিট|:count মিনিট', - 'second' => '১ সেকেন্ড|:count সেকেন্ড', - 'ago' => ':time পূর্বে', - 'from_now' => 'এখন থেকে :time', - 'after' => ':time পরে', - 'before' => ':time আগে', + 'year' => '১ বছর|:count বছর', + 'y' => '১ বছর|:count বছর', + 'month' => '১ মাস|:count মাস', + 'm' => '১ মাস|:count মাস', + 'week' => '১ সপ্তাহ|:count সপ্তাহ', + 'w' => '১ সপ্তাহ|:count সপ্তাহ', + 'day' => '১ দিন|:count দিন', + 'd' => '১ দিন|:count দিন', + 'hour' => '১ ঘন্টা|:count ঘন্টা', + 'h' => '১ ঘন্টা|:count ঘন্টা', + 'minute' => '১ মিনিট|:count মিনিট', + 'min' => '১ মিনিট|:count মিনিট', + 'second' => '১ সেকেন্ড|:count সেকেন্ড', + 's' => '১ সেকেন্ড|:count সেকেন্ড', + 'ago' => ':time পূর্বে', + 'from_now' => 'এখন থেকে :time', + 'after' => ':time পরে', + 'before' => ':time আগে', + 'diff_now' => 'এখন', + 'diff_yesterday' => 'গতকাল', + 'diff_tomorrow' => 'আগামীকাল', + 'period_recurrences' => ':count বার|:count বার', + 'period_interval' => 'প্রতি :interval', + 'period_start_date' => ':date থেকে', + 'period_end_date' => ':date পর্যন্ত', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php new file mode 100644 index 0000000..7a9b05a --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count godina|:count godine|:count godina', + 'y' => ':count godina|:count godine|:count godina', + 'month' => ':count mjesec|:count mjeseca|:count mjeseci', + 'm' => ':count mjesec|:count mjeseca|:count mjeseci', + 'week' => ':count nedjelja|:count nedjelje|:count nedjelja', + 'w' => ':count nedjelja|:count nedjelje|:count nedjelja', + 'day' => ':count dan|:count dana|:count dana', + 'd' => ':count dan|:count dana|:count dana', + 'hour' => ':count sat|:count sata|:count sati', + 'h' => ':count sat|:count sata|:count sati', + 'minute' => ':count minut|:count minuta|:count minuta', + 'min' => ':count minut|:count minuta|:count minuta', + 'second' => ':count sekund|:count sekunda|:count sekundi', + 's' => ':count sekund|:count sekunda|:count sekundi', + 'ago' => 'prije :time', + 'from_now' => 'za :time', + 'after' => 'nakon :time', + 'before' => ':time ranije', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/ca.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/ca.php index 8145161..c854b5a 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/ca.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/ca.php @@ -1,4 +1,5 @@ '1 any|:count anys', - 'month' => '1 mes|:count mesos', - 'week' => '1 setmana|:count setmanes', - 'day' => '1 dia|:count díes', - 'hour' => '1 hora|:count hores', - 'minute' => '1 minut|:count minuts', - 'second' => '1 segon|:count segons', - 'ago' => 'Fa :time', - 'from_now' => 'Dins de :time', - 'after' => ':time després', - 'before' => ':time abans', + 'year' => ':count any|:count anys', + 'y' => ':count any|:count anys', + 'month' => ':count mes|:count mesos', + 'm' => ':count mes|:count mesos', + 'week' => ':count setmana|:count setmanes', + 'w' => ':count setmana|:count setmanes', + 'day' => ':count dia|:count dies', + 'd' => ':count dia|:count dies', + 'hour' => ':count hora|:count hores', + 'h' => ':count hora|:count hores', + 'minute' => ':count minut|:count minuts', + 'min' => ':count minut|:count minuts', + 'second' => ':count segon|:count segons', + 's' => ':count segon|:count segons', + 'ago' => 'fa :time', + 'from_now' => 'd\'aquí :time', + 'after' => ':time després', + 'before' => ':time abans', + 'diff_now' => 'ara mateix', + 'diff_yesterday' => 'ahir', + 'diff_tomorrow' => 'demà', + 'diff_before_yesterday' => "abans d'ahir", + 'diff_after_tomorrow' => 'demà passat', + 'period_recurrences' => ':count cop|:count cops', + 'period_interval' => 'cada :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'fins a :date', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/cs.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/cs.php index 26a78b3..a447ce2 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/cs.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/cs.php @@ -1,4 +1,5 @@ '1 rok|:count roky|:count let', - 'month' => '1 měsíc|:count měsíce|:count měsíců', - 'week' => '1 týden|:count týdny|:count týdnů', - 'day' => '1 den|:count dny|:count dní', - 'hour' => '1 hodinu|:count hodiny|:count hodin', - 'minute' => '1 minutu|:count minuty|:count minut', - 'second' => '1 sekundu|:count sekundy|:count sekund', - 'ago' => 'před :time', - 'from_now' => 'za :time', - 'after' => ':time později', - 'before' => ':time předtím', + 'year' => ':count rok|:count roky|:count let', + 'y' => ':count rok|:count roky|:count let', + 'month' => ':count měsíc|:count měsíce|:count měsíců', + 'm' => ':count měsíc|:count měsíce|:count měsíců', + 'week' => ':count týden|:count týdny|:count týdnů', + 'w' => ':count týden|:count týdny|:count týdnů', + 'day' => ':count den|:count dny|:count dní', + 'd' => ':count den|:count dny|:count dní', + 'hour' => ':count hodinu|:count hodiny|:count hodin', + 'h' => ':count hodinu|:count hodiny|:count hodin', + 'minute' => ':count minutu|:count minuty|:count minut', + 'min' => ':count minutu|:count minuty|:count minut', + 'second' => ':count sekundu|:count sekundy|:count sekund', + 's' => ':count sekundu|:count sekundy|:count sekund', + 'ago' => ':time nazpět', + 'from_now' => 'za :time', + 'after' => ':time později', + 'before' => ':time předtím', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/cy.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/cy.php new file mode 100644 index 0000000..c93750e --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/cy.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +return array( + 'year' => '1 flwyddyn|:count blynedd', + 'y' => ':countbl', + 'month' => '1 mis|:count fis', + 'm' => ':countmi', + 'week' => ':count wythnos', + 'w' => ':countw', + 'day' => ':count diwrnod', + 'd' => ':countd', + 'hour' => ':count awr', + 'h' => ':counth', + 'minute' => ':count munud', + 'min' => ':countm', + 'second' => ':count eiliad', + 's' => ':counts', + 'ago' => ':time yn ôl', + 'from_now' => ':time o hyn ymlaen', + 'after' => ':time ar ôl', + 'before' => ':time o\'r blaen', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/da.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/da.php index d5c6a0a..86507b0 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/da.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/da.php @@ -9,20 +9,23 @@ * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ return array( - 'year' => '1 år|:count år', - 'month' => '1 måned|:count måneder', - 'week' => '1 uge|:count uger', - 'day' => '1 dag|:count dage', - 'hour' => '1 time|:count timer', - 'minute' => '1 minut|:count minutter', - 'second' => '1 sekund|:count sekunder', - 'ago' => ':time siden', - 'from_now' => 'om :time', - 'after' => ':time efter', - 'before' => ':time før', + 'year' => ':count år|:count år', + 'y' => ':count år|:count år', + 'month' => ':count måned|:count måneder', + 'm' => ':count måned|:count måneder', + 'week' => ':count uge|:count uger', + 'w' => ':count uge|:count uger', + 'day' => ':count dag|:count dage', + 'd' => ':count dag|:count dage', + 'hour' => ':count time|:count timer', + 'h' => ':count time|:count timer', + 'minute' => ':count minut|:count minutter', + 'min' => ':count minut|:count minutter', + 'second' => ':count sekund|:count sekunder', + 's' => ':count sekund|:count sekunder', + 'ago' => ':time siden', + 'from_now' => 'om :time', + 'after' => ':time efter', + 'before' => ':time før', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/de.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/de.php index bf0af71..5ea2a03 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/de.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/de.php @@ -3,36 +3,44 @@ /* * This file is part of the Carbon package. * - * (c) Michael Hohl + * (c) Brian Nesbitt * - * This file is released under the terms of CC0. - * CC0 is even more permissive than the MIT license, allowing you to use the code in - * any manner you want, without any copyright headers, notices, or other attribution. + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ return array( - 'year' => '1 Jahr|:count Jahre', - 'month' => '1 Monat|:count Monate', - 'week' => '1 Woche|:count Wochen', - 'day' => '1 Tag|:count Tage', - 'hour' => '1 Stunde|:count Stunden', - 'minute' => '1 Minute|:count Minuten', - 'second' => '1 Sekunde|:count Sekunden', - 'ago' => 'vor :time', - 'from_now' => 'in :time', - 'after' => ':time später', - 'before' => ':time zuvor', + 'year' => ':count Jahr|:count Jahre', + 'y' => ':countJ|:countJ', + 'month' => ':count Monat|:count Monate', + 'm' => ':countMon|:countMon', + 'week' => ':count Woche|:count Wochen', + 'w' => ':countWo|:countWo', + 'day' => ':count Tag|:count Tage', + 'd' => ':countTg|:countTg', + 'hour' => ':count Stunde|:count Stunden', + 'h' => ':countStd|:countStd', + 'minute' => ':count Minute|:count Minuten', + 'min' => ':countMin|:countMin', + 'second' => ':count Sekunde|:count Sekunden', + 's' => ':countSek|:countSek', + 'ago' => 'vor :time', + 'from_now' => 'in :time', + 'after' => ':time später', + 'before' => ':time zuvor', + + 'year_from_now' => ':count Jahr|:count Jahren', + 'month_from_now' => ':count Monat|:count Monaten', + 'week_from_now' => ':count Woche|:count Wochen', + 'day_from_now' => ':count Tag|:count Tagen', + 'year_ago' => ':count Jahr|:count Jahren', + 'month_ago' => ':count Monat|:count Monaten', + 'week_ago' => ':count Woche|:count Wochen', + 'day_ago' => ':count Tag|:count Tagen', - 'year_from_now' => '1 Jahr|:count Jahren', - 'month_from_now' => '1 Monat|:count Monaten', - 'week_from_now' => '1 Woche|:count Wochen', - 'day_from_now' => '1 Tag|:count Tagen', - 'year_ago' => '1 Jahr|:count Jahren', - 'month_ago' => '1 Monat|:count Monaten', - 'week_ago' => '1 Woche|:count Wochen', - 'day_ago' => '1 Tag|:count Tagen', + 'diff_now' => 'Gerade eben', + 'diff_yesterday' => 'Gestern', + 'diff_tomorrow' => 'Heute', + 'diff_before_yesterday' => 'Vorgestern', + 'diff_after_tomorrow' => 'Übermorgen', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/dv_MV.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/dv_MV.php new file mode 100644 index 0000000..e3c50b3 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/dv_MV.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '{0}އަހަރެއް|[1,Inf]:count އަހަރު', + 'y' => '{0}އަހަރެއް|[1,Inf]:count އަހަރު', + 'month' => '{0}މައްސަރެއް|[1,Inf]:count މަސް', + 'm' => '{0}މައްސަރެއް|[1,Inf]:count މަސް', + 'week' => '{0}ހަފްތާއެއް|[1,Inf]:count ހަފްތާ', + 'w' => '{0}ހަފްތާއެއް|[1,Inf]:count ހަފްތާ', + 'day' => '{0}ދުވަސް|[1,Inf]:count ދުވަސް', + 'd' => '{0}ދުވަސް|[1,Inf]:count ދުވަސް', + 'hour' => '{0}ގަޑިއިރެއް|[1,Inf]:count ގަޑި', + 'h' => '{0}ގަޑިއިރެއް|[1,Inf]:count ގަޑި', + 'minute' => '{0}މިނެޓެއް|[1,Inf]:count މިނެޓް', + 'min' => '{0}މިނެޓެއް|[1,Inf]:count މިނެޓް', + 'second' => '{0}ސިކުންތެއް|[1,Inf]:count ސިކުންތު', + 's' => '{0}ސިކުންތެއް|[1,Inf]:count ސިކުންތު', + 'ago' => ':time ކުރިން', + 'from_now' => ':time ފަހުން', + 'after' => ':time ފަހުން', + 'before' => ':time ކުރި', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/el.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/el.php index 1ecb271..16b3f44 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/el.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/el.php @@ -1,4 +1,5 @@ '1 χρόνος|:count χρόνια', - 'month' => '1 μήνας|:count μήνες', - 'week' => '1 εβδομάδα|:count εβδομάδες', - 'day' => '1 μέρα|:count μέρες', - 'hour' => '1 ώρα|:count ώρες', - 'minute' => '1 λεπτό|:count λεπτά', - 'second' => '1 δευτερόλεπτο|:count δευτερόλεπτα', - 'ago' => 'πρίν απο :time', - 'from_now' => 'σε :time απο τώρα', - 'after' => ':time μετά', - 'before' => ':time πρίν' + 'year' => ':count χρόνος|:count χρόνια', + 'y' => ':count χρόνος|:count χρόνια', + 'month' => ':count μήνας|:count μήνες', + 'm' => ':count μήνας|:count μήνες', + 'week' => ':count εβδομάδα|:count εβδομάδες', + 'w' => ':count εβδομάδα|:count εβδομάδες', + 'day' => ':count μέρα|:count μέρες', + 'd' => ':count μέρα|:count μέρες', + 'hour' => ':count ώρα|:count ώρες', + 'h' => ':count ώρα|:count ώρες', + 'minute' => ':count λεπτό|:count λεπτά', + 'min' => ':count λεπτό|:count λεπτά', + 'second' => ':count δευτερόλεπτο|:count δευτερόλεπτα', + 's' => ':count δευτερόλεπτο|:count δευτερόλεπτα', + 'ago' => 'πριν από :time', + 'from_now' => 'σε :time από τώρα', + 'after' => ':time μετά', + 'before' => ':time πριν', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/en.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/en.php index e0ad273..a15c131 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/en.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/en.php @@ -9,20 +9,32 @@ * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ return array( - 'year' => '1 year|:count years', - 'month' => '1 month|:count months', - 'week' => '1 week|:count weeks', - 'day' => '1 day|:count days', - 'hour' => '1 hour|:count hours', - 'minute' => '1 minute|:count minutes', - 'second' => '1 second|:count seconds', - 'ago' => ':time ago', - 'from_now' => ':time from now', - 'after' => ':time after', - 'before' => ':time before', + 'year' => ':count year|:count years', + 'y' => ':countyr|:countyrs', + 'month' => ':count month|:count months', + 'm' => ':countmo|:countmos', + 'week' => ':count week|:count weeks', + 'w' => ':countw|:countw', + 'day' => ':count day|:count days', + 'd' => ':countd|:countd', + 'hour' => ':count hour|:count hours', + 'h' => ':counth|:counth', + 'minute' => ':count minute|:count minutes', + 'min' => ':countm|:countm', + 'second' => ':count second|:count seconds', + 's' => ':counts|:counts', + 'ago' => ':time ago', + 'from_now' => ':time from now', + 'after' => ':time after', + 'before' => ':time before', + 'diff_now' => 'just now', + 'diff_yesterday' => 'yesterday', + 'diff_tomorrow' => 'tomorrow', + 'diff_before_yesterday' => 'before yesterday', + 'diff_after_tomorrow' => 'after tomorrow', + 'period_recurrences' => 'once|:count times', + 'period_interval' => 'every :interval', + 'period_start_date' => 'from :date', + 'period_end_date' => 'to :date', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/eo.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/eo.php index 3175a27..c5b90b3 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/eo.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/eo.php @@ -1,4 +1,5 @@ '1 jaro|:count jaroj', - 'month' => '1 monato|:count monatoj', - 'week' => '1 semajno|:count semajnoj', - 'day' => '1 tago|:count tagoj', - 'hour' => '1 horo|:count horoj', - 'minute' => '1 minuto|:count minutoj', - 'second' => '1 sekundo|:count sekundoj', - 'ago' => 'antaŭ :time', - 'from_now' => 'je :time', - 'after' => ':time poste', - 'before' => ':time antaŭe' + 'year' => ':count jaro|:count jaroj', + 'y' => ':count jaro|:count jaroj', + 'month' => ':count monato|:count monatoj', + 'm' => ':count monato|:count monatoj', + 'week' => ':count semajno|:count semajnoj', + 'w' => ':count semajno|:count semajnoj', + 'day' => ':count tago|:count tagoj', + 'd' => ':count tago|:count tagoj', + 'hour' => ':count horo|:count horoj', + 'h' => ':count horo|:count horoj', + 'minute' => ':count minuto|:count minutoj', + 'min' => ':count minuto|:count minutoj', + 'second' => ':count sekundo|:count sekundoj', + 's' => ':count sekundo|:count sekundoj', + 'ago' => 'antaŭ :time', + 'from_now' => 'je :time', + 'after' => ':time poste', + 'before' => ':time antaŭe', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/es.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/es.php index 2da39a0..567a280 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/es.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/es.php @@ -9,20 +9,28 @@ * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ return array( - 'year' => '1 año|:count años', - 'month' => '1 mes|:count meses', - 'week' => '1 semana|:count semanas', - 'day' => '1 día|:count días', - 'hour' => '1 hora|:count horas', - 'minute' => '1 minuto|:count minutos', - 'second' => '1 segundo|:count segundos', - 'ago' => 'hace :time', - 'from_now' => 'dentro de :time', - 'after' => ':time después', - 'before' => ':time antes', + 'year' => ':count año|:count años', + 'y' => ':count año|:count años', + 'month' => ':count mes|:count meses', + 'm' => ':count mes|:count meses', + 'week' => ':count semana|:count semanas', + 'w' => ':count semana|:count semanas', + 'day' => ':count día|:count días', + 'd' => ':count día|:count días', + 'hour' => ':count hora|:count horas', + 'h' => ':count hora|:count horas', + 'minute' => ':count minuto|:count minutos', + 'min' => ':count minuto|:count minutos', + 'second' => ':count segundo|:count segundos', + 's' => ':count segundo|:count segundos', + 'ago' => 'hace :time', + 'from_now' => 'dentro de :time', + 'after' => ':time después', + 'before' => ':time antes', + 'diff_now' => 'ahora mismo', + 'diff_yesterday' => 'ayer', + 'diff_tomorrow' => 'mañana', + 'diff_before_yesterday' => 'antier', + 'diff_after_tomorrow' => 'pasado mañana', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/et.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/et.php index 68dfae6..2d9291e 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/et.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/et.php @@ -1,4 +1,5 @@ '1 aasta|:count aastat', - 'month' => '1 kuu|:count kuud', - 'week' => '1 nädal|:count nädalat', - 'day' => '1 päev|:count päeva', - 'hour' => '1 tund|:count tundi', - 'minute' => '1 minut|:count minutit', - 'second' => '1 sekund|:count sekundit', - 'ago' => ':time tagasi', - 'from_now' => ':time pärast', - 'after' => ':time pärast', - 'before' => ':time enne', + 'year' => ':count aasta|:count aastat', + 'y' => ':count aasta|:count aastat', + 'month' => ':count kuu|:count kuud', + 'm' => ':count kuu|:count kuud', + 'week' => ':count nädal|:count nädalat', + 'w' => ':count nädal|:count nädalat', + 'day' => ':count päev|:count päeva', + 'd' => ':count päev|:count päeva', + 'hour' => ':count tund|:count tundi', + 'h' => ':count tund|:count tundi', + 'minute' => ':count minut|:count minutit', + 'min' => ':count minut|:count minutit', + 'second' => ':count sekund|:count sekundit', + 's' => ':count sekund|:count sekundit', + 'ago' => ':time tagasi', + 'from_now' => ':time pärast', + 'after' => ':time pärast', + 'before' => ':time enne', 'year_from_now' => ':count aasta', 'month_from_now' => ':count kuu', 'week_from_now' => ':count nädala', diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/eu.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/eu.php index 79c4d12..1cb6b7c 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/eu.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/eu.php @@ -1,4 +1,5 @@ 'Urte 1|:count urte', - 'month' => 'Hile 1|:count hile', - 'week' => 'Aste 1|:count aste', - 'day' => 'Egun 1|:count egun', - 'hour' => 'Ordu 1|:count ordu', - 'minute' => 'Minutu 1|:count minutu', - 'second' => 'Segundu 1|:count segundu', - 'ago' => 'Orain dela :time', - 'from_now' => ':time barru', - 'after' => ':time geroago', - 'before' => ':time lehenago' + 'year' => 'Urte 1|:count urte', + 'y' => 'Urte 1|:count urte', + 'month' => 'Hile 1|:count hile', + 'm' => 'Hile 1|:count hile', + 'week' => 'Aste 1|:count aste', + 'w' => 'Aste 1|:count aste', + 'day' => 'Egun 1|:count egun', + 'd' => 'Egun 1|:count egun', + 'hour' => 'Ordu 1|:count ordu', + 'h' => 'Ordu 1|:count ordu', + 'minute' => 'Minutu 1|:count minutu', + 'min' => 'Minutu 1|:count minutu', + 'second' => 'Segundu 1|:count segundu', + 's' => 'Segundu 1|:count segundu', + 'ago' => 'Orain dela :time', + 'from_now' => ':time barru', + 'after' => ':time geroago', + 'before' => ':time lehenago', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/fa.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/fa.php index 8b671da..31bec88 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/fa.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/fa.php @@ -9,21 +9,23 @@ * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ - return array( - 'year' => ':count سال', - 'month' => ':count ماه', - 'week' => ':count هفته', - 'day' => ':count روز', - 'hour' => ':count ساعت', - 'minute' => ':count دقیقه', - 'second' => ':count ثانیه', - 'ago' => ':time پیش', - 'from_now' => ':time بعد', - 'after' => ':time پیش از', - 'before' => ':time پس از', + 'year' => ':count سال', + 'y' => ':count سال', + 'month' => ':count ماه', + 'm' => ':count ماه', + 'week' => ':count هفته', + 'w' => ':count هفته', + 'day' => ':count روز', + 'd' => ':count روز', + 'hour' => ':count ساعت', + 'h' => ':count ساعت', + 'minute' => ':count دقیقه', + 'min' => ':count دقیقه', + 'second' => ':count ثانیه', + 's' => ':count ثانیه', + 'ago' => ':time پیش', + 'from_now' => ':time بعد', + 'after' => ':time پس از', + 'before' => ':time پیش از', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/fi.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/fi.php index 6198f99..4818804 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/fi.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/fi.php @@ -1,4 +1,5 @@ '1 vuosi|:count vuotta', - 'month' => '1 kuukausi|:count kuukautta', - 'week' => '1 viikko|:count viikkoa', - 'day' => '1 päivä|:count päivää', - 'hour' => '1 tunti|:count tuntia', - 'minute' => '1 minuutti|:count minuuttia', - 'second' => '1 sekunti|:count sekuntia', - 'ago' => ':time sitten', - 'from_now' => ':time tästä hetkestä', - 'after' => ':time sen jälkeen', - 'before' => ':time ennen' + 'year' => ':count vuosi|:count vuotta', + 'y' => ':count vuosi|:count vuotta', + 'month' => ':count kuukausi|:count kuukautta', + 'm' => ':count kuukausi|:count kuukautta', + 'week' => ':count viikko|:count viikkoa', + 'w' => ':count viikko|:count viikkoa', + 'day' => ':count päivä|:count päivää', + 'd' => ':count päivä|:count päivää', + 'hour' => ':count tunti|:count tuntia', + 'h' => ':count tunti|:count tuntia', + 'minute' => ':count minuutti|:count minuuttia', + 'min' => ':count minuutti|:count minuuttia', + 'second' => ':count sekunti|:count sekuntia', + 's' => ':count sekunti|:count sekuntia', + 'ago' => ':time sitten', + 'from_now' => ':time tästä hetkestä', + 'after' => ':time sen jälkeen', + 'before' => ':time ennen', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/fo.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/fo.php index 740f03b..d91104b 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/fo.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/fo.php @@ -9,20 +9,23 @@ * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ return array( - 'year' => '1 ár|:count ár', - 'month' => '1 mánaður|:count mánaðir', - 'week' => '1 vika|:count vikur', - 'day' => '1 dag|:count dagar', - 'hour' => '1 tími|:count tímar', - 'minute' => '1 minutt|:count minuttir', - 'second' => '1 sekund|:count sekundir', - 'ago' => ':time síðan', - 'from_now' => 'um :time', - 'after' => ':time aftaná', - 'before' => ':time áðrenn', + 'year' => ':count ár|:count ár', + 'y' => ':count ár|:count ár', + 'month' => ':count mánaður|:count mánaðir', + 'm' => ':count mánaður|:count mánaðir', + 'week' => ':count vika|:count vikur', + 'w' => ':count vika|:count vikur', + 'day' => ':count dag|:count dagar', + 'd' => ':count dag|:count dagar', + 'hour' => ':count tími|:count tímar', + 'h' => ':count tími|:count tímar', + 'minute' => ':count minutt|:count minuttir', + 'min' => ':count minutt|:count minuttir', + 'second' => ':count sekund|:count sekundir', + 's' => ':count sekund|:count sekundir', + 'ago' => ':time síðan', + 'from_now' => 'um :time', + 'after' => ':time aftaná', + 'before' => ':time áðrenn', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/fr.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/fr.php index 298131a..0b20cdd 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/fr.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/fr.php @@ -9,20 +9,32 @@ * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ return array( - 'year' => '1 an|:count ans', - 'month' => ':count mois', - 'week' => '1 semaine|:count semaines', - 'day' => '1 jour|:count jours', - 'hour' => '1 heure|:count heures', - 'minute' => '1 minute|:count minutes', - 'second' => '1 seconde|:count secondes', - 'ago' => 'il y a :time', - 'from_now' => 'dans :time', - 'after' => ':time après', - 'before' => ':time avant', + 'year' => ':count an|:count ans', + 'y' => ':count an|:count ans', + 'month' => ':count mois', + 'm' => ':count mois', + 'week' => ':count semaine|:count semaines', + 'w' => ':count sem.', + 'day' => ':count jour|:count jours', + 'd' => ':count j.', + 'hour' => ':count heure|:count heures', + 'h' => ':count h.', + 'minute' => ':count minute|:count minutes', + 'min' => ':count min.', + 'second' => ':count seconde|:count secondes', + 's' => ':count sec.', + 'ago' => 'il y a :time', + 'from_now' => 'dans :time', + 'after' => ':time après', + 'before' => ':time avant', + 'diff_now' => "à l'instant", + 'diff_yesterday' => 'hier', + 'diff_tomorrow' => 'demain', + 'diff_before_yesterday' => 'avant-hier', + 'diff_after_tomorrow' => 'après-demain', + 'period_recurrences' => ':count fois', + 'period_interval' => 'tous les :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'à :date', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/gl.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/gl.php new file mode 100644 index 0000000..cd22a31 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/gl.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count ano|:count anos', + 'month' => ':count mes|:count meses', + 'week' => ':count semana|:count semanas', + 'day' => ':count día|:count días', + 'hour' => ':count hora|:count horas', + 'minute' => ':count minuto|:count minutos', + 'second' => ':count segundo|:count segundos', + 'ago' => 'fai :time', + 'from_now' => 'dentro de :time', + 'after' => ':time despois', + 'before' => ':time antes', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/gu.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/gu.php new file mode 100644 index 0000000..7759dfc --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/gu.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count વર્ષ|:count વર્ષો', + 'y' => ':countવર્ષ|:countવર્ષો', + 'month' => ':count મહિનો|:count મહિના', + 'm' => ':countમહિનો|:countમહિના', + 'week' => ':count અઠવાડિયું|:count અઠવાડિયા', + 'w' => ':countઅઠ.|:countઅઠ.', + 'day' => ':count દિવસ|:count દિવસો', + 'd' => ':countદિ.|:countદિ.', + 'hour' => ':count કલાક|:count કલાકો', + 'h' => ':countક.|:countક.', + 'minute' => ':count મિનિટ|:count મિનિટ', + 'min' => ':countમિ.|:countમિ.', + 'second' => ':count સેકેન્ડ|:count સેકેન્ડ', + 's' => ':countસે.|:countસે.', + 'ago' => ':time પહેલા', + 'from_now' => ':time અત્યારથી', + 'after' => ':time પછી', + 'before' => ':time પહેલા', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/he.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/he.php index 681915b..2d4f4f8 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/he.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/he.php @@ -9,20 +9,23 @@ * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ return array( - 'year' => 'שנה|{2}שנתיים|:count שנים', - 'month' => 'חודש|{2}חודשיים|:count חודשים', - 'week' => 'שבוע|{2}שבועיים|:count שבועות', - 'day' => 'יום|{2}יומיים|:count ימים', - 'hour' => 'שעה|{2}שעתיים|:count שעות', - 'minute' => 'דקה|{2}דקותיים|:count דקות', - 'second' => 'שניה|:count שניות', - 'ago' => 'לפני :time', - 'from_now' => 'בעוד :time', - 'after' => 'אחרי :time', - 'before' => 'לפני :time', + 'year' => 'שנה|{2}שנתיים|:count שנים', + 'y' => 'שנה|{2}שנתיים|:count שנים', + 'month' => 'חודש|{2}חודשיים|:count חודשים', + 'm' => 'חודש|{2}חודשיים|:count חודשים', + 'week' => 'שבוע|{2}שבועיים|:count שבועות', + 'w' => 'שבוע|{2}שבועיים|:count שבועות', + 'day' => 'יום|{2}יומיים|:count ימים', + 'd' => 'יום|{2}יומיים|:count ימים', + 'hour' => 'שעה|{2}שעתיים|:count שעות', + 'h' => 'שעה|{2}שעתיים|:count שעות', + 'minute' => 'דקה|{2}דקותיים|:count דקות', + 'min' => 'דקה|{2}דקותיים|:count דקות', + 'second' => 'שניה|:count שניות', + 's' => 'שניה|:count שניות', + 'ago' => 'לפני :time', + 'from_now' => 'בעוד :time', + 'after' => 'אחרי :time', + 'before' => 'לפני :time', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/hi.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/hi.php new file mode 100644 index 0000000..6c670ee --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/hi.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '1 वर्ष|:count वर्षों', + 'y' => '1 वर्ष|:count वर्षों', + 'month' => '1 माह|:count महीने', + 'm' => '1 माह|:count महीने', + 'week' => '1 सप्ताह|:count सप्ताह', + 'w' => '1 सप्ताह|:count सप्ताह', + 'day' => '1 दिन|:count दिनों', + 'd' => '1 दिन|:count दिनों', + 'hour' => '1 घंटा|:count घंटे', + 'h' => '1 घंटा|:count घंटे', + 'minute' => '1 मिनट|:count मिनटों', + 'min' => '1 मिनट|:count मिनटों', + 'second' => '1 सेकंड|:count सेकंड', + 's' => '1 सेकंड|:count सेकंड', + 'ago' => ':time पूर्व', + 'from_now' => ':time से', + 'after' => ':time के बाद', + 'before' => ':time के पहले', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/hr.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/hr.php index ea21ced..1a339de 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/hr.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/hr.php @@ -1,4 +1,5 @@ ':count godinu|:count godine|:count godina', - 'month' => ':count mjesec|:count mjeseca|:count mjeseci', - 'week' => ':count tjedan|:count tjedna|:count tjedana', - 'day' => ':count dan|:count dana|:count dana', - 'hour' => ':count sat|:count sata|:count sati', - 'minute' => ':count minutu|:count minute |:count minuta', - 'second' => ':count sekundu|:count sekunde|:count sekundi', - 'ago' => 'prije :time', - 'from_now' => 'za :time', - 'after' => 'za :time', - 'before' => 'prije :time' + 'year' => ':count godinu|:count godine|:count godina', + 'y' => ':count godinu|:count godine|:count godina', + 'month' => ':count mjesec|:count mjeseca|:count mjeseci', + 'm' => ':count mjesec|:count mjeseca|:count mjeseci', + 'week' => ':count tjedan|:count tjedna|:count tjedana', + 'w' => ':count tjedan|:count tjedna|:count tjedana', + 'day' => ':count dan|:count dana|:count dana', + 'd' => ':count dan|:count dana|:count dana', + 'hour' => ':count sat|:count sata|:count sati', + 'h' => ':count sat|:count sata|:count sati', + 'minute' => ':count minutu|:count minute |:count minuta', + 'min' => ':count minutu|:count minute |:count minuta', + 'second' => ':count sekundu|:count sekunde|:count sekundi', + 's' => ':count sekundu|:count sekunde|:count sekundi', + 'ago' => 'prije :time', + 'from_now' => 'za :time', + 'after' => 'za :time', + 'before' => 'prije :time', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/hu.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/hu.php index f30c0c8..45daf41 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/hu.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/hu.php @@ -1,4 +1,5 @@ '1 évvel|:count évvel', - 'month' => '1 hónappal|:count hónappal', - 'week' => '1 héttel|:count héttel', - 'day' => '1 nappal|:count nappal', - 'hour' => '1 órával|:count órával', - 'minute' => '1 perccel|:count perccel', - 'second' => '1 másodperccel|:count másodperccel', - 'ago' => ':time korábban', - 'from_now' => ':time később', - 'after' => ':time később', - 'before' => ':time korábban' + 'year' => ':count év', + 'y' => ':count év', + 'month' => ':count hónap', + 'm' => ':count hónap', + 'week' => ':count hét', + 'w' => ':count hét', + 'day' => ':count nap', + 'd' => ':count nap', + 'hour' => ':count óra', + 'h' => ':count óra', + 'minute' => ':count perc', + 'min' => ':count perc', + 'second' => ':count másodperc', + 's' => ':count másodperc', + 'ago' => ':time', + 'from_now' => ':time múlva', + 'after' => ':time később', + 'before' => ':time korábban', + 'year_ago' => ':count éve', + 'month_ago' => ':count hónapja', + 'week_ago' => ':count hete', + 'day_ago' => ':count napja', + 'hour_ago' => ':count órája', + 'minute_ago' => ':count perce', + 'second_ago' => ':count másodperce', + 'year_after' => ':count évvel', + 'month_after' => ':count hónappal', + 'week_after' => ':count héttel', + 'day_after' => ':count nappal', + 'hour_after' => ':count órával', + 'minute_after' => ':count perccel', + 'second_after' => ':count másodperccel', + 'year_before' => ':count évvel', + 'month_before' => ':count hónappal', + 'week_before' => ':count héttel', + 'day_before' => ':count nappal', + 'hour_before' => ':count órával', + 'minute_before' => ':count perccel', + 'second_before' => ':count másodperccel', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/hy.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/hy.php new file mode 100644 index 0000000..d2665f2 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/hy.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count տարի', + 'y' => ':countտ', + 'month' => ':count ամիս', + 'm' => ':countամ', + 'week' => ':count շաբաթ', + 'w' => ':countշ', + 'day' => ':count օր', + 'd' => ':countօր', + 'hour' => ':count ժամ', + 'h' => ':countժ', + 'minute' => ':count րոպե', + 'min' => ':countր', + 'second' => ':count վարկյան', + 's' => ':countվրկ', + 'ago' => ':time առաջ', + 'from_now' => ':time ներկա պահից', + 'after' => ':time հետո', + 'before' => ':time առաջ', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/id.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/id.php index 56757a5..7f7114f 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/id.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/id.php @@ -1,4 +1,5 @@ ':count tahun', - 'month' => ':count bulan', - 'week' => ':count minggu', - 'day' => ':count hari', - 'hour' => ':count jam', - 'minute' => ':count menit', - 'second' => ':count detik', - 'ago' => ':time yang lalu', - 'from_now' => ':time dari sekarang', - 'after' => ':time setelah', - 'before' => ':time sebelum' + 'year' => ':count tahun', + 'y' => ':count tahun', + 'month' => ':count bulan', + 'm' => ':count bulan', + 'week' => ':count minggu', + 'w' => ':count minggu', + 'day' => ':count hari', + 'd' => ':count hari', + 'hour' => ':count jam', + 'h' => ':count jam', + 'minute' => ':count menit', + 'min' => ':count menit', + 'second' => ':count detik', + 's' => ':count detik', + 'ago' => ':time yang lalu', + 'from_now' => ':time dari sekarang', + 'after' => ':time setelah', + 'before' => ':time sebelum', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/is.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/is.php new file mode 100644 index 0000000..94c76a7 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/is.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '1 ár|:count ár', + 'y' => '1 ár|:count ár', + 'month' => '1 mánuður|:count mánuðir', + 'm' => '1 mánuður|:count mánuðir', + 'week' => '1 vika|:count vikur', + 'w' => '1 vika|:count vikur', + 'day' => '1 dagur|:count dagar', + 'd' => '1 dagur|:count dagar', + 'hour' => '1 klukkutími|:count klukkutímar', + 'h' => '1 klukkutími|:count klukkutímar', + 'minute' => '1 mínúta|:count mínútur', + 'min' => '1 mínúta|:count mínútur', + 'second' => '1 sekúnda|:count sekúndur', + 's' => '1 sekúnda|:count sekúndur', + 'ago' => ':time síðan', + 'from_now' => ':time síðan', + 'after' => ':time eftir', + 'before' => ':time fyrir', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/it.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/it.php index 680e0f5..70bc6d7 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/it.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/it.php @@ -9,20 +9,28 @@ * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ return array( - 'year' => '1 anno|:count anni', - 'month' => '1 mese|:count mesi', - 'week' => '1 settimana|:count settimane', - 'day' => '1 giorno|:count giorni', - 'hour' => '1 ora|:count ore', - 'minute' => '1 minuto|:count minuti', - 'second' => '1 secondo|:count secondi', - 'ago' => ':time fa', - 'from_now' => ':time da adesso', - 'after' => ':time dopo', - 'before' => ':time prima', + 'year' => ':count anno|:count anni', + 'y' => ':count anno|:count anni', + 'month' => ':count mese|:count mesi', + 'm' => ':count mese|:count mesi', + 'week' => ':count settimana|:count settimane', + 'w' => ':count settimana|:count settimane', + 'day' => ':count giorno|:count giorni', + 'd' => ':count giorno|:count giorni', + 'hour' => ':count ora|:count ore', + 'h' => ':count ora|:count ore', + 'minute' => ':count minuto|:count minuti', + 'min' => ':count minuto|:count minuti', + 'second' => ':count secondo|:count secondi', + 's' => ':count secondo|:count secondi', + 'ago' => ':time fa', + 'from_now' => 'tra :time', + 'after' => ':time dopo', + 'before' => ':time prima', + 'diff_now' => 'proprio ora', + 'diff_yesterday' => 'ieri', + 'diff_tomorrow' => 'domani', + 'diff_before_yesterday' => "l'altro ieri", + 'diff_after_tomorrow' => 'dopodomani', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/ja.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/ja.php index 66cbf90..7119547 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/ja.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/ja.php @@ -1,4 +1,5 @@ ':count 年', - 'month' => ':count ヶ月', - 'week' => ':count 週間', - 'day' => ':count 日', - 'hour' => ':count 時間', - 'minute' => ':count 分', - 'second' => ':count 秒', - 'ago' => ':time 前', - 'from_now' => '今から :time', - 'after' => ':time 後', - 'before' => ':time 前' + 'year' => ':count年', + 'y' => ':count年', + 'month' => ':countヶ月', + 'm' => ':countヶ月', + 'week' => ':count週間', + 'w' => ':count週間', + 'day' => ':count日', + 'd' => ':count日', + 'hour' => ':count時間', + 'h' => ':count時間', + 'minute' => ':count分', + 'min' => ':count分', + 'second' => ':count秒', + 's' => ':count秒', + 'ago' => ':time前', + 'from_now' => '今から:time', + 'after' => ':time後', + 'before' => ':time前', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/ka.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/ka.php new file mode 100644 index 0000000..a8dde7e --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/ka.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count წლის', + 'y' => ':count წლის', + 'month' => ':count თვის', + 'm' => ':count თვის', + 'week' => ':count კვირის', + 'w' => ':count კვირის', + 'day' => ':count დღის', + 'd' => ':count დღის', + 'hour' => ':count საათის', + 'h' => ':count საათის', + 'minute' => ':count წუთის', + 'min' => ':count წუთის', + 'second' => ':count წამის', + 's' => ':count წამის', + 'ago' => ':time უკან', + 'from_now' => ':time შემდეგ', + 'after' => ':time შემდეგ', + 'before' => ':time უკან', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/kk.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/kk.php new file mode 100644 index 0000000..8d113af --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/kk.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +return array( + 'year' => ':count жыл', + 'y' => ':count жыл', + 'month' => ':count ай', + 'm' => ':count ай', + 'week' => ':count апта', + 'w' => ':count апта', + 'day' => ':count күн', + 'd' => ':count күн', + 'hour' => ':count сағат', + 'h' => ':count сағат', + 'minute' => ':count минут', + 'min' => ':count минут', + 'second' => ':count секунд', + 's' => ':count секунд', + 'ago' => ':time бұрын', + 'from_now' => ':time кейін', + 'after' => ':time кейін', + 'before' => ':time бұрын', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/km.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/km.php new file mode 100644 index 0000000..a104e06 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/km.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count ឆ្នាំ', + 'y' => ':count ឆ្នាំ', + 'month' => ':count ខែ', + 'm' => ':count ខែ', + 'week' => ':count សប្ដាហ៍', + 'w' => ':count សប្ដាហ៍', + 'day' => ':count ថ្ងៃ', + 'd' => ':count ថ្ងៃ', + 'hour' => ':count ម៉ោង', + 'h' => ':count ម៉ោង', + 'minute' => ':count នាទី', + 'min' => ':count នាទី', + 'second' => ':count វិនាទី', + 's' => ':count វិនាទី', + 'ago' => ':timeមុន', + 'from_now' => ':timeពី​ឥឡូវ', + 'after' => 'នៅ​ក្រោយ :time', + 'before' => 'នៅ​មុន :time', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/ko.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/ko.php index fa863d9..0209164 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/ko.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/ko.php @@ -1,4 +1,5 @@ ':count 년', - 'month' => ':count 개월', - 'week' => ':count 주일', - 'day' => ':count 일', - 'hour' => ':count 시간', - 'minute' => ':count 분', - 'second' => ':count 초', - 'ago' => ':time 전', - 'from_now' => ':time 후', - 'after' => ':time 뒤', - 'before' => ':time 앞', + 'year' => ':count 년', + 'y' => ':count 년', + 'month' => ':count 개월', + 'm' => ':count 개월', + 'week' => ':count 주일', + 'w' => ':count 주일', + 'day' => ':count 일', + 'd' => ':count 일', + 'hour' => ':count 시간', + 'h' => ':count 시간', + 'minute' => ':count 분', + 'min' => ':count 분', + 'second' => ':count 초', + 's' => ':count 초', + 'ago' => ':time 전', + 'from_now' => ':time 후', + 'after' => ':time 이후', + 'before' => ':time 이전', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/lt.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/lt.php index af8ddcb..3f2fd1e 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/lt.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/lt.php @@ -9,21 +9,30 @@ * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ - return array( - 'year' => '1 metus|:count metus|:count metų', - 'month' => '1 menesį|:count menesius|:count menesių', - 'week' => '1 savaitę|:count savaites|:count savaičių', - 'day' => '1 dieną|:count dienas|:count dienų', - 'hour' => '1 valandą|:count valandas|:count valandų', - 'minute' => '1 minutę|:count minutes|:count minučių', - 'second' => '1 sekundę|:count sekundes|:count sekundžių', - 'ago' => 'prieš :time', - 'from_now' => 'už :time', - 'after' => 'po :time', - 'before' => ':time nuo dabar', + 'year' => ':count metus|:count metus|:count metų', + 'y' => ':count metus|:count metus|:count metų', + 'month' => ':count mėnesį|:count mėnesius|:count mėnesių', + 'm' => ':count mėnesį|:count mėnesius|:count mėnesių', + 'week' => ':count savaitę|:count savaites|:count savaičių', + 'w' => ':count savaitę|:count savaites|:count savaičių', + 'day' => ':count dieną|:count dienas|:count dienų', + 'd' => ':count dieną|:count dienas|:count dienų', + 'hour' => ':count valandą|:count valandas|:count valandų', + 'h' => ':count valandą|:count valandas|:count valandų', + 'minute' => ':count minutę|:count minutes|:count minučių', + 'min' => ':count minutę|:count minutes|:count minučių', + 'second' => ':count sekundę|:count sekundes|:count sekundžių', + 's' => ':count sekundę|:count sekundes|:count sekundžių', + 'second_from_now' => ':count sekundės|:count sekundžių|:count sekundžių', + 'minute_from_now' => ':count minutės|:count minučių|:count minučių', + 'hour_from_now' => ':count valandos|:count valandų|:count valandų', + 'day_from_now' => ':count dienos|:count dienų|:count dienų', + 'week_from_now' => ':count savaitės|:count savaičių|:count savaičių', + 'month_from_now' => ':count mėnesio|:count mėnesių|:count mėnesių', + 'year_from_now' => ':count metų', + 'ago' => 'prieš :time', + 'from_now' => 'už :time', + 'after' => 'po :time', + 'before' => ':time nuo dabar', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/lv.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/lv.php index fb66c22..363193d 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/lv.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/lv.php @@ -1,43 +1,47 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ return array( - 'year' => '0 gadiem|:count gada|:count gadiem', - 'month' => '0 mēnešiem|:count mēneša|:count mēnešiem', - 'week' => '0 nedēļām|:count nedēļas|:count nedēļām', - 'day' => '0 dienām|:count dienas|:count dienām', - 'hour' => '0 stundām|:count stundas|:count stundām', - 'minute' => '0 minūtēm|:count minūtes|:count minūtēm', - 'second' => '0 sekundēm|:count sekundes|:count sekundēm', - 'ago' => 'pirms :time', - 'from_now' => 'pēc :time', - 'after' => ':time vēlāk', - 'before' => ':time pirms', + 'year' => '0 gadiem|:count gada|:count gadiem', + 'y' => '0 gadiem|:count gada|:count gadiem', + 'month' => '0 mēnešiem|:count mēneša|:count mēnešiem', + 'm' => '0 mēnešiem|:count mēneša|:count mēnešiem', + 'week' => '0 nedēļām|:count nedēļas|:count nedēļām', + 'w' => '0 nedēļām|:count nedēļas|:count nedēļām', + 'day' => '0 dienām|:count dienas|:count dienām', + 'd' => '0 dienām|:count dienas|:count dienām', + 'hour' => '0 stundām|:count stundas|:count stundām', + 'h' => '0 stundām|:count stundas|:count stundām', + 'minute' => '0 minūtēm|:count minūtes|:count minūtēm', + 'min' => '0 minūtēm|:count minūtes|:count minūtēm', + 'second' => '0 sekundēm|:count sekundes|:count sekundēm', + 's' => '0 sekundēm|:count sekundes|:count sekundēm', + 'ago' => 'pirms :time', + 'from_now' => 'pēc :time', + 'after' => ':time vēlāk', + 'before' => ':time pirms', - 'year_after' => '0 gadus|:count gadu|:count gadus', - 'month_after' => '0 mēnešus|:count mēnesi|:count mēnešus', - 'week_after' => '0 nedēļas|:count nedēļu|:count nedēļas', - 'day_after' => '0 dienas|:count dienu|:count dienas', - 'hour_after' => '0 stundas|:count stundu|:count stundas', - 'minute_after' => '0 minūtes|:count minūti|:count minūtes', - 'second_after' => '0 sekundes|:count sekundi|:count sekundes', + 'year_after' => '0 gadus|:count gadu|:count gadus', + 'month_after' => '0 mēnešus|:count mēnesi|:count mēnešus', + 'week_after' => '0 nedēļas|:count nedēļu|:count nedēļas', + 'day_after' => '0 dienas|:count dienu|:count dienas', + 'hour_after' => '0 stundas|:count stundu|:count stundas', + 'minute_after' => '0 minūtes|:count minūti|:count minūtes', + 'second_after' => '0 sekundes|:count sekundi|:count sekundes', - 'year_before' => '0 gadus|:count gadu|:count gadus', - 'month_before' => '0 mēnešus|:count mēnesi|:count mēnešus', - 'week_before' => '0 nedēļas|:count nedēļu|:count nedēļas', - 'day_before' => '0 dienas|:count dienu|:count dienas', - 'hour_before' => '0 stundas|:count stundu|:count stundas', + 'year_before' => '0 gadus|:count gadu|:count gadus', + 'month_before' => '0 mēnešus|:count mēnesi|:count mēnešus', + 'week_before' => '0 nedēļas|:count nedēļu|:count nedēļas', + 'day_before' => '0 dienas|:count dienu|:count dienas', + 'hour_before' => '0 stundas|:count stundu|:count stundas', 'minute_before' => '0 minūtes|:count minūti|:count minūtes', 'second_before' => '0 sekundes|:count sekundi|:count sekundes', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/mk.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/mk.php new file mode 100644 index 0000000..c5ec12d --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/mk.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count година|:count години', + 'month' => ':count месец|:count месеци', + 'week' => ':count седмица|:count седмици', + 'day' => ':count ден|:count дена', + 'hour' => ':count час|:count часа', + 'minute' => ':count минута|:count минути', + 'second' => ':count секунда|:count секунди', + 'ago' => 'пред :time', + 'from_now' => ':time од сега', + 'after' => 'по :time', + 'before' => 'пред :time', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/mn.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/mn.php new file mode 100644 index 0000000..b26dce5 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/mn.php @@ -0,0 +1,62 @@ + + * + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @translator Batmandakh Erdenebileg + */ + +return array( + 'year' => ':count жил', + 'y' => ':count жил', + 'month' => ':count сар', + 'm' => ':count сар', + 'week' => ':count долоо хоног', + 'w' => ':count долоо хоног', + 'day' => ':count өдөр', + 'd' => ':count өдөр', + 'hour' => ':count цаг', + 'h' => ':countц', + 'minute' => ':count минут', + 'min' => ':countм', + 'second' => ':count секунд', + 's' => ':countс', + + 'ago' => ':timeн өмнө', + 'year_ago' => ':count жилий', + 'month_ago' => ':count сары', + 'day_ago' => ':count хоногий', + 'hour_ago' => ':count цагий', + 'minute_ago' => ':count минуты', + 'second_ago' => ':count секунды', + + 'from_now' => 'одоогоос :time', + 'year_from_now' => ':count жилийн дараа', + 'month_from_now' => ':count сарын дараа', + 'day_from_now' => ':count хоногийн дараа', + 'hour_from_now' => ':count цагийн дараа', + 'minute_from_now' => ':count минутын дараа', + 'second_from_now' => ':count секундын дараа', + + // Does it required to make translation for before, after as follows? hmm, I think we've made it with ago and from now keywords already. Anyway, I've included it just in case of undesired action... + 'after' => ':timeн дараа', + 'year_after' => ':count жилий', + 'month_after' => ':count сары', + 'day_after' => ':count хоногий', + 'hour_after' => ':count цагий', + 'minute_after' => ':count минуты', + 'second_after' => ':count секунды', + 'before' => ':timeн өмнө', + 'year_before' => ':count жилий', + 'month_before' => ':count сары', + 'day_before' => ':count хоногий', + 'hour_before' => ':count цагий', + 'minute_before' => ':count минуты', + 'second_before' => ':count секунды', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/ms.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/ms.php index 90304f5..ef57422 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/ms.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/ms.php @@ -1,4 +1,5 @@ ':count tahun', - 'month' => ':count bulan', - 'week' => ':count minggu', - 'day' => ':count hari', - 'hour' => ':count jam', - 'minute' => ':count minit', - 'second' => ':count saat', - 'ago' => ':time yang lalu', - 'from_now' => ':time dari sekarang', - 'after' => ':time selepas', - 'before' => ':time sebelum', + 'year' => ':count tahun', + 'y' => ':count tahun', + 'month' => ':count bulan', + 'm' => ':count bulan', + 'week' => ':count minggu', + 'w' => ':count minggu', + 'day' => ':count hari', + 'd' => ':count hari', + 'hour' => ':count jam', + 'h' => ':count jam', + 'minute' => ':count minit', + 'min' => ':count minit', + 'second' => ':count saat', + 's' => ':count saat', + 'ago' => ':time yang lalu', + 'from_now' => ':time dari sekarang', + 'after' => ':time selepas', + 'before' => ':time sebelum', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/my.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/my.php new file mode 100644 index 0000000..e8e491e --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/my.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count နှစ်|:count နှစ်', + 'y' => ':count နှစ်|:count နှစ်', + 'month' => ':count လ|:count လ', + 'm' => ':count လ|:count လ', + 'week' => ':count ပတ်|:count ပတ်', + 'w' => ':count ပတ်|:count ပတ်', + 'day' => ':count ရက်|:count ရက်', + 'd' => ':count ရက်|:count ရက်', + 'hour' => ':count နာရီ|:count နာရီ', + 'h' => ':count နာရီ|:count နာရီ', + 'minute' => ':count မိနစ်|:count မိနစ်', + 'min' => ':count မိနစ်|:count မိနစ်', + 'second' => ':count စက္ကန့်|:count စက္ကန့်', + 's' => ':count စက္ကန့်|:count စက္ကန့်', + 'ago' => 'လွန်ခဲ့သော :time က', + 'from_now' => 'ယခုမှစ၍နောက် :time အကြာ', + 'after' => ':time ကြာပြီးနောက်', + 'before' => ':time မတိုင်ခင်', + 'diff_now' => 'အခုလေးတင်', + 'diff_yesterday' => 'မနေ့က', + 'diff_tomorrow' => 'မနက်ဖြန်', + 'diff_before_yesterday' => 'တမြန်နေ့က', + 'diff_after_tomorrow' => 'တဘက်ခါ', + 'period_recurrences' => ':count ကြိမ်', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/ne.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/ne.php new file mode 100644 index 0000000..0b528df --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/ne.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count वर्ष', + 'y' => ':count वर्ष', + 'month' => ':count महिना', + 'm' => ':count महिना', + 'week' => ':count हप्ता', + 'w' => ':count हप्ता', + 'day' => ':count दिन', + 'd' => ':count दिन', + 'hour' => ':count घण्टा', + 'h' => ':count घण्टा', + 'minute' => ':count मिनेट', + 'min' => ':count मिनेट', + 'second' => ':count सेकेण्ड', + 's' => ':count सेकेण्ड', + 'ago' => ':time पहिले', + 'from_now' => ':time देखि', + 'after' => ':time पछि', + 'before' => ':time अघि', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/nl.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/nl.php index 00cd194..ec5a88e 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/nl.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/nl.php @@ -1,4 +1,5 @@ '1 jaar|:count jaren', - 'month' => '1 maand|:count maanden', - 'week' => '1 week|:count weken', - 'day' => '1 dag|:count dagen', - 'hour' => ':count uur', - 'minute' => '1 minuut|:count minuten', - 'second' => '1 seconde|:count seconden', - 'ago' => ':time geleden', - 'from_now' => 'over :time', - 'after' => ':time later', - 'before' => ':time eerder', + 'year' => ':count jaar', + 'y' => ':count jaar', + 'month' => ':count maand|:count maanden', + 'm' => ':count maand|:count maanden', + 'week' => ':count week|:count weken', + 'w' => ':count week|:count weken', + 'day' => ':count dag|:count dagen', + 'd' => ':count dag|:count dagen', + 'hour' => ':count uur', + 'h' => ':count uur', + 'minute' => ':count minuut|:count minuten', + 'min' => ':count minuut|:count minuten', + 'second' => ':count seconde|:count seconden', + 's' => ':count seconde|:count seconden', + 'ago' => ':time geleden', + 'from_now' => 'over :time', + 'after' => ':time later', + 'before' => ':time eerder', + 'diff_now' => 'nu', + 'diff_yesterday' => 'gisteren', + 'diff_tomorrow' => 'morgen', + 'diff_after_tomorrow' => 'overmorgen', + 'diff_before_yesterday' => 'eergisteren', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/no.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/no.php index 32a08c8..a6ece06 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/no.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/no.php @@ -1,4 +1,5 @@ '1 år|:count år', - 'month' => '1 måned|:count måneder', - 'week' => '1 uke|:count uker', - 'day' => '1 dag|:count dager', - 'hour' => '1 time|:count timer', - 'minute' => '1 minutt|:count minutter', - 'second' => '1 sekund|:count sekunder', - 'ago' => ':time siden', - 'from_now' => 'om :time', - 'after' => ':time etter', - 'before' => ':time før' + 'year' => ':count år|:count år', + 'y' => ':count år|:count år', + 'month' => ':count måned|:count måneder', + 'm' => ':count måned|:count måneder', + 'week' => ':count uke|:count uker', + 'w' => ':count uke|:count uker', + 'day' => ':count dag|:count dager', + 'd' => ':count dag|:count dager', + 'hour' => ':count time|:count timer', + 'h' => ':count time|:count timer', + 'minute' => ':count minutt|:count minutter', + 'min' => ':count minutt|:count minutter', + 'second' => ':count sekund|:count sekunder', + 's' => ':count sekund|:count sekunder', + 'ago' => ':time siden', + 'from_now' => 'om :time', + 'after' => ':time etter', + 'before' => ':time før', + 'diff_now' => 'akkurat nå', + 'diff_yesterday' => 'i går', + 'diff_tomorrow' => 'i morgen', + 'diff_before_yesterday' => 'i forgårs', + 'diff_after_tomorrow' => 'i overmorgen', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/oc.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/oc.php new file mode 100644 index 0000000..e89e94c --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/oc.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +\Symfony\Component\Translation\PluralizationRules::set(function ($number) { + return $number == 1 ? 0 : 1; +}, 'oc'); + +return array( + 'year' => ':count an|:count ans', + 'y' => ':count an|:count ans', + 'month' => ':count mes|:count meses', + 'm' => ':count mes|:count meses', + 'week' => ':count setmana|:count setmanas', + 'w' => ':count setmana|:count setmanas', + 'day' => ':count jorn|:count jorns', + 'd' => ':count jorn|:count jorns', + 'hour' => ':count ora|:count oras', + 'h' => ':count ora|:count oras', + 'minute' => ':count minuta|:count minutas', + 'min' => ':count minuta|:count minutas', + 'second' => ':count segonda|:count segondas', + 's' => ':count segonda|:count segondas', + 'ago' => 'fa :time', + 'from_now' => 'dins :time', + 'after' => ':time aprèp', + 'before' => ':time abans', + 'diff_now' => 'ara meteis', + 'diff_yesterday' => 'ièr', + 'diff_tomorrow' => 'deman', + 'diff_before_yesterday' => 'ièr delà', + 'diff_after_tomorrow' => 'deman passat', + 'period_recurrences' => ':count còp|:count còps', + 'period_interval' => 'cada :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'fins a :date', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/pl.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/pl.php index 1381d90..2308af2 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/pl.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/pl.php @@ -1,4 +1,5 @@ '1 rok|:count lata|:count lat', - 'month' => '1 miesiąc|:count miesiące|:count miesięcy', - 'week' => '1 tydzień|:count tygodnie|:count tygodni', - 'day' => '1 dzień|:count dni|:count dni', - 'hour' => '1 godzina|:count godziny|:count godzin', - 'minute' => '1 minuta|:count minuty|:count minut', - 'second' => '1 sekunda|:count sekundy|:count sekund', - 'ago' => ':time temu', - 'from_now' => ':time od teraz', - 'after' => ':time przed', - 'before' => ':time po' + 'year' => ':count rok|:count lata|:count lat', + 'y' => ':countr|:countl', + 'month' => ':count miesiąc|:count miesiące|:count miesięcy', + 'm' => ':countmies', + 'week' => ':count tydzień|:count tygodnie|:count tygodni', + 'w' => ':counttyg', + 'day' => ':count dzień|:count dni|:count dni', + 'd' => ':countd', + 'hour' => ':count godzina|:count godziny|:count godzin', + 'h' => ':countg', + 'minute' => ':count minuta|:count minuty|:count minut', + 'min' => ':countm', + 'second' => ':count sekunda|:count sekundy|:count sekund', + 's' => ':counts', + 'ago' => ':time temu', + 'from_now' => ':time od teraz', + 'after' => ':time po', + 'before' => ':time przed', + 'diff_now' => 'przed chwilą', + 'diff_yesterday' => 'wczoraj', + 'diff_tomorrow' => 'jutro', + 'diff_before_yesterday' => 'przedwczoraj', + 'diff_after_tomorrow' => 'pojutrze', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/ps.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/ps.php new file mode 100644 index 0000000..15c3296 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/ps.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count کال|:count کاله', + 'y' => ':countکال|:countکاله', + 'month' => ':count مياشت|:count مياشتي', + 'm' => ':countمياشت|:countمياشتي', + 'week' => ':count اونۍ|:count اونۍ', + 'w' => ':countاونۍ|:countاونۍ', + 'day' => ':count ورځ|:count ورځي', + 'd' => ':countورځ|:countورځي', + 'hour' => ':count ساعت|:count ساعته', + 'h' => ':countساعت|:countساعته', + 'minute' => ':count دقيقه|:count دقيقې', + 'min' => ':countدقيقه|:countدقيقې', + 'second' => ':count ثانيه|:count ثانيې', + 's' => ':countثانيه|:countثانيې', + 'ago' => ':time دمخه', + 'from_now' => ':time له اوس څخه', + 'after' => ':time وروسته', + 'before' => ':time دمخه', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/pt.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/pt.php index 4ee091f..392b121 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/pt.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/pt.php @@ -1,4 +1,5 @@ '1 ano|:count anos', - 'month' => '1 mês|:count meses', - 'week' => '1 semana|:count semanas', - 'day' => '1 dia|:count dias', - 'hour' => '1 hora|:count horas', - 'minute' => '1 minuto|:count minutos', - 'second' => '1 segundo|:count segundos', - 'ago' => ':time atrás', - 'from_now' => 'em :time', - 'after' => ':time depois', - 'before' => ':time antes' + 'year' => ':count ano|:count anos', + 'y' => ':count ano|:count anos', + 'month' => ':count mês|:count meses', + 'm' => ':count mês|:count meses', + 'week' => ':count semana|:count semanas', + 'w' => ':count semana|:count semanas', + 'day' => ':count dia|:count dias', + 'd' => ':count dia|:count dias', + 'hour' => ':count hora|:count horas', + 'h' => ':count hora|:count horas', + 'minute' => ':count minuto|:count minutos', + 'min' => ':count minuto|:count minutos', + 'second' => ':count segundo|:count segundos', + 's' => ':count segundo|:count segundos', + 'ago' => ':time atrás', + 'from_now' => 'em :time', + 'after' => ':time depois', + 'before' => ':time antes', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php index cd9a90e..1f84eac 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php @@ -1,4 +1,5 @@ '1 ano|:count anos', - 'month' => '1 mês|:count meses', - 'week' => '1 semana|:count semanas', - 'day' => '1 dia|:count dias', - 'hour' => '1 hora|:count horas', - 'minute' => '1 minuto|:count minutos', - 'second' => '1 segundo|:count segundos', - 'ago' => 'há :time', - 'from_now' => 'dentro de :time', - 'after' => 'após :time', - 'before' => ':time atrás', + 'year' => ':count ano|:count anos', + 'y' => ':counta|:counta', + 'month' => ':count mês|:count meses', + 'm' => ':countm|:countm', + 'week' => ':count semana|:count semanas', + 'w' => ':countsem|:countsem', + 'day' => ':count dia|:count dias', + 'd' => ':countd|:countd', + 'hour' => ':count hora|:count horas', + 'h' => ':counth|:counth', + 'minute' => ':count minuto|:count minutos', + 'min' => ':countmin|:countmin', + 'second' => ':count segundo|:count segundos', + 's' => ':counts|:counts', + 'ago' => 'há :time', + 'from_now' => 'em :time', + 'after' => 'após :time', + 'before' => ':time atrás', + 'diff_now' => 'agora', + 'diff_yesterday' => 'ontem', + 'diff_tomorrow' => 'amanhã', + 'diff_before_yesterday' => 'anteontem', + 'diff_after_tomorrow' => 'depois de amanhã', + 'period_recurrences' => 'uma|:count vez', + 'period_interval' => 'toda :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'até :date', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/ro.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/ro.php index bd812f0..cc16724 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/ro.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/ro.php @@ -1,4 +1,5 @@ 'un an|:count ani|:count ani', - 'month' => 'o lună|:count luni|:count luni', - 'week' => 'o săptămână|:count săptămâni|:count săptămâni', - 'day' => 'o zi|:count zile|:count zile', - 'hour' => 'o oră|:count ore|:count ore', - 'minute' => 'un minut|:count minute|:count minute', - 'second' => 'o secundă|:count secunde|:count secunde', - 'ago' => 'acum :time', - 'from_now' => ':time de acum', - 'after' => 'peste :time', - 'before' => 'acum :time' + 'year' => 'un an|:count ani|:count ani', + 'y' => 'un an|:count ani|:count ani', + 'month' => 'o lună|:count luni|:count luni', + 'm' => 'o lună|:count luni|:count luni', + 'week' => 'o săptămână|:count săptămâni|:count săptămâni', + 'w' => 'o săptămână|:count săptămâni|:count săptămâni', + 'day' => 'o zi|:count zile|:count zile', + 'd' => 'o zi|:count zile|:count zile', + 'hour' => 'o oră|:count ore|:count ore', + 'h' => 'o oră|:count ore|:count ore', + 'minute' => 'un minut|:count minute|:count minute', + 'min' => 'un minut|:count minute|:count minute', + 'second' => 'o secundă|:count secunde|:count secunde', + 's' => 'o secundă|:count secunde|:count secunde', + 'ago' => 'acum :time', + 'from_now' => ':time de acum', + 'after' => 'peste :time', + 'before' => 'acum :time', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/ru.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/ru.php index c843c35..6a83fb1 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/ru.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/ru.php @@ -1,4 +1,5 @@ ':count год|:count года|:count лет', - 'month' => ':count месяц|:count месяца|:count месяцев', - 'week' => ':count неделю|:count недели|:count недель', - 'day' => ':count день|:count дня|:count дней', - 'hour' => ':count час|:count часа|:count часов', - 'minute' => ':count минуту|:count минуты|:count минут', - 'second' => ':count секунду|:count секунды|:count секунд', - 'ago' => ':time назад', - 'from_now' => 'через :time', - 'after' => ':time после', - 'before' => ':time до' + 'year' => ':count год|:count года|:count лет', + 'y' => ':count г|:count г|:count л', + 'month' => ':count месяц|:count месяца|:count месяцев', + 'm' => ':count м|:count м|:count м', + 'week' => ':count неделю|:count недели|:count недель', + 'w' => ':count н|:count н|:count н', + 'day' => ':count день|:count дня|:count дней', + 'd' => ':count д|:count д|:count д', + 'hour' => ':count час|:count часа|:count часов', + 'h' => ':count ч|:count ч|:count ч', + 'minute' => ':count минуту|:count минуты|:count минут', + 'min' => ':count мин|:count мин|:count мин', + 'second' => ':count секунду|:count секунды|:count секунд', + 's' => ':count с|:count с|:count с', + 'ago' => ':time назад', + 'from_now' => 'через :time', + 'after' => ':time после', + 'before' => ':time до', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/sh.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/sh.php new file mode 100644 index 0000000..57f287a --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/sh.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +\Symfony\Component\Translation\PluralizationRules::set(function ($number) { + return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); +}, 'sh'); + +return array( + 'year' => ':count godina|:count godine|:count godina', + 'y' => ':count godina|:count godine|:count godina', + 'month' => ':count mesec|:count meseca|:count meseci', + 'm' => ':count mesec|:count meseca|:count meseci', + 'week' => ':count nedelja|:count nedelje|:count nedelja', + 'w' => ':count nedelja|:count nedelje|:count nedelja', + 'day' => ':count dan|:count dana|:count dana', + 'd' => ':count dan|:count dana|:count dana', + 'hour' => ':count čas|:count časa|:count časova', + 'h' => ':count čas|:count časa|:count časova', + 'minute' => ':count minut|:count minuta|:count minuta', + 'min' => ':count minut|:count minuta|:count minuta', + 'second' => ':count sekund|:count sekunda|:count sekundi', + 's' => ':count sekund|:count sekunda|:count sekundi', + 'ago' => 'pre :time', + 'from_now' => 'za :time', + 'after' => 'nakon :time', + 'before' => ':time raniјe', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/sk.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/sk.php index 8729e45..6101344 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/sk.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/sk.php @@ -1,4 +1,5 @@ 'rok|:count roky|:count rokov', - 'month' => 'mesiac|:count mesiace|:count mesiacov', - 'week' => 'týždeň|:count týždne|:count týždňov', - 'day' => 'deň|:count dni|:count dní', - 'hour' => 'hodinu|:count hodiny|:count hodín', - 'minute' => 'minútu|:count minúty|:count minút', - 'second' => 'sekundu|:count sekundy|:count sekúnd', - 'ago' => 'pred :time', - 'from_now' => 'za :time', - 'after' => ':time neskôr', - 'before' => ':time predtým' + 'year' => 'rok|:count roky|:count rokov', + 'y' => 'rok|:count roky|:count rokov', + 'month' => 'mesiac|:count mesiace|:count mesiacov', + 'm' => 'mesiac|:count mesiace|:count mesiacov', + 'week' => 'týždeň|:count týždne|:count týždňov', + 'w' => 'týždeň|:count týždne|:count týždňov', + 'day' => 'deň|:count dni|:count dní', + 'd' => 'deň|:count dni|:count dní', + 'hour' => 'hodinu|:count hodiny|:count hodín', + 'h' => 'hodinu|:count hodiny|:count hodín', + 'minute' => 'minútu|:count minúty|:count minút', + 'min' => 'minútu|:count minúty|:count minút', + 'second' => 'sekundu|:count sekundy|:count sekúnd', + 's' => 'sekundu|:count sekundy|:count sekúnd', + 'ago' => 'pred :time', + 'from_now' => 'za :time', + 'after' => 'o :time neskôr', + 'before' => ':time predtým', + 'year_ago' => 'rokom|:count rokmi|:count rokmi', + 'month_ago' => 'mesiacom|:count mesiacmi|:count mesiacmi', + 'week_ago' => 'týždňom|:count týždňami|:count týždňami', + 'day_ago' => 'dňom|:count dňami|:count dňami', + 'hour_ago' => 'hodinou|:count hodinami|:count hodinami', + 'minute_ago' => 'minútou|:count minútami|:count minútami', + 'second_ago' => 'sekundou|:count sekundami|:count sekundami', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/sl.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/sl.php index 8149a5d..06686d1 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/sl.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/sl.php @@ -1,4 +1,5 @@ ':count leto|:count leti|:count leta|:count let', - 'month' => ':count mesec|:count meseca|:count mesece|:count mesecev', - 'week' => ':count teden|:count tedna|:count tedne|:count tednov', - 'day' => ':count dan|:count dni|:count dni|:count dni', - 'hour' => ':count uro|:count uri|:count ure|:count ur', - 'minute' => ':count minuto|:count minuti|:count minute|:count minut', - 'second' => ':count sekundo|:count sekundi|:count sekunde|:count sekund', - 'year_ago' => ':count letom|:count leti|:count leti|:count leti', + 'year' => ':count leto|:count leti|:count leta|:count let', + 'y' => ':count leto|:count leti|:count leta|:count let', + 'month' => ':count mesec|:count meseca|:count mesece|:count mesecev', + 'm' => ':count mesec|:count meseca|:count mesece|:count mesecev', + 'week' => ':count teden|:count tedna|:count tedne|:count tednov', + 'w' => ':count teden|:count tedna|:count tedne|:count tednov', + 'day' => ':count dan|:count dni|:count dni|:count dni', + 'd' => ':count dan|:count dni|:count dni|:count dni', + 'hour' => ':count uro|:count uri|:count ure|:count ur', + 'h' => ':count uro|:count uri|:count ure|:count ur', + 'minute' => ':count minuto|:count minuti|:count minute|:count minut', + 'min' => ':count minuto|:count minuti|:count minute|:count minut', + 'second' => ':count sekundo|:count sekundi|:count sekunde|:count sekund', + 's' => ':count sekundo|:count sekundi|:count sekunde|:count sekund', + 'year_ago' => ':count letom|:count leti|:count leti|:count leti', 'month_ago' => ':count mesecem|:count meseci|:count meseci|:count meseci', - 'week_ago' => ':count tednom|:count tednoma|:count tedni|:count tedni', - 'day_ago' => ':count dnem|:count dnevoma|:count dnevi|:count dnevi', - 'hour_ago' => ':count uro|:count urama|:count urami|:count urami', - 'minute_ago'=> ':count minuto|:count minutama|:count minutami|:count minutami', - 'second_ago'=> ':count sekundo|:count sekundama|:count sekundami|:count sekundami', - 'ago' => 'pred :time', - 'from_now' => 'čez :time', - 'after' => 'čez :time', - 'before' => 'pred :time' + 'week_ago' => ':count tednom|:count tednoma|:count tedni|:count tedni', + 'day_ago' => ':count dnem|:count dnevoma|:count dnevi|:count dnevi', + 'hour_ago' => ':count uro|:count urama|:count urami|:count urami', + 'minute_ago' => ':count minuto|:count minutama|:count minutami|:count minutami', + 'second_ago' => ':count sekundo|:count sekundama|:count sekundami|:count sekundami', + 'ago' => 'pred :time', + 'from_now' => 'čez :time', + 'after' => 'čez :time', + 'before' => 'pred :time', + 'diff_now' => 'ravnokar', + 'diff_yesterday' => 'včeraj', + 'diff_tomorrow' => 'jutri', + 'diff_before_yesterday' => 'predvčerajšnjim', + 'diff_after_tomorrow' => 'pojutrišnjem', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/sq.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/sq.php index 4778260..6e138a0 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/sq.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/sq.php @@ -9,20 +9,23 @@ * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ return array( - 'year' => '1 vit|:count vjet', - 'month' => '1 muaj|:count muaj', - 'week' => '1 javë|:count javë', - 'day' => '1 ditë|:count ditë', - 'hour' => '1 orë|:count orë', - 'minute' => '1 minutë|:count minuta', - 'second' => '1 sekondë|:count sekonda', - 'ago' => ':time më parë', - 'from_now' => ':time nga tani', - 'after' => ':time pas', - 'before' => ':time para', + 'year' => ':count vit|:count vjet', + 'y' => ':count vit|:count vjet', + 'month' => ':count muaj|:count muaj', + 'm' => ':count muaj|:count muaj', + 'week' => ':count javë|:count javë', + 'w' => ':count javë|:count javë', + 'day' => ':count ditë|:count ditë', + 'd' => ':count ditë|:count ditë', + 'hour' => ':count orë|:count orë', + 'h' => ':count orë|:count orë', + 'minute' => ':count minutë|:count minuta', + 'min' => ':count minutë|:count minuta', + 'second' => ':count sekondë|:count sekonda', + 's' => ':count sekondë|:count sekonda', + 'ago' => ':time më parë', + 'from_now' => ':time nga tani', + 'after' => ':time pas', + 'before' => ':time para', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/sr.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/sr.php index af060fa..5a10642 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/sr.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/sr.php @@ -1,4 +1,5 @@ ':count godina|:count godine|:count godina', - 'month' => ':count mesec|:count meseca|:count meseci', - 'week' => ':count nedelja|:count nedelje|:count nedelja', - 'day' => ':count dan|:count dana|:count dana', - 'hour' => ':count sat|:count sata|:count sati', - 'minute' => ':count minut|:count minuta |:count minuta', - 'second' => ':count sekund|:count sekunde|:count sekunde', - 'ago' => 'pre :time', - 'from_now' => ':time od sada', - 'after' => 'nakon :time', - 'before' => 'pre :time' + 'year' => ':count godina|:count godine|:count godina', + 'y' => ':count godina|:count godine|:count godina', + 'month' => ':count mesec|:count meseca|:count meseci', + 'm' => ':count mesec|:count meseca|:count meseci', + 'week' => ':count nedelja|:count nedelje|:count nedelja', + 'w' => ':count nedelja|:count nedelje|:count nedelja', + 'day' => ':count dan|:count dana|:count dana', + 'd' => ':count dan|:count dana|:count dana', + 'hour' => ':count sat|:count sata|:count sati', + 'h' => ':count sat|:count sata|:count sati', + 'minute' => ':count minut|:count minuta |:count minuta', + 'min' => ':count minut|:count minuta |:count minuta', + 'second' => ':count sekund|:count sekunde|:count sekunde', + 's' => ':count sekund|:count sekunde|:count sekunde', + 'ago' => 'pre :time', + 'from_now' => ':time od sada', + 'after' => 'nakon :time', + 'before' => 'pre :time', + + 'year_from_now' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', + 'year_ago' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', + + 'week_from_now' => '{1} :count nedelju|{2,3,4} :count nedelje|[5,Inf[ :count nedelja', + 'week_ago' => '{1} :count nedelju|{2,3,4} :count nedelje|[5,Inf[ :count nedelja', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php new file mode 100644 index 0000000..2db83ed --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[ :count година', + 'y' => ':count г.', + 'month' => '{1} :count месец|{2,3,4}:count месеца|[5,Inf[ :count месеци', + 'm' => ':count м.', + 'week' => '{1} :count недеља|{2,3,4}:count недеље|[5,Inf[ :count недеља', + 'w' => ':count нед.', + 'day' => '{1,21,31} :count дан|[2,Inf[ :count дана', + 'd' => ':count д.', + 'hour' => '{1,21} :count сат|{2,3,4,22,23,24}:count сата|[5,Inf[ :count сати', + 'h' => ':count ч.', + 'minute' => '{1,21,31,41,51} :count минут|[2,Inf[ :count минута', + 'min' => ':count мин.', + 'second' => '{1,21,31,41,51} :count секунд|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count секунде|[5,Inf[:count секунди', + 's' => ':count сек.', + 'ago' => 'пре :time', + 'from_now' => 'за :time', + 'after' => ':time након', + 'before' => ':time пре', + + 'year_from_now' => '{1,21,31,41,51} :count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count године|[5,Inf[ :count година', + 'year_ago' => '{1,21,31,41,51} :count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count године|[5,Inf[ :count година', + + 'week_from_now' => '{1} :count недељу|{2,3,4} :count недеље|[5,Inf[ :count недеља', + 'week_ago' => '{1} :count недељу|{2,3,4} :count недеље|[5,Inf[ :count недеља', + + 'diff_now' => 'управо сада', + 'diff_yesterday' => 'јуче', + 'diff_tomorrow' => 'сутра', + 'diff_before_yesterday' => 'прекјуче', + 'diff_after_tomorrow' => 'прекосутра', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php new file mode 100644 index 0000000..18214c4 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[ :count година', + 'y' => ':count г.', + 'month' => '{1} :count мјесец|{2,3,4}:count мјесеца|[5,Inf[ :count мјесеци', + 'm' => ':count мј.', + 'week' => '{1} :count недјеља|{2,3,4}:count недјеље|[5,Inf[ :count недјеља', + 'w' => ':count нед.', + 'day' => '{1,21,31} :count дан|[2,Inf[ :count дана', + 'd' => ':count д.', + 'hour' => '{1,21} :count сат|{2,3,4,22,23,24}:count сата|[5,Inf[ :count сати', + 'h' => ':count ч.', + 'minute' => '{1,21,31,41,51} :count минут|[2,Inf[ :count минута', + 'min' => ':count мин.', + 'second' => '{1,21,31,41,51} :count секунд|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count секунде|[5,Inf[:count секунди', + 's' => ':count сек.', + 'ago' => 'прије :time', + 'from_now' => 'за :time', + 'after' => ':time након', + 'before' => ':time прије', + + 'year_from_now' => '{1,21,31,41,51} :count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count године|[5,Inf[ :count година', + 'year_ago' => '{1,21,31,41,51} :count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count године|[5,Inf[ :count година', + + 'week_from_now' => '{1} :count недјељу|{2,3,4} :count недјеље|[5,Inf[ :count недјеља', + 'week_ago' => '{1} :count недјељу|{2,3,4} :count недјеље|[5,Inf[ :count недјеља', + + 'diff_now' => 'управо сада', + 'diff_yesterday' => 'јуче', + 'diff_tomorrow' => 'сутра', + 'diff_before_yesterday' => 'прекјуче', + 'diff_after_tomorrow' => 'прекосјутра', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php new file mode 100644 index 0000000..2d2e288 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count godine|[0,Inf[ :count godina', + 'y' => ':count g.', + 'month' => '{1} :count mjesec|{2,3,4}:count mjeseca|[5,Inf[ :count mjeseci', + 'm' => ':count mj.', + 'week' => '{1} :count nedjelja|{2,3,4}:count nedjelje|[5,Inf[ :count nedjelja', + 'w' => ':count ned.', + 'day' => '{1,21,31} :count dan|[2,Inf[ :count dana', + 'd' => ':count d.', + 'hour' => '{1,21} :count sat|{2,3,4,22,23,24}:count sata|[5,Inf[ :count sati', + 'h' => ':count č.', + 'minute' => '{1,21,31,41,51} :count minut|[2,Inf[ :count minuta', + 'min' => ':count min.', + 'second' => '{1,21,31,41,51} :count sekund|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count sekunde|[5,Inf[:count sekundi', + 's' => ':count sek.', + 'ago' => 'prije :time', + 'from_now' => 'za :time', + 'after' => ':time nakon', + 'before' => ':time prije', + + 'year_from_now' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', + 'year_ago' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', + + 'week_from_now' => '{1} :count nedjelju|{2,3,4} :count nedjelje|[5,Inf[ :count nedjelja', + 'week_ago' => '{1} :count nedjelju|{2,3,4} :count nedjelje|[5,Inf[ :count nedjelja', + + 'diff_now' => 'upravo sada', + 'diff_yesterday' => 'juče', + 'diff_tomorrow' => 'sutra', + 'diff_before_yesterday' => 'prekjuče', + 'diff_after_tomorrow' => 'preksutra', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php new file mode 100644 index 0000000..7ebf6f0 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/sr_Latn_ME.php'; diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/sv.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/sv.php index 54f61fc..89a03b4 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/sv.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/sv.php @@ -1,4 +1,5 @@ '1 år|:count år', - 'month' => '1 månad|:count månader', - 'week' => '1 vecka|:count veckor', - 'day' => '1 dag|:count dagar', - 'hour' => '1 timme|:count timmar', - 'minute' => '1 minut|:count minuter', - 'second' => '1 sekund|:count sekunder', - 'ago' => ':time sedan', - 'from_now' => 'om :time', - 'after' => ':time efter', - 'before' => ':time före' + 'year' => ':count år|:count år', + 'y' => ':count år|:count år', + 'month' => ':count månad|:count månader', + 'm' => ':count månad|:count månader', + 'week' => ':count vecka|:count veckor', + 'w' => ':count vecka|:count veckor', + 'day' => ':count dag|:count dagar', + 'd' => ':count dag|:count dagar', + 'hour' => ':count timme|:count timmar', + 'h' => ':count timme|:count timmar', + 'minute' => ':count minut|:count minuter', + 'min' => ':count minut|:count minuter', + 'second' => ':count sekund|:count sekunder', + 's' => ':count sekund|:count sekunder', + 'ago' => ':time sedan', + 'from_now' => 'om :time', + 'after' => ':time efter', + 'before' => ':time före', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/sw.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/sw.php new file mode 100644 index 0000000..52f0342 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/sw.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => 'mwaka 1|miaka :count', + 'y' => 'mwaka 1|miaka :count', + 'month' => 'mwezi 1|miezi :count', + 'm' => 'mwezi 1|miezi :count', + 'week' => 'wiki 1|wiki :count', + 'w' => 'wiki 1|wiki :count', + 'day' => 'siku 1|siku :count', + 'd' => 'siku 1|siku :count', + 'hour' => 'saa 1|masaa :count', + 'h' => 'saa 1|masaa :count', + 'minute' => 'dakika 1|dakika :count', + 'min' => 'dakika 1|dakika :count', + 'second' => 'sekunde 1|sekunde :count', + 's' => 'sekunde 1|sekunde :count', + 'ago' => ':time ziliyopita', + 'from_now' => ':time kwanzia sasa', + 'after' => ':time baada', + 'before' => ':time kabla', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/th.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/th.php index 13459bc..88bb4ac 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/th.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/th.php @@ -1,4 +1,5 @@ '1 ปี|:count ปี', - 'month' => '1 เดือน|:count เดือน', - 'week' => '1 สัปดาห์|:count สัปดาห์', - 'day' => '1 วัน|:count วัน', - 'hour' => '1 ชั่วโมง|:count ชั่วโมง', - 'minute' => '1 นาที|:count นาที', - 'second' => '1 วินาที|:count วินาที', - 'ago' => ':time ที่แล้ว', - 'from_now' => ':time จากนี้', - 'after' => 'หลัง:time', - 'before' => 'ก่อน:time' + 'year' => ':count ปี', + 'y' => ':count ปี', + 'month' => ':count เดือน', + 'm' => ':count เดือน', + 'week' => ':count สัปดาห์', + 'w' => ':count สัปดาห์', + 'day' => ':count วัน', + 'd' => ':count วัน', + 'hour' => ':count ชั่วโมง', + 'h' => ':count ชั่วโมง', + 'minute' => ':count นาที', + 'min' => ':count นาที', + 'second' => ':count วินาที', + 's' => ':count วินาที', + 'ago' => ':timeที่แล้ว', + 'from_now' => ':timeต่อจากนี้', + 'after' => ':timeหลังจากนี้', + 'before' => ':timeก่อน', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/tr.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/tr.php index d7f5134..6a9dfed 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/tr.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/tr.php @@ -9,20 +9,23 @@ * file that was distributed with this source code. */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ return array( - 'year' => ':count yıl', - 'month' => ':count ay', - 'week' => ':count hafta', - 'day' => ':count gün', - 'hour' => ':count saat', - 'minute' => ':count dakika', - 'second' => ':count saniye', - 'ago' => ':time önce', - 'from_now' => ':time andan itibaren', - 'after' => ':time sonra', - 'before' => ':time önce', + 'year' => ':count yıl', + 'y' => ':count yıl', + 'month' => ':count ay', + 'm' => ':count ay', + 'week' => ':count hafta', + 'w' => ':count hafta', + 'day' => ':count gün', + 'd' => ':count gün', + 'hour' => ':count saat', + 'h' => ':count saat', + 'minute' => ':count dakika', + 'min' => ':count dakika', + 'second' => ':count saniye', + 's' => ':count saniye', + 'ago' => ':time önce', + 'from_now' => ':time sonra', + 'after' => ':time sonra', + 'before' => ':time önce', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/uk.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/uk.php index 6a23d27..8d08eaa 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/uk.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/uk.php @@ -1,4 +1,5 @@ ':count рік|:count роки|:count років', - 'month' => ':count місяць|:count місяці|:count місяців', - 'week' => ':count тиждень|:count тижні|:count тижнів', - 'day' => ':count день|:count дні|:count днів', - 'hour' => ':count година|:count години|:count годин', - 'minute' => ':count хвилину|:count хвилини|:count хвилин', - 'second' => ':count секунду|:count секунди|:count секунд', - 'ago' => ':time назад', - 'from_now' => 'через :time', - 'after' => ':time після', - 'before' => ':time до' + 'year' => ':count рік|:count роки|:count років', + 'y' => ':count рік|:count роки|:count років', + 'month' => ':count місяць|:count місяці|:count місяців', + 'm' => ':count місяць|:count місяці|:count місяців', + 'week' => ':count тиждень|:count тижні|:count тижнів', + 'w' => ':count тиждень|:count тижні|:count тижнів', + 'day' => ':count день|:count дні|:count днів', + 'd' => ':count день|:count дні|:count днів', + 'hour' => ':count година|:count години|:count годин', + 'h' => ':count година|:count години|:count годин', + 'minute' => ':count хвилину|:count хвилини|:count хвилин', + 'min' => ':count хвилину|:count хвилини|:count хвилин', + 'second' => ':count секунду|:count секунди|:count секунд', + 's' => ':count секунду|:count секунди|:count секунд', + 'ago' => ':time тому', + 'from_now' => 'через :time', + 'after' => ':time після', + 'before' => ':time до', + 'diff_now' => 'щойно', + 'diff_yesterday' => 'вчора', + 'diff_tomorrow' => 'завтра', + 'diff_before_yesterday' => 'позавчора', + 'diff_after_tomorrow' => 'післязавтра', + 'period_recurrences' => 'один раз|:count рази|:count разів', + 'period_interval' => 'кожні :interval', + 'period_start_date' => 'з :date', + 'period_end_date' => 'до :date', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/ur.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/ur.php new file mode 100644 index 0000000..3c5f7ed --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/ur.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count سال', + 'month' => ':count ماه', + 'week' => ':count ہفتے', + 'day' => ':count روز', + 'hour' => ':count گھنٹے', + 'minute' => ':count منٹ', + 'second' => ':count سیکنڈ', + 'ago' => ':time پہلے', + 'from_now' => ':time بعد', + 'after' => ':time بعد', + 'before' => ':time پہلے', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/uz.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/uz.php index d9a5efa..1cb6f71 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/uz.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/uz.php @@ -1,4 +1,5 @@ ':count yil|:count yil|:count yil', - 'month' => ':count oy|:count oy|:count oylar', - 'week' => ':count hafta|:count hafta|:count hafta', - 'day' => ':count kun|:count kun|:count kun', - 'hour' => ':count soat|:count soat|:count soat', - 'minute' => ':count minut|:count minut|:count minut', - 'second' => ':count sekund|:count sekund|:count sekund', - 'ago' => ':time avval', - 'from_now' => 'keyin :time', - 'after' => ':time keyin', - 'before' => ':time gacha' + 'year' => ':count yil', + 'y' => ':count yil', + 'month' => ':count oy', + 'm' => ':count oy', + 'week' => ':count hafta', + 'w' => ':count hafta', + 'day' => ':count kun', + 'd' => ':count kun', + 'hour' => ':count soat', + 'h' => ':count soat', + 'minute' => ':count daqiqa', + 'min' => ':count daq', + 'second' => ':count soniya', + 's' => ':count s', + 'ago' => ':time avval', + 'from_now' => ':time dan keyin', + 'after' => ':time keyin', + 'before' => ':time oldin', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/vi.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/vi.php index e0e8dfc..3f9838d 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/vi.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/vi.php @@ -1,4 +1,5 @@ ':count năm', - 'month' => ':count tháng', - 'week' => ':count tuần', - 'day' => ':count ngày', - 'hour' => ':count giờ', - 'minute' => ':count phút', - 'second' => ':count giây', - 'ago' => ':time trước', - 'from_now' => ':time từ bây giờ', - 'after' => ':time sau', - 'before' => ':time trước' + 'year' => ':count năm', + 'y' => ':count năm', + 'month' => ':count tháng', + 'm' => ':count tháng', + 'week' => ':count tuần', + 'w' => ':count tuần', + 'day' => ':count ngày', + 'd' => ':count ngày', + 'hour' => ':count giờ', + 'h' => ':count giờ', + 'minute' => ':count phút', + 'min' => ':count phút', + 'second' => ':count giây', + 's' => ':count giây', + 'ago' => ':time trước', + 'from_now' => ':time từ bây giờ', + 'after' => ':time sau', + 'before' => ':time trước', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/zh-TW.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/zh-TW.php deleted file mode 100644 index 30f0825..0000000 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/zh-TW.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -/** - * Translation messages. See http://symfony.com/doc/current/book/translation.html - * for possible formats. - */ -/** - * Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/zh-TW/date.php - */ -return array( - 'year' => ':count 年', - 'month' => ':count 月', - 'week' => ':count 周', - 'day' => ':count 天', - 'hour' => ':count 小時', - 'minute' => ':count 分鐘', - 'second' => ':count 秒', - 'ago' => ':time前', - 'from_now' => '距現在 :time', - 'after' => ':time後', - 'before' => ':time前' -); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/zh.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/zh.php index 58ea74f..9e1f6ca 100644 --- a/application/vendor/nesbot/carbon/src/Carbon/Lang/zh.php +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/zh.php @@ -1,4 +1,5 @@ ':count年', - 'month' => ':count月', - 'week' => ':count周', - 'day' => ':count天', - 'hour' => ':count小时', - 'minute' => ':count分钟', - 'second' => ':count秒', - 'ago' => ':time前', - 'from_now' => ':time距现在', - 'after' => ':time后', - 'before' => ':time前' + 'year' => ':count年', + 'y' => ':count年', + 'month' => ':count个月', + 'm' => ':count个月', + 'week' => ':count周', + 'w' => ':count周', + 'day' => ':count天', + 'd' => ':count天', + 'hour' => ':count小时', + 'h' => ':count小时', + 'minute' => ':count分钟', + 'min' => ':count分钟', + 'second' => ':count秒', + 's' => ':count秒', + 'ago' => ':time前', + 'from_now' => '距现在:time', + 'after' => ':time后', + 'before' => ':time前', ); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php b/application/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php new file mode 100644 index 0000000..c848723 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count年', + 'y' => ':count年', + 'month' => ':count月', + 'm' => ':count月', + 'week' => ':count週', + 'w' => ':count週', + 'day' => ':count天', + 'd' => ':count天', + 'hour' => ':count小時', + 'h' => ':count小時', + 'minute' => ':count分鐘', + 'min' => ':count分鐘', + 'second' => ':count秒', + 's' => ':count秒', + 'ago' => ':time前', + 'from_now' => '距現在:time', + 'after' => ':time後', + 'before' => ':time前', +); diff --git a/application/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php b/application/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php new file mode 100644 index 0000000..4d83b0c --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php @@ -0,0 +1,37 @@ +app['events']; + if ($events instanceof EventDispatcher || $events instanceof Dispatcher) { + $events->listen(class_exists('Illuminate\Foundation\Events\LocaleUpdated') ? 'Illuminate\Foundation\Events\LocaleUpdated' : 'locale.changed', function () use ($service) { + $service->updateLocale(); + }); + $service->updateLocale(); + } + } + + public function updateLocale() + { + $translator = $this->app['translator']; + if ($translator instanceof Translator || $translator instanceof IlluminateTranslator) { + Carbon::setLocale($translator->getLocale()); + } + } + + public function register() + { + // Needed for Laravel < 5.3 compatibility + } +} diff --git a/application/vendor/nesbot/carbon/src/Carbon/Translator.php b/application/vendor/nesbot/carbon/src/Carbon/Translator.php new file mode 100644 index 0000000..12115b0 --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Translator.php @@ -0,0 +1,143 @@ +addLoader('array', new Translation\Loader\ArrayLoader()); + parent::__construct($locale, $formatter, $cacheDir, $debug); + } + + /** + * Reset messages of a locale (all locale if no locale passed). + * Remove custom messages and reload initial messages from matching + * file in Lang directory. + * + * @param string|null $locale + * + * @return bool + */ + public function resetMessages($locale = null) + { + if ($locale === null) { + static::$messages = array(); + + return true; + } + + if (file_exists($filename = __DIR__.'/Lang/'.$locale.'.php')) { + static::$messages[$locale] = require $filename; + $this->addResource('array', static::$messages[$locale], $locale); + + return true; + } + + return false; + } + + /** + * Init messages language from matching file in Lang directory. + * + * @param string $locale + * + * @return bool + */ + protected function loadMessagesFromFile($locale) + { + if (isset(static::$messages[$locale])) { + return true; + } + + return $this->resetMessages($locale); + } + + /** + * Set messages of a locale and take file first if present. + * + * @param string $locale + * @param array $messages + * + * @return $this + */ + public function setMessages($locale, $messages) + { + $this->loadMessagesFromFile($locale); + $this->addResource('array', $messages, $locale); + static::$messages[$locale] = array_merge( + isset(static::$messages[$locale]) ? static::$messages[$locale] : array(), + $messages + ); + + return $this; + } + + /** + * Get messages of a locale, if none given, return all the + * languages. + * + * @param string|null $locale + * + * @return array + */ + public function getMessages($locale = null) + { + return $locale === null ? static::$messages : static::$messages[$locale]; + } + + /** + * Set the current translator locale and indicate if the source locale file exists + * + * @param string $locale locale ex. en + * + * @return bool + */ + public function setLocale($locale) + { + $locale = preg_replace_callback('/[-_]([a-z]{2,})/', function ($matches) { + // _2-letters is a region, _3+-letters is a variant + return '_'.call_user_func(strlen($matches[1]) > 2 ? 'ucfirst' : 'strtoupper', $matches[1]); + }, strtolower($locale)); + + if ($this->loadMessagesFromFile($locale)) { + parent::setLocale($locale); + + return true; + } + + return false; + } +} diff --git a/application/vendor/nesbot/carbon/src/Carbon/Upgrade.php b/application/vendor/nesbot/carbon/src/Carbon/Upgrade.php new file mode 100644 index 0000000..26449ff --- /dev/null +++ b/application/vendor/nesbot/carbon/src/Carbon/Upgrade.php @@ -0,0 +1,150 @@ + '5.8.0', + 'laravel/cashier' => '9.0.1', + 'illuminate/support' => '5.8.0', + 'laravel/dusk' => '5.0.0', + ); + + protected static $otherLibraries = array( + 'spatie/laravel-analytics' => '3.6.4', + 'jenssegers/date' => '3.5.0', + ); + + /** + * @param \UpdateHelper\UpdateHelper $helper + */ + public function check(UpdateHelper $helper) + { + $helper->write(array( + 'Carbon 1 is deprecated, see how to migrate to Carbon 2.', + 'https://carbon.nesbot.com/docs/#api-carbon-2', + )); + + if (static::SUGGEST_ON_UPDATE || static::ASK_ON_UPDATE || $helper->getIo()->isVerbose()) { + $laravelUpdate = array(); + + foreach (static::$laravelLibraries as $name => $version) { + if ($helper->hasAsDependency($name) && $helper->isDependencyLesserThan($name, $version)) { + $laravelUpdate[$name] = $version; + } + } + + if (count($laravelUpdate)) { + $output = array( + ' Please consider upgrading your Laravel dependencies to be compatible with Carbon 2:', + ); + + foreach ($laravelUpdate as $name => $version) { + $output[] = " - $name at least to version $version"; + } + + $output[] = ''; + $output[] = " If you can't update Laravel, check https://carbon.nesbot.com/ to see how to"; + $output[] = ' install Carbon 2 using alias version and our adapter kylekatarnls/laravel-carbon-2'; + $output[] = ''; + + $helper->write($output); + } + + foreach (static::$otherLibraries as $name => $version) { + if ($helper->hasAsDependency($name) && $helper->isDependencyLesserThan($name, $version)) { + $helper->write(" Please consider upgrading $name at least to $version to be compatible with Carbon 2.\n"); + } + } + + if (static::ASK_ON_UPDATE) { + static::askForUpgrade($helper); + + return; + } + } + + $path = implode(DIRECTORY_SEPARATOR, array('.', 'vendor', 'bin', 'upgrade-carbon')); + + if (!file_exists($path)) { + $path = realpath(__DIR__.'/../../bin/upgrade-carbon'); + } + + $helper->write( + ' You can run '.escapeshellarg($path). + ' to get help in updating carbon and other frameworks and libraries that depend on it.' + ); + } + + private static function getUpgradeQuestion($upgrades) + { + $message = "Do you want us to try the following upgrade:\n"; + + foreach ($upgrades as $name => $version) { + $message .= " - $name: $version\n"; + } + + return $message.'[Y/N] '; + } + + public static function askForUpgrade(UpdateHelper $helper, $upgradeIfNotInteractive = false) + { + $upgrades = array( + 'nesbot/carbon' => '^2.0.0', + ); + + foreach (array(static::$laravelLibraries, static::$otherLibraries) as $libraries) { + foreach ($libraries as $name => $version) { + if ($helper->hasAsDependency($name) && $helper->isDependencyLesserThan($name, $version)) { + $upgrades[$name] = "^$version"; + } + } + } + + $shouldUpgrade = $helper->isInteractive() + ? $helper->getIo()->askConfirmation(static::getUpgradeQuestion($upgrades)) + : $upgradeIfNotInteractive; + + if ($shouldUpgrade) { + $helper->setDependencyVersions($upgrades)->update(); + } + } + + public static function upgrade(ScriptEvent $event = null) + { + if (!$event) { + $composer = new Composer(); + $baseDir = __DIR__.'/../..'; + + if (file_exists("$baseDir/autoload.php")) { + $baseDir .= '/..'; + } + + $composer->setConfig(new Config(true, $baseDir)); + $event = new ScriptEvent( + 'upgrade-carbon', + $composer, + new ConsoleIO(new StringInput(''), new ConsoleOutput(), new HelperSet(array( + new QuestionHelper(), + ))) + ); + } + + static::askForUpgrade(new UpdateHelper($event), true); + } +} diff --git a/application/vendor/nesbot/carbon/src/JsonSerializable.php b/application/vendor/nesbot/carbon/src/JsonSerializable.php new file mode 100644 index 0000000..d34060b --- /dev/null +++ b/application/vendor/nesbot/carbon/src/JsonSerializable.php @@ -0,0 +1,18 @@ +json_encode, + * which is a value of any type other than a resource. + * + * @since 5.4.0 + */ + public function jsonSerialize(); + } +} diff --git a/application/vendor/nikic/php-parser/.gitignore b/application/vendor/nikic/php-parser/.gitignore new file mode 100644 index 0000000..8c7db2a --- /dev/null +++ b/application/vendor/nikic/php-parser/.gitignore @@ -0,0 +1,4 @@ +vendor/ +composer.lock +grammar/kmyacc.exe +grammar/y.output diff --git a/application/vendor/nikic/php-parser/.travis.yml b/application/vendor/nikic/php-parser/.travis.yml index 445913f..4716915 100644 --- a/application/vendor/nikic/php-parser/.travis.yml +++ b/application/vendor/nikic/php-parser/.travis.yml @@ -1,14 +1,32 @@ language: php +sudo: false + +cache: + directories: + - $HOME/.composer/cache + php: - - 5.3 - 5.4 - 5.5 - 5.6 - 7.0 + - nightly - hhvm +install: + - if [ $TRAVIS_PHP_VERSION = '5.6' ]; then composer require satooshi/php-coveralls '~1.0'; fi + - composer install --prefer-dist + matrix: allow_failures: - - php: 7.0 + - php: nightly fast_finish: true + +script: + - if [ $TRAVIS_PHP_VERSION = '5.6' ]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml; else vendor/bin/phpunit; fi + - if [ $TRAVIS_PHP_VERSION = '7.0' ]; then test_old/run-php-src.sh; fi + +after_success: + if [ $TRAVIS_PHP_VERSION = '5.6' ]; then php vendor/bin/coveralls; fi + diff --git a/application/vendor/nikic/php-parser/CHANGELOG.md b/application/vendor/nikic/php-parser/CHANGELOG.md index 75605cc..0ae6b7e 100644 --- a/application/vendor/nikic/php-parser/CHANGELOG.md +++ b/application/vendor/nikic/php-parser/CHANGELOG.md @@ -1,253 +1,151 @@ -Version 1.4.2-dev +Version 2.1.2-dev ----------------- Nothing yet. -Version 1.4.1 (2015-09-19) +Version 2.1.1 (2016-09-16) -------------------------- -### Fixed +### Changed -* Fixed issue with too many newlines being stripped at the end of heredoc/nowdoc strings in some - cases. (#227) +* The pretty printer will now escape all control characters in the range `\x00-\x1F` inside double + quoted strings. If no special escape sequence is available, an octal escape will be used. +* The quality of the error recovery has been improved. In particular unterminated expressions should + be handled more gracefully. +* The PHP 7 parser will now generate a parse error for `$var =& new Obj` assignments. +* Comments on free-standing code blocks will no be retained as comments on the first statement in + the code block. -Version 1.4.0 (2015-07-14) +Version 2.1.0 (2016-04-19) -------------------------- -### Added - -* Added interface `PhpParser\Node\FunctionLike`, which is implemented by `Stmt\ClassMethod`, - `Stmt\Function_` and `Expr\Closure` nodes. This interface provides getters for their common - subnodes. -* Added `Node\Stmt\ClassLike::getMethod()` to look up a specific method on a class/interface/trait. - ### Fixed -* Fixed `isPublic()` return value for implicitly public properties and methods that define and - additional modifier like `static` or `abstract`. -* Properties are now accepted by the trait builder. -* Fixed `__HALT_COMPILER_OFFSET__` support on HHVM. - -Version 1.3.0 (2015-05-02) --------------------------- +* Properly support `B""` strings (with uppercase `B`) in a number of places. +* Fixed reformatting of indented parts in a certain non-standard comment style. ### Added -* Errors can now store the attributes of the node/token where the error occurred. Previously only the start line was - stored. -* If file positions are enabled in the lexer, errors can now provide column information if it is available. See - [documentation](https://github.com/nikic/PHP-Parser/blob/master/doc/component/Error.markdown#column-information). -* The parser now provides an experimental error recovery mode, which can be enabled by disabling the `throwOnError` - parser option. In this mode the parser will try to construct a partial AST even if the code is not valid PHP. See - [documentation](https://github.com/nikic/PHP-Parser/blob/master/doc/component/Error.markdown#error-recovery). -* Added support for PHP 7 `yield from` expression. It is represented by `Expr\YieldFrom`. -* Added support for PHP 7 anonymous classes. These are represented by ordinary `Stmt\Class_` nodes with the name set to - `null`. Furthermore this implies that `Expr\New_` can now contain a `Stmt\Class_` in its `class` subnode. - -### Fixed - -* Fixed registration of PHP 7 aliases, for the case where the old name was used before the new name. -* Fixed handling of precedence when pretty-printing `print` expressions. -* Floating point numbers are now pretty-printed with a higher precision. -* Checks for special class names like `self` are now case-insensitive. - -Version 1.2.2 (2015-04-03) --------------------------- - -* The `NameResolver` now resolves parameter type hints when entering the function/method/closure node. As such other - visitors running after it will be able to make use of the resolved names at that point already. -* The autoloader no longer sets the `unserialize_callback_func` ini option on registration - this is not necessary and - may cause issues when running PhpUnit tests with process isolation. - -Version 1.2.1 (2015-03-24) --------------------------- - -* Fixed registration of the aliases introduced in 1.2.0. Previously the old class names could not be used in - `instanceof` checks under some circumstances. - -Version 1.2.0 (2015-03-22) --------------------------- +* Added `dumpComments` option to node dumper, to enable dumping of comments associated with nodes. +* Added `Stmt\Nop` node, that is used to collect comments located at the end of a block or at the + end of a file (without a following node with which they could otherwise be associated). +* Added `kind` attribute to `Expr\Exit` to distinguish between `exit` and `die`. +* Added `kind` attribute to `Scalar\LNumber` to distinguish between decimal, binary, octal and + hexadecimal numbers. +* Added `kind` attribtue to `Expr\Array` to distinguish between `array()` and `[]`. +* Added `kind` attribute to `Scalar\String` and `Scalar\Encapsed` to distinguish between + single-quoted, double-quoted, heredoc and nowdoc string. +* Added `docLabel` attribute to `Scalar\String` and `Scalar\Encapsed`, if it is a heredoc or + nowdoc string. +* Added start file offset information to `Comment` nodes. +* Added `setReturnType()` method to function and method builders. +* Added `-h` and `--help` options to `php-parse` script. ### Changed -* To ensure compatibility with PHP 7, the following node classes have been renamed: - - OLD => NEW - PhpParser\Node\Expr\Cast\Bool => PhpParser\Node\Expr\Cast\Bool_ - PhpParser\Node\Expr\Cast\Int => PhpParser\Node\Expr\Cast\Int_ - PhpParser\Node\Expr\Cast\Object => PhpParser\Node\Expr\Cast\Object_ - PhpParser\Node\Expr\Cast\String => PhpParser\Node\Expr\Cast\String_ - PhpParser\Node\Scalar\String => PhpParser\Node\Scalar\String_ - - **The previous class names are still supported as aliases.** However it is strongly encouraged to use the new names - in order to make your code compatible with PHP 7. - -* Subnodes are now stored using real properties instead of an array. This improves performance and memory usage of the - initial parse and subsequent node tree operations. The `NodeAbstract` class still supports the old way of specifying - subnodes, however this is *deprecated*. In any case properties that are assigned to a node after creation will no - longer be considered as subnodes. - -* Methods and property declarations will no longer set the `Stmt\Class_::MODIFIER_PUBLIC` flag if no visibility is - explicitly given. However the `isPublic()` method will continue to return true. This allows you to distinguish whether - a method/property is explicitly or implicitly public and control the pretty printer output more precisely. - -* The `Stmt\Class_`, `Stmt\Interface_` and `Stmt\Trait_` nodes now inherit from `Stmt\ClassLike`, which provides a - `getMethods()` method. Previously this method was only available on `Stmt\Class_`. - -* Support including the `bootstrap.php` file multiple times. - -* Make documentation and tests part of the release tarball again. - -* Improve support for HHVM and PHP 7. - -### Added - -* Added support for PHP 7 return type declarations. This adds an additional `returnType` subnode to `Stmt\Function_`, - `Stmt\ClassMethod` and `Expr\Closure`. - -* Added support for the PHP 7 null coalesce operator `??`. The operator is represented by `Expr\BinaryOp\Coalesce`. - -* Added support for the PHP 7 spaceship operator `<=>`. The operator is represented by `Expr\BinaryOp\Spaceship`. - -* Added use builder. - -* Added global namespace support to the namespace builder. - -* Added a constructor flag to `NodeTraverser`, which disables cloning of nodes. +* Invalid octal literals now throw a parse error in PHP 7 mode. +* The pretty printer takes all the new attributes mentioned in the previous section into account. +* The protected `AbstractPrettyPrinter::pComments()` method no longer returns a trailing newline. +* The bundled autoloader supports library files being stored in a different directory than + `PhpParser` for easier downstream distribution. -Version 1.1.0 (2015-01-18) --------------------------- - -* Methods that do not specify an explicit visibility (e.g. `function method()`) will now have the `MODIFIER_PUBLIC` - flag set. This also means that their `isPublic()` method will return true. - -* Declaring a property as abstract or final is now an error. - -* The `Lexer` and `Lexer\Emulative` classes now accept an `$options` array in their constructors. Currently only the - `usedAttributes` option is supported, which determines which attributes will be added to AST nodes. In particular - it is now possible to add information on the token and file positions corresponding to a node. For more details see - the [Lexer component](https://github.com/nikic/PHP-Parser/blob/master/doc/component/Lexer.markdown) documentation. - -* Node visitors can now return `NodeTraverser::DONT_TRAVERSE_CHILDREN` from `enterNode()` in order to skip all children - of the current node, for all visitors. - -* Added builders for traits and namespaces. - -* The class, interface, trait, function, method and property builders now support adding doc comments using the - `setDocComment()` method. - -* Added support for fully-qualified and namespace-relative names in builders. No longer allow use of name component - arrays. - -* Do not add documentation and tests to distribution archive files. +### Deprecated -Version 1.0.2 (2014-11-04) --------------------------- +* The `Comment::setLine()` and `Comment::setText()` methods have been deprecated. Construct new + objects instead. -* The `NameResolver` visitor now also resolves names in trait adaptations (aliases and precedence declarations). +### Removed -* Remove stray whitespace when pretty-printing trait adaptations that only change visibility. +* The internal (but public) method `Scalar\LNumber::parse()` has been removed. A non-internal + `LNumber::fromString()` method has been added instead. -Version 1.0.1 (2014-10-14) +Version 2.0.1 (2016-02-28) -------------------------- -* Disallow `new` expressions without a class name. Previously `new;` was accidentally considered to be valid code. - -* Support T_ONUMBER token used by HHVM. - -* Add ability to directly pass code to the `php-parse.php` script. - -* Prevent truncation of `var_dump()` output in the `php-parse.php` script if XDebug is used. +### Fixed -Version 1.0.0 (2014-09-12) +* `declare() {}` and `declare();` are not semantically equivalent and will now result in different + ASTs. The format case will have an empty `stmts` array, while the latter will set `stmts` to + `null`. +* Magic constants are now supported as semi-reserved keywords. +* A shebang line like `#!/usr/bin/env php` is now allowed at the start of a namespaced file. + Previously this generated an exception. +* The `prettyPrintFile()` method will not strip a trailing `?>` from the raw data that follows a + `__halt_compiler()` statement. +* The `prettyPrintFile()` method will not strip an opening `cond` - will now appear before `Stmt\If->stmts` etc. +A more detailed description of backwards incompatible changes can be found in the +[upgrading guide](UPGRADE-2.0.md). -* Added `Scalar\MagicConstant->getName()`, which returns the name of the magic constant (e.g. `__CLASS__`). +### Removed -**The following changes are also included in 0.9.5**: +* Removed support for running on PHP 5.4. It is however still possible to parse PHP 5.2 and PHP 5.3 + code while running on a newer version. +* Removed legacy class name aliases. This includes the old non-namespaced class names and the old + names for classes that were renamed for PHP 7 compatibility. +* Removed support for legacy node format. All nodes must have a `getSubNodeNames()` method now. -* [BC] Deprecated `PHPParser_Template` and `PHPParser_TemplateLoader`. This functionality does not belong in the main project - and - as far as I know - nobody is using it. +### Added -* Add `NodeTraverser::removeVisitor()` method, which removes a visitor from the node traverser. This also modifies the - corresponding `NodeTraverserInterface`. +* Added support for remaining PHP 7 features that were not present in 1.x: + * Group use declarations. These are represented using `Stmt\GroupUse` nodes. Furthermore a `type` + attribute was added to `Stmt\UseUse` to handle mixed group use declarations. + * Uniform variable syntax. + * Generalized yield operator. + * Scalar type declarations. These are presented using `'bool'`, `'int'`, `'float'` and `'string'` + as the type. The PHP 5 parser also accepts these, however they'll be `Name` instances there. + * Unicode escape sequences. +* Added `PhpParser\ParserFactory` class, which should be used to create parser instances. +* Added `Name::concat()` which concatenates two names. +* Added `Name->slice()` which takes a subslice of a name. -* Fix alias resolution in `NameResolver`: Class names are now correctly handled as case-insensitive. +### Changed -* The undefined variable error, which is used to the lexer to reset the error state, will no longer interfere with - custom error handlers. +* `PhpParser\Parser` is now an interface, implemented by `Parser\Php5`, `Parser\Php7` and + `Parser\Multiple`. The `Multiple` parser will try multiple parsers, until one succeeds. +* Token constants are now defined on `PhpParser\Parser\Tokens` rather than `PhpParser\Parser`. +* The `Name->set()`, `Name->append()`, `Name->prepend()` and `Name->setFirst()` methods are + deprecated in favor of `Name::concat()` and `Name->slice()`. +* The `NodeTraverser` no longer clones nodes by default. The old behavior can be restored by + passing `true` to the constructor. +* The constructor for `Scalar` nodes no longer has a default value. E.g. `new LNumber()` should now + be written as `new LNumber(0)`. --- -**This changelog only includes changes from the 1.0 series. For older changes see the [0.9 series changelog][1].** - - [1]: https://github.com/nikic/PHP-Parser/blob/0.9/CHANGELOG.md +**This changelog only includes changes from the 2.0 series. For older changes see the +[1.x series changelog](https://github.com/nikic/PHP-Parser/blob/1.x/CHANGELOG.md) and the +[0.9 series changelog](https://github.com/nikic/PHP-Parser/blob/0.9/CHANGELOG.md).** \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/README.md b/application/vendor/nikic/php-parser/README.md index 729e19b..28c565c 100644 --- a/application/vendor/nikic/php-parser/README.md +++ b/application/vendor/nikic/php-parser/README.md @@ -1,12 +1,14 @@ PHP Parser ========== -This is a PHP 5.2 to PHP 5.6 parser written in PHP. Its purpose is to simplify static code analysis and +[![Build Status](https://travis-ci.org/nikic/PHP-Parser.svg?branch=master)](https://travis-ci.org/nikic/PHP-Parser) [![Coverage Status](https://coveralls.io/repos/github/nikic/PHP-Parser/badge.svg?branch=master)](https://coveralls.io/github/nikic/PHP-Parser?branch=master) + +This is a PHP 5.2 to PHP 7.0 parser written in PHP. Its purpose is to simplify static code analysis and manipulation. -[**Documentation for version 1.x**][doc_1_x] (stable; for running on PHP >= 5.3). +[**Documentation for version 2.x**][doc_master] (stable; for running on PHP >= 5.4; for parsing PHP 5.2 to PHP 7.0). -[Documentation for version 0.9.x][doc_0_9] (unsupported; for running on PHP 5.2). +[Documentation for version 1.x][doc_1_x] (unsupported; for running on PHP >= 5.3; for parsing PHP 5.2 to PHP 5.6). In a Nutshell ------------- @@ -70,18 +72,25 @@ programming errors or security issues). Additionally, you can convert a syntax tree back to PHP code. This allows you to do code preprocessing (like automatedly porting code to older PHP versions). +Installation +------------ + +The preferred installation method is [composer](https://getcomposer.org): + + php composer.phar require nikic/php-parser + Documentation ------------- 1. [Introduction](doc/0_Introduction.markdown) - 2. [Installation](doc/1_Installation.markdown) - 3. [Usage of basic components](doc/2_Usage_of_basic_components.markdown) - 4. [Other node tree representations](doc/3_Other_node_tree_representations.markdown) - 5. [Code generation](doc/4_Code_generation.markdown) + 2. [Usage of basic components](doc/2_Usage_of_basic_components.markdown) + 3. [Other node tree representations](doc/3_Other_node_tree_representations.markdown) + 4. [Code generation](doc/4_Code_generation.markdown) Component documentation: - 1. [Lexer](doc/component/Lexer.markdown) + 1. [Error](doc/component/Error.markdown) + 2. [Lexer](doc/component/Lexer.markdown) - [doc_0_9]: https://github.com/nikic/PHP-Parser/tree/0.9/doc [doc_1_x]: https://github.com/nikic/PHP-Parser/tree/1.x/doc + [doc_master]: https://github.com/nikic/PHP-Parser/tree/master/doc diff --git a/application/vendor/nikic/php-parser/UPGRADE-2.0.md b/application/vendor/nikic/php-parser/UPGRADE-2.0.md new file mode 100644 index 0000000..1c61de5 --- /dev/null +++ b/application/vendor/nikic/php-parser/UPGRADE-2.0.md @@ -0,0 +1,74 @@ +Upgrading from PHP-Parser 1.x to 2.0 +==================================== + +### PHP version requirements + +PHP-Parser now requires PHP 5.4 or newer to run. It is however still possible to *parse* PHP 5.2 and +PHP 5.3 source code, while running on a newer version. + +### Creating a parser instance + +Parser instances should now be created through the `ParserFactory`. Old direct instantiation code +will not work, because the parser class was renamed. + +Old: + +```php +use PhpParser\Parser, PhpParser\Lexer; +$parser = new Parser(new Lexer\Emulative); +``` + +New: + +```php +use PhpParser\ParserFactory; +$parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7); +``` + +The first argument to `ParserFactory` determines how different PHP versions are handled. The +possible values are: + + * `ParserFactory::PREFER_PHP7`: Try to parse code as PHP 7. If this fails, try to parse it as PHP 5. + * `ParserFactory::PREFER_PHP5`: Try to parse code as PHP 5. If this fails, try to parse it as PHP 7. + * `ParserFactory::ONLY_PHP7`: Parse code as PHP 7. + * `ParserFactory::ONLY_PHP5`: Parse code as PHP 5. + +For most practical purposes the difference between `PREFER_PHP7` and `PREFER_PHP5` is mainly whether +a scalar type hint like `string` will be stored as `'string'` (PHP 7) or as `new Name('string')` +(PHP 5). + +To use a custom lexer, pass it as the second argument to the `create()` method: + +```php +use PhpParser\ParserFactory; +$lexer = new MyLexer; +$parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7, $lexer); +``` + +### Rename of the `PhpParser\Parser` class + +`PhpParser\Parser` is now an interface, which is implemented by `Parser\Php5`, `Parser\Php7` and +`Parser\Multiple`. Parser tokens are now defined in `Parser\Tokens`. If you use the `ParserFactory` +described above to create your parser instance, these changes should have no further impact on you. + +### Removal of legacy aliases + +All legacy aliases for classes have been removed. This includes the old non-namespaced `PHPParser_` +classes, as well as the classes that had to be renamed for PHP 7 support. + +### Deprecations + +The `set()`, `setFirst()`, `append()` and `prepend()` methods of the `Node\Name` class have been +deprecated. Instead `Name::concat()` and `Name->slice()` should be used. + +### Miscellaneous + +* The `NodeTraverser` no longer clones nodes by default. If you want to restore the old behavior, + pass `true` to the constructor. +* The legacy node format has been removed. If you use custom nodes, they are now expected to + implement a `getSubNodeNames()` method. +* The default value for `Scalar` node constructors was removed. This means that something like + `new LNumber()` should be replaced by `new LNumber(0)`. +* String parts of encapsed strings are now represented using `Scalar\EncapsStringPart` nodes, while + previously raw strings were used. This affects the `parts` child of `Scalar\Encaps` and + `Expr\ShellExec`. \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/bin/php-parse b/application/vendor/nikic/php-parser/bin/php-parse new file mode 100644 index 0000000..974eb1a --- /dev/null +++ b/application/vendor/nikic/php-parser/bin/php-parse @@ -0,0 +1,173 @@ +#!/usr/bin/env php + array( + 'startLine', 'endLine', 'startFilePos', 'endFilePos', 'comments' +))); +$parser = (new PhpParser\ParserFactory)->create(PhpParser\ParserFactory::PREFER_PHP7, $lexer); +$dumper = new PhpParser\NodeDumper(['dumpComments' => true]); +$prettyPrinter = new PhpParser\PrettyPrinter\Standard; +$serializer = new PhpParser\Serializer\XML; + +$traverser = new PhpParser\NodeTraverser(); +$traverser->addVisitor(new PhpParser\NodeVisitor\NameResolver); + +foreach ($files as $file) { + if (strpos($file, ' Code $code\n"; + } else { + if (!file_exists($file)) { + die("File $file does not exist.\n"); + } + + $code = file_get_contents($file); + echo "====> File $file:\n"; + } + + try { + $stmts = $parser->parse($code); + } catch (PhpParser\Error $e) { + if ($attributes['with-column-info'] && $e->hasColumnInfo()) { + $startLine = $e->getStartLine(); + $endLine = $e->getEndLine(); + $startColumn = $e->getStartColumn($code); + $endColumn = $e->getEndColumn($code); + $message .= $e->getRawMessage() . " from $startLine:$startColumn to $endLine:$endColumn"; + } else { + $message = $e->getMessage(); + } + + die($message . "\n"); + } + + foreach ($operations as $operation) { + if ('dump' === $operation) { + echo "==> Node dump:\n"; + echo $dumper->dump($stmts), "\n"; + } elseif ('pretty-print' === $operation) { + echo "==> Pretty print:\n"; + echo $prettyPrinter->prettyPrintFile($stmts), "\n"; + } elseif ('serialize-xml' === $operation) { + echo "==> Serialized XML:\n"; + echo $serializer->serialize($stmts), "\n"; + } elseif ('var-dump' === $operation) { + echo "==> var_dump():\n"; + var_dump($stmts); + } elseif ('resolve-names' === $operation) { + echo "==> Resolved names.\n"; + $stmts = $traverser->traverse($stmts); + } + } +} + +function showHelp($error = '') { + if ($error) { + echo $error . "\n\n"; + } + die(<< false, + ); + + array_shift($args); + $parseOptions = true; + foreach ($args as $arg) { + if (!$parseOptions) { + $files[] = $arg; + continue; + } + + switch ($arg) { + case '--dump': + case '-d': + $operations[] = 'dump'; + break; + case '--pretty-print': + case '-p': + $operations[] = 'pretty-print'; + break; + case '--serialize-xml': + $operations[] = 'serialize-xml'; + break; + case '--var-dump': + $operations[] = 'var-dump'; + break; + case '--resolve-names': + case '-N'; + $operations[] = 'resolve-names'; + break; + case '--with-column-info': + case '-c'; + $attributes['with-column-info'] = true; + break; + case '--help': + case '-h'; + showHelp(); + break; + case '--': + $parseOptions = false; + break; + default: + if ($arg[0] === '-') { + showHelp("Invalid operation $arg."); + } else { + $files[] = $arg; + } + } + } + + return array($operations, $files, $attributes); +} diff --git a/application/vendor/nikic/php-parser/bin/php-parse.php b/application/vendor/nikic/php-parser/bin/php-parse.php deleted file mode 100644 index c04ff08..0000000 --- a/application/vendor/nikic/php-parser/bin/php-parse.php +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env php - array( - 'startLine', 'endLine', 'startFilePos', 'endFilePos' -))); -$parser = new PhpParser\Parser($lexer); -$dumper = new PhpParser\NodeDumper; -$prettyPrinter = new PhpParser\PrettyPrinter\Standard; -$serializer = new PhpParser\Serializer\XML; - -$traverser = new PhpParser\NodeTraverser(); -$traverser->addVisitor(new PhpParser\NodeVisitor\NameResolver); - -foreach ($files as $file) { - if (strpos($file, ' Code $code\n"; - } else { - if (!file_exists($file)) { - die("File $file does not exist.\n"); - } - - $code = file_get_contents($file); - echo "====> File $file:\n"; - } - - try { - $stmts = $parser->parse($code); - } catch (PhpParser\Error $e) { - if ($attributes['with-column-info'] && $e->hasColumnInfo()) { - $startLine = $e->getStartLine(); - $endLine = $e->getEndLine(); - $startColumn = $e->getStartColumn($code); - $endColumn = $e->getEndColumn($code); - $message .= $e->getRawMessage() . " from $startLine:$startColumn to $endLine:$endColumn"; - } else { - $message = $e->getMessage(); - } - - die($message . "\n"); - } - - foreach ($operations as $operation) { - if ('dump' === $operation) { - echo "==> Node dump:\n"; - echo $dumper->dump($stmts), "\n"; - } elseif ('pretty-print' === $operation) { - echo "==> Pretty print:\n"; - echo $prettyPrinter->prettyPrintFile($stmts), "\n"; - } elseif ('serialize-xml' === $operation) { - echo "==> Serialized XML:\n"; - echo $serializer->serialize($stmts), "\n"; - } elseif ('var-dump' === $operation) { - echo "==> var_dump():\n"; - var_dump($stmts); - } elseif ('resolve-names' === $operation) { - echo "==> Resolved names.\n"; - $stmts = $traverser->traverse($stmts); - } - } -} - -function showHelp($error) { - die($error . "\n\n" . - << false, - ); - - array_shift($args); - $parseOptions = true; - foreach ($args as $arg) { - if (!$parseOptions) { - $files[] = $arg; - continue; - } - - switch ($arg) { - case '--dump': - case '-d': - $operations[] = 'dump'; - break; - case '--pretty-print': - case '-p': - $operations[] = 'pretty-print'; - break; - case '--serialize-xml': - $operations[] = 'serialize-xml'; - break; - case '--var-dump': - $operations[] = 'var-dump'; - break; - case '--resolve-names': - case '-N'; - $operations[] = 'resolve-names'; - break; - case '--with-column-info': - case '-c'; - $attributes['with-column-info'] = true; - break; - case '--': - $parseOptions = false; - break; - default: - if ($arg[0] === '-') { - showHelp("Invalid operation $arg."); - } else { - $files[] = $arg; - } - } - } - - return array($operations, $files, $attributes); -} diff --git a/application/vendor/nikic/php-parser/composer.json b/application/vendor/nikic/php-parser/composer.json index 1fd98a1..080d76a 100644 --- a/application/vendor/nikic/php-parser/composer.json +++ b/application/vendor/nikic/php-parser/composer.json @@ -10,15 +10,21 @@ } ], "require": { - "php": ">=5.3", + "php": ">=5.4", "ext-tokenizer": "*" }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, "autoload": { - "files": ["lib/bootstrap.php"] + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } }, + "bin": ["bin/php-parse"], "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.1-dev" } } } diff --git a/application/vendor/nikic/php-parser/doc/0_Introduction.markdown b/application/vendor/nikic/php-parser/doc/0_Introduction.markdown index 1ffadef..fc2c038 100644 --- a/application/vendor/nikic/php-parser/doc/0_Introduction.markdown +++ b/application/vendor/nikic/php-parser/doc/0_Introduction.markdown @@ -1,7 +1,7 @@ Introduction ============ -This project is a PHP 5.2 to PHP 5.6 parser **written in PHP itself**. +This project is a PHP 5.2 to PHP 7.0 parser **written in PHP itself**. What is this for? ----------------- @@ -18,7 +18,7 @@ For example an AST abstracts away the fact that in PHP variables can be written as `$$bar`, `${'foobar'}` or even `${!${''}=barfoo()}`. You don't have to worry about recognizing all the different syntaxes from a stream of tokens. -Another questions is: Why would I want to have a PHP parser *written in PHP*? Well, PHP might not be +Another question is: Why would I want to have a PHP parser *written in PHP*? Well, PHP might not be a language especially suited for fast parsing, but processing the AST is much easier in PHP than it would be in other, faster languages like C. Furthermore the people most probably wanting to do programmatic PHP code analysis are incidentally PHP developers, not C developers. @@ -26,13 +26,12 @@ programmatic PHP code analysis are incidentally PHP developers, not C developers What can it parse? ------------------ -The parser uses a PHP 5.6 compliant grammar, which is backwards compatible with all PHP version from PHP 5.2 -upwards (and maybe older). +The parser supports parsing PHP 5.2-5.6 and PHP 7. As the parser is based on the tokens returned by `token_get_all` (which is only able to lex the PHP -version it runs on), additionally a wrapper for emulating new tokens from 5.3, 5.4, 5.5 and 5.6 is provided. -This allows to parse PHP 5.6 source code running on PHP 5.3, for example. This emulation is very hacky and not -perfect, but it should work well on any sane code. +version it runs on), additionally a wrapper for emulating new tokens from 5.5, 5.6 and 7.0 is +provided. This allows to parse PHP 7.0 source code running on PHP 5.4, for example. This emulation +is somewhat hacky and not perfect, but it should work well on any sane code. What output does it produce? ---------------------------- diff --git a/application/vendor/nikic/php-parser/doc/1_Installation.markdown b/application/vendor/nikic/php-parser/doc/1_Installation.markdown deleted file mode 100644 index bb853a9..0000000 --- a/application/vendor/nikic/php-parser/doc/1_Installation.markdown +++ /dev/null @@ -1,31 +0,0 @@ -Installation -============ - -There are multiple ways to include the PHP parser into your project: - -Installing via Composer ------------------------ - -Run the following command inside your project: - - php composer.phar require nikic/php-parser - -If you haven't installed [Composer][1] yet, you can do so using: - - curl -s http://getcomposer.org/installer | php - -Installing as a Git Submodule ------------------------------ - -Run the following command to install the parser into the `vendor/PHP-Parser` folder: - - git submodule add git://github.com/nikic/PHP-Parser.git vendor/PHP-Parser - -Installing from the Zip- or Tarball ------------------------------------ - -Download the latest version from [the download page][2], unpack it and move the files somewhere into your project. - - - [1]: https://getcomposer.org/ - [2]: https://github.com/nikic/PHP-Parser/tags diff --git a/application/vendor/nikic/php-parser/doc/2_Usage_of_basic_components.markdown b/application/vendor/nikic/php-parser/doc/2_Usage_of_basic_components.markdown index cd0aef5..f91a5bb 100644 --- a/application/vendor/nikic/php-parser/doc/2_Usage_of_basic_components.markdown +++ b/application/vendor/nikic/php-parser/doc/2_Usage_of_basic_components.markdown @@ -6,55 +6,60 @@ This document explains how to use the parser, the pretty printer and the node tr Bootstrapping ------------- -The library needs to register a class autoloader. You can either use the `vendor/autoload.php` file generated by -Composer or by including the bundled `lib/bootstrap.php` file: +To bootstrap the library, include the autoloader generated by composer: ```php -create(ParserFactory::PREFER_PHP7); ``` -Use of the emulative lexer is required if you want to parse PHP code from newer versions than the one -you're running on. For example it will allow you to parse PHP 5.6 code while running on PHP 5.3. +The factory accepts a kind argument, that determines how different PHP versions are treated: + +Kind | Behavior +-----|--------- +`ParserFactory::PREFER_PHP7` | Try to parse code as PHP 7. If this fails, try to parse it as PHP 5. +`ParserFactory::PREFER_PHP5` | Try to parse code as PHP 5. If this fails, try to parse it as PHP 7. +`ParserFactory::ONLY_PHP7` | Parse code as PHP 7. +`ParserFactory::ONLY_PHP5` | Parse code as PHP 5. + +Unless you have strong reason to use something else, `PREFER_PHP7` is a reasonable default. + +The `create()` method optionally accepts a `Lexer` instance as the second argument. Some use cases +that require customized lexers are discussed in the [lexer documentation](component/Lexer.markdown). Subsequently you can pass PHP code (including the opening `create(ParserFactory::PREFER_PHP7); try { $stmts = $parser->parse($code); // $stmts is an array of statement nodes -} catch (PhpParser\Error $e) { +} catch (Error $e) { echo 'Parse Error: ', $e->getMessage(); } ``` @@ -137,11 +142,14 @@ information the formatting is done using a specified scheme. Currently there is namely `PhpParser\PrettyPrinter\Standard`. ```php -create(ParserFactory::PREFER_PHP7); +$prettyPrinter = new PrettyPrinter\Standard; try { // parse @@ -158,7 +166,7 @@ try { $code = $prettyPrinter->prettyPrint($stmts); echo $code; -} catch (PhpParser\Error $e) { +} catch (Error $e) { echo 'Parse Error: ', $e->getMessage(); } ``` @@ -188,11 +196,13 @@ For this purpose the parser provides a component for traversing and visiting the structure of a program using this `PhpParser\NodeTraverser` looks like this: ```php -create(ParserFactory::PREFER_PHP7); +$traverser = new NodeTraverser; +$prettyPrinter = new PrettyPrinter\Standard; // add your visitor $traverser->addVisitor(new MyNodeVisitor); @@ -218,10 +228,10 @@ try { The corresponding node visitor might look like this: ```php -create(ParserFactory::PREFER_PHP7); +$traverser = new NodeTraverser; +$prettyPrinter = new PrettyPrinter\Standard; -$traverser->addVisitor(new PhpParser\NodeVisitor\NameResolver); // we will need resolved names -$traverser->addVisitor(new NodeVisitor\NamespaceConverter); // our own node visitor +$traverser->addVisitor(new NameResolver); // we will need resolved names +$traverser->addVisitor(new NamespaceConverter); // our own node visitor // iterate over all .php files in the directory -$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($inDir)); -$files = new RegexIterator($files, '/\.php$/'); +$files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($inDir)); +$files = new \RegexIterator($files, '/\.php$/'); foreach ($files as $file) { try { @@ -343,9 +359,9 @@ Now lets start with the main code, the `NodeVisitor\NamespaceConverter`. One thi is convert `A\\B` style names to `A_B` style ones. ```php -toString()` or `(string) $no a new name from the string and return it. Returning a new node replaces the old node. Another thing we need to do is change the class/function/const declarations. Currently they contain -only the shortname (i.e. the last part of the name), but they need to contain the complete name inclduing +only the shortname (i.e. the last part of the name), but they need to contain the complete name including the namespace prefix: ```php -create(PhpParser\ParserFactory::PREFER_PHP7); $nodeDumper = new PhpParser\NodeDumper; try { @@ -106,7 +105,7 @@ function printLine($msg) { printLine('Hello World!!!'); CODE; -$parser = new PhpParser\Parser(new PhpParser\Lexer); +$parser = (new PhpParser\ParserFactory)->create(PhpParser\ParserFactory::PREFER_PHP7); $serializer = new PhpParser\Serializer\XML; try { diff --git a/application/vendor/nikic/php-parser/doc/4_Code_generation.markdown b/application/vendor/nikic/php-parser/doc/4_Code_generation.markdown index d8f1825..2c0aa0e 100644 --- a/application/vendor/nikic/php-parser/doc/4_Code_generation.markdown +++ b/application/vendor/nikic/php-parser/doc/4_Code_generation.markdown @@ -14,8 +14,11 @@ the following syntactic elements: Here is an example: ```php -namespace('Name\Space') ->addStmt($factory->use('Some\Other\Thingy')->as('SomeOtherClass')) ->addStmt($factory->class('SomeClass') @@ -26,6 +29,7 @@ $node = $factory->namespace('Name\Space') ->addStmt($factory->method('someMethod') ->makePublic() ->makeAbstract() // ->makeFinal() + ->setReturnType('bool') ->addParam($factory->param('someParam')->setTypeHint('SomeClass')) ->setDocComment('/** * This method does something. @@ -38,7 +42,7 @@ $node = $factory->namespace('Name\Space') ->makeProtected() // ->makePublic() [default], ->makePrivate() ->addParam($factory->param('someParam')->setDefault('test')) // it is possible to add manually created nodes - ->addStmt(new PhpParser\Node\Expr\Print_(new PhpParser\Node\Expr\Variable('someParam'))) + ->addStmt(new Node\Expr\Print_(new Node\Expr\Variable('someParam'))) ) // properties will be correctly reordered above the methods @@ -50,7 +54,7 @@ $node = $factory->namespace('Name\Space') ; $stmts = array($node); -$prettyPrinter = new PhpParser\PrettyPrinter\Standard(); +$prettyPrinter = new PrettyPrinter\Standard(); echo $prettyPrinter->prettyPrintFile($stmts); ``` @@ -71,7 +75,7 @@ abstract class SomeClass extends SomeOtherClass implements A\Few, \Interfaces * * @param SomeClass And takes a parameter */ - public abstract function someMethod(SomeClass $someParam); + public abstract function someMethod(SomeClass $someParam) : bool; protected function anotherMethod($someParam = 'test') { print $someParam; diff --git a/application/vendor/nikic/php-parser/doc/component/Error.markdown b/application/vendor/nikic/php-parser/doc/component/Error.markdown index 7a2ca21..eed8177 100644 --- a/application/vendor/nikic/php-parser/doc/component/Error.markdown +++ b/application/vendor/nikic/php-parser/doc/component/Error.markdown @@ -17,7 +17,7 @@ position attributes in the lexer need to be enabled: $lexer = new PhpParser\Lexer(array( 'usedAttributes' => array('comments', 'startLine', 'endLine', 'startFilePos', 'endFilePos'), )); -$parser = new PhpParser\Parser($lexer); +$parser = (new PhpParser\ParserFactory)->create(PhpParser\ParserFactory::PREFER_PHP7, $lexer); try { $stmts = $parser->parse($code); @@ -58,7 +58,7 @@ or `null` if recovery fails. A usage example: ```php -$parser = new PhpParser\Parser(new PhpParser\Lexer, array( +$parser = (new PhpParser\ParserFactory)->create(PhpParser\ParserFactory::PREFER_PHP7, null, array( 'throwOnError' => false, )); diff --git a/application/vendor/nikic/php-parser/doc/component/Lexer.markdown b/application/vendor/nikic/php-parser/doc/component/Lexer.markdown index 0bf06b6..422dd37 100644 --- a/application/vendor/nikic/php-parser/doc/component/Lexer.markdown +++ b/application/vendor/nikic/php-parser/doc/component/Lexer.markdown @@ -72,7 +72,7 @@ $lexer = new PhpParser\Lexer(array( 'comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos' ) )); -$parser = new PhpParser\Parser($lexer); +$parser = (new PhpParser\ParserFactory)->create(PhpParser\ParserFactory::PREFER_PHP7, $lexer); $visitor = new MyNodeVisitor(); $traverser = new PhpParser\NodeTraverser(); @@ -127,14 +127,17 @@ information about the formatting of integers (like decimal vs. hexadecimal) or s escape sequences). This can be remedied by storing the original value in an attribute: ```php -class KeepOriginalValueLexer extends PHPParser\Lexer // or PHPParser\Lexer\Emulative +use PhpParser\Lexer; +use PhpParser\Parser\Tokens; + +class KeepOriginalValueLexer extends Lexer // or Lexer\Emulative { public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) { $tokenId = parent::getNextToken($value, $startAttributes, $endAttributes); - if ($tokenId == PHPParser\Parser::T_CONSTANT_ENCAPSED_STRING // non-interpolated string - || $tokenId == PHPParser\Parser::T_LNUMBER // integer - || $tokenId == PHPParser\Parser::T_DNUMBER // floating point number + if ($tokenId == Tokens::T_CONSTANT_ENCAPSED_STRING // non-interpolated string + || $tokenId == Tokens::T_LNUMBER // integer + || $tokenId == Tokens::T_DNUMBER // floating point number ) { // could also use $startAttributes, doesn't really matter here $endAttributes['originalValue'] = $value; diff --git a/application/vendor/nikic/php-parser/grammar/README.md b/application/vendor/nikic/php-parser/grammar/README.md index 909f7c1..93206a8 100644 --- a/application/vendor/nikic/php-parser/grammar/README.md +++ b/application/vendor/nikic/php-parser/grammar/README.md @@ -1,22 +1,23 @@ What do all those files mean? ============================= - * `zend_language_parser.phpy`: PHP grammer written in a pseudo language - * `analyze.php`: Analyzes the `.phpy`-grammer and outputs some info about it - * `rebuildParser.php`: Preprocesses the `.phpy`-grammar and builds the parser using `kmyacc` - * `kmyacc.php.parser`: A `kmyacc` parser prototype file for PHP + * `php5.y`: PHP 5 grammar written in a pseudo language + * `php7.y`: PHP 7 grammar written in a pseudo language + * `tokens.y`: Tokens definition shared between PHP 5 and PHP 7 grammars + * `parser.template`: A `kmyacc` parser prototype file for PHP + * `tokens.template`: A `kmyacc` prototype file for the `Tokens` class + * `analyze.php`: Analyzes the grammer and outputs some info about it + * `rebuildParser.php`: Preprocesses the grammar and builds the parser using `kmyacc` .phpy pseudo language ===================== -The `.phpy` file is a normal grammer in `kmyacc` (`yacc`) style, with some transformations +The `.y` file is a normal grammer in `kmyacc` (`yacc`) style, with some transformations applied to it: * Nodes are created using the syntax `Name[..., ...]`. This is transformed into `new Name(..., ..., attributes())` * Some function-like constructs are resolved (see `rebuildParser.php` for a list) - * Associative arrays are written as `[key: value, ...]`, which is transformed to - `array('key' => value, ...)` Building the parser =================== diff --git a/application/vendor/nikic/php-parser/grammar/analyze.php b/application/vendor/nikic/php-parser/grammar/analyze.php index 50101df..cd30b3c 100644 --- a/application/vendor/nikic/php-parser/grammar/analyze.php +++ b/application/vendor/nikic/php-parser/grammar/analyze.php @@ -1,6 +1,6 @@ \'[^\\\\\']*+(?:\\\\.[^\\\\\']*+)*+\') @@ -93,4 +93,4 @@ function magicSplit($regex, $string) { } echo $ruleBlockName, ':', "\n", ' ', implode("\n" . ' | ', $rules), "\n", ';', "\n\n"; -} \ No newline at end of file +} diff --git a/application/vendor/nikic/php-parser/grammar/kmyacc.php.parser b/application/vendor/nikic/php-parser/grammar/kmyacc.php.parser deleted file mode 100644 index e8f4d5a..0000000 --- a/application/vendor/nikic/php-parser/grammar/kmyacc.php.parser +++ /dev/null @@ -1,100 +0,0 @@ -semValue -#semval($,%t) $this->semValue -#semval(%n) $this->stackPos-(%l-%n) -#semval(%n,%t) $this->stackPos-(%l-%n) - -namespace PhpParser; -#include; - -/* This is an automatically GENERATED file, which should not be manually edited. - * Instead edit one of the following: - * * the grammar file grammar/zend_language_parser.phpy - * * the skeleton file grammar/kymacc.php.parser - * * the preprocessing script grammar/rebuildParser.php - */ -class Parser extends ParserAbstract -{ - protected $tokenToSymbolMapSize = #(YYMAXLEX); - protected $actionTableSize = #(YYLAST); - protected $gotoTableSize = #(YYGLAST); - - protected $invalidSymbol = #(YYBADCH); - protected $errorSymbol = #(YYINTERRTOK); - protected $defaultAction = #(YYDEFAULT); - protected $unexpectedTokenRule = #(YYUNEXPECTED); - - protected $YY2TBLSTATE = #(YY2TBLSTATE); - protected $YYNLSTATES = #(YYNLSTATES); - -#tokenval - const %s = %n; -#endtokenval - - protected $symbolToName = array( - #listvar terminals - ); - - protected $tokenToSymbol = array( - #listvar yytranslate - ); - - protected $action = array( - #listvar yyaction - ); - - protected $actionCheck = array( - #listvar yycheck - ); - - protected $actionBase = array( - #listvar yybase - ); - - protected $actionDefault = array( - #listvar yydefault - ); - - protected $goto = array( - #listvar yygoto - ); - - protected $gotoCheck = array( - #listvar yygcheck - ); - - protected $gotoBase = array( - #listvar yygbase - ); - - protected $gotoDefault = array( - #listvar yygdefault - ); - - protected $ruleToNonTerminal = array( - #listvar yylhs - ); - - protected $ruleToLength = array( - #listvar yylen - ); -#if -t - - protected $productions = array( - #production-strings; - ); -#endif -#reduce - - protected function reduceRule%n() { - %b - } -#noact - - protected function reduceRule%n() { - $this->semValue = $this->semStack[$this->stackPos]; - } -#endreduce -} -#tailcode; diff --git a/application/vendor/nikic/php-parser/grammar/parser.template b/application/vendor/nikic/php-parser/grammar/parser.template new file mode 100644 index 0000000..fff893f --- /dev/null +++ b/application/vendor/nikic/php-parser/grammar/parser.template @@ -0,0 +1,103 @@ +semValue +#semval($,%t) $this->semValue +#semval(%n) $this->stackPos-(%l-%n) +#semval(%n,%t) $this->stackPos-(%l-%n) + +namespace PhpParser\Parser; + +use PhpParser\Error; +use PhpParser\Node; +use PhpParser\Node\Expr; +use PhpParser\Node\Name; +use PhpParser\Node\Scalar; +use PhpParser\Node\Stmt; +#include; + +/* This is an automatically GENERATED file, which should not be manually edited. + * Instead edit one of the following: + * * the grammar files grammar/php5.y or grammar/php7.y + * * the skeleton file grammar/parser.template + * * the preprocessing script grammar/rebuildParsers.php + */ +class #(-p) extends \PhpParser\ParserAbstract +{ + protected $tokenToSymbolMapSize = #(YYMAXLEX); + protected $actionTableSize = #(YYLAST); + protected $gotoTableSize = #(YYGLAST); + + protected $invalidSymbol = #(YYBADCH); + protected $errorSymbol = #(YYINTERRTOK); + protected $defaultAction = #(YYDEFAULT); + protected $unexpectedTokenRule = #(YYUNEXPECTED); + + protected $YY2TBLSTATE = #(YY2TBLSTATE); + protected $YYNLSTATES = #(YYNLSTATES); + + protected $symbolToName = array( + #listvar terminals + ); + + protected $tokenToSymbol = array( + #listvar yytranslate + ); + + protected $action = array( + #listvar yyaction + ); + + protected $actionCheck = array( + #listvar yycheck + ); + + protected $actionBase = array( + #listvar yybase + ); + + protected $actionDefault = array( + #listvar yydefault + ); + + protected $goto = array( + #listvar yygoto + ); + + protected $gotoCheck = array( + #listvar yygcheck + ); + + protected $gotoBase = array( + #listvar yygbase + ); + + protected $gotoDefault = array( + #listvar yygdefault + ); + + protected $ruleToNonTerminal = array( + #listvar yylhs + ); + + protected $ruleToLength = array( + #listvar yylen + ); +#if -t + + protected $productions = array( + #production-strings; + ); +#endif +#reduce + + protected function reduceRule%n() { + %b + } +#noact + + protected function reduceRule%n() { + $this->semValue = $this->semStack[$this->stackPos]; + } +#endreduce +} +#tailcode; diff --git a/application/vendor/nikic/php-parser/grammar/php5.y b/application/vendor/nikic/php-parser/grammar/php5.y new file mode 100644 index 0000000..d40d093 --- /dev/null +++ b/application/vendor/nikic/php-parser/grammar/php5.y @@ -0,0 +1,980 @@ +%pure_parser +%expect 6 + +%tokens + +%% + +start: + top_statement_list { $$ = $this->handleNamespaces($1); } +; + +top_statement_list_ex: + top_statement_list_ex top_statement { pushNormalizing($1, $2); } + | /* empty */ { init(); } +; + +top_statement_list: + top_statement_list_ex + { makeNop($nop, $this->lookaheadStartAttributes); + if ($nop !== null) { $1[] = $nop; } $$ = $1; } +; + +reserved_non_modifiers: + T_INCLUDE | T_INCLUDE_ONCE | T_EVAL | T_REQUIRE | T_REQUIRE_ONCE | T_LOGICAL_OR | T_LOGICAL_XOR | T_LOGICAL_AND + | T_INSTANCEOF | T_NEW | T_CLONE | T_EXIT | T_IF | T_ELSEIF | T_ELSE | T_ENDIF | T_ECHO | T_DO | T_WHILE + | T_ENDWHILE | T_FOR | T_ENDFOR | T_FOREACH | T_ENDFOREACH | T_DECLARE | T_ENDDECLARE | T_AS | T_TRY | T_CATCH + | T_FINALLY | T_THROW | T_USE | T_INSTEADOF | T_GLOBAL | T_VAR | T_UNSET | T_ISSET | T_EMPTY | T_CONTINUE | T_GOTO + | T_FUNCTION | T_CONST | T_RETURN | T_PRINT | T_YIELD | T_LIST | T_SWITCH | T_ENDSWITCH | T_CASE | T_DEFAULT + | T_BREAK | T_ARRAY | T_CALLABLE | T_EXTENDS | T_IMPLEMENTS | T_NAMESPACE | T_TRAIT | T_INTERFACE | T_CLASS + | T_CLASS_C | T_TRAIT_C | T_FUNC_C | T_METHOD_C | T_LINE | T_FILE | T_DIR | T_NS_C | T_HALT_COMPILER +; + +semi_reserved: + reserved_non_modifiers + | T_STATIC | T_ABSTRACT | T_FINAL | T_PRIVATE | T_PROTECTED | T_PUBLIC +; + +identifier: + T_STRING { $$ = $1; } + | semi_reserved { $$ = $1; } +; + +namespace_name_parts: + T_STRING { init($1); } + | namespace_name_parts T_NS_SEPARATOR T_STRING { push($1, $3); } +; + +namespace_name: + namespace_name_parts { $$ = Name[$1]; } +; + +top_statement: + statement { $$ = $1; } + | function_declaration_statement { $$ = $1; } + | class_declaration_statement { $$ = $1; } + | T_HALT_COMPILER + { $$ = Stmt\HaltCompiler[$this->lexer->handleHaltCompiler()]; } + | T_NAMESPACE namespace_name ';' { $$ = Stmt\Namespace_[$2, null]; } + | T_NAMESPACE namespace_name '{' top_statement_list '}' { $$ = Stmt\Namespace_[$2, $4]; } + | T_NAMESPACE '{' top_statement_list '}' { $$ = Stmt\Namespace_[null, $3]; } + | T_USE use_declarations ';' { $$ = Stmt\Use_[$2, Stmt\Use_::TYPE_NORMAL]; } + | T_USE use_type use_declarations ';' { $$ = Stmt\Use_[$3, $2]; } + | group_use_declaration ';' { $$ = $1; } + | T_CONST constant_declaration_list ';' { $$ = Stmt\Const_[$2]; } +; + +use_type: + T_FUNCTION { $$ = Stmt\Use_::TYPE_FUNCTION; } + | T_CONST { $$ = Stmt\Use_::TYPE_CONSTANT; } +; + +/* Using namespace_name_parts here to avoid s/r conflict on T_NS_SEPARATOR */ +group_use_declaration: + T_USE use_type namespace_name_parts T_NS_SEPARATOR '{' unprefixed_use_declarations '}' + { $$ = Stmt\GroupUse[Name[$3], $6, $2]; } + | T_USE use_type T_NS_SEPARATOR namespace_name_parts T_NS_SEPARATOR '{' unprefixed_use_declarations '}' + { $$ = Stmt\GroupUse[Name[$4], $7, $2]; } + | T_USE namespace_name_parts T_NS_SEPARATOR '{' inline_use_declarations '}' + { $$ = Stmt\GroupUse[Name[$2], $5, Stmt\Use_::TYPE_UNKNOWN]; } + | T_USE T_NS_SEPARATOR namespace_name_parts T_NS_SEPARATOR '{' inline_use_declarations '}' + { $$ = Stmt\GroupUse[Name[$3], $6, Stmt\Use_::TYPE_UNKNOWN]; } +; + +unprefixed_use_declarations: + unprefixed_use_declarations ',' unprefixed_use_declaration + { push($1, $3); } + | unprefixed_use_declaration { init($1); } +; + +use_declarations: + use_declarations ',' use_declaration { push($1, $3); } + | use_declaration { init($1); } +; + +inline_use_declarations: + inline_use_declarations ',' inline_use_declaration { push($1, $3); } + | inline_use_declaration { init($1); } +; + +unprefixed_use_declaration: + namespace_name { $$ = Stmt\UseUse[$1, null, Stmt\Use_::TYPE_UNKNOWN]; } + | namespace_name T_AS T_STRING { $$ = Stmt\UseUse[$1, $3, Stmt\Use_::TYPE_UNKNOWN]; } +; + +use_declaration: + unprefixed_use_declaration { $$ = $1; } + | T_NS_SEPARATOR unprefixed_use_declaration { $$ = $2; } +; + +inline_use_declaration: + unprefixed_use_declaration { $$ = $1; $$->type = Stmt\Use_::TYPE_NORMAL; } + | use_type unprefixed_use_declaration { $$ = $2; $$->type = $1; } +; + +constant_declaration_list: + constant_declaration_list ',' constant_declaration { push($1, $3); } + | constant_declaration { init($1); } +; + +constant_declaration: + T_STRING '=' static_scalar { $$ = Node\Const_[$1, $3]; } +; + +class_const_list: + class_const_list ',' class_const { push($1, $3); } + | class_const { init($1); } +; + +class_const: + identifier '=' static_scalar { $$ = Node\Const_[$1, $3]; } +; + +inner_statement_list_ex: + inner_statement_list_ex inner_statement { pushNormalizing($1, $2); } + | /* empty */ { init(); } +; + +inner_statement_list: + inner_statement_list_ex + { makeNop($nop, $this->lookaheadStartAttributes); + if ($nop !== null) { $1[] = $nop; } $$ = $1; } +; + +inner_statement: + statement { $$ = $1; } + | function_declaration_statement { $$ = $1; } + | class_declaration_statement { $$ = $1; } + | T_HALT_COMPILER + { throw new Error('__HALT_COMPILER() can only be used from the outermost scope', attributes()); } +; + +non_empty_statement: + '{' inner_statement_list '}' { $$ = $2; prependLeadingComments($$); } + | T_IF parentheses_expr statement elseif_list else_single + { $$ = Stmt\If_[$2, ['stmts' => toArray($3), 'elseifs' => $4, 'else' => $5]]; } + | T_IF parentheses_expr ':' inner_statement_list new_elseif_list new_else_single T_ENDIF ';' + { $$ = Stmt\If_[$2, ['stmts' => $4, 'elseifs' => $5, 'else' => $6]]; } + | T_WHILE parentheses_expr while_statement { $$ = Stmt\While_[$2, $3]; } + | T_DO statement T_WHILE parentheses_expr ';' { $$ = Stmt\Do_ [$4, toArray($2)]; } + | T_FOR '(' for_expr ';' for_expr ';' for_expr ')' for_statement + { $$ = Stmt\For_[['init' => $3, 'cond' => $5, 'loop' => $7, 'stmts' => $9]]; } + | T_SWITCH parentheses_expr switch_case_list { $$ = Stmt\Switch_[$2, $3]; } + | T_BREAK ';' { $$ = Stmt\Break_[null]; } + | T_BREAK expr ';' { $$ = Stmt\Break_[$2]; } + | T_CONTINUE ';' { $$ = Stmt\Continue_[null]; } + | T_CONTINUE expr ';' { $$ = Stmt\Continue_[$2]; } + | T_RETURN ';' { $$ = Stmt\Return_[null]; } + | T_RETURN expr ';' { $$ = Stmt\Return_[$2]; } + | yield_expr ';' { $$ = $1; } + | T_GLOBAL global_var_list ';' { $$ = Stmt\Global_[$2]; } + | T_STATIC static_var_list ';' { $$ = Stmt\Static_[$2]; } + | T_ECHO expr_list ';' { $$ = Stmt\Echo_[$2]; } + | T_INLINE_HTML { $$ = Stmt\InlineHTML[$1]; } + | expr ';' { $$ = $1; } + | T_UNSET '(' variables_list ')' ';' { $$ = Stmt\Unset_[$3]; } + | T_FOREACH '(' expr T_AS foreach_variable ')' foreach_statement + { $$ = Stmt\Foreach_[$3, $5[0], ['keyVar' => null, 'byRef' => $5[1], 'stmts' => $7]]; } + | T_FOREACH '(' expr T_AS variable T_DOUBLE_ARROW foreach_variable ')' foreach_statement + { $$ = Stmt\Foreach_[$3, $7[0], ['keyVar' => $5, 'byRef' => $7[1], 'stmts' => $9]]; } + | T_DECLARE '(' declare_list ')' declare_statement { $$ = Stmt\Declare_[$3, $5]; } + | T_TRY '{' inner_statement_list '}' catches optional_finally + { $$ = Stmt\TryCatch[$3, $5, $6]; } + | T_THROW expr ';' { $$ = Stmt\Throw_[$2]; } + | T_GOTO T_STRING ';' { $$ = Stmt\Goto_[$2]; } + | T_STRING ':' { $$ = Stmt\Label[$1]; } + | expr error { $$ = $1; } + | error { $$ = array(); /* means: no statement */ } +; + +statement: + non_empty_statement { $$ = $1; } + | ';' + { makeNop($$, $this->startAttributeStack[#1]); + if ($$ === null) $$ = array(); /* means: no statement */ } +; + +catches: + /* empty */ { init(); } + | catches catch { push($1, $2); } +; + +catch: + T_CATCH '(' name T_VARIABLE ')' '{' inner_statement_list '}' + { $$ = Stmt\Catch_[$3, parseVar($4), $7]; } +; + +optional_finally: + /* empty */ { $$ = null; } + | T_FINALLY '{' inner_statement_list '}' { $$ = $3; } +; + +variables_list: + variable { init($1); } + | variables_list ',' variable { push($1, $3); } +; + +optional_ref: + /* empty */ { $$ = false; } + | '&' { $$ = true; } +; + +optional_ellipsis: + /* empty */ { $$ = false; } + | T_ELLIPSIS { $$ = true; } +; + +function_declaration_statement: + T_FUNCTION optional_ref T_STRING '(' parameter_list ')' optional_return_type '{' inner_statement_list '}' + { $$ = Stmt\Function_[$3, ['byRef' => $2, 'params' => $5, 'returnType' => $7, 'stmts' => $9]]; } +; + +class_declaration_statement: + class_entry_type T_STRING extends_from implements_list '{' class_statement_list '}' + { $$ = Stmt\Class_[$2, ['type' => $1, 'extends' => $3, 'implements' => $4, 'stmts' => $6]]; } + | T_INTERFACE T_STRING interface_extends_list '{' class_statement_list '}' + { $$ = Stmt\Interface_[$2, ['extends' => $3, 'stmts' => $5]]; } + | T_TRAIT T_STRING '{' class_statement_list '}' + { $$ = Stmt\Trait_[$2, $4]; } +; + +class_entry_type: + T_CLASS { $$ = 0; } + | T_ABSTRACT T_CLASS { $$ = Stmt\Class_::MODIFIER_ABSTRACT; } + | T_FINAL T_CLASS { $$ = Stmt\Class_::MODIFIER_FINAL; } +; + +extends_from: + /* empty */ { $$ = null; } + | T_EXTENDS name { $$ = $2; } +; + +interface_extends_list: + /* empty */ { $$ = array(); } + | T_EXTENDS name_list { $$ = $2; } +; + +implements_list: + /* empty */ { $$ = array(); } + | T_IMPLEMENTS name_list { $$ = $2; } +; + +name_list: + name { init($1); } + | name_list ',' name { push($1, $3); } +; + +for_statement: + statement { $$ = toArray($1); } + | ':' inner_statement_list T_ENDFOR ';' { $$ = $2; } +; + +foreach_statement: + statement { $$ = toArray($1); } + | ':' inner_statement_list T_ENDFOREACH ';' { $$ = $2; } +; + +declare_statement: + non_empty_statement { $$ = toArray($1); } + | ';' { $$ = null; } + | ':' inner_statement_list T_ENDDECLARE ';' { $$ = $2; } +; + +declare_list: + declare_list_element { init($1); } + | declare_list ',' declare_list_element { push($1, $3); } +; + +declare_list_element: + T_STRING '=' static_scalar { $$ = Stmt\DeclareDeclare[$1, $3]; } +; + +switch_case_list: + '{' case_list '}' { $$ = $2; } + | '{' ';' case_list '}' { $$ = $3; } + | ':' case_list T_ENDSWITCH ';' { $$ = $2; } + | ':' ';' case_list T_ENDSWITCH ';' { $$ = $3; } +; + +case_list: + /* empty */ { init(); } + | case_list case { push($1, $2); } +; + +case: + T_CASE expr case_separator inner_statement_list { $$ = Stmt\Case_[$2, $4]; } + | T_DEFAULT case_separator inner_statement_list { $$ = Stmt\Case_[null, $3]; } +; + +case_separator: + ':' + | ';' +; + +while_statement: + statement { $$ = toArray($1); } + | ':' inner_statement_list T_ENDWHILE ';' { $$ = $2; } +; + +elseif_list: + /* empty */ { init(); } + | elseif_list elseif { push($1, $2); } +; + +elseif: + T_ELSEIF parentheses_expr statement { $$ = Stmt\ElseIf_[$2, toArray($3)]; } +; + +new_elseif_list: + /* empty */ { init(); } + | new_elseif_list new_elseif { push($1, $2); } +; + +new_elseif: + T_ELSEIF parentheses_expr ':' inner_statement_list { $$ = Stmt\ElseIf_[$2, $4]; } +; + +else_single: + /* empty */ { $$ = null; } + | T_ELSE statement { $$ = Stmt\Else_[toArray($2)]; } +; + +new_else_single: + /* empty */ { $$ = null; } + | T_ELSE ':' inner_statement_list { $$ = Stmt\Else_[$3]; } +; + +foreach_variable: + variable { $$ = array($1, false); } + | '&' variable { $$ = array($2, true); } + | list_expr { $$ = array($1, false); } +; + +parameter_list: + non_empty_parameter_list { $$ = $1; } + | /* empty */ { $$ = array(); } +; + +non_empty_parameter_list: + parameter { init($1); } + | non_empty_parameter_list ',' parameter { push($1, $3); } +; + +parameter: + optional_param_type optional_ref optional_ellipsis T_VARIABLE + { $$ = Node\Param[parseVar($4), null, $1, $2, $3]; } + | optional_param_type optional_ref optional_ellipsis T_VARIABLE '=' static_scalar + { $$ = Node\Param[parseVar($4), $6, $1, $2, $3]; } +; + +type: + name { $$ = $1; } + | T_ARRAY { $$ = 'array'; } + | T_CALLABLE { $$ = 'callable'; } +; + +optional_param_type: + /* empty */ { $$ = null; } + | type { $$ = $1; } +; + +optional_return_type: + /* empty */ { $$ = null; } + | ':' type { $$ = $2; } +; + +argument_list: + '(' ')' { $$ = array(); } + | '(' non_empty_argument_list ')' { $$ = $2; } + | '(' yield_expr ')' { $$ = array(Node\Arg[$2, false, false]); } +; + +non_empty_argument_list: + argument { init($1); } + | non_empty_argument_list ',' argument { push($1, $3); } +; + +argument: + expr { $$ = Node\Arg[$1, false, false]; } + | '&' variable { $$ = Node\Arg[$2, true, false]; } + | T_ELLIPSIS expr { $$ = Node\Arg[$2, false, true]; } +; + +global_var_list: + global_var_list ',' global_var { push($1, $3); } + | global_var { init($1); } +; + +global_var: + T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } + | '$' variable { $$ = Expr\Variable[$2]; } + | '$' '{' expr '}' { $$ = Expr\Variable[$3]; } +; + +static_var_list: + static_var_list ',' static_var { push($1, $3); } + | static_var { init($1); } +; + +static_var: + T_VARIABLE { $$ = Stmt\StaticVar[parseVar($1), null]; } + | T_VARIABLE '=' static_scalar { $$ = Stmt\StaticVar[parseVar($1), $3]; } +; + +class_statement_list: + class_statement_list class_statement { push($1, $2); } + | /* empty */ { init(); } +; + +class_statement: + variable_modifiers property_declaration_list ';' { $$ = Stmt\Property[$1, $2]; } + | T_CONST class_const_list ';' { $$ = Stmt\ClassConst[$2]; } + | method_modifiers T_FUNCTION optional_ref identifier '(' parameter_list ')' optional_return_type method_body + { $$ = Stmt\ClassMethod[$4, ['type' => $1, 'byRef' => $3, 'params' => $6, 'returnType' => $8, 'stmts' => $9]]; } + | T_USE name_list trait_adaptations { $$ = Stmt\TraitUse[$2, $3]; } +; + +trait_adaptations: + ';' { $$ = array(); } + | '{' trait_adaptation_list '}' { $$ = $2; } +; + +trait_adaptation_list: + /* empty */ { init(); } + | trait_adaptation_list trait_adaptation { push($1, $2); } +; + +trait_adaptation: + trait_method_reference_fully_qualified T_INSTEADOF name_list ';' + { $$ = Stmt\TraitUseAdaptation\Precedence[$1[0], $1[1], $3]; } + | trait_method_reference T_AS member_modifier identifier ';' + { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], $3, $4]; } + | trait_method_reference T_AS member_modifier ';' + { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], $3, null]; } + | trait_method_reference T_AS T_STRING ';' + { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], null, $3]; } + | trait_method_reference T_AS reserved_non_modifiers ';' + { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], null, $3]; } +; + +trait_method_reference_fully_qualified: + name T_PAAMAYIM_NEKUDOTAYIM identifier { $$ = array($1, $3); } +; +trait_method_reference: + trait_method_reference_fully_qualified { $$ = $1; } + | identifier { $$ = array(null, $1); } +; + +method_body: + ';' /* abstract method */ { $$ = null; } + | '{' inner_statement_list '}' { $$ = $2; } +; + +variable_modifiers: + non_empty_member_modifiers { $$ = $1; } + | T_VAR { $$ = 0; } +; + +method_modifiers: + /* empty */ { $$ = 0; } + | non_empty_member_modifiers { $$ = $1; } +; + +non_empty_member_modifiers: + member_modifier { $$ = $1; } + | non_empty_member_modifiers member_modifier { Stmt\Class_::verifyModifier($1, $2); $$ = $1 | $2; } +; + +member_modifier: + T_PUBLIC { $$ = Stmt\Class_::MODIFIER_PUBLIC; } + | T_PROTECTED { $$ = Stmt\Class_::MODIFIER_PROTECTED; } + | T_PRIVATE { $$ = Stmt\Class_::MODIFIER_PRIVATE; } + | T_STATIC { $$ = Stmt\Class_::MODIFIER_STATIC; } + | T_ABSTRACT { $$ = Stmt\Class_::MODIFIER_ABSTRACT; } + | T_FINAL { $$ = Stmt\Class_::MODIFIER_FINAL; } +; + +property_declaration_list: + property_declaration { init($1); } + | property_declaration_list ',' property_declaration { push($1, $3); } +; + +property_declaration: + T_VARIABLE { $$ = Stmt\PropertyProperty[parseVar($1), null]; } + | T_VARIABLE '=' static_scalar { $$ = Stmt\PropertyProperty[parseVar($1), $3]; } +; + +expr_list: + expr_list ',' expr { push($1, $3); } + | expr { init($1); } +; + +for_expr: + /* empty */ { $$ = array(); } + | expr_list { $$ = $1; } +; + +expr: + variable { $$ = $1; } + | list_expr '=' expr { $$ = Expr\Assign[$1, $3]; } + | variable '=' expr { $$ = Expr\Assign[$1, $3]; } + | variable '=' '&' variable { $$ = Expr\AssignRef[$1, $4]; } + | variable '=' '&' new_expr { $$ = Expr\AssignRef[$1, $4]; } + | new_expr { $$ = $1; } + | T_CLONE expr { $$ = Expr\Clone_[$2]; } + | variable T_PLUS_EQUAL expr { $$ = Expr\AssignOp\Plus [$1, $3]; } + | variable T_MINUS_EQUAL expr { $$ = Expr\AssignOp\Minus [$1, $3]; } + | variable T_MUL_EQUAL expr { $$ = Expr\AssignOp\Mul [$1, $3]; } + | variable T_DIV_EQUAL expr { $$ = Expr\AssignOp\Div [$1, $3]; } + | variable T_CONCAT_EQUAL expr { $$ = Expr\AssignOp\Concat [$1, $3]; } + | variable T_MOD_EQUAL expr { $$ = Expr\AssignOp\Mod [$1, $3]; } + | variable T_AND_EQUAL expr { $$ = Expr\AssignOp\BitwiseAnd[$1, $3]; } + | variable T_OR_EQUAL expr { $$ = Expr\AssignOp\BitwiseOr [$1, $3]; } + | variable T_XOR_EQUAL expr { $$ = Expr\AssignOp\BitwiseXor[$1, $3]; } + | variable T_SL_EQUAL expr { $$ = Expr\AssignOp\ShiftLeft [$1, $3]; } + | variable T_SR_EQUAL expr { $$ = Expr\AssignOp\ShiftRight[$1, $3]; } + | variable T_POW_EQUAL expr { $$ = Expr\AssignOp\Pow [$1, $3]; } + | variable T_INC { $$ = Expr\PostInc[$1]; } + | T_INC variable { $$ = Expr\PreInc [$2]; } + | variable T_DEC { $$ = Expr\PostDec[$1]; } + | T_DEC variable { $$ = Expr\PreDec [$2]; } + | expr T_BOOLEAN_OR expr { $$ = Expr\BinaryOp\BooleanOr [$1, $3]; } + | expr T_BOOLEAN_AND expr { $$ = Expr\BinaryOp\BooleanAnd[$1, $3]; } + | expr T_LOGICAL_OR expr { $$ = Expr\BinaryOp\LogicalOr [$1, $3]; } + | expr T_LOGICAL_AND expr { $$ = Expr\BinaryOp\LogicalAnd[$1, $3]; } + | expr T_LOGICAL_XOR expr { $$ = Expr\BinaryOp\LogicalXor[$1, $3]; } + | expr '|' expr { $$ = Expr\BinaryOp\BitwiseOr [$1, $3]; } + | expr '&' expr { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; } + | expr '^' expr { $$ = Expr\BinaryOp\BitwiseXor[$1, $3]; } + | expr '.' expr { $$ = Expr\BinaryOp\Concat [$1, $3]; } + | expr '+' expr { $$ = Expr\BinaryOp\Plus [$1, $3]; } + | expr '-' expr { $$ = Expr\BinaryOp\Minus [$1, $3]; } + | expr '*' expr { $$ = Expr\BinaryOp\Mul [$1, $3]; } + | expr '/' expr { $$ = Expr\BinaryOp\Div [$1, $3]; } + | expr '%' expr { $$ = Expr\BinaryOp\Mod [$1, $3]; } + | expr T_SL expr { $$ = Expr\BinaryOp\ShiftLeft [$1, $3]; } + | expr T_SR expr { $$ = Expr\BinaryOp\ShiftRight[$1, $3]; } + | expr T_POW expr { $$ = Expr\BinaryOp\Pow [$1, $3]; } + | '+' expr %prec T_INC { $$ = Expr\UnaryPlus [$2]; } + | '-' expr %prec T_INC { $$ = Expr\UnaryMinus[$2]; } + | '!' expr { $$ = Expr\BooleanNot[$2]; } + | '~' expr { $$ = Expr\BitwiseNot[$2]; } + | expr T_IS_IDENTICAL expr { $$ = Expr\BinaryOp\Identical [$1, $3]; } + | expr T_IS_NOT_IDENTICAL expr { $$ = Expr\BinaryOp\NotIdentical [$1, $3]; } + | expr T_IS_EQUAL expr { $$ = Expr\BinaryOp\Equal [$1, $3]; } + | expr T_IS_NOT_EQUAL expr { $$ = Expr\BinaryOp\NotEqual [$1, $3]; } + | expr T_SPACESHIP expr { $$ = Expr\BinaryOp\Spaceship [$1, $3]; } + | expr '<' expr { $$ = Expr\BinaryOp\Smaller [$1, $3]; } + | expr T_IS_SMALLER_OR_EQUAL expr { $$ = Expr\BinaryOp\SmallerOrEqual[$1, $3]; } + | expr '>' expr { $$ = Expr\BinaryOp\Greater [$1, $3]; } + | expr T_IS_GREATER_OR_EQUAL expr { $$ = Expr\BinaryOp\GreaterOrEqual[$1, $3]; } + | expr T_INSTANCEOF class_name_reference { $$ = Expr\Instanceof_[$1, $3]; } + | parentheses_expr { $$ = $1; } + /* we need a separate '(' new_expr ')' rule to avoid problems caused by a s/r conflict */ + | '(' new_expr ')' { $$ = $2; } + | expr '?' expr ':' expr { $$ = Expr\Ternary[$1, $3, $5]; } + | expr '?' ':' expr { $$ = Expr\Ternary[$1, null, $4]; } + | expr T_COALESCE expr { $$ = Expr\BinaryOp\Coalesce[$1, $3]; } + | T_ISSET '(' variables_list ')' { $$ = Expr\Isset_[$3]; } + | T_EMPTY '(' expr ')' { $$ = Expr\Empty_[$3]; } + | T_INCLUDE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_INCLUDE]; } + | T_INCLUDE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_INCLUDE_ONCE]; } + | T_EVAL parentheses_expr { $$ = Expr\Eval_[$2]; } + | T_REQUIRE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE]; } + | T_REQUIRE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE_ONCE]; } + | T_INT_CAST expr { $$ = Expr\Cast\Int_ [$2]; } + | T_DOUBLE_CAST expr { $$ = Expr\Cast\Double [$2]; } + | T_STRING_CAST expr { $$ = Expr\Cast\String_ [$2]; } + | T_ARRAY_CAST expr { $$ = Expr\Cast\Array_ [$2]; } + | T_OBJECT_CAST expr { $$ = Expr\Cast\Object_ [$2]; } + | T_BOOL_CAST expr { $$ = Expr\Cast\Bool_ [$2]; } + | T_UNSET_CAST expr { $$ = Expr\Cast\Unset_ [$2]; } + | T_EXIT exit_expr + { $attrs = attributes(); + $attrs['kind'] = strtolower($1) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; + $$ = new Expr\Exit_($2, $attrs); } + | '@' expr { $$ = Expr\ErrorSuppress[$2]; } + | scalar { $$ = $1; } + | array_expr { $$ = $1; } + | scalar_dereference { $$ = $1; } + | '`' backticks_expr '`' { $$ = Expr\ShellExec[$2]; } + | T_PRINT expr { $$ = Expr\Print_[$2]; } + | T_YIELD { $$ = Expr\Yield_[null, null]; } + | T_YIELD_FROM expr { $$ = Expr\YieldFrom[$2]; } + | T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars optional_return_type + '{' inner_statement_list '}' + { $$ = Expr\Closure[['static' => false, 'byRef' => $2, 'params' => $4, 'uses' => $6, 'returnType' => $7, 'stmts' => $9]]; } + | T_STATIC T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars optional_return_type + '{' inner_statement_list '}' + { $$ = Expr\Closure[['static' => true, 'byRef' => $3, 'params' => $5, 'uses' => $7, 'returnType' => $8, 'stmts' => $10]]; } +; + +parentheses_expr: + '(' expr ')' { $$ = $2; } + | '(' yield_expr ')' { $$ = $2; } +; + +yield_expr: + T_YIELD expr { $$ = Expr\Yield_[$2, null]; } + | T_YIELD expr T_DOUBLE_ARROW expr { $$ = Expr\Yield_[$4, $2]; } +; + +array_expr: + T_ARRAY '(' array_pair_list ')' + { $attrs = attributes(); $attrs['kind'] = Expr\Array_::KIND_LONG; + $$ = new Expr\Array_($3, $attrs); } + | '[' array_pair_list ']' + { $attrs = attributes(); $attrs['kind'] = Expr\Array_::KIND_SHORT; + $$ = new Expr\Array_($2, $attrs); } +; + +scalar_dereference: + array_expr '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | T_CONSTANT_ENCAPSED_STRING '[' dim_offset ']' + { $attrs = attributes(); $attrs['kind'] = strKind($1); + $$ = Expr\ArrayDimFetch[new Scalar\String_(Scalar\String_::parse($1), $attrs), $3]; } + | constant '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | scalar_dereference '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + /* alternative array syntax missing intentionally */ +; + +anonymous_class: + T_CLASS ctor_arguments extends_from implements_list '{' class_statement_list '}' + { $$ = array(Stmt\Class_[null, ['type' => 0, 'extends' => $3, 'implements' => $4, 'stmts' => $6]], $2); } + +new_expr: + T_NEW class_name_reference ctor_arguments { $$ = Expr\New_[$2, $3]; } + | T_NEW anonymous_class + { list($class, $ctorArgs) = $2; $$ = Expr\New_[$class, $ctorArgs]; } +; + +lexical_vars: + /* empty */ { $$ = array(); } + | T_USE '(' lexical_var_list ')' { $$ = $3; } +; + +lexical_var_list: + lexical_var { init($1); } + | lexical_var_list ',' lexical_var { push($1, $3); } +; + +lexical_var: + optional_ref T_VARIABLE { $$ = Expr\ClosureUse[parseVar($2), $1]; } +; + +function_call: + name argument_list { $$ = Expr\FuncCall[$1, $2]; } + | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM identifier argument_list + { $$ = Expr\StaticCall[$1, $3, $4]; } + | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '{' expr '}' argument_list + { $$ = Expr\StaticCall[$1, $4, $6]; } + | static_property argument_list { + if ($1 instanceof Node\Expr\StaticPropertyFetch) { + $$ = Expr\StaticCall[$1->class, Expr\Variable[$1->name], $2]; + } elseif ($1 instanceof Node\Expr\ArrayDimFetch) { + $tmp = $1; + while ($tmp->var instanceof Node\Expr\ArrayDimFetch) { + $tmp = $tmp->var; + } + + $$ = Expr\StaticCall[$tmp->var->class, $1, $2]; + $tmp->var = Expr\Variable[$tmp->var->name]; + } else { + throw new \Exception; + } + } + | variable_without_objects argument_list + { $$ = Expr\FuncCall[$1, $2]; } + | function_call '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + /* alternative array syntax missing intentionally */ +; + +class_name: + T_STATIC { $$ = Name[$1]; } + | name { $$ = $1; } +; + +name: + namespace_name_parts { $$ = Name[$1]; } + | T_NS_SEPARATOR namespace_name_parts { $$ = Name\FullyQualified[$2]; } + | T_NAMESPACE T_NS_SEPARATOR namespace_name_parts { $$ = Name\Relative[$3]; } +; + +class_name_reference: + class_name { $$ = $1; } + | dynamic_class_name_reference { $$ = $1; } +; + +dynamic_class_name_reference: + object_access_for_dcnr { $$ = $1; } + | base_variable { $$ = $1; } +; + +class_name_or_var: + class_name { $$ = $1; } + | reference_variable { $$ = $1; } +; + +object_access_for_dcnr: + base_variable T_OBJECT_OPERATOR object_property + { $$ = Expr\PropertyFetch[$1, $3]; } + | object_access_for_dcnr T_OBJECT_OPERATOR object_property + { $$ = Expr\PropertyFetch[$1, $3]; } + | object_access_for_dcnr '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | object_access_for_dcnr '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } +; + +exit_expr: + /* empty */ { $$ = null; } + | '(' ')' { $$ = null; } + | parentheses_expr { $$ = $1; } +; + +backticks_expr: + /* empty */ { $$ = array(); } + | T_ENCAPSED_AND_WHITESPACE + { $$ = array(Scalar\EncapsedStringPart[Scalar\String_::parseEscapeSequences($1, '`', false)]); } + | encaps_list { parseEncapsed($1, '`', false); $$ = $1; } +; + +ctor_arguments: + /* empty */ { $$ = array(); } + | argument_list { $$ = $1; } +; + +common_scalar: + T_LNUMBER { $$ = Scalar\LNumber::fromString($1, attributes(), true); } + | T_DNUMBER { $$ = Scalar\DNumber[Scalar\DNumber::parse($1)]; } + | T_CONSTANT_ENCAPSED_STRING + { $attrs = attributes(); $attrs['kind'] = strKind($1); + $$ = new Scalar\String_(Scalar\String_::parse($1, false), $attrs); } + | T_LINE { $$ = Scalar\MagicConst\Line[]; } + | T_FILE { $$ = Scalar\MagicConst\File[]; } + | T_DIR { $$ = Scalar\MagicConst\Dir[]; } + | T_CLASS_C { $$ = Scalar\MagicConst\Class_[]; } + | T_TRAIT_C { $$ = Scalar\MagicConst\Trait_[]; } + | T_METHOD_C { $$ = Scalar\MagicConst\Method[]; } + | T_FUNC_C { $$ = Scalar\MagicConst\Function_[]; } + | T_NS_C { $$ = Scalar\MagicConst\Namespace_[]; } + | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC + { $attrs = attributes(); setDocStringAttrs($attrs, $1); + $$ = new Scalar\String_(Scalar\String_::parseDocString($1, $2, false), $attrs); } + | T_START_HEREDOC T_END_HEREDOC + { $attrs = attributes(); setDocStringAttrs($attrs, $1); + $$ = new Scalar\String_('', $attrs); } +; + +static_scalar: + common_scalar { $$ = $1; } + | class_name T_PAAMAYIM_NEKUDOTAYIM identifier { $$ = Expr\ClassConstFetch[$1, $3]; } + | name { $$ = Expr\ConstFetch[$1]; } + | T_ARRAY '(' static_array_pair_list ')' { $$ = Expr\Array_[$3]; } + | '[' static_array_pair_list ']' { $$ = Expr\Array_[$2]; } + | static_operation { $$ = $1; } +; + +static_operation: + static_scalar T_BOOLEAN_OR static_scalar { $$ = Expr\BinaryOp\BooleanOr [$1, $3]; } + | static_scalar T_BOOLEAN_AND static_scalar { $$ = Expr\BinaryOp\BooleanAnd[$1, $3]; } + | static_scalar T_LOGICAL_OR static_scalar { $$ = Expr\BinaryOp\LogicalOr [$1, $3]; } + | static_scalar T_LOGICAL_AND static_scalar { $$ = Expr\BinaryOp\LogicalAnd[$1, $3]; } + | static_scalar T_LOGICAL_XOR static_scalar { $$ = Expr\BinaryOp\LogicalXor[$1, $3]; } + | static_scalar '|' static_scalar { $$ = Expr\BinaryOp\BitwiseOr [$1, $3]; } + | static_scalar '&' static_scalar { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; } + | static_scalar '^' static_scalar { $$ = Expr\BinaryOp\BitwiseXor[$1, $3]; } + | static_scalar '.' static_scalar { $$ = Expr\BinaryOp\Concat [$1, $3]; } + | static_scalar '+' static_scalar { $$ = Expr\BinaryOp\Plus [$1, $3]; } + | static_scalar '-' static_scalar { $$ = Expr\BinaryOp\Minus [$1, $3]; } + | static_scalar '*' static_scalar { $$ = Expr\BinaryOp\Mul [$1, $3]; } + | static_scalar '/' static_scalar { $$ = Expr\BinaryOp\Div [$1, $3]; } + | static_scalar '%' static_scalar { $$ = Expr\BinaryOp\Mod [$1, $3]; } + | static_scalar T_SL static_scalar { $$ = Expr\BinaryOp\ShiftLeft [$1, $3]; } + | static_scalar T_SR static_scalar { $$ = Expr\BinaryOp\ShiftRight[$1, $3]; } + | static_scalar T_POW static_scalar { $$ = Expr\BinaryOp\Pow [$1, $3]; } + | '+' static_scalar %prec T_INC { $$ = Expr\UnaryPlus [$2]; } + | '-' static_scalar %prec T_INC { $$ = Expr\UnaryMinus[$2]; } + | '!' static_scalar { $$ = Expr\BooleanNot[$2]; } + | '~' static_scalar { $$ = Expr\BitwiseNot[$2]; } + | static_scalar T_IS_IDENTICAL static_scalar { $$ = Expr\BinaryOp\Identical [$1, $3]; } + | static_scalar T_IS_NOT_IDENTICAL static_scalar { $$ = Expr\BinaryOp\NotIdentical [$1, $3]; } + | static_scalar T_IS_EQUAL static_scalar { $$ = Expr\BinaryOp\Equal [$1, $3]; } + | static_scalar T_IS_NOT_EQUAL static_scalar { $$ = Expr\BinaryOp\NotEqual [$1, $3]; } + | static_scalar '<' static_scalar { $$ = Expr\BinaryOp\Smaller [$1, $3]; } + | static_scalar T_IS_SMALLER_OR_EQUAL static_scalar { $$ = Expr\BinaryOp\SmallerOrEqual[$1, $3]; } + | static_scalar '>' static_scalar { $$ = Expr\BinaryOp\Greater [$1, $3]; } + | static_scalar T_IS_GREATER_OR_EQUAL static_scalar { $$ = Expr\BinaryOp\GreaterOrEqual[$1, $3]; } + | static_scalar '?' static_scalar ':' static_scalar { $$ = Expr\Ternary[$1, $3, $5]; } + | static_scalar '?' ':' static_scalar { $$ = Expr\Ternary[$1, null, $4]; } + | static_scalar '[' static_scalar ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | '(' static_scalar ')' { $$ = $2; } +; + +constant: + name { $$ = Expr\ConstFetch[$1]; } + | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM identifier + { $$ = Expr\ClassConstFetch[$1, $3]; } +; + +scalar: + common_scalar { $$ = $1; } + | constant { $$ = $1; } + | '"' encaps_list '"' + { $attrs = attributes(); $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; + parseEncapsed($2, '"', true); $$ = new Scalar\Encapsed($2, $attrs); } + | T_START_HEREDOC encaps_list T_END_HEREDOC + { $attrs = attributes(); setDocStringAttrs($attrs, $1); + parseEncapsedDoc($2, true); $$ = new Scalar\Encapsed($2, $attrs); } +; + +static_array_pair_list: + /* empty */ { $$ = array(); } + | non_empty_static_array_pair_list optional_comma { $$ = $1; } +; + +optional_comma: + /* empty */ + | ',' +; + +non_empty_static_array_pair_list: + non_empty_static_array_pair_list ',' static_array_pair { push($1, $3); } + | static_array_pair { init($1); } +; + +static_array_pair: + static_scalar T_DOUBLE_ARROW static_scalar { $$ = Expr\ArrayItem[$3, $1, false]; } + | static_scalar { $$ = Expr\ArrayItem[$1, null, false]; } +; + +variable: + object_access { $$ = $1; } + | base_variable { $$ = $1; } + | function_call { $$ = $1; } + | new_expr_array_deref { $$ = $1; } +; + +new_expr_array_deref: + '(' new_expr ')' '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$2, $5]; } + | new_expr_array_deref '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + /* alternative array syntax missing intentionally */ +; + +object_access: + variable_or_new_expr T_OBJECT_OPERATOR object_property + { $$ = Expr\PropertyFetch[$1, $3]; } + | variable_or_new_expr T_OBJECT_OPERATOR object_property argument_list + { $$ = Expr\MethodCall[$1, $3, $4]; } + | object_access argument_list { $$ = Expr\FuncCall[$1, $2]; } + | object_access '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | object_access '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } +; + +variable_or_new_expr: + variable { $$ = $1; } + | '(' new_expr ')' { $$ = $2; } +; + +variable_without_objects: + reference_variable { $$ = $1; } + | '$' variable_without_objects { $$ = Expr\Variable[$2]; } +; + +base_variable: + variable_without_objects { $$ = $1; } + | static_property { $$ = $1; } +; + +static_property: + class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '$' reference_variable + { $$ = Expr\StaticPropertyFetch[$1, $4]; } + | static_property_with_arrays { $$ = $1; } +; + +static_property_with_arrays: + class_name_or_var T_PAAMAYIM_NEKUDOTAYIM T_VARIABLE + { $$ = Expr\StaticPropertyFetch[$1, parseVar($3)]; } + | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '$' '{' expr '}' + { $$ = Expr\StaticPropertyFetch[$1, $5]; } + | static_property_with_arrays '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | static_property_with_arrays '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } +; + +reference_variable: + reference_variable '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | reference_variable '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } + | '$' '{' expr '}' { $$ = Expr\Variable[$3]; } +; + +dim_offset: + /* empty */ { $$ = null; } + | expr { $$ = $1; } +; + +object_property: + T_STRING { $$ = $1; } + | '{' expr '}' { $$ = $2; } + | variable_without_objects { $$ = $1; } +; + +list_expr: + T_LIST '(' list_expr_elements ')' { $$ = Expr\List_[$3]; } +; + +list_expr_elements: + list_expr_elements ',' list_expr_element { push($1, $3); } + | list_expr_element { init($1); } +; + +list_expr_element: + variable { $$ = $1; } + | list_expr { $$ = $1; } + | /* empty */ { $$ = null; } +; + +array_pair_list: + /* empty */ { $$ = array(); } + | non_empty_array_pair_list optional_comma { $$ = $1; } +; + +non_empty_array_pair_list: + non_empty_array_pair_list ',' array_pair { push($1, $3); } + | array_pair { init($1); } +; + +array_pair: + expr T_DOUBLE_ARROW expr { $$ = Expr\ArrayItem[$3, $1, false]; } + | expr { $$ = Expr\ArrayItem[$1, null, false]; } + | expr T_DOUBLE_ARROW '&' variable { $$ = Expr\ArrayItem[$4, $1, true]; } + | '&' variable { $$ = Expr\ArrayItem[$2, null, true]; } +; + +encaps_list: + encaps_list encaps_var { push($1, $2); } + | encaps_list encaps_string_part { push($1, $2); } + | encaps_var { init($1); } + | encaps_string_part encaps_var { init($1, $2); } +; + +encaps_string_part: + T_ENCAPSED_AND_WHITESPACE { $$ = Scalar\EncapsedStringPart[$1]; } +; + +encaps_var: + T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } + | T_VARIABLE '[' encaps_var_offset ']' { $$ = Expr\ArrayDimFetch[Expr\Variable[parseVar($1)], $3]; } + | T_VARIABLE T_OBJECT_OPERATOR T_STRING { $$ = Expr\PropertyFetch[Expr\Variable[parseVar($1)], $3]; } + | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { $$ = Expr\Variable[$2]; } + | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' { $$ = Expr\Variable[$2]; } + | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' + { $$ = Expr\ArrayDimFetch[Expr\Variable[$2], $4]; } + | T_CURLY_OPEN variable '}' { $$ = $2; } +; + +encaps_var_offset: + T_STRING { $$ = Scalar\String_[$1]; } + | T_NUM_STRING { $$ = Scalar\String_[$1]; } + | T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } +; + +%% diff --git a/application/vendor/nikic/php-parser/grammar/php7.y b/application/vendor/nikic/php-parser/grammar/php7.y new file mode 100644 index 0000000..cf5f841 --- /dev/null +++ b/application/vendor/nikic/php-parser/grammar/php7.y @@ -0,0 +1,846 @@ +%pure_parser +%expect 2 + +%tokens + +%% + +start: + top_statement_list { $$ = $this->handleNamespaces($1); } +; + +top_statement_list_ex: + top_statement_list_ex top_statement { pushNormalizing($1, $2); } + | /* empty */ { init(); } +; + +top_statement_list: + top_statement_list_ex + { makeNop($nop, $this->lookaheadStartAttributes); + if ($nop !== null) { $1[] = $nop; } $$ = $1; } +; + +reserved_non_modifiers: + T_INCLUDE | T_INCLUDE_ONCE | T_EVAL | T_REQUIRE | T_REQUIRE_ONCE | T_LOGICAL_OR | T_LOGICAL_XOR | T_LOGICAL_AND + | T_INSTANCEOF | T_NEW | T_CLONE | T_EXIT | T_IF | T_ELSEIF | T_ELSE | T_ENDIF | T_ECHO | T_DO | T_WHILE + | T_ENDWHILE | T_FOR | T_ENDFOR | T_FOREACH | T_ENDFOREACH | T_DECLARE | T_ENDDECLARE | T_AS | T_TRY | T_CATCH + | T_FINALLY | T_THROW | T_USE | T_INSTEADOF | T_GLOBAL | T_VAR | T_UNSET | T_ISSET | T_EMPTY | T_CONTINUE | T_GOTO + | T_FUNCTION | T_CONST | T_RETURN | T_PRINT | T_YIELD | T_LIST | T_SWITCH | T_ENDSWITCH | T_CASE | T_DEFAULT + | T_BREAK | T_ARRAY | T_CALLABLE | T_EXTENDS | T_IMPLEMENTS | T_NAMESPACE | T_TRAIT | T_INTERFACE | T_CLASS + | T_CLASS_C | T_TRAIT_C | T_FUNC_C | T_METHOD_C | T_LINE | T_FILE | T_DIR | T_NS_C | T_HALT_COMPILER +; + +semi_reserved: + reserved_non_modifiers + | T_STATIC | T_ABSTRACT | T_FINAL | T_PRIVATE | T_PROTECTED | T_PUBLIC +; + +identifier: + T_STRING { $$ = $1; } + | semi_reserved { $$ = $1; } +; + +namespace_name_parts: + T_STRING { init($1); } + | namespace_name_parts T_NS_SEPARATOR T_STRING { push($1, $3); } +; + +namespace_name: + namespace_name_parts { $$ = Name[$1]; } +; + +top_statement: + statement { $$ = $1; } + | function_declaration_statement { $$ = $1; } + | class_declaration_statement { $$ = $1; } + | T_HALT_COMPILER + { $$ = Stmt\HaltCompiler[$this->lexer->handleHaltCompiler()]; } + | T_NAMESPACE namespace_name ';' { $$ = Stmt\Namespace_[$2, null]; } + | T_NAMESPACE namespace_name '{' top_statement_list '}' { $$ = Stmt\Namespace_[$2, $4]; } + | T_NAMESPACE '{' top_statement_list '}' { $$ = Stmt\Namespace_[null, $3]; } + | T_USE use_declarations ';' { $$ = Stmt\Use_[$2, Stmt\Use_::TYPE_NORMAL]; } + | T_USE use_type use_declarations ';' { $$ = Stmt\Use_[$3, $2]; } + | group_use_declaration ';' { $$ = $1; } + | T_CONST constant_declaration_list ';' { $$ = Stmt\Const_[$2]; } +; + +use_type: + T_FUNCTION { $$ = Stmt\Use_::TYPE_FUNCTION; } + | T_CONST { $$ = Stmt\Use_::TYPE_CONSTANT; } +; + +/* Using namespace_name_parts here to avoid s/r conflict on T_NS_SEPARATOR */ +group_use_declaration: + T_USE use_type namespace_name_parts T_NS_SEPARATOR '{' unprefixed_use_declarations '}' + { $$ = Stmt\GroupUse[Name[$3], $6, $2]; } + | T_USE use_type T_NS_SEPARATOR namespace_name_parts T_NS_SEPARATOR '{' unprefixed_use_declarations '}' + { $$ = Stmt\GroupUse[Name[$4], $7, $2]; } + | T_USE namespace_name_parts T_NS_SEPARATOR '{' inline_use_declarations '}' + { $$ = Stmt\GroupUse[Name[$2], $5, Stmt\Use_::TYPE_UNKNOWN]; } + | T_USE T_NS_SEPARATOR namespace_name_parts T_NS_SEPARATOR '{' inline_use_declarations '}' + { $$ = Stmt\GroupUse[Name[$3], $6, Stmt\Use_::TYPE_UNKNOWN]; } +; + +unprefixed_use_declarations: + unprefixed_use_declarations ',' unprefixed_use_declaration + { push($1, $3); } + | unprefixed_use_declaration { init($1); } +; + +use_declarations: + use_declarations ',' use_declaration { push($1, $3); } + | use_declaration { init($1); } +; + +inline_use_declarations: + inline_use_declarations ',' inline_use_declaration { push($1, $3); } + | inline_use_declaration { init($1); } +; + +unprefixed_use_declaration: + namespace_name { $$ = Stmt\UseUse[$1, null, Stmt\Use_::TYPE_UNKNOWN]; } + | namespace_name T_AS T_STRING { $$ = Stmt\UseUse[$1, $3, Stmt\Use_::TYPE_UNKNOWN]; } +; + +use_declaration: + unprefixed_use_declaration { $$ = $1; } + | T_NS_SEPARATOR unprefixed_use_declaration { $$ = $2; } +; + +inline_use_declaration: + unprefixed_use_declaration { $$ = $1; $$->type = Stmt\Use_::TYPE_NORMAL; } + | use_type unprefixed_use_declaration { $$ = $2; $$->type = $1; } +; + +constant_declaration_list: + constant_declaration_list ',' constant_declaration { push($1, $3); } + | constant_declaration { init($1); } +; + +constant_declaration: + T_STRING '=' expr { $$ = Node\Const_[$1, $3]; } +; + +class_const_list: + class_const_list ',' class_const { push($1, $3); } + | class_const { init($1); } +; + +class_const: + identifier '=' expr { $$ = Node\Const_[$1, $3]; } +; + +inner_statement_list_ex: + inner_statement_list_ex inner_statement { pushNormalizing($1, $2); } + | /* empty */ { init(); } +; + +inner_statement_list: + inner_statement_list_ex + { makeNop($nop, $this->lookaheadStartAttributes); + if ($nop !== null) { $1[] = $nop; } $$ = $1; } +; + +inner_statement: + statement { $$ = $1; } + | function_declaration_statement { $$ = $1; } + | class_declaration_statement { $$ = $1; } + | T_HALT_COMPILER + { throw new Error('__HALT_COMPILER() can only be used from the outermost scope', attributes()); } +; + +non_empty_statement: + '{' inner_statement_list '}' { $$ = $2; prependLeadingComments($$); } + | T_IF '(' expr ')' statement elseif_list else_single + { $$ = Stmt\If_[$3, ['stmts' => toArray($5), 'elseifs' => $6, 'else' => $7]]; } + | T_IF '(' expr ')' ':' inner_statement_list new_elseif_list new_else_single T_ENDIF ';' + { $$ = Stmt\If_[$3, ['stmts' => $6, 'elseifs' => $7, 'else' => $8]]; } + | T_WHILE '(' expr ')' while_statement { $$ = Stmt\While_[$3, $5]; } + | T_DO statement T_WHILE '(' expr ')' ';' { $$ = Stmt\Do_ [$5, toArray($2)]; } + | T_FOR '(' for_expr ';' for_expr ';' for_expr ')' for_statement + { $$ = Stmt\For_[['init' => $3, 'cond' => $5, 'loop' => $7, 'stmts' => $9]]; } + | T_SWITCH '(' expr ')' switch_case_list { $$ = Stmt\Switch_[$3, $5]; } + | T_BREAK optional_expr ';' { $$ = Stmt\Break_[$2]; } + | T_CONTINUE optional_expr ';' { $$ = Stmt\Continue_[$2]; } + | T_RETURN optional_expr ';' { $$ = Stmt\Return_[$2]; } + | T_GLOBAL global_var_list ';' { $$ = Stmt\Global_[$2]; } + | T_STATIC static_var_list ';' { $$ = Stmt\Static_[$2]; } + | T_ECHO expr_list ';' { $$ = Stmt\Echo_[$2]; } + | T_INLINE_HTML { $$ = Stmt\InlineHTML[$1]; } + | expr ';' { $$ = $1; } + | T_UNSET '(' variables_list ')' ';' { $$ = Stmt\Unset_[$3]; } + | T_FOREACH '(' expr T_AS foreach_variable ')' foreach_statement + { $$ = Stmt\Foreach_[$3, $5[0], ['keyVar' => null, 'byRef' => $5[1], 'stmts' => $7]]; } + | T_FOREACH '(' expr T_AS variable T_DOUBLE_ARROW foreach_variable ')' foreach_statement + { $$ = Stmt\Foreach_[$3, $7[0], ['keyVar' => $5, 'byRef' => $7[1], 'stmts' => $9]]; } + | T_DECLARE '(' declare_list ')' declare_statement { $$ = Stmt\Declare_[$3, $5]; } + | T_TRY '{' inner_statement_list '}' catches optional_finally + { $$ = Stmt\TryCatch[$3, $5, $6]; } + | T_THROW expr ';' { $$ = Stmt\Throw_[$2]; } + | T_GOTO T_STRING ';' { $$ = Stmt\Goto_[$2]; } + | T_STRING ':' { $$ = Stmt\Label[$1]; } + | expr error { $$ = $1; } + | error { $$ = array(); /* means: no statement */ } +; + +statement: + non_empty_statement { $$ = $1; } + | ';' + { makeNop($$, $this->startAttributeStack[#1]); + if ($$ === null) $$ = array(); /* means: no statement */ } +; + +catches: + /* empty */ { init(); } + | catches catch { push($1, $2); } +; + +catch: + T_CATCH '(' name T_VARIABLE ')' '{' inner_statement_list '}' + { $$ = Stmt\Catch_[$3, parseVar($4), $7]; } +; + +optional_finally: + /* empty */ { $$ = null; } + | T_FINALLY '{' inner_statement_list '}' { $$ = $3; } +; + +variables_list: + variable { init($1); } + | variables_list ',' variable { push($1, $3); } +; + +optional_ref: + /* empty */ { $$ = false; } + | '&' { $$ = true; } +; + +optional_ellipsis: + /* empty */ { $$ = false; } + | T_ELLIPSIS { $$ = true; } +; + +function_declaration_statement: + T_FUNCTION optional_ref T_STRING '(' parameter_list ')' optional_return_type '{' inner_statement_list '}' + { $$ = Stmt\Function_[$3, ['byRef' => $2, 'params' => $5, 'returnType' => $7, 'stmts' => $9]]; } +; + +class_declaration_statement: + class_entry_type T_STRING extends_from implements_list '{' class_statement_list '}' + { $$ = Stmt\Class_[$2, ['type' => $1, 'extends' => $3, 'implements' => $4, 'stmts' => $6]]; } + | T_INTERFACE T_STRING interface_extends_list '{' class_statement_list '}' + { $$ = Stmt\Interface_[$2, ['extends' => $3, 'stmts' => $5]]; } + | T_TRAIT T_STRING '{' class_statement_list '}' + { $$ = Stmt\Trait_[$2, $4]; } +; + +class_entry_type: + T_CLASS { $$ = 0; } + | T_ABSTRACT T_CLASS { $$ = Stmt\Class_::MODIFIER_ABSTRACT; } + | T_FINAL T_CLASS { $$ = Stmt\Class_::MODIFIER_FINAL; } +; + +extends_from: + /* empty */ { $$ = null; } + | T_EXTENDS name { $$ = $2; } +; + +interface_extends_list: + /* empty */ { $$ = array(); } + | T_EXTENDS name_list { $$ = $2; } +; + +implements_list: + /* empty */ { $$ = array(); } + | T_IMPLEMENTS name_list { $$ = $2; } +; + +name_list: + name { init($1); } + | name_list ',' name { push($1, $3); } +; + +for_statement: + statement { $$ = toArray($1); } + | ':' inner_statement_list T_ENDFOR ';' { $$ = $2; } +; + +foreach_statement: + statement { $$ = toArray($1); } + | ':' inner_statement_list T_ENDFOREACH ';' { $$ = $2; } +; + +declare_statement: + non_empty_statement { $$ = toArray($1); } + | ';' { $$ = null; } + | ':' inner_statement_list T_ENDDECLARE ';' { $$ = $2; } +; + +declare_list: + declare_list_element { init($1); } + | declare_list ',' declare_list_element { push($1, $3); } +; + +declare_list_element: + T_STRING '=' expr { $$ = Stmt\DeclareDeclare[$1, $3]; } +; + +switch_case_list: + '{' case_list '}' { $$ = $2; } + | '{' ';' case_list '}' { $$ = $3; } + | ':' case_list T_ENDSWITCH ';' { $$ = $2; } + | ':' ';' case_list T_ENDSWITCH ';' { $$ = $3; } +; + +case_list: + /* empty */ { init(); } + | case_list case { push($1, $2); } +; + +case: + T_CASE expr case_separator inner_statement_list { $$ = Stmt\Case_[$2, $4]; } + | T_DEFAULT case_separator inner_statement_list { $$ = Stmt\Case_[null, $3]; } +; + +case_separator: + ':' + | ';' +; + +while_statement: + statement { $$ = toArray($1); } + | ':' inner_statement_list T_ENDWHILE ';' { $$ = $2; } +; + +elseif_list: + /* empty */ { init(); } + | elseif_list elseif { push($1, $2); } +; + +elseif: + T_ELSEIF '(' expr ')' statement { $$ = Stmt\ElseIf_[$3, toArray($5)]; } +; + +new_elseif_list: + /* empty */ { init(); } + | new_elseif_list new_elseif { push($1, $2); } +; + +new_elseif: + T_ELSEIF '(' expr ')' ':' inner_statement_list { $$ = Stmt\ElseIf_[$3, $6]; } +; + +else_single: + /* empty */ { $$ = null; } + | T_ELSE statement { $$ = Stmt\Else_[toArray($2)]; } +; + +new_else_single: + /* empty */ { $$ = null; } + | T_ELSE ':' inner_statement_list { $$ = Stmt\Else_[$3]; } +; + +foreach_variable: + variable { $$ = array($1, false); } + | '&' variable { $$ = array($2, true); } + | list_expr { $$ = array($1, false); } +; + +parameter_list: + non_empty_parameter_list { $$ = $1; } + | /* empty */ { $$ = array(); } +; + +non_empty_parameter_list: + parameter { init($1); } + | non_empty_parameter_list ',' parameter { push($1, $3); } +; + +parameter: + optional_param_type optional_ref optional_ellipsis T_VARIABLE + { $$ = Node\Param[parseVar($4), null, $1, $2, $3]; } + | optional_param_type optional_ref optional_ellipsis T_VARIABLE '=' expr + { $$ = Node\Param[parseVar($4), $6, $1, $2, $3]; } +; + +type: + name { $$ = $this->handleScalarTypes($1); } + | T_ARRAY { $$ = 'array'; } + | T_CALLABLE { $$ = 'callable'; } +; + +optional_param_type: + /* empty */ { $$ = null; } + | type { $$ = $1; } +; + +optional_return_type: + /* empty */ { $$ = null; } + | ':' type { $$ = $2; } +; + +argument_list: + '(' ')' { $$ = array(); } + | '(' non_empty_argument_list ')' { $$ = $2; } +; + +non_empty_argument_list: + argument { init($1); } + | non_empty_argument_list ',' argument { push($1, $3); } +; + +argument: + expr { $$ = Node\Arg[$1, false, false]; } + | '&' variable { $$ = Node\Arg[$2, true, false]; } + | T_ELLIPSIS expr { $$ = Node\Arg[$2, false, true]; } +; + +global_var_list: + global_var_list ',' global_var { push($1, $3); } + | global_var { init($1); } +; + +global_var: + simple_variable { $$ = Expr\Variable[$1]; } +; + +static_var_list: + static_var_list ',' static_var { push($1, $3); } + | static_var { init($1); } +; + +static_var: + T_VARIABLE { $$ = Stmt\StaticVar[parseVar($1), null]; } + | T_VARIABLE '=' expr { $$ = Stmt\StaticVar[parseVar($1), $3]; } +; + +class_statement_list: + class_statement_list class_statement { push($1, $2); } + | /* empty */ { init(); } +; + +class_statement: + variable_modifiers property_declaration_list ';' { $$ = Stmt\Property[$1, $2]; } + | T_CONST class_const_list ';' { $$ = Stmt\ClassConst[$2]; } + | method_modifiers T_FUNCTION optional_ref identifier '(' parameter_list ')' optional_return_type method_body + { $$ = Stmt\ClassMethod[$4, ['type' => $1, 'byRef' => $3, 'params' => $6, 'returnType' => $8, 'stmts' => $9]]; } + | T_USE name_list trait_adaptations { $$ = Stmt\TraitUse[$2, $3]; } +; + +trait_adaptations: + ';' { $$ = array(); } + | '{' trait_adaptation_list '}' { $$ = $2; } +; + +trait_adaptation_list: + /* empty */ { init(); } + | trait_adaptation_list trait_adaptation { push($1, $2); } +; + +trait_adaptation: + trait_method_reference_fully_qualified T_INSTEADOF name_list ';' + { $$ = Stmt\TraitUseAdaptation\Precedence[$1[0], $1[1], $3]; } + | trait_method_reference T_AS member_modifier identifier ';' + { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], $3, $4]; } + | trait_method_reference T_AS member_modifier ';' + { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], $3, null]; } + | trait_method_reference T_AS T_STRING ';' + { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], null, $3]; } + | trait_method_reference T_AS reserved_non_modifiers ';' + { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], null, $3]; } +; + +trait_method_reference_fully_qualified: + name T_PAAMAYIM_NEKUDOTAYIM identifier { $$ = array($1, $3); } +; +trait_method_reference: + trait_method_reference_fully_qualified { $$ = $1; } + | identifier { $$ = array(null, $1); } +; + +method_body: + ';' /* abstract method */ { $$ = null; } + | '{' inner_statement_list '}' { $$ = $2; } +; + +variable_modifiers: + non_empty_member_modifiers { $$ = $1; } + | T_VAR { $$ = 0; } +; + +method_modifiers: + /* empty */ { $$ = 0; } + | non_empty_member_modifiers { $$ = $1; } +; + +non_empty_member_modifiers: + member_modifier { $$ = $1; } + | non_empty_member_modifiers member_modifier { Stmt\Class_::verifyModifier($1, $2); $$ = $1 | $2; } +; + +member_modifier: + T_PUBLIC { $$ = Stmt\Class_::MODIFIER_PUBLIC; } + | T_PROTECTED { $$ = Stmt\Class_::MODIFIER_PROTECTED; } + | T_PRIVATE { $$ = Stmt\Class_::MODIFIER_PRIVATE; } + | T_STATIC { $$ = Stmt\Class_::MODIFIER_STATIC; } + | T_ABSTRACT { $$ = Stmt\Class_::MODIFIER_ABSTRACT; } + | T_FINAL { $$ = Stmt\Class_::MODIFIER_FINAL; } +; + +property_declaration_list: + property_declaration { init($1); } + | property_declaration_list ',' property_declaration { push($1, $3); } +; + +property_declaration: + T_VARIABLE { $$ = Stmt\PropertyProperty[parseVar($1), null]; } + | T_VARIABLE '=' expr { $$ = Stmt\PropertyProperty[parseVar($1), $3]; } +; + +expr_list: + expr_list ',' expr { push($1, $3); } + | expr { init($1); } +; + +for_expr: + /* empty */ { $$ = array(); } + | expr_list { $$ = $1; } +; + +expr: + variable { $$ = $1; } + | list_expr '=' expr { $$ = Expr\Assign[$1, $3]; } + | variable '=' expr { $$ = Expr\Assign[$1, $3]; } + | variable '=' '&' variable { $$ = Expr\AssignRef[$1, $4]; } + | new_expr { $$ = $1; } + | T_CLONE expr { $$ = Expr\Clone_[$2]; } + | variable T_PLUS_EQUAL expr { $$ = Expr\AssignOp\Plus [$1, $3]; } + | variable T_MINUS_EQUAL expr { $$ = Expr\AssignOp\Minus [$1, $3]; } + | variable T_MUL_EQUAL expr { $$ = Expr\AssignOp\Mul [$1, $3]; } + | variable T_DIV_EQUAL expr { $$ = Expr\AssignOp\Div [$1, $3]; } + | variable T_CONCAT_EQUAL expr { $$ = Expr\AssignOp\Concat [$1, $3]; } + | variable T_MOD_EQUAL expr { $$ = Expr\AssignOp\Mod [$1, $3]; } + | variable T_AND_EQUAL expr { $$ = Expr\AssignOp\BitwiseAnd[$1, $3]; } + | variable T_OR_EQUAL expr { $$ = Expr\AssignOp\BitwiseOr [$1, $3]; } + | variable T_XOR_EQUAL expr { $$ = Expr\AssignOp\BitwiseXor[$1, $3]; } + | variable T_SL_EQUAL expr { $$ = Expr\AssignOp\ShiftLeft [$1, $3]; } + | variable T_SR_EQUAL expr { $$ = Expr\AssignOp\ShiftRight[$1, $3]; } + | variable T_POW_EQUAL expr { $$ = Expr\AssignOp\Pow [$1, $3]; } + | variable T_INC { $$ = Expr\PostInc[$1]; } + | T_INC variable { $$ = Expr\PreInc [$2]; } + | variable T_DEC { $$ = Expr\PostDec[$1]; } + | T_DEC variable { $$ = Expr\PreDec [$2]; } + | expr T_BOOLEAN_OR expr { $$ = Expr\BinaryOp\BooleanOr [$1, $3]; } + | expr T_BOOLEAN_AND expr { $$ = Expr\BinaryOp\BooleanAnd[$1, $3]; } + | expr T_LOGICAL_OR expr { $$ = Expr\BinaryOp\LogicalOr [$1, $3]; } + | expr T_LOGICAL_AND expr { $$ = Expr\BinaryOp\LogicalAnd[$1, $3]; } + | expr T_LOGICAL_XOR expr { $$ = Expr\BinaryOp\LogicalXor[$1, $3]; } + | expr '|' expr { $$ = Expr\BinaryOp\BitwiseOr [$1, $3]; } + | expr '&' expr { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; } + | expr '^' expr { $$ = Expr\BinaryOp\BitwiseXor[$1, $3]; } + | expr '.' expr { $$ = Expr\BinaryOp\Concat [$1, $3]; } + | expr '+' expr { $$ = Expr\BinaryOp\Plus [$1, $3]; } + | expr '-' expr { $$ = Expr\BinaryOp\Minus [$1, $3]; } + | expr '*' expr { $$ = Expr\BinaryOp\Mul [$1, $3]; } + | expr '/' expr { $$ = Expr\BinaryOp\Div [$1, $3]; } + | expr '%' expr { $$ = Expr\BinaryOp\Mod [$1, $3]; } + | expr T_SL expr { $$ = Expr\BinaryOp\ShiftLeft [$1, $3]; } + | expr T_SR expr { $$ = Expr\BinaryOp\ShiftRight[$1, $3]; } + | expr T_POW expr { $$ = Expr\BinaryOp\Pow [$1, $3]; } + | '+' expr %prec T_INC { $$ = Expr\UnaryPlus [$2]; } + | '-' expr %prec T_INC { $$ = Expr\UnaryMinus[$2]; } + | '!' expr { $$ = Expr\BooleanNot[$2]; } + | '~' expr { $$ = Expr\BitwiseNot[$2]; } + | expr T_IS_IDENTICAL expr { $$ = Expr\BinaryOp\Identical [$1, $3]; } + | expr T_IS_NOT_IDENTICAL expr { $$ = Expr\BinaryOp\NotIdentical [$1, $3]; } + | expr T_IS_EQUAL expr { $$ = Expr\BinaryOp\Equal [$1, $3]; } + | expr T_IS_NOT_EQUAL expr { $$ = Expr\BinaryOp\NotEqual [$1, $3]; } + | expr T_SPACESHIP expr { $$ = Expr\BinaryOp\Spaceship [$1, $3]; } + | expr '<' expr { $$ = Expr\BinaryOp\Smaller [$1, $3]; } + | expr T_IS_SMALLER_OR_EQUAL expr { $$ = Expr\BinaryOp\SmallerOrEqual[$1, $3]; } + | expr '>' expr { $$ = Expr\BinaryOp\Greater [$1, $3]; } + | expr T_IS_GREATER_OR_EQUAL expr { $$ = Expr\BinaryOp\GreaterOrEqual[$1, $3]; } + | expr T_INSTANCEOF class_name_reference { $$ = Expr\Instanceof_[$1, $3]; } + | '(' expr ')' { $$ = $2; } + | expr '?' expr ':' expr { $$ = Expr\Ternary[$1, $3, $5]; } + | expr '?' ':' expr { $$ = Expr\Ternary[$1, null, $4]; } + | expr T_COALESCE expr { $$ = Expr\BinaryOp\Coalesce[$1, $3]; } + | T_ISSET '(' variables_list ')' { $$ = Expr\Isset_[$3]; } + | T_EMPTY '(' expr ')' { $$ = Expr\Empty_[$3]; } + | T_INCLUDE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_INCLUDE]; } + | T_INCLUDE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_INCLUDE_ONCE]; } + | T_EVAL '(' expr ')' { $$ = Expr\Eval_[$3]; } + | T_REQUIRE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE]; } + | T_REQUIRE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE_ONCE]; } + | T_INT_CAST expr { $$ = Expr\Cast\Int_ [$2]; } + | T_DOUBLE_CAST expr { $$ = Expr\Cast\Double [$2]; } + | T_STRING_CAST expr { $$ = Expr\Cast\String_ [$2]; } + | T_ARRAY_CAST expr { $$ = Expr\Cast\Array_ [$2]; } + | T_OBJECT_CAST expr { $$ = Expr\Cast\Object_ [$2]; } + | T_BOOL_CAST expr { $$ = Expr\Cast\Bool_ [$2]; } + | T_UNSET_CAST expr { $$ = Expr\Cast\Unset_ [$2]; } + | T_EXIT exit_expr + { $attrs = attributes(); + $attrs['kind'] = strtolower($1) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; + $$ = new Expr\Exit_($2, $attrs); } + | '@' expr { $$ = Expr\ErrorSuppress[$2]; } + | scalar { $$ = $1; } + | '`' backticks_expr '`' { $$ = Expr\ShellExec[$2]; } + | T_PRINT expr { $$ = Expr\Print_[$2]; } + | T_YIELD { $$ = Expr\Yield_[null, null]; } + | T_YIELD expr { $$ = Expr\Yield_[$2, null]; } + | T_YIELD expr T_DOUBLE_ARROW expr { $$ = Expr\Yield_[$4, $2]; } + | T_YIELD_FROM expr { $$ = Expr\YieldFrom[$2]; } + | T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars optional_return_type + '{' inner_statement_list '}' + { $$ = Expr\Closure[['static' => false, 'byRef' => $2, 'params' => $4, 'uses' => $6, 'returnType' => $7, 'stmts' => $9]]; } + | T_STATIC T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars optional_return_type + '{' inner_statement_list '}' + { $$ = Expr\Closure[['static' => true, 'byRef' => $3, 'params' => $5, 'uses' => $7, 'returnType' => $8, 'stmts' => $10]]; } +; + +anonymous_class: + T_CLASS ctor_arguments extends_from implements_list '{' class_statement_list '}' + { $$ = array(Stmt\Class_[null, ['type' => 0, 'extends' => $3, 'implements' => $4, 'stmts' => $6]], $2); } + +new_expr: + T_NEW class_name_reference ctor_arguments { $$ = Expr\New_[$2, $3]; } + | T_NEW anonymous_class + { list($class, $ctorArgs) = $2; $$ = Expr\New_[$class, $ctorArgs]; } +; + +lexical_vars: + /* empty */ { $$ = array(); } + | T_USE '(' lexical_var_list ')' { $$ = $3; } +; + +lexical_var_list: + lexical_var { init($1); } + | lexical_var_list ',' lexical_var { push($1, $3); } +; + +lexical_var: + optional_ref T_VARIABLE { $$ = Expr\ClosureUse[parseVar($2), $1]; } +; + +function_call: + name argument_list { $$ = Expr\FuncCall[$1, $2]; } + | callable_expr argument_list { $$ = Expr\FuncCall[$1, $2]; } + | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM member_name argument_list + { $$ = Expr\StaticCall[$1, $3, $4]; } +; + +class_name: + T_STATIC { $$ = Name[$1]; } + | name { $$ = $1; } +; + +name: + namespace_name_parts { $$ = Name[$1]; } + | T_NS_SEPARATOR namespace_name_parts { $$ = Name\FullyQualified[$2]; } + | T_NAMESPACE T_NS_SEPARATOR namespace_name_parts { $$ = Name\Relative[$3]; } +; + +class_name_reference: + class_name { $$ = $1; } + | new_variable { $$ = $1; } +; + +class_name_or_var: + class_name { $$ = $1; } + | dereferencable { $$ = $1; } +; + +exit_expr: + /* empty */ { $$ = null; } + | '(' optional_expr ')' { $$ = $2; } +; + +backticks_expr: + /* empty */ { $$ = array(); } + | T_ENCAPSED_AND_WHITESPACE + { $$ = array(Scalar\EncapsedStringPart[Scalar\String_::parseEscapeSequences($1, '`')]); } + | encaps_list { parseEncapsed($1, '`', true); $$ = $1; } +; + +ctor_arguments: + /* empty */ { $$ = array(); } + | argument_list { $$ = $1; } +; + +constant: + name { $$ = Expr\ConstFetch[$1]; } + | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM identifier + { $$ = Expr\ClassConstFetch[$1, $3]; } +; + +dereferencable_scalar: + T_ARRAY '(' array_pair_list ')' + { $attrs = attributes(); $attrs['kind'] = Expr\Array_::KIND_LONG; + $$ = new Expr\Array_($3, $attrs); } + | '[' array_pair_list ']' + { $attrs = attributes(); $attrs['kind'] = Expr\Array_::KIND_SHORT; + $$ = new Expr\Array_($2, $attrs); } + | T_CONSTANT_ENCAPSED_STRING + { $attrs = attributes(); $attrs['kind'] = strKind($1); + $$ = new Scalar\String_(Scalar\String_::parse($1), $attrs); } +; + +scalar: + T_LNUMBER { $$ = Scalar\LNumber::fromString($1, attributes()); } + | T_DNUMBER { $$ = Scalar\DNumber[Scalar\DNumber::parse($1)]; } + | T_LINE { $$ = Scalar\MagicConst\Line[]; } + | T_FILE { $$ = Scalar\MagicConst\File[]; } + | T_DIR { $$ = Scalar\MagicConst\Dir[]; } + | T_CLASS_C { $$ = Scalar\MagicConst\Class_[]; } + | T_TRAIT_C { $$ = Scalar\MagicConst\Trait_[]; } + | T_METHOD_C { $$ = Scalar\MagicConst\Method[]; } + | T_FUNC_C { $$ = Scalar\MagicConst\Function_[]; } + | T_NS_C { $$ = Scalar\MagicConst\Namespace_[]; } + | dereferencable_scalar { $$ = $1; } + | constant { $$ = $1; } + | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC + { $attrs = attributes(); setDocStringAttrs($attrs, $1); + $$ = new Scalar\String_(Scalar\String_::parseDocString($1, $2), $attrs); } + | T_START_HEREDOC T_END_HEREDOC + { $attrs = attributes(); setDocStringAttrs($attrs, $1); + $$ = new Scalar\String_('', $attrs); } + | '"' encaps_list '"' + { $attrs = attributes(); $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; + parseEncapsed($2, '"', true); $$ = new Scalar\Encapsed($2, $attrs); } + | T_START_HEREDOC encaps_list T_END_HEREDOC + { $attrs = attributes(); setDocStringAttrs($attrs, $1); + parseEncapsedDoc($2, true); $$ = new Scalar\Encapsed($2, $attrs); } +; + +optional_comma: + /* empty */ + | ',' +; + +optional_expr: + /* empty */ { $$ = null; } + | expr { $$ = $1; } +; + +dereferencable: + variable { $$ = $1; } + | '(' expr ')' { $$ = $2; } + | dereferencable_scalar { $$ = $1; } +; + +callable_expr: + callable_variable { $$ = $1; } + | '(' expr ')' { $$ = $2; } + | dereferencable_scalar { $$ = $1; } +; + +callable_variable: + simple_variable { $$ = Expr\Variable[$1]; } + | dereferencable '[' optional_expr ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | constant '[' optional_expr ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | dereferencable '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | function_call { $$ = $1; } + | dereferencable T_OBJECT_OPERATOR property_name argument_list + { $$ = Expr\MethodCall[$1, $3, $4]; } +; + +variable: + callable_variable { $$ = $1; } + | static_member { $$ = $1; } + | dereferencable T_OBJECT_OPERATOR property_name { $$ = Expr\PropertyFetch[$1, $3]; } +; + +simple_variable: + T_VARIABLE { $$ = parseVar($1); } + | '$' '{' expr '}' { $$ = $3; } + | '$' simple_variable { $$ = Expr\Variable[$2]; } +; + +static_member: + class_name_or_var T_PAAMAYIM_NEKUDOTAYIM simple_variable + { $$ = Expr\StaticPropertyFetch[$1, $3]; } +; + +new_variable: + simple_variable { $$ = Expr\Variable[$1]; } + | new_variable '[' optional_expr ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | new_variable '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | new_variable T_OBJECT_OPERATOR property_name { $$ = Expr\PropertyFetch[$1, $3]; } + | class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable { $$ = Expr\StaticPropertyFetch[$1, $3]; } + | new_variable T_PAAMAYIM_NEKUDOTAYIM simple_variable { $$ = Expr\StaticPropertyFetch[$1, $3]; } +; + +member_name: + identifier { $$ = $1; } + | '{' expr '}' { $$ = $2; } + | simple_variable { $$ = Expr\Variable[$1]; } +; + +property_name: + T_STRING { $$ = $1; } + | '{' expr '}' { $$ = $2; } + | simple_variable { $$ = Expr\Variable[$1]; } +; + +list_expr: + T_LIST '(' list_expr_elements ')' { $$ = Expr\List_[$3]; } +; + +list_expr_elements: + list_expr_elements ',' list_expr_element { push($1, $3); } + | list_expr_element { init($1); } +; + +list_expr_element: + variable { $$ = $1; } + | list_expr { $$ = $1; } + | /* empty */ { $$ = null; } +; + +array_pair_list: + /* empty */ { $$ = array(); } + | non_empty_array_pair_list optional_comma { $$ = $1; } +; + +non_empty_array_pair_list: + non_empty_array_pair_list ',' array_pair { push($1, $3); } + | array_pair { init($1); } +; + +array_pair: + expr T_DOUBLE_ARROW expr { $$ = Expr\ArrayItem[$3, $1, false]; } + | expr { $$ = Expr\ArrayItem[$1, null, false]; } + | expr T_DOUBLE_ARROW '&' variable { $$ = Expr\ArrayItem[$4, $1, true]; } + | '&' variable { $$ = Expr\ArrayItem[$2, null, true]; } +; + +encaps_list: + encaps_list encaps_var { push($1, $2); } + | encaps_list encaps_string_part { push($1, $2); } + | encaps_var { init($1); } + | encaps_string_part encaps_var { init($1, $2); } +; + +encaps_string_part: + T_ENCAPSED_AND_WHITESPACE { $$ = Scalar\EncapsedStringPart[$1]; } +; + +encaps_var: + T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } + | T_VARIABLE '[' encaps_var_offset ']' { $$ = Expr\ArrayDimFetch[Expr\Variable[parseVar($1)], $3]; } + | T_VARIABLE T_OBJECT_OPERATOR T_STRING { $$ = Expr\PropertyFetch[Expr\Variable[parseVar($1)], $3]; } + | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { $$ = Expr\Variable[$2]; } + | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' { $$ = Expr\Variable[$2]; } + | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' + { $$ = Expr\ArrayDimFetch[Expr\Variable[$2], $4]; } + | T_CURLY_OPEN variable '}' { $$ = $2; } +; + +encaps_var_offset: + T_STRING { $$ = Scalar\String_[$1]; } + | T_NUM_STRING { $$ = Scalar\String_[$1]; } + | T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } +; + +%% diff --git a/application/vendor/nikic/php-parser/grammar/rebuildParser.php b/application/vendor/nikic/php-parser/grammar/rebuildParser.php deleted file mode 100644 index 5d21a1e..0000000 --- a/application/vendor/nikic/php-parser/grammar/rebuildParser.php +++ /dev/null @@ -1,228 +0,0 @@ -\'[^\\\\\']*+(?:\\\\.[^\\\\\']*+)*+\') - (?"[^\\\\"]*+(?:\\\\.[^\\\\"]*+)*+") - (?(?&singleQuotedString)|(?&doubleQuotedString)) - (?/\*[^*]*+(?:\*(?!/)[^*]*+)*+\*/) - (?\{[^\'"/{}]*+(?:(?:(?&string)|(?&comment)|(?&code)|/)[^\'"/{}]*+)*+}) -)'; - -const PARAMS = '\[(?[^[\]]*+(?:\[(?¶ms)\][^[\]]*+)*+)\]'; -const ARGS = '\((?[^()]*+(?:\((?&args)\)[^()]*+)*+)\)'; - -/////////////////// -/// Main script /// -/////////////////// - -echo 'Building temporary preproprocessed grammar file.', "\n"; - -$grammarCode = file_get_contents($grammarFile); - -$grammarCode = resolveNodes($grammarCode); -$grammarCode = resolveMacros($grammarCode); -$grammarCode = resolveArrays($grammarCode); -$grammarCode = resolveStackAccess($grammarCode); - -file_put_contents($tmpGrammarFile, $grammarCode); - -$additionalArgs = $optionDebug ? '-t -v' : ''; - -echo "Building parser.\n"; -$output = trim(shell_exec("$kmyacc $additionalArgs -l -m $skeletonFile $tmpGrammarFile 2>&1")); -echo "Output: \"$output\"\n"; - -$resultCode = file_get_contents($tmpResultFile); -$resultCode = removeTrailingWhitespace($resultCode); - -ensureDirExists(dirname($parserResultFile)); -file_put_contents($parserResultFile, $resultCode); -unlink($tmpResultFile); - -if (!$optionKeepTmpGrammar) { - unlink($tmpGrammarFile); -} - -/////////////////////////////// -/// Preprocessing functions /// -/////////////////////////////// - -function resolveNodes($code) { - return preg_replace_callback( - '~(?[A-Z][a-zA-Z_\\\\]++)\s*' . PARAMS . '~', - function($matches) { - // recurse - $matches['params'] = resolveNodes($matches['params']); - - $params = magicSplit( - '(?:' . PARAMS . '|' . ARGS . ')(*SKIP)(*FAIL)|,', - $matches['params'] - ); - - $paramCode = ''; - foreach ($params as $param) { - $paramCode .= $param . ', '; - } - - return 'new ' . $matches['name'] . '(' . $paramCode . 'attributes())'; - }, - $code - ); -} - -function resolveMacros($code) { - return preg_replace_callback( - '~\b(?)(?!array\()(?[a-z][A-Za-z]++)' . ARGS . '~', - function($matches) { - // recurse - $matches['args'] = resolveMacros($matches['args']); - - $name = $matches['name']; - $args = magicSplit( - '(?:' . PARAMS . '|' . ARGS . ')(*SKIP)(*FAIL)|,', - $matches['args'] - ); - - if ('attributes' == $name) { - assertArgs(0, $args, $name); - return '$this->startAttributeStack[#1] + $this->endAttributes'; - } - - if ('init' == $name) { - return '$$ = array(' . implode(', ', $args) . ')'; - } - - if ('push' == $name) { - assertArgs(2, $args, $name); - - return $args[0] . '[] = ' . $args[1] . '; $$ = ' . $args[0]; - } - - if ('pushNormalizing' == $name) { - assertArgs(2, $args, $name); - - return 'if (is_array(' . $args[1] . ')) { $$ = array_merge(' . $args[0] . ', ' . $args[1] . '); } else { ' . $args[0] . '[] = ' . $args[1] . '; $$ = ' . $args[0] . '; }'; - } - - if ('toArray' == $name) { - assertArgs(1, $args, $name); - - return 'is_array(' . $args[0] . ') ? ' . $args[0] . ' : array(' . $args[0] . ')'; - } - - if ('parseVar' == $name) { - assertArgs(1, $args, $name); - - return 'substr(' . $args[0] . ', 1)'; - } - - if ('parseEncapsed' == $name) { - assertArgs(2, $args, $name); - - return 'foreach (' . $args[0] . ' as &$s) { if (is_string($s)) { $s = Node\Scalar\String_::parseEscapeSequences($s, ' . $args[1] . '); } }'; - } - - if ('parseEncapsedDoc' == $name) { - assertArgs(1, $args, $name); - - return 'foreach (' . $args[0] . ' as &$s) { if (is_string($s)) { $s = Node\Scalar\String_::parseEscapeSequences($s, null); } } $s = preg_replace(\'~(\r\n|\n|\r)\z~\', \'\', $s); if (\'\' === $s) array_pop(' . $args[0] . ');'; - } - - return $matches[0]; - }, - $code - ); -} - -function assertArgs($num, $args, $name) { - if ($num != count($args)) { - die('Wrong argument count for ' . $name . '().'); - } -} - -function resolveArrays($code) { - return preg_replace_callback( - '~' . PARAMS . '~', - function ($matches) { - $elements = magicSplit( - '(?:' . PARAMS . '|' . ARGS . ')(*SKIP)(*FAIL)|,', - $matches['params'] - ); - - // don't convert [] to array, it might have different meaning - if (empty($elements)) { - return $matches[0]; - } - - $elementCodes = array(); - foreach ($elements as $element) { - // convert only arrays where all elements have keys - if (false === strpos($element, ':')) { - return $matches[0]; - } - - list($key, $value) = explode(':', $element, 2); - $elementCodes[] = "'" . $key . "' =>" . $value; - } - - return 'array(' . implode(', ', $elementCodes) . ')'; - }, - $code - ); -} - -function resolveStackAccess($code) { - $code = preg_replace('/\$\d+/', '$this->semStack[$0]', $code); - $code = preg_replace('/#(\d+)/', '$$1', $code); - return $code; -} - -function removeTrailingWhitespace($code) { - $lines = explode("\n", $code); - $lines = array_map('rtrim', $lines); - return implode("\n", $lines); -} - -function ensureDirExists($dir) { - if (!is_dir($dir)) { - mkdir($dir, 0777, true); - } -} - -////////////////////////////// -/// Regex helper functions /// -////////////////////////////// - -function regex($regex) { - return '~' . LIB . '(?:' . str_replace('~', '\~', $regex) . ')~'; -} - -function magicSplit($regex, $string) { - $pieces = preg_split(regex('(?:(?&string)|(?&comment)|(?&code))(*SKIP)(*FAIL)|' . $regex), $string); - - foreach ($pieces as &$piece) { - $piece = trim($piece); - } - - return array_filter($pieces); -} diff --git a/application/vendor/nikic/php-parser/grammar/rebuildParsers.php b/application/vendor/nikic/php-parser/grammar/rebuildParsers.php new file mode 100644 index 0000000..5b538ce --- /dev/null +++ b/application/vendor/nikic/php-parser/grammar/rebuildParsers.php @@ -0,0 +1,257 @@ + 'Php5', + __DIR__ . '/php7.y' => 'Php7', +]; + +$tokensFile = __DIR__ . '/tokens.y'; +$tokensTemplate = __DIR__ . '/tokens.template'; +$skeletonFile = __DIR__ . '/parser.template'; +$tmpGrammarFile = __DIR__ . '/tmp_parser.phpy'; +$tmpResultFile = __DIR__ . '/tmp_parser.php'; +$resultDir = __DIR__ . '/../lib/PhpParser/Parser'; +$tokensResultsFile = $resultDir . '/Tokens.php'; + +// check for kmyacc.exe binary in this directory, otherwise fall back to global name +$kmyacc = __DIR__ . '/kmyacc.exe'; +if (!file_exists($kmyacc)) { + $kmyacc = 'kmyacc'; +} + +$options = array_flip($argv); +$optionDebug = isset($options['--debug']); +$optionKeepTmpGrammar = isset($options['--keep-tmp-grammar']); + +/////////////////////////////// +/// Utility regex constants /// +/////////////////////////////// + +const LIB = '(?(DEFINE) + (?\'[^\\\\\']*+(?:\\\\.[^\\\\\']*+)*+\') + (?"[^\\\\"]*+(?:\\\\.[^\\\\"]*+)*+") + (?(?&singleQuotedString)|(?&doubleQuotedString)) + (?/\*[^*]*+(?:\*(?!/)[^*]*+)*+\*/) + (?\{[^\'"/{}]*+(?:(?:(?&string)|(?&comment)|(?&code)|/)[^\'"/{}]*+)*+}) +)'; + +const PARAMS = '\[(?[^[\]]*+(?:\[(?¶ms)\][^[\]]*+)*+)\]'; +const ARGS = '\((?[^()]*+(?:\((?&args)\)[^()]*+)*+)\)'; + +/////////////////// +/// Main script /// +/////////////////// + +$tokens = file_get_contents($tokensFile); + +foreach ($grammarFileToName as $grammarFile => $name) { + echo "Building temporary $name grammar file.\n"; + + $grammarCode = file_get_contents($grammarFile); + $grammarCode = str_replace('%tokens', $tokens, $grammarCode); + + $grammarCode = resolveNodes($grammarCode); + $grammarCode = resolveMacros($grammarCode); + $grammarCode = resolveStackAccess($grammarCode); + + file_put_contents($tmpGrammarFile, $grammarCode); + + $additionalArgs = $optionDebug ? '-t -v' : ''; + + echo "Building $name parser.\n"; + $output = trim(shell_exec("$kmyacc $additionalArgs -l -m $skeletonFile -p $name $tmpGrammarFile 2>&1")); + echo "Output: \"$output\"\n"; + + $resultCode = file_get_contents($tmpResultFile); + $resultCode = removeTrailingWhitespace($resultCode); + + ensureDirExists($resultDir); + file_put_contents("$resultDir/$name.php", $resultCode); + unlink($tmpResultFile); + + echo "Building token definition.\n"; + $output = trim(shell_exec("$kmyacc -l -m $tokensTemplate $tmpGrammarFile 2>&1")); + assert($output === ''); + rename($tmpResultFile, $tokensResultsFile); + + if (!$optionKeepTmpGrammar) { + unlink($tmpGrammarFile); + } +} + +/////////////////////////////// +/// Preprocessing functions /// +/////////////////////////////// + +function resolveNodes($code) { + return preg_replace_callback( + '~\b(?[A-Z][a-zA-Z_\\\\]++)\s*' . PARAMS . '~', + function($matches) { + // recurse + $matches['params'] = resolveNodes($matches['params']); + + $params = magicSplit( + '(?:' . PARAMS . '|' . ARGS . ')(*SKIP)(*FAIL)|,', + $matches['params'] + ); + + $paramCode = ''; + foreach ($params as $param) { + $paramCode .= $param . ', '; + } + + return 'new ' . $matches['name'] . '(' . $paramCode . 'attributes())'; + }, + $code + ); +} + +function resolveMacros($code) { + return preg_replace_callback( + '~\b(?)(?!array\()(?[a-z][A-Za-z]++)' . ARGS . '~', + function($matches) { + // recurse + $matches['args'] = resolveMacros($matches['args']); + + $name = $matches['name']; + $args = magicSplit( + '(?:' . PARAMS . '|' . ARGS . ')(*SKIP)(*FAIL)|,', + $matches['args'] + ); + + if ('attributes' == $name) { + assertArgs(0, $args, $name); + return '$this->startAttributeStack[#1] + $this->endAttributes'; + } + + if ('init' == $name) { + return '$$ = array(' . implode(', ', $args) . ')'; + } + + if ('push' == $name) { + assertArgs(2, $args, $name); + + return $args[0] . '[] = ' . $args[1] . '; $$ = ' . $args[0]; + } + + if ('pushNormalizing' == $name) { + assertArgs(2, $args, $name); + + return 'if (is_array(' . $args[1] . ')) { $$ = array_merge(' . $args[0] . ', ' . $args[1] . '); }' + . ' else { ' . $args[0] . '[] = ' . $args[1] . '; $$ = ' . $args[0] . '; }'; + } + + if ('toArray' == $name) { + assertArgs(1, $args, $name); + + return 'is_array(' . $args[0] . ') ? ' . $args[0] . ' : array(' . $args[0] . ')'; + } + + if ('parseVar' == $name) { + assertArgs(1, $args, $name); + + return 'substr(' . $args[0] . ', 1)'; + } + + if ('parseEncapsed' == $name) { + assertArgs(3, $args, $name); + + return 'foreach (' . $args[0] . ' as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) {' + . ' $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, ' . $args[1] . ', ' . $args[2] . '); } }'; + } + + if ('parseEncapsedDoc' == $name) { + assertArgs(2, $args, $name); + + return 'foreach (' . $args[0] . ' as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) {' + . ' $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, ' . $args[1] . '); } }' + . ' $s->value = preg_replace(\'~(\r\n|\n|\r)\z~\', \'\', $s->value);' + . ' if (\'\' === $s->value) array_pop(' . $args[0] . ');'; + } + + if ('makeNop' == $name) { + assertArgs(2, $args, $name); + + return '$startAttributes = ' . $args[1] . ';' + . ' if (isset($startAttributes[\'comments\']))' + . ' { ' . $args[0] . ' = new Stmt\Nop([\'comments\' => $startAttributes[\'comments\']]); }' + . ' else { ' . $args[0] . ' = null; }'; + } + + if ('strKind' == $name) { + assertArgs(1, $args, $name); + + return '(' . $args[0] . '[0] === "\'" || (' . $args[0] . '[1] === "\'" && ' + . '(' . $args[0] . '[0] === \'b\' || ' . $args[0] . '[0] === \'B\')) ' + . '? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED)'; + } + + if ('setDocStringAttrs' == $name) { + assertArgs(2, $args, $name); + + return $args[0] . '[\'kind\'] = strpos(' . $args[1] . ', "\'") === false ' + . '? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; ' + . 'preg_match(\'/\A[bB]?<<<[ \t]*[\\\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\\\'"]?(?:\r\n|\n|\r)\z/\', ' . $args[1] . ', $matches); ' + . $args[0] . '[\'docLabel\'] = $matches[1];'; + } + + if ('prependLeadingComments' == $name) { + assertArgs(1, $args, $name); + + return '$attrs = $this->startAttributeStack[#1]; $stmts = ' . $args[0] . '; ' + . 'if (!empty($attrs[\'comments\']) && isset($stmts[0])) {' + . '$stmts[0]->setAttribute(\'comments\', ' + . 'array_merge($attrs[\'comments\'], $stmts[0]->getAttribute(\'comments\', []))); }'; + } + + return $matches[0]; + }, + $code + ); +} + +function assertArgs($num, $args, $name) { + if ($num != count($args)) { + die('Wrong argument count for ' . $name . '().'); + } +} + +function resolveStackAccess($code) { + $code = preg_replace('/\$\d+/', '$this->semStack[$0]', $code); + $code = preg_replace('/#(\d+)/', '$$1', $code); + return $code; +} + +function removeTrailingWhitespace($code) { + $lines = explode("\n", $code); + $lines = array_map('rtrim', $lines); + return implode("\n", $lines); +} + +function ensureDirExists($dir) { + if (!is_dir($dir)) { + mkdir($dir, 0777, true); + } +} + +////////////////////////////// +/// Regex helper functions /// +////////////////////////////// + +function regex($regex) { + return '~' . LIB . '(?:' . str_replace('~', '\~', $regex) . ')~'; +} + +function magicSplit($regex, $string) { + $pieces = preg_split(regex('(?:(?&string)|(?&comment)|(?&code))(*SKIP)(*FAIL)|' . $regex), $string); + + foreach ($pieces as &$piece) { + $piece = trim($piece); + } + + if ($pieces === ['']) { + return []; + } + + return $pieces; +} diff --git a/application/vendor/nikic/php-parser/grammar/tokens.template b/application/vendor/nikic/php-parser/grammar/tokens.template new file mode 100644 index 0000000..ba4e490 --- /dev/null +++ b/application/vendor/nikic/php-parser/grammar/tokens.template @@ -0,0 +1,17 @@ +semValue +#semval($,%t) $this->semValue +#semval(%n) $this->stackPos-(%l-%n) +#semval(%n,%t) $this->stackPos-(%l-%n) + +namespace PhpParser\Parser; +#include; + +/* GENERATED file based on grammar/tokens.y */ +final class Tokens +{ +#tokenval + const %s = %n; +#endtokenval +} diff --git a/application/vendor/nikic/php-parser/grammar/tokens.y b/application/vendor/nikic/php-parser/grammar/tokens.y new file mode 100644 index 0000000..2b54f80 --- /dev/null +++ b/application/vendor/nikic/php-parser/grammar/tokens.y @@ -0,0 +1,113 @@ +/* We currently rely on the token ID mapping to be the same between PHP 5 and PHP 7 - so the same lexer can be used for + * both. This is enforced by sharing this token file. */ + +%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE +%left ',' +%left T_LOGICAL_OR +%left T_LOGICAL_XOR +%left T_LOGICAL_AND +%right T_PRINT +%right T_YIELD +%right T_DOUBLE_ARROW +%right T_YIELD_FROM +%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL +%left '?' ':' +%right T_COALESCE +%left T_BOOLEAN_OR +%left T_BOOLEAN_AND +%left '|' +%left '^' +%left '&' +%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL T_SPACESHIP +%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL +%left T_SL T_SR +%left '+' '-' '.' +%left '*' '/' '%' +%right '!' +%nonassoc T_INSTANCEOF +%right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@' +%right T_POW +%right '[' +%nonassoc T_NEW T_CLONE +%token T_EXIT +%token T_IF +%left T_ELSEIF +%left T_ELSE +%left T_ENDIF +%token T_LNUMBER +%token T_DNUMBER +%token T_STRING +%token T_STRING_VARNAME +%token T_VARIABLE +%token T_NUM_STRING +%token T_INLINE_HTML +%token T_CHARACTER +%token T_BAD_CHARACTER +%token T_ENCAPSED_AND_WHITESPACE +%token T_CONSTANT_ENCAPSED_STRING +%token T_ECHO +%token T_DO +%token T_WHILE +%token T_ENDWHILE +%token T_FOR +%token T_ENDFOR +%token T_FOREACH +%token T_ENDFOREACH +%token T_DECLARE +%token T_ENDDECLARE +%token T_AS +%token T_SWITCH +%token T_ENDSWITCH +%token T_CASE +%token T_DEFAULT +%token T_BREAK +%token T_CONTINUE +%token T_GOTO +%token T_FUNCTION +%token T_CONST +%token T_RETURN +%token T_TRY +%token T_CATCH +%token T_FINALLY +%token T_THROW +%token T_USE +%token T_INSTEADOF +%token T_GLOBAL +%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC +%token T_VAR +%token T_UNSET +%token T_ISSET +%token T_EMPTY +%token T_HALT_COMPILER +%token T_CLASS +%token T_TRAIT +%token T_INTERFACE +%token T_EXTENDS +%token T_IMPLEMENTS +%token T_OBJECT_OPERATOR +%token T_DOUBLE_ARROW +%token T_LIST +%token T_ARRAY +%token T_CALLABLE +%token T_CLASS_C +%token T_TRAIT_C +%token T_METHOD_C +%token T_FUNC_C +%token T_LINE +%token T_FILE +%token T_COMMENT +%token T_DOC_COMMENT +%token T_OPEN_TAG +%token T_OPEN_TAG_WITH_ECHO +%token T_CLOSE_TAG +%token T_WHITESPACE +%token T_START_HEREDOC +%token T_END_HEREDOC +%token T_DOLLAR_OPEN_CURLY_BRACES +%token T_CURLY_OPEN +%token T_PAAMAYIM_NEKUDOTAYIM +%token T_NAMESPACE +%token T_NS_C +%token T_DIR +%token T_NS_SEPARATOR +%token T_ELLIPSIS diff --git a/application/vendor/nikic/php-parser/grammar/zend_language_parser.phpy b/application/vendor/nikic/php-parser/grammar/zend_language_parser.phpy deleted file mode 100644 index 9a8cd5c..0000000 --- a/application/vendor/nikic/php-parser/grammar/zend_language_parser.phpy +++ /dev/null @@ -1,994 +0,0 @@ -%pure_parser -%expect 2 - -%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE -%left ',' -%left T_LOGICAL_OR -%left T_LOGICAL_XOR -%left T_LOGICAL_AND -%right T_PRINT -%right T_YIELD -%right T_YIELD_FROM -%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL -%left '?' ':' -%right T_COALESCE -%left T_BOOLEAN_OR -%left T_BOOLEAN_AND -%left '|' -%left '^' -%left '&' -%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL T_SPACESHIP -%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL -%left T_SL T_SR -%left '+' '-' '.' -%left '*' '/' '%' -%right '!' -%nonassoc T_INSTANCEOF -%right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@' -%right T_POW -%right '[' -%nonassoc T_NEW T_CLONE -%token T_EXIT -%token T_IF -%left T_ELSEIF -%left T_ELSE -%left T_ENDIF -%token T_LNUMBER -%token T_DNUMBER -%token T_STRING -%token T_STRING_VARNAME -%token T_VARIABLE -%token T_NUM_STRING -%token T_INLINE_HTML -%token T_CHARACTER -%token T_BAD_CHARACTER -%token T_ENCAPSED_AND_WHITESPACE -%token T_CONSTANT_ENCAPSED_STRING -%token T_ECHO -%token T_DO -%token T_WHILE -%token T_ENDWHILE -%token T_FOR -%token T_ENDFOR -%token T_FOREACH -%token T_ENDFOREACH -%token T_DECLARE -%token T_ENDDECLARE -%token T_AS -%token T_SWITCH -%token T_ENDSWITCH -%token T_CASE -%token T_DEFAULT -%token T_BREAK -%token T_CONTINUE -%token T_GOTO -%token T_FUNCTION -%token T_CONST -%token T_RETURN -%token T_TRY -%token T_CATCH -%token T_FINALLY -%token T_THROW -%token T_USE -%token T_INSTEADOF -%token T_GLOBAL -%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC -%token T_VAR -%token T_UNSET -%token T_ISSET -%token T_EMPTY -%token T_HALT_COMPILER -%token T_CLASS -%token T_TRAIT -%token T_INTERFACE -%token T_EXTENDS -%token T_IMPLEMENTS -%token T_OBJECT_OPERATOR -%token T_DOUBLE_ARROW -%token T_LIST -%token T_ARRAY -%token T_CALLABLE -%token T_CLASS_C -%token T_TRAIT_C -%token T_METHOD_C -%token T_FUNC_C -%token T_LINE -%token T_FILE -%token T_COMMENT -%token T_DOC_COMMENT -%token T_OPEN_TAG -%token T_OPEN_TAG_WITH_ECHO -%token T_CLOSE_TAG -%token T_WHITESPACE -%token T_START_HEREDOC -%token T_END_HEREDOC -%token T_DOLLAR_OPEN_CURLY_BRACES -%token T_CURLY_OPEN -%token T_PAAMAYIM_NEKUDOTAYIM -%token T_NAMESPACE -%token T_NS_C -%token T_DIR -%token T_NS_SEPARATOR -%token T_ELLIPSIS - -%{ -use PhpParser\Node\Expr; -use PhpParser\Node\Name; -use PhpParser\Node\Scalar; -use PhpParser\Node\Stmt; -%} - -%% - -start: - top_statement_list { $$ = $this->handleNamespaces($1); } -; - -top_statement_list: - top_statement_list top_statement { pushNormalizing($1, $2); } - | /* empty */ { init(); } -; - -namespace_name_parts: - T_STRING { init($1); } - | namespace_name_parts T_NS_SEPARATOR T_STRING { push($1, $3); } -; - -namespace_name: - namespace_name_parts { $$ = Name[$1]; } -; - -top_statement: - statement { $$ = $1; } - | function_declaration_statement { $$ = $1; } - | class_declaration_statement { $$ = $1; } - | T_HALT_COMPILER - { $$ = Stmt\HaltCompiler[$this->lexer->handleHaltCompiler()]; } - | T_NAMESPACE namespace_name ';' { $$ = Stmt\Namespace_[$2, null]; } - | T_NAMESPACE namespace_name '{' top_statement_list '}' { $$ = Stmt\Namespace_[$2, $4]; } - | T_NAMESPACE '{' top_statement_list '}' { $$ = Stmt\Namespace_[null, $3]; } - | T_USE use_declarations ';' { $$ = Stmt\Use_[$2, Stmt\Use_::TYPE_NORMAL]; } - | T_USE T_FUNCTION use_declarations ';' { $$ = Stmt\Use_[$3, Stmt\Use_::TYPE_FUNCTION]; } - | T_USE T_CONST use_declarations ';' { $$ = Stmt\Use_[$3, Stmt\Use_::TYPE_CONSTANT]; } - | T_CONST constant_declaration_list ';' { $$ = Stmt\Const_[$2]; } -; - -use_declarations: - use_declarations ',' use_declaration { push($1, $3); } - | use_declaration { init($1); } -; - -use_declaration: - namespace_name { $$ = Stmt\UseUse[$1, null]; } - | namespace_name T_AS T_STRING { $$ = Stmt\UseUse[$1, $3]; } - | T_NS_SEPARATOR namespace_name { $$ = Stmt\UseUse[$2, null]; } - | T_NS_SEPARATOR namespace_name T_AS T_STRING { $$ = Stmt\UseUse[$2, $4]; } -; - -constant_declaration_list: - constant_declaration_list ',' constant_declaration { push($1, $3); } - | constant_declaration { init($1); } -; - -constant_declaration: - T_STRING '=' static_scalar { $$ = Node\Const_[$1, $3]; } -; - -inner_statement_list: - inner_statement_list inner_statement { pushNormalizing($1, $2); } - | /* empty */ { init(); } -; - -inner_statement: - statement { $$ = $1; } - | function_declaration_statement { $$ = $1; } - | class_declaration_statement { $$ = $1; } - | T_HALT_COMPILER - { throw new Error('__HALT_COMPILER() can only be used from the outermost scope', attributes()); } -; - -statement: - '{' inner_statement_list '}' { $$ = $2; } - | T_IF parentheses_expr statement elseif_list else_single - { $$ = Stmt\If_[$2, [stmts: toArray($3), elseifs: $4, else: $5]]; } - | T_IF parentheses_expr ':' inner_statement_list new_elseif_list new_else_single T_ENDIF ';' - { $$ = Stmt\If_[$2, [stmts: $4, elseifs: $5, else: $6]]; } - | T_WHILE parentheses_expr while_statement { $$ = Stmt\While_[$2, $3]; } - | T_DO statement T_WHILE parentheses_expr ';' { $$ = Stmt\Do_ [$4, toArray($2)]; } - | T_FOR '(' for_expr ';' for_expr ';' for_expr ')' for_statement - { $$ = Stmt\For_[[init: $3, cond: $5, loop: $7, stmts: $9]]; } - | T_SWITCH parentheses_expr switch_case_list { $$ = Stmt\Switch_[$2, $3]; } - | T_BREAK ';' { $$ = Stmt\Break_[null]; } - | T_BREAK expr ';' { $$ = Stmt\Break_[$2]; } - | T_CONTINUE ';' { $$ = Stmt\Continue_[null]; } - | T_CONTINUE expr ';' { $$ = Stmt\Continue_[$2]; } - | T_RETURN ';' { $$ = Stmt\Return_[null]; } - | T_RETURN expr ';' { $$ = Stmt\Return_[$2]; } - | yield_expr ';' { $$ = $1; } - | T_GLOBAL global_var_list ';' { $$ = Stmt\Global_[$2]; } - | T_STATIC static_var_list ';' { $$ = Stmt\Static_[$2]; } - | T_ECHO expr_list ';' { $$ = Stmt\Echo_[$2]; } - | T_INLINE_HTML { $$ = Stmt\InlineHTML[$1]; } - | expr ';' { $$ = $1; } - | T_UNSET '(' variables_list ')' ';' { $$ = Stmt\Unset_[$3]; } - | T_FOREACH '(' expr T_AS foreach_variable ')' foreach_statement - { $$ = Stmt\Foreach_[$3, $5[0], [keyVar: null, byRef: $5[1], stmts: $7]]; } - | T_FOREACH '(' expr T_AS variable T_DOUBLE_ARROW foreach_variable ')' foreach_statement - { $$ = Stmt\Foreach_[$3, $7[0], [keyVar: $5, byRef: $7[1], stmts: $9]]; } - | T_DECLARE '(' declare_list ')' declare_statement { $$ = Stmt\Declare_[$3, $5]; } - | ';' { $$ = array(); /* means: no statement */ } - | T_TRY '{' inner_statement_list '}' catches optional_finally - { $$ = Stmt\TryCatch[$3, $5, $6]; } - | T_THROW expr ';' { $$ = Stmt\Throw_[$2]; } - | T_GOTO T_STRING ';' { $$ = Stmt\Goto_[$2]; } - | T_STRING ':' { $$ = Stmt\Label[$1]; } - | error { $$ = array(); /* means: no statement */ } -; - -catches: - /* empty */ { init(); } - | catches catch { push($1, $2); } -; - -catch: - T_CATCH '(' name T_VARIABLE ')' '{' inner_statement_list '}' - { $$ = Stmt\Catch_[$3, parseVar($4), $7]; } -; - -optional_finally: - /* empty */ { $$ = null; } - | T_FINALLY '{' inner_statement_list '}' { $$ = $3; } -; - -variables_list: - variable { init($1); } - | variables_list ',' variable { push($1, $3); } -; - -optional_ref: - /* empty */ { $$ = false; } - | '&' { $$ = true; } -; - -optional_ellipsis: - /* empty */ { $$ = false; } - | T_ELLIPSIS { $$ = true; } -; - -function_declaration_statement: - T_FUNCTION optional_ref T_STRING '(' parameter_list ')' optional_return_type '{' inner_statement_list '}' - { $$ = Stmt\Function_[$3, [byRef: $2, params: $5, returnType: $7, stmts: $9]]; } -; - -class_declaration_statement: - class_entry_type T_STRING extends_from implements_list '{' class_statement_list '}' - { $$ = Stmt\Class_[$2, [type: $1, extends: $3, implements: $4, stmts: $6]]; } - | T_INTERFACE T_STRING interface_extends_list '{' class_statement_list '}' - { $$ = Stmt\Interface_[$2, [extends: $3, stmts: $5]]; } - | T_TRAIT T_STRING '{' class_statement_list '}' - { $$ = Stmt\Trait_[$2, $4]; } -; - -class_entry_type: - T_CLASS { $$ = 0; } - | T_ABSTRACT T_CLASS { $$ = Stmt\Class_::MODIFIER_ABSTRACT; } - | T_FINAL T_CLASS { $$ = Stmt\Class_::MODIFIER_FINAL; } -; - -extends_from: - /* empty */ { $$ = null; } - | T_EXTENDS name { $$ = $2; } -; - -interface_extends_list: - /* empty */ { $$ = array(); } - | T_EXTENDS name_list { $$ = $2; } -; - -implements_list: - /* empty */ { $$ = array(); } - | T_IMPLEMENTS name_list { $$ = $2; } -; - -name_list: - name { init($1); } - | name_list ',' name { push($1, $3); } -; - -for_statement: - statement { $$ = toArray($1); } - | ':' inner_statement_list T_ENDFOR ';' { $$ = $2; } -; - -foreach_statement: - statement { $$ = toArray($1); } - | ':' inner_statement_list T_ENDFOREACH ';' { $$ = $2; } -; - -declare_statement: - statement { $$ = toArray($1); } - | ':' inner_statement_list T_ENDDECLARE ';' { $$ = $2; } -; - -declare_list: - declare_list_element { init($1); } - | declare_list ',' declare_list_element { push($1, $3); } -; - -declare_list_element: - T_STRING '=' static_scalar { $$ = Stmt\DeclareDeclare[$1, $3]; } -; - -switch_case_list: - '{' case_list '}' { $$ = $2; } - | '{' ';' case_list '}' { $$ = $3; } - | ':' case_list T_ENDSWITCH ';' { $$ = $2; } - | ':' ';' case_list T_ENDSWITCH ';' { $$ = $3; } -; - -case_list: - /* empty */ { init(); } - | case_list case { push($1, $2); } -; - -case: - T_CASE expr case_separator inner_statement_list { $$ = Stmt\Case_[$2, $4]; } - | T_DEFAULT case_separator inner_statement_list { $$ = Stmt\Case_[null, $3]; } -; - -case_separator: - ':' - | ';' -; - -while_statement: - statement { $$ = toArray($1); } - | ':' inner_statement_list T_ENDWHILE ';' { $$ = $2; } -; - -elseif_list: - /* empty */ { init(); } - | elseif_list elseif { push($1, $2); } -; - -elseif: - T_ELSEIF parentheses_expr statement { $$ = Stmt\ElseIf_[$2, toArray($3)]; } -; - -new_elseif_list: - /* empty */ { init(); } - | new_elseif_list new_elseif { push($1, $2); } -; - -new_elseif: - T_ELSEIF parentheses_expr ':' inner_statement_list { $$ = Stmt\ElseIf_[$2, $4]; } -; - -else_single: - /* empty */ { $$ = null; } - | T_ELSE statement { $$ = Stmt\Else_[toArray($2)]; } -; - -new_else_single: - /* empty */ { $$ = null; } - | T_ELSE ':' inner_statement_list { $$ = Stmt\Else_[$3]; } -; - -foreach_variable: - variable { $$ = array($1, false); } - | '&' variable { $$ = array($2, true); } - | list_expr { $$ = array($1, false); } -; - -parameter_list: - non_empty_parameter_list { $$ = $1; } - | /* empty */ { $$ = array(); } -; - -non_empty_parameter_list: - parameter { init($1); } - | non_empty_parameter_list ',' parameter { push($1, $3); } -; - -parameter: - optional_param_type optional_ref optional_ellipsis T_VARIABLE - { $$ = Node\Param[parseVar($4), null, $1, $2, $3]; } - | optional_param_type optional_ref optional_ellipsis T_VARIABLE '=' static_scalar - { $$ = Node\Param[parseVar($4), $6, $1, $2, $3]; } -; - -type: - name { $$ = $1; } - | T_ARRAY { $$ = 'array'; } - | T_CALLABLE { $$ = 'callable'; } -; - -optional_param_type: - /* empty */ { $$ = null; } - | type { $$ = $1; } -; - -optional_return_type: - /* empty */ { $$ = null; } - | ':' type { $$ = $2; } -; - -argument_list: - '(' ')' { $$ = array(); } - | '(' non_empty_argument_list ')' { $$ = $2; } - | '(' yield_expr ')' { $$ = array(Node\Arg[$2, false, false]); } -; - -non_empty_argument_list: - argument { init($1); } - | non_empty_argument_list ',' argument { push($1, $3); } -; - -argument: - expr { $$ = Node\Arg[$1, false, false]; } - | '&' variable { $$ = Node\Arg[$2, true, false]; } - | T_ELLIPSIS expr { $$ = Node\Arg[$2, false, true]; } -; - -global_var_list: - global_var_list ',' global_var { push($1, $3); } - | global_var { init($1); } -; - -global_var: - T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } - | '$' variable { $$ = Expr\Variable[$2]; } - | '$' '{' expr '}' { $$ = Expr\Variable[$3]; } -; - -static_var_list: - static_var_list ',' static_var { push($1, $3); } - | static_var { init($1); } -; - -static_var: - T_VARIABLE { $$ = Stmt\StaticVar[parseVar($1), null]; } - | T_VARIABLE '=' static_scalar { $$ = Stmt\StaticVar[parseVar($1), $3]; } -; - -class_statement_list: - class_statement_list class_statement { push($1, $2); } - | /* empty */ { init(); } -; - -class_statement: - variable_modifiers property_declaration_list ';' { $$ = Stmt\Property[$1, $2]; } - | T_CONST constant_declaration_list ';' { $$ = Stmt\ClassConst[$2]; } - | method_modifiers T_FUNCTION optional_ref T_STRING '(' parameter_list ')' optional_return_type method_body - { $$ = Stmt\ClassMethod[$4, [type: $1, byRef: $3, params: $6, returnType: $8, stmts: $9]]; } - | T_USE name_list trait_adaptations { $$ = Stmt\TraitUse[$2, $3]; } -; - -trait_adaptations: - ';' { $$ = array(); } - | '{' trait_adaptation_list '}' { $$ = $2; } -; - -trait_adaptation_list: - /* empty */ { init(); } - | trait_adaptation_list trait_adaptation { push($1, $2); } -; - -trait_adaptation: - trait_method_reference_fully_qualified T_INSTEADOF name_list ';' - { $$ = Stmt\TraitUseAdaptation\Precedence[$1[0], $1[1], $3]; } - | trait_method_reference T_AS member_modifier T_STRING ';' - { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], $3, $4]; } - | trait_method_reference T_AS member_modifier ';' - { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], $3, null]; } - | trait_method_reference T_AS T_STRING ';' - { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], null, $3]; } -; - -trait_method_reference_fully_qualified: - name T_PAAMAYIM_NEKUDOTAYIM T_STRING { $$ = array($1, $3); } -; -trait_method_reference: - trait_method_reference_fully_qualified { $$ = $1; } - | T_STRING { $$ = array(null, $1); } -; - -method_body: - ';' /* abstract method */ { $$ = null; } - | '{' inner_statement_list '}' { $$ = $2; } -; - -variable_modifiers: - non_empty_member_modifiers { $$ = $1; } - | T_VAR { $$ = 0; } -; - -method_modifiers: - /* empty */ { $$ = 0; } - | non_empty_member_modifiers { $$ = $1; } -; - -non_empty_member_modifiers: - member_modifier { $$ = $1; } - | non_empty_member_modifiers member_modifier { Stmt\Class_::verifyModifier($1, $2); $$ = $1 | $2; } -; - -member_modifier: - T_PUBLIC { $$ = Stmt\Class_::MODIFIER_PUBLIC; } - | T_PROTECTED { $$ = Stmt\Class_::MODIFIER_PROTECTED; } - | T_PRIVATE { $$ = Stmt\Class_::MODIFIER_PRIVATE; } - | T_STATIC { $$ = Stmt\Class_::MODIFIER_STATIC; } - | T_ABSTRACT { $$ = Stmt\Class_::MODIFIER_ABSTRACT; } - | T_FINAL { $$ = Stmt\Class_::MODIFIER_FINAL; } -; - -property_declaration_list: - property_declaration { init($1); } - | property_declaration_list ',' property_declaration { push($1, $3); } -; - -property_declaration: - T_VARIABLE { $$ = Stmt\PropertyProperty[parseVar($1), null]; } - | T_VARIABLE '=' static_scalar { $$ = Stmt\PropertyProperty[parseVar($1), $3]; } -; - -expr_list: - expr_list ',' expr { push($1, $3); } - | expr { init($1); } -; - -for_expr: - /* empty */ { $$ = array(); } - | expr_list { $$ = $1; } -; - -expr: - variable { $$ = $1; } - | list_expr '=' expr { $$ = Expr\Assign[$1, $3]; } - | variable '=' expr { $$ = Expr\Assign[$1, $3]; } - | variable '=' '&' variable { $$ = Expr\AssignRef[$1, $4]; } - | variable '=' '&' new_expr { $$ = Expr\AssignRef[$1, $4]; } - | new_expr { $$ = $1; } - | T_CLONE expr { $$ = Expr\Clone_[$2]; } - | variable T_PLUS_EQUAL expr { $$ = Expr\AssignOp\Plus [$1, $3]; } - | variable T_MINUS_EQUAL expr { $$ = Expr\AssignOp\Minus [$1, $3]; } - | variable T_MUL_EQUAL expr { $$ = Expr\AssignOp\Mul [$1, $3]; } - | variable T_DIV_EQUAL expr { $$ = Expr\AssignOp\Div [$1, $3]; } - | variable T_CONCAT_EQUAL expr { $$ = Expr\AssignOp\Concat [$1, $3]; } - | variable T_MOD_EQUAL expr { $$ = Expr\AssignOp\Mod [$1, $3]; } - | variable T_AND_EQUAL expr { $$ = Expr\AssignOp\BitwiseAnd[$1, $3]; } - | variable T_OR_EQUAL expr { $$ = Expr\AssignOp\BitwiseOr [$1, $3]; } - | variable T_XOR_EQUAL expr { $$ = Expr\AssignOp\BitwiseXor[$1, $3]; } - | variable T_SL_EQUAL expr { $$ = Expr\AssignOp\ShiftLeft [$1, $3]; } - | variable T_SR_EQUAL expr { $$ = Expr\AssignOp\ShiftRight[$1, $3]; } - | variable T_POW_EQUAL expr { $$ = Expr\AssignOp\Pow [$1, $3]; } - | variable T_INC { $$ = Expr\PostInc[$1]; } - | T_INC variable { $$ = Expr\PreInc [$2]; } - | variable T_DEC { $$ = Expr\PostDec[$1]; } - | T_DEC variable { $$ = Expr\PreDec [$2]; } - | expr T_BOOLEAN_OR expr { $$ = Expr\BinaryOp\BooleanOr [$1, $3]; } - | expr T_BOOLEAN_AND expr { $$ = Expr\BinaryOp\BooleanAnd[$1, $3]; } - | expr T_LOGICAL_OR expr { $$ = Expr\BinaryOp\LogicalOr [$1, $3]; } - | expr T_LOGICAL_AND expr { $$ = Expr\BinaryOp\LogicalAnd[$1, $3]; } - | expr T_LOGICAL_XOR expr { $$ = Expr\BinaryOp\LogicalXor[$1, $3]; } - | expr '|' expr { $$ = Expr\BinaryOp\BitwiseOr [$1, $3]; } - | expr '&' expr { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; } - | expr '^' expr { $$ = Expr\BinaryOp\BitwiseXor[$1, $3]; } - | expr '.' expr { $$ = Expr\BinaryOp\Concat [$1, $3]; } - | expr '+' expr { $$ = Expr\BinaryOp\Plus [$1, $3]; } - | expr '-' expr { $$ = Expr\BinaryOp\Minus [$1, $3]; } - | expr '*' expr { $$ = Expr\BinaryOp\Mul [$1, $3]; } - | expr '/' expr { $$ = Expr\BinaryOp\Div [$1, $3]; } - | expr '%' expr { $$ = Expr\BinaryOp\Mod [$1, $3]; } - | expr T_SL expr { $$ = Expr\BinaryOp\ShiftLeft [$1, $3]; } - | expr T_SR expr { $$ = Expr\BinaryOp\ShiftRight[$1, $3]; } - | expr T_POW expr { $$ = Expr\BinaryOp\Pow [$1, $3]; } - | '+' expr %prec T_INC { $$ = Expr\UnaryPlus [$2]; } - | '-' expr %prec T_INC { $$ = Expr\UnaryMinus[$2]; } - | '!' expr { $$ = Expr\BooleanNot[$2]; } - | '~' expr { $$ = Expr\BitwiseNot[$2]; } - | expr T_IS_IDENTICAL expr { $$ = Expr\BinaryOp\Identical [$1, $3]; } - | expr T_IS_NOT_IDENTICAL expr { $$ = Expr\BinaryOp\NotIdentical [$1, $3]; } - | expr T_IS_EQUAL expr { $$ = Expr\BinaryOp\Equal [$1, $3]; } - | expr T_IS_NOT_EQUAL expr { $$ = Expr\BinaryOp\NotEqual [$1, $3]; } - | expr T_SPACESHIP expr { $$ = Expr\BinaryOp\Spaceship [$1, $3]; } - | expr '<' expr { $$ = Expr\BinaryOp\Smaller [$1, $3]; } - | expr T_IS_SMALLER_OR_EQUAL expr { $$ = Expr\BinaryOp\SmallerOrEqual[$1, $3]; } - | expr '>' expr { $$ = Expr\BinaryOp\Greater [$1, $3]; } - | expr T_IS_GREATER_OR_EQUAL expr { $$ = Expr\BinaryOp\GreaterOrEqual[$1, $3]; } - | expr T_INSTANCEOF class_name_reference { $$ = Expr\Instanceof_[$1, $3]; } - | parentheses_expr { $$ = $1; } - /* we need a separate '(' new_expr ')' rule to avoid problems caused by a s/r conflict */ - | '(' new_expr ')' { $$ = $2; } - | expr '?' expr ':' expr { $$ = Expr\Ternary[$1, $3, $5]; } - | expr '?' ':' expr { $$ = Expr\Ternary[$1, null, $4]; } - | expr T_COALESCE expr { $$ = Expr\BinaryOp\Coalesce[$1, $3]; } - | T_ISSET '(' variables_list ')' { $$ = Expr\Isset_[$3]; } - | T_EMPTY '(' expr ')' { $$ = Expr\Empty_[$3]; } - | T_INCLUDE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_INCLUDE]; } - | T_INCLUDE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_INCLUDE_ONCE]; } - | T_EVAL parentheses_expr { $$ = Expr\Eval_[$2]; } - | T_REQUIRE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE]; } - | T_REQUIRE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE_ONCE]; } - | T_INT_CAST expr { $$ = Expr\Cast\Int_ [$2]; } - | T_DOUBLE_CAST expr { $$ = Expr\Cast\Double [$2]; } - | T_STRING_CAST expr { $$ = Expr\Cast\String_ [$2]; } - | T_ARRAY_CAST expr { $$ = Expr\Cast\Array_ [$2]; } - | T_OBJECT_CAST expr { $$ = Expr\Cast\Object_ [$2]; } - | T_BOOL_CAST expr { $$ = Expr\Cast\Bool_ [$2]; } - | T_UNSET_CAST expr { $$ = Expr\Cast\Unset_ [$2]; } - | T_EXIT exit_expr { $$ = Expr\Exit_ [$2]; } - | '@' expr { $$ = Expr\ErrorSuppress[$2]; } - | scalar { $$ = $1; } - | array_expr { $$ = $1; } - | scalar_dereference { $$ = $1; } - | '`' backticks_expr '`' { $$ = Expr\ShellExec[$2]; } - | T_PRINT expr { $$ = Expr\Print_[$2]; } - | T_YIELD { $$ = Expr\Yield_[null, null]; } - | T_YIELD_FROM expr { $$ = Expr\YieldFrom[$2]; } - | T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars optional_return_type - '{' inner_statement_list '}' - { $$ = Expr\Closure[[static: false, byRef: $2, params: $4, uses: $6, returnType: $7, stmts: $9]]; } - | T_STATIC T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars optional_return_type - '{' inner_statement_list '}' - { $$ = Expr\Closure[[static: true, byRef: $3, params: $5, uses: $7, returnType: $8, stmts: $10]]; } -; - -parentheses_expr: - '(' expr ')' { $$ = $2; } - | '(' yield_expr ')' { $$ = $2; } -; - -yield_expr: - T_YIELD expr { $$ = Expr\Yield_[$2, null]; } - | T_YIELD expr T_DOUBLE_ARROW expr { $$ = Expr\Yield_[$4, $2]; } -; - -array_expr: - T_ARRAY '(' array_pair_list ')' { $$ = Expr\Array_[$3]; } - | '[' array_pair_list ']' { $$ = Expr\Array_[$2]; } -; - -scalar_dereference: - array_expr '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } - | T_CONSTANT_ENCAPSED_STRING '[' dim_offset ']' - { $$ = Expr\ArrayDimFetch[Scalar\String_[Scalar\String_::parse($1)], $3]; } - | constant '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } - | scalar_dereference '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } - /* alternative array syntax missing intentionally */ -; - -anonymous_class: - T_CLASS ctor_arguments extends_from implements_list '{' class_statement_list '}' - { $$ = array(Stmt\Class_[null, [type: 0, extends: $3, implements: $4, stmts: $6]], $2); } - -new_expr: - T_NEW class_name_reference ctor_arguments { $$ = Expr\New_[$2, $3]; } - | T_NEW anonymous_class - { list($class, $ctorArgs) = $2; $$ = Expr\New_[$class, $ctorArgs]; } -; - -lexical_vars: - /* empty */ { $$ = array(); } - | T_USE '(' lexical_var_list ')' { $$ = $3; } -; - -lexical_var_list: - lexical_var { init($1); } - | lexical_var_list ',' lexical_var { push($1, $3); } -; - -lexical_var: - optional_ref T_VARIABLE { $$ = Expr\ClosureUse[parseVar($2), $1]; } -; - -function_call: - name argument_list { $$ = Expr\FuncCall[$1, $2]; } - | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM T_STRING argument_list - { $$ = Expr\StaticCall[$1, $3, $4]; } - | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '{' expr '}' argument_list - { $$ = Expr\StaticCall[$1, $4, $6]; } - | static_property argument_list { - if ($1 instanceof Node\Expr\StaticPropertyFetch) { - $$ = Expr\StaticCall[$1->class, Expr\Variable[$1->name], $2]; - } elseif ($1 instanceof Node\Expr\ArrayDimFetch) { - $tmp = $1; - while ($tmp->var instanceof Node\Expr\ArrayDimFetch) { - $tmp = $tmp->var; - } - - $$ = Expr\StaticCall[$tmp->var->class, $1, $2]; - $tmp->var = Expr\Variable[$tmp->var->name]; - } else { - throw new \Exception; - } - } - | variable_without_objects argument_list - { $$ = Expr\FuncCall[$1, $2]; } - | function_call '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } - /* alternative array syntax missing intentionally */ -; - -class_name: - T_STATIC { $$ = Name[$1]; } - | name { $$ = $1; } -; - -name: - namespace_name_parts { $$ = Name[$1]; } - | T_NS_SEPARATOR namespace_name_parts { $$ = Name\FullyQualified[$2]; } - | T_NAMESPACE T_NS_SEPARATOR namespace_name_parts { $$ = Name\Relative[$3]; } -; - -class_name_reference: - class_name { $$ = $1; } - | dynamic_class_name_reference { $$ = $1; } -; - -dynamic_class_name_reference: - object_access_for_dcnr { $$ = $1; } - | base_variable { $$ = $1; } -; - -class_name_or_var: - class_name { $$ = $1; } - | reference_variable { $$ = $1; } -; - -object_access_for_dcnr: - base_variable T_OBJECT_OPERATOR object_property - { $$ = Expr\PropertyFetch[$1, $3]; } - | object_access_for_dcnr T_OBJECT_OPERATOR object_property - { $$ = Expr\PropertyFetch[$1, $3]; } - | object_access_for_dcnr '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } - | object_access_for_dcnr '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } -; - -exit_expr: - /* empty */ { $$ = null; } - | '(' ')' { $$ = null; } - | parentheses_expr { $$ = $1; } -; - -backticks_expr: - /* empty */ { $$ = array(); } - | T_ENCAPSED_AND_WHITESPACE { $$ = array(Scalar\String_::parseEscapeSequences($1, '`')); } - | encaps_list { parseEncapsed($1, '`'); $$ = $1; } -; - -ctor_arguments: - /* empty */ { $$ = array(); } - | argument_list { $$ = $1; } -; - -common_scalar: - T_LNUMBER { $$ = Scalar\LNumber[Scalar\LNumber::parse($1)]; } - | T_DNUMBER { $$ = Scalar\DNumber[Scalar\DNumber::parse($1)]; } - | T_CONSTANT_ENCAPSED_STRING { $$ = Scalar\String_[Scalar\String_::parse($1)]; } - | T_LINE { $$ = Scalar\MagicConst\Line[]; } - | T_FILE { $$ = Scalar\MagicConst\File[]; } - | T_DIR { $$ = Scalar\MagicConst\Dir[]; } - | T_CLASS_C { $$ = Scalar\MagicConst\Class_[]; } - | T_TRAIT_C { $$ = Scalar\MagicConst\Trait_[]; } - | T_METHOD_C { $$ = Scalar\MagicConst\Method[]; } - | T_FUNC_C { $$ = Scalar\MagicConst\Function_[]; } - | T_NS_C { $$ = Scalar\MagicConst\Namespace_[]; } - | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC - { $$ = Scalar\String_[Scalar\String_::parseDocString($1, $2)]; } - | T_START_HEREDOC T_END_HEREDOC - { $$ = Scalar\String_['']; } -; - -static_scalar: - common_scalar { $$ = $1; } - | class_name T_PAAMAYIM_NEKUDOTAYIM class_const_name { $$ = Expr\ClassConstFetch[$1, $3]; } - | name { $$ = Expr\ConstFetch[$1]; } - | T_ARRAY '(' static_array_pair_list ')' { $$ = Expr\Array_[$3]; } - | '[' static_array_pair_list ']' { $$ = Expr\Array_[$2]; } - | static_operation { $$ = $1; } -; - -static_operation: - static_scalar T_BOOLEAN_OR static_scalar { $$ = Expr\BinaryOp\BooleanOr [$1, $3]; } - | static_scalar T_BOOLEAN_AND static_scalar { $$ = Expr\BinaryOp\BooleanAnd[$1, $3]; } - | static_scalar T_LOGICAL_OR static_scalar { $$ = Expr\BinaryOp\LogicalOr [$1, $3]; } - | static_scalar T_LOGICAL_AND static_scalar { $$ = Expr\BinaryOp\LogicalAnd[$1, $3]; } - | static_scalar T_LOGICAL_XOR static_scalar { $$ = Expr\BinaryOp\LogicalXor[$1, $3]; } - | static_scalar '|' static_scalar { $$ = Expr\BinaryOp\BitwiseOr [$1, $3]; } - | static_scalar '&' static_scalar { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; } - | static_scalar '^' static_scalar { $$ = Expr\BinaryOp\BitwiseXor[$1, $3]; } - | static_scalar '.' static_scalar { $$ = Expr\BinaryOp\Concat [$1, $3]; } - | static_scalar '+' static_scalar { $$ = Expr\BinaryOp\Plus [$1, $3]; } - | static_scalar '-' static_scalar { $$ = Expr\BinaryOp\Minus [$1, $3]; } - | static_scalar '*' static_scalar { $$ = Expr\BinaryOp\Mul [$1, $3]; } - | static_scalar '/' static_scalar { $$ = Expr\BinaryOp\Div [$1, $3]; } - | static_scalar '%' static_scalar { $$ = Expr\BinaryOp\Mod [$1, $3]; } - | static_scalar T_SL static_scalar { $$ = Expr\BinaryOp\ShiftLeft [$1, $3]; } - | static_scalar T_SR static_scalar { $$ = Expr\BinaryOp\ShiftRight[$1, $3]; } - | static_scalar T_POW static_scalar { $$ = Expr\BinaryOp\Pow [$1, $3]; } - | '+' static_scalar %prec T_INC { $$ = Expr\UnaryPlus [$2]; } - | '-' static_scalar %prec T_INC { $$ = Expr\UnaryMinus[$2]; } - | '!' static_scalar { $$ = Expr\BooleanNot[$2]; } - | '~' static_scalar { $$ = Expr\BitwiseNot[$2]; } - | static_scalar T_IS_IDENTICAL static_scalar { $$ = Expr\BinaryOp\Identical [$1, $3]; } - | static_scalar T_IS_NOT_IDENTICAL static_scalar { $$ = Expr\BinaryOp\NotIdentical [$1, $3]; } - | static_scalar T_IS_EQUAL static_scalar { $$ = Expr\BinaryOp\Equal [$1, $3]; } - | static_scalar T_IS_NOT_EQUAL static_scalar { $$ = Expr\BinaryOp\NotEqual [$1, $3]; } - | static_scalar '<' static_scalar { $$ = Expr\BinaryOp\Smaller [$1, $3]; } - | static_scalar T_IS_SMALLER_OR_EQUAL static_scalar { $$ = Expr\BinaryOp\SmallerOrEqual[$1, $3]; } - | static_scalar '>' static_scalar { $$ = Expr\BinaryOp\Greater [$1, $3]; } - | static_scalar T_IS_GREATER_OR_EQUAL static_scalar { $$ = Expr\BinaryOp\GreaterOrEqual[$1, $3]; } - | static_scalar '?' static_scalar ':' static_scalar { $$ = Expr\Ternary[$1, $3, $5]; } - | static_scalar '?' ':' static_scalar { $$ = Expr\Ternary[$1, null, $4]; } - | static_scalar '[' static_scalar ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } - | '(' static_scalar ')' { $$ = $2; } -; - -constant: - name { $$ = Expr\ConstFetch[$1]; } - | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM class_const_name - { $$ = Expr\ClassConstFetch[$1, $3]; } -; - -scalar: - common_scalar { $$ = $1; } - | constant { $$ = $1; } - | '"' encaps_list '"' - { parseEncapsed($2, '"'); $$ = Scalar\Encapsed[$2]; } - | T_START_HEREDOC encaps_list T_END_HEREDOC - { parseEncapsedDoc($2); $$ = Scalar\Encapsed[$2]; } -; - -class_const_name: - T_STRING { $$ = $1; } - | T_CLASS { $$ = 'class'; } -; - -static_array_pair_list: - /* empty */ { $$ = array(); } - | non_empty_static_array_pair_list optional_comma { $$ = $1; } -; - -optional_comma: - /* empty */ - | ',' -; - -non_empty_static_array_pair_list: - non_empty_static_array_pair_list ',' static_array_pair { push($1, $3); } - | static_array_pair { init($1); } -; - -static_array_pair: - static_scalar T_DOUBLE_ARROW static_scalar { $$ = Expr\ArrayItem[$3, $1, false]; } - | static_scalar { $$ = Expr\ArrayItem[$1, null, false]; } -; - -variable: - object_access { $$ = $1; } - | base_variable { $$ = $1; } - | function_call { $$ = $1; } - | new_expr_array_deref { $$ = $1; } -; - -new_expr_array_deref: - '(' new_expr ')' '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$2, $5]; } - | new_expr_array_deref '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } - /* alternative array syntax missing intentionally */ -; - -object_access: - variable_or_new_expr T_OBJECT_OPERATOR object_property - { $$ = Expr\PropertyFetch[$1, $3]; } - | variable_or_new_expr T_OBJECT_OPERATOR object_property argument_list - { $$ = Expr\MethodCall[$1, $3, $4]; } - | object_access argument_list { $$ = Expr\FuncCall[$1, $2]; } - | object_access '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } - | object_access '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } -; - -variable_or_new_expr: - variable { $$ = $1; } - | '(' new_expr ')' { $$ = $2; } -; - -variable_without_objects: - reference_variable { $$ = $1; } - | '$' variable_without_objects { $$ = Expr\Variable[$2]; } -; - -base_variable: - variable_without_objects { $$ = $1; } - | static_property { $$ = $1; } -; - -static_property: - class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '$' reference_variable - { $$ = Expr\StaticPropertyFetch[$1, $4]; } - | static_property_with_arrays { $$ = $1; } -; - -static_property_with_arrays: - class_name_or_var T_PAAMAYIM_NEKUDOTAYIM T_VARIABLE - { $$ = Expr\StaticPropertyFetch[$1, parseVar($3)]; } - | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '$' '{' expr '}' - { $$ = Expr\StaticPropertyFetch[$1, $5]; } - | static_property_with_arrays '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } - | static_property_with_arrays '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } -; - -reference_variable: - reference_variable '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } - | reference_variable '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } - | T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } - | '$' '{' expr '}' { $$ = Expr\Variable[$3]; } -; - -dim_offset: - /* empty */ { $$ = null; } - | expr { $$ = $1; } -; - -object_property: - T_STRING { $$ = $1; } - | '{' expr '}' { $$ = $2; } - | variable_without_objects { $$ = $1; } -; - -list_expr: - T_LIST '(' list_expr_elements ')' { $$ = Expr\List_[$3]; } -; - -list_expr_elements: - list_expr_elements ',' list_expr_element { push($1, $3); } - | list_expr_element { init($1); } -; - -list_expr_element: - variable { $$ = $1; } - | list_expr { $$ = $1; } - | /* empty */ { $$ = null; } -; - -array_pair_list: - /* empty */ { $$ = array(); } - | non_empty_array_pair_list optional_comma { $$ = $1; } -; - -non_empty_array_pair_list: - non_empty_array_pair_list ',' array_pair { push($1, $3); } - | array_pair { init($1); } -; - -array_pair: - expr T_DOUBLE_ARROW expr { $$ = Expr\ArrayItem[$3, $1, false]; } - | expr { $$ = Expr\ArrayItem[$1, null, false]; } - | expr T_DOUBLE_ARROW '&' variable { $$ = Expr\ArrayItem[$4, $1, true]; } - | '&' variable { $$ = Expr\ArrayItem[$2, null, true]; } -; - -encaps_list: - encaps_list encaps_var { push($1, $2); } - | encaps_list T_ENCAPSED_AND_WHITESPACE { push($1, $2); } - | encaps_var { init($1); } - | T_ENCAPSED_AND_WHITESPACE encaps_var { init($1, $2); } -; - -encaps_var: - T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } - | T_VARIABLE '[' encaps_var_offset ']' { $$ = Expr\ArrayDimFetch[Expr\Variable[parseVar($1)], $3]; } - | T_VARIABLE T_OBJECT_OPERATOR T_STRING { $$ = Expr\PropertyFetch[Expr\Variable[parseVar($1)], $3]; } - | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { $$ = Expr\Variable[$2]; } - | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' { $$ = Expr\Variable[$2]; } - | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' - { $$ = Expr\ArrayDimFetch[Expr\Variable[$2], $4]; } - | T_CURLY_OPEN variable '}' { $$ = $2; } -; - -encaps_var_offset: - T_STRING { $$ = Scalar\String_[$1]; } - | T_NUM_STRING { $$ = Scalar\String_[$1]; } - | T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } -; - -%% diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Autoloader.php b/application/vendor/nikic/php-parser/lib/PhpParser/Autoloader.php index 7cf6417..809a06e 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Autoloader.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Autoloader.php @@ -10,9 +10,6 @@ class Autoloader /** @var bool Whether the autoloader has been registered. */ private static $registered = false; - /** @var bool Whether we're running on PHP 7. */ - private static $runningOnPhp7; - /** * Registers PhpParser\Autoloader as an SPL autoloader. * @@ -25,7 +22,6 @@ static public function register($prepend = false) { spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend); self::$registered = true; - self::$runningOnPhp7 = version_compare(PHP_VERSION, '7.0-dev', '>='); } /** @@ -35,241 +31,10 @@ static public function register($prepend = false) { */ static public function autoload($class) { if (0 === strpos($class, 'PhpParser\\')) { - if (isset(self::$php7AliasesOldToNew[$class])) { - if (self::$runningOnPhp7) { - return; - } - - // Load the new class, alias will be registered afterwards - $class = self::$php7AliasesOldToNew[$class]; - } - - $fileName = dirname(__DIR__) . '/' . strtr($class, '\\', '/') . '.php'; + $fileName = __DIR__ . strtr(substr($class, 9), '\\', '/') . '.php'; if (file_exists($fileName)) { require $fileName; } - - if (isset(self::$php7AliasesNewToOld[$class])) { - // New class name was used, register alias for old one, otherwise - // it won't be usable in "instanceof" and other non-autoloading places. - if (!self::$runningOnPhp7) { - class_alias($class, self::$php7AliasesNewToOld[$class]); - } - } - } else if (0 === strpos($class, 'PHPParser_')) { - if (isset(self::$nonNamespacedAliases[$class])) { - // Register all aliases at once to avoid dependency issues - self::registerNonNamespacedAliases(); - } - } - } - - private static function registerNonNamespacedAliases() { - foreach (self::$nonNamespacedAliases as $old => $new) { - class_alias($new, $old); } } - - private static $php7AliasesOldToNew = array( - 'PhpParser\Node\Expr\Cast\Bool' => 'PhpParser\Node\Expr\Cast\Bool_', - 'PhpParser\Node\Expr\Cast\Int' => 'PhpParser\Node\Expr\Cast\Int_', - 'PhpParser\Node\Expr\Cast\Object' => 'PhpParser\Node\Expr\Cast\Object_', - 'PhpParser\Node\Expr\Cast\String' => 'PhpParser\Node\Expr\Cast\String_', - 'PhpParser\Node\Scalar\String' => 'PhpParser\Node\Scalar\String_', - ); - - private static $php7AliasesNewToOld = array( - 'PhpParser\Node\Expr\Cast\Bool_' => 'PhpParser\Node\Expr\Cast\Bool', - 'PhpParser\Node\Expr\Cast\Int_' => 'PhpParser\Node\Expr\Cast\Int', - 'PhpParser\Node\Expr\Cast\Object_' => 'PhpParser\Node\Expr\Cast\Object', - 'PhpParser\Node\Expr\Cast\String_' => 'PhpParser\Node\Expr\Cast\String', - 'PhpParser\Node\Scalar\String_' => 'PhpParser\Node\Scalar\String', - ); - - private static $nonNamespacedAliases = array( - 'PHPParser_Builder' => 'PhpParser\Builder', - 'PHPParser_BuilderAbstract' => 'PhpParser\BuilderAbstract', - 'PHPParser_BuilderFactory' => 'PhpParser\BuilderFactory', - 'PHPParser_Comment' => 'PhpParser\Comment', - 'PHPParser_Comment_Doc' => 'PhpParser\Comment\Doc', - 'PHPParser_Error' => 'PhpParser\Error', - 'PHPParser_Lexer' => 'PhpParser\Lexer', - 'PHPParser_Lexer_Emulative' => 'PhpParser\Lexer\Emulative', - 'PHPParser_Node' => 'PhpParser\Node', - 'PHPParser_NodeAbstract' => 'PhpParser\NodeAbstract', - 'PHPParser_NodeDumper' => 'PhpParser\NodeDumper', - 'PHPParser_NodeTraverser' => 'PhpParser\NodeTraverser', - 'PHPParser_NodeTraverserInterface' => 'PhpParser\NodeTraverserInterface', - 'PHPParser_NodeVisitor' => 'PhpParser\NodeVisitor', - 'PHPParser_NodeVisitor_NameResolver' => 'PhpParser\NodeVisitor\NameResolver', - 'PHPParser_NodeVisitorAbstract' => 'PhpParser\NodeVisitorAbstract', - 'PHPParser_Parser' => 'PhpParser\Parser', - 'PHPParser_PrettyPrinterAbstract' => 'PhpParser\PrettyPrinterAbstract', - 'PHPParser_PrettyPrinter_Default' => 'PhpParser\PrettyPrinter\Standard', - 'PHPParser_PrettyPrinter_Zend' => 'PhpParser\PrettyPrinter\Standard', - 'PHPParser_Serializer' => 'PhpParser\Serializer', - 'PHPParser_Serializer_XML' => 'PhpParser\Serializer\XML', - 'PHPParser_Unserializer' => 'PhpParser\Unserializer', - 'PHPParser_Unserializer_XML' => 'PhpParser\Unserializer\XML', - - 'PHPParser_Builder_Class' => 'PhpParser\Builder\Class_', - 'PHPParser_Builder_Function' => 'PhpParser\Builder\Function_', - 'PHPParser_Builder_Interface' => 'PhpParser\Builder\Interface_', - 'PHPParser_Builder_Method' => 'PhpParser\Builder\Method', - 'PHPParser_Builder_Param' => 'PhpParser\Builder\Param', - 'PHPParser_Builder_Property' => 'PhpParser\Builder\Property', - - 'PHPParser_Node_Arg' => 'PhpParser\Node\Arg', - 'PHPParser_Node_Const' => 'PhpParser\Node\Const_', - 'PHPParser_Node_Expr' => 'PhpParser\Node\Expr', - 'PHPParser_Node_Name' => 'PhpParser\Node\Name', - 'PHPParser_Node_Name_FullyQualified' => 'PhpParser\Node\Name\FullyQualified', - 'PHPParser_Node_Name_Relative' => 'PhpParser\Node\Name\Relative', - 'PHPParser_Node_Param' => 'PhpParser\Node\Param', - 'PHPParser_Node_Scalar' => 'PhpParser\Node\Scalar', - 'PHPParser_Node_Stmt' => 'PhpParser\Node\Stmt', - - 'PHPParser_Node_Stmt_Break' => 'PhpParser\Node\Stmt\Break_', - 'PHPParser_Node_Stmt_Case' => 'PhpParser\Node\Stmt\Case_', - 'PHPParser_Node_Stmt_Catch' => 'PhpParser\Node\Stmt\Catch_', - 'PHPParser_Node_Stmt_Class' => 'PhpParser\Node\Stmt\Class_', - 'PHPParser_Node_Stmt_ClassConst' => 'PhpParser\Node\Stmt\ClassConst', - 'PHPParser_Node_Stmt_ClassMethod' => 'PhpParser\Node\Stmt\ClassMethod', - 'PHPParser_Node_Stmt_Const' => 'PhpParser\Node\Stmt\Const_', - 'PHPParser_Node_Stmt_Continue' => 'PhpParser\Node\Stmt\Continue_', - 'PHPParser_Node_Stmt_Declare' => 'PhpParser\Node\Stmt\Declare_', - 'PHPParser_Node_Stmt_DeclareDeclare' => 'PhpParser\Node\Stmt\DeclareDeclare', - 'PHPParser_Node_Stmt_Do' => 'PhpParser\Node\Stmt\Do_', - 'PHPParser_Node_Stmt_Echo' => 'PhpParser\Node\Stmt\Echo_', - 'PHPParser_Node_Stmt_Else' => 'PhpParser\Node\Stmt\Else_', - 'PHPParser_Node_Stmt_ElseIf' => 'PhpParser\Node\Stmt\ElseIf_', - 'PHPParser_Node_Stmt_For' => 'PhpParser\Node\Stmt\For_', - 'PHPParser_Node_Stmt_Foreach' => 'PhpParser\Node\Stmt\Foreach_', - 'PHPParser_Node_Stmt_Function' => 'PhpParser\Node\Stmt\Function_', - 'PHPParser_Node_Stmt_Global' => 'PhpParser\Node\Stmt\Global_', - 'PHPParser_Node_Stmt_Goto' => 'PhpParser\Node\Stmt\Goto_', - 'PHPParser_Node_Stmt_HaltCompiler' => 'PhpParser\Node\Stmt\HaltCompiler', - 'PHPParser_Node_Stmt_If' => 'PhpParser\Node\Stmt\If_', - 'PHPParser_Node_Stmt_InlineHTML' => 'PhpParser\Node\Stmt\InlineHTML', - 'PHPParser_Node_Stmt_Interface' => 'PhpParser\Node\Stmt\Interface_', - 'PHPParser_Node_Stmt_Label' => 'PhpParser\Node\Stmt\Label', - 'PHPParser_Node_Stmt_Namespace' => 'PhpParser\Node\Stmt\Namespace_', - 'PHPParser_Node_Stmt_Property' => 'PhpParser\Node\Stmt\Property', - 'PHPParser_Node_Stmt_PropertyProperty' => 'PhpParser\Node\Stmt\PropertyProperty', - 'PHPParser_Node_Stmt_Return' => 'PhpParser\Node\Stmt\Return_', - 'PHPParser_Node_Stmt_Static' => 'PhpParser\Node\Stmt\Static_', - 'PHPParser_Node_Stmt_StaticVar' => 'PhpParser\Node\Stmt\StaticVar', - 'PHPParser_Node_Stmt_Switch' => 'PhpParser\Node\Stmt\Switch_', - 'PHPParser_Node_Stmt_Throw' => 'PhpParser\Node\Stmt\Throw_', - 'PHPParser_Node_Stmt_Trait' => 'PhpParser\Node\Stmt\Trait_', - 'PHPParser_Node_Stmt_TraitUse' => 'PhpParser\Node\Stmt\TraitUse', - 'PHPParser_Node_Stmt_TraitUseAdaptation' => 'PhpParser\Node\Stmt\TraitUseAdaptation', - 'PHPParser_Node_Stmt_TraitUseAdaptation_Alias' => 'PhpParser\Node\Stmt\TraitUseAdaptation\Alias', - 'PHPParser_Node_Stmt_TraitUseAdaptation_Precedence' => 'PhpParser\Node\Stmt\TraitUseAdaptation\Precedence', - 'PHPParser_Node_Stmt_TryCatch' => 'PhpParser\Node\Stmt\TryCatch', - 'PHPParser_Node_Stmt_Unset' => 'PhpParser\Node\Stmt\Unset_', - 'PHPParser_Node_Stmt_UseUse' => 'PhpParser\Node\Stmt\UseUse', - 'PHPParser_Node_Stmt_Use' => 'PhpParser\Node\Stmt\Use_', - 'PHPParser_Node_Stmt_While' => 'PhpParser\Node\Stmt\While_', - - 'PHPParser_Node_Expr_AssignBitwiseAnd' => 'PhpParser\Node\Expr\AssignOp\BitwiseAnd', - 'PHPParser_Node_Expr_AssignBitwiseOr' => 'PhpParser\Node\Expr\AssignOp\BitwiseOr', - 'PHPParser_Node_Expr_AssignBitwiseXor' => 'PhpParser\Node\Expr\AssignOp\BitwiseXor', - 'PHPParser_Node_Expr_AssignConcat' => 'PhpParser\Node\Expr\AssignOp\Concat', - 'PHPParser_Node_Expr_AssignDiv' => 'PhpParser\Node\Expr\AssignOp\Div', - 'PHPParser_Node_Expr_AssignMinus' => 'PhpParser\Node\Expr\AssignOp\Minus', - 'PHPParser_Node_Expr_AssignMod' => 'PhpParser\Node\Expr\AssignOp\Mod', - 'PHPParser_Node_Expr_AssignMul' => 'PhpParser\Node\Expr\AssignOp\Mul', - 'PHPParser_Node_Expr_AssignPlus' => 'PhpParser\Node\Expr\AssignOp\Plus', - 'PHPParser_Node_Expr_AssignShiftLeft' => 'PhpParser\Node\Expr\AssignOp\ShiftLeft', - 'PHPParser_Node_Expr_AssignShiftRight' => 'PhpParser\Node\Expr\AssignOp\ShiftRight', - - 'PHPParser_Node_Expr_Cast' => 'PhpParser\Node\Expr\Cast', - 'PHPParser_Node_Expr_Cast_Array' => 'PhpParser\Node\Expr\Cast\Array_', - 'PHPParser_Node_Expr_Cast_Bool' => 'PhpParser\Node\Expr\Cast\Bool_', - 'PHPParser_Node_Expr_Cast_Double' => 'PhpParser\Node\Expr\Cast\Double', - 'PHPParser_Node_Expr_Cast_Int' => 'PhpParser\Node\Expr\Cast\Int_', - 'PHPParser_Node_Expr_Cast_Object' => 'PhpParser\Node\Expr\Cast\Object_', - 'PHPParser_Node_Expr_Cast_String' => 'PhpParser\Node\Expr\Cast\String_', - 'PHPParser_Node_Expr_Cast_Unset' => 'PhpParser\Node\Expr\Cast\Unset_', - - 'PHPParser_Node_Expr_BitwiseAnd' => 'PhpParser\Node\Expr\BinaryOp\BitwiseAnd', - 'PHPParser_Node_Expr_BitwiseOr' => 'PhpParser\Node\Expr\BinaryOp\BitwiseOr', - 'PHPParser_Node_Expr_BitwiseXor' => 'PhpParser\Node\Expr\BinaryOp\BitwiseXor', - 'PHPParser_Node_Expr_BooleanAnd' => 'PhpParser\Node\Expr\BinaryOp\BooleanAnd', - 'PHPParser_Node_Expr_BooleanOr' => 'PhpParser\Node\Expr\BinaryOp\BooleanOr', - 'PHPParser_Node_Expr_Concat' => 'PhpParser\Node\Expr\BinaryOp\Concat', - 'PHPParser_Node_Expr_Div' => 'PhpParser\Node\Expr\BinaryOp\Div', - 'PHPParser_Node_Expr_Equal' => 'PhpParser\Node\Expr\BinaryOp\Equal', - 'PHPParser_Node_Expr_Greater' => 'PhpParser\Node\Expr\BinaryOp\Greater', - 'PHPParser_Node_Expr_GreaterOrEqual' => 'PhpParser\Node\Expr\BinaryOp\GreaterOrEqual', - 'PHPParser_Node_Expr_Identical' => 'PhpParser\Node\Expr\BinaryOp\Identical', - 'PHPParser_Node_Expr_LogicalAnd' => 'PhpParser\Node\Expr\BinaryOp\LogicalAnd', - 'PHPParser_Node_Expr_LogicalOr' => 'PhpParser\Node\Expr\BinaryOp\LogicalOr', - 'PHPParser_Node_Expr_LogicalXor' => 'PhpParser\Node\Expr\BinaryOp\LogicalXor', - 'PHPParser_Node_Expr_Minus' => 'PhpParser\Node\Expr\BinaryOp\Minus', - 'PHPParser_Node_Expr_Mod' => 'PhpParser\Node\Expr\BinaryOp\Mod', - 'PHPParser_Node_Expr_Mul' => 'PhpParser\Node\Expr\BinaryOp\Mul', - 'PHPParser_Node_Expr_NotEqual' => 'PhpParser\Node\Expr\BinaryOp\NotEqual', - 'PHPParser_Node_Expr_NotIdentical' => 'PhpParser\Node\Expr\BinaryOp\NotIdentical', - 'PHPParser_Node_Expr_Plus' => 'PhpParser\Node\Expr\BinaryOp\Plus', - 'PHPParser_Node_Expr_ShiftLeft' => 'PhpParser\Node\Expr\BinaryOp\ShiftLeft', - 'PHPParser_Node_Expr_ShiftRight' => 'PhpParser\Node\Expr\BinaryOp\ShiftRight', - 'PHPParser_Node_Expr_Smaller' => 'PhpParser\Node\Expr\BinaryOp\Smaller', - 'PHPParser_Node_Expr_SmallerOrEqual' => 'PhpParser\Node\Expr\BinaryOp\SmallerOrEqual', - - 'PHPParser_Node_Expr_Array' => 'PhpParser\Node\Expr\Array_', - 'PHPParser_Node_Expr_ArrayDimFetch' => 'PhpParser\Node\Expr\ArrayDimFetch', - 'PHPParser_Node_Expr_ArrayItem' => 'PhpParser\Node\Expr\ArrayItem', - 'PHPParser_Node_Expr_Assign' => 'PhpParser\Node\Expr\Assign', - 'PHPParser_Node_Expr_AssignRef' => 'PhpParser\Node\Expr\AssignRef', - 'PHPParser_Node_Expr_BitwiseNot' => 'PhpParser\Node\Expr\BitwiseNot', - 'PHPParser_Node_Expr_BooleanNot' => 'PhpParser\Node\Expr\BooleanNot', - 'PHPParser_Node_Expr_ClassConstFetch' => 'PhpParser\Node\Expr\ClassConstFetch', - 'PHPParser_Node_Expr_Clone' => 'PhpParser\Node\Expr\Clone_', - 'PHPParser_Node_Expr_Closure' => 'PhpParser\Node\Expr\Closure', - 'PHPParser_Node_Expr_ClosureUse' => 'PhpParser\Node\Expr\ClosureUse', - 'PHPParser_Node_Expr_ConstFetch' => 'PhpParser\Node\Expr\ConstFetch', - 'PHPParser_Node_Expr_Empty' => 'PhpParser\Node\Expr\Empty_', - 'PHPParser_Node_Expr_ErrorSuppress' => 'PhpParser\Node\Expr\ErrorSuppress', - 'PHPParser_Node_Expr_Eval' => 'PhpParser\Node\Expr\Eval_', - 'PHPParser_Node_Expr_Exit' => 'PhpParser\Node\Expr\Exit_', - 'PHPParser_Node_Expr_FuncCall' => 'PhpParser\Node\Expr\FuncCall', - 'PHPParser_Node_Expr_Include' => 'PhpParser\Node\Expr\Include_', - 'PHPParser_Node_Expr_Instanceof' => 'PhpParser\Node\Expr\Instanceof_', - 'PHPParser_Node_Expr_Isset' => 'PhpParser\Node\Expr\Isset_', - 'PHPParser_Node_Expr_List' => 'PhpParser\Node\Expr\List_', - 'PHPParser_Node_Expr_MethodCall' => 'PhpParser\Node\Expr\MethodCall', - 'PHPParser_Node_Expr_New' => 'PhpParser\Node\Expr\New_', - 'PHPParser_Node_Expr_PostDec' => 'PhpParser\Node\Expr\PostDec', - 'PHPParser_Node_Expr_PostInc' => 'PhpParser\Node\Expr\PostInc', - 'PHPParser_Node_Expr_PreDec' => 'PhpParser\Node\Expr\PreDec', - 'PHPParser_Node_Expr_PreInc' => 'PhpParser\Node\Expr\PreInc', - 'PHPParser_Node_Expr_Print' => 'PhpParser\Node\Expr\Print_', - 'PHPParser_Node_Expr_PropertyFetch' => 'PhpParser\Node\Expr\PropertyFetch', - 'PHPParser_Node_Expr_ShellExec' => 'PhpParser\Node\Expr\ShellExec', - 'PHPParser_Node_Expr_StaticCall' => 'PhpParser\Node\Expr\StaticCall', - 'PHPParser_Node_Expr_StaticPropertyFetch' => 'PhpParser\Node\Expr\StaticPropertyFetch', - 'PHPParser_Node_Expr_Ternary' => 'PhpParser\Node\Expr\Ternary', - 'PHPParser_Node_Expr_UnaryMinus' => 'PhpParser\Node\Expr\UnaryMinus', - 'PHPParser_Node_Expr_UnaryPlus' => 'PhpParser\Node\Expr\UnaryPlus', - 'PHPParser_Node_Expr_Variable' => 'PhpParser\Node\Expr\Variable', - 'PHPParser_Node_Expr_Yield' => 'PhpParser\Node\Expr\Yield_', - - 'PHPParser_Node_Scalar_ClassConst' => 'PhpParser\Node\Scalar\MagicConst\Class_', - 'PHPParser_Node_Scalar_DirConst' => 'PhpParser\Node\Scalar\MagicConst\Dir', - 'PHPParser_Node_Scalar_FileConst' => 'PhpParser\Node\Scalar\MagicConst\File', - 'PHPParser_Node_Scalar_FuncConst' => 'PhpParser\Node\Scalar\MagicConst\Function_', - 'PHPParser_Node_Scalar_LineConst' => 'PhpParser\Node\Scalar\MagicConst\Line', - 'PHPParser_Node_Scalar_MethodConst' => 'PhpParser\Node\Scalar\MagicConst\Method', - 'PHPParser_Node_Scalar_NSConst' => 'PhpParser\Node\Scalar\MagicConst\Namespace_', - 'PHPParser_Node_Scalar_TraitConst' => 'PhpParser\Node\Scalar\MagicConst\Trait_', - - 'PHPParser_Node_Scalar_DNumber' => 'PhpParser\Node\Scalar\DNumber', - 'PHPParser_Node_Scalar_Encapsed' => 'PhpParser\Node\Scalar\Encapsed', - 'PHPParser_Node_Scalar_LNumber' => 'PhpParser\Node\Scalar\LNumber', - 'PHPParser_Node_Scalar_String' => 'PhpParser\Node\Scalar\String_', - ); } - -class_alias('PhpParser\Autoloader', 'PHPParser_Autoloader'); diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php index c247787..ca48287 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php @@ -44,8 +44,7 @@ public function extend($class) { /** * Implements one or more interfaces. * - * @param Name|string $interface Name of interface to implement - * @param Name|string $... More interfaces to implement + * @param Name|string ...$interfaces Names of interfaces to implement * * @return $this The builder instance (for fluid interface) */ diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php b/application/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php index 35646a3..f7b1d2c 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php @@ -10,6 +10,7 @@ abstract class FunctionLike extends Declaration { protected $returnByRef = false; protected $params = array(); + protected $returnType = null; /** * Make the function return by reference. @@ -55,4 +56,23 @@ public function addParams(array $params) { return $this; } -} \ No newline at end of file + + /** + * Sets the return type for PHP 7. + * + * @param string|Node\Name $type One of array, callable, string, int, float, bool, + * or a class/interface name. + * + * @return $this The builder instance (for fluid interface) + */ + public function setReturnType($type) + { + if (in_array($type, array('array', 'callable', 'string', 'int', 'float', 'bool'))) { + $this->returnType = $type; + } else { + $this->returnType = $this->normalizeName($type); + } + + return $this; + } +} diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php index 374f315..228bdfa 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php @@ -40,9 +40,10 @@ public function addStmt($stmt) { */ public function getNode() { return new Stmt\Function_($this->name, array( - 'byRef' => $this->returnByRef, - 'params' => $this->params, - 'stmts' => $this->stmts, + 'byRef' => $this->returnByRef, + 'params' => $this->params, + 'returnType' => $this->returnType, + 'stmts' => $this->stmts, ), $this->attributes); } -} \ No newline at end of file +} diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php index 18afaaa..8ebb292 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php @@ -25,8 +25,7 @@ public function __construct($name) { /** * Extends one or more interfaces. * - * @param Name|string $interface Name of interface to extend - * @param Name|string $... More interfaces to extend + * @param Name|string ...$interfaces Names of interfaces to extend * * @return $this The builder instance (for fluid interface) */ diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php b/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php index 60dd4b9..21698f1 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php @@ -116,10 +116,11 @@ public function addStmt($stmt) { */ public function getNode() { return new Stmt\ClassMethod($this->name, array( - 'type' => $this->type, - 'byRef' => $this->returnByRef, - 'params' => $this->params, - 'stmts' => $this->stmts, + 'type' => $this->type, + 'byRef' => $this->returnByRef, + 'params' => $this->params, + 'returnType' => $this->returnType, + 'stmts' => $this->stmts, ), $this->attributes); } } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php b/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php index af910c2..c9efc97 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php @@ -43,7 +43,7 @@ public function setDefault($value) { * @return $this The builder instance (for fluid interface) */ public function setTypeHint($type) { - if ($type === 'array' || $type === 'callable') { + if (in_array($type, array('array', 'callable', 'string', 'int', 'float', 'bool'))) { $this->type = $type; } else { $this->type = $this->normalizeName($type); @@ -73,4 +73,4 @@ public function getNode() { $this->name, $this->default, $this->type, $this->byRef ); } -} \ No newline at end of file +} diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php b/application/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php index 99c4baf..42c7f61 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php @@ -20,7 +20,7 @@ class BuilderFactory { /** * Creates a namespace builder. - * + * * @param null|string|Node\Name $name Name of the namespace * * @return Builder\Namespace_ The created namespace builder diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Comment.php b/application/vendor/nikic/php-parser/lib/PhpParser/Comment.php index 128d02e..b0b31a7 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Comment.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Comment.php @@ -6,16 +6,19 @@ class Comment { protected $text; protected $line; + protected $filePos; /** * Constructs a comment node. * - * @param string $text Comment text (including comment delimiters like /*) - * @param int $line Line number the comment started on + * @param string $text Comment text (including comment delimiters like /*) + * @param int $startLine Line number the comment started on + * @param int $startFilePos File offset the comment started on */ - public function __construct($text, $line = -1) { + public function __construct($text, $startLine = -1, $startFilePos = -1) { $this->text = $text; - $this->line = $line; + $this->line = $startLine; + $this->filePos = $startFilePos; } /** @@ -31,6 +34,8 @@ public function getText() { * Sets the comment text. * * @param string $text The comment text (including comment delimiters like /*) + * + * @deprecated Construct a new comment instead */ public function setText($text) { $this->text = $text; @@ -49,11 +54,22 @@ public function getLine() { * Sets the line number the comment started on. * * @param int $line Line number + * + * @deprecated Construct a new comment instead */ public function setLine($line) { $this->line = $line; } + /** + * Gets the file offset the comment started on. + * + * @return int File offset + */ + public function getFilePos() { + return $this->filePos; + } + /** * Gets the comment text. * @@ -75,7 +91,8 @@ public function __toString() { */ public function getReformattedText() { $text = trim($this->text); - if (false === strpos($text, "\n")) { + $newlinePos = strpos($text, "\n"); + if (false === $newlinePos) { // Single line comments don't need further processing return $text; } elseif (preg_match('((*BSR_ANYCRLF)(*ANYCRLF)^.*(?:\R\s+\*.*)+$)', $text)) { @@ -105,15 +122,30 @@ public function getReformattedText() { // // /* Some text. // Some more text. + // Indented text. // Even more text. */ // - // is handled by taking the length of the "/* " segment and leaving only that - // many space characters before the lines. Thus in the above example only three - // space characters are left at the start of every line. - return preg_replace('(^\s*(?= {' . strlen($matches[0]) . '}(?!\s)))m', '', $text); + // is handled by removing the difference between the shortest whitespace prefix on all + // lines and the length of the "/* " opening sequence. + $prefixLen = $this->getShortestWhitespacePrefixLen(substr($text, $newlinePos + 1)); + $removeLen = $prefixLen - strlen($matches[0]); + return preg_replace('(^\s{' . $removeLen . '})m', '', $text); } // No idea how to format this comment, so simply return as is return $text; } + + private function getShortestWhitespacePrefixLen($str) { + $lines = explode("\n", $str); + $shortestPrefixLen = INF; + foreach ($lines as $line) { + preg_match('(^\s*)', $line, $matches); + $prefixLen = strlen($matches[0]); + if ($prefixLen < $shortestPrefixLen) { + $shortestPrefixLen = $prefixLen; + } + } + return $shortestPrefixLen; + } } \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Lexer.php b/application/vendor/nikic/php-parser/lib/PhpParser/Lexer.php index f3af54d..cf7bf56 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Lexer.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Lexer.php @@ -2,6 +2,9 @@ namespace PhpParser; +use PhpParser\Node\Scalar\LNumber; +use PhpParser\Parser\Tokens; + class Lexer { protected $code; @@ -19,10 +22,10 @@ class Lexer * Creates a Lexer. * * @param array $options Options array. Currently only the 'usedAttributes' option is supported, - * which is an array of attributes to add to the AST nodes. Possible attributes - * are: 'comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos', - * 'startFilePos', 'endFilePos'. The option defaults to the first three. - * For more info see getNextToken() docs. + * which is an array of attributes to add to the AST nodes. Possible + * attributes are: 'comments', 'startLine', 'endLine', 'startTokenPos', + * 'endTokenPos', 'startFilePos', 'endFilePos'. The option defaults to the + * first three. For more info see getNextToken() docs. */ public function __construct(array $options = array()) { // map from internal tokens to PhpParser tokens @@ -30,7 +33,9 @@ public function __construct(array $options = array()) { // map of tokens to drop while lexing (the map is only used for isset lookup, // that's why the value is simply set to 1; the value is never actually used.) - $this->dropTokens = array_fill_keys(array(T_WHITESPACE, T_OPEN_TAG), 1); + $this->dropTokens = array_fill_keys( + array(T_WHITESPACE, T_OPEN_TAG, T_COMMENT, T_DOC_COMMENT), 1 + ); // the usedAttributes member is a map of the used attribute names to a dummy // value (here "true") @@ -65,14 +70,21 @@ public function startLexing($code) { } protected function resetErrors() { - // set error_get_last() to defined state by forcing an undefined variable error - set_error_handler(function() { return false; }, 0); - @$undefinedVariable; - restore_error_handler(); + if (function_exists('error_clear_last')) { + error_clear_last(); + } else { + // set error_get_last() to defined state by forcing an undefined variable error + set_error_handler(function() { return false; }, 0); + @$undefinedVariable; + restore_error_handler(); + } } protected function handleErrors() { $error = error_get_last(); + if (null === $error) { + return; + } if (preg_match( '~^Unterminated comment starting line ([0-9]+)$~', @@ -111,7 +123,7 @@ protected function handleErrors() { * * 'startTokenPos' => Offset into the token array of the first token in the node. * * 'endTokenPos' => Offset into the token array of the last token in the node. * * 'startFilePos' => Offset into the code string of the first character that is part of the node. - * * 'endFilePos' => Offset into the code string of the last character that is part of the node + * * 'endFilePos' => Offset into the code string of the last character that is part of the node. * * @param mixed $value Variable to store token content in * @param mixed $startAttributes Variable to store start attributes in @@ -131,6 +143,9 @@ public function getNextToken(&$value = null, &$startAttributes = null, &$endAttr $token = "\0"; } + if (isset($this->usedAttributes['startLine'])) { + $startAttributes['startLine'] = $this->line; + } if (isset($this->usedAttributes['startTokenPos'])) { $startAttributes['startTokenPos'] = $this->pos; } @@ -138,63 +153,48 @@ public function getNextToken(&$value = null, &$startAttributes = null, &$endAttr $startAttributes['startFilePos'] = $this->filePos; } - if (is_string($token)) { - // bug in token_get_all - if ('b"' === $token) { - $value = 'b"'; + if (\is_string($token)) { + $value = $token; + if (isset($token[1])) { + // bug in token_get_all $this->filePos += 2; $id = ord('"'); } else { - $value = $token; $this->filePos += 1; $id = ord($token); } + } elseif (!isset($this->dropTokens[$token[0]])) { + $value = $token[1]; + $id = $this->tokenMap[$token[0]]; - if (isset($this->usedAttributes['startLine'])) { - $startAttributes['startLine'] = $this->line; - } - if (isset($this->usedAttributes['endLine'])) { - $endAttributes['endLine'] = $this->line; - } - if (isset($this->usedAttributes['endTokenPos'])) { - $endAttributes['endTokenPos'] = $this->pos; - } - if (isset($this->usedAttributes['endFilePos'])) { - $endAttributes['endFilePos'] = $this->filePos - 1; - } - - return $id; + $this->line += substr_count($value, "\n"); + $this->filePos += \strlen($value); } else { - $this->line += substr_count($token[1], "\n"); - $this->filePos += strlen($token[1]); - - if (T_COMMENT === $token[0]) { + if (T_COMMENT === $token[0] || T_DOC_COMMENT === $token[0]) { if (isset($this->usedAttributes['comments'])) { - $startAttributes['comments'][] = new Comment($token[1], $token[2]); + $comment = T_DOC_COMMENT === $token[0] + ? new Comment\Doc($token[1], $this->line, $this->filePos) + : new Comment($token[1], $this->line, $this->filePos); + $startAttributes['comments'][] = $comment; } - } elseif (T_DOC_COMMENT === $token[0]) { - if (isset($this->usedAttributes['comments'])) { - $startAttributes['comments'][] = new Comment\Doc($token[1], $token[2]); - } - } elseif (!isset($this->dropTokens[$token[0]])) { - $value = $token[1]; + } - if (isset($this->usedAttributes['startLine'])) { - $startAttributes['startLine'] = $token[2]; - } - if (isset($this->usedAttributes['endLine'])) { - $endAttributes['endLine'] = $this->line; - } - if (isset($this->usedAttributes['endTokenPos'])) { - $endAttributes['endTokenPos'] = $this->pos; - } - if (isset($this->usedAttributes['endFilePos'])) { - $endAttributes['endFilePos'] = $this->filePos - 1; - } + $this->line += substr_count($token[1], "\n"); + $this->filePos += \strlen($token[1]); + continue; + } - return $this->tokenMap[$token[0]]; - } + if (isset($this->usedAttributes['endLine'])) { + $endAttributes['endLine'] = $this->line; } + if (isset($this->usedAttributes['endTokenPos'])) { + $endAttributes['endTokenPos'] = $this->pos; + } + if (isset($this->usedAttributes['endFilePos'])) { + $endAttributes['endFilePos'] = $this->filePos - 1; + } + + return $id; } throw new \RuntimeException('Reached end of lexer loop'); @@ -254,18 +254,18 @@ protected function createTokenMap() { for ($i = 256; $i < 1000; ++$i) { if (T_DOUBLE_COLON === $i) { // T_DOUBLE_COLON is equivalent to T_PAAMAYIM_NEKUDOTAYIM - $tokenMap[$i] = Parser::T_PAAMAYIM_NEKUDOTAYIM; + $tokenMap[$i] = Tokens::T_PAAMAYIM_NEKUDOTAYIM; } elseif(T_OPEN_TAG_WITH_ECHO === $i) { // T_OPEN_TAG_WITH_ECHO with dropped T_OPEN_TAG results in T_ECHO - $tokenMap[$i] = Parser::T_ECHO; + $tokenMap[$i] = Tokens::T_ECHO; } elseif(T_CLOSE_TAG === $i) { // T_CLOSE_TAG is equivalent to ';' $tokenMap[$i] = ord(';'); } elseif ('UNKNOWN' !== $name = token_name($i)) { if ('T_HASHBANG' === $name) { // HHVM uses a special token for #! hashbang lines - $tokenMap[$i] = Parser::T_INLINE_HTML; - } else if (defined($name = 'PhpParser\Parser::' . $name)) { + $tokenMap[$i] = Tokens::T_INLINE_HTML; + } else if (defined($name = 'PhpParser\Parser\Tokens::' . $name)) { // Other tokens can be mapped directly $tokenMap[$i] = constant($name); } @@ -274,11 +274,11 @@ protected function createTokenMap() { // HHVM uses a special token for numbers that overflow to double if (defined('T_ONUMBER')) { - $tokenMap[T_ONUMBER] = Parser::T_DNUMBER; + $tokenMap[T_ONUMBER] = Tokens::T_DNUMBER; } // HHVM also has a separate token for the __COMPILER_HALT_OFFSET__ constant if (defined('T_COMPILER_HALT_OFFSET')) { - $tokenMap[T_COMPILER_HALT_OFFSET] = Parser::T_STRING; + $tokenMap[T_COMPILER_HALT_OFFSET] = Tokens::T_STRING; } return $tokenMap; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php b/application/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php index 837def4..257f086 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php @@ -2,7 +2,7 @@ namespace PhpParser\Lexer; -use PhpParser\Parser; +use PhpParser\Parser\Tokens; /** * ATTENTION: This code is WRITE-ONLY. Do not try to read it. @@ -22,21 +22,14 @@ class Emulative extends \PhpParser\Lexer const PHP_7_0 = '7.0.0dev'; const PHP_5_6 = '5.6.0rc1'; const PHP_5_5 = '5.5.0beta1'; - const PHP_5_4 = '5.4.0beta1'; public function __construct(array $options = array()) { parent::__construct($options); $newKeywordsPerVersion = array( self::PHP_5_5 => array( - 'finally' => Parser::T_FINALLY, - 'yield' => Parser::T_YIELD, - ), - self::PHP_5_4 => array( - 'callable' => Parser::T_CALLABLE, - 'insteadof' => Parser::T_INSTEADOF, - 'trait' => Parser::T_TRAIT, - '__trait__' => Parser::T_TRAIT_C, + 'finally' => Tokens::T_FINALLY, + 'yield' => Tokens::T_YIELD, ), ); @@ -52,16 +45,16 @@ public function __construct(array $options = array()) { if (version_compare(PHP_VERSION, self::PHP_7_0, '>=')) { return; } - $this->tokenMap[self::T_COALESCE] = Parser::T_COALESCE; - $this->tokenMap[self::T_SPACESHIP] = Parser::T_SPACESHIP; - $this->tokenMap[self::T_YIELD_FROM] = Parser::T_YIELD_FROM; + $this->tokenMap[self::T_COALESCE] = Tokens::T_COALESCE; + $this->tokenMap[self::T_SPACESHIP] = Tokens::T_SPACESHIP; + $this->tokenMap[self::T_YIELD_FROM] = Tokens::T_YIELD_FROM; if (version_compare(PHP_VERSION, self::PHP_5_6, '>=')) { return; } - $this->tokenMap[self::T_ELLIPSIS] = Parser::T_ELLIPSIS; - $this->tokenMap[self::T_POW] = Parser::T_POW; - $this->tokenMap[self::T_POW_EQUAL] = Parser::T_POW_EQUAL; + $this->tokenMap[self::T_ELLIPSIS] = Tokens::T_ELLIPSIS; + $this->tokenMap[self::T_POW] = Tokens::T_POW; + $this->tokenMap[self::T_POW_EQUAL] = Tokens::T_POW_EQUAL; } public function startLexing($code) { @@ -106,12 +99,7 @@ protected function preprocessCode($code) { $code = preg_replace('((?=')) { - return $code; - } - - // binary notation (0b010101101001...) - return preg_replace('(\b0b[01]+\b)', '~__EMU__BINARY__$0__~', $code); + return $code; } /* @@ -130,14 +118,7 @@ protected function postprocessTokens() { && T_STRING === $this->tokens[$i + 1][0] && preg_match('(^__EMU__([A-Z]++)__(?:([A-Za-z0-9]++)__)?$)', $this->tokens[$i + 1][1], $matches) ) { - if ('BINARY' === $matches[1]) { - // the binary number can either be an integer or a double, so return a LNUMBER - // or DNUMBER respectively - $isInt = is_int(bindec($matches[2])); - $replace = array( - array($isInt ? T_LNUMBER : T_DNUMBER, $matches[2], $this->tokens[$i + 1][2]) - ); - } else if ('ELLIPSIS' === $matches[1]) { + if ('ELLIPSIS' === $matches[1]) { $replace = array( array(self::T_ELLIPSIS, '...', $this->tokens[$i + 1][2]) ); @@ -158,7 +139,7 @@ protected function postprocessTokens() { array(self::T_SPACESHIP, '<=>', $this->tokens[$i + 1][2]), ); } else if ('YIELDFROM' === $matches[1]) { - $content = $this->hex2bin($matches[2]); + $content = hex2bin($matches[2]); $replace = array( array(self::T_YIELD_FROM, $content, $this->tokens[$i + 1][2] - substr_count($content, "\n")) ); @@ -187,9 +168,7 @@ protected function postprocessTokens() { * multichar tokens (like strings) to their original value. */ public function restoreContentCallback(array $matches) { - if ('BINARY' === $matches[1]) { - return $matches[2]; - } else if ('ELLIPSIS' === $matches[1]) { + if ('ELLIPSIS' === $matches[1]) { return '...'; } else if ('POW' === $matches[1]) { return '**'; @@ -200,30 +179,25 @@ public function restoreContentCallback(array $matches) { } else if ('SPACESHIP' === $matches[1]) { return '<=>'; } else if ('YIELDFROM' === $matches[1]) { - return $this->hex2bin($matches[2]); + return hex2bin($matches[2]); } else { return $matches[0]; } } - private function hex2bin($str) { - // TODO Drop when removing support for PHP 5.3 - return pack('H*', $str); - } - public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) { $token = parent::getNextToken($value, $startAttributes, $endAttributes); // replace new keywords by their respective tokens. This is not done // if we currently are in an object access (e.g. in $obj->namespace // "namespace" stays a T_STRING tokens and isn't converted to T_NAMESPACE) - if (Parser::T_STRING === $token && !$this->inObjectAccess) { + if (Tokens::T_STRING === $token && !$this->inObjectAccess) { if (isset($this->newKeywords[strtolower($value)])) { return $this->newKeywords[strtolower($value)]; } } else { // keep track of whether we currently are in an object access (after ->) - $this->inObjectAccess = Parser::T_OBJECT_OPERATOR === $token; + $this->inObjectAccess = Tokens::T_OBJECT_OPERATOR === $token; } return $token; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php index c61db13..0887669 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php @@ -22,7 +22,7 @@ class Arg extends NodeAbstract * @param array $attributes Additional attributes */ public function __construct(Expr $value, $byRef = false, $unpack = false, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->value = $value; $this->byRef = $byRef; $this->unpack = $unpack; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php index f6fcf65..26322d4 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php @@ -19,7 +19,7 @@ class Const_ extends NodeAbstract * @param array $attributes Additional attributes */ public function __construct($name, Expr $value, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->name = $name; $this->value = $value; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php index 0c53d76..b2e58f6 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php @@ -19,7 +19,7 @@ class ArrayDimFetch extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $var, Expr $dim = null, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->var = $var; $this->dim = $dim; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php index 8999b5f..de73ef4 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php @@ -22,7 +22,7 @@ class ArrayItem extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $value, Expr $key = null, $byRef = false, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->key = $key; $this->value = $value; $this->byRef = $byRef; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php index 0385fe2..9151f27 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php @@ -6,6 +6,10 @@ class Array_ extends Expr { + // For use in "kind" attribute + const KIND_LONG = 1; // array() syntax + const KIND_SHORT = 2; // [] syntax + /** @var ArrayItem[] Items */ public $items; @@ -16,7 +20,7 @@ class Array_ extends Expr * @param array $attributes Additional attributes */ public function __construct(array $items = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->items = $items; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php index ef16f8e..1f280ff 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php @@ -19,7 +19,7 @@ class Assign extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $var, Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->var = $var; $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php index 54653ff..83540a0 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php @@ -4,10 +4,6 @@ use PhpParser\Node\Expr; -/** - * @property Expr $var Variable - * @property Expr $expr Expression - */ abstract class AssignOp extends Expr { /** @var Expr Variable */ @@ -23,7 +19,7 @@ abstract class AssignOp extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $var, Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->var = $var; $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php index bd2915c..7578df3 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php @@ -4,10 +4,6 @@ use PhpParser\Node\Expr; -/** - * @property Expr $var Variable reference is assigned to - * @property Expr $expr Variable which is referenced - */ class AssignRef extends Expr { /** @var Expr Variable reference is assigned to */ @@ -23,7 +19,7 @@ class AssignRef extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $var, Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->var = $var; $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php index d8a7e25..6f87e23 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php @@ -19,7 +19,7 @@ abstract class BinaryOp extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $left, Expr $right, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->left = $left; $this->right = $right; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php index d85f581..1d92264 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php @@ -16,7 +16,7 @@ class BitwiseNot extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php index 2706a50..8f543b8 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php @@ -16,7 +16,7 @@ class BooleanNot extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php index 13772e4..bf850dc 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php @@ -16,7 +16,7 @@ abstract class Cast extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php index 3540c90..c0cc26f 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php @@ -20,7 +20,7 @@ class ClassConstFetch extends Expr * @param array $attributes Additional attributes */ public function __construct($class, $name, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->class = $class; $this->name = $name; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php index 1bfab2e..198ec4d 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php @@ -16,7 +16,7 @@ class Clone_ extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php index 0cdcd41..2686086 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php @@ -34,7 +34,7 @@ class Closure extends Expr implements FunctionLike * @param array $attributes Additional attributes */ public function __construct(array $subNodes = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->static = isset($subNodes['static']) ? $subNodes['static'] : false; $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false; $this->params = isset($subNodes['params']) ? $subNodes['params'] : array(); diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php index 6669127..f4d0202 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php @@ -19,7 +19,7 @@ class ClosureUse extends Expr * @param array $attributes Additional attributes */ public function __construct($var, $byRef = false, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->var = $var; $this->byRef = $byRef; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php index 4604a32..5f1a92d 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php @@ -17,7 +17,7 @@ class ConstFetch extends Expr * @param array $attributes Additional attributes */ public function __construct(Name $name, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->name = $name; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php index a2503df..0c0509e 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php @@ -16,7 +16,7 @@ class Empty_ extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php index b55cc50..750c814 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php @@ -16,7 +16,7 @@ class ErrorSuppress extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php index cb977c2..eadffd0 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php @@ -16,7 +16,7 @@ class Eval_ extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php index c8e542b..b0b94cf 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php @@ -6,6 +6,10 @@ class Exit_ extends Expr { + /* For use in "kind" attribute */ + const KIND_EXIT = 1; + const KIND_DIE = 2; + /** @var null|Expr Expression */ public $expr; @@ -16,7 +20,7 @@ class Exit_ extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $expr = null, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php index dae3aab..60d0050 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php @@ -20,7 +20,7 @@ class FuncCall extends Expr * @param array $attributes Additional attributes */ public function __construct($name, array $args = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->name = $name; $this->args = $args; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php index 280ac98..b27f3af 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php @@ -24,7 +24,7 @@ class Include_ extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $expr, $type, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; $this->type = $type; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php index 0c670b0..3ef8ad1 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php @@ -20,7 +20,7 @@ class Instanceof_ extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $expr, $class, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; $this->class = $class; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php index 91e50fd..4ec1d02 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php @@ -16,7 +16,7 @@ class Isset_ extends Expr * @param array $attributes Additional attributes */ public function __construct(array $vars, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->vars = $vars; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php index 962543b..28ba612 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php @@ -16,7 +16,7 @@ class List_ extends Expr * @param array $attributes Additional attributes */ public function __construct(array $vars, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->vars = $vars; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php index 0a8b6d9..a6cdd07 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php @@ -23,7 +23,7 @@ class MethodCall extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $var, $name, array $args = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->var = $var; $this->name = $name; $this->args = $args; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php index 690efe6..a8c8779 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php @@ -20,7 +20,7 @@ class New_ extends Expr * @param array $attributes Additional attributes */ public function __construct($class, array $args = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->class = $class; $this->args = $args; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php index 66ba5dc..06ce547 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php @@ -16,7 +16,7 @@ class PostDec extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $var, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->var = $var; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php index ad72482..54865ba 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php @@ -16,7 +16,7 @@ class PostInc extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $var, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->var = $var; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php index c388ab5..db30f51 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php @@ -16,7 +16,7 @@ class PreDec extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $var, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->var = $var; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php index da8a58a..0635602 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php @@ -16,7 +16,7 @@ class PreInc extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $var, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->var = $var; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php index af7f02d..0666ab8 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php @@ -16,7 +16,7 @@ class Print_ extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php index 37dcd7f..adcf21c 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php @@ -19,7 +19,7 @@ class PropertyFetch extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $var, $name, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->var = $var; $this->name = $name; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php index f0adf3e..9516a32 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php @@ -16,7 +16,7 @@ class ShellExec extends Expr * @param array $attributes Additional attributes */ public function __construct(array $parts, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->parts = $parts; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php index eb17ab8..5118f34 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php @@ -23,7 +23,7 @@ class StaticCall extends Expr * @param array $attributes Additional attributes */ public function __construct($class, $name, array $args = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->class = $class; $this->name = $name; $this->args = $args; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php index acc86ec..5126bda 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php @@ -20,7 +20,7 @@ class StaticPropertyFetch extends Expr * @param array $attributes Additional attributes */ public function __construct($class, $name, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->class = $class; $this->name = $name; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php index 05d2e7a..5730139 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php @@ -22,7 +22,7 @@ class Ternary extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $cond, $if, Expr $else, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->cond = $cond; $this->if = $if; $this->else = $else; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php index 27960f8..94635d6 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php @@ -16,7 +16,7 @@ class UnaryMinus extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php index 0f545b9..6514120 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php @@ -16,7 +16,7 @@ class UnaryPlus extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php index b5dd78a..3ae3ecd 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php @@ -16,7 +16,7 @@ class Variable extends Expr * @param array $attributes Additional attributes */ public function __construct($name, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->name = $name; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php index 0936f89..993c82c 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php @@ -16,7 +16,7 @@ class YieldFrom extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php index e7e6f00..f3ca88e 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php @@ -19,7 +19,7 @@ class Yield_ extends Expr * @param array $attributes Additional attributes */ public function __construct(Expr $value = null, Expr $key = null, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->key = $key; $this->value = $value; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php index 2e3d781..ba6a20c 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php @@ -20,7 +20,7 @@ public function __construct($parts, array $attributes = array()) { $parts = explode('\\', $parts); } - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->parts = $parts; } @@ -106,37 +106,45 @@ public function __toString() { /** * Sets the whole name. * + * @deprecated Create a new Name instead, or manually modify the $parts property + * * @param string|array|self $name The name to set the whole name to */ public function set($name) { - $this->parts = $this->prepareName($name); + $this->parts = self::prepareName($name); } /** * Prepends a name to this name. * + * @deprecated Use Name::concat($name1, $name2) instead + * * @param string|array|self $name Name to prepend */ public function prepend($name) { - $this->parts = array_merge($this->prepareName($name), $this->parts); + $this->parts = array_merge(self::prepareName($name), $this->parts); } /** * Appends a name to this name. * + * @deprecated Use Name::concat($name1, $name2) instead + * * @param string|array|self $name Name to append */ public function append($name) { - $this->parts = array_merge($this->parts, $this->prepareName($name)); + $this->parts = array_merge($this->parts, self::prepareName($name)); } /** * Sets the first part of the name. * + * @deprecated Use concat($first, $name->slice(1)) instead + * * @param string|array|self $name The name to set the first part to */ public function setFirst($name) { - array_splice($this->parts, 0, 1, $this->prepareName($name)); + array_splice($this->parts, 0, 1, self::prepareName($name)); } /** @@ -145,7 +153,47 @@ public function setFirst($name) { * @param string|array|self $name The name to set the last part to */ public function setLast($name) { - array_splice($this->parts, -1, 1, $this->prepareName($name)); + array_splice($this->parts, -1, 1, self::prepareName($name)); + } + + /** + * Gets a slice of a name (similar to array_slice). + * + * This method returns a new instance of the same type as the original and with the same + * attributes. + * + * If the slice is empty, a Name with an empty parts array is returned. While this is + * meaningless in itself, it works correctly in conjunction with concat(). + * + * @param int $offset Offset to start the slice at + * + * @return static Sliced name + */ + public function slice($offset) { + // TODO negative offset and length + if ($offset < 0 || $offset > count($this->parts)) { + throw new \OutOfBoundsException(sprintf('Offset %d is out of bounds', $offset)); + } + + return new static(array_slice($this->parts, $offset), $this->attributes); + } + + /** + * Concatenate two names, yielding a new Name instance. + * + * The type of the generated instance depends on which class this method is called on, for + * example Name\FullyQualified::concat() will yield a Name\FullyQualified instance. + * + * @param string|array|self $name1 The first name + * @param string|array|self $name2 The second name + * @param array $attributes Attributes to assign to concatenated name + * + * @return static Concatenated name + */ + public static function concat($name1, $name2, array $attributes = []) { + return new static( + array_merge(self::prepareName($name1), self::prepareName($name2)), $attributes + ); } /** @@ -156,7 +204,7 @@ public function setLast($name) { * * @return array Prepared name */ - protected function prepareName($name) { + private static function prepareName($name) { if (is_string($name)) { return explode('\\', $name); } elseif (is_array($name)) { diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php index c65842d..ada197b 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php @@ -29,7 +29,7 @@ class Param extends NodeAbstract * @param array $attributes Additional attributes */ public function __construct($name, Expr $default = null, $type = null, $byRef = false, $variadic = false, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->type = $type; $this->byRef = $byRef; $this->variadic = $variadic; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php index 7fe9f73..84ef75d 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php @@ -15,8 +15,8 @@ class DNumber extends Scalar * @param float $value Value of the number * @param array $attributes Additional attributes */ - public function __construct($value = 0.0, array $attributes = array()) { - parent::__construct(null, $attributes); + public function __construct($value, array $attributes = array()) { + parent::__construct($attributes); $this->value = $value; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php index c2555bf..ec3e971 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php @@ -15,8 +15,8 @@ class Encapsed extends Scalar * @param array $parts Encaps list * @param array $attributes Additional attributes */ - public function __construct(array $parts = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + public function __construct(array $parts, array $attributes = array()) { + parent::__construct($attributes); $this->parts = $parts; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php new file mode 100644 index 0000000..50cb1af --- /dev/null +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php @@ -0,0 +1,26 @@ +value = $value; + } + + public function getSubNodeNames() { + return array('value'); + } +} diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php index 4a4e603..3559b98 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php @@ -2,10 +2,17 @@ namespace PhpParser\Node\Scalar; +use PhpParser\Error; use PhpParser\Node\Scalar; class LNumber extends Scalar { + /* For use in "kind" attribute */ + const KIND_BIN = 2; + const KIND_OCT = 8; + const KIND_DEC = 10; + const KIND_HEX = 16; + /** @var int Number value */ public $value; @@ -15,8 +22,8 @@ class LNumber extends Scalar * @param int $value Value of the number * @param array $attributes Additional attributes */ - public function __construct($value = 0, array $attributes = array()) { - parent::__construct(null, $attributes); + public function __construct($value, array $attributes = array()) { + parent::__construct($attributes); $this->value = $value; } @@ -25,37 +32,36 @@ public function getSubNodeNames() { } /** - * @internal - * - * Parses an LNUMBER token (dec, hex, oct and bin notations) like PHP would. + * Constructs an LNumber node from a string number literal. * - * @param string $str A string number + * @param string $str String number literal (decimal, octal, hex or binary) + * @param array $attributes Additional attributes + * @param bool $allowInvalidOctal Whether to allow invalid octal numbers (PHP 5) * - * @return int The parsed number + * @return LNumber The constructed LNumber, including kind attribute */ - public static function parse($str) { - // handle plain 0 specially - if ('0' === $str) { - return 0; + public static function fromString($str, array $attributes = array(), $allowInvalidOctal = false) { + if ('0' !== $str[0] || '0' === $str) { + $attributes['kind'] = LNumber::KIND_DEC; + return new LNumber((int) $str, $attributes); } - // if first char is 0 (and number isn't 0) it's a special syntax - if ('0' === $str[0]) { - // hex - if ('x' === $str[1] || 'X' === $str[1]) { - return hexdec($str); - } + if ('x' === $str[1] || 'X' === $str[1]) { + $attributes['kind'] = LNumber::KIND_HEX; + return new LNumber(hexdec($str), $attributes); + } - // bin - if ('b' === $str[1] || 'B' === $str[1]) { - return bindec($str); - } + if ('b' === $str[1] || 'B' === $str[1]) { + $attributes['kind'] = LNumber::KIND_BIN; + return new LNumber(bindec($str), $attributes); + } - // oct (intval instead of octdec to get proper cutting behavior with malformed numbers) - return intval($str, 8); + if (!$allowInvalidOctal && strpbrk($str, '89')) { + throw new Error('Invalid numeric literal', $attributes); } - // dec - return (int) $str; + // use intval instead of octdec to get proper cutting behavior with malformed numbers + $attributes['kind'] = LNumber::KIND_OCT; + return new LNumber(intval($str, 8), $attributes); } } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php index 969a664..a50d68f 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php @@ -12,7 +12,7 @@ abstract class MagicConst extends Scalar * @param array $attributes Additional attributes */ public function __construct(array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); } public function getSubNodeNames() { diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php index f7c10c3..d7bbf83 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php @@ -2,10 +2,17 @@ namespace PhpParser\Node\Scalar; +use PhpParser\Error; use PhpParser\Node\Scalar; class String_ extends Scalar { + /* For use in "kind" attribute */ + const KIND_SINGLE_QUOTED = 1; + const KIND_DOUBLE_QUOTED = 2; + const KIND_HEREDOC = 3; + const KIND_NOWDOC = 4; + /** @var string String value */ public $value; @@ -26,8 +33,8 @@ class String_ extends Scalar * @param string $value Value of the string * @param array $attributes Additional attributes */ - public function __construct($value = '', array $attributes = array()) { - parent::__construct(null, $attributes); + public function __construct($value, array $attributes = array()) { + parent::__construct($attributes); $this->value = $value; } @@ -41,12 +48,13 @@ public function getSubNodeNames() { * Parses a string token. * * @param string $str String token content + * @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes * * @return string The parsed string */ - public static function parse($str) { + public static function parse($str, $parseUnicodeEscape = true) { $bLength = 0; - if ('b' === $str[0]) { + if ('b' === $str[0] || 'B' === $str[0]) { $bLength = 1; } @@ -57,7 +65,9 @@ public static function parse($str) { substr($str, $bLength + 1, -1) ); } else { - return self::parseEscapeSequences(substr($str, $bLength + 1, -1), '"'); + return self::parseEscapeSequences( + substr($str, $bLength + 1, -1), '"', $parseUnicodeEscape + ); } } @@ -68,31 +78,54 @@ public static function parse($str) { * * @param string $str String without quotes * @param null|string $quote Quote type + * @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes * * @return string String with escape sequences parsed */ - public static function parseEscapeSequences($str, $quote) { + public static function parseEscapeSequences($str, $quote, $parseUnicodeEscape = true) { if (null !== $quote) { $str = str_replace('\\' . $quote, $quote, $str); } + $extra = ''; + if ($parseUnicodeEscape) { + $extra = '|u\{([0-9a-fA-F]+)\}'; + } + return preg_replace_callback( - '~\\\\([\\\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3})~', - array(__CLASS__, 'parseCallback'), + '~\\\\([\\\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3}' . $extra . ')~', + function($matches) { + $str = $matches[1]; + + if (isset(self::$replacements[$str])) { + return self::$replacements[$str]; + } elseif ('x' === $str[0] || 'X' === $str[0]) { + return chr(hexdec($str)); + } elseif ('u' === $str[0]) { + return self::codePointToUtf8(hexdec($matches[2])); + } else { + return chr(octdec($str)); + } + }, $str ); } - private static function parseCallback($matches) { - $str = $matches[1]; - - if (isset(self::$replacements[$str])) { - return self::$replacements[$str]; - } elseif ('x' === $str[0] || 'X' === $str[0]) { - return chr(hexdec($str)); - } else { - return chr(octdec($str)); + private static function codePointToUtf8($num) { + if ($num <= 0x7F) { + return chr($num); + } + if ($num <= 0x7FF) { + return chr(($num>>6) + 0xC0) . chr(($num&0x3F) + 0x80); + } + if ($num <= 0xFFFF) { + return chr(($num>>12) + 0xE0) . chr((($num>>6)&0x3F) + 0x80) . chr(($num&0x3F) + 0x80); + } + if ($num <= 0x1FFFFF) { + return chr(($num>>18) + 0xF0) . chr((($num>>12)&0x3F) + 0x80) + . chr((($num>>6)&0x3F) + 0x80) . chr(($num&0x3F) + 0x80); } + throw new Error('Invalid UTF-8 codepoint escape sequence: Codepoint too large'); } /** @@ -102,10 +135,11 @@ private static function parseCallback($matches) { * * @param string $startToken Doc string start token content (<<num = $num; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php index 50f17a6..03f892c 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php @@ -19,7 +19,7 @@ class Case_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct($cond, array $stmts = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->cond = $cond; $this->stmts = $stmts; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php index 7dd3e9b..2656afd 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php @@ -22,7 +22,7 @@ class Catch_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(Node\Name $type, $var, array $stmts = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->type = $type; $this->var = $var; $this->stmts = $stmts; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php index 3eb6b0c..e8e2d6f 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php @@ -16,7 +16,7 @@ class ClassConst extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(array $consts, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->consts = $consts; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php index c1bd577..dfdd8ab 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php @@ -34,7 +34,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike * @param array $attributes Additional attributes */ public function __construct($name, array $subNodes = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->type = isset($subNodes['type']) ? $subNodes['type'] : 0; $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false; $this->name = $name; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php index 496ee51..6ef093d 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php @@ -41,7 +41,7 @@ class Class_ extends ClassLike * @param array $attributes Additional attributes */ public function __construct($name, array $subNodes = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->type = isset($subNodes['type']) ? $subNodes['type'] : 0; $this->name = $name; $this->extends = isset($subNodes['extends']) ? $subNodes['extends'] : null; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php index b42c8df..8b2eecd 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php @@ -16,7 +16,7 @@ class Const_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(array $consts, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->consts = $consts; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php index 0f4c596..f78e19a 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php @@ -16,7 +16,7 @@ class Continue_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(Node\Expr $num = null, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->num = $num; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php index e7833f6..829dbaf 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php @@ -19,7 +19,7 @@ class DeclareDeclare extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct($key, Node\Expr $value, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->key = $key; $this->value = $value; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php index 67a753e..64b9efc 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php @@ -14,11 +14,11 @@ class Declare_ extends Node\Stmt * Constructs a declare node. * * @param DeclareDeclare[] $declares List of declares - * @param Node[] $stmts Statements + * @param Node[]|null $stmts Statements * @param array $attributes Additional attributes */ - public function __construct(array $declares, array $stmts, array $attributes = array()) { - parent::__construct(null, $attributes); + public function __construct(array $declares, array $stmts = null, array $attributes = array()) { + parent::__construct($attributes); $this->declares = $declares; $this->stmts = $stmts; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php index b5f3092..dd4c6c8 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php @@ -19,7 +19,7 @@ class Do_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(Node\Expr $cond, array $stmts = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->cond = $cond; $this->stmts = $stmts; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php index 9275158..11e1070 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php @@ -16,7 +16,7 @@ class Echo_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(array $exprs, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->exprs = $exprs; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php index 1a9773c..608878f 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php @@ -19,7 +19,7 @@ class ElseIf_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(Node\Expr $cond, array $stmts = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->cond = $cond; $this->stmts = $stmts; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php index ecec6e6..c91a148 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php @@ -16,7 +16,7 @@ class Else_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(array $stmts = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->stmts = $stmts; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php index 4f7d4e8..2ca88a3 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php @@ -26,7 +26,7 @@ class For_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(array $subNodes = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->init = isset($subNodes['init']) ? $subNodes['init'] : array(); $this->cond = isset($subNodes['cond']) ? $subNodes['cond'] : array(); $this->loop = isset($subNodes['loop']) ? $subNodes['loop'] : array(); diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php index bec82e9..d2c6432 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php @@ -29,7 +29,7 @@ class Foreach_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(Node\Expr $expr, Node\Expr $valueVar, array $subNodes = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; $this->keyVar = isset($subNodes['keyVar']) ? $subNodes['keyVar'] : null; $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php index 10087d5..2df68e5 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php @@ -30,7 +30,7 @@ class Function_ extends Node\Stmt implements FunctionLike * @param array $attributes Additional attributes */ public function __construct($name, array $subNodes = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false; $this->name = $name; $this->params = isset($subNodes['params']) ? $subNodes['params'] : array(); diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php index 21c040f..29fbc48 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php @@ -16,7 +16,7 @@ class Global_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(array $vars, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->vars = $vars; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php index 97c46f9..b087fe0 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php @@ -16,7 +16,7 @@ class Goto_ extends Stmt * @param array $attributes Additional attributes */ public function __construct($name, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->name = $name; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php new file mode 100644 index 0000000..d5f46d0 --- /dev/null +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php @@ -0,0 +1,35 @@ +type = $type; + $this->prefix = $prefix; + $this->uses = $uses; + } + + public function getSubNodeNames() { + return array('type', 'prefix', 'uses'); + } +} diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php index c6c85cf..c33ec9f 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php @@ -16,7 +16,7 @@ class HaltCompiler extends Stmt * @param array $attributes Additional attributes */ public function __construct($remaining, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->remaining = $remaining; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php index 3e11f24..98bda35 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php @@ -26,7 +26,7 @@ class If_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(Node\Expr $cond, array $subNodes = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->cond = $cond; $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); $this->elseifs = isset($subNodes['elseifs']) ? $subNodes['elseifs'] : array(); diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php index 2d0ff98..accebe6 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php @@ -16,7 +16,7 @@ class InlineHTML extends Stmt * @param array $attributes Additional attributes */ public function __construct($value, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->value = $value; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php index e57bac3..cb82480 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php @@ -26,7 +26,7 @@ class Interface_ extends ClassLike * @param array $attributes Additional attributes */ public function __construct($name, array $subNodes = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->name = $name; $this->extends = isset($subNodes['extends']) ? $subNodes['extends'] : array(); $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php index d30acb9..edd0ee9 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php @@ -16,7 +16,7 @@ class Label extends Stmt * @param array $attributes Additional attributes */ public function __construct($name, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->name = $name; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php index f08f4f3..fa23121 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php @@ -26,7 +26,7 @@ class Namespace_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(Node\Name $name = null, $stmts = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->name = $name; $this->stmts = $stmts; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php new file mode 100644 index 0000000..270dd09 --- /dev/null +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php @@ -0,0 +1,13 @@ +type = $type; $this->props = $props; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php index f9748aa..b2d29dc 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php @@ -19,7 +19,7 @@ class PropertyProperty extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct($name, Node\Expr $default = null, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->name = $name; $this->default = $default; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php index 67b139b..b642841 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php @@ -16,7 +16,7 @@ class Return_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(Node\Expr $expr = null, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php index aab5174..4bc5dd2 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php @@ -19,7 +19,7 @@ class StaticVar extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct($name, Node\Expr $default = null, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->name = $name; $this->default = $default; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php index 49a3f70..37cc0b3 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php @@ -16,7 +16,7 @@ class Static_ extends Stmt * @param array $attributes Additional attributes */ public function __construct(array $vars, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->vars = $vars; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php index 7a7ec92..72d667b 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php @@ -19,7 +19,7 @@ class Switch_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(Node\Expr $cond, array $cases, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->cond = $cond; $this->cases = $cases; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php index 3e21986..f8ff6aa 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php @@ -16,7 +16,7 @@ class Throw_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(Node\Expr $expr, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->expr = $expr; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php index b38f122..a29874b 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php @@ -20,7 +20,7 @@ class TraitUse extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(array $traits, array $adaptations = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->traits = $traits; $this->adaptations = $adaptations; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php index 62811db..e9b5065 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php @@ -21,7 +21,7 @@ class Alias extends Node\Stmt\TraitUseAdaptation * @param array $attributes Additional attributes */ public function __construct($trait, $method, $newModifier, $newName, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->trait = $trait; $this->method = $method; $this->newModifier = $newModifier; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php index b30c4f8..1f6bc1f 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php @@ -18,7 +18,7 @@ class Precedence extends Node\Stmt\TraitUseAdaptation * @param array $attributes Additional attributes */ public function __construct(Node\Name $trait, $method, array $insteadof, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->trait = $trait; $this->method = $method; $this->insteadof = $insteadof; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php index b96395b..356039f 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php @@ -14,7 +14,7 @@ class Trait_ extends ClassLike * @param array $attributes Additional attributes */ public function __construct($name, array $stmts = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->name = $name; $this->stmts = $stmts; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php index e3c1782..f6d2c84 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php @@ -27,7 +27,7 @@ public function __construct(array $stmts, array $catches, array $finallyStmts = throw new Error('Cannot use try without catch or finally'); } - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->stmts = $stmts; $this->catches = $catches; $this->finallyStmts = $finallyStmts; diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php index 035d0bd..0f00fe9 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php @@ -16,7 +16,7 @@ class Unset_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(array $vars, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->vars = $vars; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php index d163c2f..2508f18 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php @@ -7,6 +7,8 @@ class UseUse extends Node\Stmt { + /** @var int One of the Stmt\Use_::TYPE_* constants. Will only differ from TYPE_UNKNOWN for mixed group uses */ + public $type; /** @var Node\Name Namespace, class, function or constant to alias */ public $name; /** @var string Alias */ @@ -17,9 +19,10 @@ class UseUse extends Node\Stmt * * @param Node\Name $name Namespace/Class to alias * @param null|string $alias Alias + * @param int $type Type of the use element (for mixed group use declarations only) * @param array $attributes Additional attributes */ - public function __construct(Node\Name $name, $alias = null, array $attributes = array()) { + public function __construct(Node\Name $name, $alias = null, $type = Use_::TYPE_UNKNOWN, array $attributes = array()) { if (null === $alias) { $alias = $name->getLast(); } @@ -31,12 +34,13 @@ public function __construct(Node\Name $name, $alias = null, array $attributes = )); } - parent::__construct(null, $attributes); + parent::__construct($attributes); + $this->type = $type; $this->name = $name; $this->alias = $alias; } public function getSubNodeNames() { - return array('name', 'alias'); + return array('type', 'name', 'alias'); } } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php index 25ef577..6c89ebb 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php @@ -6,8 +6,17 @@ class Use_ extends Stmt { - const TYPE_NORMAL = 1; + /** + * Unknown type. Both Stmt\Use_ / Stmt\GroupUse and Stmt\UseUse have a $type property, one of them will always be + * TYPE_UNKNOWN while the other has one of the three other possible types. For normal use statements the type on the + * Stmt\UseUse is unknown. It's only the other way around for mixed group use declarations. + */ + const TYPE_UNKNOWN = 0; + /** Class or namespace import */ + const TYPE_NORMAL = 1; + /** Function import */ const TYPE_FUNCTION = 2; + /** Constant import */ const TYPE_CONSTANT = 3; /** @var int Type of alias */ @@ -23,7 +32,7 @@ class Use_ extends Stmt * @param array $attributes Additional attributes */ public function __construct(array $uses, $type = self::TYPE_NORMAL, array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->type = $type; $this->uses = $uses; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php index 7ca10e2..afad1b2 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php @@ -19,7 +19,7 @@ class While_ extends Node\Stmt * @param array $attributes Additional attributes */ public function __construct(Node\Expr $cond, array $stmts = array(), array $attributes = array()) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->cond = $cond; $this->stmts = $stmts; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php b/application/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php index 8940e2d..ab09bf9 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php @@ -4,30 +4,15 @@ abstract class NodeAbstract implements Node { - private $subNodeNames; protected $attributes; /** * Creates a Node. * - * If null is passed for the $subNodes parameter the node constructor must assign - * all subnodes by itself and also override the getSubNodeNames() method. - * DEPRECATED: If an array is passed as $subNodes instead, the properties corresponding - * to the array keys will be set and getSubNodeNames() will return the keys of that - * array. - * - * @param null|array $subNodes Null or an array of sub nodes (deprecated) - * @param array $attributes Array of attributes + * @param array $attributes Array of attributes */ - public function __construct($subNodes = array(), array $attributes = array()) { + public function __construct(array $attributes = array()) { $this->attributes = $attributes; - - if (null !== $subNodes) { - foreach ($subNodes as $name => $value) { - $this->$name = $value; - } - $this->subNodeNames = array_keys($subNodes); - } } /** @@ -39,15 +24,6 @@ public function getType() { return strtr(substr(rtrim(get_class($this), '_'), 15), '\\', '_'); } - /** - * Gets the names of the sub nodes. - * - * @return array Names of sub nodes - */ - public function getSubNodeNames() { - return $this->subNodeNames; - } - /** * Gets line the node started in. * @@ -87,23 +63,14 @@ public function getDocComment() { return $lastComment; } - /** - * {@inheritDoc} - */ public function setAttribute($key, $value) { $this->attributes[$key] = $value; } - /** - * {@inheritDoc} - */ public function hasAttribute($key) { return array_key_exists($key, $this->attributes); } - /** - * {@inheritDoc} - */ public function &getAttribute($key, $default = null) { if (!array_key_exists($key, $this->attributes)) { return $default; @@ -112,9 +79,6 @@ public function &getAttribute($key, $default = null) { } } - /** - * {@inheritDoc} - */ public function getAttributes() { return $this->attributes; } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php b/application/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php index 57a6fe7..b931ada 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php @@ -4,6 +4,18 @@ class NodeDumper { + private $dumpComments; + + /** + * Constructs a NodeDumper. + * + * @param array $options Boolean option 'dumpComments' controls whether comments should be + * dumped + */ + public function __construct(array $options = []) { + $this->dumpComments = !empty($options['dumpComments']); + } + /** * Dumps a node or array. * @@ -31,6 +43,10 @@ public function dump($node) { $r .= str_replace("\n", "\n ", $this->dump($value)); } } + + if ($this->dumpComments && $comments = $node->getAttribute('comments')) { + $r .= "\n comments: " . str_replace("\n", "\n ", $this->dump($comments)); + } } elseif (is_array($node)) { $r = 'array('; @@ -49,6 +65,8 @@ public function dump($node) { $r .= str_replace("\n", "\n ", $this->dump($value)); } } + } elseif ($node instanceof Comment) { + return $node->getReformattedText(); } else { throw new \InvalidArgumentException('Can only dump nodes and arrays.'); } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php b/application/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php index ba6857b..1523e31 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php @@ -19,7 +19,7 @@ class NodeTraverser implements NodeTraverserInterface * * @param bool $cloneNodes Should the traverser clone the nodes when traversing the AST */ - public function __construct($cloneNodes = true) { + public function __construct($cloneNodes = false) { $this->visitors = array(); $this->cloneNodes = $cloneNodes; } @@ -99,6 +99,12 @@ protected function traverseNode(Node $node) { foreach ($this->visitors as $visitor) { if (null !== $return = $visitor->leaveNode($subNode)) { + if (is_array($return)) { + throw new \LogicException( + 'leaveNode() may only return an array ' . + 'if the parent structure is an array' + ); + } $subNode = $return; } } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php b/application/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php index d18e5ff..b381d9f 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php @@ -6,6 +6,7 @@ use PhpParser\Error; use PhpParser\Node; use PhpParser\Node\Name; +use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Expr; use PhpParser\Node\Stmt; @@ -26,7 +27,11 @@ public function enterNode(Node $node) { $this->resetState($node->name); } elseif ($node instanceof Stmt\Use_) { foreach ($node->uses as $use) { - $this->addAlias($use, $node->type); + $this->addAlias($use, $node->type, null); + } + } elseif ($node instanceof Stmt\GroupUse) { + foreach ($node->uses as $use) { + $this->addAlias($use, $node->type, $node->prefix); } } elseif ($node instanceof Stmt\Class_) { if (null !== $node->extends) { @@ -105,7 +110,12 @@ protected function resetState(Name $namespace = null) { ); } - protected function addAlias(Stmt\UseUse $use, $type) { + protected function addAlias(Stmt\UseUse $use, $type, Name $prefix = null) { + // Add prefix for group uses + $name = $prefix ? Name::concat($prefix, $use->name) : $use->name; + // Type is determined either by individual element or whole use declaration + $type |= $use->type; + // Constant names are case sensitive, everything else case insensitive if ($type === Stmt\Use_::TYPE_CONSTANT) { $aliasName = $use->alias; @@ -123,13 +133,13 @@ protected function addAlias(Stmt\UseUse $use, $type) { throw new Error( sprintf( 'Cannot use %s%s as %s because the name is already in use', - $typeStringMap[$type], $use->name, $use->alias + $typeStringMap[$type], $name, $use->alias ), $use->getLine() ); } - $this->aliases[$type][$aliasName] = $use->name; + $this->aliases[$type][$aliasName] = $name; } /** @param Stmt\Function_|Stmt\ClassMethod|Expr\Closure $node */ @@ -165,13 +175,16 @@ protected function resolveClassName(Name $name) { $aliasName = strtolower($name->getFirst()); if (!$name->isRelative() && isset($this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName])) { // resolve aliases (for non-relative names) - $name->setFirst($this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName]); - } elseif (null !== $this->namespace) { + $alias = $this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName]; + return FullyQualified::concat($alias, $name->slice(1), $name->getAttributes()); + } + + if (null !== $this->namespace) { // if no alias exists prepend current namespace - $name->prepend($this->namespace); + return FullyQualified::concat($this->namespace, $name, $name->getAttributes()); } - return new Name\FullyQualified($name->parts, $name->getAttributes()); + return new FullyQualified($name->parts, $name->getAttributes()); } protected function resolveOtherName(Name $name, $type) { @@ -183,34 +196,38 @@ protected function resolveOtherName(Name $name, $type) { // resolve aliases for qualified names $aliasName = strtolower($name->getFirst()); if ($name->isQualified() && isset($this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName])) { - $name->setFirst($this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName]); - } elseif ($name->isUnqualified()) { + $alias = $this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName]; + return FullyQualified::concat($alias, $name->slice(1), $name->getAttributes()); + } + + if ($name->isUnqualified()) { if ($type === Stmt\Use_::TYPE_CONSTANT) { // constant aliases are case-sensitive, function aliases case-insensitive $aliasName = $name->getFirst(); } - if (isset($this->aliases[$type][$aliasName])) { - // resolve unqualified aliases - $name->set($this->aliases[$type][$aliasName]); - } else { + if (!isset($this->aliases[$type][$aliasName])) { // unqualified, unaliased names cannot be resolved at compile-time return $name; } - } elseif (null !== $this->namespace) { + + // resolve unqualified aliases + return new FullyQualified($this->aliases[$type][$aliasName], $name->getAttributes()); + } + + if (null !== $this->namespace) { // if no alias exists prepend current namespace - $name->prepend($this->namespace); + return FullyQualified::concat($this->namespace, $name, $name->getAttributes()); } - return new Name\FullyQualified($name->parts, $name->getAttributes()); + return new FullyQualified($name->parts, $name->getAttributes()); } protected function addNamespacedName(Node $node) { if (null !== $this->namespace) { - $node->namespacedName = clone $this->namespace; - $node->namespacedName->append($node->name); + $node->namespacedName = Name::concat($this->namespace, $node->name); } else { - $node->namespacedName = new Name($node->name, $node->getAttributes()); + $node->namespacedName = new Name($node->name); } } } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Parser.php b/application/vendor/nikic/php-parser/lib/PhpParser/Parser.php index 6408fbe..67913c9 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/Parser.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Parser.php @@ -2,2857 +2,23 @@ namespace PhpParser; -use PhpParser\Node\Expr; -use PhpParser\Node\Name; -use PhpParser\Node\Scalar; -use PhpParser\Node\Stmt; - -/* This is an automatically GENERATED file, which should not be manually edited. - * Instead edit one of the following: - * * the grammar file grammar/zend_language_parser.phpy - * * the skeleton file grammar/kymacc.php.parser - * * the preprocessing script grammar/rebuildParser.php - */ -class Parser extends ParserAbstract -{ - protected $tokenToSymbolMapSize = 392; - protected $actionTableSize = 1186; - protected $gotoTableSize = 591; - - protected $invalidSymbol = 157; - protected $errorSymbol = 1; - protected $defaultAction = -32766; - protected $unexpectedTokenRule = 32767; - - protected $YY2TBLSTATE = 409; - protected $YYNLSTATES = 646; - - const YYERRTOK = 256; - const T_INCLUDE = 257; - const T_INCLUDE_ONCE = 258; - const T_EVAL = 259; - const T_REQUIRE = 260; - const T_REQUIRE_ONCE = 261; - const T_LOGICAL_OR = 262; - const T_LOGICAL_XOR = 263; - const T_LOGICAL_AND = 264; - const T_PRINT = 265; - const T_YIELD = 266; - const T_YIELD_FROM = 267; - const T_PLUS_EQUAL = 268; - const T_MINUS_EQUAL = 269; - const T_MUL_EQUAL = 270; - const T_DIV_EQUAL = 271; - const T_CONCAT_EQUAL = 272; - const T_MOD_EQUAL = 273; - const T_AND_EQUAL = 274; - const T_OR_EQUAL = 275; - const T_XOR_EQUAL = 276; - const T_SL_EQUAL = 277; - const T_SR_EQUAL = 278; - const T_POW_EQUAL = 279; - const T_COALESCE = 280; - const T_BOOLEAN_OR = 281; - const T_BOOLEAN_AND = 282; - const T_IS_EQUAL = 283; - const T_IS_NOT_EQUAL = 284; - const T_IS_IDENTICAL = 285; - const T_IS_NOT_IDENTICAL = 286; - const T_SPACESHIP = 287; - const T_IS_SMALLER_OR_EQUAL = 288; - const T_IS_GREATER_OR_EQUAL = 289; - const T_SL = 290; - const T_SR = 291; - const T_INSTANCEOF = 292; - const T_INC = 293; - const T_DEC = 294; - const T_INT_CAST = 295; - const T_DOUBLE_CAST = 296; - const T_STRING_CAST = 297; - const T_ARRAY_CAST = 298; - const T_OBJECT_CAST = 299; - const T_BOOL_CAST = 300; - const T_UNSET_CAST = 301; - const T_POW = 302; - const T_NEW = 303; - const T_CLONE = 304; - const T_EXIT = 305; - const T_IF = 306; - const T_ELSEIF = 307; - const T_ELSE = 308; - const T_ENDIF = 309; - const T_LNUMBER = 310; - const T_DNUMBER = 311; - const T_STRING = 312; - const T_STRING_VARNAME = 313; - const T_VARIABLE = 314; - const T_NUM_STRING = 315; - const T_INLINE_HTML = 316; - const T_CHARACTER = 317; - const T_BAD_CHARACTER = 318; - const T_ENCAPSED_AND_WHITESPACE = 319; - const T_CONSTANT_ENCAPSED_STRING = 320; - const T_ECHO = 321; - const T_DO = 322; - const T_WHILE = 323; - const T_ENDWHILE = 324; - const T_FOR = 325; - const T_ENDFOR = 326; - const T_FOREACH = 327; - const T_ENDFOREACH = 328; - const T_DECLARE = 329; - const T_ENDDECLARE = 330; - const T_AS = 331; - const T_SWITCH = 332; - const T_ENDSWITCH = 333; - const T_CASE = 334; - const T_DEFAULT = 335; - const T_BREAK = 336; - const T_CONTINUE = 337; - const T_GOTO = 338; - const T_FUNCTION = 339; - const T_CONST = 340; - const T_RETURN = 341; - const T_TRY = 342; - const T_CATCH = 343; - const T_FINALLY = 344; - const T_THROW = 345; - const T_USE = 346; - const T_INSTEADOF = 347; - const T_GLOBAL = 348; - const T_STATIC = 349; - const T_ABSTRACT = 350; - const T_FINAL = 351; - const T_PRIVATE = 352; - const T_PROTECTED = 353; - const T_PUBLIC = 354; - const T_VAR = 355; - const T_UNSET = 356; - const T_ISSET = 357; - const T_EMPTY = 358; - const T_HALT_COMPILER = 359; - const T_CLASS = 360; - const T_TRAIT = 361; - const T_INTERFACE = 362; - const T_EXTENDS = 363; - const T_IMPLEMENTS = 364; - const T_OBJECT_OPERATOR = 365; - const T_DOUBLE_ARROW = 366; - const T_LIST = 367; - const T_ARRAY = 368; - const T_CALLABLE = 369; - const T_CLASS_C = 370; - const T_TRAIT_C = 371; - const T_METHOD_C = 372; - const T_FUNC_C = 373; - const T_LINE = 374; - const T_FILE = 375; - const T_COMMENT = 376; - const T_DOC_COMMENT = 377; - const T_OPEN_TAG = 378; - const T_OPEN_TAG_WITH_ECHO = 379; - const T_CLOSE_TAG = 380; - const T_WHITESPACE = 381; - const T_START_HEREDOC = 382; - const T_END_HEREDOC = 383; - const T_DOLLAR_OPEN_CURLY_BRACES = 384; - const T_CURLY_OPEN = 385; - const T_PAAMAYIM_NEKUDOTAYIM = 386; - const T_NAMESPACE = 387; - const T_NS_C = 388; - const T_DIR = 389; - const T_NS_SEPARATOR = 390; - const T_ELLIPSIS = 391; - - protected $symbolToName = array( - "EOF", - "error", - "T_INCLUDE", - "T_INCLUDE_ONCE", - "T_EVAL", - "T_REQUIRE", - "T_REQUIRE_ONCE", - "','", - "T_LOGICAL_OR", - "T_LOGICAL_XOR", - "T_LOGICAL_AND", - "T_PRINT", - "T_YIELD", - "T_YIELD_FROM", - "'='", - "T_PLUS_EQUAL", - "T_MINUS_EQUAL", - "T_MUL_EQUAL", - "T_DIV_EQUAL", - "T_CONCAT_EQUAL", - "T_MOD_EQUAL", - "T_AND_EQUAL", - "T_OR_EQUAL", - "T_XOR_EQUAL", - "T_SL_EQUAL", - "T_SR_EQUAL", - "T_POW_EQUAL", - "'?'", - "':'", - "T_COALESCE", - "T_BOOLEAN_OR", - "T_BOOLEAN_AND", - "'|'", - "'^'", - "'&'", - "T_IS_EQUAL", - "T_IS_NOT_EQUAL", - "T_IS_IDENTICAL", - "T_IS_NOT_IDENTICAL", - "T_SPACESHIP", - "'<'", - "T_IS_SMALLER_OR_EQUAL", - "'>'", - "T_IS_GREATER_OR_EQUAL", - "T_SL", - "T_SR", - "'+'", - "'-'", - "'.'", - "'*'", - "'/'", - "'%'", - "'!'", - "T_INSTANCEOF", - "'~'", - "T_INC", - "T_DEC", - "T_INT_CAST", - "T_DOUBLE_CAST", - "T_STRING_CAST", - "T_ARRAY_CAST", - "T_OBJECT_CAST", - "T_BOOL_CAST", - "T_UNSET_CAST", - "'@'", - "T_POW", - "'['", - "T_NEW", - "T_CLONE", - "T_EXIT", - "T_IF", - "T_ELSEIF", - "T_ELSE", - "T_ENDIF", - "T_LNUMBER", - "T_DNUMBER", - "T_STRING", - "T_STRING_VARNAME", - "T_VARIABLE", - "T_NUM_STRING", - "T_INLINE_HTML", - "T_ENCAPSED_AND_WHITESPACE", - "T_CONSTANT_ENCAPSED_STRING", - "T_ECHO", - "T_DO", - "T_WHILE", - "T_ENDWHILE", - "T_FOR", - "T_ENDFOR", - "T_FOREACH", - "T_ENDFOREACH", - "T_DECLARE", - "T_ENDDECLARE", - "T_AS", - "T_SWITCH", - "T_ENDSWITCH", - "T_CASE", - "T_DEFAULT", - "T_BREAK", - "T_CONTINUE", - "T_GOTO", - "T_FUNCTION", - "T_CONST", - "T_RETURN", - "T_TRY", - "T_CATCH", - "T_FINALLY", - "T_THROW", - "T_USE", - "T_INSTEADOF", - "T_GLOBAL", - "T_STATIC", - "T_ABSTRACT", - "T_FINAL", - "T_PRIVATE", - "T_PROTECTED", - "T_PUBLIC", - "T_VAR", - "T_UNSET", - "T_ISSET", - "T_EMPTY", - "T_HALT_COMPILER", - "T_CLASS", - "T_TRAIT", - "T_INTERFACE", - "T_EXTENDS", - "T_IMPLEMENTS", - "T_OBJECT_OPERATOR", - "T_DOUBLE_ARROW", - "T_LIST", - "T_ARRAY", - "T_CALLABLE", - "T_CLASS_C", - "T_TRAIT_C", - "T_METHOD_C", - "T_FUNC_C", - "T_LINE", - "T_FILE", - "T_START_HEREDOC", - "T_END_HEREDOC", - "T_DOLLAR_OPEN_CURLY_BRACES", - "T_CURLY_OPEN", - "T_PAAMAYIM_NEKUDOTAYIM", - "T_NAMESPACE", - "T_NS_C", - "T_DIR", - "T_NS_SEPARATOR", - "T_ELLIPSIS", - "';'", - "'{'", - "'}'", - "'('", - "')'", - "'$'", - "'`'", - "']'", - "'\"'" - ); - - protected $tokenToSymbol = array( - 0, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 52, 156, 157, 153, 51, 34, 157, - 151, 152, 49, 46, 7, 47, 48, 50, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 28, 148, - 40, 14, 42, 27, 64, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 66, 157, 155, 33, 157, 154, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 149, 32, 150, 54, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 1, 2, 3, 4, - 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 29, 30, 31, 35, 36, 37, 38, 39, 41, 43, - 44, 45, 53, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 65, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 157, 157, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 157, 157, 157, 157, - 157, 157, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147 - ); - - protected $action = array( - 707, 60, 61, 420, 62, 63,-32766,-32766,-32766,-32766, - 64, 65, 66, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 0, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243,-32766,-32766,-32766,-32766,-32766, - -32767,-32767,-32767,-32767, 650, 67, 68, 58, 244, 245, - 129, 69, 460, 70, 297, 298, 71, 72, 73, 74, - 75, 76, 77, 78,-32766, 32, 305, 79, 411, 421, - -32766,-32766,-32766, 968, 969, 463, -118, 1061, 413, 696, - 447, 464, 46, 27, 422, 366, 465, 438, 466,-32766, - 467,-32766,-32766, 423, 220, 221, 222, 36, 37, 468, - 424, 441, 38, 469, 221, 222, 80,-32766, 329, 359, - 360, 491, 751, 207, 425, 470, 471, 472, 473, 474, - 608,-32766, 207, 55, 678, 723, 475, 476, 477, 478, - 128, 974, 975, 976, 977, 971, 972, 315, 84, 85, - 86, 419, 491, 978, 973, 425, 440, 702, 618, 635, - 47, 135, 340, 327, 301, 331, 443, 40, 313, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 31, 308,-32766,-32766,-32766,-32766,-32766, 288, - -32766, 775, 776, 800, 805, 110, 650, 220, 221, 222, - -32766,-32766, 1027,-32766,-32766,-32766, 125,-32766, 439,-32766, - 569,-32766, 917, -123,-32766, 286, 207, 35,-32766,-32766, - -32766, 428, 428,-32766,-32766, 22, 693,-32766, 211, 133, - -32766, 490, 752,-32766, 301, 1090, 470, 471,-32766, -119, - 342, 1018, 694, 378, 917, 678, 723, 475, 476, 616, - 791, 41, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122,-32766,-32766,-32766, 132,-32766,-32766, - -32766, 1093, 781, 1095, 1094,-32766, 650, 220, 221, 222, - -32766,-32766, 57,-32766,-32766,-32766, 935,-32766, 54,-32766, - -32766,-32766, 856, 858,-32766, 358, 207, 248,-32766,-32766, - -32766, 428,-32766,-32766,-32766, 39, 300,-32766, 650, 388, - -32766, 490,-32766,-32766, 304,-32766,-32766,-32766,-32766,-32766, - 630,-32766, 617,-32766, 917, 290,-32766, 782, 356, 357, - -32766,-32766,-32766, 428, 1068,-32766,-32766, 434, 207,-32766, - 620, 1019,-32766, 490, 621,-32766, 302, 132,-32766,-32766, - -32766, 212, 606, 241, 242, 243, 917, 412,-32766,-32766, - -32766, 642, 1055, 326, -401, 126, 623, 470, 471, 244, - 245, 124, 131, 416, 470, 471, 656, 723, 475, 476, - -32766,-32766,-32766, 678, 723, 475, 476, 222, 650,-32766, - -32766,-32766,-32766, 428, 810,-32766,-32766,-32766, 339,-32766, - 303,-32766, -171,-32766, 207, 659,-32766, 1026,-32766, 477, - -32766,-32766,-32766, 428,-32766,-32766,-32766, 428, 445,-32766, - 650, 213,-32766, 490,-32766,-32766,-32766,-32766,-32766,-32766, - -32766,-32766,-32766,-32766, 428,-32766, 917, 348,-32766, 428, - 1083,-32766,-32766,-32766,-32766, 428, 1061,-32766,-32766,-32766, - -32766,-32766,-32766, 1027,-32766, 490, 1065,-32766, 289, 332, - -32766,-32766,-32766, 1083, 214,-32766,-32766,-32766, 917,-32766, - -32766,-32766,-32766,-32766,-32766,-32766,-32766,-32766, 249,-32767, - -32767,-32767,-32767, 347,-32766, 123,-32766,-32766,-32766,-32766, - 299, 133,-32766,-32766,-32766, 220, 221, 222, 1025, 250, - 650, 220, 221, 222,-32766,-32766,-32766,-32766,-32766,-32766, - -32766,-32766, 137,-32766, 207,-32766, 566, 980,-32766, 634, - 207, 340,-32766,-32766,-32766, 428,-32766,-32766,-32766, 134, - 575,-32766, 650, 314,-32766, 490,-32766, 716, 1024,-32766, - -32766,-32766,-32766,-32766, 538,-32766, 706,-32766, 244, 245, - -32766, 454, 581,-32766,-32766,-32766,-32766, 428, 639,-32766, - -32766, 449, 28,-32766, 917, 136,-32766, 490, 238, 239, - 240, 110,-32766,-32766,-32766, 104, 105, 106, 308,-32766, - 138, 367, 588, 589, 593, 650, 804, 638, 980,-32766, - 615, 305,-32766,-32766,-32766, 346,-32766, 52,-32766, 650, - -32766, 1061, 50,-32766,-32766,-32766,-32766,-32766,-32766,-32766, - 428, 59,-32766,-32766, 470, 471,-32766, 917, 605,-32766, - 490, 246,-32766, 678, 723, 475, 476,-32766, 650, 107, - 108, 109,-32766, 308, 945,-32766,-32766,-32766,-32766,-32766, - 56,-32766, 49,-32766, 51, 110,-32766, 775, 776, 917, - -32766,-32766,-32766, 428, 53,-32766,-32766,-32766,-32766,-32766, - 529, 961,-32766, 490, 657, 625, 491, 815, 645, 425, - -32766, 528, 516, 512, 429,-32766, 340, 511, 435, 651, - 433, 650, 667, 650, 1088,-32766, 669, 812,-32766,-32766, - -32766,-32766,-32766, 600,-32766, 938,-32766, 515, 607,-32766, - 686,-32766, 917,-32766,-32766,-32766, 428,-32766,-32766,-32766, - 590, 345,-32766, 650, 1083,-32766, 490,-32766, 559, 437, - -32766,-32766,-32766,-32766,-32766, 458,-32766,-32766,-32766, -168, - 584,-32766, 307, 285, 531,-32766,-32766,-32766, 428, 572, - -32766,-32766, 336, 432,-32766, 725, 428,-32766, 490, 724, - 42, 585, 979, 688,-32766,-32766, 338, 127, 330, 718, - -32766, 23, 811, 341, 521, 0, 650, 434, -308, 0, - -32766, 335, 0,-32766,-32766,-32766, -402,-32766, -401,-32766, - 328,-32766, 915, 477,-32766, 690,-32766, 0,-32766,-32766, - -32766, 428, 318,-32766,-32766, 0,-32766,-32766, -300, 613, - -32766, 490, 650, -309, 381, 368,-32766, 334,-32766,-32766, - -32766,-32766, 416,-32766, 1056,-32766, 247,-32766, 809, 745, - -32766, 735, 746, 698,-32766,-32766,-32766, 428, 801,-32766, - -32766, 683, 663,-32766, 215, 216,-32766, 490,-32766,-32766, - 217, 662, 218, 681,-32766,-32767,-32767,-32767,-32767, 102, - 103, 104, 105, 106, 209, 754, 661, -1, 660, 215, - 216, 705, 968, 969, 692, 217,-32766, 218, 808, 627, - 970,-32766,-32766,-32766,-32766,-32766, 626, 737, 739, 209, - -32766,-32766,-32766, 704, 691, 695, 689, 968, 969, 687, - -32766,-32766,-32766,-32766,-32766, 970, 697, 44, 45,-32766, - 643,-32766,-32766,-32766,-32766,-32766,-32766,-32767,-32767,-32767, - -32767,-32767, 644, 640, 637, 632, 631, 629, 556, 624, - 974, 975, 976, 977, 971, 972, 394, 619, 83, 130, - 641, 591, 978, 973, 1066, 793, 959, 1058, 1040, 219, - 1046,-32766, 1060, 556, 1062, 974, 975, 976, 977, 971, - 972, 394, 1089, 453, 722, 985, 720, 978, 973, 412, - 721, 1092, 931, 1087, 219, 326,-32766, 1091, 744, 470, - 471, 743, 921, 470, 471, -104, -104, -104, 656, 723, - 475, 476, 678, 723, 475, 476, 470, 471, -103, -103, - -103, 43, 470, 471, 34, 678, 723, 475, 476, 415, - 339, 678, 723, 475, 476, 470, 471, 30, 958, 33, - -32766, 719, 412, 410, 678, 723, 475, 476, 326, 343, - 312, 311, 470, 471, 816,-32766,-32766,-32766, 310, 309, - -104, 656, 723, 475, 476, -112, -112, -112, 296, -114, - -114, -114, 295, -103,-32766, 287,-32766,-32766,-32766,-32766, - -32766,-32766, 417, 339, 210, 82, 81, 48, 337, 896, - 658, 826, 827, 828, 825, 824, 823, 818, 560, 984, - 783, 925, 922, 612, 551, 461, 470, 471, 457, 455, - 470, 471,-32766,-32766,-32766, 678, 723, 475, 476, 678, - 723, 475, 476, 897, 450, 389, 25, 24, -120, 470, - 471,-32766, 1057,-32766,-32766,-32766,-32766,-32766, 678, 723, - 475, 476, 470, 471, -119, 1041, 470, 471, 1045, 0, - 1059, 678, 723, 475, 476, 678, 723, 475, 476, 944, - 470, 471, 597, 929, 470, 471, 930, 710, 927, 678, - 723, 475, 476, 678, 723, 475, 476, 470, 471, 928, - 628, 926, 470, 471, 679, 0, 678, 723, 475, 476, - 0, 678, 723, 475, 476, 0, 0, 0, 712, 0, - 0, 0, 919, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 920 - ); - - protected $actionCheck = array( - 1, 2, 3, 4, 5, 6, 30, 31, 32, 33, - 11, 12, 13, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 0, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 76, 46, 47, 66, 65, 66, - 7, 52, 7, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 8, 66, 67, 68, 69, 70, - 8, 9, 10, 74, 75, 76, 73, 78, 122, 80, - 7, 82, 83, 84, 85, 7, 87, 28, 89, 27, - 91, 29, 30, 94, 8, 9, 10, 98, 99, 100, - 101, 7, 103, 104, 9, 10, 107, 151, 127, 110, - 111, 143, 28, 27, 146, 112, 113, 118, 119, 120, - 76, 1, 27, 66, 121, 122, 123, 124, 129, 130, - 149, 132, 133, 134, 135, 136, 137, 138, 8, 9, - 10, 7, 143, 144, 145, 146, 7, 148, 149, 28, - 151, 66, 153, 154, 34, 156, 76, 27, 7, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 7, 53, 30, 31, 32, 33, 34, 7, - 70, 130, 131, 148, 150, 65, 76, 8, 9, 10, - 80, 1, 122, 83, 84, 85, 149, 87, 149, 89, - 86, 91, 12, 152, 94, 128, 27, 7, 98, 99, - 100, 101, 101, 103, 104, 152, 148, 107, 7, 149, - 110, 111, 148, 1, 34, 150, 112, 113, 118, 152, - 7, 155, 148, 78, 12, 121, 122, 123, 124, 76, - 78, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 8, 9, 10, 147, 148, 149, - 70, 76, 152, 78, 79, 102, 76, 8, 9, 10, - 80, 108, 66, 83, 84, 85, 152, 87, 66, 89, - 117, 91, 55, 56, 94, 7, 27, 28, 98, 99, - 100, 101, 70, 103, 104, 140, 141, 107, 76, 77, - 110, 111, 80, 1, 34, 83, 84, 85, 118, 87, - 28, 89, 76, 91, 12, 153, 94, 152, 101, 102, - 98, 99, 100, 101, 152, 103, 104, 146, 27, 107, - 149, 152, 110, 111, 28, 1, 34, 147, 148, 149, - 118, 14, 90, 49, 50, 51, 12, 102, 30, 31, - 32, 28, 78, 108, 127, 149, 28, 112, 113, 65, - 66, 149, 28, 146, 112, 113, 121, 122, 123, 124, - 148, 149, 70, 121, 122, 123, 124, 10, 76, 8, - 9, 10, 80, 101, 148, 83, 84, 85, 143, 87, - 7, 89, 78, 91, 27, 150, 94, 76, 27, 129, - 98, 99, 100, 101, 70, 103, 104, 101, 76, 107, - 76, 14, 110, 111, 80, 1, 102, 83, 84, 85, - 118, 87, 108, 89, 101, 91, 12, 153, 94, 101, - 81, 117, 98, 99, 100, 101, 78, 103, 104, 8, - 9, 107, 30, 122, 110, 111, 76, 1, 34, 81, - 148, 149, 118, 81, 14, 8, 9, 10, 12, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 14, 40, - 41, 42, 43, 66, 27, 14, 29, 30, 31, 32, - 34, 149, 148, 149, 70, 8, 9, 10, 139, 14, - 76, 8, 9, 10, 80, 30, 31, 83, 84, 85, - 1, 87, 149, 89, 27, 91, 153, 139, 94, 28, - 27, 153, 98, 99, 100, 101, 70, 103, 104, 149, - 81, 107, 76, 28, 110, 111, 80, 34, 156, 83, - 84, 85, 118, 87, 127, 89, 28, 91, 65, 66, - 94, 71, 72, 1, 98, 99, 100, 101, 28, 103, - 104, 71, 72, 107, 12, 28, 110, 111, 46, 47, - 48, 65, 148, 149, 118, 46, 47, 48, 53, 70, - 96, 97, 105, 106, 73, 76, 148, 149, 139, 80, - 88, 67, 83, 84, 85, 81, 87, 66, 89, 76, - 91, 78, 66, 94, 148, 149, 1, 98, 99, 100, - 101, 66, 103, 104, 112, 113, 107, 12, 76, 110, - 111, 128, 70, 121, 122, 123, 124, 118, 76, 49, - 50, 51, 80, 53, 111, 83, 84, 85, 1, 87, - 66, 89, 66, 91, 66, 65, 94, 130, 131, 12, - 98, 99, 100, 101, 66, 103, 104, 148, 149, 107, - 76, 152, 110, 111, 148, 149, 143, 148, 149, 146, - 118, 76, 76, 76, 151, 70, 153, 76, 76, 76, - 76, 76, 76, 76, 76, 80, 76, 76, 83, 84, - 85, 1, 87, 78, 89, 78, 91, 78, 78, 94, - 148, 149, 12, 98, 99, 100, 101, 70, 103, 104, - 78, 81, 107, 76, 81, 110, 111, 80, 93, 85, - 83, 84, 85, 118, 87, 101, 89, 1, 91, 93, - 95, 94, 93, 93, 93, 98, 99, 100, 101, 95, - 103, 104, 126, 101, 107, 122, 101, 110, 111, 122, - 128, 108, 139, 148, 149, 118, 109, 128, 127, 147, - 70, 152, 148, 125, 146, -1, 76, 146, 142, -1, - 80, 125, -1, 83, 84, 85, 127, 87, 127, 89, - 127, 91, 154, 129, 94, 148, 149, -1, 98, 99, - 100, 101, 142, 103, 104, -1, 70, 107, 142, 142, - 110, 111, 76, 142, 142, 142, 80, 142, 118, 83, - 84, 85, 146, 87, 150, 89, 28, 91, 148, 148, - 94, 148, 148, 148, 98, 99, 100, 101, 148, 103, - 104, 148, 148, 107, 46, 47, 110, 111, 148, 149, - 52, 148, 54, 148, 118, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 66, 148, 148, 0, 148, 46, - 47, 148, 74, 75, 148, 52, 78, 54, 148, 148, - 82, 8, 9, 10, 148, 149, 148, 148, 148, 66, - 8, 9, 10, 148, 148, 148, 148, 74, 75, 148, - 27, 78, 29, 30, 31, 82, 148, 148, 148, 27, - 149, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 149, 149, 149, 149, 149, 149, 130, 149, - 132, 133, 134, 135, 136, 137, 138, 149, 149, 149, - 149, 155, 144, 145, 150, 150, 150, 150, 155, 151, - 150, 153, 150, 130, 150, 132, 133, 134, 135, 136, - 137, 138, 150, 150, 150, 155, 150, 144, 145, 102, - 150, 150, 150, 155, 151, 108, 153, 150, 150, 112, - 113, 150, 152, 112, 113, 95, 96, 97, 121, 122, - 123, 124, 121, 122, 123, 124, 112, 113, 95, 96, - 97, 151, 112, 113, 151, 121, 122, 123, 124, 151, - 143, 121, 122, 123, 124, 112, 113, 151, 155, 151, - 151, 150, 102, 151, 121, 122, 123, 124, 108, 151, - 151, 151, 112, 113, 150, 8, 9, 10, 151, 151, - 150, 121, 122, 123, 124, 71, 72, 73, 151, 71, - 72, 73, 151, 150, 27, 151, 29, 30, 31, 32, - 33, 34, 102, 143, 151, 151, 151, 151, 108, 152, - 150, 111, 112, 113, 114, 115, 116, 117, 152, 152, - 152, 152, 152, 152, 152, 152, 112, 113, 152, 152, - 112, 113, 8, 9, 10, 121, 122, 123, 124, 121, - 122, 123, 124, 152, 152, 152, 152, 152, 152, 112, - 113, 27, 155, 29, 30, 31, 32, 33, 121, 122, - 123, 124, 112, 113, 152, 155, 112, 113, 155, -1, - 155, 121, 122, 123, 124, 121, 122, 123, 124, 155, - 112, 113, 92, 155, 112, 113, 155, 150, 155, 121, - 122, 123, 124, 121, 122, 123, 124, 112, 113, 155, - 150, 155, 112, 113, 150, -1, 121, 122, 123, 124, - -1, 121, 122, 123, 124, -1, -1, -1, 150, -1, - -1, -1, 150, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 150 - ); - - protected $actionBase = array( - 0, 880, 893, 964, 857, 255, 910, 968, 1004, 1000, - 124, 1040, 3, 262, 1018, 861, 1022, 502, 1035, 987, - 874, 338, 292, 121, 333, 121, 316, 645, 645, 645, - 120, 200, 456, 456, 509, 456, 552, 605, 637, 232, - 344, 424, 312, 690, 690, 690, 690, 726, 726, 690, - 690, 690, 690, 690, 690, 690, 690, 690, 690, 690, - 690, 690, 690, 690, 690, 690, 690, 690, 690, 690, - 690, 690, 690, 690, 690, 690, 690, 690, 690, 690, - 690, 690, 690, 690, 690, 690, 690, 690, 690, 690, - 690, 690, 690, 690, 690, 690, 690, 690, 690, 690, - 690, 690, 690, 690, 690, 690, 690, 690, 690, 690, - 690, 690, 690, 690, 690, 690, 690, 690, 690, 690, - 690, 690, 690, 690, 690, 690, 690, 690, 690, 690, - 690, 690, 690, 690, 690, 690, 690, 690, 690, 84, - 748, 629, 622, 741, 738, 736, 735, 820, 640, 941, - 802, 794, 537, 792, 790, 787, 786, 785, 803, 784, - 776, 664, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 56, 493, 189, 269, 86, 441, 487, - 487, 487, 487, 487, 487, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 95, 381, 381, 381, 377, 788, 311, 813, - 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, - 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, - 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, - 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, - 813, 62, -17, -17, 863, 422, 457, 475, 1074, 328, - 1017, 872, 872, 872, 872, 872, -24, 154, 5, 5, - 5, 5, 237, 805, 805, 805, 805, 439, 439, 439, - 439, 804, 810, 806, 812, 280, 280, 654, 654, 524, - 780, 529, 529, 522, 522, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, -44, 324, 173, 859, 61, - 61, 61, 61, 517, 517, 378, 359, 382, 80, 580, - 580, 580, 304, 304, 304, 44, 227, 630, 380, 380, - 380, 514, 613, 633, 342, -32, -32, -32, -32, 191, - 779, -32, -32, -32, 57, 165, 165, 195, 363, 644, - 821, 635, 818, 438, 661, -19, 666, 666, 666, 172, - 642, 490, 480, 477, 656, 59, 172, 84, 331, 519, - 216, 525, 737, 584, 684, 710, 78, 94, 417, 516, - 222, 284, 73, 708, 693, 916, 907, 182, 85, 649, - 525, 525, 525, 175, 449, 222, 87, 483, 483, 483, - 483, 483, 483, 483, 483, 680, 45, 134, 720, 246, - 503, 843, 597, 856, 856, 595, 607, 597, 632, 503, - 906, 906, 906, 906, 503, 607, 856, 856, 503, 524, - 856, 210, 503, 646, 607, 638, 638, 906, 728, 721, - 597, 619, 616, 856, 856, 856, 616, 595, 503, 906, - 643, 612, 221, 856, 906, 505, 505, 643, 503, 505, - 632, 505, 22, 518, 576, 840, 905, 848, 601, 778, - 627, 623, 891, 887, 904, 596, 604, 894, 858, 618, - 716, 602, 471, 536, 578, 531, 588, 650, 574, 653, - 642, 621, 506, 506, 506, 651, 665, 651, 506, 506, - 506, 506, 506, 506, 506, 506, 996, 662, 626, 631, - 634, 713, 337, 618, 641, 407, 770, 618, 920, 943, - 628, 603, 878, 922, 651, 994, 749, 43, 450, 877, - 625, 606, 651, 870, 651, 768, 651, 919, 608, 811, - 618, 506, 918, 983, 981, 978, 974, 965, 963, 960, - 947, 545, 853, 683, 942, 151, 903, 656, 663, 610, - 675, 233, 808, 651, 651, 767, 779, 651, 766, 707, - 750, 609, 671, 927, 800, 613, 926, 651, 624, 783, - 233, 491, 511, 946, 674, 862, 615, 917, 868, 765, - 464, 817, 530, 695, 945, 944, 962, 730, 764, 781, - 485, 542, 617, 620, 751, 869, 729, 921, 636, 657, - 647, 639, 763, 611, 923, 673, 614, 670, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 130, - -17, -17, -17, -17, 130, -17, -17, -17, -17, -17, - -17, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, -17, 130, - 130, 130, -17, 523, -17, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 130, 0, 0, - 130, -17, 130, -17, 130, -17, 130, 130, 130, 130, - 130, 130, -17, -17, -17, -17, -17, -17, 0, 580, - 580, 580, 580, -17, -17, -17, -17, 950, 950, 950, - 950, 523, 523, 523, 523, 523, 523, 580, 580, 304, - 304, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 523, 950, 950, 523, -32, -32, -32, -32, -32, - -32, 165, 165, 165, 284, 0, 0, 0, 0, 0, - 0, -32, 607, 165, 368, 368, 368, 165, 165, 165, - 284, 0, 0, 0, 0, 607, 368, 0, 0, 0, - 856, 0, 0, 0, 368, 484, 484, 484, 484, 233, - 222, 0, 607, 607, 607, 0, 619, 0, 0, 0, - 856, 0, 0, 0, 0, 0, 0, 506, 43, 878, - 139, 288, 0, 0, 0, 0, 0, 0, 0, 288, - 288, 393, 393, 0, 0, 545, 506, 506, 506, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 139, 0, 0, 233 - ); - - protected $actionDefault = array( - 3,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767, 428, 428,32767, 385,32767,32767,32767,32767, - 32767,32767,32767, 189, 189, 189,32767,32767,32767, 417, - 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, - 32767,32767,32767,32767,32767, 271,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767, 277, 433,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767, 252, 253, 255, 256, 188, 418, 140, 278, - 432, 187, 142, 216, 389,32767,32767,32767, 218, 26, - 151, 96, 388, 186, 127, 270, 272, 217, 193, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 192, 343, 249, 248, 247, 345,32767, 344, 382, - 382, 385,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767, 214, 371, 370, 215, 341, 219, 342, 221, 346, - 220, 237, 238, 235, 236, 239, 348, 347, 364, 365, - 362, 363, 191, 240, 241, 242, 243, 366, 367, 368, - 369, 173, 173, 173, 173,32767,32767, 427, 427,32767, - 32767, 228, 229, 355, 356,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767, 174,32767,32767, 131, - 131, 131, 131, 131,32767,32767,32767,32767,32767, 223, - 224, 222, 350, 351, 349,32767,32767, 317,32767,32767, - 32767,32767,32767, 319,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767, 390, 318,32767,32767,32767,32767, - 32767,32767,32767,32767, 403, 306,32767,32767,32767,32767, - 299, 115, 117, 65, 374,32767,32767,32767,32767,32767, - 408, 233,32767,32767,32767,32767,32767,32767, 440,32767, - 403,32767,32767,32767,32767,32767,32767,32767,32767, 246, - 225, 226, 227,32767,32767, 407, 401, 358, 359, 360, - 361, 352, 353, 354, 357,32767,32767,32767,32767,32767, - 69, 314,32767, 320, 320,32767,32767,32767,32767, 69, - 32767,32767,32767,32767, 69,32767, 406, 405, 69,32767, - 300, 384, 69, 82,32767, 80, 80,32767, 101, 101, - 32767,32767, 84, 380, 396,32767, 84,32767, 69,32767, - 288, 71, 384,32767,32767, 133, 133, 288, 69, 133, - 32767, 133,32767, 4, 324,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767, 301, - 32767,32767,32767, 267, 268, 377, 392,32767, 393,32767, - 299,32767, 231, 232, 234, 211,32767, 213, 257, 258, - 259, 260, 261, 262, 263, 265,32767,32767, 304, 307, - 32767,32767,32767, 6, 20, 150,32767, 302,32767, 196, - 32767,32767,32767,32767, 435,32767,32767, 190,32767,32767, - 22,32767, 146,32767, 67,32767, 425,32767,32767, 401, - 303, 230,32767,32767,32767,32767,32767,32767,32767,32767, - 32767, 402,32767,32767,32767, 122,32767, 337,32767,32767, - 32767, 83,32767, 194, 141,32767,32767, 434,32767,32767, - 32767,32767,32767,32767,32767,32767,32767, 68,32767,32767, - 85,32767,32767, 401,32767,32767,32767,32767,32767,32767, - 185,32767,32767,32767,32767,32767, 401,32767,32767,32767, - 126,32767,32767,32767,32767,32767,32767,32767, 4,32767, - 167,32767,32767,32767,32767,32767,32767,32767, 28, 28, - 3, 28, 109, 28, 153, 3, 101, 101, 62, 153, - 28, 153, 153, 28, 28, 28, 28, 28, 160, 28, - 28, 28, 28, 28, 28, 28 - ); - - protected $goto = array( - 168, 168, 142, 142, 147, 142, 143, 144, 145, 150, - 152, 188, 170, 166, 166, 166, 166, 147, 147, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 162, 163, 164, 165, 185, 141, 186, 492, 493, 371, - 494, 498, 499, 500, 501, 502, 503, 504, 505, 843, - 146, 148, 149, 151, 173, 178, 187, 203, 251, 254, - 256, 258, 260, 261, 262, 263, 264, 265, 273, 274, - 275, 276, 291, 292, 319, 320, 321, 390, 391, 392, - 541, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 153, 154, 155, 169, 156, 171, - 157, 204, 172, 158, 159, 160, 205, 161, 139, 557, - 700, 557, 557, 557, 557, 557, 557, 557, 557, 557, - 557, 557, 557, 557, 557, 557, 557, 557, 557, 557, - 557, 557, 557, 557, 557, 557, 557, 557, 557, 557, - 557, 557, 557, 557, 557, 557, 557, 557, 557, 557, - 557, 557, 557, 496, 496, 496, 496, 496, 496, 379, - 653, 653, 653, 496, 496, 496, 496, 496, 496, 496, - 496, 496, 496, 507, 570, 594, 507, 753, 738, 736, - 734, 736, 622, 510, 762, 757, 785, 430, 430, 430, - 430, 430, 430, 767, 767, 1072, 1072, 430, 430, 430, - 430, 430, 430, 430, 430, 430, 430, 946, 519, 350, - 946, 774, 774, 774, 774, 774, 774, 543, 544, 545, - 546, 547, 548, 549, 550, 552, 579, 609, 599, 822, - 409, 604, 282, 369, 283, 284, 530, 732, 732, 732, - 732, 537, 5, 727, 733, 603, 558, 6, 558, 558, - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - 981, 1076, 981, 981, 981, 981, 981, 981, 981, 981, - 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, - 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, - 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, - 981, 981, 981, 981, 654, 654, 654, 655, 655, 655, - 573, 576, 614, 176, 508, 957, 956, 508, 179, 180, - 181, 397, 398, 399, 400, 175, 202, 206, 208, 255, - 257, 259, 266, 267, 268, 269, 270, 271, 277, 278, - 279, 280, 293, 294, 322, 323, 324, 401, 402, 403, - 404, 177, 182, 252, 253, 183, 184, 9, 333, 3, - 372, 10, 317, 580, 353, 408, 351, 352, 11, 587, - 1044, 1, 12, 13, 2, 14, 1032, 7, 15, 16, - 17, 18, 19, 20, 396, 596, 536, 536, 563, 532, - 939, 513, 383, 384, 534, 534, 495, 497, 524, 539, - 564, 567, 577, 583, 513, 962, 1069, 595, 386, 1051, - 1082, 1082, 1051, 890, 900, 26, 21, 365, 664, 633, - 841, 513, 513, 513, 771, 509, 1085, 1082, 509, 780, - 789, 553, 1067, 1067, 1067, 380, 380, 380, 373, 1085, - 1085, 542, 522, 29, 1050, 518, 533, 380, 592, 982, - 405, 1052, 942, 943, 1052, 395, 939, 932, 518, 518, - 937, 446, 451, 670, 568, 794, 741, 1029, 459, 940, - 1043, 940, 601, 830, 0, 0, 0, 0, 0, 941, - 0, 513, 0, 0, 0, 0, 0, 0, 0, 0, - 517, 0, 0, 0, 0, 0, 0, 0, 0, 540, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 523 - ); - - protected $gotoCheck = array( - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 39, - 32, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 95, 95, 95, 95, 95, 95, 5, - 6, 6, 6, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 22, 22, 95, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 63, 39, 39, 39, - 39, 39, 39, 56, 56, 56, 56, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 79, 51, - 39, 39, 39, 39, 39, 39, 39, 88, 88, 88, - 88, 88, 88, 88, 88, 88, 88, 39, 43, 76, - 76, 43, 47, 43, 47, 47, 5, 39, 39, 39, - 39, 87, 2, 39, 39, 39, 98, 2, 98, 98, - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, - 105, 119, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 7, 7, 7, 8, 8, 8, - 42, 42, 42, 13, 98, 103, 103, 98, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 14, 104, 14, - 29, 14, 104, 49, 49, 49, 51, 51, 14, 107, - 61, 14, 14, 14, 14, 14, 111, 14, 14, 14, - 14, 14, 14, 14, 33, 33, 33, 33, 33, 33, - 61, 4, 9, 9, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 4, 16, 117, 31, 30, 97, - 120, 120, 97, 80, 16, 16, 16, 16, 11, 53, - 79, 4, 4, 4, 58, 101, 120, 120, 101, 60, - 64, 16, 97, 97, 97, 102, 102, 102, 40, 120, - 120, 26, 40, 16, 97, 26, 40, 102, 16, 106, - 10, 96, 61, 61, 96, 102, 61, 91, 26, 26, - 93, 45, 40, 12, 46, 65, 50, 110, 86, 61, - 61, 61, 40, 78, -1, -1, -1, -1, -1, 61, - -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, - 4, -1, -1, -1, -1, -1, -1, -1, -1, 4, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 79 - ); - - protected $gotoBase = array( - 0, 0, -378, 0, 95, -180, 156, 330, 333, 66, - 63, 90, 53, 136, -232, 0, 24, 0, 0, 0, - 0, 0, 130, 0, 0, -30, 441, 0, 0, 344, - 142, 151, 85, 129, 0, 0, 0, 0, 0, -98, - 44, 0, 30, -228, 0, 55, 48, -397, 0, 57, - 49, -230, 0, 82, 0, 0, -92, 0, 141, 0, - 145, 56, 0, 155, 94, 54, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -77, 0, 43, 161, - 135, 0, 0, 0, 0, 0, 41, 208, 167, 0, - 0, 73, 0, 71, 0, -132, 176, 134, 39, 0, - 0, 150, 137, 16, 61, 83, 111, 189, 0, 0, - 45, 195, 0, 0, 0, 0, 0, 148, 0, 256, - 124, 0 - ); - - protected $gotoDefault = array( - -32768, 462, 4, 648, 479, 514, 675, 676, 677, 375, - 374, 665, 671, 174, 8, 673, 891, 361, 680, 362, - 582, 682, 526, 684, 685, 140, 480, 376, 377, 527, - 385, 571, 699, 272, 382, 701, 363, 703, 709, 364, - 602, 586, 554, 598, 481, 442, 565, 281, 535, 561, - 740, 349, 748, 636, 756, 759, 482, 555, 770, 448, - 778, 967, 393, 784, 790, 795, 798, 418, 406, 578, - 802, 803, 325, 807, 610, 611, 821, 306, 829, 842, - 414, 910, 912, 483, 484, 520, 456, 506, 525, 485, - 933, 436, 407, 936, 486, 487, 426, 427, 954, 951, - 355, 1037, 354, 444, 316, 1022, 1021, 574, 986, 452, - 1075, 1033, 344, 488, 489, 370, 387, 1070, 431, 1077, - 1084, 562 - ); - - protected $ruleToNonTerminal = array( - 0, 1, 2, 2, 4, 4, 5, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 9, 9, - 11, 11, 11, 11, 10, 10, 12, 14, 14, 15, - 15, 15, 15, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 36, 36, 38, 37, 37, 30, 30, 40, - 40, 41, 41, 7, 8, 8, 8, 44, 44, 44, - 45, 45, 48, 48, 46, 46, 49, 49, 23, 23, - 32, 32, 35, 35, 34, 34, 50, 24, 24, 24, - 24, 51, 51, 52, 52, 53, 53, 21, 21, 17, - 17, 54, 19, 19, 55, 18, 18, 20, 20, 31, - 31, 31, 42, 42, 57, 57, 58, 58, 60, 60, - 60, 59, 59, 43, 43, 61, 61, 61, 62, 62, - 63, 63, 63, 27, 27, 64, 64, 64, 28, 28, - 65, 65, 47, 47, 66, 66, 66, 66, 71, 71, - 72, 72, 73, 73, 73, 73, 74, 75, 75, 70, - 70, 67, 67, 69, 69, 77, 77, 76, 76, 76, - 76, 76, 76, 68, 68, 78, 78, 29, 29, 22, - 22, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 16, 16, 26, 26, 83, - 83, 84, 84, 84, 84, 90, 79, 79, 86, 86, - 92, 92, 93, 94, 94, 94, 94, 94, 94, 98, - 98, 39, 39, 39, 80, 80, 99, 99, 95, 95, - 100, 100, 100, 100, 81, 81, 81, 85, 85, 85, - 91, 91, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 13, 13, 13, 13, 13, - 13, 108, 108, 108, 108, 108, 108, 108, 108, 108, - 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, - 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, - 108, 108, 108, 108, 89, 89, 82, 82, 82, 82, - 106, 106, 107, 107, 110, 110, 109, 109, 111, 111, - 33, 33, 33, 33, 113, 113, 112, 112, 112, 112, - 112, 114, 114, 97, 97, 101, 101, 96, 96, 115, - 115, 115, 115, 102, 102, 102, 102, 88, 88, 103, - 103, 103, 56, 116, 116, 117, 117, 117, 87, 87, - 118, 118, 119, 119, 119, 119, 104, 104, 104, 104, - 120, 120, 120, 120, 120, 120, 120, 121, 121, 121 - ); - - protected $ruleToLength = array( - 1, 1, 2, 0, 1, 3, 1, 1, 1, 1, - 1, 3, 5, 4, 3, 4, 4, 3, 3, 1, - 1, 3, 2, 4, 3, 1, 3, 2, 0, 1, - 1, 1, 1, 3, 5, 8, 3, 5, 9, 3, - 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, - 1, 2, 5, 7, 9, 5, 1, 6, 3, 3, - 2, 1, 0, 2, 8, 0, 4, 1, 3, 0, - 1, 0, 1, 10, 7, 6, 5, 1, 2, 2, - 0, 2, 0, 2, 0, 2, 1, 3, 1, 4, - 1, 4, 1, 4, 1, 3, 3, 3, 4, 4, - 5, 0, 2, 4, 3, 1, 1, 1, 4, 0, - 2, 3, 0, 2, 4, 0, 2, 0, 3, 1, - 2, 1, 1, 0, 1, 3, 4, 6, 1, 1, - 1, 0, 1, 0, 2, 2, 3, 3, 1, 3, - 1, 2, 2, 3, 1, 1, 2, 4, 3, 1, - 1, 3, 2, 0, 3, 3, 9, 3, 1, 3, - 0, 2, 4, 5, 4, 4, 3, 1, 1, 1, - 3, 1, 1, 0, 1, 1, 2, 1, 1, 1, - 1, 1, 1, 1, 3, 1, 3, 3, 1, 0, - 1, 1, 3, 3, 4, 4, 1, 2, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 1, 3, 5, 4, 3, - 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 1, 1, 3, - 2, 1, 2, 10, 11, 3, 3, 2, 4, 4, - 3, 4, 4, 4, 4, 7, 3, 2, 0, 4, - 1, 3, 2, 2, 4, 6, 2, 2, 4, 1, - 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, - 3, 3, 4, 4, 0, 2, 1, 0, 1, 1, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 3, 2, 1, 3, 1, 4, 3, - 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, - 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, - 5, 4, 4, 3, 1, 3, 1, 1, 3, 3, - 1, 1, 0, 2, 0, 1, 3, 1, 3, 1, - 1, 1, 1, 1, 6, 4, 3, 4, 2, 4, - 4, 1, 3, 1, 2, 1, 1, 4, 1, 3, - 6, 4, 4, 4, 4, 1, 4, 0, 1, 1, - 3, 1, 4, 3, 1, 1, 1, 0, 0, 2, - 3, 1, 3, 1, 4, 2, 2, 2, 1, 2, - 1, 4, 3, 3, 3, 6, 3, 1, 1, 1 - ); - - protected function reduceRule0() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule1() { - $this->semValue = $this->handleNamespaces($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule2() { - if (is_array($this->semStack[$this->stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); } else { $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; }; - } - - protected function reduceRule3() { - $this->semValue = array(); - } - - protected function reduceRule4() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule5() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule6() { - $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule7() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule8() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule9() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule10() { - $this->semValue = new Stmt\HaltCompiler($this->lexer->handleHaltCompiler(), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule11() { - $this->semValue = new Stmt\Namespace_($this->semStack[$this->stackPos-(3-2)], null, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule12() { - $this->semValue = new Stmt\Namespace_($this->semStack[$this->stackPos-(5-2)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule13() { - $this->semValue = new Stmt\Namespace_(null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule14() { - $this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(3-2)], Stmt\Use_::TYPE_NORMAL, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule15() { - $this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(4-3)], Stmt\Use_::TYPE_FUNCTION, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule16() { - $this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(4-3)], Stmt\Use_::TYPE_CONSTANT, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule17() { - $this->semValue = new Stmt\Const_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule18() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule19() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule20() { - $this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(1-1)], null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule21() { - $this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule22() { - $this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(2-2)], null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule23() { - $this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule24() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule25() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule26() { - $this->semValue = new Node\Const_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule27() { - if (is_array($this->semStack[$this->stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); } else { $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; }; - } - - protected function reduceRule28() { - $this->semValue = array(); - } - - protected function reduceRule29() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule30() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule31() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule32() { - throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule33() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule34() { - $this->semValue = new Stmt\If_($this->semStack[$this->stackPos-(5-2)], array('stmts' => is_array($this->semStack[$this->stackPos-(5-3)]) ? $this->semStack[$this->stackPos-(5-3)] : array($this->semStack[$this->stackPos-(5-3)]), 'elseifs' => $this->semStack[$this->stackPos-(5-4)], 'else' => $this->semStack[$this->stackPos-(5-5)]), $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule35() { - $this->semValue = new Stmt\If_($this->semStack[$this->stackPos-(8-2)], array('stmts' => $this->semStack[$this->stackPos-(8-4)], 'elseifs' => $this->semStack[$this->stackPos-(8-5)], 'else' => $this->semStack[$this->stackPos-(8-6)]), $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes); - } - - protected function reduceRule36() { - $this->semValue = new Stmt\While_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule37() { - $this->semValue = new Stmt\Do_($this->semStack[$this->stackPos-(5-4)], is_array($this->semStack[$this->stackPos-(5-2)]) ? $this->semStack[$this->stackPos-(5-2)] : array($this->semStack[$this->stackPos-(5-2)]), $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule38() { - $this->semValue = new Stmt\For_(array('init' => $this->semStack[$this->stackPos-(9-3)], 'cond' => $this->semStack[$this->stackPos-(9-5)], 'loop' => $this->semStack[$this->stackPos-(9-7)], 'stmts' => $this->semStack[$this->stackPos-(9-9)]), $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); - } - - protected function reduceRule39() { - $this->semValue = new Stmt\Switch_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule40() { - $this->semValue = new Stmt\Break_(null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule41() { - $this->semValue = new Stmt\Break_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule42() { - $this->semValue = new Stmt\Continue_(null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule43() { - $this->semValue = new Stmt\Continue_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule44() { - $this->semValue = new Stmt\Return_(null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule45() { - $this->semValue = new Stmt\Return_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule46() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule47() { - $this->semValue = new Stmt\Global_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule48() { - $this->semValue = new Stmt\Static_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule49() { - $this->semValue = new Stmt\Echo_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule50() { - $this->semValue = new Stmt\InlineHTML($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule51() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule52() { - $this->semValue = new Stmt\Unset_($this->semStack[$this->stackPos-(5-3)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule53() { - $this->semValue = new Stmt\Foreach_($this->semStack[$this->stackPos-(7-3)], $this->semStack[$this->stackPos-(7-5)][0], array('keyVar' => null, 'byRef' => $this->semStack[$this->stackPos-(7-5)][1], 'stmts' => $this->semStack[$this->stackPos-(7-7)]), $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); - } - - protected function reduceRule54() { - $this->semValue = new Stmt\Foreach_($this->semStack[$this->stackPos-(9-3)], $this->semStack[$this->stackPos-(9-7)][0], array('keyVar' => $this->semStack[$this->stackPos-(9-5)], 'byRef' => $this->semStack[$this->stackPos-(9-7)][1], 'stmts' => $this->semStack[$this->stackPos-(9-9)]), $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); - } - - protected function reduceRule55() { - $this->semValue = new Stmt\Declare_($this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule56() { - $this->semValue = array(); /* means: no statement */ - } - - protected function reduceRule57() { - $this->semValue = new Stmt\TryCatch($this->semStack[$this->stackPos-(6-3)], $this->semStack[$this->stackPos-(6-5)], $this->semStack[$this->stackPos-(6-6)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule58() { - $this->semValue = new Stmt\Throw_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule59() { - $this->semValue = new Stmt\Goto_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule60() { - $this->semValue = new Stmt\Label($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule61() { - $this->semValue = array(); /* means: no statement */ - } - - protected function reduceRule62() { - $this->semValue = array(); - } - - protected function reduceRule63() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule64() { - $this->semValue = new Stmt\Catch_($this->semStack[$this->stackPos-(8-3)], substr($this->semStack[$this->stackPos-(8-4)], 1), $this->semStack[$this->stackPos-(8-7)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes); - } - - protected function reduceRule65() { - $this->semValue = null; - } - - protected function reduceRule66() { - $this->semValue = $this->semStack[$this->stackPos-(4-3)]; - } - - protected function reduceRule67() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule68() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule69() { - $this->semValue = false; - } - - protected function reduceRule70() { - $this->semValue = true; - } - - protected function reduceRule71() { - $this->semValue = false; - } - - protected function reduceRule72() { - $this->semValue = true; - } - - protected function reduceRule73() { - $this->semValue = new Stmt\Function_($this->semStack[$this->stackPos-(10-3)], array('byRef' => $this->semStack[$this->stackPos-(10-2)], 'params' => $this->semStack[$this->stackPos-(10-5)], 'returnType' => $this->semStack[$this->stackPos-(10-7)], 'stmts' => $this->semStack[$this->stackPos-(10-9)]), $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes); - } - - protected function reduceRule74() { - $this->semValue = new Stmt\Class_($this->semStack[$this->stackPos-(7-2)], array('type' => $this->semStack[$this->stackPos-(7-1)], 'extends' => $this->semStack[$this->stackPos-(7-3)], 'implements' => $this->semStack[$this->stackPos-(7-4)], 'stmts' => $this->semStack[$this->stackPos-(7-6)]), $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); - } - - protected function reduceRule75() { - $this->semValue = new Stmt\Interface_($this->semStack[$this->stackPos-(6-2)], array('extends' => $this->semStack[$this->stackPos-(6-3)], 'stmts' => $this->semStack[$this->stackPos-(6-5)]), $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule76() { - $this->semValue = new Stmt\Trait_($this->semStack[$this->stackPos-(5-2)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule77() { - $this->semValue = 0; - } - - protected function reduceRule78() { - $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; - } - - protected function reduceRule79() { - $this->semValue = Stmt\Class_::MODIFIER_FINAL; - } - - protected function reduceRule80() { - $this->semValue = null; - } - - protected function reduceRule81() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule82() { - $this->semValue = array(); - } - - protected function reduceRule83() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule84() { - $this->semValue = array(); - } - - protected function reduceRule85() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule86() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule87() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule88() { - $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule89() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule90() { - $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule91() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule92() { - $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule93() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule94() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule95() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule96() { - $this->semValue = new Stmt\DeclareDeclare($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule97() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule98() { - $this->semValue = $this->semStack[$this->stackPos-(4-3)]; - } - - protected function reduceRule99() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule100() { - $this->semValue = $this->semStack[$this->stackPos-(5-3)]; - } - - protected function reduceRule101() { - $this->semValue = array(); - } - - protected function reduceRule102() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule103() { - $this->semValue = new Stmt\Case_($this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule104() { - $this->semValue = new Stmt\Case_(null, $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule105() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule106() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule107() { - $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule108() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule109() { - $this->semValue = array(); - } - - protected function reduceRule110() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule111() { - $this->semValue = new Stmt\ElseIf_($this->semStack[$this->stackPos-(3-2)], is_array($this->semStack[$this->stackPos-(3-3)]) ? $this->semStack[$this->stackPos-(3-3)] : array($this->semStack[$this->stackPos-(3-3)]), $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule112() { - $this->semValue = array(); - } - - protected function reduceRule113() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule114() { - $this->semValue = new Stmt\ElseIf_($this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule115() { - $this->semValue = null; - } - - protected function reduceRule116() { - $this->semValue = new Stmt\Else_(is_array($this->semStack[$this->stackPos-(2-2)]) ? $this->semStack[$this->stackPos-(2-2)] : array($this->semStack[$this->stackPos-(2-2)]), $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule117() { - $this->semValue = null; - } - - protected function reduceRule118() { - $this->semValue = new Stmt\Else_($this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule119() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)], false); - } - - protected function reduceRule120() { - $this->semValue = array($this->semStack[$this->stackPos-(2-2)], true); - } - - protected function reduceRule121() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)], false); - } - - protected function reduceRule122() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule123() { - $this->semValue = array(); - } - - protected function reduceRule124() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule125() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule126() { - $this->semValue = new Node\Param(substr($this->semStack[$this->stackPos-(4-4)], 1), null, $this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule127() { - $this->semValue = new Node\Param(substr($this->semStack[$this->stackPos-(6-4)], 1), $this->semStack[$this->stackPos-(6-6)], $this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-2)], $this->semStack[$this->stackPos-(6-3)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule128() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule129() { - $this->semValue = 'array'; - } - - protected function reduceRule130() { - $this->semValue = 'callable'; - } - - protected function reduceRule131() { - $this->semValue = null; - } - - protected function reduceRule132() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule133() { - $this->semValue = null; - } - - protected function reduceRule134() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule135() { - $this->semValue = array(); - } - - protected function reduceRule136() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule137() { - $this->semValue = array(new Node\Arg($this->semStack[$this->stackPos-(3-2)], false, false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes)); - } - - protected function reduceRule138() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule139() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule140() { - $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(1-1)], false, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule141() { - $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(2-2)], true, false, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule142() { - $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(2-2)], false, true, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule143() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule144() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule145() { - $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule146() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule147() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule148() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule149() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule150() { - $this->semValue = new Stmt\StaticVar(substr($this->semStack[$this->stackPos-(1-1)], 1), null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule151() { - $this->semValue = new Stmt\StaticVar(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule152() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule153() { - $this->semValue = array(); - } - - protected function reduceRule154() { - $this->semValue = new Stmt\Property($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule155() { - $this->semValue = new Stmt\ClassConst($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule156() { - $this->semValue = new Stmt\ClassMethod($this->semStack[$this->stackPos-(9-4)], array('type' => $this->semStack[$this->stackPos-(9-1)], 'byRef' => $this->semStack[$this->stackPos-(9-3)], 'params' => $this->semStack[$this->stackPos-(9-6)], 'returnType' => $this->semStack[$this->stackPos-(9-8)], 'stmts' => $this->semStack[$this->stackPos-(9-9)]), $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); - } - - protected function reduceRule157() { - $this->semValue = new Stmt\TraitUse($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule158() { - $this->semValue = array(); - } - - protected function reduceRule159() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule160() { - $this->semValue = array(); - } - - protected function reduceRule161() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule162() { - $this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule163() { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(5-1)][0], $this->semStack[$this->stackPos-(5-1)][1], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule164() { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], $this->semStack[$this->stackPos-(4-3)], null, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule165() { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule166() { - $this->semValue = array($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)]); - } - - protected function reduceRule167() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule168() { - $this->semValue = array(null, $this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule169() { - $this->semValue = null; - } - - protected function reduceRule170() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule171() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule172() { - $this->semValue = 0; - } - - protected function reduceRule173() { - $this->semValue = 0; - } - - protected function reduceRule174() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule175() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule176() { - Stmt\Class_::verifyModifier($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); $this->semValue = $this->semStack[$this->stackPos-(2-1)] | $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule177() { - $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; - } - - protected function reduceRule178() { - $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; - } - - protected function reduceRule179() { - $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; - } - - protected function reduceRule180() { - $this->semValue = Stmt\Class_::MODIFIER_STATIC; - } - - protected function reduceRule181() { - $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; - } - - protected function reduceRule182() { - $this->semValue = Stmt\Class_::MODIFIER_FINAL; - } - - protected function reduceRule183() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule184() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule185() { - $this->semValue = new Stmt\PropertyProperty(substr($this->semStack[$this->stackPos-(1-1)], 1), null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule186() { - $this->semValue = new Stmt\PropertyProperty(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule187() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule188() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule189() { - $this->semValue = array(); - } - - protected function reduceRule190() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule191() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule192() { - $this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule193() { - $this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule194() { - $this->semValue = new Expr\AssignRef($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule195() { - $this->semValue = new Expr\AssignRef($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule196() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule197() { - $this->semValue = new Expr\Clone_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule198() { - $this->semValue = new Expr\AssignOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule199() { - $this->semValue = new Expr\AssignOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule200() { - $this->semValue = new Expr\AssignOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule201() { - $this->semValue = new Expr\AssignOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule202() { - $this->semValue = new Expr\AssignOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule203() { - $this->semValue = new Expr\AssignOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule204() { - $this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule205() { - $this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule206() { - $this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule207() { - $this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule208() { - $this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule209() { - $this->semValue = new Expr\AssignOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule210() { - $this->semValue = new Expr\PostInc($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule211() { - $this->semValue = new Expr\PreInc($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule212() { - $this->semValue = new Expr\PostDec($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule213() { - $this->semValue = new Expr\PreDec($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule214() { - $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule215() { - $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule216() { - $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule217() { - $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule218() { - $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule219() { - $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule220() { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule221() { - $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule222() { - $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule223() { - $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule224() { - $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule225() { - $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule226() { - $this->semValue = new Expr\BinaryOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule227() { - $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule228() { - $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule229() { - $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule230() { - $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule231() { - $this->semValue = new Expr\UnaryPlus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule232() { - $this->semValue = new Expr\UnaryMinus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule233() { - $this->semValue = new Expr\BooleanNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule234() { - $this->semValue = new Expr\BitwiseNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule235() { - $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule236() { - $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule237() { - $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule238() { - $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule239() { - $this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule240() { - $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule241() { - $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule242() { - $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule243() { - $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule244() { - $this->semValue = new Expr\Instanceof_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule245() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule246() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule247() { - $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(5-1)], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule248() { - $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(4-1)], null, $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule249() { - $this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule250() { - $this->semValue = new Expr\Isset_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule251() { - $this->semValue = new Expr\Empty_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule252() { - $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule253() { - $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule254() { - $this->semValue = new Expr\Eval_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule255() { - $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule256() { - $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule257() { - $this->semValue = new Expr\Cast\Int_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule258() { - $this->semValue = new Expr\Cast\Double($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule259() { - $this->semValue = new Expr\Cast\String_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule260() { - $this->semValue = new Expr\Cast\Array_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule261() { - $this->semValue = new Expr\Cast\Object_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule262() { - $this->semValue = new Expr\Cast\Bool_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule263() { - $this->semValue = new Expr\Cast\Unset_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule264() { - $this->semValue = new Expr\Exit_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule265() { - $this->semValue = new Expr\ErrorSuppress($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule266() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule267() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule268() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule269() { - $this->semValue = new Expr\ShellExec($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule270() { - $this->semValue = new Expr\Print_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule271() { - $this->semValue = new Expr\Yield_(null, null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule272() { - $this->semValue = new Expr\YieldFrom($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule273() { - $this->semValue = new Expr\Closure(array('static' => false, 'byRef' => $this->semStack[$this->stackPos-(10-2)], 'params' => $this->semStack[$this->stackPos-(10-4)], 'uses' => $this->semStack[$this->stackPos-(10-6)], 'returnType' => $this->semStack[$this->stackPos-(10-7)], 'stmts' => $this->semStack[$this->stackPos-(10-9)]), $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes); - } - - protected function reduceRule274() { - $this->semValue = new Expr\Closure(array('static' => true, 'byRef' => $this->semStack[$this->stackPos-(11-3)], 'params' => $this->semStack[$this->stackPos-(11-5)], 'uses' => $this->semStack[$this->stackPos-(11-7)], 'returnType' => $this->semStack[$this->stackPos-(11-8)], 'stmts' => $this->semStack[$this->stackPos-(11-10)]), $this->startAttributeStack[$this->stackPos-(11-1)] + $this->endAttributes); - } - - protected function reduceRule275() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule276() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule277() { - $this->semValue = new Expr\Yield_($this->semStack[$this->stackPos-(2-2)], null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule278() { - $this->semValue = new Expr\Yield_($this->semStack[$this->stackPos-(4-4)], $this->semStack[$this->stackPos-(4-2)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule279() { - $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule280() { - $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule281() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule282() { - $this->semValue = new Expr\ArrayDimFetch(new Scalar\String_(Scalar\String_::parse($this->semStack[$this->stackPos-(4-1)]), $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule283() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule284() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule285() { - $this->semValue = array(new Stmt\Class_(null, array('type' => 0, 'extends' => $this->semStack[$this->stackPos-(7-3)], 'implements' => $this->semStack[$this->stackPos-(7-4)], 'stmts' => $this->semStack[$this->stackPos-(7-6)]), $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(7-2)]); - } - - protected function reduceRule286() { - $this->semValue = new Expr\New_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule287() { - list($class, $ctorArgs) = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = new Expr\New_($class, $ctorArgs, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule288() { - $this->semValue = array(); - } - - protected function reduceRule289() { - $this->semValue = $this->semStack[$this->stackPos-(4-3)]; - } - - protected function reduceRule290() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule291() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule292() { - $this->semValue = new Expr\ClosureUse(substr($this->semStack[$this->stackPos-(2-2)], 1), $this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule293() { - $this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule294() { - $this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule295() { - $this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-4)], $this->semStack[$this->stackPos-(6-6)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule296() { - - if ($this->semStack[$this->stackPos-(2-1)] instanceof Node\Expr\StaticPropertyFetch) { - $this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(2-1)]->class, new Expr\Variable($this->semStack[$this->stackPos-(2-1)]->name, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } elseif ($this->semStack[$this->stackPos-(2-1)] instanceof Node\Expr\ArrayDimFetch) { - $tmp = $this->semStack[$this->stackPos-(2-1)]; - while ($tmp->var instanceof Node\Expr\ArrayDimFetch) { - $tmp = $tmp->var; - } - - $this->semValue = new Expr\StaticCall($tmp->var->class, $this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - $tmp->var = new Expr\Variable($tmp->var->name, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } else { - throw new \Exception; - } - - } - - protected function reduceRule297() { - $this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule298() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule299() { - $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule300() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule301() { - $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule302() { - $this->semValue = new Name\FullyQualified($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule303() { - $this->semValue = new Name\Relative($this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule304() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule305() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule306() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule307() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule308() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule309() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule310() { - $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule311() { - $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule312() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule313() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule314() { - $this->semValue = null; - } - - protected function reduceRule315() { - $this->semValue = null; - } - - protected function reduceRule316() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule317() { - $this->semValue = array(); - } - - protected function reduceRule318() { - $this->semValue = array(Scalar\String_::parseEscapeSequences($this->semStack[$this->stackPos-(1-1)], '`')); - } - - protected function reduceRule319() { - foreach ($this->semStack[$this->stackPos-(1-1)] as &$s) { if (is_string($s)) { $s = Node\Scalar\String_::parseEscapeSequences($s, '`'); } }; $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule320() { - $this->semValue = array(); - } - - protected function reduceRule321() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule322() { - $this->semValue = new Scalar\LNumber(Scalar\LNumber::parse($this->semStack[$this->stackPos-(1-1)]), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule323() { - $this->semValue = new Scalar\DNumber(Scalar\DNumber::parse($this->semStack[$this->stackPos-(1-1)]), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule324() { - $this->semValue = new Scalar\String_(Scalar\String_::parse($this->semStack[$this->stackPos-(1-1)]), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule325() { - $this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule326() { - $this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule327() { - $this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule328() { - $this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule329() { - $this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule330() { - $this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule331() { - $this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule332() { - $this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule333() { - $this->semValue = new Scalar\String_(Scalar\String_::parseDocString($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-2)]), $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule334() { - $this->semValue = new Scalar\String_('', $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule335() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule336() { - $this->semValue = new Expr\ClassConstFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule337() { - $this->semValue = new Expr\ConstFetch($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule338() { - $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule339() { - $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule340() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule341() { - $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule342() { - $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule343() { - $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule344() { - $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule345() { - $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule346() { - $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule347() { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule348() { - $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule349() { - $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule350() { - $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule351() { - $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule352() { - $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule353() { - $this->semValue = new Expr\BinaryOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule354() { - $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule355() { - $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule356() { - $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule357() { - $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule358() { - $this->semValue = new Expr\UnaryPlus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule359() { - $this->semValue = new Expr\UnaryMinus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule360() { - $this->semValue = new Expr\BooleanNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule361() { - $this->semValue = new Expr\BitwiseNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule362() { - $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule363() { - $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule364() { - $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule365() { - $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule366() { - $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule367() { - $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule368() { - $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule369() { - $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule370() { - $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(5-1)], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule371() { - $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(4-1)], null, $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule372() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule373() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule374() { - $this->semValue = new Expr\ConstFetch($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule375() { - $this->semValue = new Expr\ClassConstFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule376() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule377() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule378() { - foreach ($this->semStack[$this->stackPos-(3-2)] as &$s) { if (is_string($s)) { $s = Node\Scalar\String_::parseEscapeSequences($s, '"'); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule379() { - foreach ($this->semStack[$this->stackPos-(3-2)] as &$s) { if (is_string($s)) { $s = Node\Scalar\String_::parseEscapeSequences($s, null); } } $s = preg_replace('~(\r\n|\n|\r)\z~', '', $s); if ('' === $s) array_pop($this->semStack[$this->stackPos-(3-2)]);; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule380() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule381() { - $this->semValue = 'class'; - } - - protected function reduceRule382() { - $this->semValue = array(); - } - - protected function reduceRule383() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule384() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule385() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule386() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule387() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule388() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule389() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule390() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule391() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule392() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule393() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule394() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(6-2)], $this->semStack[$this->stackPos-(6-5)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule395() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule396() { - $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule397() { - $this->semValue = new Expr\MethodCall($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule398() { - $this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule399() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule400() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule401() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule402() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule403() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule404() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule405() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule406() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule407() { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule408() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule409() { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(3-1)], substr($this->semStack[$this->stackPos-(3-3)], 1), $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule410() { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-5)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule411() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule412() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule413() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule414() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule415() { - $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule416() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule417() { - $this->semValue = null; - } - - protected function reduceRule418() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule419() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule420() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule421() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule422() { - $this->semValue = new Expr\List_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule423() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule424() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule425() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule426() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule427() { - $this->semValue = null; - } - - protected function reduceRule428() { - $this->semValue = array(); - } - - protected function reduceRule429() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule430() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule431() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule432() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule433() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule434() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(4-4)], $this->semStack[$this->stackPos-(4-1)], true, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule435() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(2-2)], null, true, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule436() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule437() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule438() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule439() { - $this->semValue = array($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); - } - - protected function reduceRule440() { - $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule441() { - $this->semValue = new Expr\ArrayDimFetch(new Expr\Variable(substr($this->semStack[$this->stackPos-(4-1)], 1), $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule442() { - $this->semValue = new Expr\PropertyFetch(new Expr\Variable(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule443() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule444() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule445() { - $this->semValue = new Expr\ArrayDimFetch(new Expr\Variable($this->semStack[$this->stackPos-(6-2)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(6-4)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule446() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule447() { - $this->semValue = new Scalar\String_($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule448() { - $this->semValue = new Scalar\String_($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule449() { - $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } +interface Parser { + /** + * Parses PHP code into a node tree. + * + * @param string $code The source code to parse + * + * @return Node[]|null Array of statements (or null if the 'throwOnError' option is disabled and the parser was + * unable to recover from an error). + */ + public function parse($code); + + /** + * Get array of errors that occurred during the last parse. + * + * This method may only return multiple errors if the 'throwOnError' option is disabled. + * + * @return Error[] + */ + public function getErrors(); } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php b/application/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php new file mode 100644 index 0000000..95446e2 --- /dev/null +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php @@ -0,0 +1,63 @@ +parsers = $parsers; + $this->errors = []; + } + + public function parse($code) { + list($firstStmts, $firstErrors, $firstError) = $this->tryParse($this->parsers[0], $code); + if ($firstErrors === []) { + $this->errors = []; + return $firstStmts; + } + + for ($i = 1, $c = count($this->parsers); $i < $c; ++$i) { + list($stmts, $errors) = $this->tryParse($this->parsers[$i], $code); + if ($errors === []) { + $this->errors = []; + return $stmts; + } + } + + $this->errors = $firstErrors; + if ($firstError) { + throw $firstError; + } + return $firstStmts; + } + + public function getErrors() { + return $this->errors; + } + + private function tryParse(Parser $parser, $code) { + $stmts = null; + $error = null; + try { + $stmts = $parser->parse($code); + } catch (Error $error) {} + $errors = $parser->getErrors(); + return [$stmts, $errors, $error]; + } +} diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php b/application/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php new file mode 100644 index 0000000..fe40052 --- /dev/null +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php @@ -0,0 +1,3126 @@ +'", + "T_IS_GREATER_OR_EQUAL", + "T_SL", + "T_SR", + "'+'", + "'-'", + "'.'", + "'*'", + "'/'", + "'%'", + "'!'", + "T_INSTANCEOF", + "'~'", + "T_INC", + "T_DEC", + "T_INT_CAST", + "T_DOUBLE_CAST", + "T_STRING_CAST", + "T_ARRAY_CAST", + "T_OBJECT_CAST", + "T_BOOL_CAST", + "T_UNSET_CAST", + "'@'", + "T_POW", + "'['", + "T_NEW", + "T_CLONE", + "T_EXIT", + "T_IF", + "T_ELSEIF", + "T_ELSE", + "T_ENDIF", + "T_LNUMBER", + "T_DNUMBER", + "T_STRING", + "T_STRING_VARNAME", + "T_VARIABLE", + "T_NUM_STRING", + "T_INLINE_HTML", + "T_ENCAPSED_AND_WHITESPACE", + "T_CONSTANT_ENCAPSED_STRING", + "T_ECHO", + "T_DO", + "T_WHILE", + "T_ENDWHILE", + "T_FOR", + "T_ENDFOR", + "T_FOREACH", + "T_ENDFOREACH", + "T_DECLARE", + "T_ENDDECLARE", + "T_AS", + "T_SWITCH", + "T_ENDSWITCH", + "T_CASE", + "T_DEFAULT", + "T_BREAK", + "T_CONTINUE", + "T_GOTO", + "T_FUNCTION", + "T_CONST", + "T_RETURN", + "T_TRY", + "T_CATCH", + "T_FINALLY", + "T_THROW", + "T_USE", + "T_INSTEADOF", + "T_GLOBAL", + "T_STATIC", + "T_ABSTRACT", + "T_FINAL", + "T_PRIVATE", + "T_PROTECTED", + "T_PUBLIC", + "T_VAR", + "T_UNSET", + "T_ISSET", + "T_EMPTY", + "T_HALT_COMPILER", + "T_CLASS", + "T_TRAIT", + "T_INTERFACE", + "T_EXTENDS", + "T_IMPLEMENTS", + "T_OBJECT_OPERATOR", + "T_LIST", + "T_ARRAY", + "T_CALLABLE", + "T_CLASS_C", + "T_TRAIT_C", + "T_METHOD_C", + "T_FUNC_C", + "T_LINE", + "T_FILE", + "T_START_HEREDOC", + "T_END_HEREDOC", + "T_DOLLAR_OPEN_CURLY_BRACES", + "T_CURLY_OPEN", + "T_PAAMAYIM_NEKUDOTAYIM", + "T_NAMESPACE", + "T_NS_C", + "T_DIR", + "T_NS_SEPARATOR", + "T_ELLIPSIS", + "';'", + "'{'", + "'}'", + "'('", + "')'", + "'$'", + "'`'", + "']'", + "'\"'" + ); + + protected $tokenToSymbol = array( + 0, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 53, 156, 157, 153, 52, 35, 157, + 151, 152, 50, 47, 7, 48, 49, 51, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 29, 148, + 41, 15, 43, 28, 65, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 67, 157, 155, 34, 157, 154, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 149, 33, 150, 55, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 1, 2, 3, 4, + 5, 6, 8, 9, 10, 11, 12, 13, 14, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 30, 31, 32, 36, 37, 38, 39, 40, 42, + 44, 45, 46, 54, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 66, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 157, 157, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 157, 157, 157, 157, + 157, 157, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147 + ); + + protected $action = array( + 672, 673, 674, 675, 676,-32766, 677, 678, 679, 715, + 716, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 282, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236,-32766,-32766,-32766,-32766,-32766,-32766,-32766, + -32766,-32767,-32767,-32767,-32767, 356, 237, 238,-32766,-32766, + -32766,-32766, 680,-32766, 0,-32766,-32766,-32766,-32766,-32766, + -32766,-32767,-32767,-32767,-32767,-32767, 681, 682, 683, 684, + 685, 686, 687, 1178, 204, 747,-32766,-32766,-32766,-32766, + -32766, 23, 688, 689, 690, 691, 692, 693, 694, 695, + 696, 697, 698, 718, 719, 720, 721, 722, 710, 711, + 712, 713, 714, 699, 700, 701, 702, 703, 704, 705, + 741, 742, 743, 744, 745, 746, 706, 707, 708, 709, + 739, 730, 728, 729, 725, 726, 46, 717, 723, 724, + 731, 732, 734, 733, 735, 736, 52, 53, 420, 54, + 55, 727, 738, 737, 447, 56, 57, 332, 58,-32766, + -32766,-32766,-32766,-32766,-32766,-32766,-32766,-32766, 7,-32767, + -32767,-32767,-32767, 50, 329, 1185, 518, 945, 946, 947, + 944, 943, 942, 937, 1211, 306, 1213, 1212, 763, 764, + 821, 59, 60,-32766,-32766,-32766, 808, 61, 1172, 62, + 291, 292, 63, 64, 65, 66, 67, 68, 69, 70, + 441, 24, 299, 71, 413,-32766,-32766,-32766, 116, 1087, + 1088, 749, 633, 1178, 213, 214, 215, 464,-32766,-32766, + -32766, 822, 407, 1099, 321,-32766, 900,-32766,-32766,-32766, + -32766,-32766,-32766, 1036, 200, -269, 428, 27,-32766, 419, + -32766,-32766,-32766,-32766,-32766, 120, 491, 945, 946, 947, + 944, 943, 942, 297, 473, 474, 283, 623, 125,-32766, + 893, 894, 339, 477, 478,-32766, 1093, 1094, 1095, 1096, + 1090, 1091, 307, 492,-32766, 8, 425, 492, 1097, 1092, + 425, 121, -220, 869, 460, 39, 412, 332, 318, 18, + 319, 421, -122, -122, -122, -4, 822, 463, 99, 100, + 101, 811, 301, 1036, 38, 19, 422, -122, 465, -122, + 466, -122, 467, -122, 102, 423, -122, -122, -122, 28, + 29, 468, 424, 624, 30, 469, 425, 812, 72, 348, + 923, 349, 350, 470, 471,-32766,-32766,-32766, 298, 472, + 1036, 809, 793, 840, 475, 476,-32767,-32767,-32767,-32767, + 94, 95, 96, 97, 98,-32766, 440,-32766,-32766,-32766, + -32766, 1137, 213, 214, 215, 295, 421, 239, 824, 638, + -122, 280, 463, 893, 894, 367, 811, 1036, 1203, 38, + 19, 422, 200, 465, 1054, 466, 492, 467, 127, 425, + 423, 213, 214, 215, 28, 29, 468, 424, 414, 30, + 469, 1036, 870, 72, 317, 822, 349, 350, 470, 471, + 1036, 200, 214, 215, 472, 1182, 919, 755, 840, 475, + 476, 213, 214, 215, 295, 918, 76, 77, 78, 47, + 338, 200, 477, 644, 326, 438, 31, 294, 331, 805, + 334, 200, 241, 824, 638, -4, 32, 119, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, + 101, 1208, 301, 242, 822, 421, 801, 124,-32766,-32766, + -32766, 463, 899, 207, 102, 811, 909, 126, 38, 19, + 422, 545, 465, 1172, 466, 34, 467, 762,-32766, 423, + -32766,-32766, 647, 28, 29, 468, 822, 1036, 30, 469, + -216, 117, 72, 803, 49, 349, 350,-32766,-32766,-32766, + -32766,-32766,-32766, 472, 123, 1036, 234, 235, 236, 213, + 214, 215, 1036, 115, 641, 1138, 124,-32766, 200,-32766, + -32766,-32766, 237, 238, 421, 96, 97, 98, 293, 200, + 463, 585, 856, 638, 811, 439, 1036, 38, 19, 422, + 284, 465, 215, 466, 749, 467, 1178, 339, 423, 231, + 232, 233, 28, 29, 468, 822, 421, 30, 469, 296, + 200, 72, 463, 415, 349, 350, 811,-32766,-32766, 38, + 19, 422, 472, 465,-32766, 466, 118, 467, 377, 1064, + 423,-32766,-32766, 642, 28, 29, 468, 822, 1099, 30, + 469,-32766, 434, 72, 129, 640, 349, 350, 576, 205, + 492, 824, 638, 425, 472, 206,-32766,-32766,-32766, 244, + 492, 237, 238, 425, 243, 653, 449, 20, 429, 301, + 332, 454, 591, 130, 357, 421,-32766, 763, 764, 599, + 600, 463, 646, 824, 638, 811, 922, 666, 38, 19, + 422, 308, 465, 650, 466, 128, 467, 756, 643, 423, + 820, 934, 656, 28, 29, 468, 822, 421, 30, 469, + 833, 102, 72, 463, 44, 349, 350, 811, 51, 48, + 38, 19, 422, 472, 465, 43, 466, 41, 467, 299, + 45, 423, 42, 605, 513, 28, 29, 468,-32766, 632, + 30, 469, 579, 432, 72, 749, 750, 349, 350, 534, + 512, 435, 824, 638, 1206, 472, 433, 33, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 533, 776, 517, 524, 437, 622, 421, 1057, 612, 516, + 602, 619, 463, 279, 824, 638, 811, 458, 595, 38, + 19, 422, 596, 465, 330, 466, 240, 467, 975, 977, + 423, 609, 582, -80, 28, 29, 468, 537, 12, 30, + 469, 477, 327, 72, 208, 209, 349, 350, 9, 1098, + 210, 303, 211, 333, 472, 842, 841, 384, 757, 370, + 0, 328, 0, 0, 202, 322, 0, 0, -497, 208, + 209, 0, 1087, 1088, 320, 210,-32766, 211, -498, 0, + 1089, 1144, 0, 824, 638, 0, 0, 4, 835, 202, + -398, -407, 0, 3, 11, -406, 75, 1087, 1088, 0, + -497,-32766, 409, 393, 408, 1089, 385, 434, 526, 372, + 302, 1143, 864, 863, 796, 857, 813, 798, 819, 807, + 0, 761, 661, 660, 37, 36, 926, 565, 810, 1093, + 1094, 1095, 1096, 1090, 1091, 383, 854, 852, 929, 804, + 759, 1097, 1092, 806, 818, 290, 760, 928, 212, 802, + -32766, 930, 565, 927, 1093, 1094, 1095, 1096, 1090, 1091, + 383, 872, 1209, 639, 649, 651, 1097, 1092, 652, 654, + 655, 1034, 658, 212, 663,-32766, 664, 665, 122, 324, + 325, 405, 406, 0, 758, 1210, 839, 838, 766, 453, + 1207, 1179, 1177, 1163, 1175, 1078, 911, 1183, 1173, 829, + 836, 1038, 1039, 827, 935, 794, 765, 837, 662, 1050, + 861, 768, 767, 862, 0, 304, 289, 281, 25, 26, + 203, 305, 335, 74, 73, 411, 417, 35, 40,-32766, + 22, 0, 1015, 569, -217, 1016, 1103, 901, 1080, 1044, + 1040, 1041, 629, 559, 461, 457, 455, 450, 378, 16, + 15, 14, -216, 0, 0, -416, 0, 1045, 603, 1157, + 1104, 1205, 1077, 1174, 1158, 1162, 1176, 1063, 1048, 1049, + 1046, 1047 + ); + + protected $actionCheck = array( + 2, 3, 4, 5, 6, 8, 8, 9, 10, 11, + 12, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 7, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 8, 9, 10, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 7, 66, 67, 31, 32, + 33, 34, 54, 28, 0, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 68, 69, 70, 71, + 72, 73, 74, 79, 7, 77, 31, 32, 33, 34, + 35, 7, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 67, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 2, 3, 4, 5, + 6, 143, 144, 145, 7, 11, 12, 153, 14, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 103, 41, + 42, 43, 44, 67, 109, 152, 82, 112, 113, 114, + 115, 116, 117, 118, 77, 7, 79, 80, 102, 103, + 1, 47, 48, 8, 9, 10, 148, 53, 79, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 7, 67, 68, 69, 70, 8, 9, 10, 149, 75, + 76, 77, 77, 79, 8, 9, 10, 83, 8, 9, + 10, 1, 146, 139, 128, 28, 152, 30, 31, 32, + 33, 34, 35, 12, 28, 79, 102, 7, 28, 7, + 30, 31, 32, 33, 34, 149, 112, 112, 113, 114, + 115, 116, 117, 7, 120, 121, 35, 77, 149, 103, + 130, 131, 153, 129, 130, 109, 132, 133, 134, 135, + 136, 137, 138, 143, 118, 7, 146, 143, 144, 145, + 146, 7, 152, 29, 7, 151, 7, 153, 154, 152, + 156, 71, 72, 73, 74, 0, 1, 77, 50, 51, + 52, 81, 54, 12, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 66, 95, 96, 97, 98, 99, + 100, 101, 102, 143, 104, 105, 146, 148, 108, 7, + 150, 111, 112, 113, 114, 8, 9, 10, 35, 119, + 12, 148, 122, 123, 124, 125, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 28, 7, 30, 31, 32, + 33, 155, 8, 9, 10, 35, 71, 13, 148, 149, + 150, 13, 77, 130, 131, 79, 81, 12, 82, 84, + 85, 86, 28, 88, 152, 90, 143, 92, 67, 146, + 95, 8, 9, 10, 99, 100, 101, 102, 103, 104, + 105, 12, 148, 108, 109, 1, 111, 112, 113, 114, + 12, 28, 9, 10, 119, 77, 148, 122, 123, 124, + 125, 8, 9, 10, 35, 148, 8, 9, 10, 67, + 67, 28, 129, 29, 7, 29, 140, 141, 143, 148, + 7, 28, 29, 148, 149, 150, 28, 13, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 150, 54, 15, 1, 71, 148, 147, 8, 9, + 10, 77, 152, 15, 66, 81, 79, 149, 84, 85, + 86, 128, 88, 79, 90, 13, 92, 148, 28, 95, + 30, 31, 29, 99, 100, 101, 1, 12, 104, 105, + 152, 149, 108, 148, 67, 111, 112, 8, 9, 10, + 31, 32, 33, 119, 29, 12, 50, 51, 52, 8, + 9, 10, 12, 15, 29, 152, 147, 28, 28, 30, + 31, 32, 66, 67, 71, 47, 48, 49, 35, 28, + 77, 82, 148, 149, 81, 149, 12, 84, 85, 86, + 153, 88, 10, 90, 77, 92, 79, 153, 95, 47, + 48, 49, 99, 100, 101, 1, 71, 104, 105, 35, + 28, 108, 77, 123, 111, 112, 81, 8, 9, 84, + 85, 86, 119, 88, 31, 90, 149, 92, 78, 112, + 95, 31, 32, 29, 99, 100, 101, 1, 139, 104, + 105, 151, 146, 108, 149, 149, 111, 112, 153, 15, + 143, 148, 149, 146, 119, 15, 8, 9, 10, 15, + 143, 66, 67, 146, 15, 29, 72, 73, 151, 54, + 153, 72, 73, 97, 98, 71, 28, 102, 103, 106, + 107, 77, 29, 148, 149, 81, 148, 149, 84, 85, + 86, 29, 88, 29, 90, 29, 92, 148, 149, 95, + 29, 148, 149, 99, 100, 101, 1, 71, 104, 105, + 35, 66, 108, 77, 67, 111, 112, 81, 67, 67, + 84, 85, 86, 119, 88, 67, 90, 67, 92, 68, + 67, 95, 67, 74, 77, 99, 100, 101, 82, 89, + 104, 105, 87, 102, 108, 77, 77, 111, 112, 77, + 77, 77, 148, 149, 77, 119, 77, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 77, 77, 77, 82, 86, 79, 71, 79, 79, 79, + 79, 91, 77, 94, 148, 149, 81, 102, 96, 84, + 85, 86, 109, 88, 110, 90, 29, 92, 56, 57, + 95, 93, 96, 94, 99, 100, 101, 94, 94, 104, + 105, 129, 126, 108, 47, 48, 111, 112, 142, 139, + 53, 151, 55, 126, 119, 123, 123, 146, 150, 142, + -1, 127, -1, -1, 67, 128, -1, -1, 128, 47, + 48, -1, 75, 76, 128, 53, 79, 55, 128, -1, + 83, 139, -1, 148, 149, -1, -1, 142, 147, 67, + 142, 142, -1, 142, 142, 142, 149, 75, 76, -1, + 128, 79, 146, 146, 146, 83, 146, 146, 146, 146, + 151, 156, 148, 148, 148, 148, 148, 148, 148, 148, + -1, 148, 148, 148, 148, 148, 148, 130, 148, 132, + 133, 134, 135, 136, 137, 138, 148, 148, 148, 148, + 148, 144, 145, 148, 148, 151, 148, 148, 151, 148, + 153, 148, 130, 148, 132, 133, 134, 135, 136, 137, + 138, 148, 150, 149, 149, 149, 144, 145, 149, 149, + 149, 154, 149, 151, 149, 153, 149, 149, 149, 149, + 149, 149, 149, -1, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, -1, 151, 151, 151, 151, 151, + 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, + 151, -1, 152, 152, 152, 152, 152, 152, 152, 152, + 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, + 152, 152, 152, -1, -1, 154, -1, 155, 155, 155, + 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, + 155, 155 + ); + + protected $actionBase = array( + 0, 220, 295, 109, 109, 180, 739, -2, -2, -2, + -2, -2, 135, 574, 473, 606, 473, 505, 404, 675, + 675, 675, 330, 389, 513, 513, 826, 513, 328, 365, + 291, 520, 495, 221, 544, 398, 398, 398, 398, 134, + 134, 398, 398, 398, 398, 398, 398, 398, 398, 398, + 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, + 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, + 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, + 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, + 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, + 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, + 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, + 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, + 398, 254, 179, 434, 482, 741, 731, 735, 736, 828, + 659, 823, 780, 781, 636, 782, 783, 784, 785, 786, + 779, 787, 843, 788, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, -3, 354, 383, 413, 206, + 579, 521, 521, 521, 521, 521, 521, 521, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 403, 618, 618, 618, 552, + 737, 510, 762, 762, 762, 762, 762, 762, 762, 762, + 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, + 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, + 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, + 762, 762, 762, 762, 762, 470, -20, -20, 509, 563, + 327, 570, 210, 489, 197, 25, 25, 25, 25, 25, + 17, 45, 5, 5, 5, 5, 712, 305, 305, 305, + 305, 118, 118, 118, 118, 776, 777, 797, 799, 303, + 303, 652, 652, 631, 769, 498, 498, 522, 522, 487, + 487, 487, 487, 487, 487, 487, 487, 487, 487, 460, + 156, 818, 130, 130, 130, 130, 243, 84, 243, 682, + 695, 248, 248, 248, 476, 476, 476, 76, 661, 296, + 338, 338, 338, 296, 545, 545, 545, 477, 477, 477, + 477, 466, 687, 477, 477, 477, 362, 626, 97, 465, + 676, 800, 662, 803, 508, 689, 96, 698, 696, 407, + 611, 564, 569, 543, 688, 406, 407, 254, 523, 447, + 585, 720, 642, 349, 732, 38, 193, 363, 519, 59, + 414, 137, 770, 738, 821, 820, 13, 321, 690, 585, + 585, 585, 74, 469, 771, 772, 59, 358, 565, 565, + 565, 565, 802, 773, 565, 565, 565, 565, 801, 796, + 268, 277, 778, 232, 718, 638, 638, 638, 638, 638, + 638, 645, 638, 808, 627, 819, 819, 663, 671, 645, + 817, 817, 817, 817, 645, 638, 819, 819, 645, 631, + 819, 230, 645, 656, 638, 667, 667, 817, 715, 714, + 627, 670, 674, 819, 819, 819, 674, 663, 645, 817, + 653, 681, 67, 819, 817, 632, 632, 653, 645, 632, + 671, 632, 54, 641, 630, 816, 813, 815, 643, 754, + 673, 672, 805, 734, 812, 665, 649, 806, 807, 702, + 713, 711, 644, 518, 635, 628, 617, 633, 691, 622, + 686, 611, 701, 615, 615, 615, 680, 685, 680, 615, + 615, 615, 615, 615, 615, 615, 615, 842, 657, 693, + 677, 658, 710, 604, 703, 683, 610, 763, 650, 702, + 702, 795, 829, 836, 841, 757, 639, 699, 831, 680, + 856, 717, 274, 468, 640, 798, 651, 664, 700, 680, + 804, 680, 765, 680, 827, 647, 775, 702, 774, 615, + 825, 855, 854, 853, 852, 851, 850, 849, 848, 621, + 847, 709, 625, 835, 168, 809, 688, 646, 697, 708, + 433, 846, 648, 680, 680, 767, 687, 680, 768, 753, + 716, 839, 705, 834, 845, 650, 833, 680, 655, 844, + 433, 623, 629, 822, 678, 704, 814, 669, 824, 811, + 755, 458, 619, 752, 634, 706, 838, 837, 840, 707, + 756, 759, 614, 660, 668, 666, 789, 760, 810, 728, + 790, 791, 830, 679, 701, 692, 654, 684, 620, 761, + 792, 832, 729, 730, 743, 793, 745, 794, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 134, 134, + -2, -2, -2, -2, 0, 0, 0, 0, 0, -2, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 0, 0, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, + 418, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 418, -20, -20, -20, -20, 418, -20, -20, + -20, -20, -20, -20, -20, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, -20, 418, 418, 418, -20, 487, -20, 487, + 487, 487, 487, 487, 487, 487, 487, 487, 487, 487, + 487, 487, 487, 487, 487, 487, 487, 487, 487, 487, + 487, 487, 487, 487, 487, 487, 487, 487, 487, 487, + 487, 487, 487, 487, 487, 487, 487, 487, 487, 487, + 487, 487, 418, 0, 0, 418, -20, 418, -20, 418, + -20, 418, 418, 418, 418, 418, 418, -20, -20, -20, + -20, -20, -20, 0, 248, 248, 248, 248, -20, -20, + -20, -20, 55, 55, 55, 55, 487, 487, 487, 487, + 487, 487, 248, 248, 476, 476, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 487, 55, 487, 638, + 638, 638, 638, 638, 296, 638, 296, 296, 0, 0, + 0, 0, 0, 0, 638, 296, 0, -6, -6, -6, + 0, 638, 638, 638, 638, 638, 638, 638, 638, -6, + 638, 638, 638, 819, 296, 0, -6, 546, 546, 546, + 546, 433, 59, 0, 638, 638, 0, 670, 0, 0, + 0, 819, 0, 0, 0, 0, 0, 615, 274, 699, + 0, 322, 0, 0, 0, 0, 0, 0, 0, 639, + 322, 246, 246, 0, 0, 621, 615, 615, 615, 0, + 0, 639, 639, 0, 0, 0, 0, 0, 0, 427, + 639, 0, 0, 0, 0, 427, 279, 0, 0, 279, + 0, 433 + ); + + protected $actionDefault = array( + 3,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767, 524, 524,32767, 481,32767,32767, + 32767,32767,32767,32767,32767, 287, 287, 287,32767,32767, + 32767, 513, 513, 513, 513, 513, 513, 513, 513, 513, + 513, 513,32767,32767,32767,32767,32767, 369,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767, 375, 529,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767, 350, 351, 353, 354, 286, 514, + 237, 376, 528, 285, 239, 314, 485,32767,32767,32767, + 316, 116, 248, 193, 484, 119, 284, 224, 368, 370, + 315, 291, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 290, 441, 347, 346, 345, 443, + 32767, 442, 478, 478, 481,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767, 312, 469, 468, 313, 439, + 317, 440, 319, 444, 318, 335, 336, 333, 334, 337, + 446, 445, 462, 463, 460, 461, 289, 338, 339, 340, + 341, 464, 465, 466, 467, 271, 271, 271, 271,32767, + 32767, 523, 523,32767,32767, 326, 327, 453, 454,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 272,32767, 228, 228, 228, 228, 228,32767,32767,32767, + 32767, 321, 322, 320, 448, 449, 447,32767, 415,32767, + 32767,32767,32767, 417,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767, 486,32767,32767,32767, + 32767,32767,32767,32767,32767, 499, 404,32767,32767,32767, + 397, 212, 214, 161, 472,32767,32767,32767,32767, 504, + 331,32767,32767,32767,32767,32767,32767, 537,32767, 499, + 32767,32767,32767,32767,32767,32767,32767,32767, 344, 323, + 324, 325,32767,32767,32767,32767, 503, 497, 456, 457, + 458, 459,32767,32767, 450, 451, 452, 455,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767, 165,32767, 412,32767, 418, 418,32767,32767, 165, + 32767,32767,32767,32767, 165,32767, 502, 501, 165,32767, + 398, 480, 165, 178,32767, 176, 176,32767, 198, 198, + 32767,32767, 180, 473, 492,32767, 180,32767, 165,32767, + 386, 167, 480,32767,32767, 230, 230, 386, 165, 230, + 32767, 230,32767, 82, 422,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767, 399, + 32767,32767,32767,32767, 365, 366, 475, 488,32767, 489, + 32767, 397,32767, 329, 330, 332, 309,32767, 311, 355, + 356, 357, 358, 359, 360, 361, 363,32767,32767, 402, + 405,32767,32767,32767, 84, 108, 247,32767, 536, 84, + 400,32767,32767, 294, 536,32767,32767,32767,32767, 531, + 32767,32767, 288,32767,32767,32767, 84,32767, 84, 243, + 32767, 163,32767, 521,32767,32767, 497, 401,32767, 328, + 32767,32767,32767,32767,32767,32767,32767,32767,32767, 498, + 32767,32767,32767,32767, 219,32767, 435,32767, 84,32767, + 179,32767,32767, 292, 238,32767,32767, 530,32767,32767, + 32767,32767,32767,32767,32767,32767,32767, 164,32767,32767, + 181,32767,32767, 497,32767,32767,32767,32767,32767,32767, + 32767,32767, 283,32767,32767,32767,32767,32767, 497,32767, + 32767,32767, 223,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767, 82, 60,32767, 265,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767, 121, 121, + 3, 121, 121, 3, 121, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 121, 121, 121, 206, 250, 209, + 198, 198, 158, 250, 250, 250, 257 + ); + + protected $goto = array( + 160, 160, 134, 134, 139, 134, 135, 136, 137, 142, + 144, 181, 162, 158, 158, 158, 158, 139, 139, 159, + 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, + 154, 155, 156, 157, 178, 133, 179, 493, 494, 360, + 495, 499, 500, 501, 502, 503, 504, 505, 506, 962, + 138, 140, 141, 143, 165, 170, 180, 196, 245, 248, + 250, 252, 254, 255, 256, 257, 258, 259, 267, 268, + 269, 270, 285, 286, 311, 312, 313, 379, 380, 381, + 549, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 145, 146, 147, 161, 148, 163, + 149, 197, 164, 150, 151, 152, 198, 153, 131, 625, + 567, 753, 567, 567, 567, 567, 567, 567, 567, 567, + 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, + 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, + 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, + 567, 567, 567, 567, 567, 1100, 6, 1100, 1100, 1100, + 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, + 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, + 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, + 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, + 885, 885, 1189, 1189, 583, 586, 631, 168, 341, 509, + 754, 509, 171, 172, 173, 388, 389, 390, 391, 167, + 195, 199, 201, 249, 251, 253, 260, 261, 262, 263, + 264, 265, 271, 272, 273, 274, 287, 288, 314, 315, + 316, 394, 395, 396, 397, 169, 174, 246, 247, 175, + 176, 177, 497, 497, 497, 497, 497, 497, 523, 1200, + 1200, 784, 497, 497, 497, 497, 497, 497, 497, 497, + 497, 497, 508, 1200, 508, 387, 608, 543, 543, 573, + 539, 580, 606, 790, 752, 541, 541, 496, 498, 529, + 546, 574, 577, 587, 593, 871, 1169, 851, 1169, 657, + 634, 511, 880, 875, 566, 815, 566, 566, 566, 566, + 566, 566, 566, 566, 566, 566, 566, 566, 566, 566, + 566, 566, 566, 566, 566, 566, 566, 566, 566, 566, + 566, 566, 566, 566, 566, 566, 566, 566, 566, 566, + 566, 566, 566, 566, 566, 566, 566, 566, 566, 551, + 552, 553, 554, 555, 556, 557, 558, 560, 589, 514, + 855, 550, 590, 344, 404, 522, 519, 519, 519, 443, + 445, 933, 636, 519, 1161, 1101, 618, 931, 522, 522, + 276, 277, 278, 430, 430, 430, 430, 430, 430, 538, + 519, 903, 1058, 430, 430, 430, 430, 430, 430, 430, + 430, 430, 430, 1065, 544, 1065, 892, 892, 892, 892, + 892, 535, 892, 659, 562, 777, 594, 868, 882, 613, + 867, 616, 878, 620, 621, 628, 630, 635, 637, 342, + 343, 849, 849, 849, 849, 323, 310, 844, 850, 615, + 548, 1199, 1199, 572, 941, 777, 777, 519, 519, 536, + 568, 519, 519, 1081, 519, 1199, 510, 1168, 510, 1168, + 1019, 17, 13, 355, 1061, 1062, 1193, 520, 1058, 1202, + 611, 1076, 1075, 617, 361, 358, 547, 561, 1184, 1184, + 1184, 1059, 1160, 1059, 598, 607, 1186, 1149, 362, 21, + 1167, 1060, 527, 375, 604, 1009, 540, 369, 369, 369, + 898, 889, 960, 770, 770, 778, 778, 778, 780, 369, + 769, 398, 451, 347, 773, 368, 386, 373, 907, 771, + 645, 402, 10, 1051, 1056, 446, 781, 578, 912, 859, + 1146, 459, 949, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 528 + ); + + protected $gotoCheck = array( + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 53, + 112, 11, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 119, 90, 119, 119, 119, + 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, + 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, + 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, + 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, + 70, 70, 70, 70, 56, 56, 56, 23, 65, 112, + 12, 112, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 109, 109, 109, 109, 109, 109, 93, 134, + 134, 25, 109, 109, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 134, 109, 47, 47, 47, 47, 47, + 47, 36, 36, 10, 10, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 10, 110, 10, 110, 10, + 5, 10, 10, 10, 53, 46, 53, 53, 53, 53, + 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, + 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, + 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, + 53, 53, 53, 53, 53, 53, 53, 53, 53, 102, + 102, 102, 102, 102, 102, 102, 102, 102, 102, 8, + 29, 40, 63, 63, 63, 40, 8, 8, 8, 7, + 7, 7, 7, 8, 75, 7, 7, 7, 40, 40, + 61, 61, 61, 53, 53, 53, 53, 53, 53, 8, + 8, 77, 75, 53, 53, 53, 53, 53, 53, 53, + 53, 53, 53, 53, 101, 53, 53, 53, 53, 53, + 53, 28, 53, 28, 28, 19, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 65, + 65, 53, 53, 53, 53, 118, 118, 53, 53, 53, + 2, 133, 133, 2, 90, 19, 19, 8, 8, 8, + 8, 8, 8, 30, 8, 133, 115, 111, 115, 111, + 30, 30, 30, 30, 75, 75, 132, 8, 75, 133, + 57, 117, 117, 57, 43, 57, 8, 30, 111, 111, + 111, 75, 75, 75, 120, 45, 130, 124, 54, 30, + 111, 75, 54, 44, 30, 94, 54, 116, 116, 116, + 74, 72, 93, 19, 19, 19, 19, 19, 19, 116, + 19, 18, 54, 14, 21, 9, 116, 13, 78, 20, + 67, 17, 54, 105, 107, 59, 22, 60, 79, 64, + 123, 100, 92, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 93 + ); + + protected $gotoBase = array( + 0, 0, -200, 0, 0, 288, 0, 366, 42, 184, + 282, 109, 208, 170, 196, 0, 0, 115, 186, 98, + 171, 188, 86, 7, 0, 253, 0, 0, -228, 342, + 40, 0, 0, 0, 0, 0, 245, 0, 0, -22, + 339, 0, 0, 436, 203, 205, 289, -4, 0, 0, + 0, 0, 0, 104, 64, 0, -99, 14, 0, 89, + 81, -283, 0, 34, 82, -231, 0, 163, 0, 0, + -79, 0, 195, 0, 192, 38, 0, 368, 162, 87, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 144, 0, 72, 219, 194, 0, 0, 0, 0, 0, + 74, 379, 307, 0, 0, 107, 0, 105, 0, -27, + -3, 158, -90, 0, 0, 157, 177, 150, 117, -45, + 281, 0, 0, 78, 283, 0, 0, 0, 0, 0, + 204, 0, 439, 132, -50, 0 + ); + + protected $gotoDefault = array( + -32768, 462, 668, 2, 669, 740, 748, 601, 479, 515, + 853, 791, 792, 364, 410, 480, 363, 399, 392, 779, + 772, 774, 782, 166, 400, 785, 1, 787, 521, 823, + 1010, 351, 795, 352, 592, 797, 531, 799, 800, 132, + 481, 365, 366, 532, 374, 581, 814, 266, 371, 816, + 353, 817, 826, 354, 614, 597, 563, 610, 482, 442, + 575, 275, 542, 570, 858, 340, 866, 648, 874, 877, + 483, 564, 888, 448, 896, 1086, 382, 902, 908, 913, + 916, 418, 401, 588, 920, 921, 5, 925, 626, 627, + 940, 300, 948, 961, 416, 1029, 1031, 484, 485, 525, + 456, 507, 530, 486, 1052, 436, 403, 1055, 487, 488, + 426, 427, 1073, 1070, 346, 1154, 345, 444, 309, 1141, + 584, 1105, 452, 1192, 1150, 336, 489, 490, 359, 376, + 1187, 431, 1194, 1201, 337, 571 + ); + + protected $ruleToNonTerminal = array( + 0, 1, 3, 3, 2, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 8, 8, 9, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 14, 14, 15, 15, + 15, 15, 17, 17, 13, 13, 18, 18, 19, 19, + 20, 20, 21, 21, 16, 16, 22, 24, 24, 25, + 26, 26, 28, 27, 27, 27, 27, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 10, 10, 50, 50, + 52, 51, 51, 44, 44, 54, 54, 55, 55, 11, + 12, 12, 12, 58, 58, 58, 59, 59, 62, 62, + 60, 60, 63, 63, 37, 37, 46, 46, 49, 49, + 49, 48, 48, 64, 38, 38, 38, 38, 65, 65, + 66, 66, 67, 67, 35, 35, 31, 31, 68, 33, + 33, 69, 32, 32, 34, 34, 45, 45, 45, 56, + 56, 71, 71, 72, 72, 74, 74, 74, 73, 73, + 57, 57, 75, 75, 75, 76, 76, 77, 77, 77, + 41, 41, 78, 78, 78, 42, 42, 79, 79, 61, + 61, 80, 80, 80, 80, 85, 85, 86, 86, 87, + 87, 87, 87, 87, 88, 89, 89, 84, 84, 81, + 81, 83, 83, 91, 91, 90, 90, 90, 90, 90, + 90, 82, 82, 92, 92, 43, 43, 36, 36, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 30, 30, 40, 40, 97, 97, 98, + 98, 98, 98, 104, 93, 93, 100, 100, 106, 106, + 107, 108, 108, 108, 108, 108, 108, 112, 112, 53, + 53, 53, 94, 94, 113, 113, 109, 109, 114, 114, + 114, 114, 95, 95, 95, 99, 99, 99, 105, 105, + 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, + 119, 119, 119, 23, 23, 23, 23, 23, 23, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 103, 103, 96, 96, 96, 96, 120, 120, + 123, 123, 122, 122, 124, 124, 47, 47, 47, 47, + 126, 126, 125, 125, 125, 125, 125, 127, 127, 111, + 111, 115, 115, 110, 110, 128, 128, 128, 128, 116, + 116, 116, 116, 102, 102, 117, 117, 117, 70, 129, + 129, 130, 130, 130, 101, 101, 131, 131, 132, 132, + 132, 132, 118, 118, 118, 118, 134, 133, 133, 133, + 133, 133, 133, 133, 135, 135, 135 + ); + + protected $ruleToLength = array( + 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 1, 1, 1, 1, 1, 3, + 5, 4, 3, 4, 2, 3, 1, 1, 7, 8, + 6, 7, 3, 1, 3, 1, 3, 1, 1, 3, + 1, 2, 1, 2, 3, 1, 3, 3, 1, 3, + 2, 0, 1, 1, 1, 1, 1, 3, 5, 8, + 3, 5, 9, 3, 2, 3, 2, 3, 2, 3, + 2, 3, 3, 3, 1, 2, 5, 7, 9, 5, + 6, 3, 3, 2, 2, 1, 1, 1, 0, 2, + 8, 0, 4, 1, 3, 0, 1, 0, 1, 10, + 7, 6, 5, 1, 2, 2, 0, 2, 0, 2, + 0, 2, 1, 3, 1, 4, 1, 4, 1, 1, + 4, 1, 3, 3, 3, 4, 4, 5, 0, 2, + 4, 3, 1, 1, 1, 4, 0, 2, 3, 0, + 2, 4, 0, 2, 0, 3, 1, 2, 1, 1, + 0, 1, 3, 4, 6, 1, 1, 1, 0, 1, + 0, 2, 2, 3, 3, 1, 3, 1, 2, 2, + 3, 1, 1, 2, 4, 3, 1, 1, 3, 2, + 0, 3, 3, 9, 3, 1, 3, 0, 2, 4, + 5, 4, 4, 4, 3, 1, 1, 1, 3, 1, + 1, 0, 1, 1, 2, 1, 1, 1, 1, 1, + 1, 1, 3, 1, 3, 3, 1, 0, 1, 1, + 3, 3, 4, 4, 1, 2, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, + 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, + 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 1, 3, 5, 4, 3, 4, 4, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 1, 1, 1, 3, 2, 1, + 2, 10, 11, 3, 3, 2, 4, 4, 3, 4, + 4, 4, 4, 7, 3, 2, 0, 4, 1, 3, + 2, 2, 4, 6, 2, 2, 4, 1, 1, 1, + 2, 3, 1, 1, 1, 1, 1, 1, 3, 3, + 4, 4, 0, 2, 1, 0, 1, 1, 0, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 2, 1, 3, 1, 4, 3, 1, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, + 4, 3, 1, 3, 1, 1, 3, 3, 0, 2, + 0, 1, 3, 1, 3, 1, 1, 1, 1, 1, + 6, 4, 3, 4, 2, 4, 4, 1, 3, 1, + 2, 1, 1, 4, 1, 3, 6, 4, 4, 4, + 4, 1, 4, 0, 1, 1, 3, 1, 4, 3, + 1, 1, 1, 0, 0, 2, 3, 1, 3, 1, + 4, 2, 2, 2, 1, 2, 1, 1, 4, 3, + 3, 3, 6, 3, 1, 1, 1 + ); + + protected function reduceRule0() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule1() { + $this->semValue = $this->handleNamespaces($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule2() { + if (is_array($this->semStack[$this->stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); } else { $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; }; + } + + protected function reduceRule3() { + $this->semValue = array(); + } + + protected function reduceRule4() { + $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $nop = null; }; + if ($nop !== null) { $this->semStack[$this->stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule5() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule6() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule7() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule8() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule9() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule10() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule11() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule12() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule13() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule14() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule15() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule16() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule17() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule18() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule19() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule20() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule21() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule22() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule23() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule24() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule25() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule26() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule27() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule28() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule29() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule30() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule31() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule32() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule33() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule34() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule35() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule36() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule37() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule38() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule39() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule40() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule41() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule42() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule43() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule44() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule45() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule46() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule47() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule48() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule49() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule50() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule51() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule52() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule53() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule54() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule55() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule56() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule57() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule58() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule59() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule60() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule61() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule62() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule63() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule64() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule65() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule66() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule67() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule68() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule69() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule70() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule71() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule72() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule73() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule74() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule75() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule76() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule77() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule78() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule79() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule80() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule81() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule82() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule83() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule84() { + $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule85() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule86() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule87() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule88() { + $this->semValue = new Stmt\HaltCompiler($this->lexer->handleHaltCompiler(), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule89() { + $this->semValue = new Stmt\Namespace_($this->semStack[$this->stackPos-(3-2)], null, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule90() { + $this->semValue = new Stmt\Namespace_($this->semStack[$this->stackPos-(5-2)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule91() { + $this->semValue = new Stmt\Namespace_(null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule92() { + $this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(3-2)], Stmt\Use_::TYPE_NORMAL, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule93() { + $this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-2)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule94() { + $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule95() { + $this->semValue = new Stmt\Const_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule96() { + $this->semValue = Stmt\Use_::TYPE_FUNCTION; + } + + protected function reduceRule97() { + $this->semValue = Stmt\Use_::TYPE_CONSTANT; + } + + protected function reduceRule98() { + $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(7-3)], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(7-6)], $this->semStack[$this->stackPos-(7-2)], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); + } + + protected function reduceRule99() { + $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(8-4)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(8-7)], $this->semStack[$this->stackPos-(8-2)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes); + } + + protected function reduceRule100() { + $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(6-2)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(6-5)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); + } + + protected function reduceRule101() { + $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(7-3)], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(7-6)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); + } + + protected function reduceRule102() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule103() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule104() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule105() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule106() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule107() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule108() { + $this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(1-1)], null, Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule109() { + $this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule110() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule111() { + $this->semValue = $this->semStack[$this->stackPos-(2-2)]; + } + + protected function reduceRule112() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; $this->semValue->type = Stmt\Use_::TYPE_NORMAL; + } + + protected function reduceRule113() { + $this->semValue = $this->semStack[$this->stackPos-(2-2)]; $this->semValue->type = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule114() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule115() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule116() { + $this->semValue = new Node\Const_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule117() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule118() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule119() { + $this->semValue = new Node\Const_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule120() { + if (is_array($this->semStack[$this->stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); } else { $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; }; + } + + protected function reduceRule121() { + $this->semValue = array(); + } + + protected function reduceRule122() { + $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $nop = null; }; + if ($nop !== null) { $this->semStack[$this->stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule123() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule124() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule125() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule126() { + throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule127() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; $attrs = $this->startAttributeStack[$this->stackPos-(3-1)]; $stmts = $this->semValue; if (!empty($attrs['comments']) && isset($stmts[0])) {$stmts[0]->setAttribute('comments', array_merge($attrs['comments'], $stmts[0]->getAttribute('comments', []))); }; + } + + protected function reduceRule128() { + $this->semValue = new Stmt\If_($this->semStack[$this->stackPos-(5-2)], ['stmts' => is_array($this->semStack[$this->stackPos-(5-3)]) ? $this->semStack[$this->stackPos-(5-3)] : array($this->semStack[$this->stackPos-(5-3)]), 'elseifs' => $this->semStack[$this->stackPos-(5-4)], 'else' => $this->semStack[$this->stackPos-(5-5)]], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule129() { + $this->semValue = new Stmt\If_($this->semStack[$this->stackPos-(8-2)], ['stmts' => $this->semStack[$this->stackPos-(8-4)], 'elseifs' => $this->semStack[$this->stackPos-(8-5)], 'else' => $this->semStack[$this->stackPos-(8-6)]], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes); + } + + protected function reduceRule130() { + $this->semValue = new Stmt\While_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule131() { + $this->semValue = new Stmt\Do_($this->semStack[$this->stackPos-(5-4)], is_array($this->semStack[$this->stackPos-(5-2)]) ? $this->semStack[$this->stackPos-(5-2)] : array($this->semStack[$this->stackPos-(5-2)]), $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule132() { + $this->semValue = new Stmt\For_(['init' => $this->semStack[$this->stackPos-(9-3)], 'cond' => $this->semStack[$this->stackPos-(9-5)], 'loop' => $this->semStack[$this->stackPos-(9-7)], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); + } + + protected function reduceRule133() { + $this->semValue = new Stmt\Switch_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule134() { + $this->semValue = new Stmt\Break_(null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule135() { + $this->semValue = new Stmt\Break_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule136() { + $this->semValue = new Stmt\Continue_(null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule137() { + $this->semValue = new Stmt\Continue_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule138() { + $this->semValue = new Stmt\Return_(null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule139() { + $this->semValue = new Stmt\Return_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule140() { + $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule141() { + $this->semValue = new Stmt\Global_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule142() { + $this->semValue = new Stmt\Static_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule143() { + $this->semValue = new Stmt\Echo_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule144() { + $this->semValue = new Stmt\InlineHTML($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule145() { + $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule146() { + $this->semValue = new Stmt\Unset_($this->semStack[$this->stackPos-(5-3)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule147() { + $this->semValue = new Stmt\Foreach_($this->semStack[$this->stackPos-(7-3)], $this->semStack[$this->stackPos-(7-5)][0], ['keyVar' => null, 'byRef' => $this->semStack[$this->stackPos-(7-5)][1], 'stmts' => $this->semStack[$this->stackPos-(7-7)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); + } + + protected function reduceRule148() { + $this->semValue = new Stmt\Foreach_($this->semStack[$this->stackPos-(9-3)], $this->semStack[$this->stackPos-(9-7)][0], ['keyVar' => $this->semStack[$this->stackPos-(9-5)], 'byRef' => $this->semStack[$this->stackPos-(9-7)][1], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); + } + + protected function reduceRule149() { + $this->semValue = new Stmt\Declare_($this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule150() { + $this->semValue = new Stmt\TryCatch($this->semStack[$this->stackPos-(6-3)], $this->semStack[$this->stackPos-(6-5)], $this->semStack[$this->stackPos-(6-6)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); + } + + protected function reduceRule151() { + $this->semValue = new Stmt\Throw_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule152() { + $this->semValue = new Stmt\Goto_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule153() { + $this->semValue = new Stmt\Label($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule154() { + $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule155() { + $this->semValue = array(); /* means: no statement */ + } + + protected function reduceRule156() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule157() { + $startAttributes = $this->startAttributeStack[$this->stackPos-(1-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $this->semValue = null; }; + if ($this->semValue === null) $this->semValue = array(); /* means: no statement */ + } + + protected function reduceRule158() { + $this->semValue = array(); + } + + protected function reduceRule159() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule160() { + $this->semValue = new Stmt\Catch_($this->semStack[$this->stackPos-(8-3)], substr($this->semStack[$this->stackPos-(8-4)], 1), $this->semStack[$this->stackPos-(8-7)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes); + } + + protected function reduceRule161() { + $this->semValue = null; + } + + protected function reduceRule162() { + $this->semValue = $this->semStack[$this->stackPos-(4-3)]; + } + + protected function reduceRule163() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule164() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule165() { + $this->semValue = false; + } + + protected function reduceRule166() { + $this->semValue = true; + } + + protected function reduceRule167() { + $this->semValue = false; + } + + protected function reduceRule168() { + $this->semValue = true; + } + + protected function reduceRule169() { + $this->semValue = new Stmt\Function_($this->semStack[$this->stackPos-(10-3)], ['byRef' => $this->semStack[$this->stackPos-(10-2)], 'params' => $this->semStack[$this->stackPos-(10-5)], 'returnType' => $this->semStack[$this->stackPos-(10-7)], 'stmts' => $this->semStack[$this->stackPos-(10-9)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes); + } + + protected function reduceRule170() { + $this->semValue = new Stmt\Class_($this->semStack[$this->stackPos-(7-2)], ['type' => $this->semStack[$this->stackPos-(7-1)], 'extends' => $this->semStack[$this->stackPos-(7-3)], 'implements' => $this->semStack[$this->stackPos-(7-4)], 'stmts' => $this->semStack[$this->stackPos-(7-6)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); + } + + protected function reduceRule171() { + $this->semValue = new Stmt\Interface_($this->semStack[$this->stackPos-(6-2)], ['extends' => $this->semStack[$this->stackPos-(6-3)], 'stmts' => $this->semStack[$this->stackPos-(6-5)]], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); + } + + protected function reduceRule172() { + $this->semValue = new Stmt\Trait_($this->semStack[$this->stackPos-(5-2)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule173() { + $this->semValue = 0; + } + + protected function reduceRule174() { + $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; + } + + protected function reduceRule175() { + $this->semValue = Stmt\Class_::MODIFIER_FINAL; + } + + protected function reduceRule176() { + $this->semValue = null; + } + + protected function reduceRule177() { + $this->semValue = $this->semStack[$this->stackPos-(2-2)]; + } + + protected function reduceRule178() { + $this->semValue = array(); + } + + protected function reduceRule179() { + $this->semValue = $this->semStack[$this->stackPos-(2-2)]; + } + + protected function reduceRule180() { + $this->semValue = array(); + } + + protected function reduceRule181() { + $this->semValue = $this->semStack[$this->stackPos-(2-2)]; + } + + protected function reduceRule182() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule183() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule184() { + $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule185() { + $this->semValue = $this->semStack[$this->stackPos-(4-2)]; + } + + protected function reduceRule186() { + $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule187() { + $this->semValue = $this->semStack[$this->stackPos-(4-2)]; + } + + protected function reduceRule188() { + $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule189() { + $this->semValue = null; + } + + protected function reduceRule190() { + $this->semValue = $this->semStack[$this->stackPos-(4-2)]; + } + + protected function reduceRule191() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule192() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule193() { + $this->semValue = new Stmt\DeclareDeclare($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule194() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule195() { + $this->semValue = $this->semStack[$this->stackPos-(4-3)]; + } + + protected function reduceRule196() { + $this->semValue = $this->semStack[$this->stackPos-(4-2)]; + } + + protected function reduceRule197() { + $this->semValue = $this->semStack[$this->stackPos-(5-3)]; + } + + protected function reduceRule198() { + $this->semValue = array(); + } + + protected function reduceRule199() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule200() { + $this->semValue = new Stmt\Case_($this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule201() { + $this->semValue = new Stmt\Case_(null, $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule202() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule203() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule204() { + $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule205() { + $this->semValue = $this->semStack[$this->stackPos-(4-2)]; + } + + protected function reduceRule206() { + $this->semValue = array(); + } + + protected function reduceRule207() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule208() { + $this->semValue = new Stmt\ElseIf_($this->semStack[$this->stackPos-(3-2)], is_array($this->semStack[$this->stackPos-(3-3)]) ? $this->semStack[$this->stackPos-(3-3)] : array($this->semStack[$this->stackPos-(3-3)]), $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule209() { + $this->semValue = array(); + } + + protected function reduceRule210() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule211() { + $this->semValue = new Stmt\ElseIf_($this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule212() { + $this->semValue = null; + } + + protected function reduceRule213() { + $this->semValue = new Stmt\Else_(is_array($this->semStack[$this->stackPos-(2-2)]) ? $this->semStack[$this->stackPos-(2-2)] : array($this->semStack[$this->stackPos-(2-2)]), $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule214() { + $this->semValue = null; + } + + protected function reduceRule215() { + $this->semValue = new Stmt\Else_($this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule216() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)], false); + } + + protected function reduceRule217() { + $this->semValue = array($this->semStack[$this->stackPos-(2-2)], true); + } + + protected function reduceRule218() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)], false); + } + + protected function reduceRule219() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule220() { + $this->semValue = array(); + } + + protected function reduceRule221() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule222() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule223() { + $this->semValue = new Node\Param(substr($this->semStack[$this->stackPos-(4-4)], 1), null, $this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule224() { + $this->semValue = new Node\Param(substr($this->semStack[$this->stackPos-(6-4)], 1), $this->semStack[$this->stackPos-(6-6)], $this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-2)], $this->semStack[$this->stackPos-(6-3)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); + } + + protected function reduceRule225() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule226() { + $this->semValue = 'array'; + } + + protected function reduceRule227() { + $this->semValue = 'callable'; + } + + protected function reduceRule228() { + $this->semValue = null; + } + + protected function reduceRule229() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule230() { + $this->semValue = null; + } + + protected function reduceRule231() { + $this->semValue = $this->semStack[$this->stackPos-(2-2)]; + } + + protected function reduceRule232() { + $this->semValue = array(); + } + + protected function reduceRule233() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule234() { + $this->semValue = array(new Node\Arg($this->semStack[$this->stackPos-(3-2)], false, false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes)); + } + + protected function reduceRule235() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule236() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule237() { + $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(1-1)], false, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule238() { + $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(2-2)], true, false, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule239() { + $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(2-2)], false, true, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule240() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule241() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule242() { + $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule243() { + $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule244() { + $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule245() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule246() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule247() { + $this->semValue = new Stmt\StaticVar(substr($this->semStack[$this->stackPos-(1-1)], 1), null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule248() { + $this->semValue = new Stmt\StaticVar(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule249() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule250() { + $this->semValue = array(); + } + + protected function reduceRule251() { + $this->semValue = new Stmt\Property($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule252() { + $this->semValue = new Stmt\ClassConst($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule253() { + $this->semValue = new Stmt\ClassMethod($this->semStack[$this->stackPos-(9-4)], ['type' => $this->semStack[$this->stackPos-(9-1)], 'byRef' => $this->semStack[$this->stackPos-(9-3)], 'params' => $this->semStack[$this->stackPos-(9-6)], 'returnType' => $this->semStack[$this->stackPos-(9-8)], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); + } + + protected function reduceRule254() { + $this->semValue = new Stmt\TraitUse($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule255() { + $this->semValue = array(); + } + + protected function reduceRule256() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule257() { + $this->semValue = array(); + } + + protected function reduceRule258() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule259() { + $this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule260() { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(5-1)][0], $this->semStack[$this->stackPos-(5-1)][1], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule261() { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], $this->semStack[$this->stackPos-(4-3)], null, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule262() { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule263() { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule264() { + $this->semValue = array($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)]); + } + + protected function reduceRule265() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule266() { + $this->semValue = array(null, $this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule267() { + $this->semValue = null; + } + + protected function reduceRule268() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule269() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule270() { + $this->semValue = 0; + } + + protected function reduceRule271() { + $this->semValue = 0; + } + + protected function reduceRule272() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule273() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule274() { + Stmt\Class_::verifyModifier($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); $this->semValue = $this->semStack[$this->stackPos-(2-1)] | $this->semStack[$this->stackPos-(2-2)]; + } + + protected function reduceRule275() { + $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; + } + + protected function reduceRule276() { + $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; + } + + protected function reduceRule277() { + $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; + } + + protected function reduceRule278() { + $this->semValue = Stmt\Class_::MODIFIER_STATIC; + } + + protected function reduceRule279() { + $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; + } + + protected function reduceRule280() { + $this->semValue = Stmt\Class_::MODIFIER_FINAL; + } + + protected function reduceRule281() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule282() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule283() { + $this->semValue = new Stmt\PropertyProperty(substr($this->semStack[$this->stackPos-(1-1)], 1), null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule284() { + $this->semValue = new Stmt\PropertyProperty(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule285() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule286() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule287() { + $this->semValue = array(); + } + + protected function reduceRule288() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule289() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule290() { + $this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule291() { + $this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule292() { + $this->semValue = new Expr\AssignRef($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule293() { + $this->semValue = new Expr\AssignRef($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule294() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule295() { + $this->semValue = new Expr\Clone_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule296() { + $this->semValue = new Expr\AssignOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule297() { + $this->semValue = new Expr\AssignOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule298() { + $this->semValue = new Expr\AssignOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule299() { + $this->semValue = new Expr\AssignOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule300() { + $this->semValue = new Expr\AssignOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule301() { + $this->semValue = new Expr\AssignOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule302() { + $this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule303() { + $this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule304() { + $this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule305() { + $this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule306() { + $this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule307() { + $this->semValue = new Expr\AssignOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule308() { + $this->semValue = new Expr\PostInc($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule309() { + $this->semValue = new Expr\PreInc($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule310() { + $this->semValue = new Expr\PostDec($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule311() { + $this->semValue = new Expr\PreDec($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule312() { + $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule313() { + $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule314() { + $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule315() { + $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule316() { + $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule317() { + $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule318() { + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule319() { + $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule320() { + $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule321() { + $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule322() { + $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule323() { + $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule324() { + $this->semValue = new Expr\BinaryOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule325() { + $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule326() { + $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule327() { + $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule328() { + $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule329() { + $this->semValue = new Expr\UnaryPlus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule330() { + $this->semValue = new Expr\UnaryMinus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule331() { + $this->semValue = new Expr\BooleanNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule332() { + $this->semValue = new Expr\BitwiseNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule333() { + $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule334() { + $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule335() { + $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule336() { + $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule337() { + $this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule338() { + $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule339() { + $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule340() { + $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule341() { + $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule342() { + $this->semValue = new Expr\Instanceof_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule343() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule344() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule345() { + $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(5-1)], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule346() { + $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(4-1)], null, $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule347() { + $this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule348() { + $this->semValue = new Expr\Isset_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule349() { + $this->semValue = new Expr\Empty_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule350() { + $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule351() { + $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule352() { + $this->semValue = new Expr\Eval_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule353() { + $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule354() { + $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule355() { + $this->semValue = new Expr\Cast\Int_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule356() { + $this->semValue = new Expr\Cast\Double($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule357() { + $this->semValue = new Expr\Cast\String_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule358() { + $this->semValue = new Expr\Cast\Array_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule359() { + $this->semValue = new Expr\Cast\Object_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule360() { + $this->semValue = new Expr\Cast\Bool_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule361() { + $this->semValue = new Expr\Cast\Unset_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule362() { + $attrs = $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes; + $attrs['kind'] = strtolower($this->semStack[$this->stackPos-(2-1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; + $this->semValue = new Expr\Exit_($this->semStack[$this->stackPos-(2-2)], $attrs); + } + + protected function reduceRule363() { + $this->semValue = new Expr\ErrorSuppress($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule364() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule365() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule366() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule367() { + $this->semValue = new Expr\ShellExec($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule368() { + $this->semValue = new Expr\Print_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule369() { + $this->semValue = new Expr\Yield_(null, null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule370() { + $this->semValue = new Expr\YieldFrom($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule371() { + $this->semValue = new Expr\Closure(['static' => false, 'byRef' => $this->semStack[$this->stackPos-(10-2)], 'params' => $this->semStack[$this->stackPos-(10-4)], 'uses' => $this->semStack[$this->stackPos-(10-6)], 'returnType' => $this->semStack[$this->stackPos-(10-7)], 'stmts' => $this->semStack[$this->stackPos-(10-9)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes); + } + + protected function reduceRule372() { + $this->semValue = new Expr\Closure(['static' => true, 'byRef' => $this->semStack[$this->stackPos-(11-3)], 'params' => $this->semStack[$this->stackPos-(11-5)], 'uses' => $this->semStack[$this->stackPos-(11-7)], 'returnType' => $this->semStack[$this->stackPos-(11-8)], 'stmts' => $this->semStack[$this->stackPos-(11-10)]], $this->startAttributeStack[$this->stackPos-(11-1)] + $this->endAttributes); + } + + protected function reduceRule373() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule374() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule375() { + $this->semValue = new Expr\Yield_($this->semStack[$this->stackPos-(2-2)], null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule376() { + $this->semValue = new Expr\Yield_($this->semStack[$this->stackPos-(4-4)], $this->semStack[$this->stackPos-(4-2)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule377() { + $attrs = $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_LONG; + $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(4-3)], $attrs); + } + + protected function reduceRule378() { + $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_SHORT; + $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(3-2)], $attrs); + } + + protected function reduceRule379() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule380() { + $attrs = $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes; $attrs['kind'] = ($this->semStack[$this->stackPos-(4-1)][0] === "'" || ($this->semStack[$this->stackPos-(4-1)][1] === "'" && ($this->semStack[$this->stackPos-(4-1)][0] === 'b' || $this->semStack[$this->stackPos-(4-1)][0] === 'B')) ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED); + $this->semValue = new Expr\ArrayDimFetch(new Scalar\String_(Scalar\String_::parse($this->semStack[$this->stackPos-(4-1)]), $attrs), $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule381() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule382() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule383() { + $this->semValue = array(new Stmt\Class_(null, ['type' => 0, 'extends' => $this->semStack[$this->stackPos-(7-3)], 'implements' => $this->semStack[$this->stackPos-(7-4)], 'stmts' => $this->semStack[$this->stackPos-(7-6)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(7-2)]); + } + + protected function reduceRule384() { + $this->semValue = new Expr\New_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule385() { + list($class, $ctorArgs) = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = new Expr\New_($class, $ctorArgs, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule386() { + $this->semValue = array(); + } + + protected function reduceRule387() { + $this->semValue = $this->semStack[$this->stackPos-(4-3)]; + } + + protected function reduceRule388() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule389() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule390() { + $this->semValue = new Expr\ClosureUse(substr($this->semStack[$this->stackPos-(2-2)], 1), $this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule391() { + $this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule392() { + $this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule393() { + $this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-4)], $this->semStack[$this->stackPos-(6-6)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); + } + + protected function reduceRule394() { + + if ($this->semStack[$this->stackPos-(2-1)] instanceof Node\Expr\StaticPropertyFetch) { + $this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(2-1)]->class, new Expr\Variable($this->semStack[$this->stackPos-(2-1)]->name, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } elseif ($this->semStack[$this->stackPos-(2-1)] instanceof Node\Expr\ArrayDimFetch) { + $tmp = $this->semStack[$this->stackPos-(2-1)]; + while ($tmp->var instanceof Node\Expr\ArrayDimFetch) { + $tmp = $tmp->var; + } + + $this->semValue = new Expr\StaticCall($tmp->var->class, $this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + $tmp->var = new Expr\Variable($tmp->var->name, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } else { + throw new \Exception; + } + + } + + protected function reduceRule395() { + $this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule396() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule397() { + $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule398() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule399() { + $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule400() { + $this->semValue = new Name\FullyQualified($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule401() { + $this->semValue = new Name\Relative($this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule402() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule403() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule404() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule405() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule406() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule407() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule408() { + $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule409() { + $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule410() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule411() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule412() { + $this->semValue = null; + } + + protected function reduceRule413() { + $this->semValue = null; + } + + protected function reduceRule414() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule415() { + $this->semValue = array(); + } + + protected function reduceRule416() { + $this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$this->stackPos-(1-1)], '`', false), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes)); + } + + protected function reduceRule417() { + foreach ($this->semStack[$this->stackPos-(1-1)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', false); } }; $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule418() { + $this->semValue = array(); + } + + protected function reduceRule419() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule420() { + $this->semValue = Scalar\LNumber::fromString($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes, true); + } + + protected function reduceRule421() { + $this->semValue = new Scalar\DNumber(Scalar\DNumber::parse($this->semStack[$this->stackPos-(1-1)]), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule422() { + $attrs = $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes; $attrs['kind'] = ($this->semStack[$this->stackPos-(1-1)][0] === "'" || ($this->semStack[$this->stackPos-(1-1)][1] === "'" && ($this->semStack[$this->stackPos-(1-1)][0] === 'b' || $this->semStack[$this->stackPos-(1-1)][0] === 'B')) ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED); + $this->semValue = new Scalar\String_(Scalar\String_::parse($this->semStack[$this->stackPos-(1-1)], false), $attrs); + } + + protected function reduceRule423() { + $this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule424() { + $this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule425() { + $this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule426() { + $this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule427() { + $this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule428() { + $this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule429() { + $this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule430() { + $this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule431() { + $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(3-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(3-1)], $matches); $attrs['docLabel'] = $matches[1];; + $this->semValue = new Scalar\String_(Scalar\String_::parseDocString($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-2)], false), $attrs); + } + + protected function reduceRule432() { + $attrs = $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(2-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(2-1)], $matches); $attrs['docLabel'] = $matches[1];; + $this->semValue = new Scalar\String_('', $attrs); + } + + protected function reduceRule433() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule434() { + $this->semValue = new Expr\ClassConstFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule435() { + $this->semValue = new Expr\ConstFetch($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule436() { + $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule437() { + $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule438() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule439() { + $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule440() { + $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule441() { + $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule442() { + $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule443() { + $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule444() { + $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule445() { + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule446() { + $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule447() { + $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule448() { + $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule449() { + $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule450() { + $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule451() { + $this->semValue = new Expr\BinaryOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule452() { + $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule453() { + $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule454() { + $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule455() { + $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule456() { + $this->semValue = new Expr\UnaryPlus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule457() { + $this->semValue = new Expr\UnaryMinus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule458() { + $this->semValue = new Expr\BooleanNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule459() { + $this->semValue = new Expr\BitwiseNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule460() { + $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule461() { + $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule462() { + $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule463() { + $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule464() { + $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule465() { + $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule466() { + $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule467() { + $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule468() { + $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(5-1)], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule469() { + $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(4-1)], null, $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule470() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule471() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule472() { + $this->semValue = new Expr\ConstFetch($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule473() { + $this->semValue = new Expr\ClassConstFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule474() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule475() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule476() { + $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; + foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $attrs); + } + + protected function reduceRule477() { + $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(3-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(3-1)], $matches); $attrs['docLabel'] = $matches[1];; + foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, true); } } $s->value = preg_replace('~(\r\n|\n|\r)\z~', '', $s->value); if ('' === $s->value) array_pop($this->semStack[$this->stackPos-(3-2)]);; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $attrs); + } + + protected function reduceRule478() { + $this->semValue = array(); + } + + protected function reduceRule479() { + $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule480() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule481() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule482() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule483() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule484() { + $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule485() { + $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule486() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule487() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule488() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule489() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule490() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(6-2)], $this->semStack[$this->stackPos-(6-5)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); + } + + protected function reduceRule491() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule492() { + $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule493() { + $this->semValue = new Expr\MethodCall($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule494() { + $this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule495() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule496() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule497() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule498() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule499() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule500() { + $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule501() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule502() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule503() { + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule504() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule505() { + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(3-1)], substr($this->semStack[$this->stackPos-(3-3)], 1), $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule506() { + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-5)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); + } + + protected function reduceRule507() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule508() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule509() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule510() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule511() { + $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule512() { + $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule513() { + $this->semValue = null; + } + + protected function reduceRule514() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule515() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule516() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule517() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule518() { + $this->semValue = new Expr\List_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule519() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule520() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule521() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule522() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule523() { + $this->semValue = null; + } + + protected function reduceRule524() { + $this->semValue = array(); + } + + protected function reduceRule525() { + $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule526() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule527() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule528() { + $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule529() { + $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule530() { + $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(4-4)], $this->semStack[$this->stackPos-(4-1)], true, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule531() { + $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(2-2)], null, true, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule532() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule533() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule534() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule535() { + $this->semValue = array($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); + } + + protected function reduceRule536() { + $this->semValue = new Scalar\EncapsedStringPart($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule537() { + $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule538() { + $this->semValue = new Expr\ArrayDimFetch(new Expr\Variable(substr($this->semStack[$this->stackPos-(4-1)], 1), $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule539() { + $this->semValue = new Expr\PropertyFetch(new Expr\Variable(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule540() { + $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule541() { + $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule542() { + $this->semValue = new Expr\ArrayDimFetch(new Expr\Variable($this->semStack[$this->stackPos-(6-2)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(6-4)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); + } + + protected function reduceRule543() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule544() { + $this->semValue = new Scalar\String_($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule545() { + $this->semValue = new Scalar\String_($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule546() { + $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } +} diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php b/application/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php new file mode 100644 index 0000000..87d0bac --- /dev/null +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php @@ -0,0 +1,2707 @@ +'", + "T_IS_GREATER_OR_EQUAL", + "T_SL", + "T_SR", + "'+'", + "'-'", + "'.'", + "'*'", + "'/'", + "'%'", + "'!'", + "T_INSTANCEOF", + "'~'", + "T_INC", + "T_DEC", + "T_INT_CAST", + "T_DOUBLE_CAST", + "T_STRING_CAST", + "T_ARRAY_CAST", + "T_OBJECT_CAST", + "T_BOOL_CAST", + "T_UNSET_CAST", + "'@'", + "T_POW", + "'['", + "T_NEW", + "T_CLONE", + "T_EXIT", + "T_IF", + "T_ELSEIF", + "T_ELSE", + "T_ENDIF", + "T_LNUMBER", + "T_DNUMBER", + "T_STRING", + "T_STRING_VARNAME", + "T_VARIABLE", + "T_NUM_STRING", + "T_INLINE_HTML", + "T_ENCAPSED_AND_WHITESPACE", + "T_CONSTANT_ENCAPSED_STRING", + "T_ECHO", + "T_DO", + "T_WHILE", + "T_ENDWHILE", + "T_FOR", + "T_ENDFOR", + "T_FOREACH", + "T_ENDFOREACH", + "T_DECLARE", + "T_ENDDECLARE", + "T_AS", + "T_SWITCH", + "T_ENDSWITCH", + "T_CASE", + "T_DEFAULT", + "T_BREAK", + "T_CONTINUE", + "T_GOTO", + "T_FUNCTION", + "T_CONST", + "T_RETURN", + "T_TRY", + "T_CATCH", + "T_FINALLY", + "T_THROW", + "T_USE", + "T_INSTEADOF", + "T_GLOBAL", + "T_STATIC", + "T_ABSTRACT", + "T_FINAL", + "T_PRIVATE", + "T_PROTECTED", + "T_PUBLIC", + "T_VAR", + "T_UNSET", + "T_ISSET", + "T_EMPTY", + "T_HALT_COMPILER", + "T_CLASS", + "T_TRAIT", + "T_INTERFACE", + "T_EXTENDS", + "T_IMPLEMENTS", + "T_OBJECT_OPERATOR", + "T_LIST", + "T_ARRAY", + "T_CALLABLE", + "T_CLASS_C", + "T_TRAIT_C", + "T_METHOD_C", + "T_FUNC_C", + "T_LINE", + "T_FILE", + "T_START_HEREDOC", + "T_END_HEREDOC", + "T_DOLLAR_OPEN_CURLY_BRACES", + "T_CURLY_OPEN", + "T_PAAMAYIM_NEKUDOTAYIM", + "T_NAMESPACE", + "T_NS_C", + "T_DIR", + "T_NS_SEPARATOR", + "T_ELLIPSIS", + "';'", + "'{'", + "'}'", + "'('", + "')'", + "'`'", + "']'", + "'\"'", + "'$'" + ); + + protected $tokenToSymbol = array( + 0, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 53, 155, 157, 156, 52, 35, 157, + 151, 152, 50, 47, 7, 48, 49, 51, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 29, 148, + 41, 15, 43, 28, 65, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 67, 157, 154, 34, 157, 153, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 149, 33, 150, 55, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 1, 2, 3, 4, + 5, 6, 8, 9, 10, 11, 12, 13, 14, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 30, 31, 32, 36, 37, 38, 39, 40, 42, + 44, 45, 46, 54, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 66, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 157, 157, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 157, 157, 157, 157, + 157, 157, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147 + ); + + protected $action = array( + 559, 560, 561, 562, 563, 704, 564, 565, 566, 602, + 603,-32766,-32766,-32766,-32767,-32767,-32767,-32767, 88, 89, + 90, 91, 92, 520,-32766,-32766,-32766,-32766,-32766,-32766, + 0,-32766, 111,-32766,-32766,-32766,-32766,-32766,-32766,-32767, + -32767,-32767,-32767,-32767,-32766, 335,-32766,-32766,-32766,-32766, + -32766,-32766, 567,-32766,-32766,-32766,-32766, 279, 825, 826, + 827, 824, 823, 822,-32766,-32766, 568, 569, 570, 571, + 572, 573, 574, 265,-32766, 634,-32766,-32766,-32766,-32766, + -32766, 258, 575, 576, 577, 578, 579, 580, 581, 582, + 583, 584, 585, 605, 606, 607, 608, 609, 597, 598, + 599, 600, 601, 586, 587, 588, 589, 590, 591, 592, + 628, 629, 630, 631, 632, 633, 593, 594, 595, 596, + 626, 617, 615, 616, 612, 613, 24, 604, 610, 611, + 618, 619, 621, 620, 622, 623, 40, 41, 373, 42, + 43, 614, 625, 624, 6, 44, 45, 7, 46, -262, + 261, -418, 695, 825, 826, 827, 824, 823, 822, 817, + 113, 22, 93, 94, 95, 636, 235, 985, 236, 22, + 650, 651, 1027,-32766, 1029, 1028, -417, 949, 96,-32766, + 985, 47, 48, 509, -233, 949, 219, 49,-32766, 50, + 214, 215, 51, 52, 53, 54, 55, 56, 57, 58, + 929, 22, 229, 59, 342,-32766,-32766,-32766, -450, 950, + 951, 636, -418, 985, 330, -459, 221, 949,-32766,-32766, + -32766, 705, -160, 390, 391,-32766, -418,-32766,-32766,-32766, + -32766, 400, 391, -418, 344, -421, 346, -417,-32766, 209, + -32766,-32766,-32766, 361, 267, 63, 399, 28, 359, 510, + 118, -417, 344, 63, 386, 387, 803, 267, -417, 128, + -420, 370, 219, 390, 391, 39, 955, 956, 957, 958, + 952, 953, 237,-32766,-32766,-32766, -460, 400, 959, 954, + 344, 126,-32766,-32766,-32766, 61, 211, 247, 799, 248, + 267, 374, -122, -122, -122, -4, 705, 375, 117, 282, + -416, 694,-32766, 782, 32, 17, 376, -122, 377, -122, + 378, -122, 379, -122, 985, 380, -122, -122, -122, 33, + 34, 381, 343, 752, 35, 382, 251, 299, 60, -233, + 1019, 280, 281, 383, 384,-32766,-32766,-32766,-32766, 385, + 288, 21, 680, 723, 388, 389, 341, 112, 90, 91, + 92, 269, 37, -450, 354,-32766, 122,-32766,-32766,-32766, + -459, -416, -459, 362, 537, -159, 374, -160, 707, 525, + -122,-32766, 375, 353, 117, -416, 694, 125, -212, 32, + 17, 376, -416, 377, 222, 378, 121, 379, 25, 217, + 380, 267,-32766, 16, 33, 34, 381, 343, 336, 35, + 382, 998, 798, 60, 246, 705, 280, 281, 383, 384, + 776, 777, 447, 250, 385,-32766, 22, 642, 723, 388, + 389, -460, 115, -460, 114, 426, 70, 71, 72, 494, + 495, 1001, 949, 529, 110, 123,-32766, 109, 263, 1024, + 691, 542, 753, 707, 525, -4, 26, 235, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 116, 235, 119, 705, 374, 238, 350, 390, 391, + 527, 375, 963, 703, 96, 694, 783,-32766, 32, 17, + 376, 922, 377, 216, 378, 692, 379, 484, 18, 380, + 63, 220, 530, 33, 34, 381, 705, 716, 35, 382, + -159, 218, 60, 38, 649, 280, 281, 124, 290, 96, + -32766, 650, 651, 385, 802, 553, 504, 479, 480, 814, + 543, 643, 528, 439, 531, 309, 438, 425, 776, 777, + 420, 419, 351, 430, 374, 349, 637, 663, 636,-32766, + 375, 1022, 707, 525, 694, 489, 424, 32, 17, 376, + -216, 377, 508, 378,-32766, 379, 925, 493, 380, 482, + 435, 519, 33, 34, 381, 705, 374, 35, 382, 485, + 505, 60, 375, 348, 280, 281, 694, -80, 208, 32, + 17, 376, 385, 377, 442, 378, 10, 379, 368, 498, + 380, 262, 490, 538, 33, 34, 381, 705, 477, 35, + 382, 259, 264, 60, 965, 0, 280, 281, 725, 962, + 337, 707, 525, 0, 385, 260, 718, 724, 710, 0, + 0, 0, 0, 0, 0, 532, 0, 0, 0, 0, + 0, 0, 0, 3, 0, 374, 0, 0, 0, -376, + 9, 375, 287, 739, 525, 694, 0, 331, 32, 17, + 376, 302, 377, 314, 378, 315, 379, 319, 350, 380, + 432, 332, 328, 33, 34, 381, 705, 374, 35, 382, + 648, 693, 60, 375, 808, 280, 281, 694, 552, 551, + 32, 17, 376, 385, 377, 31, 378, 647, 379, 701, + 30, 380, 646, 807, 810, 33, 34, 381, 806, 735, + 35, 382, 737, 683, 60, 747, 746, 280, 281, 740, + 755, 685, 707, 525, 696, 385, 690, 702, 689, 688, + 27, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 809, 917, 257, 374, 256, 69, 549, + 548, 546, 375, 544, 707, 525, 694, 541, 540, 32, + 17, 376, 536, 377, 535, 378, 533, 379, 526, 329, + 380, 854, 856, 916, 33, 34, 381, 719, 712, 35, + 382, 1025, -416, 60, 815, 645, 280, 281, 1026, 721, + 653, 652, 720, 918, 385, 744, 655, 654, 722, 545, + 681, 1023, 986, 979, 991, 996, 999, 745, 644, 0, + 36, -441, 339, 334, 266, 234, 233, 232, 231, 213, + 212, 210, 129, 707, 525, -421, 910, 127, -420, -419, + 120, 20, 23, 68, 67, 29, 62, 64, 66, 65, + -443, 0, 15, -416, 19, 242, 894, 289, 456, -213, + 473, 893, 461, 518, 897, 11, 947, -416, 939, 515, + -212, 371, 367, 365, -416, 363, 14, 964, 13, 12, + 0, -387, 0, 483, 990, 1021, 977, 978, 948 + ); + + protected $actionCheck = array( + 2, 3, 4, 5, 6, 1, 8, 9, 10, 11, + 12, 8, 9, 10, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 77, 8, 9, 10, 8, 9, 10, + 0, 28, 13, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 28, 7, 30, 31, 32, 33, + 34, 35, 54, 8, 8, 9, 10, 7, 112, 113, + 114, 115, 116, 117, 8, 9, 68, 69, 70, 71, + 72, 73, 74, 7, 28, 77, 30, 31, 32, 33, + 34, 7, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 7, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 2, 3, 4, 5, + 6, 143, 144, 145, 103, 11, 12, 7, 14, 79, + 109, 67, 148, 112, 113, 114, 115, 116, 117, 118, + 7, 67, 50, 51, 52, 77, 54, 79, 7, 67, + 102, 103, 77, 103, 79, 80, 67, 83, 66, 109, + 79, 47, 48, 77, 7, 83, 35, 53, 118, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 112, 67, 68, 69, 70, 8, 9, 10, 7, 75, + 76, 77, 128, 79, 146, 7, 7, 83, 8, 9, + 10, 1, 7, 129, 130, 28, 142, 30, 31, 32, + 33, 143, 130, 149, 146, 151, 102, 128, 28, 13, + 30, 31, 32, 29, 156, 151, 112, 13, 7, 143, + 149, 142, 146, 151, 120, 121, 150, 156, 149, 15, + 151, 7, 35, 129, 130, 67, 132, 133, 134, 135, + 136, 137, 138, 8, 9, 10, 7, 143, 144, 145, + 146, 15, 8, 9, 10, 151, 7, 153, 148, 155, + 156, 71, 72, 73, 74, 0, 1, 77, 147, 7, + 67, 81, 28, 152, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 79, 95, 96, 97, 98, 99, + 100, 101, 102, 29, 104, 105, 128, 79, 108, 152, + 82, 111, 112, 113, 114, 8, 9, 10, 79, 119, + 142, 7, 122, 123, 124, 125, 7, 149, 47, 48, + 49, 67, 67, 152, 7, 28, 67, 30, 31, 79, + 152, 128, 154, 149, 29, 7, 71, 152, 148, 149, + 150, 112, 77, 7, 147, 142, 81, 15, 152, 84, + 85, 86, 149, 88, 35, 90, 15, 92, 140, 141, + 95, 156, 112, 152, 99, 100, 101, 102, 103, 104, + 105, 77, 148, 108, 109, 1, 111, 112, 113, 114, + 130, 131, 128, 128, 119, 156, 67, 122, 123, 124, + 125, 152, 15, 154, 15, 82, 8, 9, 10, 72, + 73, 152, 83, 29, 149, 29, 156, 15, 143, 150, + 148, 29, 148, 148, 149, 150, 28, 54, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 29, 54, 149, 1, 71, 29, 146, 129, 130, + 149, 77, 139, 29, 66, 81, 152, 79, 84, 85, + 86, 152, 88, 35, 90, 148, 92, 72, 73, 95, + 151, 35, 29, 99, 100, 101, 1, 35, 104, 105, + 152, 35, 108, 67, 148, 111, 112, 97, 98, 66, + 112, 102, 103, 119, 148, 149, 74, 106, 107, 148, + 149, 148, 149, 77, 29, 78, 77, 77, 130, 131, + 77, 77, 77, 82, 71, 77, 77, 77, 77, 82, + 77, 77, 148, 149, 81, 93, 79, 84, 85, 86, + 152, 88, 79, 90, 156, 92, 79, 79, 95, 79, + 86, 89, 99, 100, 101, 1, 71, 104, 105, 87, + 91, 108, 77, 102, 111, 112, 81, 94, 94, 84, + 85, 86, 119, 88, 94, 90, 94, 92, 102, 96, + 95, 110, 96, 29, 99, 100, 101, 1, 109, 104, + 105, 126, 126, 108, 139, -1, 111, 112, 123, 139, + 123, 148, 149, -1, 119, 127, 147, 123, 150, -1, + -1, -1, -1, -1, -1, 29, -1, -1, -1, -1, + -1, -1, -1, 142, -1, 71, -1, -1, -1, 142, + 142, 77, 142, 148, 149, 81, -1, 146, 84, 85, + 86, 146, 88, 146, 90, 146, 92, 146, 146, 95, + 146, 146, 149, 99, 100, 101, 1, 71, 104, 105, + 148, 148, 108, 77, 148, 111, 112, 81, 148, 148, + 84, 85, 86, 119, 88, 148, 90, 148, 92, 148, + 148, 95, 148, 148, 148, 99, 100, 101, 148, 148, + 104, 105, 148, 148, 108, 148, 148, 111, 112, 148, + 148, 148, 148, 149, 148, 119, 148, 148, 148, 148, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 148, 150, 149, 71, 149, 149, 149, + 149, 149, 77, 149, 148, 149, 81, 149, 149, 84, + 85, 86, 149, 88, 149, 90, 149, 92, 149, 149, + 95, 56, 57, 150, 99, 100, 101, 150, 150, 104, + 105, 150, 67, 108, 150, 150, 111, 112, 150, 150, + 150, 150, 150, 150, 119, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, -1, + 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, + 151, 151, 151, 148, 149, 151, 153, 151, 151, 151, + 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, + 151, -1, 152, 128, 152, 152, 152, 152, 152, 152, + 152, 152, 152, 152, 152, 152, 152, 142, 152, 152, + 152, 152, 152, 152, 149, 152, 152, 155, 152, 152, + -1, 153, -1, 154, 154, 154, 154, 154, 154 + ); + + protected $actionBase = array( + 0, 220, 295, 101, 106, 536, -2, -2, -2, -2, + -54, 473, 606, 574, 606, 404, 505, 675, 675, 675, + 151, 227, 458, 458, 458, 457, 442, 476, 466, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 294, 4, 234, 551, 693, 702, 696, 690, 703, 494, + 695, 694, 651, 652, 406, 653, 654, 655, 656, 698, + 719, 692, 701, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, 418, 45, + 19, 56, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 274, 274, 274, 327, 210, 197, 46, 715, 16, 3, + 3, 3, 3, 3, -27, -27, -27, -27, 349, 349, + 94, 94, 102, 102, 102, 102, 102, 102, 102, 102, + 102, 102, 102, 648, 639, 642, 643, 301, 301, 497, + 70, 408, 408, 408, 408, 88, 280, 343, 280, 475, + 712, 84, 109, 112, 112, 112, 68, 461, 248, 248, + 324, 324, 233, 233, 198, 233, 419, 419, 419, 259, + 259, 259, 259, 331, 259, 259, 259, 599, 467, 95, + 506, 645, 376, 503, 657, 285, 269, 208, 511, 525, + 235, 481, 235, 421, 425, 357, 507, 235, 235, 214, + 294, 381, 393, 533, 456, 366, 554, 292, 347, 284, + 383, 241, 598, 549, 700, 358, 699, 201, 279, 289, + 393, 393, 393, 334, 596, 523, 177, 226, 647, 620, + 215, 646, 641, 140, 254, 640, 339, 560, 471, 471, + 471, 471, 471, 471, 472, 471, 463, 680, 680, 459, + 490, 472, 659, 472, 471, 680, 472, 119, 472, 485, + 471, 486, 486, 463, 477, 498, 680, 680, 498, 459, + 472, 541, 540, 499, 479, 447, 447, 499, 472, 447, + 490, 447, 30, 685, 686, 454, 688, 684, 687, 661, + 683, 464, 619, 504, 495, 669, 668, 682, 460, 468, + 670, 681, 524, 532, 465, 422, 501, 446, 678, 481, + 522, 453, 453, 453, 446, 674, 453, 453, 453, 453, + 453, 453, 453, 453, 724, 510, 484, 581, 580, 579, + 409, 578, 515, 500, 407, 604, 480, 524, 524, 650, + 718, 673, 469, 667, 706, 679, 552, 153, 371, 666, + 649, 517, 470, 519, 665, 602, 704, 474, 638, 524, + 635, 453, 660, 689, 722, 723, 677, 720, 713, 161, + 521, 576, 66, 721, 658, 601, 600, 547, 717, 711, + 710, 496, 66, 573, 492, 697, 462, 662, 488, 663, + 617, 362, 266, 631, 676, 572, 716, 714, 708, 571, + 568, 615, 613, 244, 671, 335, 452, 489, 567, 487, + 483, 628, 609, 664, 565, 564, 627, 623, 707, 493, + 522, 508, 491, 502, 482, 608, 594, 709, 412, 561, + 595, 556, 478, 555, 634, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 134, 134, -2, -2, -2, + 0, 0, 0, 0, -2, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 134, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, + 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, + 418, 0, 418, 418, 418, 418, 418, 418, 112, 112, + 112, 112, 88, 88, 88, 88, 88, 88, 88, 88, + 88, 88, 88, 88, 88, 88, 88, 41, 41, 41, + 41, 112, 112, 88, 41, 88, 88, 88, 88, 0, + 88, 248, 88, 248, 248, 0, 0, 0, 0, 0, + 471, 248, 0, 0, 235, 235, 0, 0, 0, 0, + 471, 471, 471, 88, 88, 88, 88, 471, 88, 88, + 88, 235, 248, 0, 420, 420, 66, 420, 420, 0, + 0, 0, 471, 471, 0, 477, 0, 0, 0, 0, + 680, 0, 0, 0, 0, 0, 453, 153, 667, 0, + 50, 0, 0, 0, 0, 0, 469, 50, 209, 0, + 209, 0, 0, 0, 453, 453, 453, 0, 469, 469, + 0, 0, 74, 469, 0, 74, 38, 0, 0, 38, + 0, 66 + ); + + protected $actionDefault = array( + 3,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767, 453, 453, 413,32767,32767,32767,32767, 280, + 280, 280,32767, 414, 414, 414, 414, 414, 414, 414, + 32767,32767,32767,32767,32767, 358,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767, 458,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767, 341, 342, 344, 345, 279, 415, 232, + 457, 278, 116, 241, 234, 189, 119, 277, 220, 306, + 359, 308, 357, 361, 307, 284, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 283, 360, + 338, 337, 336, 304, 305, 309, 311, 282, 310, 327, + 328, 325, 326, 329, 330, 331, 332, 333,32767,32767, + 452, 452,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767, 264, 264, 264, 264, 318, 319,32767, + 265, 224, 224, 224, 224,32767, 224,32767,32767,32767, + 32767, 406, 335, 313, 314, 312,32767, 386,32767, 388, + 32767,32767, 301, 303, 381, 285,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767, 383, 416, 416,32767,32767, + 32767, 375,32767, 157, 208, 210, 391,32767,32767,32767, + 32767,32767, 323,32767,32767,32767,32767,32767,32767, 466, + 32767,32767,32767,32767,32767, 416,32767, 416,32767,32767, + 315, 316, 317,32767,32767,32767, 416, 416,32767,32767, + 416,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767, 161,32767,32767, 389, 389,32767, + 32767, 161, 384, 161,32767,32767, 161, 412, 161, 174, + 32767, 172, 172,32767,32767, 176,32767, 430, 176,32767, + 161, 194, 194, 367, 163, 226, 226, 367, 161, 226, + 32767, 226,32767,32767,32767, 82,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767, 377,32767,32767,32767,32767, 407, 428, 375, + 32767, 321, 322, 324,32767, 418, 346, 347, 348, 349, + 350, 351, 352, 354,32767, 380,32767,32767,32767,32767, + 32767,32767, 84, 108, 240,32767, 465, 84, 378,32767, + 465,32767,32767,32767,32767,32767,32767, 281,32767,32767, + 32767, 84,32767, 84,32767,32767,32767,32767, 416, 379, + 32767, 320, 392, 434,32767,32767, 417,32767,32767, 215, + 84,32767, 175,32767,32767,32767,32767,32767,32767,32767, + 32767,32767, 177,32767,32767, 416,32767,32767,32767,32767, + 32767,32767, 276,32767,32767,32767,32767,32767, 416,32767, + 32767,32767,32767, 219,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767, 82, + 60,32767, 258,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767, 121, 121, 3, 3, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 243, 154, 243, 202, 243, 243, + 205, 194, 194, 250 + ); + + protected $goto = array( + 159, 159, 132, 132, 132, 142, 144, 175, 160, 157, + 157, 157, 157, 158, 158, 158, 158, 158, 158, 158, + 153, 154, 155, 156, 172, 170, 173, 401, 402, 292, + 403, 406, 407, 408, 409, 410, 411, 412, 413, 841, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 143, + 169, 171, 174, 190, 193, 194, 195, 196, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 227, 228, + 243, 244, 245, 310, 311, 312, 451, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 145, 189, 146, 161, 162, 163, 191, 164, 147, 148, + 149, 165, 150, 192, 130, 166, 167, 151, 168, 152, + 511, 422, 452, 813, 523, 677, 639, 503, 811, 271, + 641, 427, 427, 427, 640, 754, 453, 734, 427, 547, + 5, 416, 763, 758, 418, 421, 434, 454, 455, 457, + 467, 486, 440, 443, 427, 550, 474, 476, 497, 501, + 751, 506, 507, 765, 514, 750, 516, 522, 761, 524, + 317, 488, 307, 307, 305, 305, 252, 253, 276, 448, + 255, 316, 277, 320, 475, 404, 404, 404, 404, 404, + 404, 404, 404, 404, 404, 404, 404, 404, 404, 404, + 926, 249, 240, 427, 427, 441, 460, 427, 427, 664, + 427, 768, 768, 1005, 1005, 492, 415, 671, 502, 428, + 291, 224, 415, 225, 226, 449, 405, 405, 405, 405, + 405, 405, 405, 405, 405, 405, 405, 405, 405, 405, + 405, 664, 664, 294, 1015, 1015, 433, 521, 444, 450, + 464, 1016, 1016, 698, 1015, 469, 470, 517, 738, 927, + 364, 1016, 472, 272, 327, 785, 446, 293, 8, 1009, + 928, 981, 487, 1018, 306, 1002, 888, 781, 772, 278, + 992, 321, 300, 660, 303, 534, 658, 325, 919, 924, + 789, 657, 657, 665, 665, 665, 667, 358, 656, 668, + 466, 792, 742, 369, 829, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 273, 274, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 930, 0, 775, 775, 775, + 775, 930, 775, 0, 775, 0, 0, 0, 0, 0, + 821, 0, 989, 0, 0, 0, 0, 0, 989, 0, + 0, 0, 0, 0, 0, 732, 732, 732, 732, 0, + 727, 733, 500, 1000, 1000, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 987, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 791, 0, 791, 0, 0, 0, 0, + 993, 994 + ); + + protected $gotoCheck = array( + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 51, 8, 7, 7, 7, 10, 10, 7, 7, 63, + 12, 8, 8, 8, 11, 10, 77, 10, 8, 10, + 89, 10, 10, 10, 38, 38, 38, 38, 38, 38, + 35, 35, 28, 8, 8, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 110, 110, 110, 110, 110, + 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, + 73, 109, 109, 8, 8, 8, 8, 8, 8, 19, + 8, 68, 68, 68, 68, 55, 106, 25, 55, 8, + 55, 59, 106, 59, 59, 8, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 19, 19, 52, 121, 121, 52, 5, 52, 2, + 2, 122, 122, 44, 121, 54, 54, 54, 29, 73, + 52, 122, 61, 61, 61, 75, 112, 41, 52, 120, + 73, 73, 43, 121, 42, 118, 93, 72, 70, 14, + 115, 18, 9, 21, 13, 65, 20, 17, 99, 101, + 76, 19, 19, 19, 19, 19, 19, 57, 19, 22, + 58, 78, 62, 97, 91, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 63, 63, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 51, -1, 51, 51, 51, + 51, 51, 51, -1, 51, -1, -1, -1, -1, -1, + 89, -1, 77, -1, -1, -1, -1, -1, 77, -1, + -1, -1, -1, -1, -1, 51, 51, 51, 51, -1, + 51, 51, 51, 77, 77, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 77, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 77, -1, 77, -1, -1, -1, -1, + 77, 77 + ); + + protected $gotoBase = array( + 0, 0, -288, 0, 0, 227, 0, 109, -135, 9, + 114, 122, 118, -4, 23, 0, 0, -52, 14, -47, + -3, 15, -64, -20, 0, 200, 0, 0, -384, 232, + 0, 0, 0, 0, 0, 110, 0, 0, 100, 0, + 0, 225, 51, 53, 229, -48, 0, 0, 0, 0, + 0, 106, -110, 0, 13, -161, 0, -65, -68, -335, + 0, -8, -67, -243, 0, -15, 0, 0, -7, 0, + 32, 0, 29, -96, 0, 234, -2, 123, -63, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, + 0, -76, 0, 31, 0, 0, 0, -74, 0, -60, + 0, -62, 0, 0, 0, 0, -23, 0, 0, -56, + -33, 8, 233, 0, 0, 19, 0, 0, 54, 0, + 235, -5, 2, 0 + ); + + protected $gotoDefault = array( + -32768, 372, 555, 2, 556, 627, 635, 481, 392, 423, + 736, 678, 679, 296, 333, 393, 295, 322, 318, 666, + 659, 661, 669, 131, 323, 672, 1, 674, 429, 706, + 284, 682, 285, 496, 684, 436, 686, 687, 417, 297, + 298, 437, 304, 468, 697, 197, 301, 699, 283, 700, + 709, 286, 499, 478, 458, 491, 394, 355, 465, 223, + 445, 462, 741, 270, 749, 539, 757, 760, 395, 459, + 771, 360, 779, 944, 313, 784, 790, 976, 793, 796, + 340, 324, 471, 800, 801, 4, 805, 512, 513, 820, + 230, 828, 840, 338, 907, 909, 431, 366, 920, 352, + 326, 923, 980, 345, 396, 356, 936, 254, 275, 239, + 397, 241, 414, 1008, 398, 357, 983, 308, 1003, 347, + 1010, 1017, 268, 463 + ); + + protected $ruleToNonTerminal = array( + 0, 1, 3, 3, 2, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 8, 8, 9, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 14, 14, 15, 15, + 15, 15, 17, 17, 13, 13, 18, 18, 19, 19, + 20, 20, 21, 21, 16, 16, 22, 24, 24, 25, + 26, 26, 28, 27, 27, 27, 27, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 10, 10, 48, 48, 50, 49, 49, 42, + 42, 52, 52, 53, 53, 11, 12, 12, 12, 56, + 56, 56, 57, 57, 60, 60, 58, 58, 61, 61, + 36, 36, 44, 44, 47, 47, 47, 46, 46, 62, + 37, 37, 37, 37, 63, 63, 64, 64, 65, 65, + 34, 34, 30, 30, 66, 32, 32, 67, 31, 31, + 33, 33, 43, 43, 43, 54, 54, 69, 69, 70, + 70, 72, 72, 72, 71, 71, 55, 55, 73, 73, + 74, 74, 75, 75, 75, 39, 39, 76, 40, 40, + 78, 78, 59, 59, 79, 79, 79, 79, 84, 84, + 85, 85, 86, 86, 86, 86, 86, 87, 88, 88, + 83, 83, 80, 80, 82, 82, 90, 90, 89, 89, + 89, 89, 89, 89, 81, 81, 91, 91, 41, 41, + 35, 35, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 98, 92, 92, 97, 97, 100, + 100, 101, 102, 102, 102, 106, 106, 51, 51, 51, + 93, 93, 104, 104, 94, 94, 96, 96, 96, 99, + 99, 110, 110, 111, 111, 111, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 113, 113, 38, 38, 108, 108, 108, 103, + 103, 103, 114, 114, 114, 114, 114, 114, 45, 45, + 45, 77, 77, 77, 116, 107, 107, 107, 107, 107, + 107, 105, 105, 105, 115, 115, 115, 68, 117, 117, + 118, 118, 118, 112, 112, 119, 119, 120, 120, 120, + 120, 109, 109, 109, 109, 122, 121, 121, 121, 121, + 121, 121, 121, 123, 123, 123 + ); + + protected $ruleToLength = array( + 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 1, 1, 1, 1, 1, 3, + 5, 4, 3, 4, 2, 3, 1, 1, 7, 8, + 6, 7, 3, 1, 3, 1, 3, 1, 1, 3, + 1, 2, 1, 2, 3, 1, 3, 3, 1, 3, + 2, 0, 1, 1, 1, 1, 1, 3, 7, 10, + 5, 7, 9, 5, 3, 3, 3, 3, 3, 3, + 1, 2, 5, 7, 9, 5, 6, 3, 3, 2, + 2, 1, 1, 1, 0, 2, 8, 0, 4, 1, + 3, 0, 1, 0, 1, 10, 7, 6, 5, 1, + 2, 2, 0, 2, 0, 2, 0, 2, 1, 3, + 1, 4, 1, 4, 1, 1, 4, 1, 3, 3, + 3, 4, 4, 5, 0, 2, 4, 3, 1, 1, + 1, 4, 0, 2, 5, 0, 2, 6, 0, 2, + 0, 3, 1, 2, 1, 1, 0, 1, 3, 4, + 6, 1, 1, 1, 0, 1, 0, 2, 2, 3, + 1, 3, 1, 2, 2, 3, 1, 1, 3, 1, + 1, 3, 2, 0, 3, 3, 9, 3, 1, 3, + 0, 2, 4, 5, 4, 4, 4, 3, 1, 1, + 1, 3, 1, 1, 0, 1, 1, 2, 1, 1, + 1, 1, 1, 1, 1, 3, 1, 3, 3, 1, + 0, 1, 1, 3, 3, 4, 1, 2, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 5, 4, 3, 4, + 4, 2, 2, 4, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 3, 2, 1, 2, + 4, 2, 10, 11, 7, 3, 2, 0, 4, 1, + 3, 2, 2, 2, 4, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 0, 3, 0, 1, 1, 0, + 1, 1, 3, 4, 3, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, + 3, 3, 0, 1, 0, 1, 1, 3, 1, 1, + 3, 1, 1, 4, 4, 4, 1, 4, 1, 1, + 3, 1, 4, 2, 3, 1, 4, 4, 3, 3, + 3, 1, 3, 1, 1, 3, 1, 4, 3, 1, + 1, 1, 0, 0, 2, 3, 1, 3, 1, 4, + 2, 2, 2, 1, 2, 1, 1, 4, 3, 3, + 3, 6, 3, 1, 1, 1 + ); + + protected function reduceRule0() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule1() { + $this->semValue = $this->handleNamespaces($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule2() { + if (is_array($this->semStack[$this->stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); } else { $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; }; + } + + protected function reduceRule3() { + $this->semValue = array(); + } + + protected function reduceRule4() { + $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $nop = null; }; + if ($nop !== null) { $this->semStack[$this->stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule5() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule6() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule7() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule8() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule9() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule10() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule11() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule12() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule13() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule14() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule15() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule16() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule17() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule18() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule19() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule20() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule21() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule22() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule23() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule24() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule25() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule26() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule27() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule28() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule29() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule30() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule31() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule32() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule33() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule34() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule35() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule36() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule37() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule38() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule39() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule40() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule41() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule42() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule43() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule44() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule45() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule46() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule47() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule48() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule49() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule50() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule51() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule52() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule53() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule54() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule55() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule56() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule57() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule58() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule59() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule60() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule61() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule62() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule63() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule64() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule65() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule66() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule67() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule68() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule69() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule70() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule71() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule72() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule73() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule74() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule75() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule76() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule77() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule78() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule79() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule80() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule81() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule82() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule83() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule84() { + $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule85() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule86() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule87() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule88() { + $this->semValue = new Stmt\HaltCompiler($this->lexer->handleHaltCompiler(), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule89() { + $this->semValue = new Stmt\Namespace_($this->semStack[$this->stackPos-(3-2)], null, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule90() { + $this->semValue = new Stmt\Namespace_($this->semStack[$this->stackPos-(5-2)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule91() { + $this->semValue = new Stmt\Namespace_(null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule92() { + $this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(3-2)], Stmt\Use_::TYPE_NORMAL, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule93() { + $this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-2)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule94() { + $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule95() { + $this->semValue = new Stmt\Const_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule96() { + $this->semValue = Stmt\Use_::TYPE_FUNCTION; + } + + protected function reduceRule97() { + $this->semValue = Stmt\Use_::TYPE_CONSTANT; + } + + protected function reduceRule98() { + $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(7-3)], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(7-6)], $this->semStack[$this->stackPos-(7-2)], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); + } + + protected function reduceRule99() { + $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(8-4)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(8-7)], $this->semStack[$this->stackPos-(8-2)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes); + } + + protected function reduceRule100() { + $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(6-2)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(6-5)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); + } + + protected function reduceRule101() { + $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(7-3)], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(7-6)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); + } + + protected function reduceRule102() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule103() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule104() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule105() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule106() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule107() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule108() { + $this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(1-1)], null, Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule109() { + $this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule110() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule111() { + $this->semValue = $this->semStack[$this->stackPos-(2-2)]; + } + + protected function reduceRule112() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; $this->semValue->type = Stmt\Use_::TYPE_NORMAL; + } + + protected function reduceRule113() { + $this->semValue = $this->semStack[$this->stackPos-(2-2)]; $this->semValue->type = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule114() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule115() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule116() { + $this->semValue = new Node\Const_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule117() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule118() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule119() { + $this->semValue = new Node\Const_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule120() { + if (is_array($this->semStack[$this->stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); } else { $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; }; + } + + protected function reduceRule121() { + $this->semValue = array(); + } + + protected function reduceRule122() { + $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $nop = null; }; + if ($nop !== null) { $this->semStack[$this->stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule123() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule124() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule125() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule126() { + throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule127() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; $attrs = $this->startAttributeStack[$this->stackPos-(3-1)]; $stmts = $this->semValue; if (!empty($attrs['comments']) && isset($stmts[0])) {$stmts[0]->setAttribute('comments', array_merge($attrs['comments'], $stmts[0]->getAttribute('comments', []))); }; + } + + protected function reduceRule128() { + $this->semValue = new Stmt\If_($this->semStack[$this->stackPos-(7-3)], ['stmts' => is_array($this->semStack[$this->stackPos-(7-5)]) ? $this->semStack[$this->stackPos-(7-5)] : array($this->semStack[$this->stackPos-(7-5)]), 'elseifs' => $this->semStack[$this->stackPos-(7-6)], 'else' => $this->semStack[$this->stackPos-(7-7)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); + } + + protected function reduceRule129() { + $this->semValue = new Stmt\If_($this->semStack[$this->stackPos-(10-3)], ['stmts' => $this->semStack[$this->stackPos-(10-6)], 'elseifs' => $this->semStack[$this->stackPos-(10-7)], 'else' => $this->semStack[$this->stackPos-(10-8)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes); + } + + protected function reduceRule130() { + $this->semValue = new Stmt\While_($this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule131() { + $this->semValue = new Stmt\Do_($this->semStack[$this->stackPos-(7-5)], is_array($this->semStack[$this->stackPos-(7-2)]) ? $this->semStack[$this->stackPos-(7-2)] : array($this->semStack[$this->stackPos-(7-2)]), $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); + } + + protected function reduceRule132() { + $this->semValue = new Stmt\For_(['init' => $this->semStack[$this->stackPos-(9-3)], 'cond' => $this->semStack[$this->stackPos-(9-5)], 'loop' => $this->semStack[$this->stackPos-(9-7)], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); + } + + protected function reduceRule133() { + $this->semValue = new Stmt\Switch_($this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule134() { + $this->semValue = new Stmt\Break_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule135() { + $this->semValue = new Stmt\Continue_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule136() { + $this->semValue = new Stmt\Return_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule137() { + $this->semValue = new Stmt\Global_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule138() { + $this->semValue = new Stmt\Static_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule139() { + $this->semValue = new Stmt\Echo_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule140() { + $this->semValue = new Stmt\InlineHTML($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule141() { + $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule142() { + $this->semValue = new Stmt\Unset_($this->semStack[$this->stackPos-(5-3)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule143() { + $this->semValue = new Stmt\Foreach_($this->semStack[$this->stackPos-(7-3)], $this->semStack[$this->stackPos-(7-5)][0], ['keyVar' => null, 'byRef' => $this->semStack[$this->stackPos-(7-5)][1], 'stmts' => $this->semStack[$this->stackPos-(7-7)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); + } + + protected function reduceRule144() { + $this->semValue = new Stmt\Foreach_($this->semStack[$this->stackPos-(9-3)], $this->semStack[$this->stackPos-(9-7)][0], ['keyVar' => $this->semStack[$this->stackPos-(9-5)], 'byRef' => $this->semStack[$this->stackPos-(9-7)][1], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); + } + + protected function reduceRule145() { + $this->semValue = new Stmt\Declare_($this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule146() { + $this->semValue = new Stmt\TryCatch($this->semStack[$this->stackPos-(6-3)], $this->semStack[$this->stackPos-(6-5)], $this->semStack[$this->stackPos-(6-6)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); + } + + protected function reduceRule147() { + $this->semValue = new Stmt\Throw_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule148() { + $this->semValue = new Stmt\Goto_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule149() { + $this->semValue = new Stmt\Label($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule150() { + $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule151() { + $this->semValue = array(); /* means: no statement */ + } + + protected function reduceRule152() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule153() { + $startAttributes = $this->startAttributeStack[$this->stackPos-(1-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $this->semValue = null; }; + if ($this->semValue === null) $this->semValue = array(); /* means: no statement */ + } + + protected function reduceRule154() { + $this->semValue = array(); + } + + protected function reduceRule155() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule156() { + $this->semValue = new Stmt\Catch_($this->semStack[$this->stackPos-(8-3)], substr($this->semStack[$this->stackPos-(8-4)], 1), $this->semStack[$this->stackPos-(8-7)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes); + } + + protected function reduceRule157() { + $this->semValue = null; + } + + protected function reduceRule158() { + $this->semValue = $this->semStack[$this->stackPos-(4-3)]; + } + + protected function reduceRule159() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule160() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule161() { + $this->semValue = false; + } + + protected function reduceRule162() { + $this->semValue = true; + } + + protected function reduceRule163() { + $this->semValue = false; + } + + protected function reduceRule164() { + $this->semValue = true; + } + + protected function reduceRule165() { + $this->semValue = new Stmt\Function_($this->semStack[$this->stackPos-(10-3)], ['byRef' => $this->semStack[$this->stackPos-(10-2)], 'params' => $this->semStack[$this->stackPos-(10-5)], 'returnType' => $this->semStack[$this->stackPos-(10-7)], 'stmts' => $this->semStack[$this->stackPos-(10-9)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes); + } + + protected function reduceRule166() { + $this->semValue = new Stmt\Class_($this->semStack[$this->stackPos-(7-2)], ['type' => $this->semStack[$this->stackPos-(7-1)], 'extends' => $this->semStack[$this->stackPos-(7-3)], 'implements' => $this->semStack[$this->stackPos-(7-4)], 'stmts' => $this->semStack[$this->stackPos-(7-6)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); + } + + protected function reduceRule167() { + $this->semValue = new Stmt\Interface_($this->semStack[$this->stackPos-(6-2)], ['extends' => $this->semStack[$this->stackPos-(6-3)], 'stmts' => $this->semStack[$this->stackPos-(6-5)]], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); + } + + protected function reduceRule168() { + $this->semValue = new Stmt\Trait_($this->semStack[$this->stackPos-(5-2)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule169() { + $this->semValue = 0; + } + + protected function reduceRule170() { + $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; + } + + protected function reduceRule171() { + $this->semValue = Stmt\Class_::MODIFIER_FINAL; + } + + protected function reduceRule172() { + $this->semValue = null; + } + + protected function reduceRule173() { + $this->semValue = $this->semStack[$this->stackPos-(2-2)]; + } + + protected function reduceRule174() { + $this->semValue = array(); + } + + protected function reduceRule175() { + $this->semValue = $this->semStack[$this->stackPos-(2-2)]; + } + + protected function reduceRule176() { + $this->semValue = array(); + } + + protected function reduceRule177() { + $this->semValue = $this->semStack[$this->stackPos-(2-2)]; + } + + protected function reduceRule178() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule179() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule180() { + $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule181() { + $this->semValue = $this->semStack[$this->stackPos-(4-2)]; + } + + protected function reduceRule182() { + $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule183() { + $this->semValue = $this->semStack[$this->stackPos-(4-2)]; + } + + protected function reduceRule184() { + $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule185() { + $this->semValue = null; + } + + protected function reduceRule186() { + $this->semValue = $this->semStack[$this->stackPos-(4-2)]; + } + + protected function reduceRule187() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule188() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule189() { + $this->semValue = new Stmt\DeclareDeclare($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule190() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule191() { + $this->semValue = $this->semStack[$this->stackPos-(4-3)]; + } + + protected function reduceRule192() { + $this->semValue = $this->semStack[$this->stackPos-(4-2)]; + } + + protected function reduceRule193() { + $this->semValue = $this->semStack[$this->stackPos-(5-3)]; + } + + protected function reduceRule194() { + $this->semValue = array(); + } + + protected function reduceRule195() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule196() { + $this->semValue = new Stmt\Case_($this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule197() { + $this->semValue = new Stmt\Case_(null, $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule198() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule199() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule200() { + $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule201() { + $this->semValue = $this->semStack[$this->stackPos-(4-2)]; + } + + protected function reduceRule202() { + $this->semValue = array(); + } + + protected function reduceRule203() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule204() { + $this->semValue = new Stmt\ElseIf_($this->semStack[$this->stackPos-(5-3)], is_array($this->semStack[$this->stackPos-(5-5)]) ? $this->semStack[$this->stackPos-(5-5)] : array($this->semStack[$this->stackPos-(5-5)]), $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule205() { + $this->semValue = array(); + } + + protected function reduceRule206() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule207() { + $this->semValue = new Stmt\ElseIf_($this->semStack[$this->stackPos-(6-3)], $this->semStack[$this->stackPos-(6-6)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); + } + + protected function reduceRule208() { + $this->semValue = null; + } + + protected function reduceRule209() { + $this->semValue = new Stmt\Else_(is_array($this->semStack[$this->stackPos-(2-2)]) ? $this->semStack[$this->stackPos-(2-2)] : array($this->semStack[$this->stackPos-(2-2)]), $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule210() { + $this->semValue = null; + } + + protected function reduceRule211() { + $this->semValue = new Stmt\Else_($this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule212() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)], false); + } + + protected function reduceRule213() { + $this->semValue = array($this->semStack[$this->stackPos-(2-2)], true); + } + + protected function reduceRule214() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)], false); + } + + protected function reduceRule215() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule216() { + $this->semValue = array(); + } + + protected function reduceRule217() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule218() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule219() { + $this->semValue = new Node\Param(substr($this->semStack[$this->stackPos-(4-4)], 1), null, $this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule220() { + $this->semValue = new Node\Param(substr($this->semStack[$this->stackPos-(6-4)], 1), $this->semStack[$this->stackPos-(6-6)], $this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-2)], $this->semStack[$this->stackPos-(6-3)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); + } + + protected function reduceRule221() { + $this->semValue = $this->handleScalarTypes($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule222() { + $this->semValue = 'array'; + } + + protected function reduceRule223() { + $this->semValue = 'callable'; + } + + protected function reduceRule224() { + $this->semValue = null; + } + + protected function reduceRule225() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule226() { + $this->semValue = null; + } + + protected function reduceRule227() { + $this->semValue = $this->semStack[$this->stackPos-(2-2)]; + } + + protected function reduceRule228() { + $this->semValue = array(); + } + + protected function reduceRule229() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule230() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule231() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule232() { + $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(1-1)], false, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule233() { + $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(2-2)], true, false, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule234() { + $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(2-2)], false, true, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule235() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule236() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule237() { + $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule238() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule239() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule240() { + $this->semValue = new Stmt\StaticVar(substr($this->semStack[$this->stackPos-(1-1)], 1), null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule241() { + $this->semValue = new Stmt\StaticVar(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule242() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule243() { + $this->semValue = array(); + } + + protected function reduceRule244() { + $this->semValue = new Stmt\Property($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule245() { + $this->semValue = new Stmt\ClassConst($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule246() { + $this->semValue = new Stmt\ClassMethod($this->semStack[$this->stackPos-(9-4)], ['type' => $this->semStack[$this->stackPos-(9-1)], 'byRef' => $this->semStack[$this->stackPos-(9-3)], 'params' => $this->semStack[$this->stackPos-(9-6)], 'returnType' => $this->semStack[$this->stackPos-(9-8)], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); + } + + protected function reduceRule247() { + $this->semValue = new Stmt\TraitUse($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule248() { + $this->semValue = array(); + } + + protected function reduceRule249() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule250() { + $this->semValue = array(); + } + + protected function reduceRule251() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule252() { + $this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule253() { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(5-1)][0], $this->semStack[$this->stackPos-(5-1)][1], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule254() { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], $this->semStack[$this->stackPos-(4-3)], null, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule255() { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule256() { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule257() { + $this->semValue = array($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)]); + } + + protected function reduceRule258() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule259() { + $this->semValue = array(null, $this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule260() { + $this->semValue = null; + } + + protected function reduceRule261() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule262() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule263() { + $this->semValue = 0; + } + + protected function reduceRule264() { + $this->semValue = 0; + } + + protected function reduceRule265() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule266() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule267() { + Stmt\Class_::verifyModifier($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); $this->semValue = $this->semStack[$this->stackPos-(2-1)] | $this->semStack[$this->stackPos-(2-2)]; + } + + protected function reduceRule268() { + $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; + } + + protected function reduceRule269() { + $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; + } + + protected function reduceRule270() { + $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; + } + + protected function reduceRule271() { + $this->semValue = Stmt\Class_::MODIFIER_STATIC; + } + + protected function reduceRule272() { + $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; + } + + protected function reduceRule273() { + $this->semValue = Stmt\Class_::MODIFIER_FINAL; + } + + protected function reduceRule274() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule275() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule276() { + $this->semValue = new Stmt\PropertyProperty(substr($this->semStack[$this->stackPos-(1-1)], 1), null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule277() { + $this->semValue = new Stmt\PropertyProperty(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule278() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule279() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule280() { + $this->semValue = array(); + } + + protected function reduceRule281() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule282() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule283() { + $this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule284() { + $this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule285() { + $this->semValue = new Expr\AssignRef($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule286() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule287() { + $this->semValue = new Expr\Clone_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule288() { + $this->semValue = new Expr\AssignOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule289() { + $this->semValue = new Expr\AssignOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule290() { + $this->semValue = new Expr\AssignOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule291() { + $this->semValue = new Expr\AssignOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule292() { + $this->semValue = new Expr\AssignOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule293() { + $this->semValue = new Expr\AssignOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule294() { + $this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule295() { + $this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule296() { + $this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule297() { + $this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule298() { + $this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule299() { + $this->semValue = new Expr\AssignOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule300() { + $this->semValue = new Expr\PostInc($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule301() { + $this->semValue = new Expr\PreInc($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule302() { + $this->semValue = new Expr\PostDec($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule303() { + $this->semValue = new Expr\PreDec($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule304() { + $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule305() { + $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule306() { + $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule307() { + $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule308() { + $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule309() { + $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule310() { + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule311() { + $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule312() { + $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule313() { + $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule314() { + $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule315() { + $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule316() { + $this->semValue = new Expr\BinaryOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule317() { + $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule318() { + $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule319() { + $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule320() { + $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule321() { + $this->semValue = new Expr\UnaryPlus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule322() { + $this->semValue = new Expr\UnaryMinus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule323() { + $this->semValue = new Expr\BooleanNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule324() { + $this->semValue = new Expr\BitwiseNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule325() { + $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule326() { + $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule327() { + $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule328() { + $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule329() { + $this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule330() { + $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule331() { + $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule332() { + $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule333() { + $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule334() { + $this->semValue = new Expr\Instanceof_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule335() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule336() { + $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(5-1)], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + } + + protected function reduceRule337() { + $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(4-1)], null, $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule338() { + $this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule339() { + $this->semValue = new Expr\Isset_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule340() { + $this->semValue = new Expr\Empty_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule341() { + $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule342() { + $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule343() { + $this->semValue = new Expr\Eval_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule344() { + $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule345() { + $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule346() { + $this->semValue = new Expr\Cast\Int_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule347() { + $this->semValue = new Expr\Cast\Double($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule348() { + $this->semValue = new Expr\Cast\String_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule349() { + $this->semValue = new Expr\Cast\Array_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule350() { + $this->semValue = new Expr\Cast\Object_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule351() { + $this->semValue = new Expr\Cast\Bool_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule352() { + $this->semValue = new Expr\Cast\Unset_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule353() { + $attrs = $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes; + $attrs['kind'] = strtolower($this->semStack[$this->stackPos-(2-1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; + $this->semValue = new Expr\Exit_($this->semStack[$this->stackPos-(2-2)], $attrs); + } + + protected function reduceRule354() { + $this->semValue = new Expr\ErrorSuppress($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule355() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule356() { + $this->semValue = new Expr\ShellExec($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule357() { + $this->semValue = new Expr\Print_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule358() { + $this->semValue = new Expr\Yield_(null, null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule359() { + $this->semValue = new Expr\Yield_($this->semStack[$this->stackPos-(2-2)], null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule360() { + $this->semValue = new Expr\Yield_($this->semStack[$this->stackPos-(4-4)], $this->semStack[$this->stackPos-(4-2)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule361() { + $this->semValue = new Expr\YieldFrom($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule362() { + $this->semValue = new Expr\Closure(['static' => false, 'byRef' => $this->semStack[$this->stackPos-(10-2)], 'params' => $this->semStack[$this->stackPos-(10-4)], 'uses' => $this->semStack[$this->stackPos-(10-6)], 'returnType' => $this->semStack[$this->stackPos-(10-7)], 'stmts' => $this->semStack[$this->stackPos-(10-9)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes); + } + + protected function reduceRule363() { + $this->semValue = new Expr\Closure(['static' => true, 'byRef' => $this->semStack[$this->stackPos-(11-3)], 'params' => $this->semStack[$this->stackPos-(11-5)], 'uses' => $this->semStack[$this->stackPos-(11-7)], 'returnType' => $this->semStack[$this->stackPos-(11-8)], 'stmts' => $this->semStack[$this->stackPos-(11-10)]], $this->startAttributeStack[$this->stackPos-(11-1)] + $this->endAttributes); + } + + protected function reduceRule364() { + $this->semValue = array(new Stmt\Class_(null, ['type' => 0, 'extends' => $this->semStack[$this->stackPos-(7-3)], 'implements' => $this->semStack[$this->stackPos-(7-4)], 'stmts' => $this->semStack[$this->stackPos-(7-6)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(7-2)]); + } + + protected function reduceRule365() { + $this->semValue = new Expr\New_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule366() { + list($class, $ctorArgs) = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = new Expr\New_($class, $ctorArgs, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule367() { + $this->semValue = array(); + } + + protected function reduceRule368() { + $this->semValue = $this->semStack[$this->stackPos-(4-3)]; + } + + protected function reduceRule369() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule370() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule371() { + $this->semValue = new Expr\ClosureUse(substr($this->semStack[$this->stackPos-(2-2)], 1), $this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule372() { + $this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule373() { + $this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule374() { + $this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule375() { + $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule376() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule377() { + $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule378() { + $this->semValue = new Name\FullyQualified($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule379() { + $this->semValue = new Name\Relative($this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule380() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule381() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule382() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule383() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule384() { + $this->semValue = null; + } + + protected function reduceRule385() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule386() { + $this->semValue = array(); + } + + protected function reduceRule387() { + $this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$this->stackPos-(1-1)], '`'), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes)); + } + + protected function reduceRule388() { + foreach ($this->semStack[$this->stackPos-(1-1)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', true); } }; $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule389() { + $this->semValue = array(); + } + + protected function reduceRule390() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule391() { + $this->semValue = new Expr\ConstFetch($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule392() { + $this->semValue = new Expr\ClassConstFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule393() { + $attrs = $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_LONG; + $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(4-3)], $attrs); + } + + protected function reduceRule394() { + $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_SHORT; + $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(3-2)], $attrs); + } + + protected function reduceRule395() { + $attrs = $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes; $attrs['kind'] = ($this->semStack[$this->stackPos-(1-1)][0] === "'" || ($this->semStack[$this->stackPos-(1-1)][1] === "'" && ($this->semStack[$this->stackPos-(1-1)][0] === 'b' || $this->semStack[$this->stackPos-(1-1)][0] === 'B')) ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED); + $this->semValue = new Scalar\String_(Scalar\String_::parse($this->semStack[$this->stackPos-(1-1)]), $attrs); + } + + protected function reduceRule396() { + $this->semValue = Scalar\LNumber::fromString($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule397() { + $this->semValue = new Scalar\DNumber(Scalar\DNumber::parse($this->semStack[$this->stackPos-(1-1)]), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule398() { + $this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule399() { + $this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule400() { + $this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule401() { + $this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule402() { + $this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule403() { + $this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule404() { + $this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule405() { + $this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule406() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule407() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule408() { + $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(3-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(3-1)], $matches); $attrs['docLabel'] = $matches[1];; + $this->semValue = new Scalar\String_(Scalar\String_::parseDocString($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-2)]), $attrs); + } + + protected function reduceRule409() { + $attrs = $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(2-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(2-1)], $matches); $attrs['docLabel'] = $matches[1];; + $this->semValue = new Scalar\String_('', $attrs); + } + + protected function reduceRule410() { + $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; + foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $attrs); + } + + protected function reduceRule411() { + $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(3-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(3-1)], $matches); $attrs['docLabel'] = $matches[1];; + foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, true); } } $s->value = preg_replace('~(\r\n|\n|\r)\z~', '', $s->value); if ('' === $s->value) array_pop($this->semStack[$this->stackPos-(3-2)]);; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $attrs); + } + + protected function reduceRule412() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule413() { + $this->semValue = $this->semStack[$this->stackPos]; + } + + protected function reduceRule414() { + $this->semValue = null; + } + + protected function reduceRule415() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule416() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule417() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule418() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule419() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule420() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule421() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule422() { + $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule423() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule424() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule425() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule426() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule427() { + $this->semValue = new Expr\MethodCall($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule428() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule429() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule430() { + $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule431() { + $this->semValue = substr($this->semStack[$this->stackPos-(1-1)], 1); + } + + protected function reduceRule432() { + $this->semValue = $this->semStack[$this->stackPos-(4-3)]; + } + + protected function reduceRule433() { + $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule434() { + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule435() { + $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule436() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule437() { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule438() { + $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule439() { + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule440() { + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule441() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule442() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule443() { + $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule444() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule445() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule446() { + $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule447() { + $this->semValue = new Expr\List_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule448() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule449() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule450() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule451() { + $this->semValue = $this->semStack[$this->stackPos-(1-1)]; + } + + protected function reduceRule452() { + $this->semValue = null; + } + + protected function reduceRule453() { + $this->semValue = array(); + } + + protected function reduceRule454() { + $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule455() { + $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; + } + + protected function reduceRule456() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule457() { + $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule458() { + $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule459() { + $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(4-4)], $this->semStack[$this->stackPos-(4-1)], true, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule460() { + $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(2-2)], null, true, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); + } + + protected function reduceRule461() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule462() { + $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; + } + + protected function reduceRule463() { + $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); + } + + protected function reduceRule464() { + $this->semValue = array($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); + } + + protected function reduceRule465() { + $this->semValue = new Scalar\EncapsedStringPart($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule466() { + $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule467() { + $this->semValue = new Expr\ArrayDimFetch(new Expr\Variable(substr($this->semStack[$this->stackPos-(4-1)], 1), $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + } + + protected function reduceRule468() { + $this->semValue = new Expr\PropertyFetch(new Expr\Variable(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule469() { + $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule470() { + $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + } + + protected function reduceRule471() { + $this->semValue = new Expr\ArrayDimFetch(new Expr\Variable($this->semStack[$this->stackPos-(6-2)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(6-4)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); + } + + protected function reduceRule472() { + $this->semValue = $this->semStack[$this->stackPos-(3-2)]; + } + + protected function reduceRule473() { + $this->semValue = new Scalar\String_($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule474() { + $this->semValue = new Scalar\String_($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } + + protected function reduceRule475() { + $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + } +} diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/Parser/Tokens.php b/application/vendor/nikic/php-parser/lib/PhpParser/Parser/Tokens.php new file mode 100644 index 0000000..861663f --- /dev/null +++ b/application/vendor/nikic/php-parser/lib/PhpParser/Parser/Tokens.php @@ -0,0 +1,144 @@ +startAttributeStack[$this->stackPos+1] = $startAttributes; + $this->lookaheadStartAttributes = $startAttributes; //$this->traceRead($symbol); } @@ -346,7 +351,9 @@ protected function getExpectedTokens($state) { && ($idx = $this->actionBase[$state + $this->YYNLSTATES] + $symbol) >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol ) { - if ($this->action[$idx] != $this->unexpectedTokenRule) { + if ($this->action[$idx] != $this->unexpectedTokenRule + && $this->action[$idx] != $this->defaultAction + ) { if (count($expected) == 4) { /* Too many expected tokens */ return array(); @@ -444,7 +451,7 @@ protected function handleNamespaces(array $stmts) { private function getNamespacingStyle(array $stmts) { $style = null; $hasNotAllowedStmts = false; - foreach ($stmts as $stmt) { + foreach ($stmts as $i => $stmt) { if ($stmt instanceof Node\Stmt\Namespace_) { $currentStyle = null === $stmt->stmts ? 'semicolon' : 'brace'; if (null === $style) { @@ -455,10 +462,40 @@ private function getNamespacingStyle(array $stmts) { } elseif ($style !== $currentStyle) { throw new Error('Cannot mix bracketed namespace declarations with unbracketed namespace declarations', $stmt->getLine()); } - } elseif (!$stmt instanceof Node\Stmt\Declare_ && !$stmt instanceof Node\Stmt\HaltCompiler) { - $hasNotAllowedStmts = true; + continue; + } + + /* declare(), __halt_compiler() and nops can be used before a namespace declaration */ + if ($stmt instanceof Node\Stmt\Declare_ + || $stmt instanceof Node\Stmt\HaltCompiler + || $stmt instanceof Node\Stmt\Nop) { + continue; } + + /* There may be a hashbang line at the very start of the file */ + if ($i == 0 && $stmt instanceof Node\Stmt\InlineHTML && preg_match('/\A#!.*\r?\n\z/', $stmt->value)) { + continue; + } + + /* Everything else if forbidden before namespace declarations */ + $hasNotAllowedStmts = true; } return $style; } + + protected function handleScalarTypes(Name $name) { + $scalarTypes = [ + 'bool' => true, + 'int' => true, + 'float' => true, + 'string' => true, + ]; + + if (!$name->isUnqualified()) { + return $name; + } + + $lowerName = strtolower($name->toString()); + return isset($scalarTypes[$lowerName]) ? $lowerName : $name; + } } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php b/application/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php new file mode 100644 index 0000000..28b9070 --- /dev/null +++ b/application/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php @@ -0,0 +1,43 @@ +pNoIndent(addcslashes($node->value, '\'\\')) . '\''; + $kind = $node->getAttribute('kind', Scalar\String_::KIND_SINGLE_QUOTED); + switch ($kind) { + case Scalar\String_::KIND_NOWDOC: + $label = $node->getAttribute('docLabel'); + if ($label && !$this->containsEndLabel($node->value, $label)) { + if ($node->value === '') { + return $this->pNoIndent("<<<'$label'\n$label") . $this->docStringEndToken; + } + + return $this->pNoIndent("<<<'$label'\n$node->value\n$label") + . $this->docStringEndToken; + } + /* break missing intentionally */ + case Scalar\String_::KIND_SINGLE_QUOTED: + return '\'' . $this->pNoIndent(addcslashes($node->value, '\'\\')) . '\''; + case Scalar\String_::KIND_HEREDOC: + $label = $node->getAttribute('docLabel'); + if ($label && !$this->containsEndLabel($node->value, $label)) { + if ($node->value === '') { + return $this->pNoIndent("<<<$label\n$label") . $this->docStringEndToken; + } + + $escaped = $this->escapeString($node->value, null); + return $this->pNoIndent("<<<$label\n" . $escaped ."\n$label") + . $this->docStringEndToken; + } + /* break missing intentionally */ + case Scalar\String_::KIND_DOUBLE_QUOTED: + return '"' . $this->escapeString($node->value, '"') . '"'; + } + throw new \Exception('Invalid string kind'); } public function pScalar_Encapsed(Scalar\Encapsed $node) { + if ($node->getAttribute('kind') === Scalar\String_::KIND_HEREDOC) { + $label = $node->getAttribute('docLabel'); + if ($label && !$this->encapsedContainsEndLabel($node->parts, $label)) { + if (count($node->parts) === 1 + && $node->parts[0] instanceof Scalar\EncapsedStringPart + && $node->parts[0]->value === '' + ) { + return $this->pNoIndent("<<<$label\n$label") . $this->docStringEndToken; + } + + return $this->pNoIndent( + "<<<$label\n" . $this->pEncapsList($node->parts, null) . "\n$label" + ) . $this->docStringEndToken; + } + } return '"' . $this->pEncapsList($node->parts, '"') . '"'; } public function pScalar_LNumber(Scalar\LNumber $node) { - return (string) $node->value; + $str = (string) $node->value; + switch ($node->getAttribute('kind', Scalar\LNumber::KIND_DEC)) { + case Scalar\LNumber::KIND_BIN: + return '0b' . base_convert($str, 10, 2); + case Scalar\LNumber::KIND_OCT: + return '0' . base_convert($str, 10, 8); + case Scalar\LNumber::KIND_DEC: + return $str; + case Scalar\LNumber::KIND_HEX: + return '0x' . base_convert($str, 10, 16); + } + throw new \Exception('Invalid number kind'); } public function pScalar_DNumber(Scalar\DNumber $node) { @@ -356,19 +412,19 @@ public function pExpr_Cast_Unset(Cast\Unset_ $node) { // Function calls and similar constructs public function pExpr_FuncCall(Expr\FuncCall $node) { - return $this->p($node->name) . '(' . $this->pCommaSeparated($node->args) . ')'; + return $this->pCallLhs($node->name) + . '(' . $this->pCommaSeparated($node->args) . ')'; } public function pExpr_MethodCall(Expr\MethodCall $node) { - return $this->pVarOrNewExpr($node->var) . '->' . $this->pObjectProperty($node->name) + return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name) . '(' . $this->pCommaSeparated($node->args) . ')'; } public function pExpr_StaticCall(Expr\StaticCall $node) { - return $this->p($node->class) . '::' + return $this->pDereferenceLhs($node->class) . '::' . ($node->name instanceof Expr ? ($node->name instanceof Expr\Variable - || $node->name instanceof Expr\ArrayDimFetch ? $this->p($node->name) : '{' . $this->p($node->name) . '}') : $node->name) @@ -422,7 +478,13 @@ public function pExpr_Variable(Expr\Variable $node) { } public function pExpr_Array(Expr\Array_ $node) { - return 'array(' . $this->pCommaSeparated($node->items) . ')'; + $syntax = $node->getAttribute('kind', + $this->options['shortArraySyntax'] ? Expr\Array_::KIND_SHORT : Expr\Array_::KIND_LONG); + if ($syntax === Expr\Array_::KIND_SHORT) { + return '[' . $this->pCommaSeparated($node->items) . ']'; + } else { + return 'array(' . $this->pCommaSeparated($node->items) . ')'; + } } public function pExpr_ArrayItem(Expr\ArrayItem $node) { @@ -431,7 +493,7 @@ public function pExpr_ArrayItem(Expr\ArrayItem $node) { } public function pExpr_ArrayDimFetch(Expr\ArrayDimFetch $node) { - return $this->pVarOrNewExpr($node->var) + return $this->pDereferenceLhs($node->var) . '[' . (null !== $node->dim ? $this->p($node->dim) : '') . ']'; } @@ -444,11 +506,11 @@ public function pExpr_ClassConstFetch(Expr\ClassConstFetch $node) { } public function pExpr_PropertyFetch(Expr\PropertyFetch $node) { - return $this->pVarOrNewExpr($node->var) . '->' . $this->pObjectProperty($node->name); + return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name); } public function pExpr_StaticPropertyFetch(Expr\StaticPropertyFetch $node) { - return $this->p($node->class) . '::$' . $this->pObjectProperty($node->name); + return $this->pDereferenceLhs($node->class) . '::$' . $this->pObjectProperty($node->name); } public function pExpr_ShellExec(Expr\ShellExec $node) { @@ -489,7 +551,9 @@ public function pExpr_Ternary(Expr\Ternary $node) { } public function pExpr_Exit(Expr\Exit_ $node) { - return 'die' . (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : ''); + $kind = $node->getAttribute('kind', Expr\Exit_::KIND_DIE); + return ($kind === Expr\Exit_::KIND_EXIT ? 'exit' : 'die') + . (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : ''); } public function pExpr_Yield(Expr\Yield_ $node) { @@ -516,17 +580,25 @@ public function pStmt_Namespace(Stmt\Namespace_ $node) { } public function pStmt_Use(Stmt\Use_ $node) { - return 'use ' - . ($node->type === Stmt\Use_::TYPE_FUNCTION ? 'function ' : '') - . ($node->type === Stmt\Use_::TYPE_CONSTANT ? 'const ' : '') + return 'use ' . $this->pUseType($node->type) . $this->pCommaSeparated($node->uses) . ';'; } + public function pStmt_GroupUse(Stmt\GroupUse $node) { + return 'use ' . $this->pUseType($node->type) . $this->pName($node->prefix) + . '\{' . $this->pCommaSeparated($node->uses) . '};'; + } + public function pStmt_UseUse(Stmt\UseUse $node) { - return $this->p($node->name) + return $this->pUseType($node->type) . $this->p($node->name) . ($node->name->getLast() !== $node->alias ? ' as ' . $node->alias : ''); } + private function pUseType($type) { + return $type === Stmt\Use_::TYPE_FUNCTION ? 'function ' + : ($type === Stmt\Use_::TYPE_CONSTANT ? 'const ' : ''); + } + public function pStmt_Interface(Stmt\Interface_ $node) { return 'interface ' . $node->name . (!empty($node->extends) ? ' extends ' . $this->pCommaSeparated($node->extends) : '') @@ -597,12 +669,12 @@ public function pStmt_Const(Stmt\Const_ $node) { } public function pStmt_Declare(Stmt\Declare_ $node) { - return 'declare (' . $this->pCommaSeparated($node->declares) . ') {' - . $this->pStmts($node->stmts) . "\n" . '}'; + return 'declare (' . $this->pCommaSeparated($node->declares) . ')' + . (null !== $node->stmts ? ' {' . $this->pStmts($node->stmts) . "\n" . '}' : ';'); } public function pStmt_DeclareDeclare(Stmt\DeclareDeclare $node) { - return $node->key . ' = ' . $this->p($node->value); + return $node->key . '=' . $this->p($node->value); } // Control flow @@ -726,6 +798,10 @@ public function pStmt_HaltCompiler(Stmt\HaltCompiler $node) { return '__halt_compiler();' . $node->remaining; } + public function pStmt_Nop(Stmt\Nop $node) { + return ''; + } + // Helpers protected function pType($node) { @@ -740,8 +816,7 @@ protected function pClassCommon(Stmt\Class_ $node, $afterClassToken) { . "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}'; } - /** @internal */ - public function pObjectProperty($node) { + protected function pObjectProperty($node) { if ($node instanceof Expr) { return '{' . $this->p($node) . '}'; } else { @@ -749,8 +824,7 @@ public function pObjectProperty($node) { } } - /** @internal */ - public function pModifiers($modifiers) { + protected function pModifiers($modifiers) { return ($modifiers & Stmt\Class_::MODIFIER_PUBLIC ? 'public ' : '') . ($modifiers & Stmt\Class_::MODIFIER_PROTECTED ? 'protected ' : '') . ($modifiers & Stmt\Class_::MODIFIER_PRIVATE ? 'private ' : '') @@ -759,12 +833,11 @@ public function pModifiers($modifiers) { . ($modifiers & Stmt\Class_::MODIFIER_FINAL ? 'final ' : ''); } - /** @internal */ - public function pEncapsList(array $encapsList, $quote) { + protected function pEncapsList(array $encapsList, $quote) { $return = ''; foreach ($encapsList as $element) { - if (is_string($element)) { - $return .= addcslashes($element, "\n\r\t\f\v$" . $quote . "\\"); + if ($element instanceof Scalar\EncapsedStringPart) { + $return .= $this->escapeString($element->value, $quote); } else { $return .= '{' . $this->p($element) . '}'; } @@ -773,12 +846,77 @@ public function pEncapsList(array $encapsList, $quote) { return $return; } - /** @internal */ - public function pVarOrNewExpr(Node $node) { - if ($node instanceof Expr\New_) { - return '(' . $this->p($node) . ')'; + protected function escapeString($string, $quote) { + if (null === $quote) { + // For doc strings, don't escape newlines + $escaped = addcslashes($string, "\t\f\v$\\"); } else { + $escaped = addcslashes($string, "\n\r\t\f\v$" . $quote . "\\"); + } + + // Escape other control characters + return preg_replace_callback('/([\0-\10\16-\37])(?=([0-7]?))/', function ($matches) { + $oct = decoct(ord($matches[1])); + if ($matches[2] !== '') { + // If there is a trailing digit, use the full three character form + return '\\' . str_pad($oct, 3, '0', STR_PAD_LEFT); + } + return '\\' . $oct; + }, $escaped); + } + + protected function containsEndLabel($string, $label, $atStart = true, $atEnd = true) { + $start = $atStart ? '(?:^|[\r\n])' : '[\r\n]'; + $end = $atEnd ? '(?:$|[;\r\n])' : '[;\r\n]'; + return false !== strpos($string, $label) + && preg_match('/' . $start . $label . $end . '/', $string); + } + + protected function encapsedContainsEndLabel(array $parts, $label) { + foreach ($parts as $i => $part) { + $atStart = $i === 0; + $atEnd = $i === count($parts) - 1; + if ($part instanceof Scalar\EncapsedStringPart + && $this->containsEndLabel($part->value, $label, $atStart, $atEnd) + ) { + return true; + } + } + return false; + } + + protected function pDereferenceLhs(Node $node) { + if ($node instanceof Expr\Variable + || $node instanceof Name + || $node instanceof Expr\ArrayDimFetch + || $node instanceof Expr\PropertyFetch + || $node instanceof Expr\StaticPropertyFetch + || $node instanceof Expr\FuncCall + || $node instanceof Expr\MethodCall + || $node instanceof Expr\StaticCall + || $node instanceof Expr\Array_ + || $node instanceof Scalar\String_ + || $node instanceof Expr\ConstFetch + || $node instanceof Expr\ClassConstFetch + ) { return $this->p($node); + } else { + return '(' . $this->p($node) . ')'; + } + } + + protected function pCallLhs(Node $node) { + if ($node instanceof Name + || $node instanceof Expr\Variable + || $node instanceof Expr\ArrayDimFetch + || $node instanceof Expr\FuncCall + || $node instanceof Expr\MethodCall + || $node instanceof Expr\StaticCall + || $node instanceof Expr\Array_ + ) { + return $this->p($node); + } else { + return '(' . $this->p($node) . ')'; } } } diff --git a/application/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php b/application/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php index e4195ff..d984d27 100644 --- a/application/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php +++ b/application/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php @@ -75,10 +75,25 @@ abstract class PrettyPrinterAbstract ); protected $noIndentToken; + protected $docStringEndToken; protected $canUseSemicolonNamespaces; + protected $options; - public function __construct() { + /** + * Creates a pretty printer instance using the given options. + * + * Supported options: + * * bool $shortArraySyntax = false: Whether to use [] instead of array() as the default array + * syntax, if the node does not specify a format. + * + * @param array $options Dictionary of formatting options + */ + public function __construct(array $options = []) { $this->noIndentToken = '_NO_INDENT_' . mt_rand(); + $this->docStringEndToken = '_DOC_STRING_END_' . mt_rand(); + + $defaultOptions = ['shortArraySyntax' => false]; + $this->options = $options + $defaultOptions; } /** @@ -91,7 +106,7 @@ public function __construct() { public function prettyPrint(array $stmts) { $this->preprocessNodes($stmts); - return ltrim(str_replace("\n" . $this->noIndentToken, "\n", $this->pStmts($stmts, false))); + return ltrim($this->handleMagicTokens($this->pStmts($stmts, false))); } /** @@ -102,7 +117,7 @@ public function prettyPrint(array $stmts) { * @return string Pretty printed node */ public function prettyPrintExpr(Expr $node) { - return str_replace("\n" . $this->noIndentToken, "\n", $this->p($node)); + return $this->handleMagicTokens($this->p($node)); } /** @@ -113,13 +128,17 @@ public function prettyPrintExpr(Expr $node) { * @return string Pretty printed statements */ public function prettyPrintFile(array $stmts) { - $p = rtrim($this->prettyPrint($stmts)); + if (!$stmts) { + return "\n?/', '', $p, -1, $count); - $p = preg_replace('/<\?php$/', '', $p); + $p = "prettyPrint($stmts); - if (!$count) { - $p = "\n?/', '', $p); + } + if ($stmts[count($stmts) - 1] instanceof Stmt\InlineHTML) { + $p = preg_replace('/<\?php$/', '', rtrim($p)); } return $p; @@ -140,6 +159,17 @@ protected function preprocessNodes(array $nodes) { } } + protected function handleMagicTokens($str) { + // Drop no-indent tokens + $str = str_replace($this->noIndentToken, '', $str); + + // Replace doc-string-end tokens with nothing or a newline + $str = str_replace($this->docStringEndToken . ";\n", ";\n", $str); + $str = str_replace($this->docStringEndToken, "\n", $str); + + return $str; + } + /** * Pretty prints an array of nodes (statements) and indents them optionally. * @@ -151,10 +181,15 @@ protected function preprocessNodes(array $nodes) { protected function pStmts(array $nodes, $indent = true) { $result = ''; foreach ($nodes as $node) { - $result .= "\n" - . $this->pComments($node->getAttribute('comments', array())) - . $this->p($node) - . ($node instanceof Expr ? ';' : ''); + $comments = $node->getAttribute('comments', array()); + if ($comments) { + $result .= "\n" . $this->pComments($comments); + if ($node instanceof Stmt\Nop) { + continue; + } + } + + $result .= "\n" . $this->p($node) . ($node instanceof Expr ? ';' : ''); } if ($indent) { @@ -252,19 +287,26 @@ protected function pCommaSeparated(array $nodes) { * * @param string $string Not to be indented string * - * @return mixed String marked with $this->noIndentToken's. + * @return string String marked with $this->noIndentToken's. */ protected function pNoIndent($string) { return str_replace("\n", "\n" . $this->noIndentToken, $string); } + /** + * Prints reformatted text of the passed comments. + * + * @param Comment[] $comments List of comments + * + * @return string Reformatted text of comments + */ protected function pComments(array $comments) { - $result = ''; + $formattedComments = []; foreach ($comments as $comment) { - $result .= $comment->getReformattedText() . "\n"; + $formattedComments[] = $comment->getReformattedText(); } - return $result; + return implode("\n", $formattedComments); } } diff --git a/application/vendor/nikic/php-parser/phpunit.xml.dist b/application/vendor/nikic/php-parser/phpunit.xml.dist index 0f48857..8c2d0f2 100644 --- a/application/vendor/nikic/php-parser/phpunit.xml.dist +++ b/application/vendor/nikic/php-parser/phpunit.xml.dist @@ -9,7 +9,7 @@ processIsolation="false" stopOnFailure="false" syntaxCheck="false" - bootstrap="./lib/bootstrap.php"> + bootstrap="./test/bootstrap.php"> ./test/ @@ -21,4 +21,4 @@ ./lib/PhpParser/ - \ No newline at end of file + diff --git a/application/vendor/nikic/php-parser/test/PhpParser/AutoloaderTest.php b/application/vendor/nikic/php-parser/test/PhpParser/AutoloaderTest.php index 4fdc4c2..e16b9f2 100644 --- a/application/vendor/nikic/php-parser/test/PhpParser/AutoloaderTest.php +++ b/application/vendor/nikic/php-parser/test/PhpParser/AutoloaderTest.php @@ -8,32 +8,9 @@ /* The autoloader is already active at this point, so we only check effects here. */ class AutoloaderTest extends \PHPUnit_Framework_TestCase { - public function testLegacyNames() { - $lexer = new \PHPParser_Lexer; - $parser = new \PHPParser_Parser($lexer); - $prettyPrinter = new \PHPParser_PrettyPrinter_Default; - - $this->assertInstanceof('PhpParser\Lexer', $lexer); - $this->assertInstanceof('PhpParser\Parser', $parser); - $this->assertInstanceof('PhpParser\PrettyPrinter\Standard', $prettyPrinter); - } - - public function testPhp7ReservedNames() { - if (version_compare(PHP_VERSION, '7.0-dev', '>=')) { - $this->markTestSkipped('Cannot create aliases to reserved names on PHP 7'); - } - - $this->assertTrue(new Expr\Cast\Bool_(new Expr\Variable('foo')) instanceof Expr\Cast\Bool); - $this->assertTrue(new Expr\Cast\Int_(new Expr\Variable('foo')) instanceof Expr\Cast\Int); - - $this->assertInstanceof('PhpParser\Node\Expr\Cast\Object_', new Expr\Cast\Object(new Expr\Variable('foo'))); - $this->assertInstanceof('PhpParser\Node\Expr\Cast\String_', new Expr\Cast\String(new Expr\Variable('foo'))); - $this->assertInstanceof('PhpParser\Node\Scalar\String_', new Scalar\String('foobar')); - } - public function testClassExists() { $this->assertTrue(class_exists('PhpParser\NodeVisitorAbstract')); - $this->assertTrue(class_exists('PHPParser_NodeVisitor_NameResolver')); + $this->assertFalse(class_exists('PHPParser_NodeVisitor_NameResolver')); $this->assertFalse(class_exists('PhpParser\FooBar')); $this->assertFalse(class_exists('PHPParser_FooBar')); diff --git a/application/vendor/nikic/php-parser/test/PhpParser/Builder/FunctionTest.php b/application/vendor/nikic/php-parser/test/PhpParser/Builder/FunctionTest.php index 88fb205..7b397fe 100644 --- a/application/vendor/nikic/php-parser/test/PhpParser/Builder/FunctionTest.php +++ b/application/vendor/nikic/php-parser/test/PhpParser/Builder/FunctionTest.php @@ -76,6 +76,16 @@ public function testDocComment() { )), $node); } + public function testReturnType() { + $node = $this->createFunctionBuilder('test') + ->setReturnType('bool') + ->getNode(); + + $this->assertEquals(new Stmt\Function_('test', array( + 'returnType' => 'bool' + ), array()), $node); + } + /** * @expectedException \LogicException * @expectedExceptionMessage Expected parameter node, got "Name" diff --git a/application/vendor/nikic/php-parser/test/PhpParser/Builder/MethodTest.php b/application/vendor/nikic/php-parser/test/PhpParser/Builder/MethodTest.php index 668d13f..aa8e976 100644 --- a/application/vendor/nikic/php-parser/test/PhpParser/Builder/MethodTest.php +++ b/application/vendor/nikic/php-parser/test/PhpParser/Builder/MethodTest.php @@ -120,6 +120,15 @@ public function testDocComment() { )), $node); } + public function testReturnType() { + $node = $this->createMethodBuilder('test') + ->setReturnType('bool') + ->getNode(); + $this->assertEquals(new Stmt\ClassMethod('test', array( + 'returnType' => 'bool' + ), array()), $node); + } + /** * @expectedException \LogicException * @expectedExceptionMessage Cannot add statements to an abstract method diff --git a/application/vendor/nikic/php-parser/test/PhpParser/CodeParsingTest.php b/application/vendor/nikic/php-parser/test/PhpParser/CodeParsingTest.php new file mode 100644 index 0000000..5eb695e --- /dev/null +++ b/application/vendor/nikic/php-parser/test/PhpParser/CodeParsingTest.php @@ -0,0 +1,69 @@ + array( + 'startLine', 'endLine', 'startFilePos', 'endFilePos', 'comments' + ))); + $parser5 = new Parser\Php5($lexer, array( + 'throwOnError' => false, + )); + $parser7 = new Parser\Php7($lexer, array( + 'throwOnError' => false, + )); + + $output5 = $this->getParseOutput($parser5, $code); + $output7 = $this->getParseOutput($parser7, $code); + + if ($mode === 'php5') { + $this->assertSame($expected, $output5, $name); + $this->assertNotSame($expected, $output7, $name); + } else if ($mode === 'php7') { + $this->assertNotSame($expected, $output5, $name); + $this->assertSame($expected, $output7, $name); + } else { + $this->assertSame($expected, $output5, $name); + $this->assertSame($expected, $output7, $name); + } + } + + private function getParseOutput(Parser $parser, $code) { + $stmts = $parser->parse($code); + $errors = $parser->getErrors(); + + $output = ''; + foreach ($errors as $error) { + $output .= $this->formatErrorMessage($error, $code) . "\n"; + } + + if (null !== $stmts) { + $dumper = new NodeDumper(['dumpComments' => true]); + $output .= $dumper->dump($stmts); + } + + return canonicalize($output); + } + + public function provideTestParse() { + return $this->getTests(__DIR__ . '/../code/parser', 'test'); + } + + private function formatErrorMessage(Error $e, $code) { + if ($e->hasColumnInfo()) { + return $e->getRawMessage() . ' from ' . $e->getStartLine() . ':' . $e->getStartColumn($code) + . ' to ' . $e->getEndLine() . ':' . $e->getEndColumn($code); + } else { + return $e->getMessage(); + } + } +} diff --git a/application/vendor/nikic/php-parser/test/PhpParser/CodeTestAbstract.php b/application/vendor/nikic/php-parser/test/PhpParser/CodeTestAbstract.php index d22617e..369ee41 100644 --- a/application/vendor/nikic/php-parser/test/PhpParser/CodeTestAbstract.php +++ b/application/vendor/nikic/php-parser/test/PhpParser/CodeTestAbstract.php @@ -5,49 +5,57 @@ abstract class CodeTestAbstract extends \PHPUnit_Framework_TestCase { protected function getTests($directory, $fileExtension) { + $directory = realpath($directory); $it = new \RecursiveDirectoryIterator($directory); $it = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::LEAVES_ONLY); $it = new \RegexIterator($it, '(\.' . preg_quote($fileExtension) . '$)'); $tests = array(); foreach ($it as $file) { - $fileName = realpath($file->getPathname()); + $fileName = $file->getPathname(); $fileContents = file_get_contents($fileName); + $fileContents = canonicalize($fileContents); // evaluate @@{expr}@@ expressions $fileContents = preg_replace_callback( '/@@\{(.*?)\}@@/', - array($this, 'evalCallback'), + function($matches) { + return eval('return ' . $matches[1] . ';'); + }, $fileContents ); // parse sections - $parts = array_map('trim', explode('-----', $fileContents)); + $parts = preg_split("/\n-----(?:\n|$)/", $fileContents); // first part is the name $name = array_shift($parts) . ' (' . $fileName . ')'; + $shortName = ltrim(str_replace($directory, '', $fileName), '/\\'); // multiple sections possible with always two forming a pair - foreach (array_chunk($parts, 2) as $chunk) { - $tests[] = array($name, $chunk[0], $chunk[1]); + $chunks = array_chunk($parts, 2); + foreach ($chunks as $i => $chunk) { + $dataSetName = $shortName . (count($chunks) > 1 ? '#' . $i : ''); + list($expected, $mode) = $this->extractMode($chunk[1]); + $tests[$dataSetName] = array($name, $chunk[0], $expected, $mode); } } return $tests; } - protected function evalCallback($matches) { - return eval('return ' . $matches[1] . ';'); - } - - protected function canonicalize($str) { - // trim from both sides - $str = trim($str); + private function extractMode($expected) { + $firstNewLine = strpos($expected, "\n"); + if (false === $firstNewLine) { + $firstNewLine = strlen($expected); + } - // normalize EOL to \n - $str = str_replace(array("\r\n", "\r"), "\n", $str); + $firstLine = substr($expected, 0, $firstNewLine); + if (0 !== strpos($firstLine, '!!')) { + return [$expected, null]; + } - // trim right side of all lines - return implode("\n", array_map('rtrim', explode("\n", $str))); + $expected = (string) substr($expected, $firstNewLine + 1); + return [$expected, substr($firstLine, 2)]; } } diff --git a/application/vendor/nikic/php-parser/test/PhpParser/CommentTest.php b/application/vendor/nikic/php-parser/test/PhpParser/CommentTest.php index 96db6e6..fb20557 100644 --- a/application/vendor/nikic/php-parser/test/PhpParser/CommentTest.php +++ b/application/vendor/nikic/php-parser/test/PhpParser/CommentTest.php @@ -5,11 +5,12 @@ class CommentTest extends \PHPUnit_Framework_TestCase { public function testGetSet() { - $comment = new Comment('/* Some comment */', 1); + $comment = new Comment('/* Some comment */', 1, 10); $this->assertSame('/* Some comment */', $comment->getText()); $this->assertSame('/* Some comment */', (string) $comment); $this->assertSame(1, $comment->getLine()); + $this->assertSame(10, $comment->getFilePos()); $comment->setText('/* Some other comment */'); $comment->setLine(10); @@ -58,6 +59,14 @@ public function provideTestReformatting() { '/* Some text. More text. Even more text. */' + ), + array( + '/* Some text. + More text. + Indented text. */', + '/* Some text. + More text. + Indented text. */', ), // invalid comment -> no reformatting array( diff --git a/application/vendor/nikic/php-parser/test/PhpParser/Lexer/EmulativeTest.php b/application/vendor/nikic/php-parser/test/PhpParser/Lexer/EmulativeTest.php index 7743428..f1fe618 100644 --- a/application/vendor/nikic/php-parser/test/PhpParser/Lexer/EmulativeTest.php +++ b/application/vendor/nikic/php-parser/test/PhpParser/Lexer/EmulativeTest.php @@ -3,7 +3,7 @@ namespace PhpParser\Lexer; use PhpParser\LexerTest; -use PhpParser\Parser; +use PhpParser\Parser\Tokens; require_once __DIR__ . '/../LexerTest.php'; @@ -31,28 +31,28 @@ public function testNoReplaceKeywordsAfterObjectOperator($keyword) { $lexer = $this->getLexer(); $lexer->startLexing('' . $keyword); - $this->assertSame(Parser::T_OBJECT_OPERATOR, $lexer->getNextToken()); - $this->assertSame(Parser::T_STRING, $lexer->getNextToken()); + $this->assertSame(Tokens::T_OBJECT_OPERATOR, $lexer->getNextToken()); + $this->assertSame(Tokens::T_STRING, $lexer->getNextToken()); $this->assertSame(0, $lexer->getNextToken()); } public function provideTestReplaceKeywords() { return array( // PHP 5.5 - array('finally', Parser::T_FINALLY), - array('yield', Parser::T_YIELD), + array('finally', Tokens::T_FINALLY), + array('yield', Tokens::T_YIELD), // PHP 5.4 - array('callable', Parser::T_CALLABLE), - array('insteadof', Parser::T_INSTEADOF), - array('trait', Parser::T_TRAIT), - array('__TRAIT__', Parser::T_TRAIT_C), + array('callable', Tokens::T_CALLABLE), + array('insteadof', Tokens::T_INSTEADOF), + array('trait', Tokens::T_TRAIT), + array('__TRAIT__', Tokens::T_TRAIT_C), // PHP 5.3 - array('__DIR__', Parser::T_DIR), - array('goto', Parser::T_GOTO), - array('namespace', Parser::T_NAMESPACE), - array('__NAMESPACE__', Parser::T_NS_C), + array('__DIR__', Tokens::T_DIR), + array('goto', Tokens::T_GOTO), + array('namespace', Tokens::T_NAMESPACE), + array('__NAMESPACE__', Tokens::T_NS_C), ); } @@ -80,7 +80,7 @@ public function testLeaveStuffAloneInStrings($code) { $lexer = $this->getLexer(); $lexer->startLexing('assertSame(Parser::T_CONSTANT_ENCAPSED_STRING, $lexer->getNextToken($text)); + $this->assertSame(Tokens::T_CONSTANT_ENCAPSED_STRING, $lexer->getNextToken($text)); $this->assertSame($stringifiedToken, $text); $this->assertSame(0, $lexer->getNextToken()); } @@ -88,44 +88,44 @@ public function testLeaveStuffAloneInStrings($code) { public function provideTestLexNewFeatures() { return array( array('yield from', array( - array(Parser::T_YIELD_FROM, 'yield from'), + array(Tokens::T_YIELD_FROM, 'yield from'), )), array("yield\r\nfrom", array( - array(Parser::T_YIELD_FROM, "yield\r\nfrom"), + array(Tokens::T_YIELD_FROM, "yield\r\nfrom"), )), array('...', array( - array(Parser::T_ELLIPSIS, '...'), + array(Tokens::T_ELLIPSIS, '...'), )), array('**', array( - array(Parser::T_POW, '**'), + array(Tokens::T_POW, '**'), )), array('**=', array( - array(Parser::T_POW_EQUAL, '**='), + array(Tokens::T_POW_EQUAL, '**='), )), array('??', array( - array(Parser::T_COALESCE, '??'), + array(Tokens::T_COALESCE, '??'), )), array('<=>', array( - array(Parser::T_SPACESHIP, '<=>'), + array(Tokens::T_SPACESHIP, '<=>'), )), array('0b1010110', array( - array(Parser::T_LNUMBER, '0b1010110'), + array(Tokens::T_LNUMBER, '0b1010110'), )), array('0b1011010101001010110101010010101011010101010101101011001110111100', array( - array(Parser::T_DNUMBER, '0b1011010101001010110101010010101011010101010101101011001110111100'), + array(Tokens::T_DNUMBER, '0b1011010101001010110101010010101011010101010101101011001110111100'), )), array('\\', array( - array(Parser::T_NS_SEPARATOR, '\\'), + array(Tokens::T_NS_SEPARATOR, '\\'), )), array("<<<'NOWDOC'\nNOWDOC;\n", array( - array(Parser::T_START_HEREDOC, "<<<'NOWDOC'\n"), - array(Parser::T_END_HEREDOC, 'NOWDOC'), + array(Tokens::T_START_HEREDOC, "<<<'NOWDOC'\n"), + array(Tokens::T_END_HEREDOC, 'NOWDOC'), array(ord(';'), ';'), )), array("<<<'NOWDOC'\nFoobar\nNOWDOC;\n", array( - array(Parser::T_START_HEREDOC, "<<<'NOWDOC'\n"), - array(Parser::T_ENCAPSED_AND_WHITESPACE, "Foobar\n"), - array(Parser::T_END_HEREDOC, 'NOWDOC'), + array(Tokens::T_START_HEREDOC, "<<<'NOWDOC'\n"), + array(Tokens::T_ENCAPSED_AND_WHITESPACE, "Foobar\n"), + array(Tokens::T_END_HEREDOC, 'NOWDOC'), array(ord(';'), ';'), )), ); diff --git a/application/vendor/nikic/php-parser/test/PhpParser/LexerTest.php b/application/vendor/nikic/php-parser/test/PhpParser/LexerTest.php index 5b20989..d180e76 100644 --- a/application/vendor/nikic/php-parser/test/PhpParser/LexerTest.php +++ b/application/vendor/nikic/php-parser/test/PhpParser/LexerTest.php @@ -2,6 +2,8 @@ namespace PhpParser; +use PhpParser\Parser\Tokens; + class LexerTest extends \PHPUnit_Framework_TestCase { /* To allow overwriting in parent class */ @@ -61,7 +63,7 @@ public function provideTestLex() { array(), array( array( - Parser::T_STRING, 'tokens', + Tokens::T_STRING, 'tokens', array('startLine' => 1), array('endLine' => 1) ), array( @@ -69,7 +71,7 @@ public function provideTestLex() { array('startLine' => 1), array('endLine' => 1) ), array( - Parser::T_INLINE_HTML, 'plaintext', + Tokens::T_INLINE_HTML, 'plaintext', array('startLine' => 1), array('endLine' => 1) ), ) @@ -84,14 +86,16 @@ public function provideTestLex() { array('startLine' => 2), array('endLine' => 2) ), array( - Parser::T_STRING, 'token', + Tokens::T_STRING, 'token', array('startLine' => 2), array('endLine' => 2) ), array( ord('$'), '$', array( 'startLine' => 3, - 'comments' => array(new Comment\Doc('/** doc' . "\n" . 'comment */', 2)) + 'comments' => array( + new Comment\Doc('/** doc' . "\n" . 'comment */', 2, 14), + ) ), array('endLine' => 3) ), @@ -103,14 +107,14 @@ public function provideTestLex() { array(), array( array( - Parser::T_STRING, 'token', + Tokens::T_STRING, 'token', array( 'startLine' => 2, 'comments' => array( - new Comment('/* comment */', 1), - new Comment('// comment' . "\n", 1), - new Comment\Doc('/** docComment 1 */', 2), - new Comment\Doc('/** docComment 2 */', 2), + new Comment('/* comment */', 1, 6), + new Comment('// comment' . "\n", 1, 20), + new Comment\Doc('/** docComment 1 */', 2, 31), + new Comment\Doc('/** docComment 2 */', 2, 50), ), ), array('endLine' => 2) @@ -123,7 +127,7 @@ public function provideTestLex() { array(), array( array( - Parser::T_CONSTANT_ENCAPSED_STRING, '"foo' . "\n" . 'bar"', + Tokens::T_CONSTANT_ENCAPSED_STRING, '"foo' . "\n" . 'bar"', array('startLine' => 1), array('endLine' => 2) ), ) @@ -134,7 +138,7 @@ public function provideTestLex() { array('usedAttributes' => array('startFilePos', 'endFilePos')), array( array( - Parser::T_CONSTANT_ENCAPSED_STRING, '"a"', + Tokens::T_CONSTANT_ENCAPSED_STRING, '"a"', array('startFilePos' => 6), array('endFilePos' => 8) ), array( @@ -142,7 +146,7 @@ public function provideTestLex() { array('startFilePos' => 9), array('endFilePos' => 9) ), array( - Parser::T_CONSTANT_ENCAPSED_STRING, '"b"', + Tokens::T_CONSTANT_ENCAPSED_STRING, '"b"', array('startFilePos' => 18), array('endFilePos' => 20) ), array( @@ -157,7 +161,7 @@ public function provideTestLex() { array('usedAttributes' => array('startTokenPos', 'endTokenPos')), array( array( - Parser::T_CONSTANT_ENCAPSED_STRING, '"a"', + Tokens::T_CONSTANT_ENCAPSED_STRING, '"a"', array('startTokenPos' => 1), array('endTokenPos' => 1) ), array( @@ -165,7 +169,7 @@ public function provideTestLex() { array('startTokenPos' => 2), array('endTokenPos' => 2) ), array( - Parser::T_CONSTANT_ENCAPSED_STRING, '"b"', + Tokens::T_CONSTANT_ENCAPSED_STRING, '"b"', array('startTokenPos' => 5), array('endTokenPos' => 5) ), array( @@ -180,7 +184,7 @@ public function provideTestLex() { array('usedAttributes' => array()), array( array( - Parser::T_VARIABLE, '$bar', + Tokens::T_VARIABLE, '$bar', array(), array() ), array( @@ -199,7 +203,7 @@ public function testHandleHaltCompiler($code, $remaining) { $lexer = $this->getLexer(); $lexer->startLexing($code); - while (Parser::T_HALT_COMPILER !== $lexer->getNextToken()); + while (Tokens::T_HALT_COMPILER !== $lexer->getNextToken()); $this->assertSame($remaining, $lexer->handleHaltCompiler()); $this->assertSame(0, $lexer->getNextToken()); @@ -223,7 +227,7 @@ public function testHandleHaltCompilerError() { $lexer = $this->getLexer(); $lexer->startLexing('getNextToken()); + while (Tokens::T_HALT_COMPILER !== $lexer->getNextToken()); $lexer->handleHaltCompiler(); } diff --git a/application/vendor/nikic/php-parser/test/PhpParser/Node/NameTest.php b/application/vendor/nikic/php-parser/test/PhpParser/Node/NameTest.php index 1b20ae3..3378551 100644 --- a/application/vendor/nikic/php-parser/test/PhpParser/Node/NameTest.php +++ b/application/vendor/nikic/php-parser/test/PhpParser/Node/NameTest.php @@ -95,6 +95,38 @@ public function testPrepend() { $this->assertSame('foo\bar\bar\foo', $name->toString()); } + public function testSlice() { + $name = new Name('foo\bar'); + $this->assertEquals(new Name('foo\bar'), $name->slice(0)); + $this->assertEquals(new Name('bar'), $name->slice(1)); + $this->assertEquals(new Name([]), $name->slice(2)); + } + + /** + * @expectedException \OutOfBoundsException + * @expectedExceptionMessage Offset 4 is out of bounds + */ + public function testSliceException() { + (new Name('foo\bar\baz'))->slice(4); + } + + public function testConcat() { + $this->assertEquals(new Name('foo\bar\baz'), Name::concat('foo', 'bar\baz')); + $this->assertEquals( + new Name\FullyQualified('foo\bar'), + Name\FullyQualified::concat(['foo'], new Name('bar')) + ); + + $attributes = ['foo' => 'bar']; + $this->assertEquals( + new Name\Relative('foo\bar\baz', $attributes), + Name\Relative::concat(new Name\FullyQualified('foo\bar'), 'baz', $attributes) + ); + + $this->assertEquals(new Name('foo'), Name::concat([], 'foo')); + $this->assertEquals(new Name([]), Name::concat([], [])); + } + public function testIs() { $name = new Name('foo'); $this->assertTrue ($name->isUnqualified()); diff --git a/application/vendor/nikic/php-parser/test/PhpParser/NodeAbstractTest.php b/application/vendor/nikic/php-parser/test/PhpParser/NodeAbstractTest.php index dc2e6f7..40e0bb8 100644 --- a/application/vendor/nikic/php-parser/test/PhpParser/NodeAbstractTest.php +++ b/application/vendor/nikic/php-parser/test/PhpParser/NodeAbstractTest.php @@ -7,7 +7,7 @@ class DummyNode extends NodeAbstract { public $subNode2; public function __construct($subNode1, $subNode2, $attributes) { - parent::__construct(null, $attributes); + parent::__construct($attributes); $this->subNode1 = $subNode1; $this->subNode2 = $subNode2; } @@ -33,25 +33,11 @@ public function provideNodes() { ), ); - $node1 = $this->getMockForAbstractClass( - 'PhpParser\NodeAbstract', - array( - array( - 'subNode1' => 'value1', - 'subNode2' => 'value2', - ), - $attributes - ), - 'PhpParser_Node_Dummy' - ); - $node1->notSubNode = 'value3'; - - $node2 = new DummyNode('value1', 'value2', $attributes); - $node2->notSubNode = 'value3'; + $node = new DummyNode('value1', 'value2', $attributes); + $node->notSubNode = 'value3'; return array( - array($attributes, $node1), - array($attributes, $node2), + array($attributes, $node), ); } diff --git a/application/vendor/nikic/php-parser/test/PhpParser/NodeTraverserTest.php b/application/vendor/nikic/php-parser/test/PhpParser/NodeTraverserTest.php index 3b702ea..d750e14 100644 --- a/application/vendor/nikic/php-parser/test/PhpParser/NodeTraverserTest.php +++ b/application/vendor/nikic/php-parser/test/PhpParser/NodeTraverserTest.php @@ -185,19 +185,34 @@ public function testRemovingVisitor() { $this->assertAttributeSame($postExpected, 'visitors', $traverser, 'The appropriate visitors are not present after removal'); } - public function testCloneNodesByDefault() { + public function testCloneNodes() { $stmts = array(new Node\Stmt\Echo_(array(new String_('Foo'), new String_('Bar')))); - $traverser = new NodeTraverser; + $traverser = new NodeTraverser(true); $this->assertNotSame($stmts, $traverser->traverse($stmts)); } - public function testCloneNodesDisabled() { + public function testNoCloneNodesByDefault() { $stmts = array(new Node\Stmt\Echo_(array(new String_('Foo'), new String_('Bar')))); - $traverser = new NodeTraverser(false); + $traverser = new NodeTraverser; $this->assertSame($stmts, $traverser->traverse($stmts)); } + + /** + * @expectedException \LogicException + * @expectedExceptionMessage leaveNode() may only return an array if the parent structure is an array + */ + public function testReplaceByArrayOnlyAllowedIfParentIsArray() { + $stmts = array(new Node\Expr\UnaryMinus(new Node\Scalar\LNumber(42))); + + $visitor = $this->getMock('PhpParser\NodeVisitor'); + $visitor->method('leaveNode')->willReturn(array(new Node\Scalar\DNumber(42.0))); + + $traverser = new NodeTraverser(); + $traverser->addVisitor($visitor); + $traverser->traverse($stmts); + } } diff --git a/application/vendor/nikic/php-parser/test/PhpParser/NodeVisitor/NameResolverTest.php b/application/vendor/nikic/php-parser/test/PhpParser/NodeVisitor/NameResolverTest.php index 08027e2..ecc443f 100644 --- a/application/vendor/nikic/php-parser/test/PhpParser/NodeVisitor/NameResolverTest.php +++ b/application/vendor/nikic/php-parser/test/PhpParser/NodeVisitor/NameResolverTest.php @@ -76,6 +76,25 @@ public function testResolveNames() { BAR\FOO; BAZ\FOO; } +namespace Baz { + use A\T\{B\C, D\E}; + use function X\T\{b\c, d\e}; + use const Y\T\{B\C, D\E}; + use Z\T\{G, function f, const K}; + + new C; + new E; + new C\D; + new E\F; + new G; + + c(); + e(); + f(); + C; + E; + K; +} EOC; $expectedCode = <<<'EOC' namespace Foo { @@ -127,9 +146,26 @@ public function testResolveNames() { \foo\FOO; \Bar\BAZ\FOO; } +namespace Baz { + use A\T\{B\C, D\E}; + use function X\T\{b\c, d\e}; + use const Y\T\{B\C, D\E}; + use Z\T\{G, function f, const K}; + new \A\T\B\C(); + new \A\T\D\E(); + new \A\T\B\C\D(); + new \A\T\D\E\F(); + new \Z\T\G(); + \X\T\b\c(); + \X\T\d\e(); + \Z\T\f(); + \Y\T\B\C; + \Y\T\D\E; + \Z\T\K; +} EOC; - $parser = new PhpParser\Parser(new PhpParser\Lexer\Emulative); + $parser = new PhpParser\Parser\Php7(new PhpParser\Lexer\Emulative); $prettyPrinter = new PhpParser\PrettyPrinter\Standard; $traverser = new PhpParser\NodeTraverser; $traverser->addVisitor(new NameResolver); @@ -219,7 +255,7 @@ function () : \NS\A { } EOC; - $parser = new PhpParser\Parser(new PhpParser\Lexer\Emulative); + $parser = new PhpParser\Parser\Php7(new PhpParser\Lexer\Emulative); $prettyPrinter = new PhpParser\PrettyPrinter\Standard; $traverser = new PhpParser\NodeTraverser; $traverser->addVisitor(new NameResolver); @@ -242,53 +278,36 @@ public function testNoResolveSpecialName() { $this->assertEquals($stmts, $traverser->traverse($stmts)); } - protected function createNamespacedAndNonNamespaced(array $stmts) { - return array( - new Stmt\Namespace_(new Name('NS'), $stmts), - new Stmt\Namespace_(null, $stmts), - ); - } - public function testAddNamespacedName() { - $stmts = $this->createNamespacedAndNonNamespaced(array( + $nsStmts = array( new Stmt\Class_('A'), new Stmt\Interface_('B'), new Stmt\Function_('C'), new Stmt\Const_(array( - new Node\Const_('D', new Node\Scalar\String_('E')) + new Node\Const_('D', new Node\Scalar\LNumber(42)) )), + new Stmt\Trait_('E'), new Expr\New_(new Stmt\Class_(null)), - )); + ); $traverser = new PhpParser\NodeTraverser; $traverser->addVisitor(new NameResolver); - $stmts = $traverser->traverse($stmts); - + $stmts = $traverser->traverse([new Stmt\Namespace_(new Name('NS'), $nsStmts)]); $this->assertSame('NS\\A', (string) $stmts[0]->stmts[0]->namespacedName); $this->assertSame('NS\\B', (string) $stmts[0]->stmts[1]->namespacedName); $this->assertSame('NS\\C', (string) $stmts[0]->stmts[2]->namespacedName); $this->assertSame('NS\\D', (string) $stmts[0]->stmts[3]->consts[0]->namespacedName); - $this->assertObjectNotHasAttribute('namespacedName', $stmts[0]->stmts[4]->class); - $this->assertSame('A', (string) $stmts[1]->stmts[0]->namespacedName); - $this->assertSame('B', (string) $stmts[1]->stmts[1]->namespacedName); - $this->assertSame('C', (string) $stmts[1]->stmts[2]->namespacedName); - $this->assertSame('D', (string) $stmts[1]->stmts[3]->consts[0]->namespacedName); - $this->assertObjectNotHasAttribute('namespacedName', $stmts[1]->stmts[4]->class); - } - - public function testAddTraitNamespacedName() { - $stmts = $this->createNamespacedAndNonNamespaced(array( - new Stmt\Trait_('A') - )); - - $traverser = new PhpParser\NodeTraverser; - $traverser->addVisitor(new NameResolver); - - $stmts = $traverser->traverse($stmts); - - $this->assertSame('NS\\A', (string) $stmts[0]->stmts[0]->namespacedName); - $this->assertSame('A', (string) $stmts[1]->stmts[0]->namespacedName); + $this->assertSame('NS\\E', (string) $stmts[0]->stmts[4]->namespacedName); + $this->assertObjectNotHasAttribute('namespacedName', $stmts[0]->stmts[5]->class); + + $stmts = $traverser->traverse([new Stmt\Namespace_(null, $nsStmts)]); + $this->assertSame('A', (string) $stmts[0]->stmts[0]->namespacedName); + $this->assertSame('B', (string) $stmts[0]->stmts[1]->namespacedName); + $this->assertSame('C', (string) $stmts[0]->stmts[2]->namespacedName); + $this->assertSame('D', (string) $stmts[0]->stmts[3]->consts[0]->namespacedName); + $this->assertSame('E', (string) $stmts[0]->stmts[4]->namespacedName); + $this->assertObjectNotHasAttribute('namespacedName', $stmts[0]->stmts[5]->class); } /** @@ -306,22 +325,22 @@ public function provideTestError() { return array( array( new Stmt\Use_(array( - new Stmt\UseUse(new Name('A\B'), 'B', array('startLine' => 1)), - new Stmt\UseUse(new Name('C\D'), 'B', array('startLine' => 2)), + new Stmt\UseUse(new Name('A\B'), 'B', 0, array('startLine' => 1)), + new Stmt\UseUse(new Name('C\D'), 'B', 0, array('startLine' => 2)), ), Stmt\Use_::TYPE_NORMAL), 'Cannot use C\D as B because the name is already in use on line 2' ), array( new Stmt\Use_(array( - new Stmt\UseUse(new Name('a\b'), 'b', array('startLine' => 1)), - new Stmt\UseUse(new Name('c\d'), 'B', array('startLine' => 2)), + new Stmt\UseUse(new Name('a\b'), 'b', 0, array('startLine' => 1)), + new Stmt\UseUse(new Name('c\d'), 'B', 0, array('startLine' => 2)), ), Stmt\Use_::TYPE_FUNCTION), 'Cannot use function c\d as B because the name is already in use on line 2' ), array( new Stmt\Use_(array( - new Stmt\UseUse(new Name('A\B'), 'B', array('startLine' => 1)), - new Stmt\UseUse(new Name('C\D'), 'B', array('startLine' => 2)), + new Stmt\UseUse(new Name('A\B'), 'B', 0, array('startLine' => 1)), + new Stmt\UseUse(new Name('C\D'), 'B', 0, array('startLine' => 2)), ), Stmt\Use_::TYPE_CONSTANT), 'Cannot use const C\D as B because the name is already in use on line 2' ), @@ -353,7 +372,7 @@ public function testClassNameIsCaseInsensitive() $test = new baz(); EOC; - $parser = new PhpParser\Parser(new PhpParser\Lexer\Emulative); + $parser = new PhpParser\Parser\Php7(new PhpParser\Lexer\Emulative); $stmts = $parser->parse($source); $traverser = new PhpParser\NodeTraverser; @@ -381,7 +400,7 @@ public static function method() } EOC; - $parser = new PhpParser\Parser(new PhpParser\Lexer\Emulative); + $parser = new PhpParser\Parser\Php7(new PhpParser\Lexer\Emulative); $stmts = $parser->parse($source); $traverser = new PhpParser\NodeTraverser; diff --git a/application/vendor/nikic/php-parser/test/PhpParser/Parser/MultipleTest.php b/application/vendor/nikic/php-parser/test/PhpParser/Parser/MultipleTest.php new file mode 100644 index 0000000..e2722c3 --- /dev/null +++ b/application/vendor/nikic/php-parser/test/PhpParser/Parser/MultipleTest.php @@ -0,0 +1,113 @@ + []]); + return new Multiple([new Php7($lexer), new Php5($lexer)]); + } + + private function getPrefer5() { + $lexer = new Lexer(['usedAttributes' => []]); + return new Multiple([new Php5($lexer), new Php7($lexer)]); + } + + /** @dataProvider provideTestParse */ + public function testParse($code, Multiple $parser, $expected) { + $this->assertEquals($expected, $parser->parse($code)); + $this->assertSame([], $parser->getErrors()); + } + + public function provideTestParse() { + return [ + [ + // PHP 7 only code + 'getPrefer5(), + [ + new Stmt\Class_('Test', ['stmts' => [ + new Stmt\ClassMethod('function') + ]]), + ] + ], + [ + // PHP 5 only code + 'b;', + $this->getPrefer7(), + [ + new Stmt\Global_([ + new Expr\Variable(new Expr\PropertyFetch(new Expr\Variable('a'), 'b')) + ]) + ] + ], + [ + // Different meaning (PHP 5) + 'getPrefer5(), + [ + new Expr\Variable( + new Expr\ArrayDimFetch(new Expr\Variable('a'), LNumber::fromString('0')) + ) + ] + ], + [ + // Different meaning (PHP 7) + 'getPrefer7(), + [ + new Expr\ArrayDimFetch( + new Expr\Variable(new Expr\Variable('a')), LNumber::fromString('0') + ) + ] + ], + ]; + } + + public function testThrownError() { + $this->setExpectedException('PhpParser\Error', 'FAIL A'); + + $parserA = $this->getMockBuilder('PhpParser\Parser')->getMock(); + $parserA->expects($this->at(0)) + ->method('parse')->will($this->throwException(new Error('FAIL A'))); + + $parserB = $this->getMockBuilder('PhpParser\Parser')->getMock(); + $parserB->expects($this->at(0)) + ->method('parse')->will($this->throwException(new Error('FAIL B'))); + + $parser = new Multiple([$parserA, $parserB]); + $parser->parse('dummy'); + } + + public function testGetErrors() { + $errorsA = [new Error('A1'), new Error('A2')]; + $parserA = $this->getMockBuilder('PhpParser\Parser')->getMock(); + $parserA->expects($this->at(0))->method('parse'); + $parserA->expects($this->at(1)) + ->method('getErrors')->will($this->returnValue($errorsA)); + + $errorsB = [new Error('B1'), new Error('B2')]; + $parserB = $this->getMockBuilder('PhpParser\Parser')->getMock(); + $parserB->expects($this->at(0))->method('parse'); + $parserB->expects($this->at(1)) + ->method('getErrors')->will($this->returnValue($errorsB)); + + $parser = new Multiple([$parserA, $parserB]); + $parser->parse('dummy'); + $this->assertSame($errorsA, $parser->getErrors()); + } +} \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/PhpParser/Parser/Php5Test.php b/application/vendor/nikic/php-parser/test/PhpParser/Parser/Php5Test.php new file mode 100644 index 0000000..58c4e61 --- /dev/null +++ b/application/vendor/nikic/php-parser/test/PhpParser/Parser/Php5Test.php @@ -0,0 +1,14 @@ +assertInstanceOf($expected, (new ParserFactory)->create($kind, $lexer)); + } + + public function provideTestCreate() { + $lexer = new Lexer(); + return [ + [ + ParserFactory::PREFER_PHP7, $lexer, + 'PhpParser\Parser\Multiple' + ], + [ + ParserFactory::PREFER_PHP5, null, + 'PhpParser\Parser\Multiple' + ], + [ + ParserFactory::ONLY_PHP7, null, + 'PhpParser\Parser\Php7' + ], + [ + ParserFactory::ONLY_PHP5, $lexer, + 'PhpParser\Parser\Php5' + ] + ]; + } +} \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/PhpParser/ParserTest.php b/application/vendor/nikic/php-parser/test/PhpParser/ParserTest.php index b066ee1..1318d8b 100644 --- a/application/vendor/nikic/php-parser/test/PhpParser/ParserTest.php +++ b/application/vendor/nikic/php-parser/test/PhpParser/ParserTest.php @@ -3,57 +3,21 @@ namespace PhpParser; use PhpParser\Comment; +use PhpParser\Node\Expr; +use PhpParser\Node\Scalar; +use PhpParser\Node\Scalar\String_; -require_once __DIR__ . '/CodeTestAbstract.php'; - -class ParserTest extends CodeTestAbstract +abstract class ParserTest extends \PHPUnit_Framework_TestCase { - /** - * @dataProvider provideTestParse - */ - public function testParse($name, $code, $expected) { - $lexer = new Lexer\Emulative(array('usedAttributes' => array( - 'startLine', 'endLine', 'startFilePos', 'endFilePos' - ))); - $parser = new Parser($lexer, array( - 'throwOnError' => false, - )); - - $stmts = $parser->parse($code); - $errors = $parser->getErrors(); - - $output = ''; - foreach ($errors as $error) { - $output .= $this->formatErrorMessage($error, $code) . "\n"; - } - - if (null !== $stmts) { - $dumper = new NodeDumper; - $output .= $dumper->dump($stmts); - } - - $this->assertSame($this->canonicalize($expected), $this->canonicalize($output), $name); - } - - public function provideTestParse() { - return $this->getTests(__DIR__ . '/../code/parser', 'test'); - } - - private function formatErrorMessage(Error $e, $code) { - if ($e->hasColumnInfo()) { - return $e->getRawMessage() . ' from ' . $e->getStartLine() . ':' . $e->getStartColumn($code) - . ' to ' . $e->getEndLine() . ':' . $e->getEndColumn($code); - } else { - return $e->getMessage(); - } - } + /** @returns Parser */ + abstract protected function getParser(Lexer $lexer); /** * @expectedException \PhpParser\Error * @expectedExceptionMessage Syntax error, unexpected EOF on line 1 */ public function testParserThrowsSyntaxError() { - $parser = new Parser(new Lexer()); + $parser = $this->getParser(new Lexer()); $parser->parse('getParser(new Lexer()); $parser->parse('canonicalize($code); + $code = canonicalize($code); - $parser = new Parser($lexer); + $parser = $this->getParser($lexer); $stmts = $parser->parse($code); /** @var \PhpParser\Node\Stmt\Function_ $fn */ @@ -93,7 +57,7 @@ function test($a) { $this->assertInstanceOf('PhpParser\Node\Stmt\Function_', $fn); $this->assertEquals(array( 'comments' => array( - new Comment\Doc('/** Doc comment */', 2), + new Comment\Doc('/** Doc comment */', 2, 6), ), 'startLine' => 3, 'endLine' => 7, @@ -115,8 +79,8 @@ function test($a) { $this->assertInstanceOf('PhpParser\Node\Stmt\Echo_', $echo); $this->assertEquals(array( 'comments' => array( - new Comment("// Line\n", 4), - new Comment("// Comments\n", 5), + new Comment("// Line\n", 4, 49), + new Comment("// Comments\n", 5, 61), ), 'startLine' => 6, 'endLine' => 6, @@ -141,9 +105,61 @@ function test($a) { */ public function testInvalidToken() { $lexer = new InvalidTokenLexer; - $parser = new Parser($lexer); + $parser = $this->getParser($lexer); $parser->parse('dummy'); } + + /** + * @dataProvider provideTestKindAttributes + */ + public function testKindAttributes($code, $expectedAttributes) { + $parser = $this->getParser(new Lexer); + $stmts = $parser->parse("getAttributes(); + foreach ($expectedAttributes as $name => $value) { + $this->assertSame($value, $attributes[$name]); + } + } + + public function provideTestKindAttributes() { + return array( + array('0', ['kind' => Scalar\LNumber::KIND_DEC]), + array('9', ['kind' => Scalar\LNumber::KIND_DEC]), + array('07', ['kind' => Scalar\LNumber::KIND_OCT]), + array('0xf', ['kind' => Scalar\LNumber::KIND_HEX]), + array('0XF', ['kind' => Scalar\LNumber::KIND_HEX]), + array('0b1', ['kind' => Scalar\LNumber::KIND_BIN]), + array('0B1', ['kind' => Scalar\LNumber::KIND_BIN]), + array('[]', ['kind' => Expr\Array_::KIND_SHORT]), + array('array()', ['kind' => Expr\Array_::KIND_LONG]), + array("'foo'", ['kind' => String_::KIND_SINGLE_QUOTED]), + array("b'foo'", ['kind' => String_::KIND_SINGLE_QUOTED]), + array("B'foo'", ['kind' => String_::KIND_SINGLE_QUOTED]), + array('"foo"', ['kind' => String_::KIND_DOUBLE_QUOTED]), + array('b"foo"', ['kind' => String_::KIND_DOUBLE_QUOTED]), + array('B"foo"', ['kind' => String_::KIND_DOUBLE_QUOTED]), + array('"foo$bar"', ['kind' => String_::KIND_DOUBLE_QUOTED]), + array('b"foo$bar"', ['kind' => String_::KIND_DOUBLE_QUOTED]), + array('B"foo$bar"', ['kind' => String_::KIND_DOUBLE_QUOTED]), + array("<<<'STR'\nSTR\n", ['kind' => String_::KIND_NOWDOC, 'docLabel' => 'STR']), + array("<< String_::KIND_HEREDOC, 'docLabel' => 'STR']), + array("<<<\"STR\"\nSTR\n", ['kind' => String_::KIND_HEREDOC, 'docLabel' => 'STR']), + array("b<<<'STR'\nSTR\n", ['kind' => String_::KIND_NOWDOC, 'docLabel' => 'STR']), + array("B<<<'STR'\nSTR\n", ['kind' => String_::KIND_NOWDOC, 'docLabel' => 'STR']), + array("<<< \t 'STR'\nSTR\n", ['kind' => String_::KIND_NOWDOC, 'docLabel' => 'STR']), + // HHVM doesn't support this due to a lexer bug + // (https://github.com/facebook/hhvm/issues/6970) + // array("<<<'\xff'\n\xff\n", ['kind' => String_::KIND_NOWDOC, 'docLabel' => "\xff"]), + array("<<<\"STR\"\n\$a\nSTR\n", ['kind' => String_::KIND_HEREDOC, 'docLabel' => 'STR']), + array("b<<<\"STR\"\n\$a\nSTR\n", ['kind' => String_::KIND_HEREDOC, 'docLabel' => 'STR']), + array("B<<<\"STR\"\n\$a\nSTR\n", ['kind' => String_::KIND_HEREDOC, 'docLabel' => 'STR']), + array("<<< \t \"STR\"\n\$a\nSTR\n", ['kind' => String_::KIND_HEREDOC, 'docLabel' => 'STR']), + array("die", ['kind' => Expr\Exit_::KIND_DIE]), + array("die('done')", ['kind' => Expr\Exit_::KIND_DIE]), + array("exit", ['kind' => Expr\Exit_::KIND_EXIT]), + array("exit(1)", ['kind' => Expr\Exit_::KIND_EXIT]), + ); + } } class InvalidTokenLexer extends Lexer { diff --git a/application/vendor/nikic/php-parser/test/PhpParser/PrettyPrinterTest.php b/application/vendor/nikic/php-parser/test/PhpParser/PrettyPrinterTest.php index 6415b06..9dbd3d3 100644 --- a/application/vendor/nikic/php-parser/test/PhpParser/PrettyPrinterTest.php +++ b/application/vendor/nikic/php-parser/test/PhpParser/PrettyPrinterTest.php @@ -2,7 +2,10 @@ namespace PhpParser; +use PhpParser\Comment; use PhpParser\Node\Expr; +use PhpParser\Node\Scalar\Encapsed; +use PhpParser\Node\Scalar\EncapsedStringPart; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt; use PhpParser\PrettyPrinter\Standard; @@ -11,32 +14,58 @@ class PrettyPrinterTest extends CodeTestAbstract { - protected function doTestPrettyPrintMethod($method, $name, $code, $dump) { - $parser = new Parser(new Lexer\Emulative); - $prettyPrinter = new Standard; + protected function doTestPrettyPrintMethod($method, $name, $code, $expected, $modeLine) { + $lexer = new Lexer\Emulative; + $parser5 = new Parser\Php5($lexer); + $parser7 = new Parser\Php7($lexer); - $stmts = $parser->parse($code); - $this->assertSame( - $this->canonicalize($dump), - $this->canonicalize($prettyPrinter->$method($stmts)), - $name - ); + list($version, $options) = $this->parseModeLine($modeLine); + $prettyPrinter = new Standard($options); + + try { + $output5 = canonicalize($prettyPrinter->$method($parser5->parse($code))); + } catch (Error $e) { + $output5 = null; + if ('php7' !== $version) { + throw $e; + } + } + + try { + $output7 = canonicalize($prettyPrinter->$method($parser7->parse($code))); + } catch (Error $e) { + $output7 = null; + if ('php5' !== $version) { + throw $e; + } + } + + if ('php5' === $version) { + $this->assertSame($expected, $output5, $name); + $this->assertNotSame($expected, $output7, $name); + } else if ('php7' === $version) { + $this->assertSame($expected, $output7, $name); + $this->assertNotSame($expected, $output5, $name); + } else { + $this->assertSame($expected, $output5, $name); + $this->assertSame($expected, $output7, $name); + } } /** * @dataProvider provideTestPrettyPrint * @covers PhpParser\PrettyPrinter\Standard */ - public function testPrettyPrint($name, $code, $dump) { - $this->doTestPrettyPrintMethod('prettyPrint', $name, $code, $dump); + public function testPrettyPrint($name, $code, $expected, $mode) { + $this->doTestPrettyPrintMethod('prettyPrint', $name, $code, $expected, $mode); } /** * @dataProvider provideTestPrettyPrintFile * @covers PhpParser\PrettyPrinter\Standard */ - public function testPrettyPrintFile($name, $code, $dump) { - $this->doTestPrettyPrintMethod('prettyPrintFile', $name, $code, $dump); + public function testPrettyPrintFile($name, $code, $expected, $mode) { + $this->doTestPrettyPrintMethod('prettyPrintFile', $name, $code, $expected, $mode); } public function provideTestPrettyPrint() { @@ -60,4 +89,76 @@ public function testPrettyPrintExpr() { )); $this->assertEquals("function () {\n return 'a\nb';\n}", $prettyPrinter->prettyPrintExpr($expr)); } + + public function testCommentBeforeInlineHTML() { + $prettyPrinter = new PrettyPrinter\Standard; + $comment = new Comment\Doc("/**\n * This is a comment\n */"); + $stmts = [new Stmt\InlineHTML('Hello World!', ['comments' => [$comment]])]; + $expected = "\nHello World!"; + $this->assertSame($expected, $prettyPrinter->prettyPrintFile($stmts)); + } + + private function parseModeLine($modeLine) { + $parts = explode(' ', $modeLine, 2); + $version = isset($parts[0]) ? $parts[0] : 'both'; + $options = isset($parts[1]) ? json_decode($parts[1], true) : []; + return [$version, $options]; + } + + public function testArraySyntaxDefault() { + $prettyPrinter = new Standard(['shortArraySyntax' => true]); + $expr = new Expr\Array_([ + new Expr\ArrayItem(new String_('val'), new String_('key')) + ]); + $expected = "['key' => 'val']"; + $this->assertSame($expected, $prettyPrinter->prettyPrintExpr($expr)); + } + + /** + * @dataProvider provideTestKindAttributes + */ + public function testKindAttributes($node, $expected) { + $prttyPrinter = new PrettyPrinter\Standard; + $result = $prttyPrinter->prettyPrintExpr($node); + $this->assertSame($expected, $result); + } + + public function provideTestKindAttributes() { + $nowdoc = ['kind' => String_::KIND_NOWDOC, 'docLabel' => 'STR']; + $heredoc = ['kind' => String_::KIND_HEREDOC, 'docLabel' => 'STR']; + return [ + // Defaults to single quoted + [new String_('foo'), "'foo'"], + // Explicit single/double quoted + [new String_('foo', ['kind' => String_::KIND_SINGLE_QUOTED]), "'foo'"], + [new String_('foo', ['kind' => String_::KIND_DOUBLE_QUOTED]), '"foo"'], + // Fallback from doc string if no label + [new String_('foo', ['kind' => String_::KIND_NOWDOC]), "'foo'"], + [new String_('foo', ['kind' => String_::KIND_HEREDOC]), '"foo"'], + // Fallback if string contains label + [new String_("A\nB\nC", ['kind' => String_::KIND_NOWDOC, 'docLabel' => 'A']), "'A\nB\nC'"], + [new String_("A\nB\nC", ['kind' => String_::KIND_NOWDOC, 'docLabel' => 'B']), "'A\nB\nC'"], + [new String_("A\nB\nC", ['kind' => String_::KIND_NOWDOC, 'docLabel' => 'C']), "'A\nB\nC'"], + [new String_("STR;", ['kind' => String_::KIND_NOWDOC, 'docLabel' => 'STR']), "'STR;'"], + // Doc string if label not contained (or not in ending position) + [new String_("foo", $nowdoc), "<<<'STR'\nfoo\nSTR\n"], + [new String_("foo", $heredoc), "<< + + 4 + // comment @@ -30,9 +33,6 @@ function functionName(&\$a = 0, \$b = 1.0) { /** doc comment */ - - 4 - 6 @@ -71,6 +71,9 @@ function functionName(&\$a = 0, \$b = 1.0) { 4 + + 10 + 0 @@ -113,7 +116,7 @@ function functionName(&\$a = 0, \$b = 1.0) { - + @@ -133,6 +136,9 @@ function functionName(&\$a = 0, \$b = 1.0) { 5 + + 1 + Foo @@ -147,9 +153,10 @@ function functionName(&\$a = 0, \$b = 1.0) { XML; - $parser = new PhpParser\Parser(new PhpParser\Lexer); + $parser = new PhpParser\Parser\Php7(new PhpParser\Lexer); $serializer = new XML; + $code = str_replace("\r\n", "\n", $code); $stmts = $parser->parse($code); $this->assertXmlStringEqualsXmlString($xml, $serializer->serialize($stmts)); } diff --git a/application/vendor/nikic/php-parser/test/bootstrap.php b/application/vendor/nikic/php-parser/test/bootstrap.php new file mode 100644 index 0000000..9526b64 --- /dev/null +++ b/application/vendor/nikic/php-parser/test/bootstrap.php @@ -0,0 +1,20 @@ + +----- +array( + 0: Stmt_Nop( + comments: array( + 0: /** doc */ + 1: /* foobar */ + 2: // foo + 3: // bar + ) + ) +) +----- +$b['c'](); $a->b()['c']; $a->b(){'c'}; // invalid PHP: drop Support? ----- +!!php5 array( 0: Expr_PropertyFetch( var: Expr_Variable( name: a + comments: array( + 0: // property fetch variations + ) ) name: b + comments: array( + 0: // property fetch variations + ) ) 1: Expr_ArrayDimFetch( var: Expr_PropertyFetch( @@ -49,10 +56,16 @@ array( 3: Expr_MethodCall( var: Expr_Variable( name: a + comments: array( + 0: // method call variations + ) ) name: b args: array( ) + comments: array( + 0: // method call variations + ) ) 4: Expr_MethodCall( var: Expr_Variable( @@ -93,14 +106,23 @@ array( var: Expr_MethodCall( var: Expr_Variable( name: a + comments: array( + 0: // array dereferencing + ) ) name: b args: array( ) + comments: array( + 0: // array dereferencing + ) ) dim: Scalar_String( value: c ) + comments: array( + 0: // array dereferencing + ) ) 8: Expr_ArrayDimFetch( var: Expr_MethodCall( @@ -115,4 +137,9 @@ array( value: c ) ) + 9: Stmt_Nop( + comments: array( + 0: // invalid PHP: drop Support? + ) + ) ) \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticCall.test b/application/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticCall.test index 961dc65..b806f7d 100644 --- a/application/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticCall.test +++ b/application/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticCall.test @@ -18,16 +18,23 @@ $a::b(); ${'a'}::b(); $a['b']::c(); ----- +!!php5 array( 0: Expr_StaticCall( class: Name( parts: array( 0: A ) + comments: array( + 0: // method name variations + ) ) name: b args: array( ) + comments: array( + 0: // method name variations + ) ) 1: Expr_StaticCall( class: Name( @@ -98,24 +105,39 @@ array( parts: array( 0: A ) + comments: array( + 0: // array dereferencing + ) ) name: b args: array( ) + comments: array( + 0: // array dereferencing + ) ) dim: Scalar_String( value: c ) + comments: array( + 0: // array dereferencing + ) ) 6: Expr_StaticCall( class: Name( parts: array( 0: static ) + comments: array( + 0: // class name variations + ) ) name: b args: array( ) + comments: array( + 0: // class name variations + ) ) 7: Expr_StaticCall( class: Expr_Variable( diff --git a/application/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticPropertyFetch.test b/application/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticPropertyFetch.test index f1b08eb..3d3cde5 100644 --- a/application/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticPropertyFetch.test +++ b/application/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticPropertyFetch.test @@ -19,8 +19,14 @@ array( parts: array( 0: A ) + comments: array( + 0: // property name variations + ) ) name: b + comments: array( + 0: // property name variations + ) ) 1: Expr_StaticPropertyFetch( class: Name( @@ -48,12 +54,21 @@ array( parts: array( 0: A ) + comments: array( + 0: // array access + ) ) name: b + comments: array( + 0: // array access + ) ) dim: Scalar_String( value: c ) + comments: array( + 0: // array access + ) ) 4: Expr_ArrayDimFetch( var: Expr_StaticPropertyFetch( @@ -68,4 +83,9 @@ array( value: c ) ) + 5: Stmt_Nop( + comments: array( + 0: // class name variations can be found in staticCall.test + ) + ) ) \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/code/parser/expr/logic.test b/application/vendor/nikic/php-parser/test/code/parser/expr/logic.test index 967afdd..b3634e9 100644 --- a/application/vendor/nikic/php-parser/test/code/parser/expr/logic.test +++ b/application/vendor/nikic/php-parser/test/code/parser/expr/logic.test @@ -24,10 +24,16 @@ array( 0: Expr_BinaryOp_BooleanAnd( left: Expr_Variable( name: a + comments: array( + 0: // boolean ops + ) ) right: Expr_Variable( name: b ) + comments: array( + 0: // boolean ops + ) ) 1: Expr_BinaryOp_BooleanOr( left: Expr_Variable( @@ -52,10 +58,16 @@ array( 4: Expr_BinaryOp_LogicalAnd( left: Expr_Variable( name: a + comments: array( + 0: // logical ops + ) ) right: Expr_Variable( name: b ) + comments: array( + 0: // logical ops + ) ) 5: Expr_BinaryOp_LogicalOr( left: Expr_Variable( @@ -77,10 +89,16 @@ array( left: Expr_BinaryOp_BooleanAnd( left: Expr_Variable( name: a + comments: array( + 0: // precedence + ) ) right: Expr_Variable( name: b ) + comments: array( + 0: // precedence + ) ) right: Expr_BinaryOp_BooleanAnd( left: Expr_Variable( @@ -90,6 +108,9 @@ array( name: d ) ) + comments: array( + 0: // precedence + ) ) 8: Expr_BinaryOp_BooleanAnd( left: Expr_BinaryOp_BooleanAnd( diff --git a/application/vendor/nikic/php-parser/test/code/parser/expr/math.test b/application/vendor/nikic/php-parser/test/code/parser/expr/math.test index 7a2c744..3c00ebc 100644 --- a/application/vendor/nikic/php-parser/test/code/parser/expr/math.test +++ b/application/vendor/nikic/php-parser/test/code/parser/expr/math.test @@ -38,6 +38,9 @@ array( expr: Expr_Variable( name: a ) + comments: array( + 0: // unary ops + ) ) 1: Expr_UnaryPlus( expr: Expr_Variable( @@ -52,10 +55,16 @@ array( 3: Expr_BinaryOp_BitwiseAnd( left: Expr_Variable( name: a + comments: array( + 0: // binary ops + ) ) right: Expr_Variable( name: b ) + comments: array( + 0: // binary ops + ) ) 4: Expr_BinaryOp_BitwiseOr( left: Expr_Variable( @@ -149,14 +158,23 @@ array( left: Expr_BinaryOp_Mul( left: Expr_Variable( name: a + comments: array( + 0: // associativity + ) ) right: Expr_Variable( name: b ) + comments: array( + 0: // associativity + ) ) right: Expr_Variable( name: c ) + comments: array( + 0: // associativity + ) ) 16: Expr_BinaryOp_Mul( left: Expr_Variable( @@ -174,6 +192,9 @@ array( 17: Expr_BinaryOp_Plus( left: Expr_Variable( name: a + comments: array( + 0: // precedence + ) ) right: Expr_BinaryOp_Mul( left: Expr_Variable( @@ -183,6 +204,9 @@ array( name: c ) ) + comments: array( + 0: // precedence + ) ) 18: Expr_BinaryOp_Mul( left: Expr_BinaryOp_Plus( @@ -200,6 +224,9 @@ array( 19: Expr_BinaryOp_Pow( left: Expr_Variable( name: a + comments: array( + 0: // pow is special + ) ) right: Expr_BinaryOp_Pow( left: Expr_Variable( @@ -209,6 +236,9 @@ array( name: c ) ) + comments: array( + 0: // pow is special + ) ) 20: Expr_BinaryOp_Pow( left: Expr_BinaryOp_Pow( diff --git a/application/vendor/nikic/php-parser/test/code/parser/expr/new.test b/application/vendor/nikic/php-parser/test/code/parser/expr/new.test index b7ce7a9..a132bbb 100644 --- a/application/vendor/nikic/php-parser/test/code/parser/expr/new.test +++ b/application/vendor/nikic/php-parser/test/code/parser/expr/new.test @@ -50,6 +50,9 @@ array( ) args: array( ) + comments: array( + 0: // class name variations + ) ) 3: Expr_New( class: Expr_ArrayDimFetch( @@ -84,6 +87,9 @@ array( ) args: array( ) + comments: array( + 0: // DNCR object access + ) ) 6: Expr_New( class: Expr_PropertyFetch( diff --git a/application/vendor/nikic/php-parser/test/code/parser/expr/shellExec.test b/application/vendor/nikic/php-parser/test/code/parser/expr/shellExec.test index bc7e314..2304fd9 100644 --- a/application/vendor/nikic/php-parser/test/code/parser/expr/shellExec.test +++ b/application/vendor/nikic/php-parser/test/code/parser/expr/shellExec.test @@ -14,12 +14,16 @@ array( ) 1: Expr_ShellExec( parts: array( - 0: test + 0: Scalar_EncapsedStringPart( + value: test + ) ) ) 2: Expr_ShellExec( parts: array( - 0: test + 0: Scalar_EncapsedStringPart( + value: test + ) 1: Expr_Variable( name: A ) @@ -27,12 +31,16 @@ array( ) 3: Expr_ShellExec( parts: array( - 0: test ` + 0: Scalar_EncapsedStringPart( + value: test ` + ) ) ) 4: Expr_ShellExec( parts: array( - 0: test \" + 0: Scalar_EncapsedStringPart( + value: test \" + ) ) ) ) \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/code/parser/expr/ternaryAndCoalesce.test b/application/vendor/nikic/php-parser/test/code/parser/expr/ternaryAndCoalesce.test index 5ebf5fe..268935d 100644 --- a/application/vendor/nikic/php-parser/test/code/parser/expr/ternaryAndCoalesce.test +++ b/application/vendor/nikic/php-parser/test/code/parser/expr/ternaryAndCoalesce.test @@ -20,6 +20,9 @@ array( 0: Expr_Ternary( cond: Expr_Variable( name: a + comments: array( + 0: // ternary + ) ) if: Expr_Variable( name: b @@ -27,6 +30,9 @@ array( else: Expr_Variable( name: c ) + comments: array( + 0: // ternary + ) ) 1: Expr_Ternary( cond: Expr_Variable( @@ -41,6 +47,9 @@ array( cond: Expr_Ternary( cond: Expr_Variable( name: a + comments: array( + 0: // precedence + ) ) if: Expr_Variable( name: b @@ -48,6 +57,9 @@ array( else: Expr_Variable( name: c ) + comments: array( + 0: // precedence + ) ) if: Expr_Variable( name: d @@ -55,6 +67,9 @@ array( else: Expr_Variable( name: e ) + comments: array( + 0: // precedence + ) ) 3: Expr_Ternary( cond: Expr_Variable( @@ -78,10 +93,16 @@ array( 4: Expr_BinaryOp_Coalesce( left: Expr_Variable( name: a + comments: array( + 0: // null coalesce + ) ) right: Expr_Variable( name: b ) + comments: array( + 0: // null coalesce + ) ) 5: Expr_BinaryOp_Coalesce( left: Expr_Variable( @@ -125,4 +146,4 @@ array( name: c ) ) -) +) \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test b/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test new file mode 100644 index 0000000..c4e4a48 --- /dev/null +++ b/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test @@ -0,0 +1,16 @@ +Non-simple variables are forbidden in PHP 7 +----- +bar; +----- +!!php7 +Syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' from 2:13 to 2:14 +array( + 0: Expr_ConstFetch( + name: Name( + parts: array( + 0: bar + ) + ) + ) +) diff --git a/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/indirectCall.test b/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/indirectCall.test new file mode 100644 index 0000000..bb3e7fb --- /dev/null +++ b/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/indirectCall.test @@ -0,0 +1,481 @@ +UVS indirect calls +----- + 'b']->a); +isset("str"->a); +----- +!!php7 +array( + 0: Expr_Isset( + vars: array( + 0: Expr_ArrayDimFetch( + var: Expr_BinaryOp_Plus( + left: Expr_Array( + items: array( + 0: Expr_ArrayItem( + key: null + value: Scalar_LNumber( + value: 0 + ) + byRef: false + ) + 1: Expr_ArrayItem( + key: null + value: Scalar_LNumber( + value: 1 + ) + byRef: false + ) + ) + ) + right: Expr_Array( + items: array( + ) + ) + ) + dim: Scalar_LNumber( + value: 0 + ) + ) + ) + ) + 1: Expr_Isset( + vars: array( + 0: Expr_PropertyFetch( + var: Expr_Array( + items: array( + 0: Expr_ArrayItem( + key: Scalar_String( + value: a + ) + value: Scalar_String( + value: b + ) + byRef: false + ) + ) + ) + name: a + ) + ) + ) + 2: Expr_Isset( + vars: array( + 0: Expr_PropertyFetch( + var: Scalar_String( + value: str + ) + name: a + ) + ) + ) +) diff --git a/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/misc.test b/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/misc.test new file mode 100644 index 0000000..2c5ba90 --- /dev/null +++ b/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/misc.test @@ -0,0 +1,109 @@ +Uniform variable syntax in PHP 7 (misc) +----- +length(); +(clone $obj)->b[0](1); +[0, 1][0] = 1; +----- +!!php7 +array( + 0: Expr_ArrayDimFetch( + var: Expr_ClassConstFetch( + class: Name( + parts: array( + 0: A + ) + ) + name: A + ) + dim: Scalar_LNumber( + value: 0 + ) + ) + 1: Expr_ArrayDimFetch( + var: Expr_ArrayDimFetch( + var: Expr_ArrayDimFetch( + var: Expr_ClassConstFetch( + class: Name( + parts: array( + 0: A + ) + ) + name: A + ) + dim: Scalar_LNumber( + value: 0 + ) + ) + dim: Scalar_LNumber( + value: 1 + ) + ) + dim: Scalar_LNumber( + value: 2 + ) + ) + 2: Expr_MethodCall( + var: Scalar_String( + value: string + ) + name: length + args: array( + ) + ) + 3: Expr_FuncCall( + name: Expr_ArrayDimFetch( + var: Expr_PropertyFetch( + var: Expr_Clone( + expr: Expr_Variable( + name: obj + ) + ) + name: b + ) + dim: Scalar_LNumber( + value: 0 + ) + ) + args: array( + 0: Arg( + value: Scalar_LNumber( + value: 1 + ) + byRef: false + unpack: false + ) + ) + ) + 4: Expr_Assign( + var: Expr_ArrayDimFetch( + var: Expr_Array( + items: array( + 0: Expr_ArrayItem( + key: null + value: Scalar_LNumber( + value: 0 + ) + byRef: false + ) + 1: Expr_ArrayItem( + key: null + value: Scalar_LNumber( + value: 1 + ) + byRef: false + ) + ) + ) + dim: Scalar_LNumber( + value: 0 + ) + ) + expr: Scalar_LNumber( + value: 1 + ) + ) +) diff --git a/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/new.test b/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/new.test new file mode 100644 index 0000000..e5f92f9 --- /dev/null +++ b/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/new.test @@ -0,0 +1,95 @@ +UVS new expressions +----- +className; +new Test::$className; +new $test::$className; +new $weird[0]->foo::$className; +----- +!!php7 +array( + 0: Expr_New( + class: Expr_Variable( + name: className + ) + args: array( + ) + ) + 1: Expr_New( + class: Expr_ArrayDimFetch( + var: Expr_Variable( + name: array + ) + dim: Scalar_String( + value: className + ) + ) + args: array( + ) + ) + 2: Expr_New( + class: Expr_ArrayDimFetch( + var: Expr_Variable( + name: array + ) + dim: Scalar_String( + value: className + ) + ) + args: array( + ) + ) + 3: Expr_New( + class: Expr_PropertyFetch( + var: Expr_Variable( + name: obj + ) + name: className + ) + args: array( + ) + ) + 4: Expr_New( + class: Expr_StaticPropertyFetch( + class: Name( + parts: array( + 0: Test + ) + ) + name: className + ) + args: array( + ) + ) + 5: Expr_New( + class: Expr_StaticPropertyFetch( + class: Expr_Variable( + name: test + ) + name: className + ) + args: array( + ) + ) + 6: Expr_New( + class: Expr_StaticPropertyFetch( + class: Expr_PropertyFetch( + var: Expr_ArrayDimFetch( + var: Expr_Variable( + name: weird + ) + dim: Scalar_LNumber( + value: 0 + ) + ) + name: foo + ) + name: className + ) + args: array( + ) + ) +) diff --git a/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/staticProperty.test b/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/staticProperty.test new file mode 100644 index 0000000..5fadfc4 --- /dev/null +++ b/application/vendor/nikic/php-parser/test/code/parser/expr/uvs/staticProperty.test @@ -0,0 +1,93 @@ +UVS static access +----- +c test EOS; -// comment to force line break before EOF +b<< float overflows + 1: // (all are actually the same number, just in different representations) + ) ) 11: Scalar_DNumber( - value: @@{ 0xFFFFFFFFFFFFFFFF }@@ + value: 1.844674407371E+19 ) 12: Scalar_DNumber( - value: @@{ 0xFFFFFFFFFFFFFFFF }@@ + value: 1.844674407371E+19 ) 13: Scalar_DNumber( - value: @@{ 0xFFFFFFFFFFFFFFFF }@@ + value: 1.844674407371E+19 ) 14: Scalar_DNumber( - value: @@{ 0xFFFFFFFFFFFFFFFF }@@ + value: 1.844674407371E+19 ) ) \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/code/parser/scalar/int.test b/application/vendor/nikic/php-parser/test/code/parser/scalar/int.test index 17a5785..5a21267 100644 --- a/application/vendor/nikic/php-parser/test/code/parser/scalar/int.test +++ b/application/vendor/nikic/php-parser/test/code/parser/scalar/int.test @@ -10,7 +10,6 @@ Different integer syntaxes 0xfff; 0XfFf; 0777; -0787; 0b111000111000; ----- array( @@ -39,9 +38,6 @@ array( value: 511 ) 8: Scalar_LNumber( - value: 7 - ) - 9: Scalar_LNumber( value: 3640 ) ) \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/code/parser/scalar/invalidOctal.test b/application/vendor/nikic/php-parser/test/code/parser/scalar/invalidOctal.test new file mode 100644 index 0000000..eedae74 --- /dev/null +++ b/application/vendor/nikic/php-parser/test/code/parser/scalar/invalidOctal.test @@ -0,0 +1,17 @@ +Invalid octal literals +----- +array(); +$t->public(); + +Test::list(); +Test::protected(); + +$t->class; +$t->private; + +Test::TRAIT; +Test::FINAL; + +class Foo { + use TraitA, TraitB { + TraitA::catch insteadof namespace\TraitB; + TraitA::list as foreach; + TraitB::throw as protected public; + TraitB::self as protected; + exit as die; + \TraitC::exit as bye; + namespace\TraitC::exit as byebye; + TraitA:: + // + /** doc comment */ + # + catch /* comment */ + // comment + # comment + insteadof TraitB; + } +} +----- +array( + 0: Stmt_Class( + type: 0 + name: Test + extends: null + implements: array( + ) + stmts: array( + 0: Stmt_ClassMethod( + type: 0 + byRef: false + name: array + params: array( + ) + returnType: null + stmts: array( + ) + ) + 1: Stmt_ClassMethod( + type: 0 + byRef: false + name: public + params: array( + ) + returnType: null + stmts: array( + ) + ) + 2: Stmt_ClassMethod( + type: 8 + byRef: false + name: list + params: array( + ) + returnType: null + stmts: array( + ) + ) + 3: Stmt_ClassMethod( + type: 8 + byRef: false + name: protected + params: array( + ) + returnType: null + stmts: array( + ) + ) + 4: Stmt_Property( + type: 1 + props: array( + 0: Stmt_PropertyProperty( + name: class + default: null + ) + ) + ) + 5: Stmt_Property( + type: 1 + props: array( + 0: Stmt_PropertyProperty( + name: private + default: null + ) + ) + ) + 6: Stmt_ClassConst( + consts: array( + 0: Const( + name: TRAIT + value: Scalar_LNumber( + value: 3 + ) + ) + 1: Const( + name: FINAL + value: Scalar_LNumber( + value: 4 + ) + ) + ) + ) + 7: Stmt_ClassConst( + consts: array( + 0: Const( + name: __CLASS__ + value: Scalar_LNumber( + value: 1 + ) + ) + 1: Const( + name: __TRAIT__ + value: Scalar_LNumber( + value: 2 + ) + ) + 2: Const( + name: __FUNCTION__ + value: Scalar_LNumber( + value: 3 + ) + ) + 3: Const( + name: __METHOD__ + value: Scalar_LNumber( + value: 4 + ) + ) + 4: Const( + name: __LINE__ + value: Scalar_LNumber( + value: 5 + ) + ) + 5: Const( + name: __FILE__ + value: Scalar_LNumber( + value: 6 + ) + ) + 6: Const( + name: __DIR__ + value: Scalar_LNumber( + value: 7 + ) + ) + 7: Const( + name: __NAMESPACE__ + value: Scalar_LNumber( + value: 8 + ) + ) + ) + ) + ) + ) + 1: Expr_Assign( + var: Expr_Variable( + name: t + ) + expr: Expr_New( + class: Name( + parts: array( + 0: Test + ) + ) + args: array( + ) + ) + ) + 2: Expr_MethodCall( + var: Expr_Variable( + name: t + ) + name: array + args: array( + ) + ) + 3: Expr_MethodCall( + var: Expr_Variable( + name: t + ) + name: public + args: array( + ) + ) + 4: Expr_StaticCall( + class: Name( + parts: array( + 0: Test + ) + ) + name: list + args: array( + ) + ) + 5: Expr_StaticCall( + class: Name( + parts: array( + 0: Test + ) + ) + name: protected + args: array( + ) + ) + 6: Expr_PropertyFetch( + var: Expr_Variable( + name: t + ) + name: class + ) + 7: Expr_PropertyFetch( + var: Expr_Variable( + name: t + ) + name: private + ) + 8: Expr_ClassConstFetch( + class: Name( + parts: array( + 0: Test + ) + ) + name: TRAIT + ) + 9: Expr_ClassConstFetch( + class: Name( + parts: array( + 0: Test + ) + ) + name: FINAL + ) + 10: Stmt_Class( + type: 0 + name: Foo + extends: null + implements: array( + ) + stmts: array( + 0: Stmt_TraitUse( + traits: array( + 0: Name( + parts: array( + 0: TraitA + ) + ) + 1: Name( + parts: array( + 0: TraitB + ) + ) + ) + adaptations: array( + 0: Stmt_TraitUseAdaptation_Precedence( + trait: Name( + parts: array( + 0: TraitA + ) + ) + method: catch + insteadof: array( + 0: Name_Relative( + parts: array( + 0: TraitB + ) + ) + ) + ) + 1: Stmt_TraitUseAdaptation_Alias( + trait: Name( + parts: array( + 0: TraitA + ) + ) + method: list + newModifier: null + newName: foreach + ) + 2: Stmt_TraitUseAdaptation_Alias( + trait: Name( + parts: array( + 0: TraitB + ) + ) + method: throw + newModifier: 2 + newName: public + ) + 3: Stmt_TraitUseAdaptation_Alias( + trait: Name( + parts: array( + 0: TraitB + ) + ) + method: self + newModifier: 2 + newName: null + ) + 4: Stmt_TraitUseAdaptation_Alias( + trait: null + method: exit + newModifier: null + newName: die + ) + 5: Stmt_TraitUseAdaptation_Alias( + trait: Name_FullyQualified( + parts: array( + 0: TraitC + ) + ) + method: exit + newModifier: null + newName: bye + ) + 6: Stmt_TraitUseAdaptation_Alias( + trait: Name_Relative( + parts: array( + 0: TraitC + ) + ) + method: exit + newModifier: null + newName: byebye + ) + 7: Stmt_TraitUseAdaptation_Precedence( + trait: Name( + parts: array( + 0: TraitA + ) + ) + method: catch + insteadof: array( + 0: Name( + parts: array( + 0: TraitB + ) + ) + ) + ) + ) + ) + ) + ) +) \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test b/application/vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test index 97524ac..6e47a5b 100644 --- a/application/vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test +++ b/application/vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test @@ -38,6 +38,11 @@ array( stmts: array( ) ) + 1: Stmt_Nop( + comments: array( + 0: // Type in the partial parse could conceivably be any of 0, 16 or 32 + ) + ) ) ----- $value; - - // expressions - $data = yield; - $data = (yield $value); - $data = (yield $key => $value); - - // yield in language constructs with their own parentheses - if (yield $foo); elseif (yield $foo); - if (yield $foo): elseif (yield $foo): endif; - while (yield $foo); - do {} while (yield $foo); - switch (yield $foo) {} - die(yield $foo); - - // yield in function calls - func(yield $foo); - $foo->func(yield $foo); - new Foo(yield $foo); - - yield from $foo; - yield from $foo and yield from $bar; - yield from $foo + $bar; -} ------ -array( - 0: Stmt_Function( - byRef: false - name: gen - params: array( - ) - returnType: null - stmts: array( - 0: Expr_Yield( - key: null - value: null - ) - 1: Expr_Yield( - key: null - value: Expr_Variable( - name: value - ) - ) - 2: Expr_Yield( - key: Expr_Variable( - name: key - ) - value: Expr_Variable( - name: value - ) - ) - 3: Expr_Assign( - var: Expr_Variable( - name: data - ) - expr: Expr_Yield( - key: null - value: null - ) - ) - 4: Expr_Assign( - var: Expr_Variable( - name: data - ) - expr: Expr_Yield( - key: null - value: Expr_Variable( - name: value - ) - ) - ) - 5: Expr_Assign( - var: Expr_Variable( - name: data - ) - expr: Expr_Yield( - key: Expr_Variable( - name: key - ) - value: Expr_Variable( - name: value - ) - ) - ) - 6: Stmt_If( - cond: Expr_Yield( - key: null - value: Expr_Variable( - name: foo - ) - ) - stmts: array( - ) - elseifs: array( - 0: Stmt_ElseIf( - cond: Expr_Yield( - key: null - value: Expr_Variable( - name: foo - ) - ) - stmts: array( - ) - ) - ) - else: null - ) - 7: Stmt_If( - cond: Expr_Yield( - key: null - value: Expr_Variable( - name: foo - ) - ) - stmts: array( - ) - elseifs: array( - 0: Stmt_ElseIf( - cond: Expr_Yield( - key: null - value: Expr_Variable( - name: foo - ) - ) - stmts: array( - ) - ) - ) - else: null - ) - 8: Stmt_While( - cond: Expr_Yield( - key: null - value: Expr_Variable( - name: foo - ) - ) - stmts: array( - ) - ) - 9: Stmt_Do( - cond: Expr_Yield( - key: null - value: Expr_Variable( - name: foo - ) - ) - stmts: array( - ) - ) - 10: Stmt_Switch( - cond: Expr_Yield( - key: null - value: Expr_Variable( - name: foo - ) - ) - cases: array( - ) - ) - 11: Expr_Exit( - expr: Expr_Yield( - key: null - value: Expr_Variable( - name: foo - ) - ) - ) - 12: Expr_FuncCall( - name: Name( - parts: array( - 0: func - ) - ) - args: array( - 0: Arg( - value: Expr_Yield( - key: null - value: Expr_Variable( - name: foo - ) - ) - byRef: false - unpack: false - ) - ) - ) - 13: Expr_MethodCall( - var: Expr_Variable( - name: foo - ) - name: func - args: array( - 0: Arg( - value: Expr_Yield( - key: null - value: Expr_Variable( - name: foo - ) - ) - byRef: false - unpack: false - ) - ) - ) - 14: Expr_New( - class: Name( - parts: array( - 0: Foo - ) - ) - args: array( - 0: Arg( - value: Expr_Yield( - key: null - value: Expr_Variable( - name: foo - ) - ) - byRef: false - unpack: false - ) - ) - ) - 15: Expr_YieldFrom( - expr: Expr_Variable( - name: foo - ) - ) - 16: Expr_BinaryOp_LogicalAnd( - left: Expr_YieldFrom( - expr: Expr_Variable( - name: foo - ) - ) - right: Expr_YieldFrom( - expr: Expr_Variable( - name: bar - ) - ) - ) - 17: Expr_YieldFrom( - expr: Expr_BinaryOp_Plus( - left: Expr_Variable( - name: foo - ) - right: Expr_Variable( - name: bar - ) - ) - ) - ) - ) -) diff --git a/application/vendor/nikic/php-parser/test/code/parser/stmt/function/scalarTypeDeclarations.test b/application/vendor/nikic/php-parser/test/code/parser/stmt/function/scalarTypeDeclarations.test new file mode 100644 index 0000000..aacaf1c --- /dev/null +++ b/application/vendor/nikic/php-parser/test/code/parser/stmt/function/scalarTypeDeclarations.test @@ -0,0 +1,45 @@ +Scalar type declarations +----- + $value; + + // expressions + $data = yield; + $data = (yield $value); + $data = (yield $key => $value); + + // yield in language constructs with their own parentheses + if (yield $foo); elseif (yield $foo); + if (yield $foo): elseif (yield $foo): endif; + while (yield $foo); + do {} while (yield $foo); + switch (yield $foo) {} + die(yield $foo); + + // yield in function calls + func(yield $foo); + $foo->func(yield $foo); + new Foo(yield $foo); + + yield from $foo; + yield from $foo and yield from $bar; + yield from $foo + $bar; +} +----- +array( + 0: Stmt_Function( + byRef: false + name: gen + params: array( + ) + returnType: null + stmts: array( + 0: Expr_Yield( + key: null + value: null + comments: array( + 0: // statements + ) + ) + 1: Expr_Yield( + key: null + value: Expr_Variable( + name: value + ) + ) + 2: Expr_Yield( + key: Expr_Variable( + name: key + ) + value: Expr_Variable( + name: value + ) + ) + 3: Expr_Assign( + var: Expr_Variable( + name: data + comments: array( + 0: // expressions + ) + ) + expr: Expr_Yield( + key: null + value: null + ) + comments: array( + 0: // expressions + ) + ) + 4: Expr_Assign( + var: Expr_Variable( + name: data + ) + expr: Expr_Yield( + key: null + value: Expr_Variable( + name: value + ) + ) + ) + 5: Expr_Assign( + var: Expr_Variable( + name: data + ) + expr: Expr_Yield( + key: Expr_Variable( + name: key + ) + value: Expr_Variable( + name: value + ) + ) + ) + 6: Stmt_If( + cond: Expr_Yield( + key: null + value: Expr_Variable( + name: foo + ) + ) + stmts: array( + ) + elseifs: array( + 0: Stmt_ElseIf( + cond: Expr_Yield( + key: null + value: Expr_Variable( + name: foo + ) + ) + stmts: array( + ) + ) + ) + else: null + comments: array( + 0: // yield in language constructs with their own parentheses + ) + ) + 7: Stmt_If( + cond: Expr_Yield( + key: null + value: Expr_Variable( + name: foo + ) + ) + stmts: array( + ) + elseifs: array( + 0: Stmt_ElseIf( + cond: Expr_Yield( + key: null + value: Expr_Variable( + name: foo + ) + ) + stmts: array( + ) + ) + ) + else: null + ) + 8: Stmt_While( + cond: Expr_Yield( + key: null + value: Expr_Variable( + name: foo + ) + ) + stmts: array( + ) + ) + 9: Stmt_Do( + cond: Expr_Yield( + key: null + value: Expr_Variable( + name: foo + ) + ) + stmts: array( + ) + ) + 10: Stmt_Switch( + cond: Expr_Yield( + key: null + value: Expr_Variable( + name: foo + ) + ) + cases: array( + ) + ) + 11: Expr_Exit( + expr: Expr_Yield( + key: null + value: Expr_Variable( + name: foo + ) + ) + ) + 12: Expr_FuncCall( + name: Name( + parts: array( + 0: func + ) + comments: array( + 0: // yield in function calls + ) + ) + args: array( + 0: Arg( + value: Expr_Yield( + key: null + value: Expr_Variable( + name: foo + ) + ) + byRef: false + unpack: false + ) + ) + comments: array( + 0: // yield in function calls + ) + ) + 13: Expr_MethodCall( + var: Expr_Variable( + name: foo + ) + name: func + args: array( + 0: Arg( + value: Expr_Yield( + key: null + value: Expr_Variable( + name: foo + ) + ) + byRef: false + unpack: false + ) + ) + ) + 14: Expr_New( + class: Name( + parts: array( + 0: Foo + ) + ) + args: array( + 0: Arg( + value: Expr_Yield( + key: null + value: Expr_Variable( + name: foo + ) + ) + byRef: false + unpack: false + ) + ) + ) + 15: Expr_YieldFrom( + expr: Expr_Variable( + name: foo + ) + ) + 16: Expr_BinaryOp_LogicalAnd( + left: Expr_YieldFrom( + expr: Expr_Variable( + name: foo + ) + ) + right: Expr_YieldFrom( + expr: Expr_Variable( + name: bar + ) + ) + ) + 17: Expr_YieldFrom( + expr: Expr_BinaryOp_Plus( + left: Expr_Variable( + name: foo + ) + right: Expr_Variable( + name: bar + ) + ) + ) + ) + ) +) \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldPrecedence.test b/application/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldPrecedence.test new file mode 100644 index 0000000..ff0d4df --- /dev/null +++ b/application/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldPrecedence.test @@ -0,0 +1,230 @@ +Yield operator precedence +----- + "a" . "b"; + yield "k" => "a" or die; + var_dump([yield "k" => "a" . "b"]); + yield yield "k1" => yield "k2" => "a" . "b"; + yield yield "k1" => (yield "k2") => "a" . "b"; + var_dump([yield "k1" => yield "k2" => "a" . "b"]); + var_dump([yield "k1" => (yield "k2") => "a" . "b"]); +} +----- +!!php7 +array( + 0: Stmt_Function( + byRef: false + name: gen + params: array( + ) + returnType: null + stmts: array( + 0: Expr_Yield( + key: null + value: Expr_BinaryOp_Concat( + left: Scalar_String( + value: a + ) + right: Scalar_String( + value: b + ) + ) + ) + 1: Expr_BinaryOp_LogicalOr( + left: Expr_Yield( + key: null + value: Scalar_String( + value: a + ) + ) + right: Expr_Exit( + expr: null + ) + ) + 2: Expr_Yield( + key: Scalar_String( + value: k + ) + value: Expr_BinaryOp_Concat( + left: Scalar_String( + value: a + ) + right: Scalar_String( + value: b + ) + ) + ) + 3: Expr_BinaryOp_LogicalOr( + left: Expr_Yield( + key: Scalar_String( + value: k + ) + value: Scalar_String( + value: a + ) + ) + right: Expr_Exit( + expr: null + ) + ) + 4: Expr_FuncCall( + name: Name( + parts: array( + 0: var_dump + ) + ) + args: array( + 0: Arg( + value: Expr_Array( + items: array( + 0: Expr_ArrayItem( + key: null + value: Expr_Yield( + key: Scalar_String( + value: k + ) + value: Expr_BinaryOp_Concat( + left: Scalar_String( + value: a + ) + right: Scalar_String( + value: b + ) + ) + ) + byRef: false + ) + ) + ) + byRef: false + unpack: false + ) + ) + ) + 5: Expr_Yield( + key: null + value: Expr_Yield( + key: Scalar_String( + value: k1 + ) + value: Expr_Yield( + key: Scalar_String( + value: k2 + ) + value: Expr_BinaryOp_Concat( + left: Scalar_String( + value: a + ) + right: Scalar_String( + value: b + ) + ) + ) + ) + ) + 6: Expr_Yield( + key: Expr_Yield( + key: Scalar_String( + value: k1 + ) + value: Expr_Yield( + key: null + value: Scalar_String( + value: k2 + ) + ) + ) + value: Expr_BinaryOp_Concat( + left: Scalar_String( + value: a + ) + right: Scalar_String( + value: b + ) + ) + ) + 7: Expr_FuncCall( + name: Name( + parts: array( + 0: var_dump + ) + ) + args: array( + 0: Arg( + value: Expr_Array( + items: array( + 0: Expr_ArrayItem( + key: null + value: Expr_Yield( + key: Scalar_String( + value: k1 + ) + value: Expr_Yield( + key: Scalar_String( + value: k2 + ) + value: Expr_BinaryOp_Concat( + left: Scalar_String( + value: a + ) + right: Scalar_String( + value: b + ) + ) + ) + ) + byRef: false + ) + ) + ) + byRef: false + unpack: false + ) + ) + ) + 8: Expr_FuncCall( + name: Name( + parts: array( + 0: var_dump + ) + ) + args: array( + 0: Arg( + value: Expr_Array( + items: array( + 0: Expr_ArrayItem( + key: Expr_Yield( + key: Scalar_String( + value: k1 + ) + value: Expr_Yield( + key: null + value: Scalar_String( + value: k2 + ) + ) + ) + value: Expr_BinaryOp_Concat( + left: Scalar_String( + value: a + ) + right: Scalar_String( + value: b + ) + ) + byRef: false + ) + ) + ) + byRef: false + unpack: false + ) + ) + ) + ) + ) +) diff --git a/application/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldUnaryPrecedence.test b/application/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldUnaryPrecedence.test new file mode 100644 index 0000000..13f9660 --- /dev/null +++ b/application/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldUnaryPrecedence.test @@ -0,0 +1,48 @@ +Yield with unary operator argument +----- +a = 'bar'; - echo 'test'; - } - - protected function baz() {} - public function foo() {} - abstract static function bar() {} -} ------ -class Foo -{ - var $a = 'foo'; - private $b = 'bar'; - static $c = 'baz'; - function test() - { - $this->a = 'bar'; - echo 'test'; - } - protected function baz() - { - } - public function foo() - { - } - static abstract function bar() - { - } -} \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/code/prettyPrinter/comments.test b/application/vendor/nikic/php-parser/test/code/prettyPrinter/comments.test index 7c2a474..34a9f93 100644 --- a/application/vendor/nikic/php-parser/test/code/prettyPrinter/comments.test +++ b/application/vendor/nikic/php-parser/test/code/prettyPrinter/comments.test @@ -27,7 +27,6 @@ function justForIndentation() Even more text. */ $foo; } - ----- function justForIndentation() { @@ -53,4 +52,16 @@ function justForIndentation() More text. Even more text. */ $foo; +} +----- +d} +STR; + +call( + <<d} +STR; +call(<< 'b', 'c' => 'd']; +----- +[]; +array(1, 2, 3); +['a' => 'b', 'c' => 'd']; \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/code/prettyPrinter/expr/stringEscaping.test b/application/vendor/nikic/php-parser/test/code/prettyPrinter/expr/stringEscaping.test new file mode 100644 index 0000000..02877ad --- /dev/null +++ b/application/vendor/nikic/php-parser/test/code/prettyPrinter/expr/stringEscaping.test @@ -0,0 +1,23 @@ +Escape sequences in double-quoted strings +----- +b)(); +(A::$b)(); +----- +!!php7 +(function () { +})(); +array('a', 'b')()(); +A::$b::$c; +$A::$b[$c](); +$A::{$b[$c]}(); +A::${$b}[$c](); +($a->b)(); +(A::$b)(); diff --git a/application/vendor/nikic/php-parser/test/code/prettyPrinter/variables.test b/application/vendor/nikic/php-parser/test/code/prettyPrinter/expr/variables.test similarity index 91% rename from application/vendor/nikic/php-parser/test/code/prettyPrinter/variables.test rename to application/vendor/nikic/php-parser/test/code/prettyPrinter/expr/variables.test index f24750d..4e0fa2e 100644 --- a/application/vendor/nikic/php-parser/test/code/prettyPrinter/variables.test +++ b/application/vendor/nikic/php-parser/test/code/prettyPrinter/expr/variables.test @@ -24,6 +24,7 @@ $a::$b[$c]; $a::$b[$c]($d); $a::{$b[$c]}($d); $a::{$b->c}(); +A::$$b[$c](); a(); $a(); $a()[$b]; @@ -36,6 +37,7 @@ $a::$b()[$c]; global $a, $$a, $$a[$b], $$a->b; ----- +!!php5 $a; ${$a}; ${$a}; @@ -55,9 +57,10 @@ $a::b(); $a::b($c); $a::$b(); $a::$b[$c]; -$a::$b[$c]($d); -$a::$b[$c]($d); +$a::{$b[$c]}($d); +$a::{$b[$c]}($d); $a::{$b->c}(); +A::${$b[$c]}(); a(); $a(); $a()[$b]; diff --git a/application/vendor/nikic/php-parser/test/code/prettyPrinter/expr/yield.test b/application/vendor/nikic/php-parser/test/code/prettyPrinter/expr/yield.test new file mode 100644 index 0000000..12ab7de --- /dev/null +++ b/application/vendor/nikic/php-parser/test/code/prettyPrinter/expr/yield.test @@ -0,0 +1,46 @@ +Yield +----- + $b; + $a = yield; + $a = (yield $b); + $a = (yield $b => $c); +} +// TODO Get rid of parens for cases 2 and 3 +----- +function gen() +{ + yield; + (yield $a); + (yield $a => $b); + $a = yield; + $a = (yield $b); + $a = (yield $b => $c); +} +// TODO Get rid of parens for cases 2 and 3 +----- + $c; + yield from $a; + $a = yield from $b; +} +// TODO Get rid of parens for last case +----- +!!php7 +function gen() +{ + $a = (yield $b); + $a = (yield $b => $c); + yield from $a; + $a = (yield from $b); +} +// TODO Get rid of parens for last case \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/code/prettyPrinter/onlyPHP.file-test b/application/vendor/nikic/php-parser/test/code/prettyPrinter/onlyPHP.file-test index 6b7ec49..9550b10 100644 --- a/application/vendor/nikic/php-parser/test/code/prettyPrinter/onlyPHP.file-test +++ b/application/vendor/nikic/php-parser/test/code/prettyPrinter/onlyPHP.file-test @@ -8,4 +8,9 @@ echo 'Bar Foo'; a = 'bar'; + echo 'test'; + } + + protected function baz() {} + public function foo() {} + abstract static function bar() {} +} + +trait Bar +{ + function test() + { + } +} +----- +class Foo extends Bar implements ABC, \DEF, namespace\GHI +{ + var $a = 'foo'; + private $b = 'bar'; + static $c = 'baz'; + function test() + { + $this->a = 'bar'; + echo 'test'; + } + protected function baz() + { + } + public function foo() + { + } + static abstract function bar() + { + } +} +trait Bar +{ + function test() + { + } +} \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/code/prettyPrinter/stmt/const.test b/application/vendor/nikic/php-parser/test/code/prettyPrinter/stmt/const.test new file mode 100644 index 0000000..6b17642 --- /dev/null +++ b/application/vendor/nikic/php-parser/test/code/prettyPrinter/stmt/const.test @@ -0,0 +1,11 @@ +Constant declarations +----- + $val) { + +} + +foreach ($arr as $key => &$val) { + +} +----- +foreach ($arr as $val) { +} +foreach ($arr as &$val) { +} +foreach ($arr as $key => $val) { +} +foreach ($arr as $key => &$val) { +} \ No newline at end of file diff --git a/application/vendor/nikic/php-parser/test/code/prettyPrinter/function_signatures.test b/application/vendor/nikic/php-parser/test/code/prettyPrinter/stmt/function_signatures.test similarity index 100% rename from application/vendor/nikic/php-parser/test/code/prettyPrinter/function_signatures.test rename to application/vendor/nikic/php-parser/test/code/prettyPrinter/stmt/function_signatures.test diff --git a/application/vendor/nikic/php-parser/test/code/prettyPrinter/stmt/global_static_variables.test b/application/vendor/nikic/php-parser/test/code/prettyPrinter/stmt/global_static_variables.test new file mode 100644 index 0000000..eea776a --- /dev/null +++ b/application/vendor/nikic/php-parser/test/code/prettyPrinter/stmt/global_static_variables.test @@ -0,0 +1,11 @@ +Global and static variables +----- + 0) { - if (count($options) === 1 && $options[0] === '--no-progress') { - $SHOW_PROGRESS = false; +$showProgress = true; +$verbose = false; +foreach ($options as $option) { + if ($option === '--no-progress') { + $showProgress = false; + } elseif ($option === '--verbose') { + $verbose = true; } else { showHelp('Invalid option passed!'); } } -$TEST_TYPE = $arguments[0]; -$DIR = $arguments[1]; - -if ('Symfony' === $TEST_TYPE) { - function filter_func($path) { - return preg_match('~\.php(?:\.cache)?$~', $path) && false === strpos($path, 'skeleton'); - }; -} elseif ('PHP' === $TEST_TYPE) { - function filter_func($path) { - return preg_match('~\.phpt$~', $path); - }; -} else { - showHelp('Test type must be either "Symfony" or "PHP"!'); +$testType = $arguments[0]; +$dir = $arguments[1]; + +switch ($testType) { + case 'Symfony': + $version = 'Php5'; + $fileFilter = function($path) { + return preg_match('~\.php(?:\.cache)?$~', $path) && false === strpos($path, 'skeleton'); + }; + $codeExtractor = function($file, $code) { + return $code; + }; + break; + case 'PHP5': + case 'PHP7': + $version = $testType === 'PHP5' ? 'Php5' : 'Php7'; + $fileFilter = function($path) { + return preg_match('~\.phpt$~', $path); + }; + $codeExtractor = function($file, $code) { + if (preg_match('~(?: +# skeleton files + ext.gmp.tests.001 +| ext.skeleton.tests.001 +# multibyte encoded files +| ext.mbstring.tests.zend_multibyte-01 +| Zend.tests.multibyte.multibyte_encoding_001 +| Zend.tests.multibyte.multibyte_encoding_004 +| Zend.tests.multibyte.multibyte_encoding_005 +# token_get_all bug (https://bugs.php.net/bug.php?id=60097) +| Zend.tests.bug47516 +# pretty print difference due to INF vs 1e1000 +| ext.standard.tests.general_functions.bug27678 +| tests.lang.bug24640 +# pretty print difference due to nop statements +| ext.mbstring.tests.htmlent +| ext.standard.tests.file.fread_basic +# tests using __halt_compiler as semi reserved keyword +| Zend.tests.grammar.semi_reserved_001 +| Zend.tests.grammar.semi_reserved_002 +| Zend.tests.grammar.semi_reserved_005 +)\.phpt$~x', $file)) { + return null; + } + + if (!preg_match('~--FILE--\s*(.*?)--[A-Z]+--~s', $code, $matches)) { + return null; + } + if (preg_match('~--EXPECT(?:F|REGEX)?--\s*(?:Parse|Fatal) error~', $code)) { + return null; + } + + return $matches[1]; + }; + break; + default: + showHelp('Test type must be one of: PHP5, PHP7 or Symfony'); } require_once dirname(__FILE__) . '/../lib/PhpParser/Autoloader.php'; PhpParser\Autoloader::register(); -$parser = new PhpParser\Parser(new PhpParser\Lexer\Emulative); +$parserName = 'PhpParser\Parser\\' . $version; +$parser = new $parserName(new PhpParser\Lexer\Emulative); $prettyPrinter = new PhpParser\PrettyPrinter\Standard; $nodeDumper = new PhpParser\NodeDumper; @@ -78,10 +127,10 @@ function filter_func($path) { $totalStartTime = microtime(true); foreach (new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($DIR), + new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if (!filter_func($file)) { + if (!$fileFilter($file)) { continue; } @@ -89,41 +138,16 @@ function filter_func($path) { $code = file_get_contents($file); $readTime += microtime(true) - $startTime; - if ('PHP' === $TEST_TYPE) { - if (preg_match('~(?: -# skeleton files - ext.gmp.tests.001 -| ext.skeleton.tests.001 -# multibyte encoded files -| ext.mbstring.tests.zend_multibyte-01 -| Zend.tests.multibyte.multibyte_encoding_001 -| Zend.tests.multibyte.multibyte_encoding_004 -| Zend.tests.multibyte.multibyte_encoding_005 -# token_get_all bug (https://bugs.php.net/bug.php?id=60097) -| Zend.tests.bug47516 -# pretty print difference due to INF vs 1e1000 -| ext.standard.tests.general_functions.bug27678 -| tests.lang.bug24640 -)\.phpt$~x', $file)) { - continue; - } - - if (!preg_match('~--FILE--\s*(.*?)--[A-Z]+--~s', $code, $matches)) { - continue; - } - if (preg_match('~--EXPECT(?:F|REGEX)?--\s*(?:Parse|Fatal) error~', $code)) { - continue; - } - - $code = $matches[1]; + if (null === $code = $codeExtractor($file, $code)) { + continue; } set_time_limit(10); ++$count; - if ($SHOW_PROGRESS) { - echo substr(str_pad('Testing file ' . $count . ': ' . substr($file, strlen($DIR)), 79), 0, 79), "\r"; + if ($showProgress) { + echo substr(str_pad('Testing file ' . $count . ': ' . substr($file, strlen($dir)), 79), 0, 79), "\r"; } try { @@ -146,11 +170,17 @@ function filter_func($path) { if (!$same) { echo $file, ":\n Result of initial parse and parse after pretty print differ\n"; + if ($verbose) { + echo "Pretty printer output:\n=====\n$code\n=====\n\n"; + } ++$compareFail; } } catch (PhpParser\Error $e) { echo $file, ":\n Parse of pretty print failed with message: {$e->getMessage()}\n"; + if ($verbose) { + echo "Pretty printer output:\n=====\n$code\n=====\n\n"; + } ++$ppFail; } @@ -162,8 +192,10 @@ function filter_func($path) { } if (0 === $parseFail && 0 === $ppFail && 0 === $compareFail) { + $exit = 0; echo "\n\n", 'All tests passed.', "\n"; } else { + $exit = 1; echo "\n\n", '==========', "\n\n", 'There were: ', "\n"; if (0 !== $parseFail) { echo ' ', $parseFail, ' parse failures.', "\n"; @@ -186,4 +218,6 @@ function filter_func($path) { 'Comparing took: ', $compareTime, "\n", "\n", 'Total time: ', microtime(true) - $totalStartTime, "\n", - 'Maximum memory usage: ', memory_get_peak_usage(true), "\n"; \ No newline at end of file + 'Maximum memory usage: ', memory_get_peak_usage(true), "\n"; + +exit($exit); diff --git a/application/vendor/paragonie/random_compat/CHANGELOG.md b/application/vendor/paragonie/random_compat/CHANGELOG.md new file mode 100644 index 0000000..56d5a7c --- /dev/null +++ b/application/vendor/paragonie/random_compat/CHANGELOG.md @@ -0,0 +1,290 @@ +### Version 1.4.3 - 2018-04-04 + +* Fix version number in constant in lib/random.php +* Upgrade your dependency from `^1` to `^1|^2` if you want other + changes (i.e. better compatibility with type-safety), because the + v2 branch is where most of the development effort is focused. + Continued support for v1.x is considered "only for emergencies". + +### Version 1.4.2 - 2017-03-13 + +* Backport changes from version 2: + * Version 2.0.9 - 2017-03-03 + * More Psalm integration fixes. + * Version 2.0.8 - 2017-03-03 + * Prevent function already declared error for `random_int()` caused by misusing + the library (really you should only ever include `lib/random.php` and never any + of the other files). See [#125](https://github.com/paragonie/random_compat/issues/125). + * Version 2.0.6, 2.0.7 - 2017-02-27 + * Just updates to psalm.xml to silence false positives. + * Version 2.0.5 - 2017-02-27 + * Run random_compat through the static analysis tool, [psalm](https://github.com/vimeo/psalm), + as part of our continuous integration process. + * Minor readability enhancements ([#122](https://github.com/paragonie/random_compat/issues/122) + and several docblock changes). + * Version 2.0.4 - 2016-11-07 + * Don't unnecessarily prevent `mcrypt_create_iv()` from being used. + See [#111](https://github.com/paragonie/random_compat/issues/111). + * Version 2.0.3 - 2016-10-17 + * Updated `lib/error_polyfill.php` [to resolve corner cases](https://github.com/paragonie/random_compat/issues/104). + * The README was updated to help users troubleshoot and fix insecure environments. + * Tags will now be signed by [the GnuPG key used by the security team at Paragon Initiative Enterprises, LLC](https://paragonie.com/static/gpg-public-key.txt). + * Version 2.0.2 - 2016-04-03 + * Added a consistency check (discovered by Taylor Hornby in his + [PHP encryption library](https://github.com/defuse/php-encryption)). It + wasn't likely causing any trouble for us. + +### Version 1.4.1 - 2016-03-18 + +Update comment in random.php + +### Version 1.4.0 - 2016-03-18 + +Restored OpenSSL in the version 1 branch in preparation to remove +OpenSSL in version 2. + +### Version 1.3.1/1.2.3 - 2016-03-18 + +* Add more possible values to `open_baseir` check. + +### Version 1.3.0 - 2016-03-17 + +* Removed `openssl_random_pseudo_bytes()` entirely. If you are using + random_compat in PHP on a Unix-like OS but cannot access + `/dev/urandom`, version 1.3+ will throw an `Exception`. If you want to + trust OpenSSL, feel free to write your own fallback code. e.g. + + ```php + try { + $bytes = random_bytes(32); + } catch (Exception $ex) { + $strong = false; + $bytes = openssl_random_pseudo_bytes(32, $strong); + if (!$strong) { + throw $ex; + } + } + ``` + +### Version 1.2.2 - 2016-03-11 + +* To prevent applications from hanging, if `/dev/urandom` is not + accessible to PHP, skip mcrypt (which just fails before giving OpenSSL + a chance and was morally equivalent to not offering OpenSSL at all). + +### Version 1.2.1 - 2016-02-29 + +* PHP 5.6.10 - 5.6.12 will hang when mcrypt is used on Unix-based operating + systems ([PHP bug 69833](https://bugs.php.net/bug.php?id=69833)). If you are + running one of these versions, please upgrade (or make sure `/dev/urandom` is + readable) otherwise you're relying on OpenSSL. + +### Version 1.2.0 - 2016-02-05 + +* Whitespace and other cosmetic changes +* Added a changelog. +* We now ship with a command line utility to build a PHP Archive from the + command line. + + Every time we publish a new release, we will also upload a .phar + to Github. Our public key is signed by our GPG key. + +### Version 1.1.6 - 2016-01-29 + +* Eliminate `open_basedir` warnings by detecting this configuration setting. + (Thanks [@oucil](https://github.com/oucil) for reporting this.) +* Added install instructions to the README. +* Documentation cleanup (there is, in fact, no `MCRYPT_CREATE_IV` constant, I + meant to write `MCRYPT_DEV_URANDOM`) + +### Version 1.1.5 - 2016-01-06 + +Prevent fatal errors on platforms with older versions of libsodium. + +### Version 1.1.4 - 2015-12-10 + +Thanks [@narfbg](https://github.com/narfbg) for [critiquing the previous patch](https://github.com/paragonie/random_compat/issues/79#issuecomment-163590589) +and suggesting a fix. + +### Version 1.1.3 - 2015-12-09 + +The test for COM in disabled_classes is now case-insensitive. + +### Version 1.1.2 - 2015-12-09 + +Don't instantiate COM if it's a disabled class. Removes the E_WARNING on Windows. + +### Version 1.1.1 - 2015-11-30 + +Fix a performance issue with `/dev/urandom` buffering. + +### Version 1.1.0 - 2015-11-09 + +Fix performance issues with ancient versions of PHP on Windows, but dropped +support for PHP < 5.4.1 without mcrypt on Windows 7+ in the process. Since this + is a BC break, semver dictates a minor version bump. + +### Version 1.0.10 - 2015-10-23 + +* Avoid a performance killer with OpenSSL on Windows PHP 5.3.0 - 5.3.3 that was + affecting [WordPress users](https://core.trac.wordpress.org/ticket/34409). +* Use `$var = null` instead of `unset($var)` to avoid triggering the garbage + collector and slowing things down. + +### Version 1.0.9 - 2015-10-20 + +There is an outstanding issue `mcrypt_create_iv()` and PHP 7's `random_bytes()` +on Windows reported by [@nicolas-grekas](https://github.com/nicolas-grekas) caused by `proc_open()` and environment +variable handling (discovered by Appveyor when developing Symfony). + +Since the break is consistent, it's not our responsibility to fix it, but we +should fail the same way PHP 7 will (i.e. throw an `Exception` rather than raise +an error and then throw an `Exception`). + +### Version 1.0.8 - 2015-10-18 + +* Fix usability issues with Windows (`new COM('CAPICOM.Utilities.1')` is not + always available). +* You can now test all the possible drivers by running `phpunit.sh each` in the + `tests` directory. + +### Version 1.0.7 - 2015-10-16 + +Several large integer handling bugfixes were contributed by [@oittaa](https://github.com/oittaa). + +### Version 1.0.6 - 2015-10-15 + +Don't let the version number fool you, this was a pretty significant change. + +1. Added support for ext-libsodium, if it exists on the system. This is morally + equivalent to adding `getrandom(2)` support without having to expose the + syscall interface in PHP-land. +2. Relaxed open_basedir restrictions. In previous versions, if open_basedir was + set, PHP wouldn't even try to read from `/dev/urandom`. Now it will still do + so if you can. +3. Fixed integer casting inconsistencies between random_compat and PHP 7. +4. Handle edge cases where an integer overflow turns one of the parameters into + a float. + +One change that we discussed was making `random_bytes()` and `random_int()` +strict typed; meaning you could *only* pass integers to either function. While +most veteran programmers are probably only doing this already (we strongly +encourage it), it wouldn't be consistent with how these functions behave in PHP +7. Please use these functions responsibly. + +We've had even more of the PHP community involved in this release; the +contributors list has been updated. If I forgot anybody, I promise you it's not +because your contributions (either code or ideas) aren't valued, it's because +I'm a bit overloaded with information at the moment. Please let me know +immediately and I will correct my oversight. + +Thanks everyone for helping make random_compat better. + +### Version 1.0.5 - 2015-10-08 + +Got rid of the methods in the `Throwable` interface, which was causing problems +on PHP 5.2. While we would normally not care about 5.2 (since [5.4 and earlier are EOL'd](https://secure.php.net/supported-versions.php)), +we do want to encourage widespread adoption (e.g. [Wordpress](https://core.trac.wordpress.org/ticket/28633)). + +### Version 1.0.4 - 2015-10-02 + +Removed redundant `if()` checks, since `lib/random.php` is the entrypoint people +should use. + +### Version 1.0.3 - 2015-10-02 + +This release contains bug fixes contributed by the community. + +* Avoid a PHP Notice when PHP is running without the mbstring extension +* Use a compatible version of PHPUnit for testing on older versions of PHP + +Although none of these bugs were outright security-affecting, updating ASAP is +still strongly encouraged. + +### Version 1.0.2 - 2015-09-23 + +Less strict input validation on `random_int()` parameters. PHP 7's `random_int()` +accepts strings and floats that look like numbers, so we should too. + +Thanks [@dd32](https://github.com/@dd32) for correcting this oversight. + +### Version 1.0.1 - 2015-09-10 + +Instead of throwing an Exception immediately on insecure platforms, only do so +when `random_bytes()` is invoked. + +### Version 1.0.0 - 2015-09-07 + +Our API is now stable and forward-compatible with the CSPRNG features in PHP 7 +(as of 7.0.0 RC3). + +A lot of great people have contributed their time and expertise to make this +compatibility library possible. That this library has reached a stable release +is more a reflection on the community than it is on PIE. + +We are confident that random_compat will serve as the simplest and most secure +CSPRNG interface available for PHP5 projects. + +### Version 0.9.7 (pre-release) - 2015-09-01 + +An attempt to achieve compatibility with Error/TypeError in the RFC. + +This should be identical to 1.0.0 sans any last-minute changes or performance enhancements. + +### Version 0.9.6 (pre-release) - 2015-08-06 + +* Split the implementations into their own file (for ease of auditing) +* Corrected the file type check after `/dev/urandom` has been opened (thanks + [@narfbg](https://github.com/narfbg) and [@jedisct1](https://github.com/jedisct1)) + +### Version 0.9.5 (pre-release) - 2015-07-31 + +* Validate that `/dev/urandom` is a character device + * Reported by [@lokdnet](https://twitter.com/lokdnet) + * Investigated by [@narfbg](https://github.com/narfbg) and [frymaster](http://stackoverflow.com/users/1226810/frymaster) on [StackOverflow](http://stackoverflow.com/q/31631066/2224584) +* Remove support for `/dev/arandom` which is an old OpenBSD feature, thanks [@jedisct1](https://github.com/jedisct1) +* Prevent race conditions on the `filetype()` check, thanks [@jedisct1](https://github.com/jedisct1) +* Buffer file reads to 8 bytes (performance optimization; PHP defaults to 8192 bytes) + +### Version 0.9.4 (pre-release) - 2015-07-27 + +* Add logic to verify that `/dev/arandom` and `/dev/urandom` are actually devices. +* Some clean-up in the comments + +### Version 0.9.3 (pre-release) - 2015-07-22 + +Unless the Exceptions change to PHP 7 fails, this should be the last pre-release +version. If need be, we'll make one more pre-release version with compatible +behavior. + +Changes since 0.9.2: + +* Prioritize `/dev/arandom` and `/dev/urandom` over mcrypt. +[@oittaa](https://github.com/oittaa) removed the -1 and +1 juggling on `$range` calculations for `random_int()` +* Whitespace and comment clean-up, plus better variable names +* Actually put a description in the composer.json file... + +### Version 0.9.2 (pre-release) - 2015-07-16 + +* Consolidated `$range > PHP_INT_MAX` logic with `$range <= PHP_INT_MAX` (thanks + [@oittaa](https://github.com/oittaa) and [@CodesInChaos](https://github.com/CodesInChaos)) +* `tests/phpunit.sh` now also runs the tests with `mbstring.func_overload` and + `open_basedir` +* Style consistency, whitespace cleanup, more meaningful variable names + +### Version 0.9.1 (pre-release) - 2015-07-09 + +* Return random values on integer ranges > `PHP_INT_MAX` (thanks [@CodesInChaos](https://github.com/CodesInChaos)) +* Determined CSPRNG preference: + 1. `mcrypt_create_iv()` with `MCRYPT_DEV_URANDOM` + 2. `/dev/arandom` + 3. `/dev/urandom` + 4. `openssl_random_pseudo_bytes()` +* Optimized backend selection (thanks [@lt](https://github.com/lt)) +* Fix #3 (thanks [@scottchiefbaker](https://github.com/scottchiefbaker)) + +### Version 0.9.0 (pre-release) - 2015-07-07 + +This should be a sane polyfill for PHP 7's `random_bytes()` and `random_int()`. +We hesitate to call it production ready until it has received sufficient third +party review. \ No newline at end of file diff --git a/application/vendor/paragonie/random_compat/LICENSE b/application/vendor/paragonie/random_compat/LICENSE new file mode 100644 index 0000000..45c7017 --- /dev/null +++ b/application/vendor/paragonie/random_compat/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Paragon Initiative Enterprises + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/application/vendor/paragonie/random_compat/RATIONALE.md b/application/vendor/paragonie/random_compat/RATIONALE.md new file mode 100644 index 0000000..a6e7307 --- /dev/null +++ b/application/vendor/paragonie/random_compat/RATIONALE.md @@ -0,0 +1,42 @@ +## Rationale (Design Decisions) + +### Reasoning Behind the Order of Preferred Random Data Sources + +The order is: + + 1. `libsodium if available` + 2. `fread() /dev/urandom if available` + 3. `mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM)` + 4. `COM('CAPICOM.Utilities.1')->GetRandom()` + 5. `openssl_random_pseudo_bytes()` + +If libsodium is available, we get random data from it. This is the preferred +method on all OSes, but libsodium is not very widely installed, so other +fallbacks are available. + +Next, we read `/dev/urandom` (if it exists). This is the preferred file to read +for random data for cryptographic purposes for BSD and Linux. This step +is skipped on Windows, because someone could create a `C:\dev\urandom` +file and PHP would helpfully (but insecurely) return bytes from it. + +Despite [strongly urging people not to use mcrypt in their projects](https://paragonie.com/blog/2015/05/if-you-re-typing-word-mcrypt-into-your-code-you-re-doing-it-wrong) +(because libmcrypt is abandonware and the API puts too much responsibility on the +implementor) we prioritize `mcrypt_create_iv()` with `MCRYPT_DEV_URANDOM` above +the remaining implementations. + +The reason is simple: `mcrypt_create_iv()` is part of PHP's `ext/mcrypt` code, +and is not part `libmcrypt`. It actually does the right thing: + + * On Unix-based operating systems, it reads from `/dev/urandom` which + (unlike `/dev/random`) is the sane and correct thing to do. + * On Windows, it reads from `CryptGenRandom`, which is an exclusively Windows + way to get random bytes. + +If we're on Windows and don't have access to `mcrypt`, we use `CAPICOM.Utilities.1`. + +Finally, we use `openssl_random_pseudo_bytes()` **as a last resort**, due to +[PHP bug #70014](https://bugs.php.net/bug.php?id=70014). Internally, this +function calls `RAND_pseudo_bytes()`, which has been [deprecated](https://github.com/paragonie/random_compat/issues/5) +by the OpenSSL team. Furthermore, [it might silently return weak random data](https://github.com/paragonie/random_compat/issues/6#issuecomment-119564973) +if it is called before OpenSSL's **userspace** CSPRNG is seeded. Also, +[you want the OS CSPRNG, not a userspace CSPRNG](http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/). diff --git a/application/vendor/paragonie/random_compat/README.md b/application/vendor/paragonie/random_compat/README.md new file mode 100644 index 0000000..63c6d71 --- /dev/null +++ b/application/vendor/paragonie/random_compat/README.md @@ -0,0 +1,176 @@ +# random_compat + +[![Build Status](https://travis-ci.org/paragonie/random_compat.svg?branch=v1.x)](https://travis-ci.org/paragonie/random_compat) +[![Scrutinizer](https://scrutinizer-ci.com/g/paragonie/random_compat/badges/quality-score.png?b=v1.x)](https://scrutinizer-ci.com/g/paragonie/random_compat) + +PHP 5.x polyfill for `random_bytes()` and `random_int()` created and maintained +by [Paragon Initiative Enterprises](https://paragonie.com). + +Although this library *should* function in earlier versions of PHP, we will only +consider issues relevant to [supported PHP versions](https://secure.php.net/supported-versions.php). +**If you are using an unsupported version of PHP, please upgrade as soon as possible.** + +## Important + +Although this library has been examined by some security experts in the PHP +community, there will always be a chance that we overlooked something. Please +ask your favorite trusted hackers to hammer it for implementation errors and +bugs before even thinking about deploying it in production. + +**Do not use the master branch, use a [stable release](https://github.com/paragonie/random_compat/releases/latest).** + +For the background of this library, please refer to our blog post on +[Generating Random Integers and Strings in PHP](https://paragonie.com/blog/2015/07/how-safely-generate-random-strings-and-integers-in-php). + +### Usability Notice + +If PHP cannot safely generate random data, this library will throw an `Exception`. +It will never fall back to insecure random data. If this keeps happening, upgrade +to a newer version of PHP immediately. + +## Installing + +**With [Composer](https://getcomposer.org):** + + composer require paragonie/random_compat + +**Signed PHP Archive:** + +As of version 1.2.0, we also ship an ECDSA-signed PHP Archive with each stable +release on Github. + +1. Download [the `.phar`, `.phar.pubkey`, and `.phar.pubkey.asc`](https://github.com/paragonie/random_compat/releases/latest) files. +2. (**Recommended** but not required) Verify the PGP signature of `.phar.pubkey` + (contained within the `.asc` file) using the [PGP public key for Paragon Initiative Enterprises](https://paragonie.com/static/gpg-public-key.txt). +3. Extract both `.phar` and `.phar.pubkey` files to the same directory. +4. `require_once "/path/to/random_compat.phar";` +5. When a new version is released, you only need to replace the `.phar` file; + the `.pubkey` will not change (unless our signing key is ever compromised). + +**Manual Installation:** + +1. Download [a stable release](https://github.com/paragonie/random_compat/releases/latest). +2. Extract the files into your project. +3. `require_once "/path/to/random_compat/lib/random.php";` + +## Usage + +This library exposes the [CSPRNG functions added in PHP 7](https://secure.php.net/manual/en/ref.csprng.php) +for use in PHP 5 projects. Their behavior should be identical. + +### Generate a string of random bytes + +```php +try { + $string = random_bytes(32); +} catch (TypeError $e) { + // Well, it's an integer, so this IS unexpected. + die("An unexpected error has occurred"); +} catch (Error $e) { + // This is also unexpected because 32 is a reasonable integer. + die("An unexpected error has occurred"); +} catch (Exception $e) { + // If you get this message, the CSPRNG failed hard. + die("Could not generate a random string. Is our OS secure?"); +} + +var_dump(bin2hex($string)); +// string(64) "5787c41ae124b3b9363b7825104f8bc8cf27c4c3036573e5f0d4a91ad2eeac6f" +``` + +### Generate a random integer between two given integers (inclusive) + +```php +try { + $int = random_int(0,255); + +} catch (TypeError $e) { + // Well, it's an integer, so this IS unexpected. + die("An unexpected error has occurred"); +} catch (Error $e) { + // This is also unexpected because 0 and 255 are both reasonable integers. + die("An unexpected error has occurred"); +} catch (Exception $e) { + // If you get this message, the CSPRNG failed hard. + die("Could not generate a random string. Is our OS secure?"); +} + +var_dump($int); +// int(47) +``` + +### Exception handling + +When handling exceptions and errors you must account for differences between +PHP 5 and PHP7. + +The differences: + +* Catching `Error` works, so long as it is caught before `Exception`. +* Catching `Exception` has different behavior, without previously catching `Error`. +* There is *no* portable way to catch all errors/exceptions. + +#### Our recommendation + +**Always** catch `Error` before `Exception`. + +#### Example + +```php +try { + return random_int(1, $userInput); +} catch (TypeError $e) { + // This is okay, so long as `Error` is caught before `Exception`. + throw new Exception('Please enter a number!'); +} catch (Error $e) { + // This is required, if you do not need to do anything just rethrow. + throw $e; +} catch (Exception $e) { + // This is optional and maybe omitted if you do not want to handle errors + // during generation. + throw new InternalServerErrorException( + 'Oops, our server is bust and cannot generate any random data.', + 500, + $e + ); +} +``` + +## Contributors + +This project would not be anywhere near as excellent as it is today if it +weren't for the contributions of the following individuals: + +* [@AndrewCarterUK (Andrew Carter)](https://github.com/AndrewCarterUK) +* [@asgrim (James Titcumb)](https://github.com/asgrim) +* [@bcremer (Benjamin Cremer)](https://github.com/bcremer) +* [@CodesInChaos (Christian Winnerlein)](https://github.com/CodesInChaos) +* [@chriscct7 (Chris Christoff)](https://github.com/chriscct7) +* [@cs278 (Chris Smith)](https://github.com/cs278) +* [@cweagans (Cameron Eagans)](https://github.com/cweagans) +* [@dd32 (Dion Hulse)](https://github.com/dd32) +* [@geggleto (Glenn Eggleton)](https://github.com/geggleto) +* [@ircmaxell (Anthony Ferrara)](https://github.com/ircmaxell) +* [@jedisct1 (Frank Denis)](https://github.com/jedisct1) +* [@juliangut (Julián Gutiérrez)](https://github.com/juliangut) +* [@kelunik (Niklas Keller)](https://github.com/kelunik) +* [@lt (Leigh)](https://github.com/lt) +* [@MasonM (Mason Malone)](https://github.com/MasonM) +* [@mmeyer2k (Michael M)](https://github.com/mmeyer2k) +* [@narfbg (Andrey Andreev)](https://github.com/narfbg) +* [@nicolas-grekas (Nicolas Grekas)](https://github.com/nicolas-grekas) +* [@oittaa](https://github.com/oittaa) +* [@oucil (Kevin Farley)](https://github.com/oucil) +* [@redragonx (Stephen Chavez)](https://github.com/redragonx) +* [@rchouinard (Ryan Chouinard)](https://github.com/rchouinard) +* [@SammyK (Sammy Kaye Powers)](https://github.com/SammyK) +* [@scottchiefbaker (Scott Baker)](https://github.com/scottchiefbaker) +* [@skyosev (Stoyan Kyosev)](https://github.com/skyosev) +* [@stof (Christophe Coevoet)](https://github.com/stof) +* [@teohhanhui (Teoh Han Hui)](https://github.com/teohhanhui) +* [@tom-- (Tom Worster)](https://github.com/tom--) +* [@tsyr2ko](https://github.com/tsyr2ko) +* [@trowski (Aaron Piotrowski)](https://github.com/trowski) +* [@twistor (Chris Lepannen)](https://github.com/twistor) +* [@voku (Lars Moelleken)](https://github.com/voku) +* [@xabbuh (Christian Flothmann)](https://github.com/xabbuh) diff --git a/application/vendor/paragonie/random_compat/SECURITY.md b/application/vendor/paragonie/random_compat/SECURITY.md new file mode 100644 index 0000000..8f731b3 --- /dev/null +++ b/application/vendor/paragonie/random_compat/SECURITY.md @@ -0,0 +1,108 @@ +# An Invitation to Security Researchers + +Every company says they take security "very seriously." Rather than bore anyone +with banal boilerplate, here are some quick answers followed by detailed +elaboration. If you have any questions about our policies, please email them to +`scott@paragonie.com`. + +## Quick Answers + +* There is no compulsion to disclose vulnerabilities privately, but we + appreciate a head's up. +* `security@paragonie.com` will get your reports to the right person. Our GPG + fingerprint, should you decide to encrypt your report, is + `7F52 D5C6 1D12 55C7 3136 2E82 6B97 A1C2 8264 04DA`. + +* **YES**, we will reward security researchers who disclose vulnerabilities in + our software. +* In most cases, **No Proof-of-Concept Required.** + +## How to Report a Security Bug to Paragon Initiative Enterprises + +### There is no compulsion to disclose privately. + +We believe vulnerability disclosure style is a personal choice and enjoy working +with a diverse community. We understand and appreciate the importance of Full +Disclosure in the history and practice of security research. + +We would *like* to know about high-severity bugs before they become public +knowledge, so we can fix them in a timely manner, but **we do not believe in +threatening researchers or trying to enforce vulnerability embargoes**. + +Ultimately, if you discover a security-affecting vulnerability, what you do with +it is your choice. We would like to work with people, and to celebrate and +reward their skill, experience, and dedication. We appreciate being informed of +our mistakes so we can learn from them and build a better product. Our goal is +to empower the community. + +### Where to Send Security Vulnerabilities + +Our security email address is `security@paragonie.com`. Also feel free to open a +new issue on Github if you want to disclose publicly. + +``` +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG + +mQENBFUgwRUBCADcIpqNwyYc5UmY/tpx1sF/rQ3knR1YNXYZThzFV+Gmqhp1fDH5 +qBs9foh1xwI6O7knWmQngnf/nBumI3x6xj7PuOdEZUh2FwCG/VWnglW8rKmoHzHA +ivjiu9SLnPIPAgHSHeh2XD7q3Ndm3nenbjAiRFNl2iXcwA2cTQp9Mmfw9vVcw0G0 +z1o0G3s8cC8ZS6flFySIervvfSRWj7A1acI5eE3+AH/qXJRdEJ+9J8OB65p1JMfk +6+fWgOB1XZxMpz70S0rW6IX38WDSRhEK2fXyZJAJjyt+YGuzjZySNSoQR/V6vNYn +syrNPCJ2i5CgZQxAkyBBcr7koV9RIhPRzct/ABEBAAG0IVNlY3VyaXR5IDxzZWN1 +cml0eUBwYXJhZ29uaWUuY29tPokBOQQTAQIAIwUCVSDBFQIbAwcLCQgHAwIBBhUI +AgkKCwQWAgMBAh4BAheAAAoJEGuXocKCZATat2YIAIoejNFEQ2c1iaOEtSuB7Pn/ +WLbsDsHNLDKOV+UnfaCjv/vL7D+5NMChFCi2frde/NQb2TsjqmIH+V+XbnJtlrXD +Vj7yvMVal+Jqjwj7v4eOEWcKVcFZk+9cfUgh7t92T2BMX58RpgZF0IQZ6Z1R3FfC +9Ub4X6ykW+te1q0/4CoRycniwmlQi6iGSr99LQ5pfJq2Qlmz/luTZ0UX0h575T7d +cp2T1sX/zFRk/fHeANWSksipdDBjAXR7NMnYZgw2HghEdFk/xRDY7K1NRWNZBf05 +WrMHmh6AIVJiWZvI175URxEe268hh+wThBhXQHMhFNJM1qPIuzb4WogxM3UUD7m5 +AQ0EVSDBFQEIALNkpzSuJsHAHh79sc0AYWztdUe2MzyofQbbOnOCpWZebYsC3EXU +335fIg59k0m6f+O7GmEZzzIv5v0i99GS1R8CJm6FvhGqtH8ZqmOGbc71WdJSiNVE +0kpQoJlVzRbig6ZyyjzrggbM1eh5OXOk5pw4+23FFEdw7JWU0HJS2o71r1hwp05Z +vy21kcUEobz/WWQQyGS0Neo7PJn+9KS6wOxXul/UE0jct/5f7KLMdWMJ1VgniQmm +hjvkHLPSICteqCI04RfcmMseW9gueHQXeUu1SNIvsWa2MhxjeBej3pDnrZWszKwy +gF45GO9/v4tkIXNMy5J1AtOyRgQ3IUMqp8EAEQEAAYkBHwQYAQIACQUCVSDBFQIb +DAAKCRBrl6HCgmQE2jnIB/4/xFz8InpM7eybnBOAir3uGcYfs3DOmaKn7qWVtGzv +rKpQPYnVtlU2i6Z5UO4c4jDLT/8Xm1UDz3Lxvqt4xCaDwJvBZexU5BMK8l5DvOzH +6o6P2L1UDu6BvmPXpVZz7/qUhOnyf8VQg/dAtYF4/ax19giNUpI5j5o5mX5w80Rx +qSXV9NdSL4fdjeG1g/xXv2luhoV53T1bsycI3wjk/x5tV+M2KVhZBvvuOm/zhJje +oLWp0saaESkGXIXqurj6gZoujJvSvzl0n9F9VwqMEizDUfrXgtD1siQGhP0sVC6q +ha+F/SAEJ0jEquM4TfKWWU2S5V5vgPPpIQSYRnhQW4b1 +=xJPW +-----END PGP PUBLIC KEY BLOCK----- +``` + +### We Will Reward Security Researchers + +**This process has not been formalized; nor have dollar amounts been +discussed.** + +However, if you report a valid security-affecting bug, we will compensate you +for the time spent finding the vulnerability and reward you for being a good +neighbor. + +#### What does a "valid" bug mean? + +There are two sides to this: + +1. Some have spammed projects with invalid bug reports hoping to collect + bounties for pressing a button and running an automated analysis tool. This + is not cool. +2. There is a potential for the developers of a project to declare all security + bug reports as invalid to save money. + +Our team members have an established history of reporting vulnerabilities to +large open source projects. **We aren't in the business of ripping people off.** +When in doubt, our policy is to err on the side of generosity. + +### No Proof-of-Concept Required + +We might ask for one if we feel we do not understand some of the details +pertaining to a specific vulnerability. We certainly appreciate them if you +include them in your report, but we believe **the burden lies with the developer +to prove their software *is* secure** rather than with the researcher to prove +that it isn't. + +In our experience, most bugs are simpler to fix than they are to exploit. + diff --git a/application/vendor/paragonie/random_compat/build-phar.sh b/application/vendor/paragonie/random_compat/build-phar.sh new file mode 100644 index 0000000..b4a5ba3 --- /dev/null +++ b/application/vendor/paragonie/random_compat/build-phar.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +basedir=$( dirname $( readlink -f ${BASH_SOURCE[0]} ) ) + +php -dphar.readonly=0 "$basedir/other/build_phar.php" $* \ No newline at end of file diff --git a/application/vendor/paragonie/random_compat/composer.json b/application/vendor/paragonie/random_compat/composer.json new file mode 100644 index 0000000..d363f4c --- /dev/null +++ b/application/vendor/paragonie/random_compat/composer.json @@ -0,0 +1,35 @@ +{ + "name": "paragonie/random_compat", + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "random", + "pseudorandom" + ], + "license": "MIT", + "type": "library", + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "support": { + "issues": "https://github.com/paragonie/random_compat/issues", + "email": "info@paragonie.com", + "source": "https://github.com/paragonie/random_compat" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "autoload": { + "files": ["lib/random.php"] + } +} diff --git a/application/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey b/application/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey new file mode 100644 index 0000000..eb50ebf --- /dev/null +++ b/application/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey @@ -0,0 +1,5 @@ +-----BEGIN PUBLIC KEY----- +MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEEd+wCqJDrx5B4OldM0dQE0ZMX+lx1ZWm +pui0SUqD4G29L3NGsz9UhJ/0HjBdbnkhIK5xviT0X5vtjacF6ajgcCArbTB+ds+p ++h7Q084NuSuIpNb6YPfoUFgC/CL9kAoc +-----END PUBLIC KEY----- diff --git a/application/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc b/application/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc new file mode 100644 index 0000000..6a1d7f3 --- /dev/null +++ b/application/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc @@ -0,0 +1,11 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.22 (MingW32) + +iQEcBAABAgAGBQJWtW1hAAoJEGuXocKCZATaJf0H+wbZGgskK1dcRTsuVJl9IWip +QwGw/qIKI280SD6/ckoUMxKDCJiFuPR14zmqnS36k7N5UNPnpdTJTS8T11jttSpg +1LCmgpbEIpgaTah+cELDqFCav99fS+bEiAL5lWDAHBTE/XPjGVCqeehyPYref4IW +NDBIEsvnHPHPLsn6X5jq4+Yj5oUixgxaMPiR+bcO4Sh+RzOVB6i2D0upWfRXBFXA +NNnsg9/zjvoC7ZW73y9uSH+dPJTt/Vgfeiv52/v41XliyzbUyLalf02GNPY+9goV +JHG1ulEEBJOCiUD9cE1PUIJwHA/HqyhHIvV350YoEFiHl8iSwm7SiZu5kPjaq74= +=B6+8 +-----END PGP SIGNATURE----- diff --git a/application/vendor/paragonie/random_compat/lib/byte_safe_strings.php b/application/vendor/paragonie/random_compat/lib/byte_safe_strings.php new file mode 100644 index 0000000..6de294f --- /dev/null +++ b/application/vendor/paragonie/random_compat/lib/byte_safe_strings.php @@ -0,0 +1,181 @@ + RandomCompat_strlen($binary_string)) { + return ''; + } + + return (string) mb_substr($binary_string, $start, $length, '8bit'); + } + + } else { + + /** + * substr() implementation that isn't brittle to mbstring.func_overload + * + * This version just uses the default substr() + * + * @param string $binary_string + * @param int $start + * @param int $length (optional) + * + * @throws TypeError + * + * @return string + */ + function RandomCompat_substr($binary_string, $start, $length = null) + { + if (!is_string($binary_string)) { + throw new TypeError( + 'RandomCompat_substr(): First argument should be a string' + ); + } + + if (!is_int($start)) { + throw new TypeError( + 'RandomCompat_substr(): Second argument should be an integer' + ); + } + + if ($length !== null) { + if (!is_int($length)) { + throw new TypeError( + 'RandomCompat_substr(): Third argument should be an integer, or omitted' + ); + } + + return (string) substr($binary_string, $start, $length); + } + + return (string) substr($binary_string, $start); + } + } +} diff --git a/application/vendor/paragonie/random_compat/lib/cast_to_int.php b/application/vendor/paragonie/random_compat/lib/cast_to_int.php new file mode 100644 index 0000000..dc4048c --- /dev/null +++ b/application/vendor/paragonie/random_compat/lib/cast_to_int.php @@ -0,0 +1,74 @@ + operators might accidentally let a float + * through. + * + * @param int|float $number The number we want to convert to an int + * @param boolean $fail_open Set to true to not throw an exception + * + * @return float|int + * + * @throws TypeError + */ + function RandomCompat_intval($number, $fail_open = false) + { + if (is_int($number) || is_float($number)) { + $number += 0; + } elseif (is_numeric($number)) { + $number += 0; + } + + if ( + is_float($number) + && + $number > ~PHP_INT_MAX + && + $number < PHP_INT_MAX + ) { + $number = (int) $number; + } + + if (is_int($number)) { + return (int) $number; + } elseif (!$fail_open) { + throw new TypeError( + 'Expected an integer.' + ); + } + return $number; + } +} diff --git a/application/vendor/paragonie/random_compat/lib/error_polyfill.php b/application/vendor/paragonie/random_compat/lib/error_polyfill.php new file mode 100644 index 0000000..17ece7b --- /dev/null +++ b/application/vendor/paragonie/random_compat/lib/error_polyfill.php @@ -0,0 +1,49 @@ += 70000) { + return; +} + +if (!defined('RANDOM_COMPAT_READ_BUFFER')) { + define('RANDOM_COMPAT_READ_BUFFER', 8); +} + +$RandomCompatDIR = dirname(__FILE__); + +require_once $RandomCompatDIR . '/byte_safe_strings.php'; +require_once $RandomCompatDIR . '/cast_to_int.php'; +require_once $RandomCompatDIR . '/error_polyfill.php'; + +if (!is_callable('random_bytes')) { + /** + * PHP 5.2.0 - 5.6.x way to implement random_bytes() + * + * We use conditional statements here to define the function in accordance + * to the operating environment. It's a micro-optimization. + * + * In order of preference: + * 1. Use libsodium if available. + * 2. fread() /dev/urandom if available (never on Windows) + * 3. mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM) + * 4. COM('CAPICOM.Utilities.1')->GetRandom() + * + * See RATIONALE.md for our reasoning behind this particular order + */ + if (extension_loaded('libsodium')) { + // See random_bytes_libsodium.php + if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) { + require_once $RandomCompatDIR . '/random_bytes_libsodium.php'; + } elseif (method_exists('Sodium', 'randombytes_buf')) { + require_once $RandomCompatDIR . '/random_bytes_libsodium_legacy.php'; + } + } + + /** + * Reading directly from /dev/urandom: + */ + if (DIRECTORY_SEPARATOR === '/') { + // DIRECTORY_SEPARATOR === '/' on Unix-like OSes -- this is a fast + // way to exclude Windows. + $RandomCompatUrandom = true; + $RandomCompat_basedir = ini_get('open_basedir'); + + if (!empty($RandomCompat_basedir)) { + $RandomCompat_open_basedir = explode( + PATH_SEPARATOR, + strtolower($RandomCompat_basedir) + ); + $RandomCompatUrandom = (array() !== array_intersect( + array('/dev', '/dev/', '/dev/urandom'), + $RandomCompat_open_basedir + )); + $RandomCompat_open_basedir = null; + } + + if ( + !is_callable('random_bytes') + && + $RandomCompatUrandom + && + @is_readable('/dev/urandom') + ) { + // Error suppression on is_readable() in case of an open_basedir + // or safe_mode failure. All we care about is whether or not we + // can read it at this point. If the PHP environment is going to + // panic over trying to see if the file can be read in the first + // place, that is not helpful to us here. + + // See random_bytes_dev_urandom.php + require_once $RandomCompatDIR . '/random_bytes_dev_urandom.php'; + } + // Unset variables after use + $RandomCompat_basedir = null; + } else { + $RandomCompatUrandom = false; + } + + /** + * mcrypt_create_iv() + * + * We only want to use mcypt_create_iv() if: + * + * - random_bytes() hasn't already been defined + * - the mcrypt extensions is loaded + * - One of these two conditions is true: + * - We're on Windows (DIRECTORY_SEPARATOR !== '/') + * - We're not on Windows and /dev/urandom is readabale + * (i.e. we're not in a chroot jail) + * - Special case: + * - If we're not on Windows, but the PHP version is between + * 5.6.10 and 5.6.12, we don't want to use mcrypt. It will + * hang indefinitely. This is bad. + * - If we're on Windows, we want to use PHP >= 5.3.7 or else + * we get insufficient entropy errors. + */ + if ( + !is_callable('random_bytes') + && + // Windows on PHP < 5.3.7 is broken, but non-Windows is not known to be. + (DIRECTORY_SEPARATOR === '/' || PHP_VERSION_ID >= 50307) + && + // Prevent this code from hanging indefinitely on non-Windows; + // see https://bugs.php.net/bug.php?id=69833 + ( + DIRECTORY_SEPARATOR !== '/' || + (PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613) + ) + && + extension_loaded('mcrypt') + ) { + // See random_bytes_mcrypt.php + require_once $RandomCompatDIR . '/random_bytes_mcrypt.php'; + } + $RandomCompatUrandom = null; + + /** + * This is a Windows-specific fallback, for when the mcrypt extension + * isn't loaded. + */ + if ( + !is_callable('random_bytes') + && + extension_loaded('com_dotnet') + && + class_exists('COM') + ) { + $RandomCompat_disabled_classes = preg_split( + '#\s*,\s*#', + strtolower(ini_get('disable_classes')) + ); + + if (!in_array('com', $RandomCompat_disabled_classes)) { + try { + $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); + if (method_exists($RandomCompatCOMtest, 'GetRandom')) { + // See random_bytes_com_dotnet.php + require_once $RandomCompatDIR . '/random_bytes_com_dotnet.php'; + } + } catch (com_exception $e) { + // Don't try to use it. + } + } + $RandomCompat_disabled_classes = null; + $RandomCompatCOMtest = null; + } + + /** + * openssl_random_pseudo_bytes() + */ + if ( + ( + // Unix-like with PHP >= 5.3.0 or + ( + DIRECTORY_SEPARATOR === '/' + && + PHP_VERSION_ID >= 50300 + ) + || + // Windows with PHP >= 5.4.1 + PHP_VERSION_ID >= 50401 + ) + && + !function_exists('random_bytes') + && + extension_loaded('openssl') + ) { + // See random_bytes_openssl.php + require_once $RandomCompatDIR . '/random_bytes_openssl.php'; + } + + /** + * throw new Exception + */ + if (!is_callable('random_bytes')) { + /** + * We don't have any more options, so let's throw an exception right now + * and hope the developer won't let it fail silently. + * + * @param mixed $length + * @return void + * @throws Exception + */ + function random_bytes($length) + { + unset($length); // Suppress "variable not used" warnings. + throw new Exception( + 'There is no suitable CSPRNG installed on your system' + ); + } + } +} + +if (!is_callable('random_int')) { + require_once $RandomCompatDIR . '/random_int.php'; +} + +$RandomCompatDIR = null; diff --git a/application/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php b/application/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php new file mode 100644 index 0000000..28cc56a --- /dev/null +++ b/application/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php @@ -0,0 +1,88 @@ +GetRandom($bytes, 0)); + if (RandomCompat_strlen($buf) >= $bytes) { + /** + * Return our random entropy buffer here: + */ + return RandomCompat_substr($buf, 0, $bytes); + } + ++$execCount; + } while ($execCount < $bytes); + + /** + * If we reach here, PHP has failed us. + */ + throw new Exception( + 'Could not gather sufficient random data' + ); + } +} diff --git a/application/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php b/application/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php new file mode 100644 index 0000000..8bf7034 --- /dev/null +++ b/application/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php @@ -0,0 +1,150 @@ + 0); + + /** + * Is our result valid? + */ + if ($buf !== false) { + if (RandomCompat_strlen($buf) === $bytes) { + /** + * Return our random entropy buffer here: + */ + return $buf; + } + } + } + + /** + * If we reach here, PHP has failed us. + */ + throw new Exception( + 'Error reading from source device' + ); + } +} diff --git a/application/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php b/application/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php new file mode 100644 index 0000000..7d32b21 --- /dev/null +++ b/application/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php @@ -0,0 +1,88 @@ + 2147483647) { + $buf = ''; + for ($i = 0; $i < $bytes; $i += 1073741824) { + $n = ($bytes - $i) > 1073741824 + ? 1073741824 + : $bytes - $i; + $buf .= \Sodium\randombytes_buf($n); + } + } else { + $buf = \Sodium\randombytes_buf($bytes); + } + + if ($buf !== false) { + if (RandomCompat_strlen($buf) === $bytes) { + return $buf; + } + } + + /** + * If we reach here, PHP has failed us. + */ + throw new Exception( + 'Could not gather sufficient random data' + ); + } +} diff --git a/application/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php b/application/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php new file mode 100644 index 0000000..ba93c40 --- /dev/null +++ b/application/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php @@ -0,0 +1,92 @@ + 2147483647) { + for ($i = 0; $i < $bytes; $i += 1073741824) { + $n = ($bytes - $i) > 1073741824 + ? 1073741824 + : $bytes - $i; + $buf .= Sodium::randombytes_buf($n); + } + } else { + $buf .= Sodium::randombytes_buf($bytes); + } + + if (is_string($buf)) { + if (RandomCompat_strlen($buf) === $bytes) { + return $buf; + } + } + + /** + * If we reach here, PHP has failed us. + */ + throw new Exception( + 'Could not gather sufficient random data' + ); + } +} diff --git a/application/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php b/application/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php new file mode 100644 index 0000000..3bce91a --- /dev/null +++ b/application/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php @@ -0,0 +1,77 @@ + operators might accidentally let a float + * through. + */ + + try { + $min = RandomCompat_intval($min); + } catch (TypeError $ex) { + throw new TypeError( + 'random_int(): $min must be an integer' + ); + } + + try { + $max = RandomCompat_intval($max); + } catch (TypeError $ex) { + throw new TypeError( + 'random_int(): $max must be an integer' + ); + } + + /** + * Now that we've verified our weak typing system has given us an integer, + * let's validate the logic then we can move forward with generating random + * integers along a given range. + */ + if ($min > $max) { + throw new Error( + 'Minimum value must be less than or equal to the maximum value' + ); + } + + if ($max === $min) { + return $min; + } + + /** + * Initialize variables to 0 + * + * We want to store: + * $bytes => the number of random bytes we need + * $mask => an integer bitmask (for use with the &) operator + * so we can minimize the number of discards + */ + $attempts = $bits = $bytes = $mask = $valueShift = 0; + + /** + * At this point, $range is a positive number greater than 0. It might + * overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to + * a float and we will lose some precision. + */ + $range = $max - $min; + + /** + * Test for integer overflow: + */ + if (!is_int($range)) { + + /** + * Still safely calculate wider ranges. + * Provided by @CodesInChaos, @oittaa + * + * @ref https://gist.github.com/CodesInChaos/03f9ea0b58e8b2b8d435 + * + * We use ~0 as a mask in this case because it generates all 1s + * + * @ref https://eval.in/400356 (32-bit) + * @ref http://3v4l.org/XX9r5 (64-bit) + */ + $bytes = PHP_INT_SIZE; + $mask = ~0; + + } else { + + /** + * $bits is effectively ceil(log($range, 2)) without dealing with + * type juggling + */ + while ($range > 0) { + if ($bits % 8 === 0) { + ++$bytes; + } + ++$bits; + $range >>= 1; + $mask = $mask << 1 | 1; + } + $valueShift = $min; + } + + $val = 0; + /** + * Now that we have our parameters set up, let's begin generating + * random integers until one falls between $min and $max + */ + do { + /** + * The rejection probability is at most 0.5, so this corresponds + * to a failure probability of 2^-128 for a working RNG + */ + if ($attempts > 128) { + throw new Exception( + 'random_int: RNG is broken - too many rejections' + ); + } + + /** + * Let's grab the necessary number of random bytes + */ + $randomByteString = random_bytes($bytes); + + /** + * Let's turn $randomByteString into an integer + * + * This uses bitwise operators (<< and |) to build an integer + * out of the values extracted from ord() + * + * Example: [9F] | [6D] | [32] | [0C] => + * 159 + 27904 + 3276800 + 201326592 => + * 204631455 + */ + $val &= 0; + for ($i = 0; $i < $bytes; ++$i) { + $val |= ord($randomByteString[$i]) << ($i * 8); + } + + /** + * Apply mask + */ + $val &= $mask; + $val += $valueShift; + + ++$attempts; + /** + * If $val overflows to a floating point number, + * ... or is larger than $max, + * ... or smaller than $min, + * then try again. + */ + } while (!is_int($val) || $val > $max || $val < $min); + + return (int)$val; + } +} diff --git a/application/vendor/paragonie/random_compat/other/build_phar.php b/application/vendor/paragonie/random_compat/other/build_phar.php new file mode 100644 index 0000000..70ef4b2 --- /dev/null +++ b/application/vendor/paragonie/random_compat/other/build_phar.php @@ -0,0 +1,57 @@ +buildFromDirectory(dirname(__DIR__).'/lib'); +rename( + dirname(__DIR__).'/lib/index.php', + dirname(__DIR__).'/lib/random.php' +); + +/** + * If we pass an (optional) path to a private key as a second argument, we will + * sign the Phar with OpenSSL. + * + * If you leave this out, it will produce an unsigned .phar! + */ +if ($argc > 1) { + if (!@is_readable($argv[1])) { + echo 'Could not read the private key file:', $argv[1], "\n"; + exit(255); + } + $pkeyFile = file_get_contents($argv[1]); + + $private = openssl_get_privatekey($pkeyFile); + if ($private !== false) { + $pkey = ''; + openssl_pkey_export($private, $pkey); + $phar->setSignatureAlgorithm(Phar::OPENSSL, $pkey); + + /** + * Save the corresponding public key to the file + */ + if (!@is_readable($dist.'/random_compat.phar.pubkey')) { + $details = openssl_pkey_get_details($private); + file_put_contents( + $dist.'/random_compat.phar.pubkey', + $details['key'] + ); + } + } else { + echo 'An error occurred reading the private key from OpenSSL.', "\n"; + exit(255); + } +} diff --git a/application/vendor/paragonie/random_compat/other/ide_stubs/COM.php b/application/vendor/paragonie/random_compat/other/ide_stubs/COM.php new file mode 100644 index 0000000..4ba4bb3 --- /dev/null +++ b/application/vendor/paragonie/random_compat/other/ide_stubs/COM.php @@ -0,0 +1,20 @@ + + + + + + + + + + + diff --git a/application/vendor/psr/log/Psr/Log/AbstractLogger.php b/application/vendor/psr/log/Psr/Log/AbstractLogger.php index 00f9034..90e721a 100644 --- a/application/vendor/psr/log/Psr/Log/AbstractLogger.php +++ b/application/vendor/psr/log/Psr/Log/AbstractLogger.php @@ -15,8 +15,9 @@ abstract class AbstractLogger implements LoggerInterface * System is unusable. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function emergency($message, array $context = array()) { @@ -30,8 +31,9 @@ public function emergency($message, array $context = array()) * trigger the SMS alerts and wake you up. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function alert($message, array $context = array()) { @@ -44,8 +46,9 @@ public function alert($message, array $context = array()) * Example: Application component unavailable, unexpected exception. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function critical($message, array $context = array()) { @@ -57,8 +60,9 @@ public function critical($message, array $context = array()) * be logged and monitored. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function error($message, array $context = array()) { @@ -72,8 +76,9 @@ public function error($message, array $context = array()) * that are not necessarily wrong. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function warning($message, array $context = array()) { @@ -84,8 +89,9 @@ public function warning($message, array $context = array()) * Normal but significant events. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function notice($message, array $context = array()) { @@ -98,8 +104,9 @@ public function notice($message, array $context = array()) * Example: User logs in, SQL logs. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function info($message, array $context = array()) { @@ -110,8 +117,9 @@ public function info($message, array $context = array()) * Detailed debug information. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function debug($message, array $context = array()) { diff --git a/application/vendor/psr/log/Psr/Log/LogLevel.php b/application/vendor/psr/log/Psr/Log/LogLevel.php index e32c151..9cebcac 100644 --- a/application/vendor/psr/log/Psr/Log/LogLevel.php +++ b/application/vendor/psr/log/Psr/Log/LogLevel.php @@ -3,16 +3,16 @@ namespace Psr\Log; /** - * Describes log levels + * Describes log levels. */ class LogLevel { const EMERGENCY = 'emergency'; - const ALERT = 'alert'; - const CRITICAL = 'critical'; - const ERROR = 'error'; - const WARNING = 'warning'; - const NOTICE = 'notice'; - const INFO = 'info'; - const DEBUG = 'debug'; + const ALERT = 'alert'; + const CRITICAL = 'critical'; + const ERROR = 'error'; + const WARNING = 'warning'; + const NOTICE = 'notice'; + const INFO = 'info'; + const DEBUG = 'debug'; } diff --git a/application/vendor/psr/log/Psr/Log/LoggerAwareInterface.php b/application/vendor/psr/log/Psr/Log/LoggerAwareInterface.php index 2eebc4e..4d64f47 100644 --- a/application/vendor/psr/log/Psr/Log/LoggerAwareInterface.php +++ b/application/vendor/psr/log/Psr/Log/LoggerAwareInterface.php @@ -3,15 +3,16 @@ namespace Psr\Log; /** - * Describes a logger-aware instance + * Describes a logger-aware instance. */ interface LoggerAwareInterface { /** - * Sets a logger instance on the object + * Sets a logger instance on the object. * * @param LoggerInterface $logger - * @return null + * + * @return void */ public function setLogger(LoggerInterface $logger); } diff --git a/application/vendor/psr/log/Psr/Log/LoggerAwareTrait.php b/application/vendor/psr/log/Psr/Log/LoggerAwareTrait.php index f087a3d..639f79b 100644 --- a/application/vendor/psr/log/Psr/Log/LoggerAwareTrait.php +++ b/application/vendor/psr/log/Psr/Log/LoggerAwareTrait.php @@ -7,12 +7,16 @@ */ trait LoggerAwareTrait { - /** @var LoggerInterface */ + /** + * The logger instance. + * + * @var LoggerInterface + */ protected $logger; /** * Sets a logger. - * + * * @param LoggerInterface $logger */ public function setLogger(LoggerInterface $logger) diff --git a/application/vendor/psr/log/Psr/Log/LoggerInterface.php b/application/vendor/psr/log/Psr/Log/LoggerInterface.php index 476bb96..e695046 100644 --- a/application/vendor/psr/log/Psr/Log/LoggerInterface.php +++ b/application/vendor/psr/log/Psr/Log/LoggerInterface.php @@ -3,14 +3,14 @@ namespace Psr\Log; /** - * Describes a logger instance + * Describes a logger instance. * * The message MUST be a string or object implementing __toString(). * * The message MAY contain placeholders in the form: {foo} where foo * will be replaced by the context data in key "foo". * - * The context array can contain arbitrary data, the only assumption that + * The context array can contain arbitrary data. The only assumption that * can be made by implementors is that if an Exception instance is given * to produce a stack trace, it MUST be in a key named "exception". * @@ -23,8 +23,9 @@ interface LoggerInterface * System is unusable. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function emergency($message, array $context = array()); @@ -35,8 +36,9 @@ public function emergency($message, array $context = array()); * trigger the SMS alerts and wake you up. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function alert($message, array $context = array()); @@ -46,8 +48,9 @@ public function alert($message, array $context = array()); * Example: Application component unavailable, unexpected exception. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function critical($message, array $context = array()); @@ -56,8 +59,9 @@ public function critical($message, array $context = array()); * be logged and monitored. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function error($message, array $context = array()); @@ -68,8 +72,9 @@ public function error($message, array $context = array()); * that are not necessarily wrong. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function warning($message, array $context = array()); @@ -77,8 +82,9 @@ public function warning($message, array $context = array()); * Normal but significant events. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function notice($message, array $context = array()); @@ -88,8 +94,9 @@ public function notice($message, array $context = array()); * Example: User logs in, SQL logs. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function info($message, array $context = array()); @@ -97,18 +104,22 @@ public function info($message, array $context = array()); * Detailed debug information. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function debug($message, array $context = array()); /** * Logs with an arbitrary level. * - * @param mixed $level + * @param mixed $level * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void + * + * @throws \Psr\Log\InvalidArgumentException */ public function log($level, $message, array $context = array()); } diff --git a/application/vendor/psr/log/Psr/Log/LoggerTrait.php b/application/vendor/psr/log/Psr/Log/LoggerTrait.php index 5912496..e392fef 100644 --- a/application/vendor/psr/log/Psr/Log/LoggerTrait.php +++ b/application/vendor/psr/log/Psr/Log/LoggerTrait.php @@ -6,8 +6,8 @@ * This is a simple Logger trait that classes unable to extend AbstractLogger * (because they extend another class, etc) can include. * - * It simply delegates all log-level-specific methods to the `log` method to - * reduce boilerplate code that a simple Logger that does the same thing with + * It simply delegates all log-level-specific methods to the `log` method to + * reduce boilerplate code that a simple Logger that does the same thing with * messages regardless of the error level has to implement. */ trait LoggerTrait @@ -16,8 +16,9 @@ trait LoggerTrait * System is unusable. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function emergency($message, array $context = array()) { @@ -31,8 +32,9 @@ public function emergency($message, array $context = array()) * trigger the SMS alerts and wake you up. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function alert($message, array $context = array()) { @@ -45,8 +47,9 @@ public function alert($message, array $context = array()) * Example: Application component unavailable, unexpected exception. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function critical($message, array $context = array()) { @@ -58,8 +61,9 @@ public function critical($message, array $context = array()) * be logged and monitored. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function error($message, array $context = array()) { @@ -73,8 +77,9 @@ public function error($message, array $context = array()) * that are not necessarily wrong. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function warning($message, array $context = array()) { @@ -85,8 +90,9 @@ public function warning($message, array $context = array()) * Normal but significant events. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function notice($message, array $context = array()) { @@ -99,8 +105,9 @@ public function notice($message, array $context = array()) * Example: User logs in, SQL logs. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function info($message, array $context = array()) { @@ -111,8 +118,9 @@ public function info($message, array $context = array()) * Detailed debug information. * * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void */ public function debug($message, array $context = array()) { @@ -122,10 +130,13 @@ public function debug($message, array $context = array()) /** * Logs with an arbitrary level. * - * @param mixed $level + * @param mixed $level * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void + * + * @throws \Psr\Log\InvalidArgumentException */ abstract public function log($level, $message, array $context = array()); } diff --git a/application/vendor/psr/log/Psr/Log/NullLogger.php b/application/vendor/psr/log/Psr/Log/NullLogger.php index 553a3c5..c8f7293 100644 --- a/application/vendor/psr/log/Psr/Log/NullLogger.php +++ b/application/vendor/psr/log/Psr/Log/NullLogger.php @@ -3,7 +3,7 @@ namespace Psr\Log; /** - * This Logger can be used to avoid conditional log calls + * This Logger can be used to avoid conditional log calls. * * Logging should always be optional, and if no logger is provided to your * library creating a NullLogger instance to have something to throw logs at @@ -15,10 +15,13 @@ class NullLogger extends AbstractLogger /** * Logs with an arbitrary level. * - * @param mixed $level + * @param mixed $level * @param string $message - * @param array $context - * @return null + * @param array $context + * + * @return void + * + * @throws \Psr\Log\InvalidArgumentException */ public function log($level, $message, array $context = array()) { diff --git a/application/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php b/application/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php index a932815..9ecb6c4 100644 --- a/application/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php +++ b/application/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php @@ -2,28 +2,33 @@ namespace Psr\Log\Test; +use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; +use PHPUnit\Framework\TestCase; /** - * Provides a base test class for ensuring compliance with the LoggerInterface + * Provides a base test class for ensuring compliance with the LoggerInterface. * - * Implementors can extend the class and implement abstract methods to run this as part of their test suite + * Implementors can extend the class and implement abstract methods to run this + * as part of their test suite. */ -abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase +abstract class LoggerInterfaceTest extends TestCase { /** * @return LoggerInterface */ - abstract function getLogger(); + abstract public function getLogger(); /** - * This must return the log messages in order with a simple formatting: " " + * This must return the log messages in order. * - * Example ->error('Foo') would yield "error Foo" + * The simple formatting of the messages is: " ". + * + * Example ->error('Foo') would yield "error Foo". * * @return string[] */ - abstract function getLogs(); + abstract public function getLogs(); public function testImplements() { @@ -61,7 +66,7 @@ public function provideLevelsAndMessages() } /** - * @expectedException Psr\Log\InvalidArgumentException + * @expectedException \Psr\Log\InvalidArgumentException */ public function testThrowsOnInvalidLevel() { @@ -80,16 +85,26 @@ public function testContextReplacement() public function testObjectCastToString() { - $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString')); + if (method_exists($this, 'createPartialMock')) { + $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString')); + } else { + $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString')); + } $dummy->expects($this->once()) ->method('__toString') ->will($this->returnValue('DUMMY')); $this->getLogger()->warning($dummy); + + $expected = array('warning DUMMY'); + $this->assertEquals($expected, $this->getLogs()); } public function testContextCanContainAnything() { + $closed = fopen('php://memory', 'r'); + fclose($closed); + $context = array( 'bool' => true, 'null' => null, @@ -99,18 +114,33 @@ public function testContextCanContainAnything() 'nested' => array('with object' => new DummyTest), 'object' => new \DateTime, 'resource' => fopen('php://memory', 'r'), + 'closed' => $closed, ); $this->getLogger()->warning('Crazy context data', $context); + + $expected = array('warning Crazy context data'); + $this->assertEquals($expected, $this->getLogs()); } public function testContextExceptionKeyCanBeExceptionOrOtherValues() { - $this->getLogger()->warning('Random message', array('exception' => 'oops')); - $this->getLogger()->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); + $logger = $this->getLogger(); + $logger->warning('Random message', array('exception' => 'oops')); + $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); + + $expected = array( + 'warning Random message', + 'critical Uncaught Exception!' + ); + $this->assertEquals($expected, $this->getLogs()); } } class DummyTest { -} \ No newline at end of file + public function __toString() + { + return 'DummyTest'; + } +} diff --git a/application/vendor/psr/log/Psr/Log/Test/TestLogger.php b/application/vendor/psr/log/Psr/Log/Test/TestLogger.php new file mode 100644 index 0000000..1be3230 --- /dev/null +++ b/application/vendor/psr/log/Psr/Log/Test/TestLogger.php @@ -0,0 +1,147 @@ + $level, + 'message' => $message, + 'context' => $context, + ]; + + $this->recordsByLevel[$record['level']][] = $record; + $this->records[] = $record; + } + + public function hasRecords($level) + { + return isset($this->recordsByLevel[$level]); + } + + public function hasRecord($record, $level) + { + if (is_string($record)) { + $record = ['message' => $record]; + } + return $this->hasRecordThatPasses(function ($rec) use ($record) { + if ($rec['message'] !== $record['message']) { + return false; + } + if (isset($record['context']) && $rec['context'] !== $record['context']) { + return false; + } + return true; + }, $level); + } + + public function hasRecordThatContains($message, $level) + { + return $this->hasRecordThatPasses(function ($rec) use ($message) { + return strpos($rec['message'], $message) !== false; + }, $level); + } + + public function hasRecordThatMatches($regex, $level) + { + return $this->hasRecordThatPasses(function ($rec) use ($regex) { + return preg_match($regex, $rec['message']) > 0; + }, $level); + } + + public function hasRecordThatPasses(callable $predicate, $level) + { + if (!isset($this->recordsByLevel[$level])) { + return false; + } + foreach ($this->recordsByLevel[$level] as $i => $rec) { + if (call_user_func($predicate, $rec, $i)) { + return true; + } + } + return false; + } + + public function __call($method, $args) + { + if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { + $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; + $level = strtolower($matches[2]); + if (method_exists($this, $genericMethod)) { + $args[] = $level; + return call_user_func_array([$this, $genericMethod], $args); + } + } + throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); + } + + public function reset() + { + $this->records = []; + $this->recordsByLevel = []; + } +} diff --git a/application/vendor/psr/log/README.md b/application/vendor/psr/log/README.md index 574bc1c..a9f20c4 100644 --- a/application/vendor/psr/log/README.md +++ b/application/vendor/psr/log/README.md @@ -7,6 +7,13 @@ This repository holds all interfaces/classes/traits related to Note that this is not a logger of its own. It is merely an interface that describes a logger. See the specification for more details. +Installation +------------ + +```bash +composer require psr/log +``` + Usage ----- @@ -31,6 +38,12 @@ class Foo if ($this->logger) { $this->logger->info('Doing work'); } + + try { + $this->doSomethingElse(); + } catch (Exception $exception) { + $this->logger->error('Oh no!', array('exception' => $exception)); + } // do something useful } diff --git a/application/vendor/psr/log/composer.json b/application/vendor/psr/log/composer.json index 6bdcc21..3f6d4ee 100644 --- a/application/vendor/psr/log/composer.json +++ b/application/vendor/psr/log/composer.json @@ -2,6 +2,7 @@ "name": "psr/log", "description": "Common interface for logging libraries", "keywords": ["psr", "psr-3", "log"], + "homepage": "https://github.com/php-fig/log", "license": "MIT", "authors": [ { @@ -9,9 +10,17 @@ "homepage": "http://www.php-fig.org/" } ], + "require": { + "php": ">=5.3.0" + }, "autoload": { - "psr-0": { - "Psr\\Log\\": "" + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" } } } diff --git a/application/vendor/psy/psysh/.gitignore b/application/vendor/psy/psysh/.gitignore index 856c6ca..a7fd20d 100644 --- a/application/vendor/psy/psysh/.gitignore +++ b/application/vendor/psy/psysh/.gitignore @@ -1,3 +1,4 @@ +build-vendor/ vendor/ composer.lock manual/ diff --git a/application/vendor/psy/psysh/.php_cs b/application/vendor/psy/psysh/.php_cs index 84be2fc..cb3e56b 100644 --- a/application/vendor/psy/psysh/.php_cs +++ b/application/vendor/psy/psysh/.php_cs @@ -2,15 +2,42 @@ use Symfony\CS\Config\Config; use Symfony\CS\FixerInterface; +use Symfony\CS\Fixer\Contrib\HeaderCommentFixer; + +$header = <<level(Symfony\CS\FixerInterface::SYMFONY_LEVEL) - ->fixers(array('align_double_arrow', '-concat_without_spaces', 'concat_with_spaces', 'ordered_use', 'strict')) + ->level(FixerInterface::SYMFONY_LEVEL) + ->fixers(array( + 'align_double_arrow', + 'concat_with_spaces', + 'header_comment', + 'long_array_syntax', + 'ordered_use', + 'strict', + '-concat_without_spaces', + '-method_argument_space', + '-pre_increment', + '-unalign_double_arrow', + '-unalign_equals', + )) ->setUsingLinter(false); $finder = $config->getFinder() - ->in('src') - ->in('test'); + ->in(__DIR__) + ->name('.php_cs') + ->name('build-manual') + ->name('build-phar') + ->exclude('build-vendor'); return $config; diff --git a/application/vendor/psy/psysh/.styleci.yml b/application/vendor/psy/psysh/.styleci.yml index aeb82fc..c6fa146 100644 --- a/application/vendor/psy/psysh/.styleci.yml +++ b/application/vendor/psy/psysh/.styleci.yml @@ -3,8 +3,20 @@ preset: symfony enabled: - align_double_arrow - concat_with_spaces + - long_array_syntax - ordered_use - strict disabled: - concat_without_spaces + - method_argument_space + - pre_increment + - unalign_double_arrow + - unalign_equals + +finder: + name: + - "*.php" + - ".php_cs" + - "build-manual" + - "build-phar" diff --git a/application/vendor/psy/psysh/.travis.yml b/application/vendor/psy/psysh/.travis.yml index 030e85c..ca4f5ad 100644 --- a/application/vendor/psy/psysh/.travis.yml +++ b/application/vendor/psy/psysh/.travis.yml @@ -5,17 +5,20 @@ php: - 5.4 - 5.5 - 5.6 + - 7.0 - hhvm - - hhvm-nightly install: - travis_retry composer install --no-interaction --prefer-source + - '[ -z "$MIN_VERSIONS" ] || composer require --no-interaction --prefer-source $MIN_VERSIONS' script: - vendor/bin/phpunit matrix: - allow_failures: - - php: hhvm - - php: hhvm-nightly fast_finish: true + include: + - php: 5.3 + env: MIN_VERSIONS="symfony/console:2.3.10 symfony/var-dumper:2.7.0 nikic/php-parser:1.2.1 jakub-onderka/php-console-highlighter:0.3.0" + allow_failures: + - env: MIN_VERSIONS="symfony/console:2.3.10 symfony/var-dumper:2.7.0 nikic/php-parser:1.2.1 jakub-onderka/php-console-highlighter:0.3.0" diff --git a/application/vendor/psy/psysh/CONTRIBUTING.md b/application/vendor/psy/psysh/CONTRIBUTING.md index dad600e..a86e6e9 100644 --- a/application/vendor/psy/psysh/CONTRIBUTING.md +++ b/application/vendor/psy/psysh/CONTRIBUTING.md @@ -2,12 +2,15 @@ Please make your code look like the other code in the project. PsySH follows [PSR-1](http://php-fig.org/psr/psr-1/) and [PSR-2](http://php-fig.org/psr/psr-2/). The easiest way to do make sure you're following the coding standard is to run `vendor/bin/php-cs-fixer fix` before committing. +## Branching model + +Please branch off and send pull requests to the `develop` branch. ## Building the manual ```sh svn co https://svn.php.net/repository/phpdoc/en/trunk/reference/ php_manual -bin/build_manual phpdoc_manual ~/.psysh/php_manual.sqlite +bin/build_manual phpdoc_manual ~/.local/share/psysh/php_manual.sqlite ``` To build the manual for another language, switch out `en` above for `de`, `es`, or any of the other languages listed in the README. diff --git a/application/vendor/psy/psysh/LICENSE b/application/vendor/psy/psysh/LICENSE index 71e3c64..0d094e0 100644 --- a/application/vendor/psy/psysh/LICENSE +++ b/application/vendor/psy/psysh/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2012-2014 Justin Hileman +Copyright (c) 2012-2015 Justin Hileman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/application/vendor/psy/psysh/README.md b/application/vendor/psy/psysh/README.md index 2ff7ed2..7394d03 100644 --- a/application/vendor/psy/psysh/README.md +++ b/application/vendor/psy/psysh/README.md @@ -1,13 +1,16 @@ # PsySH -[![Package version](http://img.shields.io/packagist/v/psy/psysh.svg?style=flat-square)](https://packagist.org/packages/psy/psysh) -[![Build status](http://img.shields.io/travis/bobthecow/psysh/master.svg?style=flat-square)](http://travis-ci.org/bobthecow/psysh) -[![Made out of awesome](http://img.shields.io/badge/made_out_of_awesome-✓-brightgreen.svg?style=flat-square)](http://psysh.org) +[![Package version](https://img.shields.io/packagist/v/psy/psysh.svg?style=flat-square)](https://packagist.org/packages/psy/psysh) +[![Monthly downloads](http://img.shields.io/packagist/dm/psy/psysh.svg?style=flat-square)](https://packagist.org/packages/psy/psysh) +[![Made out of awesome](https://img.shields.io/badge/made_out_of_awesome-✓-brightgreen.svg?style=flat-square)](http://psysh.org) + +[![Build status](https://img.shields.io/travis/bobthecow/psysh/master.svg?style=flat-square)](http://travis-ci.org/bobthecow/psysh) +[![StyleCI](https://styleci.io/repos/4549925/shield)](https://styleci.io/repos/4549925) ## About -PsySH is a runtime developer console, interactive debugger and [REPL](http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) for PHP. Learn more at [psysh.org](http://psysh.org/). Check out the [Interactive Debugging in PHP talk from OSCON](https://presentate.com/bobthecow/talks/php-for-pirates) on Presentate. +PsySH is a runtime developer console, interactive debugger and [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) for PHP. Learn more at [psysh.org](http://psysh.org/). Check out the [Interactive Debugging in PHP talk from OSCON](https://presentate.com/bobthecow/talks/php-for-pirates) on Presentate. ## Installation @@ -40,7 +43,7 @@ cd psysh ## PsySH configuration -While PsySH strives to detect the right settings automatically, you might want to configure it yourself. Just add a file to `~/.config/psysh/config.php` (or `C:\Users\{USER}\AppData\Roaming\PsySH` on Windows): +While PsySH strives to detect the right settings automatically, you might want to configure it yourself. Just add a file to `~/.config/psysh/config.php` (or `C:\Users\{USER}\AppData\Roaming\PsySH\config.php` on Windows): ```php false, + 'requireSemicolons' => true, + + // PsySH uses a couple of UTF-8 characters in its own output. These can be + // disabled, mostly to work around code page issues. Because Windows. + // + // Note that this does not disable Unicode output in general, it just makes + // it so PsySH won't output any itself. + 'useUnicode' => false, + + // While PsySH respects the current `error_reporting` level, and doesn't throw + // exceptions for all errors, it does log all errors regardless of level. Set + // `errorLoggingLevel` to 0 to prevent logging non-thrown errors. Set it to any + // valid `error_reporting` value to log only errors which match that level. + 'errorLoggingLevel' => E_ALL & ~E_NOTICE, // "Default includes" will be included once at the beginning of every PsySH // session. This is a good place to add autoloaders for your favorite // libraries. 'defaultIncludes' => array( - __DIR__.'/include/bootstrap.php', + __DIR__ . '/include/bootstrap.php', ), // While PsySH ships with a bunch of great commands, it's possible to add @@ -96,11 +112,11 @@ return array( new \Psy\Command\ParseCommand, ), - // PsySH ships with presenters for scalars, resources, arrays, and objects. - // But you're not limited to those presenters. You can enable additional - // presenters (like the included MongoCursorPresenter), or write your own! - 'presenters' => array( - new \Psy\Presenter\MongoCursorPresenter, + // PsySH uses symfony/var-dumper's casters for presenting scalars, resources, + // arrays and objects. You can enable additional casters, or write your own! + // See http://symfony.com/doc/current/components/var_dumper/advanced.html#casters + 'casters' => array( + 'MyFooClass' => 'MyFooClassCaster::castMyFooObject', ), // You can disable tab completion if you want to. Not sure why you'd want to. @@ -112,13 +128,25 @@ return array( new \Psy\TabCompletion\Matcher\MongoClientMatcher, new \Psy\TabCompletion\Matcher\MongoDatabaseMatcher, ), + + // If multiple versions of the same configuration or data file exist, PsySH will + // use the file with highest precedence, and will silently ignore all others. With + // this enabled, a warning will be emitted (but not an exception thrown) if multiple + // configuration or data files are found. + // + // This will default to true in a future release, but is false for now. + 'warnOnMultipleConfigs' => true, + + // By default, output contains colors if support for them is detected. To override: + 'colorMode' => \Psy\Configuration::COLOR_MODE_FORCED, // force colors in output + 'colorMode' => \Psy\Configuration::COLOR_MODE_DISABLED, // disable colors in output ); ``` ## Downloading the manual -The PsySH `doc` command is great for documenting source code, but you'll need a little something extra for PHP core documentation. Download one of the following PHP Manual files and drop it in `~/.local/share/psysh/` (or `C:\Users\{USER}\AppData\Roaming\PsySH` on Windows): +The PsySH `doc` command is great for documenting source code, but you'll need a little something extra for PHP core documentation. Download one of the following PHP Manual files and drop it in `~/.local/share/psysh/`, `/usr/local/share/psysh/` or `C:\Users\{USER}\AppData\Roaming\PsySH\` on Windows: * **[English](http://psysh.org/manual/en/php_manual.sqlite)** * [Brazilian Portuguese](http://psysh.org/manual/pt_BR/php_manual.sqlite) @@ -133,3 +161,19 @@ The PsySH `doc` command is great for documenting source code, but you'll need a * [Persian](http://psysh.org/manual/fa/php_manual.sqlite) * [Spanish](http://psysh.org/manual/es/php_manual.sqlite) * [Turkish](http://psysh.org/manual/tr/php_manual.sqlite) + + + +## As Seen On… + + * Cake: [`cake console`](http://book.cakephp.org/3.0/en/console-and-shells/repl.html) + * Drupal: [`drush php`](http://drushcommands.com/drush-8x/core/core-cli/), [drush-psysh](https://github.com/grota/drush-psysh) + * eZ Publish: [`ezsh`](https://github.com/lolautruche/ezsh) + * Laravel: [`artisan tinker`](https://github.com/laravel/framework/blob/5.0/src/Illuminate/Foundation/Console/TinkerCommand.php) + * Lumen: [`artisan tinker`](https://github.com/vluzrmos/lumen-tinker) + * Magento: [`magerun console`](https://github.com/netz98/n98-magerun/blob/develop/src/N98/Magento/Command/Developer/ConsoleCommand.php) + * Pantheon CLI: [`terminus cli console`](https://github.com/pantheon-systems/terminus) + * Symfony: [sf1-psysh-bootstrap](https://github.com/varas/sf1-psysh-bootstrap) + * Symfony2: [`psymf`](https://github.com/navitronic/psymf), [sf2-psysh-bootstrap](https://github.com/varas/sf2-psysh-bootstrap), [symfony-repl](https://github.com/luxifer/symfony-repl), [PsyshBundle](https://github.com/theofidry/PsyshBundle) + * WordPress: [`wp-cli shell`](https://github.com/wp-cli/wp-cli/blob/master/php/commands/shell.php) + * Zend Framework 2: [PsyshModule](https://zfmodules.com/gianarb/zf2-psysh-module) diff --git a/application/vendor/psy/psysh/bin/build b/application/vendor/psy/psysh/bin/build new file mode 100644 index 0000000..3598932 --- /dev/null +++ b/application/vendor/psy/psysh/bin/build @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +cd "${BASH_SOURCE%/*}/.." + +./bin/build-vendor || exit 1 +./bin/build-phar diff --git a/application/vendor/psy/psysh/bin/build-manual b/application/vendor/psy/psysh/bin/build-manual new file mode 100644 index 0000000..fca601d --- /dev/null +++ b/application/vendor/psy/psysh/bin/build-manual @@ -0,0 +1,285 @@ +#!/usr/bin/env php +': + $inTag = false; + + default: + } + + if ($inTag) { + $tagWidth++; + } + + $i++; + + if (!$inTag && ($i - $tagWidth > $width)) { + $lastSpace = $lastSpace ?: $width; + + $return[] = trim(substr($text, 0, $lastSpace)); + $text = substr($text, $lastSpace); + $len = strlen($text); + + $i = $tagWidth = 0; + } + } while ($i < $len); + + $return[] = trim($text); + + return implode("\n", $return); +} + +function extract_paragraphs($element) +{ + $paragraphs = array(); + foreach ($element->getElementsByTagName('para') as $p) { + $text = ''; + foreach ($p->childNodes as $child) { + // @todo: figure out if there's something we can do with tables. + if ($child instanceof DOMElement && $child->tagName === 'table') { + continue; + } + + // skip references, because ugh. + if (preg_match('{^\s*&[a-z][a-z\.]+;\s*$}', $child->textContent)) { + continue; + } + + $text .= $child->ownerDocument->saveXML($child); + } + + if ($text = trim(preg_replace('{\n[ \t]+}', ' ', $text))) { + $paragraphs[] = $text; + } + } + + return implode("\n\n", $paragraphs); +} + +function format_doc($doc) +{ + $chunks = array(); + + if (!empty($doc['description'])) { + $chunks[] = 'Description:'; + $chunks[] = indent_text(htmlwrap(thunk_tags($doc['description']), WRAP_WIDTH - 2)); + $chunks[] = ''; + } + + if (!empty($doc['params'])) { + $chunks[] = 'Param:'; + + $typeMax = max(array_map(function ($param) { + return strlen($param['type']); + }, $doc['params'])); + + $max = max(array_map(function ($param) { + return strlen($param['name']); + }, $doc['params'])); + + $template = ' %-' . $typeMax . 's %-' . $max . 's %s'; + $indent = str_repeat(' ', $typeMax + $max + 6); + $wrapWidth = WRAP_WIDTH - strlen($indent); + + foreach ($doc['params'] as $param) { + $desc = indent_text(htmlwrap(thunk_tags($param['description']), $wrapWidth), $indent, false); + $chunks[] = sprintf($template, $param['type'], $param['name'], $desc); + } + $chunks[] = ''; + } + + if (isset($doc['return']) || isset($doc['return_type'])) { + $chunks[] = 'Return:'; + + $type = isset($doc['return_type']) ? $doc['return_type'] : 'unknown'; + $desc = isset($doc['return']) ? $doc['return'] : ''; + + $indent = str_repeat(' ', strlen($type) + 4); + $wrapWidth = WRAP_WIDTH - strlen($indent); + + if (!empty($desc)) { + $desc = indent_text(htmlwrap(thunk_tags($doc['return']), $wrapWidth), $indent, false); + } + + $chunks[] = sprintf(' %s %s', $type, $desc); + $chunks[] = ''; + } + + array_pop($chunks); // get rid of the trailing newline + + return implode("\n", $chunks); +} + +function thunk_tags($text) +{ + $tagMap = array( + 'parameter>' => 'strong>', + 'function>' => 'strong>', + 'literal>' => 'return>', + 'type>' => 'info>', + 'constant>' => 'info>', + ); + + $andBack = array( + '&' => '&', + '&true;' => 'true', + '&false;' => 'false', + '&null;' => 'null', + ); + + return strtr(strip_tags(strtr($text, $tagMap), ''), $andBack); +} + +function indent_text($text, $indent = ' ', $leading = true) +{ + return ($leading ? $indent : '') . str_replace("\n", "\n" . $indent, $text); +} + +function find_type($xml, $paramName) +{ + foreach ($xml->getElementsByTagName('methodparam') as $param) { + if ($type = $param->getElementsByTagName('type')->item(0)) { + if ($parameter = $param->getElementsByTagName('parameter')->item(0)) { + if ($paramName === $parameter->textContent) { + return $type->textContent; + } + } + } + } +} + +$docs = array(); +foreach (glob($argv[1] . '/*/*/*.xml') as $function) { + $funcname = basename($function); + if ($funcname === 'main.xml' || strpos($funcname, 'entities.') === 0) { + continue; + } + + $xmlstr = str_replace('&', '&', file_get_contents($function)); + + $xml = new DOMDocument(); + $xml->preserveWhiteSpace = false; + + if (!@$xml->loadXml($xmlstr)) { + echo "XML Parse Error: $function\n"; + continue; + } + + $doc = array(); + $refsect1s = $xml->getElementsByTagName('refsect1'); + foreach ($refsect1s as $refsect1) { + $role = $refsect1->getAttribute('role'); + switch ($role) { + case 'description': + $doc['description'] = extract_paragraphs($refsect1); + + if ($synopsis = $refsect1->getElementsByTagName('methodsynopsis')->item(0)) { + foreach ($synopsis->childNodes as $node) { + if ($node instanceof DOMElement && $node->tagName === 'type') { + $doc['return_type'] = $node->textContent; + break; + } + } + } + break; + + case 'returnvalues': + // do nothing. + $doc['return'] = extract_paragraphs($refsect1); + break; + + case 'parameters': + $params = array(); + $vars = $refsect1->getElementsByTagName('varlistentry'); + foreach ($vars as $var) { + if ($name = $var->getElementsByTagName('parameter')->item(0)) { + $params[] = array( + 'name' => '$' . $name->textContent, + 'type' => find_type($xml, $name->textContent), + 'description' => extract_paragraphs($var), + ); + } + } + + $doc['params'] = $params; + break; + } + } + + // and the purpose + if ($purpose = $xml->getElementsByTagName('refpurpose')->item(0)) { + $desc = htmlwrap($purpose->textContent); + if (isset($doc['description'])) { + $desc .= "\n\n" . $doc['description']; + } + + $doc['description'] = trim($desc); + } + + $formatted = format_doc($doc); + foreach ($xml->getElementsByTagName('refname') as $ref) { + $docs[$ref->textContent] = $formatted; + } +} + +if (is_file($argv[2])) { + unlink($argv[2]); +} + +$db = new PDO('sqlite:' . $argv[2]); + +$db->query('CREATE TABLE php_manual (id char(256) PRIMARY KEY, doc TEXT)'); +$cmd = $db->prepare('INSERT INTO php_manual (id, doc) VALUES (?, ?)'); +foreach ($docs as $id => $doc) { + $cmd->execute(array($id, $doc)); +} diff --git a/application/vendor/psy/psysh/bin/build-phar b/application/vendor/psy/psysh/bin/build-phar new file mode 100644 index 0000000..accdee7 --- /dev/null +++ b/application/vendor/psy/psysh/bin/build-phar @@ -0,0 +1,33 @@ +#!/usr/bin/env php +compile(); diff --git a/application/vendor/psy/psysh/bin/build-vendor b/application/vendor/psy/psysh/bin/build-vendor new file mode 100644 index 0000000..e2375b0 --- /dev/null +++ b/application/vendor/psy/psysh/bin/build-vendor @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +cd "${BASH_SOURCE%/*}/.." + +rm -rf build-vendor + +COMPOSER_VENDOR_DIR=build-vendor composer install --ignore-platform-reqs --no-dev --no-progress --classmap-authoritative diff --git a/application/vendor/psy/psysh/bin/build_manual b/application/vendor/psy/psysh/bin/build_manual deleted file mode 100644 index 1b90802..0000000 --- a/application/vendor/psy/psysh/bin/build_manual +++ /dev/null @@ -1,285 +0,0 @@ -#!/usr/bin/env php -': - $inTag = false; - - default: - } - - if ($inTag) { - $tagWidth++; - } - - $i++; - - if (!$inTag && ($i - $tagWidth > $width)) { - $lastSpace = $lastSpace ?: $width; - - $return[] = trim(substr($text, 0, $lastSpace)); - $text = substr($text, $lastSpace); - $len = strlen($text); - - $i = $tagWidth = 0; - } - } while ($i < $len); - - $return[] = trim($text); - - return implode("\n", $return); -} - -function extract_paragraphs($element) -{ - $paragraphs = array(); - foreach ($element->getElementsByTagName('para') as $p) { - $text = ''; - foreach ($p->childNodes as $child) { - // @todo: figure out if there's something we can do with tables. - if ($child instanceof DOMElement && $child->tagName === 'table') { - continue; - } - - // skip references, because ugh. - if (preg_match('{^\s*&[a-z][a-z\.]+;\s*$}', $child->textContent)) { - continue; - } - - $text .= $child->ownerDocument->saveXML($child); - } - - if ($text = trim(preg_replace('{\n[ \t]+}', ' ', $text))) { - $paragraphs[] = $text; - } - } - - return implode("\n\n", $paragraphs); -} - -function format_doc($doc) -{ - $chunks = array(); - - if (!empty($doc['description'])) { - $chunks[] = 'Description:'; - $chunks[] = indent_text(htmlwrap(thunk_tags($doc['description']), WRAP_WIDTH - 2)); - $chunks[] = ''; - } - - if (!empty($doc['params'])) { - $chunks[] = 'Param:'; - - $typeMax = max(array_map(function($param) { - return strlen($param['type']); - }, $doc['params'])); - - $max = max(array_map(function($param) { - return strlen($param['name']); - }, $doc['params'])); - - $template = ' %-'.$typeMax.'s %-'.$max.'s %s'; - $indent = str_repeat(' ', $typeMax + $max + 6); - $wrapWidth = WRAP_WIDTH - strlen($indent); - - foreach ($doc['params'] as $param) { - $desc = indent_text(htmlwrap(thunk_tags($param['description']), $wrapWidth), $indent, false); - $chunks[] = sprintf($template, $param['type'], $param['name'], $desc); - } - $chunks[] = ''; - } - - if (isset($doc['return']) || isset($doc['return_type'])) { - $chunks[] = 'Return:'; - - $type = isset($doc['return_type']) ? $doc['return_type'] : 'unknown'; - $desc = isset($doc['return']) ? $doc['return'] : ''; - - $indent = str_repeat(' ', strlen($type) + 4); - $wrapWidth = WRAP_WIDTH - strlen($indent); - - if (!empty($desc)) { - $desc = indent_text(htmlwrap(thunk_tags($doc['return']), $wrapWidth), $indent, false); - } - - $chunks[] = sprintf(' %s %s', $type, $desc); - $chunks[] = ''; - } - - array_pop($chunks); // get rid of the trailing newline - - return implode("\n", $chunks); -} - -function thunk_tags($text) -{ - $tagMap = array( - 'parameter>' => 'strong>', - 'function>' => 'strong>', - 'literal>' => 'return>', - 'type>' => 'info>', - 'constant>' => 'info>', - ); - - $andBack = array( - '&' => '&', - '&true;' => 'true', - '&false;' => 'false', - '&null;' => 'null', - ); - - return strtr(strip_tags(strtr($text, $tagMap), ''), $andBack); -} - -function indent_text($text, $indent = ' ', $leading = true) -{ - return ($leading ? $indent : '') . str_replace("\n", "\n".$indent, $text); -} - -function find_type($xml, $paramName) -{ - foreach ($xml->getElementsByTagName('methodparam') as $param) { - if ($type = $param->getElementsByTagName('type')->item(0)) { - if ($parameter = $param->getElementsByTagName('parameter')->item(0)) { - if ($paramName == $parameter->textContent) { - return $type->textContent; - } - } - } - } -} - -$docs = array(); -foreach (glob($argv[1] . '/*/*/*.xml') as $function) { - $funcname = basename($function); - if ($funcname == 'main.xml' || strpos($funcname, 'entities.') === 0) { - continue; - } - - $xmlstr = str_replace('&', '&', file_get_contents($function)); - - $xml = new DOMDocument(); - $xml->preserveWhiteSpace = false; - - if (!@$xml->loadXml($xmlstr)) { - echo "XML Parse Error: $function\n"; - continue; - } - - $doc = array(); - $refsect1s = $xml->getElementsByTagName('refsect1'); - foreach ($refsect1s as $refsect1) { - $role = $refsect1->getAttribute('role'); - switch ($role) { - case 'description': - $doc['description'] = extract_paragraphs($refsect1); - - if ($synopsis = $refsect1->getElementsByTagName('methodsynopsis')->item(0)) { - foreach ($synopsis->childNodes as $node) { - if ($node instanceof DOMElement && $node->tagName == 'type') { - $doc['return_type'] = $node->textContent; - break; - } - } - } - break; - - case 'returnvalues': - // do nothing. - $doc['return'] = extract_paragraphs($refsect1); - break; - - case 'parameters': - $params = array(); - $vars = $refsect1->getElementsByTagName('varlistentry'); - foreach ($vars as $var) { - if ($name = $var->getElementsByTagName('parameter')->item(0)) { - $params[] = array( - 'name' => '$'.$name->textContent, - 'type' => find_type($xml, $name->textContent), - 'description' => extract_paragraphs($var), - ); - } - } - - $doc['params'] = $params; - break; - } - } - - // and the purpose - if ($purpose = $xml->getElementsByTagName('refpurpose')->item(0)) { - $desc = htmlwrap($purpose->textContent); - if (isset($doc['description'])) { - $desc .= "\n\n" . $doc['description']; - } - - $doc['description'] = trim($desc); - } - - $formatted = format_doc($doc); - foreach ($xml->getElementsByTagName('refname') as $ref) { - $docs[$ref->textContent] = $formatted; - } -} - -if (is_file($argv[2])) { - unlink($argv[2]); -} - -$db = new PDO('sqlite:'.$argv[2]); - -$db->query('CREATE TABLE php_manual (id char(256) PRIMARY KEY, doc TEXT)'); -$cmd = $db->prepare('INSERT INTO php_manual (id, doc) VALUES (?, ?)'); -foreach ($docs as $id => $doc) { - $cmd->execute(array($id, $doc)); -} diff --git a/application/vendor/psy/psysh/bin/compile b/application/vendor/psy/psysh/bin/compile deleted file mode 100644 index 68720bd..0000000 --- a/application/vendor/psy/psysh/bin/compile +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env php -compile(); diff --git a/application/vendor/psy/psysh/bin/psysh b/application/vendor/psy/psysh/bin/psysh index cad93e4..4fbd223 100644 --- a/application/vendor/psy/psysh/bin/psysh +++ b/application/vendor/psy/psysh/bin/psysh @@ -2,34 +2,99 @@ $arg) { + if ($arg === '--cwd') { + if ($i >= count($argv) - 1) { + echo 'Missing --cwd argument.' . PHP_EOL; + exit(1); + } + $cwd = $argv[$i + 1]; + break; + } + + if (preg_match('/^--cwd=/', $arg)) { + $cwd = substr($arg, 6); + break; + } + } + + // Or fall back to the actual cwd + if (!isset($cwd)) { + $cwd = getcwd(); + } + + $cwd = str_replace('\\', '/', $cwd); + + $chunks = explode('/', $cwd); + while (!empty($chunks)) { + $path = implode('/', $chunks); + + // Find composer.json + if (is_file($path . '/composer.json')) { + if ($cfg = json_decode(file_get_contents($path . '/composer.json'), true)) { + if (isset($cfg['name']) && $cfg['name'] === 'psy/psysh') { + // We're inside the psysh project. Let's use the local + // Composer autoload. + if (is_file($path . '/vendor/autoload.php')) { + require $path . '/vendor/autoload.php'; + } + + return; + } + } + } + + // Or a composer.lock + if (is_file($path . '/composer.lock')) { + if ($cfg = json_decode(file_get_contents($path . '/composer.lock'), true)) { + foreach (array_merge($cfg['packages'], $cfg['packages-dev']) as $pkg) { + if (isset($pkg['name']) && $pkg['name'] === 'psy/psysh') { + // We're inside a project which requires psysh. We'll + // use the local Composer autoload. + if (is_file($path . '/vendor/autoload.php')) { + require $path . '/vendor/autoload.php'; + } + + return; + } + } + } + } + + array_pop($chunks); + } +}); + +// We didn't find an autoloader for a local version, so use the autoloader that +// came with this script. +if (!class_exists('Psy\Shell')) { /* <<< */ -if (is_file(__DIR__ . '/../vendor/autoload.php')) { - require(__DIR__ . '/../vendor/autoload.php'); -} elseif (is_file(__DIR__ . '/../../../autoload.php')) { - require(__DIR__ . '/../../../autoload.php'); -} else { - die( - 'You must set up the Psy Shell dependencies, run the following commands:' . PHP_EOL . - 'curl -s http://getcomposer.org/installer | php' . PHP_EOL . - 'php composer.phar install' . PHP_EOL - ); -} + if (is_file(__DIR__ . '/../vendor/autoload.php')) { + require __DIR__ . '/../vendor/autoload.php'; + } elseif (is_file(__DIR__ . '/../../../autoload.php')) { + require __DIR__ . '/../../../autoload.php'; + } else { + echo 'PsySH dependencies not found, be sure to run `composer install`.' . PHP_EOL; + echo 'See https://getcomposer.org to get Composer.' . PHP_EOL; + exit(1); + } /* >>> */ - -use Psy\Configuration; -use Psy\Shell; -use Symfony\Component\Console\Input\ArgvInput; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputOption; +} // If the psysh binary was included directly, assume they just wanted an // autoloader and bail early. @@ -41,7 +106,7 @@ if (version_compare(PHP_VERSION, '5.3.6', '<')) { $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); } -if (Shell::isIncluded($trace)) { +if (Psy\Shell::isIncluded($trace)) { unset($trace); return; @@ -50,74 +115,21 @@ if (Shell::isIncluded($trace)) { // Clean up after ourselves. unset($trace); -call_user_func(function() { - $usageException = null; - - $input = new ArgvInput(); - try { - $input->bind(new InputDefinition(array( - new InputOption('help', 'h', InputOption::VALUE_NONE), - new InputOption('config', 'c', InputOption::VALUE_REQUIRED), - new InputOption('version', 'v', InputOption::VALUE_NONE), - - new InputArgument('include', InputArgument::IS_ARRAY), - ))); - } catch (\RuntimeException $e) { - $usageException = $e; - } - - $config = array(); - - // Handle --config - if ($configFile = $input->getOption('config')) { - $config['configFile'] = $configFile; - } - - $shell = new Shell(new Configuration($config)); - - // Handle --help - if ($usageException !== null || $input->getOption('help')) { - if ($usageException !== null) { - echo $usageException->getMessage() . PHP_EOL . PHP_EOL; - } - - $version = $shell->getVersion(); - $name = basename(reset($_SERVER['argv'])); - echo <<getOption('version')) { - echo $shell->getVersion() . PHP_EOL; - exit(0); +// If the local version is too old, we can't do this +if (!function_exists('Psy\bin')) { + $argv = $_SERVER['argv']; + $first = array_shift($argv); + if (preg_match('/php(\.exe)?$/', $first)) { + array_shift($argv); } + array_unshift($argv, 'vendor/bin/psysh'); - // Pass additional arguments to Shell as 'includes' - $shell->setIncludes($input->getArgument('include')); - - try { - // And go! - $shell->run(); - } catch (Exception $e) { - echo $e->getMessage() . PHP_EOL; - - // TODO: this triggers the "exited unexpectedly" logic in the - // ForkingLoop, so we can't exit(1) after starting the shell... - // fix this :) + echo 'A local PsySH dependency was found, but it cannot be loaded. Please update to' . PHP_EOL; + echo 'the latest version, or run the local copy directly, e.g.:' . PHP_EOL; + echo PHP_EOL; + echo ' ' . implode(' ', $argv) . PHP_EOL; + exit(1); +} - // exit(1); - } -}); +// And go! +call_user_func(Psy\bin()); diff --git a/application/vendor/psy/psysh/composer.json b/application/vendor/psy/psysh/composer.json index 9d3806b..fd3b477 100644 --- a/application/vendor/psy/psysh/composer.json +++ b/application/vendor/psy/psysh/composer.json @@ -13,14 +13,15 @@ } ], "require": { - "php": ">=5.3.0", - "symfony/console": "~2.3.10|~2.4.2|~2.5", - "nikic/php-parser": "~1.0", + "php": ">=5.3.9", + "symfony/console": "~2.3.10|^2.4.2|~3.0", + "symfony/var-dumper": "~2.7|~3.0", + "nikic/php-parser": "^1.2.1|~2.0", "dnoegel/php-xdg-base-dir": "0.1", "jakub-onderka/php-console-highlighter": "0.3.*" }, "require-dev": { - "phpunit/phpunit": "~3.7|~4.0", + "phpunit/phpunit": "~3.7|~4.0|~5.0", "symfony/finder": "~2.1|~3.0", "squizlabs/php_codesniffer": "~2.0", "fabpot/php-cs-fixer": "~1.5" @@ -33,14 +34,19 @@ }, "autoload": { "files": ["src/Psy/functions.php"], - "psr-0": { - "Psy\\": "src/" + "psr-4": { + "Psy\\": "src/Psy/" + } + }, + "autoload-dev": { + "psr-4": { + "Psy\\Test\\": "test/Psy/Test/" } }, "bin": ["bin/psysh"], "extra": { "branch-alias": { - "dev-develop": "0.4.x-dev" + "dev-develop": "0.8.x-dev" } } } diff --git a/application/vendor/psy/psysh/phpunit.xml.dist b/application/vendor/psy/psysh/phpunit.xml.dist index dc56876..78b2b33 100644 --- a/application/vendor/psy/psysh/phpunit.xml.dist +++ b/application/vendor/psy/psysh/phpunit.xml.dist @@ -1,5 +1,5 @@ - + ./test diff --git a/application/vendor/psy/psysh/src/Psy/Autoloader.php b/application/vendor/psy/psysh/src/Psy/Autoloader.php index 4666839..db09ded 100644 --- a/application/vendor/psy/psysh/src/Psy/Autoloader.php +++ b/application/vendor/psy/psysh/src/Psy/Autoloader.php @@ -1,9 +1,9 @@ parser = $parser ?: new Parser(new Lexer()); + if ($parser === null) { + $parserFactory = new ParserFactory(); + $parser = $parserFactory->createParser(); + } + + $this->parser = $parser; $this->printer = $printer ?: new Printer(); $this->traverser = $traverser ?: new NodeTraverser(); @@ -81,11 +87,13 @@ private function getDefaultPasses() new ImplicitReturnPass(), new UseStatementPass(), // must run before namespace and validation passes new NamespacePass($this), // must run after the implicit return pass + new StrictTypesPass(), new StaticConstructorPass(), new ValidFunctionNamePass(), new ValidClassNamePass(), new ValidConstantPass(), new MagicConstantsPass(), + new ExitPass(), ); } @@ -101,7 +109,7 @@ private function getDefaultPasses() */ public function clean(array $codeLines, $requireSemicolons = false) { - $stmts = $this->parse("parse('parser->parse($code); } catch (\PhpParser\Error $e) { + if ($this->parseErrorIsUnclosedString($e, $code)) { + return false; + } + if (!$this->parseErrorIsEOF($e)) { throw ParseErrorException::fromParseError($e); } @@ -170,6 +182,33 @@ private function parseErrorIsEOF(\PhpParser\Error $e) { $msg = $e->getRawMessage(); - return ($msg === "Unexpected token EOF") || (strpos($msg, "Syntax error, unexpected EOF") !== false); + return ($msg === 'Unexpected token EOF') || (strpos($msg, 'Syntax error, unexpected EOF') !== false); + } + + /** + * A special test for unclosed single-quoted strings. + * + * Unlike (all?) other unclosed statements, single quoted strings have + * their own special beautiful snowflake syntax error just for + * themselves. + * + * @param \PhpParser\Error $e + * @param string $code + * + * @return bool + */ + private function parseErrorIsUnclosedString(\PhpParser\Error $e, $code) + { + if ($e->getRawMessage() !== 'Syntax error, unexpected T_ENCAPSED_AND_WHITESPACE') { + return false; + } + + try { + $this->parser->parse($code . "';"); + } catch (\Exception $e) { + return false; + } + + return true; } } diff --git a/application/vendor/psy/psysh/src/Psy/CodeCleaner/AbstractClassPass.php b/application/vendor/psy/psysh/src/Psy/CodeCleaner/AbstractClassPass.php index 7e3be9f..e0ec08c 100644 --- a/application/vendor/psy/psysh/src/Psy/CodeCleaner/AbstractClassPass.php +++ b/application/vendor/psy/psysh/src/Psy/CodeCleaner/AbstractClassPass.php @@ -1,9 +1,9 @@ $last->getLine(), 'endLine' => $last->getLine(), diff --git a/application/vendor/psy/psysh/src/Psy/CodeCleaner/InstanceOfPass.php b/application/vendor/psy/psysh/src/Psy/CodeCleaner/InstanceOfPass.php index e07ed56..a5f37c0 100644 --- a/application/vendor/psy/psysh/src/Psy/CodeCleaner/InstanceOfPass.php +++ b/application/vendor/psy/psysh/src/Psy/CodeCleaner/InstanceOfPass.php @@ -1,9 +1,9 @@ name === "__psysh__") { + if ($node instanceof Variable && $node->name === '__psysh__') { throw new RuntimeException('Don\'t mess with $__psysh__. Bad things will happen.'); } } diff --git a/application/vendor/psy/psysh/src/Psy/CodeCleaner/LegacyEmptyPass.php b/application/vendor/psy/psysh/src/Psy/CodeCleaner/LegacyEmptyPass.php index beeee9b..f89fbc7 100644 --- a/application/vendor/psy/psysh/src/Psy/CodeCleaner/LegacyEmptyPass.php +++ b/application/vendor/psy/psysh/src/Psy/CodeCleaner/LegacyEmptyPass.php @@ -1,9 +1,9 @@ getAttributes()); } elseif ($node instanceof File) { - return new String('', $node->getAttributes()); + return new StringNode('', $node->getAttributes()); } } } diff --git a/application/vendor/psy/psysh/src/Psy/CodeCleaner/NamespaceAwarePass.php b/application/vendor/psy/psysh/src/Psy/CodeCleaner/NamespaceAwarePass.php index 3daac72..554e6e1 100644 --- a/application/vendor/psy/psysh/src/Psy/CodeCleaner/NamespaceAwarePass.php +++ b/application/vendor/psy/psysh/src/Psy/CodeCleaner/NamespaceAwarePass.php @@ -1,9 +1,9 @@ strictTypes; + + foreach ($nodes as $key => $node) { + if ($node instanceof DeclareStmt) { + foreach ($node->declares as $declare) { + if ($declare->key === 'strict_types') { + $value = $declare->value; + if (!$value instanceof LNumber || ($value->value !== 0 && $value->value !== 1)) { + throw new FatalErrorException('strict_types declaration must have 0 or 1 as its value'); + } + + $this->strictTypes = $value->value === 1; + } + } + } + } + + if ($prependStrictTypes) { + $first = reset($nodes); + if (!$first instanceof DeclareStmt) { + $declare = new DeclareStmt(array(new DeclareDeclare('strict_types', new LNumber(1)))); + array_unshift($nodes, $declare); + } + } + + return $nodes; + } +} diff --git a/application/vendor/psy/psysh/src/Psy/CodeCleaner/UseStatementPass.php b/application/vendor/psy/psysh/src/Psy/CodeCleaner/UseStatementPass.php index 3c7aadf..ee96a1c 100644 --- a/application/vendor/psy/psysh/src/Psy/CodeCleaner/UseStatementPass.php +++ b/application/vendor/psy/psysh/src/Psy/CodeCleaner/UseStatementPass.php @@ -1,9 +1,9 @@ validateClassStatement($node); + } elseif ($node instanceof InterfaceStmt) { + $this->validateInterfaceStatement($node); + } elseif ($node instanceof TraitStmt) { + $this->validateTraitStatement($node); + } + } + + /** + * Validate `new` expressions, class constant fetches, and static calls. * * @throws FatalErrorException if a class, interface or trait is referenced which does not exist. * @throws FatalErrorException if a class extends something that is not a class. @@ -54,13 +76,7 @@ public function __construct() */ public function leaveNode(Node $node) { - if ($node instanceof ClassStmt) { - $this->validateClassStatement($node); - } elseif ($node instanceof InterfaceStmt) { - $this->validateInterfaceStatement($node); - } elseif ($node instanceof TraitStmt) { - $this->validateTraitStatement($node); - } elseif ($node instanceof NewExpr) { + if ($node instanceof NewExpr) { $this->validateNewExpression($node); } elseif ($node instanceof ClassConstFetch) { $this->validateClassConstFetchExpression($node); @@ -111,8 +127,8 @@ protected function validateTraitStatement(TraitStmt $stmt) */ protected function validateNewExpression(NewExpr $stmt) { - // if class name is an expression, give it a pass for now - if (!$stmt->class instanceof Expr) { + // if class name is an expression or an anonymous class, give it a pass for now + if (!$stmt->class instanceof Expr && !$stmt->class instanceof ClassStmt) { $this->ensureClassExists($this->getFullyQualifiedName($stmt->class), $stmt); } } @@ -124,9 +140,15 @@ protected function validateNewExpression(NewExpr $stmt) */ protected function validateClassConstFetchExpression(ClassConstFetch $stmt) { + // there is no need to check exists for ::class const for php 5.5 or newer + if (strtolower($stmt->name) === 'class' + && version_compare(PHP_VERSION, '5.5', '>=')) { + return; + } + // if class name is an expression, give it a pass for now if (!$stmt->class instanceof Expr) { - $this->ensureClassExists($this->getFullyQualifiedName($stmt->class), $stmt); + $this->ensureClassOrInterfaceExists($this->getFullyQualifiedName($stmt->class), $stmt); } } @@ -188,6 +210,21 @@ protected function ensureClassExists($name, $stmt) } } + /** + * Ensure that a referenced class _or interface_ exists. + * + * @throws FatalErrorException + * + * @param string $name + * @param Stmt $stmt + */ + protected function ensureClassOrInterfaceExists($name, $stmt) + { + if (!$this->classExists($name) && !$this->interfaceExists($name)) { + throw $this->createError(sprintf('Class \'%s\' not found', $name), $stmt); + } + } + /** * Ensure that a statically called method exists. * @@ -201,6 +238,11 @@ protected function ensureMethodExists($class, $name, $stmt) { $this->ensureClassExists($class, $stmt); + // let's pretend all calls to self, parent and static are valid + if (in_array(strtolower($class), array('self', 'parent', 'static'))) { + return; + } + // if method name is an expression, give it a pass for now if ($name instanceof Expr) { return; @@ -251,12 +293,21 @@ protected function getScopeType(Stmt $stmt) /** * Check whether a class exists, or has been defined in the current code snippet. * + * Gives `self`, `static` and `parent` a free pass. + * * @param string $name * - * @return boolean + * @return bool */ protected function classExists($name) { + // Give `self`, `static` and `parent` a pass. This will actually let + // some errors through, since we're not checking whether the keyword is + // being used in a class scope. + if (in_array(strtolower($name), array('self', 'static', 'parent'))) { + return true; + } + return class_exists($name) || $this->findInScope($name) === self::CLASS_TYPE; } @@ -265,7 +316,7 @@ protected function classExists($name) * * @param string $name * - * @return boolean + * @return bool */ protected function interfaceExists($name) { @@ -277,7 +328,7 @@ protected function interfaceExists($name) * * @param string $name * - * @return boolean + * @return bool */ protected function traitExists($name) { diff --git a/application/vendor/psy/psysh/src/Psy/CodeCleaner/ValidConstantPass.php b/application/vendor/psy/psysh/src/Psy/CodeCleaner/ValidConstantPass.php index dd6b5ec..da54f42 100644 --- a/application/vendor/psy/psysh/src/Psy/CodeCleaner/ValidConstantPass.php +++ b/application/vendor/psy/psysh/src/Psy/CodeCleaner/ValidConstantPass.php @@ -1,9 +1,9 @@ name === 'class') { + return; + } + // if class name is an expression, give it a pass for now if (!$stmt->class instanceof Expr) { $className = $this->getFullyQualifiedName($stmt->class); // if the class doesn't exist, don't throw an exception… it might be // defined in the same line it's used or something stupid like that. - if (class_exists($className)) { + if (class_exists($className) || interface_exists($className)) { $constName = sprintf('%s::%s', $className, $stmt->name); if (!defined($constName)) { - $msg = sprintf('Class constant \'%s\' not found', $constName); + $constType = class_exists($className) ? 'Class' : 'Interface'; + $msg = sprintf('%s constant \'%s\' not found', $constType, $constName); throw new FatalErrorException($msg, 0, 1, null, $stmt->getLine()); } } diff --git a/application/vendor/psy/psysh/src/Psy/CodeCleaner/ValidFunctionNamePass.php b/application/vendor/psy/psysh/src/Psy/CodeCleaner/ValidFunctionNamePass.php index 60106d5..70eea91 100644 --- a/application/vendor/psy/psysh/src/Psy/CodeCleaner/ValidFunctionNamePass.php +++ b/application/vendor/psy/psysh/src/Psy/CodeCleaner/ValidFunctionNamePass.php @@ -1,9 +1,9 @@ getFullyQualifiedName($node->name); @@ -43,10 +43,23 @@ public function leaveNode(Node $node) } $this->currentScope[strtolower($name)] = true; - } elseif ($node instanceof FuncCall) { + } + } + + /** + * Validate that function calls will succeed. + * + * @throws FatalErrorException if a function is redefined. + * @throws FatalErrorException if the function name is a string (not an expression) and is not defined. + * + * @param Node $node + */ + public function leaveNode(Node $node) + { + if ($node instanceof FuncCall) { // if function name is an expression or a variable, give it a pass for now. $name = $node->name; - if (!$name instanceof Expression && !$name instanceof Variable) { + if (!$name instanceof Expr && !$name instanceof Variable) { $shortName = implode('\\', $name->parts); $fullName = $this->getFullyQualifiedName($name); $inScope = isset($this->currentScope[strtolower($fullName)]); diff --git a/application/vendor/psy/psysh/src/Psy/Command/BufferCommand.php b/application/vendor/psy/psysh/src/Psy/Command/BufferCommand.php index 42ab86f..bfa1da1 100644 --- a/application/vendor/psy/psysh/src/Psy/Command/BufferCommand.php +++ b/application/vendor/psy/psysh/src/Psy/Command/BufferCommand.php @@ -1,9 +1,9 @@ setDescription('Show (or clear) the contents of the code input buffer.') ->setHelp( - <<--clear option. diff --git a/application/vendor/psy/psysh/src/Psy/Command/ClearCommand.php b/application/vendor/psy/psysh/src/Psy/Command/ClearCommand.php index 59b1000..56b422b 100644 --- a/application/vendor/psy/psysh/src/Psy/Command/ClearCommand.php +++ b/application/vendor/psy/psysh/src/Psy/Command/ClearCommand.php @@ -1,9 +1,9 @@ setDefinition(array()) ->setDescription('Clear the Psy Shell screen.') ->setHelp( - <<presenterManager = $manager; + $this->presenter = $presenter; } /** @@ -53,14 +52,14 @@ protected function configure() )) ->setDescription('Dump an object or primitive.') ->setHelp( - <<way awesomer. e.g. ->>> dump \$_ ->>> dump \$someVar +>>> dump $_ +>>> dump $someVar HELP ); } @@ -72,7 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { $depth = $input->getOption('depth'); $target = $this->resolveTarget($input->getArgument('target')); - $output->page($this->presenterManager->present($target, $depth, $input->getOption('all') ? Presenter::VERBOSE : 0)); + $output->page($this->presenter->present($target, $depth, $input->getOption('all') ? Presenter::VERBOSE : 0)); } /** diff --git a/application/vendor/psy/psysh/src/Psy/Command/ExitCommand.php b/application/vendor/psy/psysh/src/Psy/Command/ExitCommand.php index a782489..59e8719 100644 --- a/application/vendor/psy/psysh/src/Psy/Command/ExitCommand.php +++ b/application/vendor/psy/psysh/src/Psy/Command/ExitCommand.php @@ -1,9 +1,9 @@ setDefinition(array()) ->setDescription('End the current session and return to caller.') ->setHelp( - <<setDescription('Show the Psy Shell history.') ->setHelp( - <<presenterManager = $manager; + $this->presenter = $presenter; } /** @@ -84,7 +84,7 @@ protected function configure() )) ->setDescription('List local, instance or class variables, methods and constants.') ->setHelp( - <<>>> ls ->>> ls \$foo +>>> ls $foo >>> ls -k --grep mongo -i >>> ls -al ReflectionClass >>> ls --constants --category date @@ -141,7 +141,7 @@ protected function execute(InputInterface $input, OutputInterface $output) protected function initEnumerators() { if (!isset($this->enumerators)) { - $mgr = $this->presenterManager; + $mgr = $this->presenter; $this->enumerators = array( new ClassConstantEnumerator($mgr), diff --git a/application/vendor/psy/psysh/src/Psy/Command/ListCommand/ClassConstantEnumerator.php b/application/vendor/psy/psysh/src/Psy/Command/ListCommand/ClassConstantEnumerator.php index fbce7f1..98593e8 100644 --- a/application/vendor/psy/psysh/src/Psy/Command/ListCommand/ClassConstantEnumerator.php +++ b/application/vendor/psy/psysh/src/Psy/Command/ListCommand/ClassConstantEnumerator.php @@ -1,9 +1,9 @@ presenterManager = $presenterManager; + $this->presenter = $presenter; } /** @@ -87,7 +87,7 @@ abstract protected function listItems(InputInterface $input, \Reflector $reflect protected function presentRef($value) { - return $this->presenterManager->presentRef($value); + return $this->presenter->presentRef($value); } protected function showItem($name) @@ -121,7 +121,7 @@ private function setFilter(InputInterface $input) * * @param string $pattern * - * @return boolean + * @return bool */ private function validateRegex($pattern) { diff --git a/application/vendor/psy/psysh/src/Psy/Command/ListCommand/FunctionEnumerator.php b/application/vendor/psy/psysh/src/Psy/Command/ListCommand/FunctionEnumerator.php index 8842715..712f1ce 100644 --- a/application/vendor/psy/psysh/src/Psy/Command/ListCommand/FunctionEnumerator.php +++ b/application/vendor/psy/psysh/src/Psy/Command/ListCommand/FunctionEnumerator.php @@ -1,9 +1,9 @@ context = $context; - parent::__construct($presenterManager); + parent::__construct($presenter); } /** @@ -68,7 +68,7 @@ protected function listItems(InputInterface $input, \Reflector $reflector = null /** * Get scope variables. * - * @param boolean $showAll Include special variables (e.g. $_). + * @param bool $showAll Include special variables (e.g. $_). * * @return array */ diff --git a/application/vendor/psy/psysh/src/Psy/Command/ParseCommand.php b/application/vendor/psy/psysh/src/Psy/Command/ParseCommand.php index 57952ef..53b87c4 100644 --- a/application/vendor/psy/psysh/src/Psy/Command/ParseCommand.php +++ b/application/vendor/psy/psysh/src/Psy/Command/ParseCommand.php @@ -1,9 +1,9 @@ presenterManager = new PresenterManager(); + $this->parserFactory = new ParserFactory(); + $this->parsers = array(); - foreach ($manager as $presenter) { - $this->presenterManager->addPresenter($presenter); - } + parent::__construct($name); + } - $this->presenterManager->addPresenter(new PHPParserPresenter()); + /** + * PresenterAware interface. + * + * @param Presenter $presenter + */ + public function setPresenter(Presenter $presenter) + { + $this->presenter = clone $presenter; + $this->presenter->addCasters(array( + 'PhpParser\Node' => function (Node $node, array $a) { + $a = array( + Caster::PREFIX_VIRTUAL . 'type' => $node->getType(), + Caster::PREFIX_VIRTUAL . 'attributes' => $node->getAttributes(), + ); + + foreach ($node->getSubNodeNames() as $name) { + $a[Caster::PREFIX_VIRTUAL . $name] = $node->$name; + } + + return $a; + }, + )); } /** @@ -50,15 +71,26 @@ public function setPresenterManager(PresenterManager $manager) */ protected function configure() { + $definition = array( + new InputArgument('code', InputArgument::REQUIRED, 'PHP code to parse.'), + new InputOption('depth', '', InputOption::VALUE_REQUIRED, 'Depth to parse', 10), + ); + + if ($this->parserFactory->hasKindsSupport()) { + $msg = 'One of PhpParser\\ParserFactory constants: ' + . implode(', ', ParserFactory::getPossibleKinds()) + . " (default is based on current interpreter's version)"; + $defaultKind = $this->parserFactory->getDefaultKind(); + + $definition[] = new InputOption('kind', '', InputOption::VALUE_REQUIRED, $msg, $defaultKind); + } + $this ->setName('parse') - ->setDefinition(array( - new InputArgument('code', InputArgument::REQUIRED, 'PHP code to parse.'), - new InputOption('depth', '', InputOption::VALUE_REQUIRED, 'Depth to parse', 10), - )) + ->setDefinition($definition) ->setDescription('Parse PHP code and show the abstract syntax tree.') ->setHelp( - <<getOption('depth'); - $nodes = $this->parse($code); - $output->page($this->presenterManager->present($nodes, $depth)); + $parserKind = $input->getOption('kind'); + $depth = $input->getOption('depth'); + $nodes = $this->parse($this->getParser($parserKind), $code); + $output->page($this->presenter->present($nodes, $depth)); } /** * Lex and parse a string of code into statements. * + * @param Parser $parser * @param string $code * * @return array Statements */ - private function parse($code) + private function parse(Parser $parser, $code) { - $parser = $this->getParser(); - try { return $parser->parse($code); } catch (\PhpParser\Error $e) { @@ -112,14 +144,16 @@ private function parse($code) /** * Get (or create) the Parser instance. * + * @param string|null $kind One of Psy\ParserFactory constants (only for PHP parser 2.0 and above). + * * @return Parser */ - private function getParser() + private function getParser($kind = null) { - if (!isset($this->parser)) { - $this->parser = new Parser(new Lexer()); + if (!array_key_exists($kind, $this->parsers)) { + $this->parsers[$kind] = $this->parserFactory->createParser($kind); } - return $this->parser; + return $this->parsers[$kind]; } } diff --git a/application/vendor/psy/psysh/src/Psy/Command/PsyVersionCommand.php b/application/vendor/psy/psysh/src/Psy/Command/PsyVersionCommand.php index e458c11..ff84c3b 100644 --- a/application/vendor/psy/psysh/src/Psy/Command/PsyVersionCommand.php +++ b/application/vendor/psy/psysh/src/Psy/Command/PsyVersionCommand.php @@ -1,9 +1,9 @@ resolveInstance($matches[1]), null, 0); - case (!$classOnly && preg_match(self::CLASS_MEMBER, $valueName, $matches)): + case !$classOnly && preg_match(self::CLASS_MEMBER, $valueName, $matches): return array($this->resolveName($matches[1]), $matches[2], Mirror::CONSTANT | Mirror::METHOD); - case (!$classOnly && preg_match(self::CLASS_STATIC, $valueName, $matches)): + case !$classOnly && preg_match(self::CLASS_STATIC, $valueName, $matches): return array($this->resolveName($matches[1]), $matches[2], Mirror::STATIC_PROPERTY | Mirror::PROPERTY); - case (!$classOnly && preg_match(self::INSTANCE_MEMBER, $valueName, $matches)): + case !$classOnly && preg_match(self::INSTANCE_MEMBER, $valueName, $matches): if ($matches[2] === '->') { $kind = Mirror::METHOD | Mirror::PROPERTY; } else { @@ -81,7 +81,7 @@ protected function getTarget($valueName, $classOnly = false) return array($this->resolveInstance($matches[1]), $matches[3], $kind); - case (!$classOnly && preg_match(self::INSTANCE_STATIC, $valueName, $matches)): + case !$classOnly && preg_match(self::INSTANCE_STATIC, $valueName, $matches): return array($this->resolveInstance($matches[1]), $matches[2], Mirror::STATIC_PROPERTY); default: @@ -117,8 +117,8 @@ protected function resolveName($name, $includeFunctions = false) /** * Get a Reflector and documentation for a function, class or instance, constant, method or property. * - * @param string $valueName Function, class, variable, constant, method or property name. - * @param boolean $classOnly True if the name should only refer to a class, function or instance + * @param string $valueName Function, class, variable, constant, method or property name. + * @param bool $classOnly True if the name should only refer to a class, function or instance * * @return array (value, Reflector) */ diff --git a/application/vendor/psy/psysh/src/Psy/Command/ShowCommand.php b/application/vendor/psy/psysh/src/Psy/Command/ShowCommand.php index 8255f3d..3a85d67 100644 --- a/application/vendor/psy/psysh/src/Psy/Command/ShowCommand.php +++ b/application/vendor/psy/psysh/src/Psy/Command/ShowCommand.php @@ -1,9 +1,9 @@ colorMode = $colorMode ?: Configuration::COLOR_MODE_AUTO; + + return parent::__construct(); + } + /** * {@inheritdoc} */ @@ -54,7 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output) list($value, $reflector) = $this->getTargetAndReflector($input->getArgument('value')); try { - $output->page(CodeFormatter::format($reflector), ShellOutput::OUTPUT_RAW); + $output->page(CodeFormatter::format($reflector, $this->colorMode), ShellOutput::OUTPUT_RAW); } catch (RuntimeException $e) { $output->writeln(SignatureFormatter::format($reflector)); throw $e; diff --git a/application/vendor/psy/psysh/src/Psy/Command/ThrowUpCommand.php b/application/vendor/psy/psysh/src/Psy/Command/ThrowUpCommand.php index 951e447..5bfc9bc 100644 --- a/application/vendor/psy/psysh/src/Psy/Command/ThrowUpCommand.php +++ b/application/vendor/psy/psysh/src/Psy/Command/ThrowUpCommand.php @@ -1,9 +1,9 @@ setDescription('Throw an exception out of the Psy Shell.') ->setHelp( - <<>>> throw-up ->>> throw-up \$e +>>> throw-up $e HELP ); } diff --git a/application/vendor/psy/psysh/src/Psy/Command/TraceCommand.php b/application/vendor/psy/psysh/src/Psy/Command/TraceCommand.php index e12b35f..e54a5f4 100644 --- a/application/vendor/psy/psysh/src/Psy/Command/TraceCommand.php +++ b/application/vendor/psy/psysh/src/Psy/Command/TraceCommand.php @@ -1,9 +1,9 @@ setDescription('Show the current call stack.') ->setHelp( - <<--include-psy option. @@ -53,7 +53,7 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $trace = $this->getBacktrace(new \Exception(), $input->getOption('num'), $input->getOption('include-psy')); - $output->page($trace, ShellOutput::NUMBER_LINES | ShellOutput::OUTPUT_RAW); + $output->page($trace, ShellOutput::NUMBER_LINES); } /** @@ -106,7 +106,7 @@ protected function getBacktrace(\Exception $e, $count = null, $includePsy = true $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a'; $lines[] = sprintf( - ' %s%s%s() at %s:%s', + ' %s%s%s() at %s:%s', OutputFormatter::escape($class), OutputFormatter::escape($type), OutputFormatter::escape($function), diff --git a/application/vendor/psy/psysh/src/Psy/Command/WhereamiCommand.php b/application/vendor/psy/psysh/src/Psy/Command/WhereamiCommand.php index d467f46..04598da 100644 --- a/application/vendor/psy/psysh/src/Psy/Command/WhereamiCommand.php +++ b/application/vendor/psy/psysh/src/Psy/Command/WhereamiCommand.php @@ -1,9 +1,9 @@ colorMode = $colorMode ?: Configuration::COLOR_MODE_AUTO; + if (version_compare(PHP_VERSION, '5.3.6', '>=')) { $this->backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); } else { @@ -46,7 +54,7 @@ protected function configure() )) ->setDescription('Show where you are in the code.') ->setHelp( - <<fileInfo(); $num = $input->getOption('num'); - $colors = new ConsoleColor(); - $colors->addTheme('line_number', array('blue')); + $factory = new ConsoleColorFactory($this->colorMode); + $colors = $factory->getConsoleColor(); $highlighter = new Highlighter($colors); $contents = file_get_contents($info['file']); $output->page($highlighter->getCodeSnippet($contents, $info['line'], $num, $num), ShellOutput::OUTPUT_RAW); diff --git a/application/vendor/psy/psysh/src/Psy/Command/WtfCommand.php b/application/vendor/psy/psysh/src/Psy/Command/WtfCommand.php index d215768..afcbc6e 100644 --- a/application/vendor/psy/psysh/src/Psy/Command/WtfCommand.php +++ b/application/vendor/psy/psysh/src/Psy/Command/WtfCommand.php @@ -1,9 +1,9 @@ setDescription('Show the backtrace of the most recent exception.') ->setHelp( - <<ignoreVCS(true) ->name('*.php') ->exclude('Tests') - ->in(__DIR__ . '/../../vendor/dnoegel/php-xdg-base-dir/src') - ->in(__DIR__ . '/../../vendor/jakub-onderka/php-console-color') - ->in(__DIR__ . '/../../vendor/jakub-onderka/php-console-highlighter') - ->in(__DIR__ . '/../../vendor/nikic/php-parser/lib') - ->in(__DIR__ . '/../../vendor/symfony/console') - ->in(__DIR__ . '/../../vendor/symfony/yaml'); + ->in(__DIR__ . '/../../build-vendor'); foreach ($finder as $file) { $this->addFile($phar, $file); } - $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/autoload.php')); - $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/include_paths.php')); - $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/autoload_files.php')); - $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/autoload_psr4.php')); - $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/autoload_real.php')); - $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/autoload_namespaces.php')); - $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/autoload_classmap.php')); - $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/ClassLoader.php')); - // Stubs $phar->setStub($this->getStub()); $phar->stopBuffering(); - // $this->addFile($phar, new \SplFileInfo(__DIR__.'/../../LICENSE'), false); - unset($phar); } @@ -139,6 +123,20 @@ private function stripWhitespace($source) return $output; } + private static function getStubLicense() + { + $license = file_get_contents(__DIR__ . '/../../LICENSE'); + $license = str_replace('The MIT License (MIT)', '', $license); + $license = str_replace("\n", "\n * ", trim($license)); + + return $license; + } + + const STUB_AUTOLOAD = <<<'EOS' + Phar::mapPhar('psysh.phar'); + require 'phar://psysh.phar/build-vendor/autoload.php'; +EOS; + /** * Get a Phar stub for psysh. * @@ -148,14 +146,11 @@ private function stripWhitespace($source) */ private function getStub() { - $autoload = <<<'EOS' -Phar::mapPhar('psysh.phar'); -require 'phar://psysh.phar/vendor/autoload.php'; -EOS; - $content = file_get_contents(__DIR__ . '/../../bin/psysh'); - $content = preg_replace('{/\* <<<.*?>>> \*/}sm', $autoload, $content); - $content .= "__HALT_COMPILER();"; + $content = preg_replace('{/\* <<<.*?>>> \*/}sm', self::STUB_AUTOLOAD, $content); + $content = preg_replace('/\\(c\\) .*?with this source code./sm', self::getStubLicense(), $content); + + $content .= '__HALT_COMPILER();'; return $content; } diff --git a/application/vendor/psy/psysh/src/Psy/ConfigPaths.php b/application/vendor/psy/psysh/src/Psy/ConfigPaths.php new file mode 100644 index 0000000..578a25b --- /dev/null +++ b/application/vendor/psy/psysh/src/Psy/ConfigPaths.php @@ -0,0 +1,183 @@ +getConfigDirs()); + } + + /** + * Get potential home config directory paths. + * + * Returns `~/.psysh`, `%APPDATA%/PsySH` (when on Windows), and the + * XDG Base Directory home config directory: + * + * http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html + * + * @return string[] + */ + public static function getHomeConfigDirs() + { + $xdg = new Xdg(); + + return self::getDirNames(array($xdg->getHomeConfigDir())); + } + + /** + * Get the current home config directory. + * + * Returns the highest precedence home config directory which actually + * exists. If none of them exists, returns the highest precedence home + * config directory (`%APPDATA%/PsySH` on Windows, `~/.config/psysh` + * everywhere else). + * + * @see self::getHomeConfigDirs + * + * @return string + */ + public static function getCurrentConfigDir() + { + $configDirs = self::getHomeConfigDirs(); + foreach ($configDirs as $configDir) { + if (@is_dir($configDir)) { + return $configDir; + } + } + + return $configDirs[0]; + } + + /** + * Find real config files in config directories. + * + * @param string[] $names Config file names + * @param string $configDir Optionally use a specific config directory + * + * @return string[] + */ + public static function getConfigFiles(array $names, $configDir = null) + { + $dirs = ($configDir === null) ? self::getConfigDirs() : array($configDir); + + return self::getRealFiles($dirs, $names); + } + + /** + * Get potential data directory paths. + * + * If a `dataDir` option was explicitly set, returns an array containing + * just that directory. + * + * Otherwise, it returns `~/.psysh` and all XDG Base Directory data directories: + * + * http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html + * + * @return string[] + */ + public static function getDataDirs() + { + $xdg = new Xdg(); + + return self::getDirNames($xdg->getDataDirs()); + } + + /** + * Find real data files in config directories. + * + * @param string[] $names Config file names + * @param string $dataDir Optionally use a specific config directory + * + * @return string[] + */ + public static function getDataFiles(array $names, $dataDir = null) + { + $dirs = ($dataDir === null) ? self::getDataDirs() : array($dataDir); + + return self::getRealFiles($dirs, $names); + } + + /** + * Get a runtime directory. + * + * Defaults to `/psysh` inside the system's temp dir. + * + * @return string + */ + public static function getRuntimeDir() + { + $xdg = new Xdg(); + + return $xdg->getRuntimeDir(false) . '/psysh'; + } + + private static function getDirNames(array $baseDirs) + { + $dirs = array_map(function ($dir) { + return strtr($dir, '\\', '/') . '/psysh'; + }, $baseDirs); + + // Add ~/.psysh + if ($home = getenv('HOME')) { + $dirs[] = strtr($home, '\\', '/') . '/.psysh'; + } + + // Add some Windows specific ones :) + if (defined('PHP_WINDOWS_VERSION_MAJOR')) { + if ($appData = getenv('APPDATA')) { + // AppData gets preference + array_unshift($dirs, strtr($appData, '\\', '/') . '/PsySH'); + } + + $dir = strtr(getenv('HOMEDRIVE') . '/' . getenv('HOMEPATH'), '\\', '/') . '/.psysh'; + if (!in_array($dir, $dirs)) { + $dirs[] = $dir; + } + } + + return $dirs; + } + + private static function getRealFiles(array $dirNames, array $fileNames) + { + $files = array(); + foreach ($dirNames as $dir) { + foreach ($fileNames as $name) { + $file = $dir . '/' . $name; + if (@is_file($file)) { + $files[] = $file; + } + } + } + + return $files; + } +} diff --git a/application/vendor/psy/psysh/src/Psy/Configuration.php b/application/vendor/psy/psysh/src/Psy/Configuration.php index d530286..926472a 100644 --- a/application/vendor/psy/psysh/src/Psy/Configuration.php +++ b/application/vendor/psy/psysh/src/Psy/Configuration.php @@ -1,9 +1,9 @@ setColorMode(self::COLOR_MODE_AUTO); + // explicit configFile option if (isset($config['configFile'])) { $this->configFile = $config['configFile']; @@ -84,10 +97,7 @@ public function __construct(array $config = array()) if (isset($config['baseDir'])) { $msg = "The 'baseDir' configuration option is deprecated. " . "Please specify 'configDir' and 'dataDir' options instead."; - trigger_error($msg, E_USER_DEPRECATED); - - $this->setConfigDir($config['baseDir']); - $this->setDataDir($config['baseDir']); + throw new DeprecatedException($msg); } unset($config['configFile'], $config['baseDir']); @@ -103,6 +113,9 @@ public function __construct(array $config = array()) * This checks for the presence of Readline and Pcntl extensions. * * If a config file is available, it will be loaded and merged with the current config. + * + * If no custom config file was specified and a local project config file + * is available, it will be loaded and merged with the current config. */ public function init() { @@ -113,6 +126,10 @@ public function init() if ($configFile = $this->getConfigFile()) { $this->loadConfigFile($configFile); } + + if (!$this->configFile && $localConfig = $this->getLocalConfigFile()) { + $this->loadConfigFile($localConfig); + } } /** @@ -135,111 +152,33 @@ public function getConfigFile() return $this->configFile; } - foreach ($this->getConfigDirs() as $dir) { - $file = $dir . '/config.php'; - if (@is_file($file)) { - return $this->configFile = $file; - } - - $file = $dir . '/rc.php'; - if (@is_file($file)) { - return $this->configFile = $file; - } - } - } - - /** - * Helper function to get the proper home directory. - * - * @return string - */ - private function getPsyHome() - { - if ($home = getenv('HOME')) { - return $home . '/.psysh'; - } - - if (defined('PHP_WINDOWS_VERSION_MAJOR')) { - // Check the old default - $oldHome = strtr(getenv('HOMEDRIVE') . '/' . getenv('HOMEPATH') . '/.psysh', '\\', '/'); - - if ($appData = getenv('APPDATA')) { - $home = strtr($appData, '\\', '/') . '/PsySH'; + $files = ConfigPaths::getConfigFiles(array('config.php', 'rc.php'), $this->configDir); - if (is_dir($oldHome) && !is_dir($home)) { - $msg = sprintf( - "Config directory found at '%s'. Please move it to '%s'.", - strtr($oldHome, '/', '\\'), - strtr($home, '/', '\\') - ); - trigger_error($msg, E_USER_DEPRECATED); - - return $oldHome; - } - - return $home; + if (!empty($files)) { + if ($this->warnOnMultipleConfigs && count($files) > 1) { + $msg = sprintf('Multiple configuration files found: %s. Using %s', implode($files, ', '), $files[0]); + trigger_error($msg, E_USER_NOTICE); } - } - } - - /** - * Get potential config directory paths. - * - * If a `configDir` option was explicitly set, returns an array containing - * just that directory. - * - * Otherwise, it returns `~/.psysh` and all XDG Base Directory config directories: - * - * http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html - * - * @return string[] - */ - protected function getConfigDirs() - { - if (isset($this->configDir)) { - return array($this->configDir); - } - - $xdg = new Xdg(); - $dirs = array_map(function ($dir) { - return $dir . '/psysh'; - }, $xdg->getConfigDirs()); - if ($home = $this->getPsyHome()) { - array_unshift($dirs, $home); + return $files[0]; } - - return $dirs; } /** - * Get potential data directory paths. - * - * If a `dataDir` option was explicitly set, returns an array containing - * just that directory. + * Get the local PsySH config file. * - * Otherwise, it returns `~/.psysh` and all XDG Base Directory data directories: + * Searches for a project specific config file `.psysh.php` in the current + * working directory. * - * http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html - * - * @return string[] + * @return string */ - protected function getDataDirs() + public function getLocalConfigFile() { - if (isset($this->dataDir)) { - return array($this->dataDir); - } - - $xdg = new Xdg(); - $dirs = array_map(function ($dir) { - return $dir . '/psysh'; - }, $xdg->getDataDirs()); + $localConfig = getenv('PWD') . '/.psysh.php'; - if ($home = $this->getPsyHome()) { - array_unshift($dirs, $home); + if (@is_file($localConfig)) { + return $localConfig; } - - return $dirs; } /** @@ -256,7 +195,7 @@ public function loadConfig(array $options) } } - foreach (array('commands', 'tabCompletionMatchers', 'presenters') as $option) { + foreach (array('commands', 'tabCompletionMatchers', 'casters') as $option) { if (isset($options[$option])) { $method = 'add' . ucfirst($option); $this->$method($options[$option]); @@ -376,8 +315,7 @@ public function setRuntimeDir($dir) public function getRuntimeDir() { if (!isset($this->runtimeDir)) { - $xdg = new Xdg(); - $this->runtimeDir = $xdg->getRuntimeDir() . '/psysh'; + $this->runtimeDir = ConfigPaths::getRuntimeDir(); } if (!is_dir($this->runtimeDir)) { @@ -387,30 +325,6 @@ public function getRuntimeDir() return $this->runtimeDir; } - /** - * @deprecated Use setRuntimeDir() instead. - * - * @param string $dir - */ - public function setTempDir($dir) - { - trigger_error("'setTempDir' is deprecated. Use 'setRuntimeDir' instead.", E_USER_DEPRECATED); - - return $this->setRuntimeDir($dir); - } - - /** - * @deprecated Use getRuntimeDir() instead. - * - * @return string - */ - public function getTempDir() - { - trigger_error("'getTempDir' is deprecated. Use 'getRuntimeDir' instead.", E_USER_DEPRECATED); - - return $this->getRuntimeDir(); - } - /** * Set the readline history file path. * @@ -435,33 +349,42 @@ public function getHistoryFile() return $this->historyFile; } - foreach ($this->getConfigDirs() as $dir) { - $file = $dir . '/psysh_history'; - if (@is_file($file)) { - return $this->historyFile = $file; - } + // Deprecation warning for incorrect psysh_history path. + // TODO: remove this before v0.8.0 + $xdg = new Xdg(); + $oldHistory = $xdg->getHomeConfigDir() . '/psysh_history'; + if (@is_file($oldHistory)) { + $dir = $this->configDir ?: ConfigPaths::getCurrentConfigDir(); + $newHistory = $dir . '/psysh_history'; + + $msg = sprintf( + "PsySH history file found at '%s'. Please delete it or move it to '%s'.", + strtr($oldHistory, '\\', '/'), + $newHistory + ); + trigger_error($msg, E_USER_DEPRECATED); - $file = $dir . '/history'; - if (@is_file($file)) { - return $this->historyFile = $file; - } + return $this->historyFile = $oldHistory; } - // fallback: create our own - if (isset($this->configDir)) { - $dir = $this->configDir; - } else { - $xdg = new Xdg(); - $dir = $xdg->getHomeConfigDir(); + $files = ConfigPaths::getConfigFiles(array('psysh_history', 'history'), $this->configDir); + + if (!empty($files)) { + if ($this->warnOnMultipleConfigs && count($files) > 1) { + $msg = sprintf('Multiple history files found: %s. Using %s', implode($files, ', '), $files[0]); + trigger_error($msg, E_USER_NOTICE); + } + + return $this->historyFile = $files[0]; } + // fallback: create our own history file + $dir = $this->configDir ?: ConfigPaths::getCurrentConfigDir(); if (!is_dir($dir)) { mkdir($dir, 0700, true); } - $file = $dir . '/psysh_history'; - - return $this->historyFile = $file; + return $this->historyFile = $dir . '/psysh_history'; } /** @@ -683,6 +606,69 @@ public function requireSemicolons() return $this->requireSemicolons; } + /** + * Enable or disable Unicode in PsySH specific output. + * + * Note that this does not disable Unicode output in general, it just makes + * it so PsySH won't output any itself. + * + * @param bool $useUnicode + */ + public function setUseUnicode($useUnicode) + { + $this->useUnicode = (bool) $useUnicode; + } + + /** + * Check whether to use Unicode in PsySH specific output. + * + * Note that this does not disable Unicode output in general, it just makes + * it so PsySH won't output any itself. + * + * @return bool + */ + public function useUnicode() + { + if (isset($this->useUnicode)) { + return $this->useUnicode; + } + + // TODO: detect `chsh` != 65001 on Windows and return false + return true; + } + + /** + * Set the error logging level. + * + * @see self::errorLoggingLevel + * + * @param bool $errorLoggingLevel + */ + public function setErrorLoggingLevel($errorLoggingLevel) + { + $this->errorLoggingLevel = (E_ALL | E_STRICT) & $errorLoggingLevel; + } + + /** + * Get the current error logging level. + * + * By default, PsySH will automatically log all errors, regardless of the + * current `error_reporting` level. Additionally, if the `error_reporting` + * level warrants, an ErrorException will be thrown. + * + * Set `errorLoggingLevel` to 0 to prevent logging non-thrown errors. Set it + * to any valid error_reporting value to log only errors which match that + * level. + * + * http://php.net/manual/en/function.error-reporting.php + * + * @return int + */ + public function errorLoggingLevel() + { + return $this->errorLoggingLevel; + } + /** * Set a CodeCleaner service instance. * @@ -755,12 +741,33 @@ public function setOutput(ShellOutput $output) public function getOutput() { if (!isset($this->output)) { - $this->output = new ShellOutput(ShellOutput::VERBOSITY_NORMAL, null, null, $this->getPager()); + $this->output = new ShellOutput( + ShellOutput::VERBOSITY_NORMAL, + $this->getOutputDecorated(), + null, + $this->getPager() + ); } return $this->output; } + /** + * Get the decoration (i.e. color) setting for the Shell Output service. + * + * @return null|bool 3-state boolean corresponding to the current color mode + */ + public function getOutputDecorated() + { + if ($this->colorMode() === self::COLOR_MODE_AUTO) { + return; + } elseif ($this->colorMode() === self::COLOR_MODE_FORCED) { + return true; + } elseif ($this->colorMode() === self::COLOR_MODE_DISABLED) { + return false; + } + } + /** * Set the OutputPager service. * @@ -946,11 +953,14 @@ public function getManualDbFile() return $this->manualDbFile; } - foreach ($this->getDataDirs() as $dir) { - $file = $dir . '/php_manual.sqlite'; - if (@is_file($file)) { - return $this->manualDbFile = $file; + $files = ConfigPaths::getDataFiles(array('php_manual.sqlite'), $this->dataDir); + if (!empty($files)) { + if ($this->warnOnMultipleConfigs && count($files) > 1) { + $msg = sprintf('Multiple manual database files found: %s. Using %s', implode($files, ', '), $files[0]); + trigger_error($msg, E_USER_NOTICE); } + + return $this->manualDbFile = $files[0]; } } @@ -980,29 +990,85 @@ public function getManualDb() } /** - * Add an array of Presenters. + * Add an array of casters definitions. + * + * @param array $casters + */ + public function addCasters(array $casters) + { + $this->getPresenter()->addCasters($casters); + } + + /** + * Get the Presenter service. * - * @param array $presenters + * @return Presenter */ - public function addPresenters(array $presenters) + public function getPresenter() { - $manager = $this->getPresenterManager(); - foreach ($presenters as $presenter) { - $manager->addPresenter($presenter); + if (!isset($this->presenter)) { + $this->presenter = new Presenter($this->getOutput()->getFormatter()); } + + return $this->presenter; + } + + /** + * Enable or disable warnings on multiple configuration or data files. + * + * @see self::warnOnMultipleConfigs() + * + * @param bool $warnOnMultipleConfigs + */ + public function setWarnOnMultipleConfigs($warnOnMultipleConfigs) + { + $this->warnOnMultipleConfigs = (bool) $warnOnMultipleConfigs; + } + + /** + * Check whether to warn on multiple configuration or data files. + * + * By default, PsySH will use the file with highest precedence, and will + * silently ignore all others. With this enabled, a warning will be emitted + * (but not an exception thrown) if multiple configuration or data files + * are found. + * + * This will default to true in a future release, but is false for now. + * + * @return bool + */ + public function warnOnMultipleConfigs() + { + return $this->warnOnMultipleConfigs; } /** - * Get the PresenterManager service. + * Set the current color mode. * - * @return PresenterManager + * @param string $colorMode */ - public function getPresenterManager() + public function setColorMode($colorMode) { - if (!isset($this->presenters)) { - $this->presenters = new PresenterManager(); + $validColorModes = array( + self::COLOR_MODE_AUTO, + self::COLOR_MODE_FORCED, + self::COLOR_MODE_DISABLED, + ); + + if (in_array($colorMode, $validColorModes)) { + $this->colorMode = $colorMode; + } else { + throw new \InvalidArgumentException('invalid color mode: ' . $colorMode); } + } - return $this->presenters; + /** + * Get the current color mode. + * + * @return string + */ + public function colorMode() + { + return $this->colorMode; } } diff --git a/application/vendor/psy/psysh/src/Psy/ConsoleColorFactory.php b/application/vendor/psy/psysh/src/Psy/ConsoleColorFactory.php new file mode 100644 index 0000000..5808771 --- /dev/null +++ b/application/vendor/psy/psysh/src/Psy/ConsoleColorFactory.php @@ -0,0 +1,79 @@ +colorMode = $colorMode; + } + + /** + * Get a `ConsoleColor` instance configured according to the given color + * mode. + * + * @return ConsoleColor + */ + public function getConsoleColor() + { + if ($this->colorMode === Configuration::COLOR_MODE_AUTO) { + return $this->getDefaultConsoleColor(); + } elseif ($this->colorMode === Configuration::COLOR_MODE_FORCED) { + return $this->getForcedConsoleColor(); + } elseif ($this->colorMode === Configuration::COLOR_MODE_DISABLED) { + return $this->getDisabledConsoleColor(); + } + } + + private function getDefaultConsoleColor() + { + $color = new ConsoleColor(); + $color->addTheme(Highlighter::LINE_NUMBER, array('blue')); + + return $color; + } + + private function getForcedConsoleColor() + { + $color = $this->getDefaultConsoleColor(); + $color->setForceStyle(true); + + return $color; + } + + private function getDisabledConsoleColor() + { + $color = new ConsoleColor(); + + $color->addTheme(Highlighter::TOKEN_STRING, array('none')); + $color->addTheme(Highlighter::TOKEN_COMMENT, array('none')); + $color->addTheme(Highlighter::TOKEN_KEYWORD, array('none')); + $color->addTheme(Highlighter::TOKEN_DEFAULT, array('none')); + $color->addTheme(Highlighter::TOKEN_HTML, array('none')); + $color->addTheme(Highlighter::ACTUAL_LINE_MARK, array('none')); + $color->addTheme(Highlighter::LINE_NUMBER, array('none')); + + return $color; + } +} diff --git a/application/vendor/psy/psysh/src/Psy/Context.php b/application/vendor/psy/psysh/src/Psy/Context.php index 515174f..6018891 100644 --- a/application/vendor/psy/psysh/src/Psy/Context.php +++ b/application/vendor/psy/psysh/src/Psy/Context.php @@ -1,9 +1,9 @@ rawMessage = $message; parent::__construct(sprintf('Exit: %s', $message), $code, $previous); diff --git a/application/vendor/psy/psysh/src/Psy/Exception/DeprecatedException.php b/application/vendor/psy/psysh/src/Psy/Exception/DeprecatedException.php new file mode 100644 index 0000000..91bc14e --- /dev/null +++ b/application/vendor/psy/psysh/src/Psy/Exception/DeprecatedException.php @@ -0,0 +1,20 @@ +rawMessage = $message; if (!empty($filename) && preg_match('{Psy[/\\\\]ExecutionLoop}', $filename)) { - $filename = null; + $filename = ''; } switch ($severity) { @@ -83,6 +83,6 @@ public function getRawMessage() */ public static function throwException($errno, $errstr, $errfile, $errline) { - throw new ErrorException($errstr, 0, $errno, $errfile, $errline); + throw new self($errstr, 0, $errno, $errfile, $errline); } } diff --git a/application/vendor/psy/psysh/src/Psy/Exception/Exception.php b/application/vendor/psy/psysh/src/Psy/Exception/Exception.php index 68c524c..4d9345f 100644 --- a/application/vendor/psy/psysh/src/Psy/Exception/Exception.php +++ b/application/vendor/psy/psysh/src/Psy/Exception/Exception.php @@ -1,9 +1,9 @@ rawMessage = $message; $message = sprintf('PHP Fatal error: %s in %s on line %d', $message, $filename ?: "eval()'d code", $lineno); diff --git a/application/vendor/psy/psysh/src/Psy/Exception/ParseErrorException.php b/application/vendor/psy/psysh/src/Psy/Exception/ParseErrorException.php index 543eed0..25b8145 100644 --- a/application/vendor/psy/psysh/src/Psy/Exception/ParseErrorException.php +++ b/application/vendor/psy/psysh/src/Psy/Exception/ParseErrorException.php @@ -1,9 +1,9 @@ rawMessage = $message; parent::__construct($message, $code, $previous); diff --git a/application/vendor/psy/psysh/src/Psy/Exception/ThrowUpException.php b/application/vendor/psy/psysh/src/Psy/Exception/ThrowUpException.php index 262486e..c289026 100644 --- a/application/vendor/psy/psysh/src/Psy/Exception/ThrowUpException.php +++ b/application/vendor/psy/psysh/src/Psy/Exception/ThrowUpException.php @@ -1,9 +1,9 @@ rawMessage = $message; + $message = preg_replace('/, called in .*?: eval\\(\\)\'d code/', '', $message); + parent::__construct(sprintf('TypeError: %s', $message), $code); + } + + /** + * Get the raw (unformatted) message for this error. + * + * @return string + */ + public function getRawMessage() + { + return $this->rawMessage; + } + + /** + * Create a TypeErrorException from a TypeError. + * + * @param \TypeError $e + * + * @return TypeErrorException + */ + public static function fromTypeError(\TypeError $e) + { + return new self($e->getMessage(), $e->getLine()); + } +} diff --git a/application/vendor/psy/psysh/src/Psy/ExecutionLoop/ForkingLoop.php b/application/vendor/psy/psysh/src/Psy/ExecutionLoop/ForkingLoop.php index 0e537ea..f695519 100644 --- a/application/vendor/psy/psysh/src/Psy/ExecutionLoop/ForkingLoop.php +++ b/application/vendor/psy/psysh/src/Psy/ExecutionLoop/ForkingLoop.php @@ -1,9 +1,9 @@ $value) { + // No need to return magic variables + if ($key === '_' || $key === '_e') { + continue; + } + + // Resources don't error, but they don't serialize well either. + if (is_resource($value) || $value instanceof \Closure) { + continue; + } + try { - serialize($value); + @serialize($value); $serializable[$key] = $value; } catch (\Exception $e) { // we'll just ignore this one... } } - return serialize($serializable); + return @serialize($serializable); } } diff --git a/application/vendor/psy/psysh/src/Psy/ExecutionLoop/Loop.php b/application/vendor/psy/psysh/src/Psy/ExecutionLoop/Loop.php index a8efdbe..45ff1b1 100644 --- a/application/vendor/psy/psysh/src/Psy/ExecutionLoop/Loop.php +++ b/application/vendor/psy/psysh/src/Psy/ExecutionLoop/Loop.php @@ -1,9 +1,9 @@ flushCode()); + $_ = eval($__psysh__->flushCode() ?: Loop::NOOP_INPUT); restore_error_handler(); ob_end_flush(); @@ -95,6 +98,12 @@ public function run(Shell $shell) $__psysh__->writeException($_e); throw $_e; + } catch (\TypeError $_e) { + restore_error_handler(); + if (ob_get_level() > 0) { + ob_end_clean(); + } + $__psysh__->writeException(TypeErrorException::fromTypeError($_e)); } catch (\Exception $_e) { restore_error_handler(); if (ob_get_level() > 0) { @@ -103,8 +112,6 @@ public function run(Shell $shell) $__psysh__->writeException($_e); } - // a bit of housekeeping - unset($__psysh_out__); $__psysh__->afterLoop(); } while (true); }; @@ -153,7 +160,7 @@ public function afterLoop() /** * Decide whether to bind the execution loop. * - * @return boolean + * @return bool */ protected static function bindLoop() { diff --git a/application/vendor/psy/psysh/src/Psy/Formatter/CodeFormatter.php b/application/vendor/psy/psysh/src/Psy/Formatter/CodeFormatter.php index e757e96..d992c48 100644 --- a/application/vendor/psy/psysh/src/Psy/Formatter/CodeFormatter.php +++ b/application/vendor/psy/psysh/src/Psy/Formatter/CodeFormatter.php @@ -1,9 +1,9 @@ getFileName()) { if (!is_file($fileName)) { throw new RuntimeException('Source code unavailable.'); @@ -38,8 +42,8 @@ public static function format(\Reflector $reflector) $start = $reflector->getStartLine(); $end = $reflector->getEndLine() - $start; - $colors = new ConsoleColor(); - $colors->addTheme('line_number', array('blue')); + $factory = new ConsoleColorFactory($colorMode); + $colors = $factory->getConsoleColor(); $highlighter = new Highlighter($colors); return $highlighter->getCodeSnippet($file, $start, 0, $end); diff --git a/application/vendor/psy/psysh/src/Psy/Formatter/DocblockFormatter.php b/application/vendor/psy/psysh/src/Psy/Formatter/DocblockFormatter.php index 1912d4b..71d93ed 100644 --- a/application/vendor/psy/psysh/src/Psy/Formatter/DocblockFormatter.php +++ b/application/vendor/psy/psysh/src/Psy/Formatter/DocblockFormatter.php @@ -1,9 +1,9 @@ getInterfaceNames(); if (!empty($interfaces)) { + sort($interfaces); + $chunks[] = 'implements'; $chunks[] = implode(', ', array_map(function ($name) { return sprintf('%s', $name); diff --git a/application/vendor/psy/psysh/src/Psy/Output/OutputPager.php b/application/vendor/psy/psysh/src/Psy/Output/OutputPager.php index ccc3d33..9d8f5bf 100644 --- a/application/vendor/psy/psysh/src/Psy/Output/OutputPager.php +++ b/application/vendor/psy/psysh/src/Psy/Output/OutputPager.php @@ -1,9 +1,9 @@ setStyle('const', new OutputFormatterStyle('cyan')); $formatter->setStyle('class', new OutputFormatterStyle('blue', null, array('underscore'))); $formatter->setStyle('function', new OutputFormatterStyle(null)); + $formatter->setStyle('default', new OutputFormatterStyle(null)); // Types $formatter->setStyle('number', new OutputFormatterStyle('magenta')); diff --git a/application/vendor/psy/psysh/src/Psy/ParserFactory.php b/application/vendor/psy/psysh/src/Psy/ParserFactory.php new file mode 100644 index 0000000..22b3b99 --- /dev/null +++ b/application/vendor/psy/psysh/src/Psy/ParserFactory.php @@ -0,0 +1,91 @@ += 2.0 — does. + * + * @return bool + */ + public function hasKindsSupport() + { + return class_exists('PhpParser\ParserFactory'); + } + + /** + * Default kind (if supported, based on current interpreter's version). + * + * @return string|null + */ + public function getDefaultKind() + { + if ($this->hasKindsSupport()) { + return version_compare(PHP_VERSION, '7.0', '>=') ? static::ONLY_PHP7 : static::ONLY_PHP5; + } + } + + /** + * New parser instance with given kind. + * + * @param string|null $kind One of class constants (only for PHP parser 2.0 and above). + * + * @return Parser + */ + public function createParser($kind = null) + { + if ($this->hasKindsSupport()) { + $originalFactory = new OriginalParserFactory(); + + $kind = $kind ?: $this->getDefaultKind(); + + if (!in_array($kind, static::getPossibleKinds())) { + throw new \InvalidArgumentException('Unknown parser kind'); + } + + $parser = $originalFactory->create(constant('PhpParser\ParserFactory::' . $kind)); + } else { + if ($kind !== null) { + throw new \InvalidArgumentException('Install PHP Parser v2.x to specify parser kind'); + } + + $parser = new Parser(new Lexer()); + } + + return $parser; + } +} diff --git a/application/vendor/psy/psysh/src/Psy/Presenter/ArrayPresenter.php b/application/vendor/psy/psysh/src/Psy/Presenter/ArrayPresenter.php deleted file mode 100644 index e93947b..0000000 --- a/application/vendor/psy/psysh/src/Psy/Presenter/ArrayPresenter.php +++ /dev/null @@ -1,174 +0,0 @@ -\\<%s #%s>'; - - /** - * ArrayPresenter can present arrays. - * - * @param mixed $value - * - * @return boolean - */ - public function canPresent($value) - { - return is_array($value) || $this->isArrayObject($value); - } - - /** - * Determine whether something is an ArrayObject. - * - * This is a useful extension point for Presenter subclasses for Array-like - * objects which aren't necessarily subclasses of ArrayObject. - * - * @return boolean - */ - protected function isArrayObject($value) - { - return $value instanceof \ArrayObject; - } - - /** - * Present a reference to the array. - * - * @param array $value - * - * @return string - */ - public function presentRef($value) - { - if ($this->isArrayObject($value)) { - return $this->presentArrayObjectRef($value); - } elseif (empty($value)) { - return '[]'; - } else { - return sprintf('Array(%d)', count($value)); - } - } - - /** - * Present a reference to an ArrayObject. - * - * @param ArrayObject $value - * - * @return string - */ - protected function presentArrayObjectRef($value) - { - return sprintf(self::ARRAY_OBJECT_FMT, get_class($value), spl_object_hash($value)); - } - - /** - * Get an array of values from an ArrayObject. - * - * This is a useful extension point for Presenter subclasses for Array-like - * objects which aren't necessarily subclasses of ArrayObject. - * - * @return array - */ - protected function getArrayObjectValue($value) - { - return iterator_to_array($value->getIterator()); - } - - /** - * Present the array. - * - * @param object $value - * @param int $depth (default: null) - * @param int $options One of Presenter constants - * - * @return string - */ - protected function presentValue($value, $depth = null, $options = 0) - { - $prefix = ''; - if ($this->isArrayObject($value)) { - $prefix = $this->presentArrayObjectRef($value) . ' '; - $value = $this->getArrayObjectValue($value); - } - - if (empty($value) || $depth === 0) { - return $prefix . $this->presentRef($value); - } - - $formatted = array(); - foreach ($value as $key => $val) { - $formatted[$key] = $this->presentSubValue($val); - } - - if ($this->shouldShowKeys($value)) { - $pad = max(array_map('strlen', array_map(array('Psy\Util\Json', 'encode'), array_keys($value)))); - foreach ($formatted as $key => $val) { - $formatted[$key] = $this->formatKeyAndValue($key, $val, $pad); - } - } else { - $formatted = array_map(array($this, 'indentValue'), $formatted); - } - - $template = sprintf('%s[%s%s%%s%s]', $prefix, PHP_EOL, self::INDENT, PHP_EOL); - $glue = sprintf(',%s%s', PHP_EOL, self::INDENT); - - return sprintf($template, implode($glue, $formatted)); - } - - /** - * Helper method for determining whether to render array keys. - * - * Keys are only rendered for associative arrays or non-consecutive integer- - * based arrays. - * - * @param array $array - * - * @return boolean - */ - protected function shouldShowKeys(array $array) - { - $i = 0; - foreach (array_keys($array) as $k) { - if ($k !== $i++) { - return true; - } - } - - return false; - } - - /** - * Format a key => value pair. - * - * @param mixed $key - * @param string $value - * @param integer $pad Maximum key width, to align the hashrockets. - * - * @return string - */ - protected function formatKeyAndValue($key, $value, $pad = 0) - { - $type = is_string($value) ? 'string' : 'number'; - $tpl = "<$type>%-${pad}s => %s"; - - return sprintf( - $tpl, - Json::encode($key), - $this->indentValue($value) - ); - } -} diff --git a/application/vendor/psy/psysh/src/Psy/Presenter/ClosurePresenter.php b/application/vendor/psy/psysh/src/Psy/Presenter/ClosurePresenter.php deleted file mode 100644 index 3abae0c..0000000 --- a/application/vendor/psy/psysh/src/Psy/Presenter/ClosurePresenter.php +++ /dev/null @@ -1,173 +0,0 @@ -function (%s)%s { ... }'; - const USE_FMT = ' use (%s)'; - - protected $manager; - - /** - * PresenterManagerAware interface. - * - * @param PresenterManager $manager - */ - public function setPresenterManager(PresenterManager $manager) - { - $this->manager = $manager; - } - - /** - * ClosurePresenter can present closures. - * - * @param mixed $value - * - * @return boolean - */ - public function canPresent($value) - { - return $value instanceof \Closure; - } - - /** - * Present a reference to the value. - * - * @param mixed $value - * - * @return string - */ - public function presentRef($value) - { - return sprintf( - self::FMT, - $this->formatParams($value), - $this->formatStaticVariables($value) - ); - } - - /** - * Present the Closure. - * - * @param \Closure $value - * @param int $depth (default:null) - * @param int $options One of Presenter constants - * - * @return string - */ - public function present($value, $depth = null, $options = 0) - { - return $this->presentRef($value); - } - - /** - * Format a list of Closure parameters. - * - * @param \Closure $value - * - * @return string - */ - protected function formatParams(\Closure $value) - { - $r = new \ReflectionFunction($value); - $params = array_map(array($this, 'formatParam'), $r->getParameters()); - - return implode(', ', $params); - } - - /** - * Format an individual Closure parameter. - * - * @param \ReflectionParameter $param - * - * @return string - */ - protected function formatParam(\ReflectionParameter $param) - { - $ret = $this->formatParamName($param->name); - - if ($param->isOptional()) { - $ret .= ' = '; - - if (self::isParamDefaultValueConstant($param)) { - $name = $param->getDefaultValueConstantName(); - $ret .= '' . $name . ''; - } elseif ($param->isDefaultValueAvailable()) { - $ret .= $this->manager->presentRef($param->getDefaultValue()); - } else { - $ret .= '?'; - } - } - - return $ret; - } - - /** - * Format static (used) variable names. - * - * @param \Closure $value - * - * @return string - */ - protected function formatStaticVariables(\Closure $value) - { - $r = new \ReflectionFunction($value); - $used = $r->getStaticVariables(); - if (empty($used)) { - return ''; - } - - $names = array_map(array($this, 'formatParamName'), array_keys($used)); - - return sprintf( - self::USE_FMT, - implode(', ', $names) - ); - } - - /** - * Format a Closure parameter name. - * - * @param string $name - * - * @return string - */ - protected function formatParamName($name) - { - return sprintf('$%s', $name); - } - - /** - * Check whether a parameter's default value is a constant. - * - * This is only supported in PHP >= 5.4.3, and currently unimplemented in - * HHVM. - * - * @param \ReflectionParameter $param - * - * @return boolean - */ - protected static function isParamDefaultValueConstant(\ReflectionParameter $param) - { - // HHVM doesn't currently support `isDefaultValueConstant`, skip for now - // see https://github.com/facebook/hhvm/issues/3812 - if (defined('HHVM_VERSION')) { - return false; - } - - return version_compare(PHP_VERSION, '5.4.3', '>=') && $param->isDefaultValueConstant(); - } -} diff --git a/application/vendor/psy/psysh/src/Psy/Presenter/ExceptionPresenter.php b/application/vendor/psy/psysh/src/Psy/Presenter/ExceptionPresenter.php deleted file mode 100644 index 00c1c01..0000000 --- a/application/vendor/psy/psysh/src/Psy/Presenter/ExceptionPresenter.php +++ /dev/null @@ -1,52 +0,0 @@ -message' => $value->getMessage(), - 'code' => $value->getCode(), - 'file' => $value->getFile(), - 'line' => $value->getLine(), - 'previous' => $value->getPrevious(), - ); - - return array_merge(array_filter($props), parent::getProperties($value, $class, $options)); - } -} diff --git a/application/vendor/psy/psysh/src/Psy/Presenter/MongoCursorPresenter.php b/application/vendor/psy/psysh/src/Psy/Presenter/MongoCursorPresenter.php deleted file mode 100644 index 813eac5..0000000 --- a/application/vendor/psy/psysh/src/Psy/Presenter/MongoCursorPresenter.php +++ /dev/null @@ -1,119 +0,0 @@ -info(); - - $this->normalizeQueryArray($info); - $this->normalizeFieldsArray($info); - $this->unsetBoringFields($info); - $this->unsetIgnoredFields($info); - - if ($value->dead()) { - $info['dead'] = true; - } - - return array_merge( - $info, - parent::getProperties($value, $class, $propertyFilter) - ); - } - - /** - * Normalize (empty) cursor query to always be an actual array. - * - * @param array $info Cursor info - */ - private function normalizeQueryArray(array &$info) - { - if (isset($info['query'])) { - if ($info['query'] === new \StdClass()) { - $info['query'] = array(); - } elseif (is_array($info['query']) && isset($info['query']['$query'])) { - if ($info['query']['$query'] === new \StdClass()) { - $info['query']['$query'] = array(); - } - } - } - } - - /** - * Normalize (empty) cursor fields to always be an actual array. - * - * @param array $info Cursor info - */ - private function normalizeFieldsArray(array &$info) - { - if (isset($info['fields']) && $info['fields'] === new \StdClass()) { - $info['fields'] = array(); - } - } - - /** - * Unset boring fields from the Cursor info array. - * - * @param array $info Cursor info - */ - private function unsetBoringFields(array &$info) - { - foreach (self::$boringFields as $boring) { - if ($info[$boring] === 0) { - unset($info[$boring]); - } - } - } - - /** - * Unset ignored fields from the Cursor info array. - * - * @param array $info Cursor info - */ - private function unsetIgnoredFields(array &$info) - { - foreach (self::$ignoreFields as $ignore) { - if (isset($info[$ignore])) { - unset($info[$ignore]); - } - } - } -} diff --git a/application/vendor/psy/psysh/src/Psy/Presenter/ObjectPresenter.php b/application/vendor/psy/psysh/src/Psy/Presenter/ObjectPresenter.php deleted file mode 100644 index 285da9b..0000000 --- a/application/vendor/psy/psysh/src/Psy/Presenter/ObjectPresenter.php +++ /dev/null @@ -1,143 +0,0 @@ -\\<%s #%s>'; - - /** - * ObjectPresenter can present objects. - * - * @param mixed $value - * - * @return boolean - */ - public function canPresent($value) - { - return is_object($value); - } - - /** - * Present a reference to the object. - * - * @param object $value - * - * @return string - */ - public function presentRef($value) - { - return sprintf(self::FMT, get_class($value), spl_object_hash($value)); - } - - /** - * Present the object. - * - * @param object $value - * @param int $depth (default: null) - * @param int $options One of Presenter constants - * - * @return string - */ - protected function presentValue($value, $depth = null, $options = 0) - { - if ($depth === 0) { - return $this->presentRef($value); - } - - $class = new \ReflectionObject($value); - $propertyFilter = \ReflectionProperty::IS_PUBLIC; - if ($options & Presenter::VERBOSE) { - $propertyFilter |= \ReflectionProperty::IS_PRIVATE | \ReflectionProperty::IS_PROTECTED; - } - $props = $this->getProperties($value, $class, $propertyFilter); - - return sprintf('%s %s', $this->presentRef($value), $this->formatProperties($props)); - } - - /** - * Format object properties. - * - * @param array $props - * - * @return string - */ - protected function formatProperties($props) - { - if (empty($props)) { - return '{}'; - } - - $formatted = array(); - foreach ($props as $name => $value) { - $formatted[] = sprintf('%s: %s', $name, $this->indentValue($this->presentSubValue($value))); - } - - $template = sprintf('{%s%s%%s%s}', PHP_EOL, self::INDENT, PHP_EOL); - $glue = sprintf(',%s%s', PHP_EOL, self::INDENT); - - return sprintf($template, implode($glue, $formatted)); - } - - /** - * Get an array of object properties. - * - * @param object $value - * @param \ReflectionClass $class - * @param int $propertyFilter One of \ReflectionProperty constants - * - * @return array - */ - protected function getProperties($value, \ReflectionClass $class, $propertyFilter) - { - $deprecated = false; - set_error_handler(function ($errno, $errstr) use (&$deprecated) { - if (in_array($errno, array(E_DEPRECATED, E_USER_DEPRECATED))) { - $deprecated = true; - } else { - // not a deprecation error, let someone else handle this - return false; - } - }); - - $props = array(); - foreach ($class->getProperties($propertyFilter) as $prop) { - $deprecated = false; - - $prop->setAccessible(true); - $val = $prop->getValue($value); - - if (!$deprecated) { - $props[$this->propertyKey($prop)] = $val; - } - } - - restore_error_handler(); - - return $props; - } - - protected function propertyKey(\ReflectionProperty $prop) - { - $key = $prop->getName(); - if ($prop->isProtected()) { - return sprintf('%s', $key); - } elseif ($prop->isPrivate()) { - return sprintf('%s', $key); - } - - return $key; - } -} diff --git a/application/vendor/psy/psysh/src/Psy/Presenter/PHPParserPresenter.php b/application/vendor/psy/psysh/src/Psy/Presenter/PHPParserPresenter.php deleted file mode 100644 index 0e540e1..0000000 --- a/application/vendor/psy/psysh/src/Psy/Presenter/PHPParserPresenter.php +++ /dev/null @@ -1,69 +0,0 @@ -\\<%s>'; - - /** - * PHPParserPresenter can present parse trees. - * - * @param mixed $value - * - * @return boolean - */ - public function canPresent($value) - { - return $value instanceof Node; - } - - /** - * Present a reference to the object. - * - * @param object $value - * - * @return string - */ - public function presentRef($value) - { - return sprintf(self::FMT, get_class($value)); - } - - /** - * Get an array of object properties. - * - * @param object $value - * @param \ReflectionClass $class - * @param int $propertyFilter One of \ReflectionProperty constants - * - * @return array - */ - protected function getProperties($value, \ReflectionClass $class, $propertyFilter) - { - $props = array(); - - $props['type'] = $value->getType(); - $props['attributes'] = $value->getAttributes(); - - foreach ($value->getSubNodeNames() as $name) { - $props[$name] = $value->$name; - } - - return $props; - } -} diff --git a/application/vendor/psy/psysh/src/Psy/Presenter/Presenter.php b/application/vendor/psy/psysh/src/Psy/Presenter/Presenter.php deleted file mode 100644 index 5bcb645..0000000 --- a/application/vendor/psy/psysh/src/Psy/Presenter/Presenter.php +++ /dev/null @@ -1,52 +0,0 @@ -addPresenters(array( - new ObjectPresenter(), // lowest precedence - new ArrayPresenter(), - new ClosurePresenter(), - new ExceptionPresenter(), - new ResourcePresenter(), - new ScalarPresenter(), - )); - } - - /** - * Register Presenters. - * - * Presenters should be passed in an array from lowest to highest precedence. - * - * @see self::addPresenter - * - * @param Presenter[] $presenters - */ - public function addPresenters(array $presenters) - { - foreach ($presenters as $presenter) { - $this->addPresenter($presenter); - } - } - - /** - * Register a Presenter. - * - * If multiple Presenters are able to present a value, the most recently - * registered Presenter takes precedence. - * - * If $presenter is already registered, it will be re-registered as the - * highest precedence Presenter. - * - * @param Presenter $presenter - */ - public function addPresenter(Presenter $presenter) - { - $this->removePresenter($presenter); - - if ($presenter instanceof PresenterManagerAware) { - $presenter->setPresenterManager($this); - } - - array_unshift($this->presenters, $presenter); - } - - /** - * Unregister a Presenter. - * - * @param Presenter $presenter - */ - public function removePresenter(Presenter $presenter) - { - foreach ($this->presenters as $i => $p) { - if ($p === $presenter) { - unset($this->presenters[$i]); - } - } - } - - /** - * Check whether a Presenter is registered for $value. - * - * @param mixed $value - * - * @return boolean - */ - public function canPresent($value) - { - return $this->getPresenter($value) !== null; - } - - /** - * Present a reference to the value. - * - * @param mixed $value - * - * @throws \InvalidArgumentException If no Presenter is registered for $value - * - * @return string - */ - public function presentRef($value) - { - if ($presenter = $this->getPresenter($value)) { - return $presenter->presentRef($value); - } - - throw new \InvalidArgumentException(sprintf('Unable to present %s', $value)); - } - - /** - * Present a full representation of the value. - * - * If $depth is 0, the value will be presented as a ref instead. - * - * @param mixed $value - * @param int $depth (default: null) - * @param int $options One of Presenter constants - * - * @throws \InvalidArgumentException If no Presenter is registered for $value - * - * @return string - */ - public function present($value, $depth = null, $options = 0) - { - if ($presenter = $this->getPresenter($value)) { - if ($depth === 0) { - return $presenter->presentRef($value); - } - - return $presenter->present($value, $depth, $options); - } - - throw new \InvalidArgumentException(sprintf('Unable to present %s', $value)); - } - - /** - * IteratorAggregate interface. - * - * @return \ArrayIterator - */ - public function getIterator() - { - return new \ArrayIterator(array_reverse($this->presenters)); - } - - /** - * Find the highest precedence Presenter available for $value. - * - * Returns null if none is present. - * - * @param mixed $value - * - * @return null|Presenter - */ - protected function getPresenter($value) - { - foreach ($this->presenters as $presenter) { - if ($presenter->canPresent($value)) { - return $presenter; - } - } - } -} diff --git a/application/vendor/psy/psysh/src/Psy/Presenter/PresenterManagerAware.php b/application/vendor/psy/psysh/src/Psy/Presenter/PresenterManagerAware.php deleted file mode 100644 index cffd6e8..0000000 --- a/application/vendor/psy/psysh/src/Psy/Presenter/PresenterManagerAware.php +++ /dev/null @@ -1,26 +0,0 @@ -manager = $manager; - } - - /** - * Present the recursive value. - * - * Subclasses should implement `presentValue` rather than overriding this - * method. - * - * @see self::presentValue() - * - * @param mixed $value - * @param int $depth (default: null) - * @param int $options One of Presenter constants - * - * @return string - */ - public function present($value, $depth = null, $options = 0) - { - $this->setDepth($depth); - - return $this->presentValue($value, $depth, $options); - } - - /** - * RecursivePresenter subclasses implement a `presentValue` method for - * actually doing the presentation. - * - * @param mixed $value - * - * @return string - */ - abstract protected function presentValue($value); - - /** - * Keep track of the remaining recursion depth. - * - * If $depth is null, set it to `self::MAX_DEPTH`. - * - * @param int $depth (default: null) - */ - protected function setDepth($depth = null) - { - $this->depth = $depth === null ? self::MAX_DEPTH : $depth; - } - - /** - * Present a sub-value. - * - * If the current recursion depth is greater than self::MAX_DEPTH, it will - * present a reference, otherwise it will present the full representation - * of the sub-value. - * - * @see PresenterManager::present() - * @see PresenterManager::presentRef() - * - * @param mixed $value - * @param int $options One of Presenter constants - * - * @return string - */ - protected function presentSubValue($value, $options = 0) - { - $depth = $this->depth; - $formatted = $this->manager->present($value, $depth - 1, $options); - $this->setDepth($depth); - - return $formatted; - } - - /** - * Indent every line of a value. - * - * @param string $value - * - * @return string - */ - protected function indentValue($value) - { - return str_replace(PHP_EOL, PHP_EOL . self::INDENT, $value); - } -} diff --git a/application/vendor/psy/psysh/src/Psy/Presenter/ResourcePresenter.php b/application/vendor/psy/psysh/src/Psy/Presenter/ResourcePresenter.php deleted file mode 100644 index 77f61d5..0000000 --- a/application/vendor/psy/psysh/src/Psy/Presenter/ResourcePresenter.php +++ /dev/null @@ -1,115 +0,0 @@ -\\<%s resource #%s>'; - - /** - * Resource presenter can present resources. - * - * @param mixed $value - * - * @return boolean - */ - public function canPresent($value) - { - return is_resource($value); - } - - /** - * Present a reference to the value. - * - * @param mixed $value - * - * @return string - */ - public function presentRef($value) - { - $type = get_resource_type($value); - if ($type === 'stream') { - $meta = stream_get_meta_data($value); - $type = sprintf('%s stream', $meta['stream_type']); - } - - $id = str_replace('Resource id #', '', (string) $value); - - return sprintf(self::FMT, $type, $id); - } - - /** - * Present the resource. - * - * @param resource $value - * @param int $depth (default: null) - * @param int $options One of Presenter constants - * - * @return string - */ - public function presentValue($value, $depth = null, $options = 0) - { - if ($depth === 0 || !($options & Presenter::VERBOSE)) { - return $this->presentRef($value); - } - - return sprintf('%s %s', $this->presentRef($value), $this->formatMetadata($value)); - } - - /** - * Format resource metadata. - * - * @param resource $value - * - * @return string - */ - protected function formatMetadata($value) - { - $props = array(); - - switch (get_resource_type($value)) { - case 'stream': - $props = stream_get_meta_data($value); - break; - - case 'curl': - $props = curl_getinfo($value); - break; - - case 'xml': - $props = array( - 'current_byte_index' => xml_get_current_byte_index($value), - 'current_column_number' => xml_get_current_column_number($value), - 'current_line_number' => xml_get_current_line_number($value), - 'error_code' => xml_get_error_code($value), - ); - break; - } - - if (empty($props)) { - return '{}'; - } - - $formatted = array(); - foreach ($props as $name => $value) { - $formatted[] = sprintf('%s: %s', $name, $this->indentValue($this->presentSubValue($value))); - } - - $template = sprintf('{%s%s%%s%s}', PHP_EOL, self::INDENT, PHP_EOL); - $glue = sprintf(',%s%s', PHP_EOL, self::INDENT); - - return sprintf($template, implode($glue, $formatted)); - } -} diff --git a/application/vendor/psy/psysh/src/Psy/Presenter/ScalarPresenter.php b/application/vendor/psy/psysh/src/Psy/Presenter/ScalarPresenter.php deleted file mode 100644 index bd19a0c..0000000 --- a/application/vendor/psy/psysh/src/Psy/Presenter/ScalarPresenter.php +++ /dev/null @@ -1,109 +0,0 @@ -present($value); - } - - /** - * Present the scalar value. - * - * @param mixed $value - * @param int $depth (default: null) - * @param int $options One of Presenter constants - * - * @return string - */ - public function present($value, $depth = null, $options = 0) - { - $formatted = $this->format($value); - - if ($typeStyle = $this->getTypeStyle($value)) { - return sprintf('<%s>%s', $typeStyle, $formatted, $typeStyle); - } else { - return $formatted; - } - } - - private function format($value) - { - // Handle floats. - if (is_float($value)) { - // Some are unencodable... - if (is_nan($value)) { - return 'NAN'; - } elseif (is_infinite($value)) { - return $value === INF ? 'INF' : '-INF'; - } - - // ... others just encode as ints when there's no decimal - $float = Json::encode($value); - if (strpos($float, '.') === false) { - $float .= '.0'; - } - - return $float; - } - - return OutputFormatter::escape(Json::encode($value)); - } - - /** - * Get the output style for a value of a given type. - * - * @param mixed $value - * - * @return string - */ - private function getTypeStyle($value) - { - if (is_int($value) || is_float($value)) { - return 'number'; - } elseif (is_string($value)) { - return 'string'; - } elseif (is_bool($value) || is_null($value)) { - return 'bool'; - } - } -} diff --git a/application/vendor/psy/psysh/src/Psy/Readline/GNUReadline.php b/application/vendor/psy/psysh/src/Psy/Readline/GNUReadline.php index 5663448..0a37b73 100644 --- a/application/vendor/psy/psysh/src/Psy/Readline/GNUReadline.php +++ b/application/vendor/psy/psysh/src/Psy/Readline/GNUReadline.php @@ -1,9 +1,9 @@ >> '; const BUFF_PROMPT = '... '; @@ -80,18 +80,6 @@ public function __construct(Configuration $config = null) parent::__construct('Psy Shell', self::VERSION); $this->config->setShell($this); - // auto completer needs shell to be linked to configuration because of the context aware matchers - if ($this->config->getTabCompletion()) { - $this->completion = $this->config->getAutoCompleter(); - $this->addTabCompletionMatchers($this->config->getTabCompletionMatchers()); - foreach ($this->getTabCompletionMatchers() as $matcher) { - if ($matcher instanceof ContextAware) { - $matcher->setContext($this->context); - } - $this->completion->addMatcher($matcher); - } - $this->completion->activate(); - } } /** @@ -158,7 +146,7 @@ public static function debug(array $vars = array(), $bind = null) /** * Adds a command object. * - * {@inheritDoc} + * {@inheritdoc} * * @param BaseCommand $command A Symfony Console Command object * @@ -171,8 +159,8 @@ public function add(BaseCommand $command) $ret->setContext($this->context); } - if ($ret instanceof PresenterManagerAware) { - $ret->setPresenterManager($this->config->getPresenterManager()); + if ($ret instanceof PresenterAware) { + $ret->setPresenter($this->config->getPresenter()); } } @@ -207,9 +195,9 @@ protected function getDefaultCommands() new Command\ListCommand(), new Command\DumpCommand(), new Command\DocCommand(), - new Command\ShowCommand(), + new Command\ShowCommand($this->config->colorMode()), new Command\WtfCommand(), - new Command\WhereamiCommand(), + new Command\WhereamiCommand($this->config->colorMode()), new Command\ThrowUpCommand(), new Command\TraceCommand(), new Command\BufferCommand(), @@ -267,10 +255,12 @@ public function setOutput(OutputInterface $output) * @param InputInterface $input An Input instance * @param OutputInterface $output An Output instance * - * @return integer 0 if everything went fine, or an error code + * @return int 0 if everything went fine, or an error code */ public function run(InputInterface $input = null, OutputInterface $output = null) { + $this->initializeTabCompletion(); + if ($input === null && !isset($_SERVER['argv'])) { $input = new ArgvInput(array()); } @@ -279,7 +269,11 @@ public function run(InputInterface $input = null, OutputInterface $output = null $output = $this->config->getOutput(); } - return parent::run($input, $output); + try { + return parent::run($input, $output); + } catch (\Exception $e) { + $this->writeException($e); + } } /** @@ -290,7 +284,7 @@ public function run(InputInterface $input = null, OutputInterface $output = null * @param InputInterface $input An Input instance * @param OutputInterface $output An Output instance * - * @return integer 0 if everything went fine, or an error code + * @return int 0 if everything went fine, or an error code */ public function doRun(InputInterface $input, OutputInterface $output) { @@ -299,7 +293,7 @@ public function doRun(InputInterface $input, OutputInterface $output) $this->resetCodeBuffer(); $this->setAutoExit(false); - $this->setCatchExceptions(true); + $this->setCatchExceptions(false); $this->readline->readHistory(); @@ -312,8 +306,6 @@ public function doRun(InputInterface $input, OutputInterface $output) try { $this->loop->run($this); } catch (ThrowUpException $e) { - $this->setCatchExceptions(false); - throw $e->getPrevious(); } } @@ -612,14 +604,14 @@ public function writeStdout($out, $phase = PHP_OUTPUT_HANDLER_END) } // Incremental flush - if (!empty($out) && !$isCleaning) { + if ($out !== '' && !$isCleaning) { $this->output->write($out, false, ShellOutput::OUTPUT_RAW); $this->outputWantsNewline = (substr($out, -1) !== "\n"); } // Output buffering is done! if ($this->outputWantsNewline && $phase & PHP_OUTPUT_HANDLER_END) { - $this->output->writeln(''); + $this->output->writeln(sprintf('', $this->config->useUnicode() ? '⏎' : '\\n')); $this->outputWantsNewline = false; } } @@ -643,18 +635,6 @@ public function writeReturnValue($ret) $this->output->writeln(self::RETVAL . str_replace(PHP_EOL, PHP_EOL . $indent, $ret)); } - /** - * Write a caught Exception to stdout. - * - * @see self::renderException - * - * @param \Exception $e - */ - public function writeException(\Exception $e) - { - $this->renderException($e, $this->output); - } - /** * Renders a caught Exception. * @@ -666,7 +646,7 @@ public function writeException(\Exception $e) * @param \Exception $e An exception instance * @param OutputInterface $output An OutputInterface instance */ - public function renderException($e, $output) + public function writeException(\Exception $e) { $this->context->setLastException($e); @@ -676,7 +656,7 @@ public function renderException($e, $output) } $severity = ($e instanceof \ErrorException) ? $this->getSeverity($e) : 'error'; - $output->writeln(sprintf('<%s>%s', $severity, OutputFormatter::escape($message), $severity)); + $this->output->writeln(sprintf('<%s>%s', $severity, OutputFormatter::escape($message), $severity)); $this->resetCodeBuffer(); } @@ -724,9 +704,14 @@ protected function getSeverity(\ErrorException $e) * threshold. This should probably only be used in the inner execution loop * of the shell, as most of the time a thrown exception is much more useful. * + * If the error type matches the `errorLoggingLevel` config, it will be + * logged as well, regardless of the `error_reporting` level. + * * @see \Psy\Exception\ErrorException::throwException * @see \Psy\Shell::writeException * + * @throws \Psy\Exception\ErrorException depending on the current error_reporting level. + * * @param int $errno Error type * @param string $errstr Message * @param string $errfile Filename @@ -736,7 +721,7 @@ public function handleError($errno, $errstr, $errfile, $errline) { if ($errno & error_reporting()) { ErrorException::throwException($errno, $errstr, $errfile, $errline); - } else { + } elseif ($errno & $this->config->errorLoggingLevel()) { // log it and continue... $this->writeException(new ErrorException($errstr, 0, $errno, $errfile, $errline)); } @@ -745,7 +730,7 @@ public function handleError($errno, $errstr, $errfile, $errline) /** * Format a value for display. * - * @see PresenterManager::present + * @see Presenter::present * * @param mixed $val * @@ -753,7 +738,7 @@ public function handleError($errno, $errstr, $errfile, $errline) */ protected function presentValue($val) { - return $this->config->getPresenterManager()->present($val); + return $this->config->getPresenter()->present($val); } /** @@ -828,7 +813,7 @@ protected function readline() */ protected function getHeader() { - return sprintf("", $this->getVersion()); + return sprintf('', $this->getVersion()); } /** @@ -838,7 +823,9 @@ protected function getHeader() */ public function getVersion() { - return sprintf("Psy Shell %s (PHP %s — %s)", self::VERSION, phpversion(), php_sapi_name()); + $separator = $this->config->useUnicode() ? '—' : '-'; + + return sprintf('Psy Shell %s (PHP %s %s %s)', self::VERSION, phpversion(), $separator, php_sapi_name()); } /** @@ -875,4 +862,26 @@ protected function autocomplete($text) return $this->getScopeVariableNames(); } } + + /** + * Initialize tab completion matchers. + * + * If tab completion is enabled this adds tab completion matchers to the + * auto completer and sets context if needed. + */ + protected function initializeTabCompletion() + { + // auto completer needs shell to be linked to configuration because of the context aware matchers + if ($this->config->getTabCompletion()) { + $this->completion = $this->config->getAutoCompleter(); + $this->addTabCompletionMatchers($this->config->getTabCompletionMatchers()); + foreach ($this->getTabCompletionMatchers() as $matcher) { + if ($matcher instanceof ContextAware) { + $matcher->setContext($this->context); + } + $this->completion->addMatcher($matcher); + } + $this->completion->activate(); + } + } } diff --git a/application/vendor/psy/psysh/src/Psy/TabCompletion/AutoCompleter.php b/application/vendor/psy/psysh/src/Psy/TabCompletion/AutoCompleter.php index 65504cb..37a2081 100644 --- a/application/vendor/psy/psysh/src/Psy/TabCompletion/AutoCompleter.php +++ b/application/vendor/psy/psysh/src/Psy/TabCompletion/AutoCompleter.php @@ -1,9 +1,9 @@ getVariable($objectName); + + try { + $object = $this->getVariable($objectName); + } catch (InvalidArgumentException $e) { + return array(); + } return array_filter( array_keys(get_class_vars(get_class($object))), @@ -46,7 +53,7 @@ function ($var) use ($input) { } /** - * {@inheritDoc} + * {@inheritdoc} */ public function hasMatched(array $tokens) { diff --git a/application/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php b/application/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php index 95b3677..ebb9f56 100644 --- a/application/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php +++ b/application/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php @@ -1,9 +1,9 @@ getVariable($objectName); + + try { + $object = $this->getVariable($objectName); + } catch (InvalidArgumentException $e) { + return array(); + } return array_filter( get_class_methods($object), @@ -46,7 +53,7 @@ function ($var) use ($input) { } /** - * {@inheritDoc} + * {@inheritdoc} */ public function hasMatched(array $tokens) { diff --git a/application/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/VariablesMatcher.php b/application/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/VariablesMatcher.php index a91e032..4835ca4 100644 --- a/application/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/VariablesMatcher.php +++ b/application/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/VariablesMatcher.php @@ -1,9 +1,9 @@ filter = $filter; + + return parent::cloneVar($var, $filter); + } + + /** + * {@inheritdoc} + */ + protected function castResource(Stub $stub, $isNested) + { + return Caster::EXCLUDE_VERBOSE & $this->filter ? array() : parent::castResource($stub, $isNested); + } +} diff --git a/application/vendor/psy/psysh/src/Psy/VarDumper/Dumper.php b/application/vendor/psy/psysh/src/Psy/VarDumper/Dumper.php new file mode 100644 index 0000000..9db93e0 --- /dev/null +++ b/application/vendor/psy/psysh/src/Psy/VarDumper/Dumper.php @@ -0,0 +1,103 @@ +formatter = $formatter; + parent::__construct(); + $this->setColors(false); + } + + /** + * {@inheritdoc} + */ + public function enterHash(Cursor $cursor, $type, $class, $hasChild) + { + if (Cursor::HASH_INDEXED === $type || Cursor::HASH_ASSOC === $type) { + $class = 0; + } + parent::enterHash($cursor, $type, $class, $hasChild); + } + + /** + * {@inheritdoc} + */ + protected function dumpKey(Cursor $cursor) + { + if (Cursor::HASH_INDEXED !== $cursor->hashType) { + parent::dumpKey($cursor); + } + } + + protected function style($style, $value, $attr = array()) + { + if ('ref' === $style) { + $value = strtr($value, '@', '#'); + } + $style = $this->styles[$style]; + $value = "<{$style}>" . $this->formatter->escape($value) . ""; + $cchr = $this->styles['cchr']; + $value = preg_replace_callback(self::$controlCharsRx, function ($c) use ($cchr) { + switch ($c[0]) { + case "\t": + $c = '\t'; + break; + case "\n": + $c = '\n'; + break; + case "\v": + $c = '\v'; + break; + case "\f": + $c = '\f'; + break; + case "\r": + $c = '\r'; + break; + case "\033": + $c = '\e'; + break; + default: + $c = sprintf('\x%02X', ord($c[0])); + break; + } + + return "<{$cchr}>{$c}"; + }, $value); + + return $value; + } + + /** + * {@inheritdoc} + */ + protected function dumpLine($depth, $endOfValue = false) + { + if ($endOfValue && 0 < $depth) { + $this->line .= ','; + } + $this->line = $this->formatter->format($this->line); + parent::dumpLine($depth, $endOfValue); + } +} diff --git a/application/vendor/psy/psysh/src/Psy/VarDumper/Presenter.php b/application/vendor/psy/psysh/src/Psy/VarDumper/Presenter.php new file mode 100644 index 0000000..8c61a1f --- /dev/null +++ b/application/vendor/psy/psysh/src/Psy/VarDumper/Presenter.php @@ -0,0 +1,123 @@ + 'number', + 'const' => 'const', + 'str' => 'string', + 'cchr' => 'default', + 'note' => 'class', + 'ref' => 'default', + 'public' => 'public', + 'protected' => 'protected', + 'private' => 'private', + 'meta' => 'comment', + 'key' => 'comment', + 'index' => 'number', + ); + + public function __construct(OutputFormatter $formatter) + { + $this->dumper = new Dumper($formatter); + $this->dumper->setStyles($this->styles); + + $this->cloner = new Cloner(); + $this->cloner->addCasters(array('*' => function ($obj, array $a, Stub $stub, $isNested, $filter = 0) { + if ($filter || $isNested) { + if ($obj instanceof \Exception) { + $a = Caster::filter($a, Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_EMPTY, $this->exceptionsImportants); + } else { + $a = Caster::filter($a, Caster::EXCLUDE_PROTECTED | Caster::EXCLUDE_PRIVATE); + } + } + + return $a; + })); + } + + /** + * Register casters. + * + * @see http://symfony.com/doc/current/components/var_dumper/advanced.html#casters + * + * @param callable[] $casters A map of casters. + */ + public function addCasters(array $casters) + { + $this->cloner->addCasters($casters); + } + + /** + * Present a reference to the value. + * + * @param mixed $value + * + * @return string + */ + public function presentRef($value) + { + return $this->present($value, 0); + } + + /** + * Present a full representation of the value. + * + * If $depth is 0, the value will be presented as a ref instead. + * + * @param mixed $value + * @param int $depth (default: null) + * @param int $options One of Presenter constants + * + * @return string + */ + public function present($value, $depth = null, $options = 0) + { + $data = $this->cloner->cloneVar($value, !($options & self::VERBOSE) ? Caster::EXCLUDE_VERBOSE : 0); + + if (null !== $depth) { + $data = $data->withMaxDepth($depth); + } + + $output = ''; + $this->dumper->dump($data, function ($line, $depth) use (&$output) { + if ($depth >= 0) { + if ('' !== $output) { + $output .= PHP_EOL; + } + $output .= str_repeat(' ', $depth) . $line; + } + }); + + return OutputFormatter::escape($output); + } +} diff --git a/application/vendor/psy/psysh/src/Psy/VarDumper/PresenterAware.php b/application/vendor/psy/psysh/src/Psy/VarDumper/PresenterAware.php new file mode 100644 index 0000000..4b4999b --- /dev/null +++ b/application/vendor/psy/psysh/src/Psy/VarDumper/PresenterAware.php @@ -0,0 +1,26 @@ + Shell::VERSION, + 'PHP version' => PHP_VERSION, + 'default includes' => $config->getDefaultIncludes(), + 'require semicolons' => $config->requireSemicolons(), + 'error logging level' => $config->errorLoggingLevel(), + 'config file' => array( + 'default config file' => $config->getConfigFile(), + 'local config file' => $config->getLocalConfigFile(), + 'PSYSH_CONFIG env' => getenv('PSYSH_CONFIG'), + ), + // 'config dir' => $config->getConfigDir(), + // 'data dir' => $config->getDataDir(), + // 'runtime dir' => $config->getRuntimeDir(), + ); + + if ($config->hasReadline()) { + $info = readline_info(); + + $readline = array( + 'readline available' => true, + 'readline enabled' => $config->useReadline(), + 'readline service' => get_class($config->getReadline()), + 'readline library' => $info['library_version'], + ); + + if ($info['readline_name'] !== '') { + $readline['readline name'] = $info['readline_name']; + } + } else { + $readline = array( + 'readline available' => false, + ); + } + + $pcntl = array( + 'pcntl available' => function_exists('pcntl_signal'), + 'posix available' => function_exists('posix_getpid'), + ); + + $history = array( + 'history file' => $config->getHistoryFile(), + 'history size' => $config->getHistorySize(), + 'erase duplicates' => $config->getEraseDuplicates(), + ); + + $docs = array( + 'manual db file' => $config->getManualDbFile(), + 'sqlite available' => true, + ); + + try { + if ($db = $config->getManualDb()) { + if ($q = $db->query('SELECT * FROM meta;')) { + $q->setFetchMode(\PDO::FETCH_KEY_PAIR); + $meta = $q->fetchAll(); + + foreach ($meta as $key => $val) { + switch ($key) { + case 'built_at': + $d = new \DateTime('@' . $val); + $val = $d->format(\DateTime::RFC2822); + break; + } + $key = 'db ' . str_replace('_', ' ', $key); + $docs[$key] = $val; + } + } else { + $docs['db schema'] = '0.1.0'; + } + } + } catch (Exception\RuntimeException $e) { + if ($e->getMessage() === 'SQLite PDO driver not found') { + $docs['sqlite available'] = false; + } else { + throw $e; + } + } + + $autocomplete = array( + 'tab completion enabled' => $config->getTabCompletion(), + 'custom matchers' => array_map('get_class', $config->getTabCompletionMatchers()), + ); + + return array_merge($core, compact('pcntl', 'readline', 'history', 'docs', 'autocomplete')); + } +} + +if (!function_exists('Psy\bin')) { + /** + * `psysh` command line executable. + * + * @return Closure + */ + function bin() + { + return function () { + $usageException = null; + + $input = new ArgvInput(); + try { + $input->bind(new InputDefinition(array( + new InputOption('help', 'h', InputOption::VALUE_NONE), + new InputOption('config', 'c', InputOption::VALUE_REQUIRED), + new InputOption('version', 'v', InputOption::VALUE_NONE), + new InputOption('cwd', null, InputOption::VALUE_REQUIRED), + new InputOption('color', null, InputOption::VALUE_NONE), + new InputOption('no-color', null, InputOption::VALUE_NONE), + + new InputArgument('include', InputArgument::IS_ARRAY), + ))); + } catch (\RuntimeException $e) { + $usageException = $e; + } + + $config = array(); + + // Handle --config + if ($configFile = $input->getOption('config')) { + $config['configFile'] = $configFile; + } + + // Handle --color and --no-color + if ($input->getOption('color') && $input->getOption('no-color')) { + $usageException = new \RuntimeException('Using both "--color" and "--no-color" options is invalid.'); + } elseif ($input->getOption('color')) { + $config['colorMode'] = Configuration::COLOR_MODE_FORCED; + } elseif ($input->getOption('no-color')) { + $config['colorMode'] = Configuration::COLOR_MODE_DISABLED; + } + + $shell = new Shell(new Configuration($config)); + + // Handle --help + if ($usageException !== null || $input->getOption('help')) { + if ($usageException !== null) { + echo $usageException->getMessage() . PHP_EOL . PHP_EOL; + } + + $version = $shell->getVersion(); + $name = basename(reset($_SERVER['argv'])); + echo <<getOption('version')) { + echo $shell->getVersion() . PHP_EOL; + exit(0); + } + + // Pass additional arguments to Shell as 'includes' + $shell->setIncludes($input->getArgument('include')); + + try { + // And go! + $shell->run(); + } catch (Exception $e) { + echo $e->getMessage() . PHP_EOL; + + // TODO: this triggers the "exited unexpectedly" logic in the + // ForkingLoop, so we can't exit(1) after starting the shell... + // fix this :) + + // exit(1); + } + }; + } +} diff --git a/application/vendor/psy/psysh/test/Psy/Test/AutoloaderTest.php b/application/vendor/psy/psysh/test/Psy/Test/AutoloaderTest.php index 311c006..3fb46d3 100644 --- a/application/vendor/psy/psysh/test/Psy/Test/AutoloaderTest.php +++ b/application/vendor/psy/psysh/test/Psy/Test/AutoloaderTest.php @@ -1,9 +1,9 @@ getParser()->parse($code); - } catch (\PHPParser_Error $e) { + } catch (\PhpParser\Error $e) { if (!$this->parseErrorIsEOF($e)) { throw ParseErrorException::fromParseError($e); } @@ -47,7 +47,7 @@ protected function parse($code, $prefix = 'getParser()->parse($code . ';'); - } catch (\PHPParser_Error $e) { + } catch (\PhpParser\Error $e) { return false; } } @@ -73,7 +73,8 @@ protected function assertProcessesAs($from, $to) private function getParser() { if (!isset($this->parser)) { - $this->parser = new Parser(new Lexer()); + $parserFactory = new ParserFactory(); + $this->parser = $parserFactory->createParser(); } return $this->parser; @@ -88,10 +89,10 @@ private function getPrinter() return $this->printer; } - private function parseErrorIsEOF(\PHPParser_Error $e) + private function parseErrorIsEOF(\PhpParser\Error $e) { $msg = $e->getRawMessage(); - return ($msg === "Unexpected token EOF") || (strpos($msg, "Syntax error, unexpected EOF") !== false); + return ($msg === 'Unexpected token EOF') || (strpos($msg, 'Syntax error, unexpected EOF') !== false); } } diff --git a/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ExitPassTest.php b/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ExitPassTest.php new file mode 100644 index 0000000..861afab --- /dev/null +++ b/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ExitPassTest.php @@ -0,0 +1,51 @@ +setPass(new ExitPass()); + } + + /** + * @dataProvider dataProviderExitStatement + */ + public function testExitStatement($from, $to) + { + $this->assertProcessesAs($from, $to); + } + + /** + * Data provider for testExitStatement. + * + * @return array + */ + public function dataProviderExitStatement() + { + return array( + array('exit;', $this->expectedExceptionString), + array('exit();', $this->expectedExceptionString), + array('die;', $this->expectedExceptionString), + array('if (true) { exit; }', "if (true) {\n $this->expectedExceptionString\n}"), + array('if (false) { exit; }', "if (false) {\n $this->expectedExceptionString\n}"), + ); + } +} diff --git a/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/Fixtures/ClassWithCallStatic.php b/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/Fixtures/ClassWithCallStatic.php index 84fc062..8f8624b 100644 --- a/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/Fixtures/ClassWithCallStatic.php +++ b/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/Fixtures/ClassWithCallStatic.php @@ -1,9 +1,9 @@ fail(); } catch (FatalErrorException $e) { if (version_compare(PHP_VERSION, '5.5', '>=')) { - $this->assertContains('Cannot use isset() on the result of a function call (you can use "null !== func()" instead)', $e->getMessage()); + $this->assertContains( + 'Cannot use isset() on the result of a function call (you can use "null !== func()" instead)', + $e->getMessage() + ); } else { $this->assertContains("Can't use function return value in write context", $e->getMessage()); } diff --git a/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ImplicitReturnPassTest.php b/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ImplicitReturnPassTest.php index db95c54..7186262 100644 --- a/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ImplicitReturnPassTest.php +++ b/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ImplicitReturnPassTest.php @@ -1,9 +1,9 @@ markTestSkipped(); + } + + $this->setPass(new StrictTypesPass()); + } + + public function testProcess() + { + $this->assertProcessesAs('declare(strict_types=1)', 'declare (strict_types=1);'); + $this->assertProcessesAs('null', "declare (strict_types=1);\nnull;"); + $this->assertProcessesAs('declare(strict_types=0)', 'declare (strict_types=0);'); + $this->assertProcessesAs('null', 'null;'); + } + + /** + * @dataProvider invalidDeclarations + * @expectedException \Psy\Exception\FatalErrorException + */ + public function testInvalidDeclarations($declaration) + { + $stmts = $this->parse($declaration); + $this->traverser->traverse($stmts); + } + + public function invalidDeclarations() + { + return array( + array('declare(strict_types=-1)'), + array('declare(strict_types=2)'), + array('declare(strict_types="foo")'), + ); + } +} diff --git a/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/UseStatementPassTest.php b/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/UseStatementPassTest.php index 426b078..d3a7a75 100644 --- a/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/UseStatementPassTest.php +++ b/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/UseStatementPassTest.php @@ -1,9 +1,9 @@ =')) { + $valid[] = array('interface A {} A::class'); + $valid[] = array('interface A {} A::CLASS'); + $valid[] = array('class A {} A::class'); + $valid[] = array('class A {} A::CLASS'); + $valid[] = array('A::class'); + $valid[] = array('A::CLASS'); + } + + return $valid; } } diff --git a/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ValidConstantPassTest.php b/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ValidConstantPassTest.php index 10dff04..65a6d6b 100644 --- a/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ValidConstantPassTest.php +++ b/application/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ValidConstantPassTest.php @@ -1,9 +1,9 @@ assertEquals($expected, $cc->clean($lines, $requireSemicolons)); } - public function codeProvider() + public function semicolonCodeProvider() { return array( array(array('true'), false, 'return true;'), @@ -33,7 +33,63 @@ public function codeProvider() array(array('true'), true, false), array(array('echo "foo";', 'true'), false, "echo 'foo';\nreturn true;"), - array(array('echo "foo";', 'true'), true , false), + array(array('echo "foo";', 'true'), true, false), + ); + } + + /** + * @dataProvider unclosedStatementsProvider + */ + public function testUnclosedStatements(array $lines, $isUnclosed) + { + $cc = new CodeCleaner(); + $res = $cc->clean($lines); + + if ($isUnclosed) { + $this->assertFalse($res); + } else { + $this->assertNotFalse($res); + } + } + + public function unclosedStatementsProvider() + { + return array( + array(array('echo "'), true), + array(array('echo \''), true), + array(array('if (1) {'), true), + + array(array('echo ""'), false), + array(array("echo ''"), false), + array(array('if (1) {}'), false), + + array(array("\$content = <<clean(array($code)); + } + + public function invalidStatementsProvider() + { + return array( + array('function "what'), + array("function 'what"), + array('echo }'), + array('echo {'), + array('if (1) }'), + array('echo """'), + array("echo '''"), + array('$foo "bar'), + array('$foo \'bar'), ); } } diff --git a/application/vendor/psy/psysh/test/Psy/Test/ConfigurationTest.php b/application/vendor/psy/psysh/test/Psy/Test/ConfigurationTest.php index aee0f05..58f3a3b 100644 --- a/application/vendor/psy/psysh/test/Psy/Test/ConfigurationTest.php +++ b/application/vendor/psy/psysh/test/Psy/Test/ConfigurationTest.php @@ -1,9 +1,9 @@ assertEquals(function_exists('pcntl_signal'), $config->hasPcntl()); $this->assertEquals(function_exists('pcntl_signal'), $config->usePcntl()); $this->assertFalse($config->requireSemicolons()); + $this->assertSame(Configuration::COLOR_MODE_AUTO, $config->colorMode()); } public function testGettersAndSetters() @@ -99,6 +100,8 @@ public function testLoadConfig() 'pager' => $pager, 'loop' => $loop, 'requireSemicolons' => true, + 'errorLoggingLevel' => E_ERROR | E_WARNING, + 'colorMode' => Configuration::COLOR_MODE_FORCED, )); $this->assertFalse($config->useReadline()); @@ -107,6 +110,8 @@ public function testLoadConfig() $this->assertSame($pager, $config->getPager()); $this->assertSame($loop, $config->getLoop()); $this->assertTrue($config->requireSemicolons()); + $this->assertEquals(E_ERROR | E_WARNING, $config->errorLoggingLevel()); + $this->assertSame(Configuration::COLOR_MODE_FORCED, $config->colorMode()); } public function testLoadConfigFile() @@ -117,38 +122,35 @@ public function testLoadConfigFile() $this->assertStringStartsWith($runtimeDir, realpath($config->getTempFile('foo', 123))); $this->assertStringStartsWith($runtimeDir, realpath(dirname($config->getPipe('pipe', 123)))); - - // This will be deprecated, but we want to actually test the value. - $was = error_reporting(error_reporting() & ~E_USER_DEPRECATED); - $this->assertStringStartsWith($runtimeDir, realpath($config->getTempDir())); - error_reporting($was); - $this->assertStringStartsWith($runtimeDir, realpath($config->getRuntimeDir())); $this->assertEquals(function_exists('readline'), $config->useReadline()); $this->assertFalse($config->usePcntl()); + $this->assertEquals(E_ALL & ~E_NOTICE, $config->errorLoggingLevel()); } - /** - * @expectedException PHPUnit_Framework_Error_Deprecated - */ - public function testSetTempDirIsDeprecated() + public function testLoadLocalConfigFile() { - $config = new Configuration(); - $config->setTempDir('fake'); - } + $oldPwd = getenv('PWD'); + putenv('PWD=' . realpath(__DIR__ . '/../../fixtures/project/')); - /** - * @expectedException PHPUnit_Framework_Error_Deprecated - */ - public function testGetTempDirIsDeprecated() - { $config = new Configuration(); - $config->getTempDir(); + + // When no configuration file is specified local project config is merged + $this->assertFalse($config->useReadline()); + $this->assertTrue($config->usePcntl()); + + $config = new Configuration(array('configFile' => __DIR__ . '/../../fixtures/config.php')); + + // Defining a configuration file skips loading local project config + $this->assertTrue($config->useReadline()); + $this->assertFalse($config->usePcntl()); + + putenv("PWD=$oldPwd"); } /** - * @expectedException PHPUnit_Framework_Error_Deprecated + * @expectedException Psy\Exception\DeprecatedException */ public function testBaseDirConfigIsDeprecated() { @@ -171,4 +173,69 @@ public function testConfigIncludes() $this->assertCount(1, $includes); $this->assertEquals('/file.php', $includes[0]); } + + public function testGetOutput() + { + $config = new Configuration(); + $output = $config->getOutput(); + + $this->assertInstanceOf('\Psy\Output\ShellOutput', $output); + } + + public function getOutputDecoratedProvider() + { + return array( + 'auto' => array( + null, + Configuration::COLOR_MODE_AUTO, + ), + 'forced' => array( + true, + Configuration::COLOR_MODE_FORCED, + ), + 'disabled' => array( + false, + Configuration::COLOR_MODE_DISABLED, + ), + ); + } + + /** @dataProvider getOutputDecoratedProvider */ + public function testGetOutputDecorated($expectation, $colorMode) + { + $config = new Configuration(); + $config->setColorMode($colorMode); + + $this->assertSame($expectation, $config->getOutputDecorated()); + } + + public function setColorModeValidProvider() + { + return array( + 'auto' => array(Configuration::COLOR_MODE_AUTO), + 'forced' => array(Configuration::COLOR_MODE_FORCED), + 'disabled' => array(Configuration::COLOR_MODE_DISABLED), + ); + } + + /** @dataProvider setColorModeValidProvider */ + public function testSetColorModeValid($colorMode) + { + $config = new Configuration(); + $config->setColorMode($colorMode); + + $this->assertEquals($colorMode, $config->colorMode()); + } + + public function testSetColorModeInvalid() + { + $config = new Configuration(); + $colorMode = 'some invalid mode'; + + $this->setExpectedException( + '\InvalidArgumentException', + 'invalid color mode: some invalid mode' + ); + $config->setColorMode($colorMode); + } } diff --git a/application/vendor/psy/psysh/test/Psy/Test/ConsoleColorFactoryTest.php b/application/vendor/psy/psysh/test/Psy/Test/ConsoleColorFactoryTest.php new file mode 100644 index 0000000..ab3c89b --- /dev/null +++ b/application/vendor/psy/psysh/test/Psy/Test/ConsoleColorFactoryTest.php @@ -0,0 +1,51 @@ +getConsoleColor(); + $themes = $colors->getThemes(); + + $this->assertFalse($colors->isStyleForced()); + $this->assertEquals(array('blue'), $themes['line_number']); + } + + public function testGetConsoleColorForced() + { + $colorMode = Configuration::COLOR_MODE_FORCED; + $factory = new ConsoleColorFactory($colorMode); + $colors = $factory->getConsoleColor(); + $themes = $colors->getThemes(); + + $this->assertTrue($colors->isStyleForced()); + $this->assertEquals(array('blue'), $themes['line_number']); + } + + public function testGetConsoleColorDisabled() + { + $colorMode = Configuration::COLOR_MODE_DISABLED; + $factory = new ConsoleColorFactory($colorMode); + $colors = $factory->getConsoleColor(); + $themes = $colors->getThemes(); + + $this->assertFalse($colors->isStyleForced()); + $this->assertEquals(array('none'), $themes['line_number']); + } +} diff --git a/application/vendor/psy/psysh/test/Psy/Test/Exception/BreakExceptionTest.php b/application/vendor/psy/psysh/test/Psy/Test/Exception/BreakExceptionTest.php index a55e33f..94a90fd 100644 --- a/application/vendor/psy/psysh/test/Psy/Test/Exception/BreakExceptionTest.php +++ b/application/vendor/psy/psysh/test/Psy/Test/Exception/BreakExceptionTest.php @@ -1,9 +1,9 @@ assertTrue($e instanceof Exception); - $this->assertTrue($e instanceof \PHPParser_Error); + $this->assertTrue($e instanceof \PhpParser\Error); $this->assertTrue($e instanceof ParseErrorException); } @@ -35,7 +35,7 @@ public function testMessage() public function testConstructFromParseError() { - $e = ParseErrorException::fromParseError(new \PHPParser_Error('{msg}')); + $e = ParseErrorException::fromParseError(new \PhpParser\Error('{msg}')); $this->assertContains('{msg}', $e->getRawMessage()); $this->assertContains('PHP Parse error:', $e->getMessage()); diff --git a/application/vendor/psy/psysh/test/Psy/Test/Exception/RuntimeExceptionTest.php b/application/vendor/psy/psysh/test/Psy/Test/Exception/RuntimeExceptionTest.php index 6ba59ee..0396a26 100644 --- a/application/vendor/psy/psysh/test/Psy/Test/Exception/RuntimeExceptionTest.php +++ b/application/vendor/psy/psysh/test/Psy/Test/Exception/RuntimeExceptionTest.php @@ -1,9 +1,9 @@ 18| private function ignoreThisMethod(\$arg) + $expected = <<<'EOS' + > 18| private function ignoreThisMethod($arg) 19| { - 20| echo "whot!"; + 20| echo 'whot!'; 21| } EOS; diff --git a/application/vendor/psy/psysh/test/Psy/Test/Formatter/DocblockFormatterTest.php b/application/vendor/psy/psysh/test/Psy/Test/Formatter/DocblockFormatterTest.php index 4717d6b..4aad9a8 100644 --- a/application/vendor/psy/psysh/test/Psy/Test/Formatter/DocblockFormatterTest.php +++ b/application/vendor/psy/psysh/test/Psy/Test/Formatter/DocblockFormatterTest.php @@ -1,9 +1,9 @@ assertEquals($expected, strip_tags(SignatureFormatter::format($reflector))); - // $this->assertEquals( - // , - // strip_tags(SignatureFormatter::format(new \ReflectionFunction('sort'))) - // ); } public function signatureReflectors() @@ -41,13 +37,13 @@ public function signatureReflectors() array( new \ReflectionClass($this), "class Psy\Test\Formatter\SignatureFormatterTest " - . "extends PHPUnit_Framework_TestCase implements " - . "PHPUnit_Framework_SelfDescribing, Countable, " - . "PHPUnit_Framework_Test", + . 'extends PHPUnit_Framework_TestCase implements ' + . 'Countable, PHPUnit_Framework_SelfDescribing, ' + . 'PHPUnit_Framework_Test', ), array( new \ReflectionFunction('implode'), - 'function implode($glue, $pieces)', + defined('HHVM_VERSION') ? 'function implode($arg1, $arg2 = null)' : 'function implode($glue, $pieces)', ), array( new ReflectionConstant($this, 'FOO'), @@ -63,7 +59,9 @@ public function signatureReflectors() ), array( new \ReflectionClass('Psy\CodeCleaner\CodeCleanerPass'), - 'abstract class Psy\CodeCleaner\CodeCleanerPass extends PhpParser\NodeVisitorAbstract implements PhpParser\NodeVisitor', + 'abstract class Psy\CodeCleaner\CodeCleanerPass ' + . 'extends PhpParser\NodeVisitorAbstract ' + . 'implements PhpParser\NodeVisitor', ), ); } diff --git a/application/vendor/psy/psysh/test/Psy/Test/Presenter/ArrayPresenterTest.php b/application/vendor/psy/psysh/test/Psy/Test/Presenter/ArrayPresenterTest.php deleted file mode 100644 index 9111ba7..0000000 --- a/application/vendor/psy/psysh/test/Psy/Test/Presenter/ArrayPresenterTest.php +++ /dev/null @@ -1,127 +0,0 @@ -presenter = new ArrayPresenter(); - - $this->manager = new PresenterManager(); - $this->manager->addPresenter(new ScalarPresenter()); - $this->manager->addPresenter(new ObjectPresenter()); - $this->manager->addPresenter($this->presenter); - } - - /** - * @dataProvider presentData - */ - public function testPresent($array, $expect) - { - $this->assertEquals($expect, self::strip($this->presenter->present($array))); - } - - public function presentData() - { - return array( - array(array(), '[]'), - array(array(1), '[1]'), - array(array(2, "string"), '[2,"string"]'), - array(array('a' => 1, 'b' => 2), '["a"=>1,"b"=>2]'), - ); - } - - /** - * @dataProvider presentRefData - */ - public function testPresentRef($array, $expect) - { - $this->assertEquals($expect, $this->presenter->presentRef($array)); - } - - public function presentRefData() - { - return array( - array(array(), '[]'), - array(array(1), 'Array(1)'), - array(array(1, 2), 'Array(2)'), - array(array(1, 2, 3), 'Array(3)'), - ); - } - - /** - * @dataProvider presentArrayObjectsData - */ - public function testPresentArrayObjects($arrayObj, $expect, $expectRef) - { - $this->assertEquals($expect, $this->presenter->present($arrayObj)); - $this->assertEquals($expectRef, $this->presenter->presentRef($arrayObj)); - } - - public function presentArrayObjectsData() - { - $obj1 = new \ArrayObject(array(1, "string")); - $hash1 = spl_object_hash($obj1); - $ref1 = '\\<ArrayObject #' . $hash1 . '>'; - $expect1 = <<1, - "string" -] -EOS; - - $obj2 = new FakeArrayObject(array('a' => 'AAA', 'b' => 'BBB')); - $hash2 = spl_object_hash($obj2); - $ref2 = '\\<Psy\\Test\\Presenter\\FakeArrayObject #' . $hash2 . '>'; - $expect2 = <<"a" => "AAA", - "b" => "BBB" -] -EOS; - - return array( - array($obj1, $expect1, $ref1), - array($obj2, $expect2, $ref2), - ); - } - - public function testPresentsRecursively() - { - $obj = new \StdClass(); - $array = array(1, $obj, "a"); - $hash = spl_object_hash($obj); - $expected = <<1, - \<stdClass #$hash> {}, - "a" -] -EOS; - - $this->assertEquals($expected, $this->presenter->present($array)); - } - - private static function strip($text) - { - return preg_replace('/\\s/', '', $text); - } -} diff --git a/application/vendor/psy/psysh/test/Psy/Test/Presenter/ClosurePresenterTest.php b/application/vendor/psy/psysh/test/Psy/Test/Presenter/ClosurePresenterTest.php deleted file mode 100644 index fcd3781..0000000 --- a/application/vendor/psy/psysh/test/Psy/Test/Presenter/ClosurePresenterTest.php +++ /dev/null @@ -1,88 +0,0 @@ -presenter = new ClosurePresenter(); - - $this->manager = new PresenterManager(); - $this->manager->addPresenter(new ScalarPresenter()); - $this->manager->addPresenter(new ObjectPresenter()); - $this->manager->addPresenter($this->presenter); - } - - /** - * @dataProvider presentData - */ - public function testPresent($closure, $expect) - { - $this->assertEquals($expect, $this->presenter->present($closure)); - } - - /** - * @dataProvider presentData - */ - public function testPresentRef($closure, $expect) - { - $this->assertEquals($expect, $this->presenter->presentRef($closure)); - } - - public function presentData() - { - $null = null; - $eol = version_compare(PHP_VERSION, '5.4.3', '>=') ? 'PHP_EOL' : '"\n"'; - - return array( - array( - function () { - }, - 'function () { ... }', - ), - array( - function ($foo) { - }, - 'function ($foo) { ... }', - ), - array( - function ($foo, $bar = null) { - }, - 'function ($foo, $bar = null) { ... }', - ), - array( - function ($foo = "bar") { - }, - 'function ($foo = "bar") { ... }', - ), - array( - function ($foo = \PHP_EOL) { - }, - 'function ($foo = ' . $eol . ') { ... }', - ), - array( - function ($foo) use ($eol, $null) { - }, - 'function ($foo) use ($eol, $null) { ... }', - ), - ); - } -} diff --git a/application/vendor/psy/psysh/test/Psy/Test/Presenter/FakeArrayObject.php b/application/vendor/psy/psysh/test/Psy/Test/Presenter/FakeArrayObject.php deleted file mode 100644 index 354194c..0000000 --- a/application/vendor/psy/psysh/test/Psy/Test/Presenter/FakeArrayObject.php +++ /dev/null @@ -1,17 +0,0 @@ -presenter = new ObjectPresenter(); - - $this->manager = new PresenterManager(); - $this->manager->addPresenter(new ScalarPresenter()); - $this->manager->addPresenter(new ArrayPresenter()); - $this->manager->addPresenter($this->presenter); - } - - public function testPresentEmptyObject() - { - $empty = new \StdClass(); - $this->assertEquals( - $this->presenter->presentRef($empty) . ' {}', - $this->presenter->present($empty) - ); - } - - public function testPresentWithDepth() - { - $obj = new \StdClass(); - $obj->name = 'std'; - $obj->type = 'class'; - $obj->tags = array('stuff', 'junk'); - $obj->child = new \StdClass(); - $obj->child->name = 'std, jr'; - - $hash = spl_object_hash($obj); - $childHash = spl_object_hash($obj->child); - - $expected = <<\<stdClass #$hash> { - name: "std", - type: "class", - tags: Array(2), - child: \<stdClass #$childHash> -} -EOS; - - $this->assertStringMatchesFormat($expected, $this->presenter->present($obj, 1)); - } - - public function testPresentWithoutDepth() - { - $obj = new \StdClass(); - $obj->name = 'std'; - $obj->type = 'class'; - $obj->tags = array('stuff', 'junk'); - $obj->child = new \StdClass(); - $obj->child->name = 'std, jr'; - - $hash = spl_object_hash($obj); - $childHash = spl_object_hash($obj->child); - - $expected = <<\<stdClass #$hash> { - name: "std", - type: "class", - tags: [ - "stuff", - "junk" - ], - child: \<stdClass #$childHash> { - name: "std, jr" - } -} -EOS; - - $this->assertStringMatchesFormat($expected, $this->presenter->present($obj)); - } - - public function testPresentRef() - { - $obj = new \StdClass(); - - $formatted = $this->presenter->presentRef($obj); - - $this->assertStringMatchesFormat('\<stdClass #%s>', $formatted); - $this->assertContains(spl_object_hash($obj), $formatted); - } - - public function testPresentVerbose() - { - $obj = new SimpleClass(); - $hash = spl_object_hash($obj); - - $expected = <<\<Psy\Test\Presenter\Fixtures\SimpleClass #$hash> { - hello: "Hello world!", - foo: "bar", - secret: 42 -} -EOS; - - $this->assertStringMatchesFormat($expected, $this->presenter->present($obj, null, Presenter::VERBOSE)); - } -} diff --git a/application/vendor/psy/psysh/test/Psy/Test/Presenter/ResourcePresenterTest.php b/application/vendor/psy/psysh/test/Psy/Test/Presenter/ResourcePresenterTest.php deleted file mode 100644 index 684f41b..0000000 --- a/application/vendor/psy/psysh/test/Psy/Test/Presenter/ResourcePresenterTest.php +++ /dev/null @@ -1,31 +0,0 @@ -presenter = new ResourcePresenter(); - } - - public function testPresent() - { - $resource = fopen('php://stdin', 'r'); - $this->assertStringMatchesFormat('\resource #%d>', $this->presenter->present($resource)); - fclose($resource); - } -} diff --git a/application/vendor/psy/psysh/test/Psy/Test/Presenter/ScalarPresenterTest.php b/application/vendor/psy/psysh/test/Psy/Test/Presenter/ScalarPresenterTest.php deleted file mode 100644 index 371b4d9..0000000 --- a/application/vendor/psy/psysh/test/Psy/Test/Presenter/ScalarPresenterTest.php +++ /dev/null @@ -1,53 +0,0 @@ -presenter = new ScalarPresenter(); - } - - /** - * @dataProvider scalarData - */ - public function testPresent($value, $expect) - { - $this->assertEquals($expect, $this->presenter->present($value)); - } - - public function scalarData() - { - return array( - array(1, '1'), - array(1.0, '1.0'), - array(1.5, '1.5'), - array('2', '"2"'), - array('2.5', '"2.5"'), - array('alpha', '"alpha"'), - array("a\nb", '"a\\nb"'), - array(true, 'true'), - array(false, 'false'), - array(null, 'null'), - array(NAN, 'NAN'), // heh. - array(acos(8), 'NAN'), - array(INF, 'INF'), - array(-INF, '-INF'), - array(log(0), '-INF'), - ); - } -} diff --git a/application/vendor/psy/psysh/test/Psy/Test/Readline/GNUReadlineTest.php b/application/vendor/psy/psysh/test/Psy/Test/Readline/GNUReadlineTest.php index 323111a..60756aa 100644 --- a/application/vendor/psy/psysh/test/Psy/Test/Readline/GNUReadlineTest.php +++ b/application/vendor/psy/psysh/test/Psy/Test/Readline/GNUReadlineTest.php @@ -1,9 +1,9 @@ assertEquals(array( "foo\rbar", "baz\r", - "w00t", + 'w00t', ), $readline->listHistory()); $readline->clearHistory(); } diff --git a/application/vendor/psy/psysh/test/Psy/Test/Readline/TransientTest.php b/application/vendor/psy/psysh/test/Psy/Test/Readline/TransientTest.php index 4b8bd02..6fcd182 100644 --- a/application/vendor/psy/psysh/test/Psy/Test/Readline/TransientTest.php +++ b/application/vendor/psy/psysh/test/Psy/Test/Readline/TransientTest.php @@ -1,9 +1,9 @@ getStream(); $e = new ParseErrorException('message', 13); + $shell->setOutput($output); $shell->addCode('code'); $this->assertTrue($shell->hasCode()); $this->assertNotEmpty($shell->getCodeBuffer()); - $shell->renderException($e, $output); + $shell->writeException($e); $this->assertSame($e, $shell->getScopeVariable('_e')); $this->assertFalse($shell->hasCode()); @@ -285,8 +286,8 @@ public function testWriteReturnValue($input, $expected) public function getReturnValues() { return array( - array('{{return value}}', '=> "{{return value}}"' . PHP_EOL), - array(1, '=> 1' . PHP_EOL), + array('{{return value}}', "=> \"\033[32m{{return value}}\033[39m\"" . PHP_EOL), + array(1, "=> \033[35m1\033[39m" . PHP_EOL), ); } diff --git a/application/vendor/psy/psysh/test/Psy/Test/TabCompletion/AutoCompleterTest.php b/application/vendor/psy/psysh/test/Psy/Test/TabCompletion/AutoCompleterTest.php index 495e96e..8bb4828 100644 --- a/application/vendor/psy/psysh/test/Psy/Test/TabCompletion/AutoCompleterTest.php +++ b/application/vendor/psy/psysh/test/Psy/Test/TabCompletion/AutoCompleterTest.php @@ -1,9 +1,9 @@ array(array('type' => '\Exception', 'desc' => 'with a description')), ), diff --git a/application/vendor/psy/psysh/test/Psy/Test/Util/MirrorTest.php b/application/vendor/psy/psysh/test/Psy/Test/Util/MirrorTest.php index 3da19c8..82726d3 100644 --- a/application/vendor/psy/psysh/test/Psy/Test/Util/MirrorTest.php +++ b/application/vendor/psy/psysh/test/Psy/Test/Util/MirrorTest.php @@ -1,9 +1,9 @@ assertEquals($expected, Str::unvis($input)); + } + + public function testUnvisProvider() + { + //return require_once(__DIR__.'/../../../fixtures/unvis_fixtures.php'); + return json_decode(file_get_contents(__DIR__ . '/../../../fixtures/unvis_fixtures.json')); + } +} diff --git a/application/vendor/psy/psysh/test/Psy/Test/Util/StringTest.php b/application/vendor/psy/psysh/test/Psy/Test/Util/StringTest.php deleted file mode 100644 index 4c1347a..0000000 --- a/application/vendor/psy/psysh/test/Psy/Test/Util/StringTest.php +++ /dev/null @@ -1,30 +0,0 @@ -assertEquals($expected, String::unvis($input)); - } - public function testUnvisProvider() - { - //return require_once(__DIR__.'/../../../fixtures/unvis_fixtures.php'); - return json_decode(file_get_contents(__DIR__ . '/../../../fixtures/unvis_fixtures.json')); - } -} diff --git a/application/vendor/psy/psysh/test/bootstrap.php b/application/vendor/psy/psysh/test/bootstrap.php deleted file mode 100644 index e335dc9..0000000 --- a/application/vendor/psy/psysh/test/bootstrap.php +++ /dev/null @@ -1,17 +0,0 @@ -add('Psy\\Test\\', __DIR__); diff --git a/application/vendor/psy/psysh/test/fixtures/config.php b/application/vendor/psy/psysh/test/fixtures/config.php index e56bae4..0057eca 100644 --- a/application/vendor/psy/psysh/test/fixtures/config.php +++ b/application/vendor/psy/psysh/test/fixtures/config.php @@ -1,9 +1,9 @@ setRuntimeDir(sys_get_temp_dir() . '/psysh_test/withconfig/temp'); return array( - 'useReadline' => true, - 'usePcntl' => false, + 'useReadline' => true, + 'usePcntl' => false, + 'errorLoggingLevel' => E_ALL & ~E_NOTICE, ); diff --git a/application/vendor/psy/psysh/test/fixtures/empty.php b/application/vendor/psy/psysh/test/fixtures/empty.php index b3d9bbc..4048c76 100644 --- a/application/vendor/psy/psysh/test/fixtures/empty.php +++ b/application/vendor/psy/psysh/test/fixtures/empty.php @@ -1 +1,12 @@ false, + 'usePcntl' => true, +); diff --git a/application/vendor/psy/psysh/test/tools/gen_unvis_fixtures.py b/application/vendor/psy/psysh/test/tools/gen_unvis_fixtures.py index 4b3132d..e02a741 100644 --- a/application/vendor/psy/psysh/test/tools/gen_unvis_fixtures.py +++ b/application/vendor/psy/psysh/test/tools/gen_unvis_fixtures.py @@ -46,7 +46,7 @@ if __name__ == '__main__': argp = argparse.ArgumentParser( - description='Generates test data for Psy\\Test\\Util\\StringTest') + description='Generates test data for Psy\\Test\\Util\\StrTest') argp.add_argument('-f', '--format-output', action='store_true', help='Indent JSON output to ease debugging') argp.add_argument('-a', '--all', action='store_true', diff --git a/application/vendor/swiftmailer/swiftmailer/.github/ISSUE_TEMPLATE.md b/application/vendor/swiftmailer/swiftmailer/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..5db6524 --- /dev/null +++ b/application/vendor/swiftmailer/swiftmailer/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,19 @@ + + +| Q | A +| ------------------- | ----- +| Bug report? | yes/no +| Feature request? | yes/no +| RFC? | yes/no +| How used? | Standalone/Symfony/3party +| Swiftmailer version | x.y.z +| PHP version | x.y.z + +### Observed behaviour + + +### Expected behaviour + + +### Example + diff --git a/application/vendor/swiftmailer/swiftmailer/.github/PULL_REQUEST_TEMPLATE.md b/application/vendor/swiftmailer/swiftmailer/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..4b39510 --- /dev/null +++ b/application/vendor/swiftmailer/swiftmailer/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,14 @@ + + +| Q | A +| ------------- | --- +| Bug fix? | yes/no +| New feature? | yes/no +| Doc update? | yes/no +| BC breaks? | yes/no +| Deprecations? | yes/no +| Fixed tickets | #... +| License | MIT + + + diff --git a/application/vendor/swiftmailer/swiftmailer/.gitignore b/application/vendor/swiftmailer/swiftmailer/.gitignore index 9a23ffe..20d389a 100644 --- a/application/vendor/swiftmailer/swiftmailer/.gitignore +++ b/application/vendor/swiftmailer/swiftmailer/.gitignore @@ -1,4 +1,8 @@ +/.php_cs.cache +/.phpunit +/build/* +/composer.lock +/phpunit.xml /tests/acceptance.conf.php /tests/smoke.conf.php -/build/* /vendor/ diff --git a/application/vendor/swiftmailer/swiftmailer/.php_cs.dist b/application/vendor/swiftmailer/swiftmailer/.php_cs.dist new file mode 100644 index 0000000..f18d65d --- /dev/null +++ b/application/vendor/swiftmailer/swiftmailer/.php_cs.dist @@ -0,0 +1,15 @@ +setRules(array( + '@Symfony' => true, + '@Symfony:risky' => true, + 'array_syntax' => array('syntax' => 'long'), + 'no_unreachable_default_argument_value' => false, + 'braces' => array('allow_single_line_closure' => true), + 'heredoc_to_nowdoc' => false, + 'phpdoc_annotation_without_dot' => false, + )) + ->setRiskyAllowed(true) + ->setFinder(PhpCsFixer\Finder::create()->in(__DIR__)) +; diff --git a/application/vendor/swiftmailer/swiftmailer/.travis.yml b/application/vendor/swiftmailer/swiftmailer/.travis.yml index cadee01..fc24d05 100644 --- a/application/vendor/swiftmailer/swiftmailer/.travis.yml +++ b/application/vendor/swiftmailer/swiftmailer/.travis.yml @@ -1,25 +1,31 @@ language: php -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - hhvm-nightly +sudo: false before_script: - cp tests/acceptance.conf.php.default tests/acceptance.conf.php - cp tests/smoke.conf.php.default tests/smoke.conf.php - composer self-update - composer update --no-interaction --prefer-source + - gem install mime-types -v 2.99.1 - gem install mailcatcher - mailcatcher --smtp-port 4456 -script: - - phpunit --verbose +script: ./vendor/bin/simple-phpunit matrix: - allow_failures: - - php: 5.6 - - php: hhvm-nightly - fast_finish: true + include: + - php: 5.3 + - php: 5.4 + - php: 5.5 + - php: 5.6 + - php: 7.0 + - php: 7.1 + - php: hhvm + allow_failures: + - php: hhvm + fast_finish: true + +cache: + directories: + - .phpunit diff --git a/application/vendor/swiftmailer/swiftmailer/CHANGES b/application/vendor/swiftmailer/swiftmailer/CHANGES index 7330acd..3532ec2 100644 --- a/application/vendor/swiftmailer/swiftmailer/CHANGES +++ b/application/vendor/swiftmailer/swiftmailer/CHANGES @@ -1,6 +1,87 @@ Changelog ========= +5.4.12 (2018-07-31) +------------------- + + * fixed typo + +5.4.11 (2018-07-31) +------------------- + + * fixed startTLS support for PHP 5.6- + +5.4.10 (2018-07-27) +------------------- + + * fixed startTLS only allowed tls1.0, now allowed: tls1.0, tls1.1, tls1.2 + +5.4.9 (2018-01-23) +------------------ + + * no changes, last version of the 5.x series + +5.4.8 (2017-05-01) +------------------ + + * fixed encoding inheritance in addPart() + * fixed sorting MIME children when their types are equal + +5.4.7 (2017-04-20) +------------------ + + * fixed NTLMAuthenticator clobbering bcmath scale + +5.4.6 (2017-02-13) +------------------ + + * removed exceptions thrown in destructors as they lead to fatal errors + * switched to use sha256 by default in DKIM as per the RFC + * fixed an 'Undefined variable: pipes' PHP notice + * fixed long To headers when using the mail transport + * fixed NTLMAuthenticator when no domain is passed with the username + * prevented fatal error during unserialization of a message + * fixed a PHP warning when sending a message that has a length of a multiple of 8192 + +5.4.5 (2016-12-29) +------------------ + + * SECURITY FIX: fixed CVE-2016-10074 by disallowing potentially unsafe shell characters + + Prior to 5.4.5, the mail transport (Swift_Transport_MailTransport) was vulnerable to passing + arbitrary shell arguments if the "From", "ReturnPath" or "Sender" header came + from a non-trusted source, potentially allowing Remote Code Execution + * deprecated the mail transport + +5.4.4 (2016-11-23) +------------------ + + * reverted escaping command-line args to mail (PHP mail() function already does it) + +5.4.3 (2016-07-08) +------------------ + + * fixed SimpleHeaderSet::has()/get() when the 0 index is removed + * removed the need to have mcrypt installed + * fixed broken MIME header encoding with quotes/colons and non-ascii chars + * allowed mail transport send for messages without To header + * fixed PHP 7 support + +5.4.2 (2016-05-01) +------------------ + + * fixed support for IPv6 sockets + * added auto-retry when sending messages from the memory spool + * fixed consecutive read calls in Swift_ByteStream_FileByteStream + * added support for iso-8859-15 encoding + * fixed PHP mail extra params on missing reversePath + * added methods to set custom stream context options + * fixed charset changes in QpContentEncoderProxy + * added return-path header to the ignoredHeaders list of DKIMSigner + * fixed crlf for subject using mail + * fixed add soft line break only when necessary + * fixed escaping command-line args to mail + 5.4.1 (2015-06-06) ------------------ diff --git a/application/vendor/swiftmailer/swiftmailer/LICENSE b/application/vendor/swiftmailer/swiftmailer/LICENSE index 674bb2a..485f1d6 100644 --- a/application/vendor/swiftmailer/swiftmailer/LICENSE +++ b/application/vendor/swiftmailer/swiftmailer/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2013 Fabien Potencier +Copyright (c) 2013-2016 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/application/vendor/swiftmailer/swiftmailer/README b/application/vendor/swiftmailer/swiftmailer/README index eb5f8bc..52c0757 100644 --- a/application/vendor/swiftmailer/swiftmailer/README +++ b/application/vendor/swiftmailer/swiftmailer/README @@ -4,9 +4,8 @@ Swift Mailer Swift Mailer is a component based mailing solution for PHP 5. It is released under the MIT license. -Homepage: http://swiftmailer.org -Documentation: http://swiftmailer.org/docs -Mailing List: http://groups.google.com/group/swiftmailer +Homepage: https://swiftmailer.symfony.com/ +Documentation: https://swiftmailer.symfony.com/docs/introduction.html Bugs: https://github.com/swiftmailer/swiftmailer/issues Repository: https://github.com/swiftmailer/swiftmailer diff --git a/application/vendor/swiftmailer/swiftmailer/VERSION b/application/vendor/swiftmailer/swiftmailer/VERSION index e61a6df..82a2d1d 100644 --- a/application/vendor/swiftmailer/swiftmailer/VERSION +++ b/application/vendor/swiftmailer/swiftmailer/VERSION @@ -1 +1 @@ -Swift-5.4.1 +Swift-5.4.12 diff --git a/application/vendor/swiftmailer/swiftmailer/composer.json b/application/vendor/swiftmailer/swiftmailer/composer.json index a7b5e44..44a1050 100644 --- a/application/vendor/swiftmailer/swiftmailer/composer.json +++ b/application/vendor/swiftmailer/swiftmailer/composer.json @@ -3,7 +3,7 @@ "type": "library", "description": "Swiftmailer, free feature-rich PHP mailer", "keywords": ["mail","mailer","email"], - "homepage": "http://swiftmailer.org", + "homepage": "https://swiftmailer.symfony.com", "license": "MIT", "authors": [ { @@ -18,11 +18,17 @@ "php": ">=5.3.3" }, "require-dev": { - "mockery/mockery": "~0.9.1,<0.9.4" + "mockery/mockery": "~0.9.1", + "symfony/phpunit-bridge": "~3.2" }, "autoload": { "files": ["lib/swift_required.php"] }, + "autoload-dev": { + "psr-0": { + "Swift_": "tests/unit" + } + }, "extra": { "branch-alias": { "dev-master": "5.4-dev" diff --git a/application/vendor/swiftmailer/swiftmailer/doc/headers.rst b/application/vendor/swiftmailer/swiftmailer/doc/headers.rst index 6aec23f..2c11c18 100644 --- a/application/vendor/swiftmailer/swiftmailer/doc/headers.rst +++ b/application/vendor/swiftmailer/swiftmailer/doc/headers.rst @@ -476,10 +476,8 @@ the HeaderSet's ``addIdHeader()`` method. $headers->addIdHeader('Your-Header-Name', '123456.unqiue@example.org'); -Changing the value of an existing date header is done by calling its -``setId()`` method. - -.. code-block:: php +Changing the value of an existing ID header is done by calling its +``setId()`` method:: $msgId = $message->getHeaders()->get('Message-ID'); @@ -518,7 +516,6 @@ You add a new path header to a HeaderSet by calling the HeaderSet's $headers->addPathHeader('Your-Header-Name', 'person@example.org'); - Changing the value of an existing path header is done by calling its ``setAddress()`` method. diff --git a/application/vendor/swiftmailer/swiftmailer/doc/messages.rst b/application/vendor/swiftmailer/swiftmailer/doc/messages.rst index 7a19253..b058b77 100644 --- a/application/vendor/swiftmailer/swiftmailer/doc/messages.rst +++ b/application/vendor/swiftmailer/swiftmailer/doc/messages.rst @@ -283,11 +283,9 @@ the same filename as the one you attached. // Attach it to the message $message->attach($attachment); - // The two statements above could be written in one line instead $message->attach(Swift_Attachment::fromPath('/path/to/image.jpg')); - // You can attach files from a URL if allow_url_fopen is on in php.ini $message->attach(Swift_Attachment::fromPath('http://site.tld/logo.png')); @@ -311,7 +309,6 @@ the email will rename the file to something else. $attachment = Swift_Attachment::fromPath('/path/to/image.jpg') ->setFilename('cool.jpg'); - // Because there's a fluid interface, you can do this in one statement $message->attach( Swift_Attachment::fromPath('/path/to/image.jpg')->setFilename('cool.jpg') @@ -1038,13 +1035,14 @@ priority will not change the way your email is sent -- it is purely an indicative setting for the recipient. The priority of a message is an indication to the recipient what significance -it has. Swift Mailer allows you to set the priority by calling the ``setPriority`` method. This method takes an integer value between 1 and 5: +it has. Swift Mailer allows you to set the priority by calling the +``setPriority`` method. This method takes an integer value between 1 and 5: -* Highest -* High -* Normal -* Low -* Lowest +* `Swift_Mime_SimpleMessage::PRIORITY_HIGHEST`: 1 +* `Swift_Mime_SimpleMessage::PRIORITY_HIGH`: 2 +* `Swift_Mime_SimpleMessage::PRIORITY_NORMAL`: 3 +* `Swift_Mime_SimpleMessage::PRIORITY_LOW`: 4 +* `Swift_Mime_SimpleMessage::PRIORITY_LOWEST`: 5 To set the message priority: @@ -1055,3 +1053,6 @@ To set the message priority: // Indicate "High" priority $message->setPriority(2); + + // Or use the constant to be more explicit + $message->setPriority(Swift_Mime_SimpleMessage::PRIORITY_HIGH); diff --git a/application/vendor/swiftmailer/swiftmailer/doc/overview.rst b/application/vendor/swiftmailer/swiftmailer/doc/overview.rst index c912617..ebfe008 100644 --- a/application/vendor/swiftmailer/swiftmailer/doc/overview.rst +++ b/application/vendor/swiftmailer/swiftmailer/doc/overview.rst @@ -21,11 +21,11 @@ System Requirements The basic requirements to operate Swift Mailer are extremely minimal and easily achieved. Historically, Swift Mailer has supported both PHP 4 and PHP 5 by following a parallel development workflow. Now in it's fourth major -version, and Swift Mailer operates on servers running PHP 5.2 or higher. +version, and Swift Mailer operates on servers running PHP 5.3.3 or higher. The library aims to work with as many PHP 5 projects as possible: -* PHP 5.2 or higher, with the SPL extension (standard) +* PHP 5.3.3 or higher, with the SPL extension (standard) * Limited network access to connect to remote SMTP servers @@ -84,8 +84,6 @@ use for your environment. +---------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | ``Swift_SendmailTransport`` | Communicates with a locally installed ``sendmail`` executable (Linux/UNIX) | Quick time-to-run; Provides less-accurate feedback than SMTP; Requires ``sendmail`` installation | +---------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ -| ``Swift_MailTransport`` | Uses PHP's built-in ``mail()`` function | Very portable; Potentially unpredictable results; Provides extremely weak feedback | -+---------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | ``Swift_LoadBalancedTransport`` | Cycles through a collection of the other Transports to manage load-reduction | Provides graceful fallback if one Transport fails (e.g. an SMTP server is down); Keeps the load on remote services down by spreading the work | +---------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | ``Swift_FailoverTransport`` | Works in conjunction with a collection of the other Transports to provide high-availability | Provides graceful fallback if one Transport fails (e.g. an SMTP server is down) | diff --git a/application/vendor/swiftmailer/swiftmailer/doc/plugins.rst b/application/vendor/swiftmailer/swiftmailer/doc/plugins.rst index 16ae335..6cec6be 100644 --- a/application/vendor/swiftmailer/swiftmailer/doc/plugins.rst +++ b/application/vendor/swiftmailer/swiftmailer/doc/plugins.rst @@ -350,14 +350,14 @@ provide an implementation that does this. You need to create a small class. class DbReplacements implements Swift_Plugins_Decorator_Replacements { public function getReplacementsFor($address) { - $sql = sprintf( - "SELECT * FROM user WHERE email = '%s'", - mysql_real_escape_string($address) + global $db; // Your PDO instance with a connection to your database + $query = $db->prepare( + "SELECT * FROM `users` WHERE `email` = ?" ); - $result = mysql_query($sql); + $query->execute([$address]); - if ($row = mysql_fetch_assoc($result)) { + if ($row = $query->fetch(PDO::FETCH_ASSOC)) { return array( '{username}'=>$row['username'], '{password}'=>$row['password'] diff --git a/application/vendor/swiftmailer/swiftmailer/doc/sending.rst b/application/vendor/swiftmailer/swiftmailer/doc/sending.rst index 4460845..f340404 100644 --- a/application/vendor/swiftmailer/swiftmailer/doc/sending.rst +++ b/application/vendor/swiftmailer/swiftmailer/doc/sending.rst @@ -10,7 +10,7 @@ create the Mailer, then you use the Mailer to send the message. To send a Message: * Create a Transport from one of the provided Transports -- - ``Swift_SmtpTransport``, ``Swift_SendmailTransport``, ``Swift_MailTransport`` + ``Swift_SmtpTransport``, ``Swift_SendmailTransport`` or one of the aggregate Transports. * Create an instance of the ``Swift_Mailer`` class, using the Transport as @@ -46,13 +46,10 @@ recipients are delivered to successfully then the value 5 will be returned. ; /* - You could alternatively use a different transport such as Sendmail or Mail: + You could alternatively use a different transport such as Sendmail: // Sendmail $transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs'); - - // Mail - $transport = Swift_MailTransport::newInstance(); */ // Create the Mailer using your created Transport @@ -350,39 +347,6 @@ Serious drawbacks when using this Transport are: It's a last resort, and we say that with a passion! -Using the Mail Transport -^^^^^^^^^^^^^^^^^^^^^^^^ - -To use the Mail Transport you simply need to call -``Swift_MailTransport::newInstance()``. It's unlikely you'll need to configure -the Transport. - -To use the Mail Transport: - -* Call ``Swift_MailTransport::newInstance()``. - -* Use the returned object to create the Mailer. - -Messages will be sent using the ``mail()`` function. - -.. note:: - - The ``mail()`` function can take a ``$additional_parameters`` parameter. - Swift Mailer sets this to "``-f%s``" by default, where the "``%s``" is - substituted with the address of the sender (via a ``sprintf()``) at send - time. You may override this default by passing an argument to - ``newInstance()``. - - .. code-block:: php - - require_once 'lib/swift_required.php'; - - // Create the Transport - $transport = Swift_MailTransport::newInstance(); - - // Create the Mailer using your created Transport - $mailer = Swift_Mailer::newInstance($transport); - Available Methods for Sending Messages ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -414,7 +378,7 @@ To send a Message with ``send()``: * Create a Transport from one of the provided Transports -- ``Swift_SmtpTransport``, ``Swift_SendmailTransport``, - ``Swift_MailTransport`` or one of the aggregate Transports. + or one of the aggregate Transports. * Create an instance of the ``Swift_Mailer`` class, using the Transport as it's constructor parameter. @@ -474,7 +438,7 @@ own address shows up in the ``To:`` field, follow the following recipe: * Create a Transport from one of the provided Transports -- ``Swift_SmtpTransport``, ``Swift_SendmailTransport``, - ``Swift_MailTransport`` or one of the aggregate Transports. + or one of the aggregate Transports. * Create an instance of the ``Swift_Mailer`` class, using the Transport as it's constructor parameter. diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php index 72419b3..82c381b 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php @@ -47,7 +47,7 @@ public static function autoload($class) return; } - $path = dirname(__FILE__).'/'.str_replace('_', '/', $class).'.php'; + $path = __DIR__.'/'.str_replace('_', '/', $class).'.php'; if (!file_exists($path)) { return; diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php index c397c8b..a7b0e3a 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php @@ -22,6 +22,8 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I /** * StreamFilters. + * + * @var Swift_StreamFilter[] */ private $_filters = array(); diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php index 561cda8..ef05a6d 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php @@ -82,9 +82,7 @@ public function read($length) // Don't use array slice $end = $length + $this->_offset; - $end = $this->_arraySize < $end - ? $this->_arraySize - : $end; + $end = $this->_arraySize < $end ? $this->_arraySize : $end; $ret = ''; for (; $this->_offset < $end; ++$this->_offset) { $ret .= $this->_array[$this->_offset]; diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php index 4061043..9ed8523 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php @@ -139,11 +139,13 @@ protected function _flush() private function _getReadHandle() { if (!isset($this->_reader)) { - if (!$this->_reader = fopen($this->_path, 'rb')) { + $pointer = @fopen($this->_path, 'rb'); + if (!$pointer) { throw new Swift_IoException( 'Unable to open file for reading ['.$this->_path.']' ); } + $this->_reader = $pointer; if ($this->_offset != 0) { $this->_getReadStreamSeekableStatus(); $this->_seekReadStreamToPosition($this->_offset); diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader.php index 3d5e854..4267adb 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader.php @@ -48,8 +48,8 @@ public function getMapType(); * A value of zero means this is already a valid character. * A value of -1 means this cannot possibly be a valid character. * - * @param integer[] $bytes - * @param int $size + * @param int[] $bytes + * @param int $size * * @return int */ diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php index c1029b9..6a18e1d 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php @@ -48,7 +48,7 @@ public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredC $strlen = strlen($string); // % and / are CPU intensive, so, maybe find a better way $ignored = $strlen % $this->_width; - $ignoredChars = substr($string, -$ignored); + $ignoredChars = $ignored ? substr($string, -$ignored) : ''; $currentMap = $this->_width; return ($strlen - $ignored) / $this->_width; @@ -82,7 +82,7 @@ public function validateByteSequence($bytes, $size) { $needed = $this->_width - $size; - return ($needed > -1) ? $needed : -1; + return $needed > -1 ? $needed : -1; } /** diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/UsAsciiReader.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/UsAsciiReader.php index ddc34ca..67da48f 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/UsAsciiReader.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/UsAsciiReader.php @@ -67,9 +67,9 @@ public function validateByteSequence($bytes, $size) $byte = reset($bytes); if (1 == count($bytes) && $byte >= 0x00 && $byte <= 0x7F) { return 0; - } else { - return -1; } + + return -1; } /** diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php index d5fa9c9..22746bd 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php @@ -19,22 +19,22 @@ class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader /** Pre-computed for optimization */ private static $length_map = array( // N=0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x0N - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1N - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x2N - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3N - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x4N - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5N - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x6N - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7N - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x8N - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9N - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xAN - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBN - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xCN - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDN - 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEN - 4,4,4,4,4,4,4,4,5,5,5,5,6,6,0,0, // 0xFN + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x0N + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x1N + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x2N + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x3N + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x4N + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x5N + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x6N + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x7N + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x8N + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x9N + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xAN + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xBN + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xCN + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xDN + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xEN + 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 0, 0, // 0xFN ); private static $s_length_map = array( @@ -161,10 +161,7 @@ public function validateByteSequence($bytes, $size) } $needed = self::$length_map[$bytes[0]] - $size; - return ($needed > -1) - ? $needed - : -1 - ; + return $needed > -1 ? $needed : -1; } /** diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php index d695a6e..7213a40 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php @@ -155,7 +155,7 @@ public function read($length) * * @param int $length * - * @return integer[] + * @return int[] */ public function readBytes($length) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php index 7620d0e..58bd140 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php @@ -165,9 +165,7 @@ public function read($length) return false; } $ret = false; - $length = ($this->_currentPos + $length > $this->_charCount) - ? $this->_charCount - $this->_currentPos - : $length; + $length = $this->_currentPos + $length > $this->_charCount ? $this->_charCount - $this->_currentPos : $length; switch ($this->_mapType) { case Swift_CharacterReader::MAP_TYPE_FIXED_LEN: $len = $length * $this->_map; @@ -178,10 +176,6 @@ public function read($length) break; case Swift_CharacterReader::MAP_TYPE_INVALID: - $end = $this->_currentPos + $length; - $end = $end > $this->_charCount - ? $this->_charCount - : $end; $ret = ''; for (; $this->_currentPos < $length; ++$this->_currentPos) { if (isset($this->_map[$this->_currentPos])) { @@ -194,9 +188,7 @@ public function read($length) case Swift_CharacterReader::MAP_TYPE_POSITIONS: $end = $this->_currentPos + $length; - $end = $end > $this->_charCount - ? $this->_charCount - : $end; + $end = $end > $this->_charCount ? $this->_charCount : $end; $ret = ''; $start = 0; if ($this->_currentPos > 0) { @@ -223,7 +215,7 @@ public function read($length) * * @param int $length * - * @return integer[] + * @return int[] */ public function readBytes($length) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php index 660cc84..befec9a 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php @@ -48,7 +48,7 @@ public function __construct() /** * Returns a singleton of the DependencyContainer. * - * @return Swift_DependencyContainer + * @return self */ public static function getInstance() { @@ -143,7 +143,7 @@ public function createDependenciesFor($itemName) * * @param string $itemName * - * @return Swift_DependencyContainer + * @return $this */ public function register($itemName) { @@ -160,7 +160,7 @@ public function register($itemName) * * @param mixed $value * - * @return Swift_DependencyContainer + * @return $this */ public function asValue($value) { @@ -176,7 +176,7 @@ public function asValue($value) * * @param string $lookup * - * @return Swift_DependencyContainer + * @return $this */ public function asAliasOf($lookup) { @@ -198,7 +198,7 @@ public function asAliasOf($lookup) * * @param string $className * - * @return Swift_DependencyContainer + * @return $this */ public function asNewInstanceOf($className) { @@ -216,7 +216,7 @@ public function asNewInstanceOf($className) * * @param string $className * - * @return Swift_DependencyContainer + * @return $this */ public function asSharedInstanceOf($className) { @@ -236,7 +236,7 @@ public function asSharedInstanceOf($className) * * @param array $lookups * - * @return Swift_DependencyContainer + * @return $this */ public function withDependencies(array $lookups) { @@ -257,7 +257,7 @@ public function withDependencies(array $lookups) * * @param mixed $value * - * @return Swift_DependencyContainer + * @return $this */ public function addConstructorValue($value) { @@ -278,7 +278,7 @@ public function addConstructorValue($value) * * @param string $lookup * - * @return Swift_DependencyContainer + * @return $this */ public function addConstructorLookup($lookup) { @@ -311,9 +311,9 @@ private function _createNewInstance($itemName) return $reflector->newInstanceArgs( $this->createDependenciesFor($itemName) ); - } else { - return $reflector->newInstance(); } + + return $reflector->newInstance(); } /** Create and register a shared instance of $itemName */ @@ -366,8 +366,8 @@ private function _lookupRecursive($item) } return $collection; - } else { - return $this->lookup($item); } + + return $this->lookup($item); } } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php index f989c8d..edec10c 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php @@ -198,14 +198,25 @@ public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0) } $enc = $this->_encodeByteSequence($bytes, $size); - if ($currentLine && $lineLen + $size >= $thisLineLength) { + + $i = strpos($enc, '=0D=0A'); + $newLineLength = $lineLen + ($i === false ? $size : $i); + + if ($currentLine && $newLineLength >= $thisLineLength) { $lines[$lNo] = ''; $currentLine = &$lines[$lNo++]; $thisLineLength = $maxLineLength; $lineLen = 0; } - $lineLen += $size; + $currentLine .= $enc; + + if ($i === false) { + $lineLen += $size; + } else { + // 6 is the length of '=0D=0A'. + $lineLen = $size - strrpos($enc, '=0D=0A') - 6; + } } return $this->_standardize(implode("=\r\n", $lines)); @@ -224,8 +235,8 @@ public function charsetChanged($charset) /** * Encode the given byte array into a verbatim QP form. * - * @param integer[] $bytes - * @param int $size + * @param int[] $bytes + * @param int $size * * @return string */ @@ -251,7 +262,7 @@ protected function _encodeByteSequence(array $bytes, &$size) * * @param int $size number of bytes to read * - * @return integer[] + * @return int[] */ protected function _nextSequence($size = 4) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoding.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoding.php index 253977b..2458787 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoding.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoding.php @@ -55,8 +55,6 @@ public static function getBase64Encoding() return self::_lookup('mime.base64contentencoder'); } - // -- Private Static Methods - private static function _lookup($key) { return Swift_DependencyContainer::getInstance()->lookup($key); diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/CommandEvent.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/CommandEvent.php index 7dc381d..674e6b5 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/CommandEvent.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/CommandEvent.php @@ -25,7 +25,7 @@ class Swift_Events_CommandEvent extends Swift_Events_EventObject /** * An array of codes which a successful response will contain. * - * @var integer[] + * @var int[] */ private $_successCodes = array(); @@ -56,7 +56,7 @@ public function getCommand() /** * Get the numeric response codes which indicate success for this command. * - * @return integer[] + * @return int[] */ public function getSuccessCodes() { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FailoverTransport.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FailoverTransport.php index 53f277d..9951c59 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FailoverTransport.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FailoverTransport.php @@ -36,7 +36,7 @@ public function __construct($transports = array()) * * @param Swift_Transport[] $transports * - * @return Swift_FailoverTransport + * @return self */ public static function newInstance($transports = array()) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.php index 2208539..c82c5db 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.php @@ -39,7 +39,7 @@ public function __construct($path) if (!file_exists($this->_path)) { if (!mkdir($this->_path, 0777, true)) { - throw new Swift_IoException('Unable to create Path ['.$this->_path.']'); + throw new Swift_IoException(sprintf('Unable to create path "%s".', $this->_path)); } } } @@ -108,7 +108,7 @@ public function queueMessage(Swift_Mime_Message $message) } } - throw new Swift_IoException('Unable to create a file for enqueuing Message'); + throw new Swift_IoException(sprintf('Unable to create a file for enqueuing Message in "%s".', $this->_path)); } /** diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Image.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Image.php index 25f5f1b..4213ee2 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Image.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Image.php @@ -36,7 +36,7 @@ public function __construct($data = null, $filename = null, $contentType = null) * @param string $filename * @param string $contentType * - * @return Swift_Image + * @return self */ public static function newInstance($data = null, $filename = null, $contentType = null) { @@ -48,14 +48,10 @@ public static function newInstance($data = null, $filename = null, $contentType * * @param string $path * - * @return Swift_Image + * @return self */ public static function fromPath($path) { - $image = self::newInstance()->setFile( - new Swift_ByteStream_FileByteStream($path) - ); - - return $image; + return self::newInstance()->setFile(new Swift_ByteStream_FileByteStream($path)); } } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php index dc1515a..453f50a 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php @@ -289,10 +289,7 @@ private function _prepareCache($nsKey) private function _getHandle($nsKey, $itemKey, $position) { if (!isset($this->_keys[$nsKey][$itemKey])) { - $openMode = $this->hasKey($nsKey, $itemKey) - ? 'r+b' - : 'w+b' - ; + $openMode = $this->hasKey($nsKey, $itemKey) ? 'r+b' : 'w+b'; $fp = fopen($this->_path.'/'.$nsKey.'/'.$itemKey, $openMode); $this->_keys[$nsKey][$itemKey] = $fp; } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php index fdba9df..e151b8a 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php @@ -36,7 +36,7 @@ public function __construct($transports = array()) * * @param array $transports * - * @return Swift_LoadBalancedTransport + * @return self */ public static function newInstance($transports = array()) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MailTransport.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MailTransport.php index 858ca81..1855698 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MailTransport.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MailTransport.php @@ -12,6 +12,8 @@ * Sends Messages using the mail() function. * * @author Chris Corbyn + * + * @deprecated since 5.4.5 (to be removed in 6.0) */ class Swift_MailTransport extends Swift_Transport_MailTransport { @@ -36,7 +38,7 @@ public function __construct($extraParams = '-f%s') * * @param string $extraParams To be passed to mail() * - * @return Swift_MailTransport + * @return self */ public static function newInstance($extraParams = '-f%s') { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php index 34a78d4..8314fe8 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php @@ -33,7 +33,7 @@ public function __construct(Swift_Transport $transport) * * @param Swift_Transport $transport * - * @return Swift_Mailer + * @return self */ public static function newInstance(Swift_Transport $transport) { @@ -69,7 +69,7 @@ public function createMessage($service = 'message') * @param Swift_Mime_Message $message * @param array $failedRecipients An array of failures by-reference * - * @return int + * @return int The number of successful recipients. Can be 0 which indicates failure */ public function send(Swift_Mime_Message $message, &$failedRecipients = null) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MemorySpool.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MemorySpool.php index 5b23969..2cafb67 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MemorySpool.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MemorySpool.php @@ -16,6 +16,7 @@ class Swift_MemorySpool implements Swift_Spool { protected $messages = array(); + private $flushRetries = 3; /** * Tests if this Transport mechanism has started. @@ -41,6 +42,14 @@ public function stop() { } + /** + * @param int $retries + */ + public function setFlushRetries($retries) + { + $this->flushRetries = $retries; + } + /** * Stores a message in the queue. * @@ -75,8 +84,25 @@ public function flushQueue(Swift_Transport $transport, &$failedRecipients = null } $count = 0; - while ($message = array_pop($this->messages)) { - $count += $transport->send($message, $failedRecipients); + $retries = $this->flushRetries; + while ($retries--) { + try { + while ($message = array_pop($this->messages)) { + $count += $transport->send($message, $failedRecipients); + } + } catch (Swift_TransportException $exception) { + if ($retries) { + // re-queue the message at the end of the queue to give a chance + // to the other messages to be sent, in case the failure was due to + // this message and not just the transport failing + array_unshift($this->messages, $message); + + // wait half a second before we try again + usleep(500000); + } else { + throw $exception; + } + } } return $count; diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php index 11aa5a9..242cbf3 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php @@ -68,7 +68,7 @@ public function __construct($subject = null, $body = null, $contentType = null, * @param string $contentType * @param string $charset * - * @return Swift_Message + * @return $this */ public static function newInstance($subject = null, $body = null, $contentType = null, $charset = null) { @@ -82,21 +82,19 @@ public static function newInstance($subject = null, $body = null, $contentType = * @param string $contentType * @param string $charset * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function addPart($body, $contentType = null, $charset = null) { - return $this->attach(Swift_MimePart::newInstance( - $body, $contentType, $charset - )); + return $this->attach(Swift_MimePart::newInstance($body, $contentType, $charset)->setEncoder($this->getEncoder())); } /** - * Attach a new signature handler to the message. + * Detach a signature handler from a message. * * @param Swift_Signer $signer * - * @return Swift_Message + * @return $this */ public function attachSigner(Swift_Signer $signer) { @@ -114,7 +112,7 @@ public function attachSigner(Swift_Signer $signer) * * @param Swift_Signer $signer * - * @return Swift_Message + * @return $this */ public function detachSigner(Swift_Signer $signer) { @@ -281,11 +279,11 @@ public function __clone() { parent::__clone(); foreach ($this->bodySigners as $key => $bodySigner) { - $this->bodySigners[$key] = clone($bodySigner); + $this->bodySigners[$key] = clone $bodySigner; } foreach ($this->headerSigners as $key => $headerSigner) { - $this->headerSigners[$key] = clone($headerSigner); + $this->headerSigners[$key] = clone $headerSigner; } } } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Attachment.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Attachment.php index 0a72606..d5ba14b 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Attachment.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Attachment.php @@ -64,14 +64,12 @@ public function getDisposition() * * @param string $disposition * - * @return Swift_Mime_Attachment + * @return $this */ public function setDisposition($disposition) { if (!$this->_setHeaderFieldModel('Content-Disposition', $disposition)) { - $this->getHeaders()->addParameterizedHeader( - 'Content-Disposition', $disposition - ); + $this->getHeaders()->addParameterizedHeader('Content-Disposition', $disposition); } return $this; @@ -92,7 +90,7 @@ public function getFilename() * * @param string $filename * - * @return Swift_Mime_Attachment + * @return $this */ public function setFilename($filename) { @@ -117,7 +115,7 @@ public function getSize() * * @param int $size * - * @return Swift_Mime_Attachment + * @return $this */ public function setSize($size) { @@ -132,16 +130,14 @@ public function setSize($size) * @param Swift_FileStream $file * @param string $contentType optional * - * @return Swift_Mime_Attachment + * @return $this */ public function setFile(Swift_FileStream $file, $contentType = null) { $this->setFilename(basename($file->getPath())); $this->setBody($file, $contentType); if (!isset($contentType)) { - $extension = strtolower(substr( - $file->getPath(), strrpos($file->getPath(), '.') + 1 - )); + $extension = strtolower(substr($file->getPath(), strrpos($file->getPath(), '.') + 1)); if (array_key_exists($extension, $this->_mimeTypes)) { $this->setContentType($this->_mimeTypes[$extension]); diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php index 8ee4c75..5cc907b 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php @@ -95,15 +95,26 @@ public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStre } $enc = $this->_encodeByteSequence($bytes, $size); - if ($currentLine && $lineLen + $size >= $thisLineLength) { + + $i = strpos($enc, '=0D=0A'); + $newLineLength = $lineLen + ($i === false ? $size : $i); + + if ($currentLine && $newLineLength >= $thisLineLength) { $is->write($prepend.$this->_standardize($currentLine)); $currentLine = ''; $prepend = "=\r\n"; $thisLineLength = $maxLineLength; $lineLen = 0; } - $lineLen += $size; + $currentLine .= $enc; + + if ($i === false) { + $lineLen += $size; + } else { + // 6 is the length of '=0D=0A'. + $lineLen = $size - strrpos($enc, '=0D=0A') - 6; + } } if (strlen($currentLine)) { $is->write($prepend.$this->_standardize($currentLine)); diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php index 8113e52..3214e1c 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php @@ -61,6 +61,7 @@ public function __clone() public function charsetChanged($charset) { $this->charset = $charset; + $this->safeEncoder->charsetChanged($charset); } /** diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Grammar.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Grammar.php index 6bd2801..a09f338 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Grammar.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Grammar.php @@ -129,11 +129,11 @@ public function getDefinition($name) { if (array_key_exists($name, self::$_grammar)) { return self::$_grammar[$name]; - } else { - throw new Swift_RfcComplianceException( - "No such grammar '".$name."' defined." - ); } + + throw new Swift_RfcComplianceException( + "No such grammar '".$name."' defined." + ); } /** diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderSet.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderSet.php index 7390d2c..1768709 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderSet.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderSet.php @@ -138,7 +138,7 @@ public function removeAll($name); /** * Create a new instance of this HeaderSet. * - * @return Swift_Mime_HeaderSet + * @return self */ public function newInstance(); diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php index fbd9258..3a6d7b3 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php @@ -219,8 +219,6 @@ public function __toString() return $this->toString(); } - // -- Points of extension - /** * Set the name of this Header field. * @@ -449,7 +447,7 @@ protected function clearCachedValueIf($condition) */ protected function toTokens($string = null) { - if (is_null($string)) { + if (null === $string) { $string = $this->getFieldBody(); } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php index 4fd6674..4075cbf 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php @@ -95,7 +95,7 @@ public function getTimestamp() */ public function setTimestamp($timestamp) { - if (!is_null($timestamp)) { + if (null !== $timestamp) { $timestamp = (int) $timestamp; } $this->clearCachedValueIf($this->_timestamp != $timestamp); diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php index 798e7f4..e4567fc 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php @@ -231,15 +231,13 @@ public function removeAddresses($addresses) public function getFieldBody() { // Compute the string value of the header only if needed - if (is_null($this->getCachedValue())) { + if (null === $this->getCachedValue()) { $this->setCachedValue($this->createMailboxListString($this->_mailboxes)); } return $this->getCachedValue(); } - // -- Points of extension - /** * Normalizes a user-input list of mailboxes into consistent key=>value pairs. * @@ -277,9 +275,7 @@ protected function normalizeMailboxes(array $mailboxes) */ protected function createDisplayNameString($displayName, $shorten = false) { - return $this->createPhrase($this, $displayName, - $this->getCharset(), $this->getEncoder(), $shorten - ); + return $this->createPhrase($this, $displayName, $this->getCharset(), $this->getEncoder(), $shorten); } /** @@ -299,8 +295,9 @@ protected function createMailboxListString(array $mailboxes) /** * Redefine the encoding requirements for mailboxes. * - * Commas and semicolons are used to separate - * multiple addresses, and should therefore be encoded + * All "specials" must be encoded as the full header value will not be quoted + * + * @see RFC 2822 3.2.1 * * @param string $token * @@ -308,7 +305,7 @@ protected function createMailboxListString(array $mailboxes) */ protected function tokenNeedsEncoding($token) { - return preg_match('/[,;]/', $token) || parent::tokenNeedsEncoding($token); + return preg_match('/[()<>\[\]:;@\,."]/', $token) || parent::tokenNeedsEncoding($token); } /** @@ -324,7 +321,7 @@ private function _createNameAddressStrings(array $mailboxes) foreach ($mailboxes as $email => $name) { $mailboxStr = $email; - if (!is_null($name)) { + if (null !== $name) { $nameStr = $this->createDisplayNameString($name, empty($strings)); $mailboxStr = $nameStr.' <'.$mailboxStr.'>'; } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php index b52b964..d749550 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php @@ -30,11 +30,7 @@ class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header private $_fieldName; /** - * Creates a new SimpleHeader with $name. - * - * @param string $name - * @param Swift_Mime_HeaderEncoder $encoder - * @param Swift_Mime_Grammar $grammar + * @param string $name */ public function __construct($name) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php index 0dcf1fc..c1777d3 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php @@ -98,9 +98,7 @@ public function getParameter($parameter) { $params = $this->getParameters(); - return array_key_exists($parameter, $params) - ? $params[$parameter] - : null; + return array_key_exists($parameter, $params) ? $params[$parameter] : null; } /** @@ -133,7 +131,7 @@ public function getFieldBody() //TODO: Check caching here { $body = parent::getFieldBody(); foreach ($this->_params as $name => $value) { - if (!is_null($value)) { + if (null !== $value) { // Add the parameter $body .= '; '.$this->_createParameter($name, $value); } @@ -158,7 +156,7 @@ protected function toTokens($string = null) // Try creating any parameters foreach ($this->_params as $name => $value) { - if (!is_null($value)) { + if (null !== $value) { // Add the semi-colon separator $tokens[count($tokens) - 1] .= ';'; $tokens = array_merge($tokens, $this->generateTokenLines( diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php index 2fffc7b..4a814b1 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php @@ -80,7 +80,7 @@ public function getFieldBodyModel() */ public function setAddress($address) { - if (is_null($address)) { + if (null === $address) { $this->_address = null; } elseif ('' == $address) { $this->_address = ''; diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php index a7ec785..4564fef 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php @@ -40,7 +40,7 @@ public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEnc { parent::__construct($headers, $encoder, $cache, $grammar); $this->setContentType('text/plain'); - if (!is_null($charset)) { + if (null !== $charset) { $this->setCharset($charset); } } @@ -53,7 +53,7 @@ public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEnc * @param string $contentType optional * @param string $charset optional * - * @return Swift_Mime_MimePart + * @return $this */ public function setBody($body, $contentType = null, $charset = null) { @@ -82,7 +82,7 @@ public function getCharset() * * @param string $charset * - * @return Swift_Mime_MimePart + * @return $this */ public function setCharset($charset) { @@ -111,7 +111,7 @@ public function getFormat() * * @param string $format * - * @return Swift_Mime_MimePart + * @return $this */ public function setFormat($format) { @@ -128,9 +128,7 @@ public function setFormat($format) */ public function getDelSp() { - return ($this->_getHeaderParameter('Content-Type', 'delsp') == 'yes') - ? true - : false; + return 'yes' == $this->_getHeaderParameter('Content-Type', 'delsp') ? true : false; } /** @@ -138,7 +136,7 @@ public function getDelSp() * * @param bool $delsp * - * @return Swift_Mime_MimePart + * @return $this */ public function setDelSp($delsp = true) { @@ -196,7 +194,7 @@ protected function _setNestingLevel($level) protected function _convertString($string) { $charset = strtolower($this->getCharset()); - if (!in_array($charset, array('utf-8', 'iso-8859-1', ''))) { + if (!in_array($charset, array('utf-8', 'iso-8859-1', 'iso-8859-15', ''))) { // mb_convert_encoding must be the first one to check, since iconv cannot convert some words. if (function_exists('mb_convert_encoding')) { $string = mb_convert_encoding($string, $charset, 'utf-8'); diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php index 55a5cf6..1ca504e 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php @@ -112,12 +112,7 @@ public function createTextHeader($name, $value = null) public function createParameterizedHeader($name, $value = null, $params = array()) { - $header = new Swift_Mime_Headers_ParameterizedHeader($name, - $this->_encoder, (strtolower($name) == 'content-disposition') - ? $this->_paramEncoder - : null, - $this->_grammar - ); + $header = new Swift_Mime_Headers_ParameterizedHeader($name, $this->_encoder, strtolower($name) == 'content-disposition' ? $this->_paramEncoder : null, $this->_grammar); if (isset($value)) { $header->setFieldBodyModel($value); } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php index 0776240..a06ce72 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php @@ -140,7 +140,16 @@ public function has($name, $index = 0) { $lowerName = strtolower($name); - return array_key_exists($lowerName, $this->_headers) && array_key_exists($index, $this->_headers[$lowerName]); + if (!array_key_exists($lowerName, $this->_headers)) { + return false; + } + + if (func_num_args() < 2) { + // index was not specified, so we only need to check that there is at least one header value set + return (bool) count($this->_headers[$lowerName]); + } + + return array_key_exists($index, $this->_headers[$lowerName]); } /** @@ -173,10 +182,18 @@ public function set(Swift_Mime_Header $header, $index = 0) */ public function get($name, $index = 0) { - if ($this->has($name, $index)) { - $lowerName = strtolower($name); + $name = strtolower($name); + + if (func_num_args() < 2) { + if ($this->has($name)) { + $values = array_values($this->_headers[$name]); - return $this->_headers[$lowerName][$index]; + return array_shift($values); + } + } else { + if ($this->has($name, $index)) { + return $this->_headers[$name][$index]; + } } } @@ -249,7 +266,7 @@ public function removeAll($name) /** * Create a new instance of this HeaderSet. * - * @return Swift_Mime_HeaderSet + * @return self */ public function newInstance() { @@ -349,12 +366,13 @@ private function _sortHeaders($a, $b) { $lowerA = strtolower($a); $lowerB = strtolower($b); - $aPos = array_key_exists($lowerA, $this->_order) - ? $this->_order[$lowerA] - : -1; - $bPos = array_key_exists($lowerB, $this->_order) - ? $this->_order[$lowerB] - : -1; + $aPos = array_key_exists($lowerA, $this->_order) ? $this->_order[$lowerA] : -1; + $bPos = array_key_exists($lowerB, $this->_order) ? $this->_order[$lowerB] : -1; + + if (-1 === $aPos && -1 === $bPos) { + // just be sure to be determinist here + return $a > $b ? -1 : 1; + } if ($aPos == -1) { return 1; @@ -362,7 +380,7 @@ private function _sortHeaders($a, $b) return -1; } - return ($aPos < $bPos) ? -1 : 1; + return $aPos < $bPos ? -1 : 1; } /** Test if the given Header is always displayed */ diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php index 72b6ad9..72d40ce 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php @@ -15,6 +15,12 @@ */ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime_Message { + const PRIORITY_HIGHEST = 1; + const PRIORITY_HIGH = 2; + const PRIORITY_NORMAL = 3; + const PRIORITY_LOW = 4; + const PRIORITY_LOWEST = 5; + /** * Create a new SimpleMessage with $headers, $encoder and $cache. * @@ -67,7 +73,7 @@ public function getNestingLevel() * * @param string $subject * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function setSubject($subject) { @@ -93,7 +99,7 @@ public function getSubject() * * @param int $date * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function setDate($date) { @@ -119,7 +125,7 @@ public function getDate() * * @param string $address * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function setReturnPath($address) { @@ -148,7 +154,7 @@ public function getReturnPath() * @param string $address * @param string $name optional * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function setSender($address, $name = null) { @@ -181,7 +187,7 @@ public function getSender() * @param string $address * @param string $name optional * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function addFrom($address, $name = null) { @@ -202,7 +208,7 @@ public function addFrom($address, $name = null) * @param string|array $addresses * @param string $name optional * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function setFrom($addresses, $name = null) { @@ -235,7 +241,7 @@ public function getFrom() * @param string $address * @param string $name optional * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function addReplyTo($address, $name = null) { @@ -253,10 +259,10 @@ public function addReplyTo($address, $name = null) * If $name is passed and the first parameter is a string, this name will be * associated with the address. * - * @param string $addresses + * @param mixed $addresses * @param string $name optional * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function setReplyTo($addresses, $name = null) { @@ -289,7 +295,7 @@ public function getReplyTo() * @param string $address * @param string $name optional * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function addTo($address, $name = null) { @@ -311,7 +317,7 @@ public function addTo($address, $name = null) * @param mixed $addresses * @param string $name optional * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function setTo($addresses, $name = null) { @@ -344,7 +350,7 @@ public function getTo() * @param string $address * @param string $name optional * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function addCc($address, $name = null) { @@ -363,7 +369,7 @@ public function addCc($address, $name = null) * @param mixed $addresses * @param string $name optional * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function setCc($addresses, $name = null) { @@ -396,7 +402,7 @@ public function getCc() * @param string $address * @param string $name optional * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function addBcc($address, $name = null) { @@ -415,7 +421,7 @@ public function addBcc($address, $name = null) * @param mixed $addresses * @param string $name optional * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function setBcc($addresses, $name = null) { @@ -447,16 +453,16 @@ public function getBcc() * * @param int $priority * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function setPriority($priority) { $priorityMap = array( - 1 => 'Highest', - 2 => 'High', - 3 => 'Normal', - 4 => 'Low', - 5 => 'Lowest', + self::PRIORITY_HIGHEST => 'Highest', + self::PRIORITY_HIGH => 'High', + self::PRIORITY_NORMAL => 'Normal', + self::PRIORITY_LOW => 'Low', + self::PRIORITY_LOWEST => 'Lowest', ); $pMapKeys = array_keys($priorityMap); if ($priority > max($pMapKeys)) { @@ -495,7 +501,7 @@ public function getPriority() * * @param array $addresses * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function setReadReceiptTo($addresses) { @@ -522,7 +528,7 @@ public function getReadReceiptTo() * * @param Swift_Mime_MimeEntity $entity * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function attach(Swift_Mime_MimeEntity $entity) { @@ -536,7 +542,7 @@ public function attach(Swift_Mime_MimeEntity $entity) * * @param Swift_Mime_MimeEntity $entity * - * @return Swift_Mime_SimpleMessage + * @return $this */ public function detach(Swift_Mime_MimeEntity $entity) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php index 8e14ba8..a13f1b2 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php @@ -161,7 +161,7 @@ public function getContentType() * * @param string $type * - * @return Swift_Mime_SimpleMimeEntity + * @return $this */ public function setContentType($type) { @@ -192,7 +192,7 @@ public function getId() * * @param string $id * - * @return Swift_Mime_SimpleMimeEntity + * @return $this */ public function setId($id) { @@ -223,7 +223,7 @@ public function getDescription() * * @param string $description * - * @return Swift_Mime_SimpleMimeEntity + * @return $this */ public function setDescription($description) { @@ -251,7 +251,7 @@ public function getMaxLineLength() * * @param int $length * - * @return Swift_Mime_SimpleMimeEntity + * @return $this */ public function setMaxLineLength($length) { @@ -276,17 +276,13 @@ public function getChildren() * @param Swift_Mime_MimeEntity[] $children * @param int $compoundLevel For internal use only * - * @return Swift_Mime_SimpleMimeEntity + * @return $this */ public function setChildren(array $children, $compoundLevel = null) { // TODO: Try to refactor this logic - $compoundLevel = isset($compoundLevel) - ? $compoundLevel - : $this->_getCompoundLevel($children) - ; - + $compoundLevel = isset($compoundLevel) ? $compoundLevel : $this->_getCompoundLevel($children); $immediateChildren = array(); $grandchildren = array(); $newContentType = $this->_userContentType; @@ -311,15 +307,15 @@ public function setChildren(array $children, $compoundLevel = null) } } - if (!empty($immediateChildren)) { + if ($immediateChildren) { $lowestLevel = $this->_getNeededChildLevel($immediateChildren[0], $compoundLevel); // Determine which composite media type is needed to accommodate the // immediate children foreach ($this->_compositeRanges as $mediaType => $range) { - if ($lowestLevel > $range[0] - && $lowestLevel <= $range[1]) { + if ($lowestLevel > $range[0] && $lowestLevel <= $range[1]) { $newContentType = $mediaType; + break; } } @@ -349,9 +345,7 @@ public function setChildren(array $children, $compoundLevel = null) */ public function getBody() { - return ($this->_body instanceof Swift_OutputByteStream) - ? $this->_readStream($this->_body) - : $this->_body; + return $this->_body instanceof Swift_OutputByteStream ? $this->_readStream($this->_body) : $this->_body; } /** @@ -361,7 +355,7 @@ public function getBody() * @param mixed $body * @param string $contentType optional * - * @return Swift_Mime_SimpleMimeEntity + * @return $this */ public function setBody($body, $contentType = null) { @@ -392,7 +386,7 @@ public function getEncoder() * * @param Swift_Mime_ContentEncoder $encoder * - * @return Swift_Mime_SimpleMimeEntity + * @return $this */ public function setEncoder(Swift_Mime_ContentEncoder $encoder) { @@ -428,7 +422,7 @@ public function getBoundary() * * @throws Swift_RfcComplianceException * - * @return Swift_Mime_SimpleMimeEntity + * @return $this */ public function setBoundary($boundary) { @@ -486,12 +480,8 @@ protected function _bodyToString() if ($this->_cache->hasKey($this->_cacheKey, 'body')) { $body = $this->_cache->getString($this->_cacheKey, 'body'); } else { - $body = "\r\n".$this->_encoder->encodeString($this->getBody(), 0, - $this->getMaxLineLength() - ); - $this->_cache->setString($this->_cacheKey, 'body', $body, - Swift_KeyCache::MODE_WRITE - ); + $body = "\r\n".$this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength()); + $this->_cache->setString($this->_cacheKey, 'body', $body, Swift_KeyCache::MODE_WRITE); } $string .= $body; } @@ -602,9 +592,9 @@ protected function _setHeaderFieldModel($field, $model) $this->_headers->get($field)->setFieldBodyModel($model); return true; - } else { - return false; } + + return false; } /** @@ -626,9 +616,9 @@ protected function _setHeaderParameter($field, $parameter, $value) $this->_headers->get($field)->setParameter($parameter, $value); return true; - } else { - return false; } + + return false; } /** @@ -716,9 +706,7 @@ private function _setEncoding($encoding) private function _assertValidBoundary($boundary) { - if (!preg_match( - '/^[a-z0-9\'\(\)\+_\-,\.\/:=\?\ ]{0,69}[a-z0-9\'\(\)\+_\-,\.\/:=\?]$/Di', - $boundary)) { + if (!preg_match('/^[a-z0-9\'\(\)\+_\-,\.\/:=\?\ ]{0,69}[a-z0-9\'\(\)\+_\-,\.\/:=\?]$/Di', $boundary)) { throw new Swift_RfcComplianceException('Mime boundary set is not RFC 2046 compliant.'); } } @@ -757,18 +745,16 @@ private function _getNeededChildLevel($child, $compoundLevel) $realLevel = $child->getNestingLevel(); $lowercaseType = strtolower($child->getContentType()); - if (isset($filter[$realLevel]) - && isset($filter[$realLevel][$lowercaseType])) { + if (isset($filter[$realLevel]) && isset($filter[$realLevel][$lowercaseType])) { return $filter[$realLevel][$lowercaseType]; - } else { - return $realLevel; } + + return $realLevel; } private function _createChild() { - return new self($this->_headers->newInstance(), - $this->_encoder, $this->_cache, $this->_grammar); + return new self($this->_headers->newInstance(), $this->_encoder, $this->_cache, $this->_grammar); } private function _notifyEncoderChanged(Swift_Mime_ContentEncoder $encoder) @@ -800,34 +786,33 @@ private function _sortChildren() // Sort in order of preference, if there is one if ($shouldSort) { - usort($this->_immediateChildren, array($this, '_childSortAlgorithm')); - } - } + // Group the messages by order of preference + $sorted = array(); + foreach ($this->_immediateChildren as $child) { + $type = $child->getContentType(); + $level = array_key_exists($type, $this->_alternativePartOrder) ? $this->_alternativePartOrder[$type] : max($this->_alternativePartOrder) + 1; - private function _childSortAlgorithm($a, $b) - { - $typePrefs = array(); - $types = array( - strtolower($a->getContentType()), - strtolower($b->getContentType()), - ); - foreach ($types as $type) { - $typePrefs[] = (array_key_exists($type, $this->_alternativePartOrder)) - ? $this->_alternativePartOrder[$type] - : (max($this->_alternativePartOrder) + 1); - } + if (empty($sorted[$level])) { + $sorted[$level] = array(); + } - return ($typePrefs[0] >= $typePrefs[1]) ? 1 : -1; - } + $sorted[$level][] = $child; + } - // -- Destructor + ksort($sorted); + + $this->_immediateChildren = array_reduce($sorted, 'array_merge', array()); + } + } /** * Empties it's own contents from the cache. */ public function __destruct() { - $this->_cache->clearAll($this->_cacheKey); + if ($this->_cache instanceof Swift_KeyCache) { + $this->_cache->clearAll($this->_cacheKey); + } } /** @@ -839,14 +824,8 @@ public function __destruct() */ private function _assertValidId($id) { - if (!preg_match( - '/^'.$this->_grammar->getDefinition('id-left').'@'. - $this->_grammar->getDefinition('id-right').'$/D', - $id - )) { - throw new Swift_RfcComplianceException( - 'Invalid ID given <'.$id.'>' - ); + if (!preg_match('/^'.$this->_grammar->getDefinition('id-left').'@'.$this->_grammar->getDefinition('id-right').'$/D', $id)) { + throw new Swift_RfcComplianceException('Invalid ID given <'.$id.'>'); } } @@ -857,7 +836,7 @@ public function __clone() { $this->_headers = clone $this->_headers; $this->_encoder = clone $this->_encoder; - $this->_cacheKey = uniqid(); + $this->_cacheKey = md5(uniqid(getmypid().mt_rand(), true)); $children = array(); foreach ($this->_children as $pos => $child) { $children[$pos] = clone $child; diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php index 215f8db..525b7ec 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php @@ -50,7 +50,7 @@ public function __construct($body = null, $contentType = null, $charset = null) * @param string $contentType * @param string $charset * - * @return Swift_Mime_MimePart + * @return self */ public static function newInstance($body = null, $contentType = null, $charset = null) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/NullTransport.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/NullTransport.php index b38e1cf..ddde335 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/NullTransport.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/NullTransport.php @@ -15,9 +15,6 @@ */ class Swift_NullTransport extends Swift_Transport_NullTransport { - /** - * Create a new NullTransport. - */ public function __construct() { call_user_func_array( @@ -30,7 +27,7 @@ public function __construct() /** * Create a new NullTransport instance. * - * @return Swift_NullTransport + * @return self */ public static function newInstance() { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php index 083b930..0762b36 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php @@ -157,12 +157,9 @@ public function getReplacementsFor($address) { if ($this->_replacements instanceof Swift_Plugins_Decorator_Replacements) { return $this->_replacements->getReplacementsFor($address); - } else { - return isset($this->_replacements[$address]) - ? $this->_replacements[$address] - : null - ; } + + return isset($this->_replacements[$address]) ? $this->_replacements[$address] : null; } /** diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php index 7552b67..5834440 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php @@ -18,7 +18,7 @@ class Swift_Plugins_ImpersonatePlugin implements Swift_Events_SendListener /** * The sender to impersonate. * - * @var String + * @var string */ private $_sender; diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php index e622cb3..5ff1d93 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php @@ -16,7 +16,7 @@ class Swift_Plugins_MessageLogger implements Swift_Events_SendListener { /** - * @var array + * @var Swift_Mime_Message[] */ private $messages; @@ -28,7 +28,7 @@ public function __construct() /** * Get the message list. * - * @return array + * @return Swift_Mime_Message[] */ public function getMessages() { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php index 18abb77..3146152 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php @@ -63,7 +63,7 @@ public function __construct($host, $port = 110, $crypto = null) * @param int $port * @param string $crypto as "tls" or "ssl" * - * @return Swift_Plugins_PopBeforeSmtpPlugin + * @return self */ public static function newInstance($host, $port = 110, $crypto = null) { @@ -75,7 +75,7 @@ public static function newInstance($host, $port = 110, $crypto = null) * * @param Swift_Plugins_Pop_Pop3Connection $connection * - * @return Swift_Plugins_PopBeforeSmtpPlugin + * @return $this */ public function setConnection(Swift_Plugins_Pop_Pop3Connection $connection) { @@ -99,7 +99,7 @@ public function bindSmtp(Swift_Transport $smtp) * * @param int $timeout * - * @return Swift_Plugins_PopBeforeSmtpPlugin + * @return $this */ public function setTimeout($timeout) { @@ -113,7 +113,7 @@ public function setTimeout($timeout) * * @param string $username * - * @return Swift_Plugins_PopBeforeSmtpPlugin + * @return $this */ public function setUsername($username) { @@ -127,7 +127,7 @@ public function setUsername($username) * * @param string $password * - * @return Swift_Plugins_PopBeforeSmtpPlugin + * @return $this */ public function setPassword($password) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php index 91aeb27..a37901f 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php @@ -49,25 +49,13 @@ public function sendPerformed(Swift_Events_SendEvent $evt) $message = $evt->getMessage(); $failures = array_flip($evt->getFailedRecipients()); foreach ((array) $message->getTo() as $address => $null) { - $this->_reporter->notify( - $message, $address, (array_key_exists($address, $failures) - ? Swift_Plugins_Reporter::RESULT_FAIL - : Swift_Plugins_Reporter::RESULT_PASS) - ); + $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS); } foreach ((array) $message->getCc() as $address => $null) { - $this->_reporter->notify( - $message, $address, (array_key_exists($address, $failures) - ? Swift_Plugins_Reporter::RESULT_FAIL - : Swift_Plugins_Reporter::RESULT_PASS) - ); + $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS); } foreach ((array) $message->getBcc() as $address => $null) { - $this->_reporter->notify( - $message, $address, (array_key_exists($address, $failures) - ? Swift_Plugins_Reporter::RESULT_FAIL - : Swift_Plugins_Reporter::RESULT_PASS) - ); + $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS); } } } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php index a3b421e..2f4b9a7 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php @@ -98,16 +98,16 @@ public function beforeSendPerformed(Swift_Events_SendEvent $evt) $duration = $time - $this->_start; switch ($this->_mode) { - case self::BYTES_PER_MINUTE : + case self::BYTES_PER_MINUTE: $sleep = $this->_throttleBytesPerMinute($duration); break; - case self::MESSAGES_PER_SECOND : + case self::MESSAGES_PER_SECOND: $sleep = $this->_throttleMessagesPerSecond($duration); break; - case self::MESSAGES_PER_MINUTE : + case self::MESSAGES_PER_MINUTE: $sleep = $this->_throttleMessagesPerMinute($duration); break; - default : + default: $sleep = 0; break; } @@ -151,9 +151,9 @@ public function getTimestamp() { if (isset($this->_timer)) { return $this->_timer->getTimestamp(); - } else { - return time(); } + + return time(); } /** diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php index 503db84..83cbddc 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php @@ -26,7 +26,7 @@ private function __construct() /** * Gets the instance of Preferences. * - * @return Swift_Preferences + * @return self */ public static function getInstance() { @@ -42,12 +42,11 @@ public static function getInstance() * * @param string $charset * - * @return Swift_Preferences + * @return $this */ public function setCharset($charset) { - Swift_DependencyContainer::getInstance() - ->register('properties.charset')->asValue($charset); + Swift_DependencyContainer::getInstance()->register('properties.charset')->asValue($charset); return $this; } @@ -57,12 +56,11 @@ public function setCharset($charset) * * @param string $dir * - * @return Swift_Preferences + * @return $this */ public function setTempDir($dir) { - Swift_DependencyContainer::getInstance() - ->register('tempdir')->asValue($dir); + Swift_DependencyContainer::getInstance()->register('tempdir')->asValue($dir); return $this; } @@ -72,12 +70,11 @@ public function setTempDir($dir) * * @param string $type * - * @return Swift_Preferences + * @return $this */ public function setCacheType($type) { - Swift_DependencyContainer::getInstance() - ->register('cache')->asAliasOf(sprintf('cache.%s', $type)); + Swift_DependencyContainer::getInstance()->register('cache')->asAliasOf(sprintf('cache.%s', $type)); return $this; } @@ -87,7 +84,7 @@ public function setCacheType($type) * * @param bool $dotEscape * - * @return Swift_Preferences + * @return $this */ public function setQPDotEscape($dotEscape) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php index 974b24f..47ae7a5 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php @@ -36,7 +36,7 @@ public function __construct($command = '/usr/sbin/sendmail -bs') * * @param string $command * - * @return Swift_SendmailTransport + * @return self */ public static function newInstance($command = '/usr/sbin/sendmail -bs') { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/BodySigner.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/BodySigner.php index 9ffcef3..8e66e18 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/BodySigner.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/BodySigner.php @@ -20,7 +20,7 @@ interface Swift_Signers_BodySigner extends Swift_Signer * * @param Swift_Message $message * - * @return Swift_Signers_BodySigner + * @return self */ public function signMessage(Swift_Message $message); diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php index 514b61a..454e84b 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php @@ -39,9 +39,11 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner /** * Hash algorithm used. * + * @see RFC6376 3.3: Signers MUST implement and SHOULD sign using rsa-sha256. + * * @var string */ - protected $_hashAlgorithm = 'rsa-sha1'; + protected $_hashAlgorithm = 'rsa-sha256'; /** * Body canon method. @@ -62,12 +64,12 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner * * @var array */ - protected $_ignoredHeaders = array(); + protected $_ignoredHeaders = array('return-path' => true); /** * Signer identity. * - * @var unknown_type + * @var string */ protected $_signerIdentity; @@ -101,7 +103,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner /** * When will the signature expires false means not embedded, if sigTimestamp is auto - * Expiration is relative, otherwhise it's absolute. + * Expiration is relative, otherwise it's absolute. * * @var int */ @@ -123,7 +125,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner protected $_signedHeaders = array(); /** - * If debugHeaders is set store debugDatas here. + * If debugHeaders is set store debugData here. * * @var string */ @@ -143,13 +145,6 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner */ protected $_dkimHeader; - /** - * Hash Handler. - * - * @var hash_ressource - */ - private $_headerHashHandler; - private $_bodyHashHandler; private $_headerHash; @@ -181,6 +176,11 @@ public function __construct($privateKey, $domainName, $selector) $this->_domainName = $domainName; $this->_signerIdentity = '@'.$domainName; $this->_selector = $selector; + + // keep fallback hash algorithm sha1 if php version is lower than 5.4.8 + if (PHP_VERSION_ID < 50408) { + $this->_hashAlgorithm = 'rsa-sha1'; + } } /** @@ -190,7 +190,7 @@ public function __construct($privateKey, $domainName, $selector) * @param string $domainName * @param string $selector * - * @return Swift_Signers_DKIMSigner + * @return self */ public static function newInstance($privateKey, $domainName, $selector) { @@ -206,7 +206,6 @@ public function reset() { $this->_headerHash = null; $this->_signedHeaders = array(); - $this->_headerHashHandler = null; $this->_bodyHash = null; $this->_bodyHashHandler = null; $this->_bodyCanonIgnoreStart = 2; @@ -231,6 +230,7 @@ public function reset() * * @return int */ + // TODO fix return public function write($bytes) { $this->_canonicalizeBody($bytes); @@ -242,8 +242,6 @@ public function write($bytes) /** * For any bytes that are currently buffered inside the stream, force them * off the buffer. - * - * @throws Swift_IoException */ public function commit() { @@ -284,8 +282,6 @@ public function unbind(Swift_InputByteStream $is) return; } } - - return; } /** @@ -300,19 +296,28 @@ public function flushBuffers() } /** - * Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1 defaults to rsa-sha256. + * Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1. * - * @param string $hash + * @param string $hash 'rsa-sha1' or 'rsa-sha256' * - * @return Swift_Signers_DKIMSigner + * @throws Swift_SwiftException + * + * @return $this */ public function setHashAlgorithm($hash) { - // Unable to sign with rsa-sha256 - if ($hash == 'rsa-sha1') { - $this->_hashAlgorithm = 'rsa-sha1'; - } else { - $this->_hashAlgorithm = 'rsa-sha256'; + switch ($hash) { + case 'rsa-sha1': + $this->_hashAlgorithm = 'rsa-sha1'; + break; + case 'rsa-sha256': + $this->_hashAlgorithm = 'rsa-sha256'; + if (!defined('OPENSSL_ALGO_SHA256')) { + throw new Swift_SwiftException('Unable to set sha256 as it is not supported by OpenSSL.'); + } + break; + default: + throw new Swift_SwiftException('Unable to set the hash algorithm, must be one of rsa-sha1 or rsa-sha256 (%s given).', $hash); } return $this; @@ -323,7 +328,7 @@ public function setHashAlgorithm($hash) * * @param string $canon * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setBodyCanon($canon) { @@ -341,7 +346,7 @@ public function setBodyCanon($canon) * * @param string $canon * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setHeaderCanon($canon) { @@ -359,7 +364,7 @@ public function setHeaderCanon($canon) * * @param string $identity * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setSignerIdentity($identity) { @@ -373,7 +378,7 @@ public function setSignerIdentity($identity) * * @param mixed $len (bool or int) * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setBodySignedLen($len) { @@ -381,7 +386,7 @@ public function setBodySignedLen($len) $this->_showLen = true; $this->_maxLen = PHP_INT_MAX; } elseif ($len === false) { - $this->showLen = false; + $this->_showLen = false; $this->_maxLen = PHP_INT_MAX; } else { $this->_showLen = true; @@ -394,9 +399,9 @@ public function setBodySignedLen($len) /** * Set the signature timestamp. * - * @param timestamp $time + * @param int $time A timestamp * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setSignatureTimestamp($time) { @@ -408,9 +413,9 @@ public function setSignatureTimestamp($time) /** * Set the signature expiration timestamp. * - * @param timestamp $time + * @param int $time A timestamp * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setSignatureExpiration($time) { @@ -440,10 +445,10 @@ public function startBody() { // Init switch ($this->_hashAlgorithm) { - case 'rsa-sha256' : + case 'rsa-sha256': $this->_bodyHashHandler = hash_init('sha256'); break; - case 'rsa-sha1' : + case 'rsa-sha1': $this->_bodyHashHandler = hash_init('sha1'); break; } @@ -575,22 +580,26 @@ public function addSignature(Swift_Mime_HeaderSet $headers) protected function _addHeader($header, $is_sig = false) { switch ($this->_headerCanon) { - case 'relaxed' : + case 'relaxed': // Prepare Header and cascade $exploded = explode(':', $header, 2); $name = strtolower(trim($exploded[0])); $value = str_replace("\r\n", '', $exploded[1]); $value = preg_replace("/[ \t][ \t]+/", ' ', $value); $header = $name.':'.trim($value).($is_sig ? '' : "\r\n"); - case 'simple' : + case 'simple': // Nothing to do } $this->_addToHeaderHash($header); } + /** + * @deprecated This method is currently useless in this class but it must be + * kept for BC reasons due to its "protected" scope. This method + * might be overridden by custom client code. + */ protected function _endOfHeaders() { - //$this->_headerHash=hash_final($this->_headerHashHandler, true); } protected function _canonicalizeBody($string) @@ -604,10 +613,10 @@ protected function _canonicalizeBody($string) continue; } switch ($string[$i]) { - case "\r" : + case "\r": $this->_bodyCanonLastChar = "\r"; break; - case "\n" : + case "\n": if ($this->_bodyCanonLastChar == "\r") { if ($method) { $this->_bodyCanonSpace = false; @@ -623,13 +632,13 @@ protected function _canonicalizeBody($string) // todo handle it but should never happen } break; - case ' ' : - case "\t" : + case ' ': + case "\t": if ($method) { $this->_bodyCanonSpace = true; break; } - default : + default: if ($this->_bodyCanonEmptyCounter > 0) { $canon .= str_repeat("\r\n", $this->_bodyCanonEmptyCounter); $this->_bodyCanonEmptyCounter = 0; @@ -682,6 +691,7 @@ private function _addToHeaderHash($header) private function _getEncryptedHash() { $signature = ''; + switch ($this->_hashAlgorithm) { case 'rsa-sha1': $algorithm = OPENSSL_ALGO_SHA1; diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php index bceda3d..0365363 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php @@ -131,7 +131,7 @@ public function __construct($privateKey, $domainName, $selector) * @param string $domainName * @param string $selector * - * @return Swift_Signers_DomainKeySigner + * @return self */ public static function newInstance($privateKey, $domainName, $selector) { @@ -141,7 +141,7 @@ public static function newInstance($privateKey, $domainName, $selector) /** * Resets internal states. * - * @return Swift_Signers_DomainKeysSigner + * @return $this */ public function reset() { @@ -169,8 +169,7 @@ public function reset() * * @throws Swift_IoException * - * @return int - * @return Swift_Signers_DomainKeysSigner + * @return $this */ public function write($bytes) { @@ -188,7 +187,7 @@ public function write($bytes) * * @throws Swift_IoException * - * @return Swift_Signers_DomainKeysSigner + * @return $this */ public function commit() { @@ -203,7 +202,7 @@ public function commit() * * @param Swift_InputByteStream $is * - * @return Swift_Signers_DomainKeysSigner + * @return $this */ public function bind(Swift_InputByteStream $is) { @@ -221,7 +220,7 @@ public function bind(Swift_InputByteStream $is) * * @param Swift_InputByteStream $is * - * @return Swift_Signers_DomainKeysSigner + * @return $this */ public function unbind(Swift_InputByteStream $is) { @@ -230,7 +229,7 @@ public function unbind(Swift_InputByteStream $is) if ($stream === $is) { unset($this->_bound[$k]); - return; + break; } } @@ -243,7 +242,7 @@ public function unbind(Swift_InputByteStream $is) * * @throws Swift_IoException * - * @return Swift_Signers_DomainKeysSigner + * @return $this */ public function flushBuffers() { @@ -257,7 +256,7 @@ public function flushBuffers() * * @param string $hash * - * @return Swift_Signers_DomainKeysSigner + * @return $this */ public function setHashAlgorithm($hash) { @@ -271,7 +270,7 @@ public function setHashAlgorithm($hash) * * @param string $canon simple | nofws defaults to simple * - * @return Swift_Signers_DomainKeysSigner + * @return $this */ public function setCanon($canon) { @@ -289,7 +288,7 @@ public function setCanon($canon) * * @param string $identity * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function setSignerIdentity($identity) { @@ -303,7 +302,7 @@ public function setSignerIdentity($identity) * * @param bool $debug * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function setDebugHeaders($debug) { @@ -336,9 +335,9 @@ public function getAlteredHeaders() { if ($this->_debugHeaders) { return array('DomainKey-Signature', 'X-DebugHash'); - } else { - return array('DomainKey-Signature'); } + + return array('DomainKey-Signature'); } /** @@ -346,7 +345,7 @@ public function getAlteredHeaders() * * @param string $header_name * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function ignoreHeader($header_name) { @@ -360,7 +359,7 @@ public function ignoreHeader($header_name) * * @param Swift_Mime_HeaderSet $headers * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function setHeaders(Swift_Mime_HeaderSet $headers) { @@ -392,7 +391,7 @@ public function setHeaders(Swift_Mime_HeaderSet $headers) * * @param Swift_Mime_HeaderSet $headers * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function addSignature(Swift_Mime_HeaderSet $headers) { @@ -413,14 +412,14 @@ public function addSignature(Swift_Mime_HeaderSet $headers) protected function _addHeader($header) { switch ($this->_canon) { - case 'nofws' : + case 'nofws': // Prepare Header and cascade $exploded = explode(':', $header, 2); $name = strtolower(trim($exploded[0])); $value = str_replace("\r\n", '', $exploded[1]); $value = preg_replace("/[ \t][ \t]+/", ' ', $value); $header = $name.':'.trim($value)."\r\n"; - case 'simple' : + case 'simple': // Nothing to do } $this->_addToHash($header); @@ -442,10 +441,10 @@ protected function _canonicalizeBody($string) continue; } switch ($string[$i]) { - case "\r" : + case "\r": $this->_bodyCanonLastChar = "\r"; break; - case "\n" : + case "\n": if ($this->_bodyCanonLastChar == "\r") { if ($nofws) { $this->_bodyCanonSpace = false; @@ -461,14 +460,14 @@ protected function _canonicalizeBody($string) throw new Swift_SwiftException('Invalid new line sequence in mail found \n without preceding \r'); } break; - case ' ' : - case "\t" : + case ' ': + case "\t": case "\x09": //HTAB if ($nofws) { $this->_bodyCanonSpace = true; break; } - default : + default: if ($this->_bodyCanonEmptyCounter > 0) { $canon .= str_repeat("\r\n", $this->_bodyCanonEmptyCounter); $this->_bodyCanonEmptyCounter = 0; @@ -498,11 +497,11 @@ private function _startHash() { // Init switch ($this->_hashAlgorithm) { - case 'rsa-sha1' : + case 'rsa-sha1': $this->_hashHandler = hash_init('sha1'); break; } - $this->_canonLine = ''; + $this->_bodyCanonLine = ''; } /** diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php index c75cb08..ef8832f 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php @@ -20,21 +20,21 @@ interface Swift_Signers_HeaderSigner extends Swift_Signer, Swift_InputByteStream * * @param string $header_name * - * @return Swift_Signers_HeaderSigner + * @return self */ public function ignoreHeader($header_name); /** * Prepare the Signer to get a new Body. * - * @return Swift_Signers_HeaderSigner + * @return self */ public function startBody(); /** * Give the signal that the body has finished streaming. * - * @return Swift_Signers_HeaderSigner + * @return self */ public function endBody(); @@ -43,7 +43,7 @@ public function endBody(); * * @param Swift_Mime_SimpleHeaderSet $headers * - * @return Swift_Signers_HeaderSigner + * @return self */ public function setHeaders(Swift_Mime_HeaderSet $headers); @@ -52,7 +52,7 @@ public function setHeaders(Swift_Mime_HeaderSet $headers); * * @param Swift_Mime_HeaderSet $headers * - * @return Swift_Signers_HeaderSigner + * @return self */ public function addSignature(Swift_Mime_HeaderSet $headers); diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php index 9f1022c..8fdbaa4 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php @@ -29,11 +29,12 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner public function __construct($privateKey, $domainName, $selector) { - if (extension_loaded('opendkim')) { - $this->_peclLoaded = true; - } else { + if (!extension_loaded('opendkim')) { throw new Swift_SwiftException('php-opendkim extension not found'); } + + $this->_peclLoaded = true; + parent::__construct($privateKey, $domainName, $selector); } @@ -61,9 +62,9 @@ public function setHeaders(Swift_Mime_HeaderSet $headers) if (is_bool($bodyLen)) { $bodyLen = -1; } - $hash = ($this->_hashAlgorithm == 'rsa-sha1') ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256; - $bodyCanon = ($this->_bodyCanon == 'simple') ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED; - $headerCanon = ($this->_headerCanon == 'simple') ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED; + $hash = $this->_hashAlgorithm == 'rsa-sha1' ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256; + $bodyCanon = $this->_bodyCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED; + $headerCanon = $this->_headerCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED; $this->_dkimHandler = new OpenDKIMSign($this->_privateKey, $this->_selector, $this->_domainName, $headerCanon, $bodyCanon, $hash, $bodyLen); // Hardcode signature Margin for now $this->_dkimHandler->setMargin(78); @@ -130,9 +131,9 @@ public function reset() /** * Set the signature timestamp. * - * @param timestamp $time + * @param int $time * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setSignatureTimestamp($time) { @@ -144,9 +145,9 @@ public function setSignatureTimestamp($time) /** * Set the signature expiration timestamp. * - * @param timestamp $time + * @param int $time * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setSignatureExpiration($time) { @@ -160,7 +161,7 @@ public function setSignatureExpiration($time) * * @param bool $debug * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setDebugHeaders($debug) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php index d4c77e7..d13c02e 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php @@ -41,9 +41,9 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner /** * Constructor. * - * @param string $certificate - * @param string $privateKey - * @param string $encryptCertificate + * @param string|null $signCertificate + * @param string|null $signPrivateKey + * @param string|null $encryptCertificate */ public function __construct($signCertificate = null, $signPrivateKey = null, $encryptCertificate = null) { @@ -74,7 +74,7 @@ public function __construct($signCertificate = null, $signPrivateKey = null, $en * @param string $certificate * @param string $privateKey * - * @return Swift_Signers_SMimeSigner + * @return self */ public static function newInstance($certificate = null, $privateKey = null) { @@ -84,14 +84,14 @@ public static function newInstance($certificate = null, $privateKey = null) /** * Set the certificate location to use for signing. * - * @link http://www.php.net/manual/en/openssl.pkcs7.flags.php + * @see http://www.php.net/manual/en/openssl.pkcs7.flags.php * * @param string $certificate * @param string|array $privateKey If the key needs an passphrase use array('file-location', 'passphrase') instead * @param int $signOptions Bitwise operator options for openssl_pkcs7_sign() * @param string $extraCerts A file containing intermediate certificates needed by the signing certificate * - * @return Swift_Signers_SMimeSigner + * @return $this */ public function setSignCertificate($certificate, $privateKey = null, $signOptions = PKCS7_DETACHED, $extraCerts = null) { @@ -117,13 +117,13 @@ public function setSignCertificate($certificate, $privateKey = null, $signOption /** * Set the certificate location to use for encryption. * - * @link http://www.php.net/manual/en/openssl.pkcs7.flags.php - * @link http://nl3.php.net/manual/en/openssl.ciphers.php + * @see http://www.php.net/manual/en/openssl.pkcs7.flags.php + * @see http://nl3.php.net/manual/en/openssl.ciphers.php * * @param string|array $recipientCerts Either an single X.509 certificate, or an assoc array of X.509 certificates. * @param int $cipher * - * @return Swift_Signers_SMimeSigner + * @return $this */ public function setEncryptCertificate($recipientCerts, $cipher = null) { @@ -167,9 +167,9 @@ public function getSignPrivateKey() * But some older mail clients, namely Microsoft Outlook 2000 will work when the message first encrypted. * As this goes against the official specs, its recommended to only use 'encryption -> signing' when specifically targeting these 'broken' clients. * - * @param string $signThenEncrypt + * @param bool $signThenEncrypt * - * @return Swift_Signers_SMimeSigner + * @return $this */ public function setSignThenEncrypt($signThenEncrypt = true) { @@ -189,7 +189,7 @@ public function isSignThenEncrypt() /** * Resets internal states. * - * @return Swift_Signers_SMimeSigner + * @return $this */ public function reset() { @@ -201,7 +201,7 @@ public function reset() * * @param Swift_Message $message * - * @return Swift_Signers_SMimeSigner + * @return $this */ public function signMessage(Swift_Message $message) { @@ -400,7 +400,6 @@ protected function streamToMime(Swift_OutputByteStream $fromStream, Swift_Messag } $boundary = trim($contentTypeData['1'], '"'); - $boundaryLen = strlen($boundary); // Skip the header and CRLF CRLF $fromStream->setReadPointer($headersPosEnd + 4); diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php index 6251611..b97f01e 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php @@ -49,7 +49,7 @@ public function __construct($host = 'localhost', $port = 25, $security = null) * @param int $port * @param string $security * - * @return Swift_SmtpTransport + * @return self */ public static function newInstance($host = 'localhost', $port = 25, $security = null) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SpoolTransport.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SpoolTransport.php index cf9bf78..79c9b1f 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SpoolTransport.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SpoolTransport.php @@ -38,7 +38,7 @@ public function __construct(Swift_Spool $spool) * * @param Swift_Spool $spool * - * @return Swift_SpoolTransport + * @return self */ public static function newInstance(Swift_Spool $spool) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php index d573566..9412b1d 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php @@ -124,13 +124,14 @@ public function filter($buffer, $_minReplaces = -1) $newBuffer = array(); $buf_size = count($buffer); + $last_size = 0; for ($i = 0; $i < $buf_size; ++$i) { $search_pos = $this->_tree; $last_found = PHP_INT_MAX; // We try to find if the next byte is part of a search pattern for ($j = 0; $j <= $this->_treeMaxLen; ++$j) { // We have a new byte for a search pattern - if (isset($buffer [$p = $i + $j]) && isset($search_pos[$buffer[$p]])) { + if (isset($buffer[$p = $i + $j]) && isset($search_pos[$buffer[$p]])) { $search_pos = $search_pos[$buffer[$p]]; // We have a complete pattern, save, in case we don't find a better match later if (isset($search_pos[-1]) && $search_pos[-1] < $last_found diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php index d0db8b9..f64144a 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php @@ -42,6 +42,10 @@ public function __construct($search, $replace) */ public function shouldBuffer($buffer) { + if ('' === $buffer) { + return false; + } + $endOfBuffer = substr($buffer, -1); foreach ((array) $this->_search as $needle) { if (false !== strpos($needle, $endOfBuffer)) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php index 90971ab..60233f9 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php @@ -57,7 +57,7 @@ public function __construct(Swift_Transport_IoBuffer $buf, Swift_Events_EventDis * * @param string $domain * - * @return Swift_Transport_AbstractSmtpTransport + * @return $this */ public function setLocalDomain($domain) { @@ -396,7 +396,7 @@ protected function _getFullResponse($seq) do { $line = $this->_buffer->readLine($seq); $response .= $line; - } while (null !== $line && false !== $line && ' ' != $line{3}); + } while (null !== $line && false !== $line && ' ' != $line[3]); } catch (Swift_TransportException $e) { $this->_throwException($e); } catch (Swift_IoException $e) { @@ -417,7 +417,7 @@ private function _doMailTransaction($message, $reversePath, array $recipients, a foreach ($recipients as $forwardPath) { try { $this->_doRcptToCommand($forwardPath); - $sent++; + ++$sent; } catch (Swift_TransportException $e) { $failedRecipients[] = $forwardPath; } @@ -461,11 +461,17 @@ private function _sendBcc(Swift_Mime_Message $message, $reversePath, array $bcc, /** Try to determine the hostname of the server this is run on */ private function _lookupHostname() { - if (!empty($_SERVER['SERVER_NAME']) - && $this->_isFqdn($_SERVER['SERVER_NAME'])) { + if (!empty($_SERVER['SERVER_NAME']) && $this->_isFqdn($_SERVER['SERVER_NAME'])) { $this->_domain = $_SERVER['SERVER_NAME']; } elseif (!empty($_SERVER['SERVER_ADDR'])) { - $this->_domain = sprintf('[%s]', $_SERVER['SERVER_ADDR']); + // Set the address literal tag (See RFC 5321, section: 4.1.3) + if (false === strpos($_SERVER['SERVER_ADDR'], ':')) { + $prefix = ''; // IPv4 addresses are not tagged. + } else { + $prefix = 'IPv6:'; // Adding prefix in case of IPv6. + } + + $this->_domain = sprintf('[%s%s]', $prefix, $_SERVER['SERVER_ADDR']); } } @@ -475,9 +481,9 @@ private function _isFqdn($hostname) // We could do a really thorough check, but there's really no point if (false !== $dotPos = strpos($hostname, '.')) { return ($dotPos > 0) && ($dotPos != strlen($hostname) - 1); - } else { - return false; } + + return false; } /** @@ -485,6 +491,9 @@ private function _isFqdn($hostname) */ public function __destruct() { - $this->stop(); + try { + $this->stop(); + } catch (Exception $e) { + } } } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php index f1102bb..8392658 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php @@ -41,16 +41,12 @@ public function getAuthKeyword() */ public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password) { - if (!function_exists('mcrypt_module_open')) { - throw new LogicException('The mcrypt functions need to be enabled to use the NTLM authenticator.'); - } - - if (!function_exists('openssl_random_pseudo_bytes')) { + if (!function_exists('openssl_random_pseudo_bytes') || !function_exists('openssl_encrypt')) { throw new LogicException('The OpenSSL extension must be enabled to use the NTLM authenticator.'); } if (!function_exists('bcmul')) { - throw new LogicException('The BCMatch functions must be enabled to use the NTLM authenticator.'); + throw new LogicException('The BCMath functions must be enabled to use the NTLM authenticator.'); } try { @@ -300,9 +296,14 @@ protected function getDomainAndUsername($name) return explode('\\', $name); } - list($user, $domain) = explode('@', $name); + if (false !== strpos($name, '@')) { + list($user, $domain) = explode('@', $name); + + return array($domain, $user); + } - return array($domain, $user); + // no domain passed + return array('', $name); } /** @@ -365,15 +366,13 @@ protected function createNTLMPassword($password, $challenge) protected function getCorrectTimestamp($time) { // Get our timestamp (tricky!) - bcscale(0); - $time = number_format($time, 0, '.', ''); // save microtime to string - $time = bcadd($time, '11644473600000'); // add epoch time - $time = bcmul($time, 10000); // tenths of a microsecond. + $time = bcadd($time, '11644473600000', 0); // add epoch time + $time = bcmul($time, 10000, 0); // tenths of a microsecond. $binary = $this->si2bin($time, 64); // create 64 bit binary string $timestamp = ''; - for ($i = 0; $i < 8; $i++) { + for ($i = 0; $i < 8; ++$i) { $timestamp .= chr(bindec(substr($binary, -(($i + 1) * 8), 8))); } @@ -437,7 +436,7 @@ protected function createDesKey($key) { $material = array(bin2hex($key[0])); $len = strlen($key); - for ($i = 1; $i < $len; $i++) { + for ($i = 1; $i < $len; ++$i) { list($high, $low) = str_split(bin2hex($key[$i])); $v = $this->castToByte(ord($key[$i - 1]) << (7 + 1 - $i) | $this->uRShift(hexdec(dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xf)), $i)); $material[] = str_pad(substr(dechex($v), -2), 2, '0', STR_PAD_LEFT); // cast to byte @@ -463,6 +462,7 @@ protected function createDesKey($key) } /** HELPER FUNCTIONS */ + /** * Create our security buffer depending on length and offset. * @@ -565,20 +565,19 @@ protected function getRandomBytes($length) } /** ENCRYPTION ALGORITHMS */ + /** * DES Encryption. * - * @param string $value + * @param string $value An 8-byte string * @param string $key * * @return string */ protected function desEncrypt($value, $key) { - $cipher = mcrypt_module_open(MCRYPT_DES, '', 'ecb', ''); - mcrypt_generic_init($cipher, $key, mcrypt_create_iv(mcrypt_enc_get_iv_size($cipher), MCRYPT_DEV_RANDOM)); - - return mcrypt_generic($cipher, $value); + // 1 == OPENSSL_RAW_DATA - but constant is only available as of PHP 5.4. + return substr(openssl_encrypt($value, 'DES-ECB', $key, 1), 0, 8); } /** diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php index 2b0e682..cb36133 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php @@ -172,7 +172,7 @@ public function afterEhlo(Swift_Transport_SmtpAgent $agent) foreach ($this->_getAuthenticatorsForAgent() as $authenticator) { if (in_array(strtolower($authenticator->getAuthKeyword()), array_map('strtolower', $this->_esmtpParams))) { - $count++; + ++$count; if ($authenticator->authenticate($agent, $this->_username, $this->_password)) { return; } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php index 5b4f50c..156e2cf 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php @@ -42,6 +42,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo 'blocking' => 1, 'tls' => false, 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET, + 'stream_context_options' => array(), ); /** @@ -62,7 +63,7 @@ public function __construct(Swift_Transport_IoBuffer $buf, array $extensionHandl * * @param string $host * - * @return Swift_Transport_EsmtpTransport + * @return $this */ public function setHost($host) { @@ -86,7 +87,7 @@ public function getHost() * * @param int $port * - * @return Swift_Transport_EsmtpTransport + * @return $this */ public function setPort($port) { @@ -110,7 +111,7 @@ public function getPort() * * @param int $timeout seconds * - * @return Swift_Transport_EsmtpTransport + * @return $this */ public function setTimeout($timeout) { @@ -135,10 +136,11 @@ public function getTimeout() * * @param string $encryption * - * @return Swift_Transport_EsmtpTransport + * @return $this */ public function setEncryption($encryption) { + $encryption = strtolower($encryption); if ('tls' == $encryption) { $this->_params['protocol'] = 'tcp'; $this->_params['tls'] = true; @@ -160,12 +162,36 @@ public function getEncryption() return $this->_params['tls'] ? 'tls' : $this->_params['protocol']; } + /** + * Sets the stream context options. + * + * @param array $options + * + * @return $this + */ + public function setStreamOptions($options) + { + $this->_params['stream_context_options'] = $options; + + return $this; + } + + /** + * Returns the stream context options. + * + * @return array + */ + public function getStreamOptions() + { + return $this->_params['stream_context_options']; + } + /** * Sets the source IP. * * @param string $source * - * @return Swift_Transport_EsmtpTransport + * @return $this */ public function setSourceIp($source) { @@ -189,7 +215,7 @@ public function getSourceIp() * * @param Swift_Transport_EsmtpHandler[] $handlers * - * @return Swift_Transport_EsmtpTransport + * @return $this */ public function setExtensionHandlers(array $handlers) { @@ -197,7 +223,8 @@ public function setExtensionHandlers(array $handlers) foreach ($handlers as $handler) { $assoc[$handler->getHandledKeyword()] = $handler; } - uasort($assoc, array($this, '_sortHandlers')); + + @uasort($assoc, array($this, '_sortHandlers')); $this->_handlers = $assoc; $this->_setHandlerParams(); @@ -243,8 +270,6 @@ public function executeCommand($command, $codes = array(), &$failures = null) return parent::executeCommand($command, $codes, $failures); } - // -- Mixin invocation code - /** Mixin handling method for ESMTP handlers */ public function __call($method, $args) { @@ -254,7 +279,7 @@ public function __call($method, $args) )) { $return = call_user_func_array(array($handler, $method), $args); // Allow fluid method calls - if (is_null($return) && substr($method, 0, 3) == 'set') { + if (null === $return && substr($method, 0, 3) == 'set') { return $this; } else { return $return; diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php index 59c7302..311a0f2 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php @@ -22,9 +22,7 @@ class Swift_Transport_FailoverTransport extends Swift_Transport_LoadBalancedTran */ private $_currentTransport; - /** - * Creates a new FailoverTransport. - */ + // needed as __construct is called from elsewhere explicitly public function __construct() { parent::__construct(); @@ -45,6 +43,7 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) { $maxTransports = count($this->_transports); $sent = 0; + $this->_lastUsedTransport = null; for ($i = 0; $i < $maxTransports && $transport = $this->_getNextTransport(); ++$i) { @@ -53,7 +52,11 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) $transport->start(); } - return $transport->send($message, $failedRecipients); + if ($sent = $transport->send($message, $failedRecipients)) { + $this->_lastUsedTransport = $transport; + + return $sent; + } } catch (Swift_TransportException $e) { $this->_killCurrentTransport(); } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php index 0133350..e2adc56 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php @@ -30,8 +30,13 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport protected $_transports = array(); /** - * Creates a new LoadBalancedTransport. + * The Transport used in the last successful send operation. + * + * @var Swift_Transport */ + protected $_lastUsedTransport = null; + + // needed as __construct is called from elsewhere explicitly public function __construct() { } @@ -57,6 +62,16 @@ public function getTransports() return array_merge($this->_transports, $this->_deadTransports); } + /** + * Get the Transport used in the last successful send operation. + * + * @return Swift_Transport + */ + public function getLastUsedTransport() + { + return $this->_lastUsedTransport; + } + /** * Test if this Transport mechanism has started. * @@ -100,6 +115,7 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) { $maxTransports = count($this->_transports); $sent = 0; + $this->_lastUsedTransport = null; for ($i = 0; $i < $maxTransports && $transport = $this->_getNextTransport(); ++$i) { @@ -108,6 +124,7 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) $transport->start(); } if ($sent = $transport->send($message, $failedRecipients)) { + $this->_lastUsedTransport = $transport; break; } } catch (Swift_TransportException $e) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php index 546eb61..48ef4a7 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php @@ -20,6 +20,8 @@ * all-or-nothing result from sending. * * @author Chris Corbyn + * + * @deprecated since 5.4.5 (to be removed in 6.0) */ class Swift_Transport_MailTransport implements Swift_Transport { @@ -40,6 +42,8 @@ class Swift_Transport_MailTransport implements Swift_Transport */ public function __construct(Swift_Transport_MailInvoker $invoker, Swift_Events_EventDispatcher $eventDispatcher) { + @trigger_error(sprintf('The %s class is deprecated since version 5.4.5 and will be removed in 6.0. Use the Sendmail or SMTP transport instead.', __CLASS__), E_USER_DEPRECATED); + $this->_invoker = $invoker; $this->_eventDispatcher = $eventDispatcher; } @@ -73,7 +77,7 @@ public function stop() * * @param string $params * - * @return Swift_Transport_MailTransport + * @return $this */ public function setExtraParams($params) { @@ -125,10 +129,10 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) $toHeader = $message->getHeaders()->get('To'); $subjectHeader = $message->getHeaders()->get('Subject'); - if (!$toHeader) { + if (0 === $count) { $this->_throwException(new Swift_TransportException('Cannot send message without a recipient')); } - $to = $toHeader->getFieldBody(); + $to = $toHeader ? $toHeader->getFieldBody() : ''; $subject = $subjectHeader ? $subjectHeader->getFieldBody() : ''; $reversePath = $this->_getReversePath($message); @@ -139,7 +143,9 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) $messageStr = $message->toString(); - $message->getHeaders()->set($toHeader); + if ($toHeader) { + $message->getHeaders()->set($toHeader); + } $message->getHeaders()->set($subjectHeader); // Separate headers from body @@ -156,15 +162,18 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) if ("\r\n" != PHP_EOL) { // Non-windows (not using SMTP) $headers = str_replace("\r\n", PHP_EOL, $headers); + $subject = str_replace("\r\n", PHP_EOL, $subject); $body = str_replace("\r\n", PHP_EOL, $body); + $to = str_replace("\r\n", PHP_EOL, $to); } else { // Windows, using SMTP $headers = str_replace("\r\n.", "\r\n..", $headers); + $subject = str_replace("\r\n.", "\r\n..", $subject); $body = str_replace("\r\n.", "\r\n..", $body); + $to = str_replace("\r\n.", "\r\n..", $to); } - if ($this->_invoker->mail($to, $subject, $body, $headers, - sprintf($this->_extraParams, $reversePath))) { + if ($this->_invoker->mail($to, $subject, $body, $headers, $this->_formatExtraParams($this->_extraParams, $reversePath))) { if ($evt) { $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS); $evt->setFailedRecipients($failedRecipients); @@ -234,4 +243,55 @@ private function _getReversePath(Swift_Mime_Message $message) return $path; } + + /** + * Fix CVE-2016-10074 by disallowing potentially unsafe shell characters. + * + * Note that escapeshellarg and escapeshellcmd are inadequate for our purposes, especially on Windows. + * + * @param string $string The string to be validated + * + * @return bool + */ + private function _isShellSafe($string) + { + // Future-proof + if (escapeshellcmd($string) !== $string || !in_array(escapeshellarg($string), array("'$string'", "\"$string\""))) { + return false; + } + + $length = strlen($string); + for ($i = 0; $i < $length; ++$i) { + $c = $string[$i]; + // All other characters have a special meaning in at least one common shell, including = and +. + // Full stop (.) has a special meaning in cmd.exe, but its impact should be negligible here. + // Note that this does permit non-Latin alphanumeric characters based on the current locale. + if (!ctype_alnum($c) && strpos('@_-.', $c) === false) { + return false; + } + } + + return true; + } + + /** + * Return php mail extra params to use for invoker->mail. + * + * @param $extraParams + * @param $reversePath + * + * @return string|null + */ + private function _formatExtraParams($extraParams, $reversePath) + { + if (false !== strpos($extraParams, '-f%s')) { + if (empty($reversePath) || false === $this->_isShellSafe($reversePath)) { + $extraParams = str_replace('-f%s', '', $extraParams); + } else { + $extraParams = sprintf($extraParams, $reversePath); + } + } + + return !empty($extraParams) ? $extraParams : null; + } } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php index 3ef7dec..6430d5f 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php @@ -64,7 +64,7 @@ public function start() * * @param string $command * - * @return Swift_Transport_SendmailTransport + * @return $this */ public function setCommand($command) { @@ -102,6 +102,7 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) $failedRecipients = (array) $failedRecipients; $command = $this->getCommand(); $buffer = $this->getBuffer(); + $count = 0; if (false !== strpos($command, ' -t')) { if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SimpleMailInvoker.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SimpleMailInvoker.php index 21e629a..4cab66b 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SimpleMailInvoker.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SimpleMailInvoker.php @@ -32,8 +32,8 @@ public function mail($to, $subject, $body, $headers = null, $extraParams = null) { if (!ini_get('safe_mode')) { return @mail($to, $subject, $body, $headers, $extraParams); - } else { - return @mail($to, $subject, $body, $headers); } + + return @mail($to, $subject, $body, $headers); } } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php index 55a7992..e4b87f3 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php @@ -35,7 +35,7 @@ public function __construct(Swift_Events_EventDispatcher $eventDispatcher, Swift * * @param Swift_Spool $spool * - * @return Swift_Transport_SpoolTransport + * @return $this */ public function setSpool(Swift_Spool $spool) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php index 84ebbee..3a9fe76 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php @@ -84,7 +84,6 @@ public function setParam($param, $value) if ($this->_stream) { stream_set_blocking($this->_stream, 1); } - } } $this->_params[$param] = $value; @@ -92,7 +91,16 @@ public function setParam($param, $value) public function startTLS() { - return stream_socket_enable_crypto($this->_stream, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); + // STREAM_CRYPTO_METHOD_TLS_CLIENT only allow tls1.0 connections (some php versions) + // To support modern tls we allow explicit tls1.0, tls1.1, tls1.2 + // Ssl3 and older are not allowed because they are vulnerable + // @TODO make tls arguments configurable + $cryptoType = STREAM_CRYPTO_METHOD_TLS_CLIENT; + if (PHP_VERSION_ID >= 50600) { + $cryptoType = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; + } + + return stream_socket_enable_crypto($this->_stream, true, $cryptoType); } /** @@ -260,7 +268,11 @@ private function _establishSocketConnection() if (!empty($this->_params['sourceIp'])) { $options['socket']['bindto'] = $this->_params['sourceIp'].':0'; } - $this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, stream_context_create($options)); + if (isset($this->_params['stream_context_options'])) { + $options = array_merge($options, $this->_params['stream_context_options']); + } + $streamContext = stream_context_create($options); + $this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext); if (false === $this->_stream) { throw new Swift_TransportException( 'Connection could not be established with host '.$this->_params['host']. @@ -288,6 +300,7 @@ private function _establishProcessConnection() 1 => array('pipe', 'w'), 2 => array('pipe', 'w'), ); + $pipes = array(); $this->_stream = proc_open($command, $descriptorSpec, $pipes); stream_set_blocking($pipes[2], 0); if ($err = stream_get_contents($pipes[2])) { diff --git a/application/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php b/application/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php index 04f394b..d575e4f 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php @@ -1,6 +1,6 @@ register('properties.charset') @@ -117,7 +117,7 @@ // As of PHP 5.4.7, the quoted_printable_encode() function behaves correctly. // see https://github.com/php/php-src/commit/18bb426587d62f93c54c40bf8535eb8416603629 ->register('mime.qpcontentencoder') - ->asAliasOf(version_compare(phpversion(), '5.4.7', '>=') ? 'mime.qpcontentencoderproxy' : 'mime.safeqpcontentencoder') + ->asAliasOf(PHP_VERSION_ID >= 50407 ? 'mime.qpcontentencoderproxy' : 'mime.safeqpcontentencoder') ; unset($swift_mime_types); diff --git a/application/vendor/swiftmailer/swiftmailer/lib/mime_types.php b/application/vendor/swiftmailer/swiftmailer/lib/mime_types.php index 2d7b98d..b42c1cc 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/mime_types.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/mime_types.php @@ -7,7 +7,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * autogenerated using http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types + * autogenerated using https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types * and https://raw.github.com/minad/mimemagic/master/script/freedesktop.org.xml */ diff --git a/application/vendor/swiftmailer/swiftmailer/lib/preferences.php b/application/vendor/swiftmailer/swiftmailer/lib/preferences.php index e519501..0b430e6 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/preferences.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/preferences.php @@ -20,6 +20,6 @@ // this should only be done when Swiftmailer won't use the native QP content encoder // see mime_deps.php -if (version_compare(phpversion(), '5.4.7', '<')) { +if (PHP_VERSION_ID < 50407) { $preferences->setQPDotEscape(false); } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/swift_init.php b/application/vendor/swiftmailer/swiftmailer/lib/swift_init.php index 5c4bae4..ff71963 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/swift_init.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/swift_init.php @@ -19,10 +19,10 @@ define('SWIFT_INIT_LOADED', true); // Load in dependency maps -require dirname(__FILE__).'/dependency_maps/cache_deps.php'; -require dirname(__FILE__).'/dependency_maps/mime_deps.php'; -require dirname(__FILE__).'/dependency_maps/message_deps.php'; -require dirname(__FILE__).'/dependency_maps/transport_deps.php'; +require __DIR__.'/dependency_maps/cache_deps.php'; +require __DIR__.'/dependency_maps/mime_deps.php'; +require __DIR__.'/dependency_maps/message_deps.php'; +require __DIR__.'/dependency_maps/transport_deps.php'; // Load in global library preferences -require dirname(__FILE__).'/preferences.php'; +require __DIR__.'/preferences.php'; diff --git a/application/vendor/swiftmailer/swiftmailer/lib/swift_required.php b/application/vendor/swiftmailer/swiftmailer/lib/swift_required.php index ca7d8a3..03a72ce 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/swift_required.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/swift_required.php @@ -17,12 +17,12 @@ } // Load Swift utility class -require dirname(__FILE__).'/classes/Swift.php'; +require __DIR__.'/classes/Swift.php'; if (!function_exists('_swiftmailer_init')) { function _swiftmailer_init() { - require dirname(__FILE__).'/swift_init.php'; + require __DIR__.'/swift_init.php'; } } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/swift_required_pear.php b/application/vendor/swiftmailer/swiftmailer/lib/swift_required_pear.php index d826d0f..2b5181a 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/swift_required_pear.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/swift_required_pear.php @@ -17,12 +17,12 @@ } // Load Swift utility class -require dirname(__FILE__).'/Swift.php'; +require __DIR__.'/Swift.php'; if (!function_exists('_swiftmailer_init')) { function _swiftmailer_init() { - require dirname(__FILE__).'/swift_init.php'; + require __DIR__.'/swift_init.php'; } } diff --git a/application/vendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php b/application/vendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php index 3bb8780..85f2d69 100644 --- a/application/vendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php +++ b/application/vendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php @@ -1,8 +1,8 @@ #!/usr/bin/php 'audio/wav', 'wma' => 'audio/x-ms-wma', 'wmv' => 'audio/x-ms-wmv', - 'xls' => 'application/excel', + 'xls' => 'application/vnd.ms-excel', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'xml' => 'application/xml', ); diff --git a/application/vendor/swiftmailer/swiftmailer/phpunit.xml.dist b/application/vendor/swiftmailer/swiftmailer/phpunit.xml.dist index 2420586..606c5b4 100644 --- a/application/vendor/swiftmailer/swiftmailer/phpunit.xml.dist +++ b/application/vendor/swiftmailer/swiftmailer/phpunit.xml.dist @@ -14,6 +14,7 @@ + @@ -32,6 +33,7 @@ - + + diff --git a/application/vendor/swiftmailer/swiftmailer/tests/SwiftMailerSmokeTestCase.php b/application/vendor/swiftmailer/swiftmailer/tests/SwiftMailerSmokeTestCase.php index 21d89e8..71c5713 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/SwiftMailerSmokeTestCase.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/SwiftMailerSmokeTestCase.php @@ -7,7 +7,7 @@ */ class SwiftMailerSmokeTestCase extends SwiftMailerTestCase { - public function setUp() + protected function setUp() { if (!defined('SWIFT_SMOKE_TRANSPORT_TYPE')) { $this->markTestSkipped( diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default b/application/vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default index 68902d8..5717c98 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default @@ -12,13 +12,6 @@ You can fill out only the parts you know and leave the other bits. */ - -/* - Defines: The path to a writable directory (a temporary dir). - Recommended: /tmp - */ -define('SWIFT_TMP_DIR', '/tmp'); - /* Defines: The name and port of a SMTP server you can connect to. Recommended: smtp.gmail.com:25 diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php index 7fc7bc3..49ad20a 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php @@ -2,24 +2,15 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_TestCase { - private $_tmpDir; private $_testFile; - public function setUp() + protected function setUp() { - if (!defined('SWIFT_TMP_DIR')) { - $this->markTestSkipped( - 'Cannot run test without a writable directory to use ('. - 'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)' - ); - } - - $this->_tmpDir = SWIFT_TMP_DIR; - $this->_testFile = $this->_tmpDir.'/swift-test-file'.__CLASS__; + $this->_testFile = sys_get_temp_dir().'/swift-test-file'.__CLASS__; file_put_contents($this->_testFile, 'abcdefghijklm'); } - public function tearDown() + protected function tearDown() { unlink($this->_testFile); } @@ -50,18 +41,14 @@ public function testFilenameIsReturned() public function testFileCanBeWrittenTo() { - $file = $this->_createFileStream( - $this->_testFile, true - ); + $file = $this->_createFileStream($this->_testFile, true); $file->write('foobar'); $this->assertEquals('foobar', $file->read(8192)); } public function testReadingFromThenWritingToFile() { - $file = $this->_createFileStream( - $this->_testFile, true - ); + $file = $this->_createFileStream($this->_testFile, true); $file->write('foobar'); $this->assertEquals('foobar', $file->read(8192)); $file->write('zipbutton'); @@ -70,9 +57,7 @@ public function testReadingFromThenWritingToFile() public function testWritingToFileWithCanonicalization() { - $file = $this->_createFileStream( - $this->_testFile, true - ); + $file = $this->_createFileStream($this->_testFile, true); $file->addFilter($this->_createFilter(array("\r\n", "\r"), "\n"), 'allToLF'); $file->write("foo\r\nbar\r"); $file->write("\nzip\r\ntest\r"); @@ -80,11 +65,18 @@ public function testWritingToFileWithCanonicalization() $this->assertEquals("foo\nbar\nzip\ntest\n", file_get_contents($this->_testFile)); } + public function testWritingWithFulleMessageLengthOfAMultipleOf8192() + { + $file = $this->_createFileStream($this->_testFile, true); + $file->addFilter($this->_createFilter(array("\r\n", "\r"), "\n"), 'allToLF'); + $file->write(''); + $file->flushBuffers(); + $this->assertEquals('', file_get_contents($this->_testFile)); + } + public function testBindingOtherStreamsMirrorsWriteOperations() { - $file = $this->_createFileStream( - $this->_testFile, true - ); + $file = $this->_createFileStream($this->_testFile, true); $is1 = $this->_createMockInputStream(); $is2 = $this->_createMockInputStream(); @@ -129,9 +121,7 @@ public function testBindingOtherStreamsMirrorsFlushOperations() public function testUnbindingStreamPreventsFurtherWrites() { - $file = $this->_createFileStream( - $this->_testFile, true - ); + $file = $this->_createFileStream($this->_testFile, true); $is1 = $this->_createMockInputStream(); $is2 = $this->_createMockInputStream(); @@ -155,8 +145,6 @@ public function testUnbindingStreamPreventsFurtherWrites() $file->write('y'); } - // -- Creation methods - private function _createFilter($search, $replace) { return new Swift_StreamFilters_StringReplacementFilter($search, $replace); @@ -164,7 +152,7 @@ private function _createFilter($search, $replace) private function _createMockInputStream() { - return $this->getMock('Swift_InputByteStream'); + return $this->getMockBuilder('Swift_InputByteStream')->getMock(); } private function _createFileStream($file, $writable = false) diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php index 8ce4a18..c13e570 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php @@ -5,7 +5,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex private $_factory; private $_prefix = 'Swift_CharacterReader_'; - public function setUp() + protected function setUp() { $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); } @@ -14,7 +14,7 @@ public function testCreatingUtf8Reader() { foreach (array('utf8', 'utf-8', 'UTF-8', 'UTF8') as $utf8) { $reader = $this->_factory->getReaderFor($utf8); - $this->assertInstanceof($this->_prefix.'Utf8Reader', $reader); + $this->assertInstanceOf($this->_prefix.'Utf8Reader', $reader); } } @@ -32,7 +32,7 @@ public function testCreatingIso8859XReaders() foreach ($charsets as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -49,7 +49,7 @@ public function testCreatingWindows125XReaders() foreach ($charsets as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -74,7 +74,7 @@ public function testCreatingCodePageReaders() foreach ($charsets as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -83,7 +83,7 @@ public function testCreatingAnsiReader() { foreach (array('ansi', 'ANSI') as $ansi) { $reader = $this->_factory->getReaderFor($ansi); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -92,7 +92,7 @@ public function testCreatingMacintoshReader() { foreach (array('macintosh', 'MACINTOSH') as $mac) { $reader = $this->_factory->getReaderFor($mac); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -109,7 +109,7 @@ public function testCreatingKOIReaders() foreach ($charsets as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -118,7 +118,7 @@ public function testCreatingIsciiReaders() { foreach (array('iscii', 'ISCII', 'viscii', 'VISCII') as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -127,7 +127,7 @@ public function testCreatingMIKReader() { foreach (array('mik', 'MIK') as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -136,7 +136,7 @@ public function testCreatingCorkReader() { foreach (array('cork', 'CORK', 't1', 'T1') as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -145,7 +145,7 @@ public function testCreatingUcs2Reader() { foreach (array('ucs-2', 'UCS-2', 'ucs2', 'UCS2') as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(2, $reader->getInitialByteSize()); } } @@ -154,7 +154,7 @@ public function testCreatingUtf16Reader() { foreach (array('utf-16', 'UTF-16', 'utf16', 'UTF16') as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(2, $reader->getInitialByteSize()); } } @@ -163,7 +163,7 @@ public function testCreatingUcs4Reader() { foreach (array('ucs-4', 'UCS-4', 'ucs4', 'UCS4') as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(4, $reader->getInitialByteSize()); } } @@ -172,7 +172,7 @@ public function testCreatingUtf32Reader() { foreach (array('utf-32', 'UTF-32', 'utf32', 'UTF32') as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(4, $reader->getInitialByteSize()); } } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php index 8caf6f5..e83c2bf 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php @@ -11,6 +11,10 @@ public function testNoLookupsFail() $di = Swift_DependencyContainer::getInstance(); foreach ($di->listItems() as $itemName) { try { + // to be removed in 6.0 + if ('transport.mail' === $itemName) { + continue; + } $di->lookup($itemName); } catch (Swift_DependencyException $e) { $this->fail($e->getMessage()); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php index d8ba526..bada509 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php @@ -5,7 +5,7 @@ class Swift_Encoder_Base64EncoderAcceptanceTest extends \PHPUnit_Framework_TestC private $_samplesDir; private $_encoder; - public function setUp() + protected function setUp() { $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets'); $this->_encoder = new Swift_Encoder_Base64Encoder(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php index 736dccb..442d9a9 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php @@ -5,7 +5,7 @@ class Swift_Encoder_QpEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase private $_samplesDir; private $_factory; - public function setUp() + protected function setUp() { $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets'); $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); @@ -36,6 +36,10 @@ public function testEncodingAndDecodingSamples() $text = file_get_contents($sampleDir.'/'.$sampleFile); $encodedText = $encoder->encodeString($text); + foreach (explode("\r\n", $encodedText) as $line) { + $this->assertLessThanOrEqual(76, strlen($line)); + } + $this->assertEquals( quoted_printable_decode($encodedText), $text, '%s: Encoded string should decode back to original string for sample '. diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php index 043ddf8..bcb6b95 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php @@ -5,7 +5,7 @@ class Swift_Encoder_Rfc2231EncoderAcceptanceTest extends \PHPUnit_Framework_Test private $_samplesDir; private $_factory; - public function setUp() + protected function setUp() { $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets'); $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php index 6b06e2e..5fab14c 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php @@ -6,7 +6,7 @@ class Swift_KeyCache_ArrayKeyCacheAcceptanceTest extends \PHPUnit_Framework_Test private $_key1 = 'key1'; private $_key2 = 'key2'; - public function setUp() + protected function setUp() { $this->_cache = new Swift_KeyCache_ArrayKeyCache( new Swift_KeyCache_SimpleKeyCacheInputStream() diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php index 392edde..0e027c2 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php @@ -6,21 +6,11 @@ class Swift_KeyCache_DiskKeyCacheAcceptanceTest extends \PHPUnit_Framework_TestC private $_key1; private $_key2; - public function setUp() + protected function setUp() { - if (!defined('SWIFT_TMP_DIR')) { - $this->markTestSkipped( - 'Cannot run test without a writable directory to use ('. - 'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)' - ); - } - $this->_key1 = uniqid(microtime(true), true); $this->_key2 = uniqid(microtime(true), true); - $this->_cache = new Swift_KeyCache_DiskKeyCache( - new Swift_KeyCache_SimpleKeyCacheInputStream(), - SWIFT_TMP_DIR - ); + $this->_cache = new Swift_KeyCache_DiskKeyCache(new Swift_KeyCache_SimpleKeyCacheInputStream(), sys_get_temp_dir()); } public function testStringDataCanBeSetAndFetched() diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php index 9372fbf..5f4e983 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php @@ -45,8 +45,6 @@ public function testAddPartWrapper() ); } - // -- Private helpers - protected function _createMessage() { Swift_DependencyContainer::getInstance() diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php index e925367..7353d9d 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php @@ -7,7 +7,7 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase private $_grammar; private $_headers; - public function setUp() + protected function setUp() { $this->_cache = new Swift_KeyCache_ArrayKeyCache( new Swift_KeyCache_SimpleKeyCacheInputStream() @@ -109,8 +109,6 @@ public function testEndToEnd() ); } - // -- Private helpers - protected function _createAttachment() { $entity = new Swift_Mime_Attachment( diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php index 2a5c562..a72f5ff 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php @@ -5,7 +5,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderAcceptanceTest extends \PHPU private $_samplesDir; private $_encoder; - public function setUp() + protected function setUp() { $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets'); $this->_encoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php index e8313da..0dfc4e2 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php @@ -2,12 +2,14 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase { + protected $_samplesDir; + /** * @var Swift_Mime_ContentEncoder_NativeQpContentEncoder */ protected $_encoder; - public function setUp() + protected function setUp() { $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets'); $this->_encoder = new Swift_Mime_ContentEncoder_NativeQpContentEncoder(); @@ -63,7 +65,7 @@ public function testEncodingAndDecodingSamplesFromDiConfiguredInstance() } /** - * @expectedException RuntimeException + * @expectedException \RuntimeException */ public function testCharsetChangeNotImplemented() { diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php index 1541b7e..5eff4e2 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php @@ -5,7 +5,7 @@ class Swift_Mime_ContentEncoder_PlainContentEncoderAcceptanceTest extends \PHPUn private $_samplesDir; private $_encoder; - public function setUp() + protected function setUp() { $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets'); $this->_encoder = new Swift_Mime_ContentEncoder_PlainContentEncoder('8bit'); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php index 501dbfa..a383b58 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php @@ -5,12 +5,17 @@ class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit_ private $_samplesDir; private $_factory; - public function setUp() + protected function setUp() { $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets'); $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); } + protected function tearDown() + { + Swift_Preferences::getInstance()->setQPDotEscape(false); + } + public function testEncodingAndDecodingSamples() { $sampleFp = opendir($this->_samplesDir); @@ -144,8 +149,6 @@ public function testDotStuffingEncodingAndDecodingSamplesFromDiConfiguredInstanc // Enable DotEscaping Swift_Preferences::getInstance()->setQPDotEscape(true); $this->testEncodingAndDecodingSamplesFromDiConfiguredInstance(); - // Disable DotStuffing to continue - Swift_Preferences::getInstance()->setQPDotEscape(false); } private function _createEncoderFromContainer() diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php index 75f3c84..0f7aa72 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php @@ -7,7 +7,7 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase private $_grammar; private $_headers; - public function setUp() + protected function setUp() { $this->_cache = new Swift_KeyCache_ArrayKeyCache( new Swift_KeyCache_SimpleKeyCacheInputStream() @@ -35,8 +35,8 @@ public function testContentIdIsSetInHeader() $this->assertEquals( 'Content-Type: application/pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline'."\r\n". - 'Content-ID: '."\r\n", + 'Content-ID: '."\r\n". + 'Content-Disposition: inline'."\r\n", $file->toString() ); } @@ -50,8 +50,8 @@ public function testDispositionIsSetInHeader() $this->assertEquals( 'Content-Type: application/pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: attachment'."\r\n". - 'Content-ID: <'.$id.'>'."\r\n", + 'Content-ID: <'.$id.'>'."\r\n". + 'Content-Disposition: attachment'."\r\n", $file->toString() ); } @@ -65,8 +65,8 @@ public function testFilenameIsSetInHeader() $this->assertEquals( 'Content-Type: application/pdf; name=foo.pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=foo.pdf'."\r\n". - 'Content-ID: <'.$id.'>'."\r\n", + 'Content-ID: <'.$id.'>'."\r\n". + 'Content-Disposition: inline; filename=foo.pdf'."\r\n", $file->toString() ); } @@ -80,8 +80,8 @@ public function testSizeIsSetInHeader() $this->assertEquals( 'Content-Type: application/pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; size=12340'."\r\n". - 'Content-ID: <'.$id.'>'."\r\n", + 'Content-ID: <'.$id.'>'."\r\n". + 'Content-Disposition: inline; size=12340'."\r\n", $file->toString() ); } @@ -93,11 +93,12 @@ public function testMultipleParametersInHeader() $file->setContentType('application/pdf'); $file->setFilename('foo.pdf'); $file->setSize(12340); + $this->assertEquals( 'Content-Type: application/pdf; name=foo.pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=foo.pdf; size=12340'."\r\n". - 'Content-ID: <'.$id.'>'."\r\n", + 'Content-ID: <'.$id.'>'."\r\n". + 'Content-Disposition: inline; filename=foo.pdf; size=12340'."\r\n", $file->toString() ); } @@ -113,16 +114,14 @@ public function testEndToEnd() $this->assertEquals( 'Content-Type: application/pdf; name=foo.pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=foo.pdf; size=12340'."\r\n". 'Content-ID: <'.$id.'>'."\r\n". + 'Content-Disposition: inline; filename=foo.pdf; size=12340'."\r\n". "\r\n". base64_encode('abcd'), $file->toString() ); } - // -- Private helpers - protected function _createEmbeddedFile() { $entity = new Swift_Mime_EmbeddedFile( diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php index 304867a..e3fad6d 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php @@ -4,7 +4,7 @@ class Swift_Mime_HeaderEncoder_Base64HeaderEncoderAcceptanceTest extends \PHPUni { private $_encoder; - public function setUp() + protected function setUp() { $this->_encoder = new Swift_Mime_HeaderEncoder_Base64HeaderEncoder(); } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php index 8232fe6..a7f6fc5 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php @@ -7,7 +7,7 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase private $_grammar; private $_headers; - public function setUp() + protected function setUp() { $this->_cache = new Swift_KeyCache_ArrayKeyCache( new Swift_KeyCache_SimpleKeyCacheInputStream() @@ -113,8 +113,6 @@ public function testBodyIsCanonicalized() ); } - // -- Private helpers - protected function _createMimePart() { $entity = new Swift_Mime_MimePart( diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php index 84f3443..912768e 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php @@ -2,7 +2,7 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase { - public function setUp() + protected function setUp() { Swift_Preferences::getInstance()->setCharset(null); //TODO: Test with the charset defined } @@ -778,8 +778,8 @@ public function testAttachmentsAndEmbeddedFilesBeingAttached() '--\\2'."\r\n". 'Content-Type: image/jpeg; name=myimage.jpg'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=myimage.jpg'."\r\n". 'Content-ID: <'.$cid.'>'."\r\n". + 'Content-Disposition: inline; filename=myimage.jpg'."\r\n". "\r\n". preg_quote(base64_encode(''), '~'). "\r\n\r\n". @@ -857,8 +857,8 @@ public function testComplexEmbeddingOfContent() '--\\1'."\r\n". 'Content-Type: image/jpeg; name=myimage.jpg'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=myimage.jpg'."\r\n". 'Content-ID: <'.$cid.'>'."\r\n". + 'Content-Disposition: inline; filename=myimage.jpg'."\r\n". "\r\n". preg_quote(base64_encode(''), '~'). "\r\n\r\n". @@ -938,8 +938,8 @@ public function testAttachingAndDetachingContent() '--\\1'."\r\n". 'Content-Type: image/jpeg; name=myimage.jpg'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=myimage.jpg'."\r\n". 'Content-ID: <'.$cid.'>'."\r\n". + 'Content-Disposition: inline; filename=myimage.jpg'."\r\n". "\r\n". preg_quote(base64_encode(''), '~'). "\r\n\r\n". @@ -1227,8 +1227,6 @@ public function testBodyIsCanonicalized() ); } - // -- Private helpers - protected function _createMessage() { return new Swift_Message(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php index 465f2c1..21abc13 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php @@ -1,13 +1,12 @@ markTestSkipped( @@ -17,7 +16,7 @@ public function setUp() } $this->_buffer = new Swift_Transport_StreamBuffer( - $this->getMock('Swift_ReplacementFilterFactory') + $this->getMockBuilder('Swift_ReplacementFilterFactory')->getMock() ); } @@ -125,10 +124,8 @@ public function testUnbindingStreamPreventsFurtherWrites() $this->_buffer->write('y'); } - // -- Creation Methods - private function _createMockInputStream() { - return $this->getMock('Swift_InputByteStream'); + return $this->getMockBuilder('Swift_InputByteStream')->getMock(); } } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php index 8f6e453..4c3c7d3 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php @@ -2,10 +2,9 @@ require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php'; -class Swift_Transport_StreamBuffer_BasicSocketAcceptanceTest - extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest +class Swift_Transport_StreamBuffer_BasicSocketAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest { - public function setUp() + protected function setUp() { if (!defined('SWIFT_SMTP_HOST')) { $this->markTestSkipped( @@ -29,6 +28,6 @@ protected function _initializeBuffer() 'protocol' => 'tcp', 'blocking' => 1, 'timeout' => 15, - )); + )); } } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php index b4e88a7..a37439d 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php @@ -2,10 +2,9 @@ require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php'; -class Swift_Transport_StreamBuffer_ProcessAcceptanceTest - extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest +class Swift_Transport_StreamBuffer_ProcessAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest { - public function setUp() + protected function setUp() { if (!defined('SWIFT_SENDMAIL_PATH')) { $this->markTestSkipped( diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php index 81db65e..59362b0 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php @@ -4,9 +4,11 @@ class Swift_Transport_StreamBuffer_SocketTimeoutTest extends \PHPUnit_Framework_ { protected $_buffer; + protected $_randomHighPort; + protected $_server; - public function setUp() + protected function setUp() { if (!defined('SWIFT_SMTP_HOST')) { $this->markTestSkipped( @@ -25,7 +27,7 @@ public function setUp() } $this->_buffer = new Swift_Transport_StreamBuffer( - $this->getMock('Swift_ReplacementFilterFactory') + $this->getMockBuilder('Swift_ReplacementFilterFactory')->getMock() ); } @@ -41,7 +43,7 @@ protected function _initializeBuffer() 'protocol' => 'tcp', 'blocking' => 1, 'timeout' => 1, - )); + )); } public function testTimeoutException() @@ -52,11 +54,11 @@ public function testTimeoutException() $line = $this->_buffer->readLine(0); } catch (Exception $e) { } - $this->assertInstanceof('Swift_IoException', $e, 'IO Exception Not Thrown On Connection Timeout'); + $this->assertInstanceOf('Swift_IoException', $e, 'IO Exception Not Thrown On Connection Timeout'); $this->assertRegExp('/Connection to .* Timed Out/', $e->getMessage()); } - public function tearDown() + protected function tearDown() { if ($this->_server) { stream_socket_shutdown($this->_server, STREAM_SHUT_RDWR); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php index d2d2a38..32e0fe8 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php @@ -2,10 +2,9 @@ require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php'; -class Swift_Transport_StreamBuffer_SslSocketAcceptanceTest - extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest +class Swift_Transport_StreamBuffer_SslSocketAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest { - public function setUp() + protected function setUp() { $streams = stream_get_transports(); if (!in_array('ssl', $streams)) { @@ -36,6 +35,6 @@ protected function _initializeBuffer() 'protocol' => 'ssl', 'blocking' => 1, 'timeout' => 15, - )); + )); } } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php index 314fffe..1053a87 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php @@ -2,10 +2,9 @@ require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php'; -class Swift_Transport_StreamBuffer_TlsSocketAcceptanceTest - extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest +class Swift_Transport_StreamBuffer_TlsSocketAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest { - public function setUp() + protected function setUp() { $streams = stream_get_transports(); if (!in_array('tls', $streams)) { diff --git a/application/vendor/swiftmailer/swiftmailer/tests/bootstrap.php b/application/vendor/swiftmailer/swiftmailer/tests/bootstrap.php index 9b169b3..27091a2 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/bootstrap.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/bootstrap.php @@ -1,11 +1,13 @@ add('Swift_', __DIR__.'/unit'); +require_once dirname(__DIR__).'/vendor/autoload.php'; + +// Disable garbage collector to prevent segfaults +gc_disable(); set_include_path(get_include_path().PATH_SEPARATOR.dirname(__DIR__).'/lib'); -\Mockery::getConfiguration()->allowMockingNonExistentMethods(false); +Mockery::getConfiguration()->allowMockingNonExistentMethods(true); if (is_file(__DIR__.'/acceptance.conf.php')) { require_once __DIR__.'/acceptance.conf.php'; diff --git a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php index bd10c71..40b5a77 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php @@ -4,7 +4,7 @@ class Swift_Bug118Test extends \PHPUnit_Framework_TestCase { private $_message; - public function setUp() + protected function setUp() { $this->_message = new Swift_Message(); } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php index fdfa530..7563f4d 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php @@ -4,7 +4,7 @@ class Swift_Bug206Test extends \PHPUnit_Framework_TestCase { private $_factory; - public function setUp() + protected function setUp() { $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder( diff --git a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug274Test.php b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug274Test.php index d305d02..f5f057a 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug274Test.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug274Test.php @@ -2,14 +2,14 @@ class Swift_Bug274Test extends \PHPUnit_Framework_TestCase { - public function testEmptyFileNameAsAttachement() + public function testEmptyFileNameAsAttachment() { $message = new Swift_Message(); $this->setExpectedException('Swift_IoException', 'The path cannot be empty'); $message->attach(Swift_Attachment::fromPath('')); } - public function testNonEmptyFileNameAsAttachement() + public function testNonEmptyFileNameAsAttachment() { $message = new Swift_Message(); try { diff --git a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php index 6a0f33d..768bf3d 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php @@ -2,7 +2,7 @@ class Swift_Bug34Test extends \PHPUnit_Framework_TestCase { - public function setUp() + protected function setUp() { Swift_Preferences::getInstance()->setCharset('utf-8'); } @@ -60,8 +60,8 @@ public function testEmbeddedFilesWithMultipartDataCreateMultipartRelatedContentA '--\\1'."\r\n". 'Content-Type: image/gif; name=image.gif'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=image.gif'."\r\n". 'Content-ID: <'.$cidVal.'>'."\r\n". + 'Content-Disposition: inline; filename=image.gif'."\r\n". "\r\n". preg_quote(base64_encode(''), '~'). "\r\n\r\n". diff --git a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php index e07ee8f..98999f0 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php @@ -2,7 +2,7 @@ class Swift_Bug35Test extends \PHPUnit_Framework_TestCase { - public function setUp() + protected function setUp() { Swift_Preferences::getInstance()->setCharset('utf-8'); } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php index e281516..9deae4f 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php @@ -6,7 +6,7 @@ class Swift_Bug38Test extends \PHPUnit_Framework_TestCase private $_attFileName; private $_attFileType; - public function setUp() + protected function setUp() { $this->_attFileName = 'data.txt'; $this->_attFileType = 'text/plain'; @@ -57,8 +57,8 @@ public function testWritingMessageToByteStreamProducesCorrectStructure() '--'.$boundary."\r\n". 'Content-Type: image/gif; name=image.gif'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=image.gif'."\r\n". 'Content-ID: <'.preg_quote($imgId, '~').'>'."\r\n". + 'Content-Disposition: inline; filename=image.gif'."\r\n". "\r\n". preg_quote(base64_encode(''), '~'). "\r\n\r\n". @@ -106,8 +106,8 @@ public function testWritingMessageToByteStreamTwiceProducesCorrectStructure() '--'.$boundary."\r\n". 'Content-Type: image/gif; name=image.gif'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=image.gif'."\r\n". 'Content-ID: <'.preg_quote($imgId, '~').'>'."\r\n". + 'Content-Disposition: inline; filename=image.gif'."\r\n". "\r\n". preg_quote(base64_encode(''), '~'). "\r\n\r\n". @@ -181,8 +181,6 @@ public function testWritingMessageToByteStreamTwiceUsingAFileAttachment() $this->assertPatternInStream($pattern, $streamB); } - // -- Helpers - public function assertPatternInStream($pattern, $stream, $message = '%s') { $string = ''; diff --git a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php index b9c33b0..48074f0 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php @@ -5,23 +5,16 @@ class Swift_Bug51Test extends \SwiftMailerTestCase private $_attachmentFile; private $_outputFile; - public function setUp() + protected function setUp() { - if (!defined('SWIFT_TMP_DIR') || !is_writable(SWIFT_TMP_DIR)) { - $this->markTestSkipped( - 'Cannot run test without a writable directory to use ('. - 'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)' - ); - } - - $this->_attachmentFile = SWIFT_TMP_DIR.'/attach.rand.bin'; + $this->_attachmentFile = sys_get_temp_dir().'/attach.rand.bin'; file_put_contents($this->_attachmentFile, ''); - $this->_outputFile = SWIFT_TMP_DIR.'/attach.out.bin'; + $this->_outputFile = sys_get_temp_dir().'/attach.out.bin'; file_put_contents($this->_outputFile, ''); } - public function tearDown() + protected function tearDown() { unlink($this->_attachmentFile); unlink($this->_outputFile); @@ -66,8 +59,6 @@ public function testAttachmentsDoNotGetTruncatedUsingToString() } } - // -- Custom Assertions - public function assertAttachmentFromSourceMatches($attachmentData, $source) { $encHeader = 'Content-Transfer-Encoding: base64'; @@ -88,8 +79,6 @@ public function assertAttachmentFromSourceMatches($attachmentData, $source) $this->assertIdenticalBinary($attachmentData, base64_decode($attachmentBase64)); } - // -- Creation Methods - private function _fillFileWithRandomBytes($byteCount, $file) { // I was going to use dd with if=/dev/random but this way seems more diff --git a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug650Test.php b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug650Test.php new file mode 100644 index 0000000..3393fb8 --- /dev/null +++ b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug650Test.php @@ -0,0 +1,36 @@ +setCharset('utf-8'); + + $header->setNameAddresses(array( + 'test@example.com' => $name, + )); + + $this->assertSame('To: '.$expectedEncodedName." \r\n", $header->toString()); + } + + public function encodingDataProvider() + { + return array( + array('this is " a test ö', 'this is =?utf-8?Q?=22?= a test =?utf-8?Q?=C3=B6?='), + array(': this is a test ö', '=?utf-8?Q?=3A?= this is a test =?utf-8?Q?=C3=B6?='), + array('( test ö', '=?utf-8?Q?=28?= test =?utf-8?Q?=C3=B6?='), + array('[ test ö', '=?utf-8?Q?=5B?= test =?utf-8?Q?=C3=B6?='), + array('@ test ö)', '=?utf-8?Q?=40?= test =?utf-8?Q?=C3=B6=29?='), + ); + } +} diff --git a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php index 4b80453..d58242f 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php @@ -4,7 +4,7 @@ class Swift_Bug71Test extends \PHPUnit_Framework_TestCase { private $_message; - public function setUp() + protected function setUp() { $this->_message = new Swift_Message('test'); } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php index c2b12cb..899083c 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php @@ -6,25 +6,18 @@ class Swift_Bug76Test extends \PHPUnit_Framework_TestCase private $_outputFile; private $_encoder; - public function setUp() + protected function setUp() { - if (!defined('SWIFT_TMP_DIR') || !is_writable(SWIFT_TMP_DIR)) { - $this->markTestSkipped( - 'Cannot run test without a writable directory to use ('. - 'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)' - ); - } - - $this->_inputFile = SWIFT_TMP_DIR.'/in.bin'; + $this->_inputFile = sys_get_temp_dir().'/in.bin'; file_put_contents($this->_inputFile, ''); - $this->_outputFile = SWIFT_TMP_DIR.'/out.bin'; + $this->_outputFile = sys_get_temp_dir().'/out.bin'; file_put_contents($this->_outputFile, ''); $this->_encoder = $this->_createEncoder(); } - public function tearDown() + protected function tearDown() { unlink($this->_inputFile); unlink($this->_outputFile); @@ -44,8 +37,6 @@ public function testBase64EncodedLineLengthNeverExceeds76CharactersEvenIfArgsDo( ); } - // -- Custom Assertions - public function assertMaxLineLength($length, $filePath, $message = '%s') { $lines = file($filePath); @@ -54,8 +45,6 @@ public function assertMaxLineLength($length, $filePath, $message = '%s') } } - // -- Creation Methods - private function _fillFileWithRandomBytes($byteCount, $file) { // I was going to use dd with if=/dev/random but this way seems more diff --git a/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/BugFileByteStreamConsecutiveReadCallsTest.php b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/BugFileByteStreamConsecutiveReadCallsTest.php new file mode 100644 index 0000000..35733ec --- /dev/null +++ b/application/vendor/swiftmailer/swiftmailer/tests/bug/Swift/BugFileByteStreamConsecutiveReadCallsTest.php @@ -0,0 +1,19 @@ +read(100); + } catch (\Swift_IoException $exc) { + $fbs->read(100); + } + } +} diff --git a/application/vendor/swiftmailer/swiftmailer/tests/fixtures/EsmtpTransportFixture.php b/application/vendor/swiftmailer/swiftmailer/tests/fixtures/EsmtpTransportFixture.php deleted file mode 100644 index d56d88d..0000000 --- a/application/vendor/swiftmailer/swiftmailer/tests/fixtures/EsmtpTransportFixture.php +++ /dev/null @@ -1,10 +0,0 @@ -_attFile = __DIR__.'/../../../_samples/files/textfile.zip'; } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php b/application/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php index a589752..3b13cc5 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php @@ -5,7 +5,9 @@ */ class Swift_Smoke_HtmlWithAttachmentSmokeTest extends SwiftMailerSmokeTestCase { - public function setUp() + private $_attFile; + + protected function setUp() { $this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip'; } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php b/application/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php index e7c695e..b9ebef5 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php @@ -5,8 +5,11 @@ */ class Swift_Smoke_InternationalSmokeTest extends SwiftMailerSmokeTestCase { - public function setUp() + private $_attFile; + + protected function setUp() { + parent::setup(); // For skip $this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip'; } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php index 0193484..60ebb66 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php @@ -55,7 +55,6 @@ public function testResettingPointerAfterExhaustion() { $input = array('a', 'b', 'c'); $bs = $this->_createArrayStream($input); - while (false !== $bs->read(1)); $bs->setReadPointer(0); @@ -81,7 +80,7 @@ public function testPointerNeverSetsAboveStackSize() $bs = $this->_createArrayStream($input); $bs->setReadPointer(3); - $this->assertSame(false, $bs->read(1), + $this->assertFalse($bs->read(1), '%s: Stream should be at end and thus return false' ); } @@ -109,7 +108,7 @@ public function testContentsCanBeFlushed() $bs->flushBuffers(); - $this->assertSame(false, $bs->read(1), + $this->assertFalse($bs->read(1), '%s: Contents have been flushed so read() should return false' ); } @@ -129,8 +128,8 @@ public function testConstructorCanTakeStringArgument() public function testBindingOtherStreamsMirrorsWriteOperations() { $bs = $this->_createArrayStream(''); - $is1 = $this->getMock('Swift_InputByteStream'); - $is2 = $this->getMock('Swift_InputByteStream'); + $is1 = $this->getMockBuilder('Swift_InputByteStream')->getMock(); + $is2 = $this->getMockBuilder('Swift_InputByteStream')->getMock(); $is1->expects($this->at(0)) ->method('write') @@ -155,8 +154,8 @@ public function testBindingOtherStreamsMirrorsWriteOperations() public function testBindingOtherStreamsMirrorsFlushOperations() { $bs = $this->_createArrayStream(''); - $is1 = $this->getMock('Swift_InputByteStream'); - $is2 = $this->getMock('Swift_InputByteStream'); + $is1 = $this->getMockBuilder('Swift_InputByteStream')->getMock(); + $is2 = $this->getMockBuilder('Swift_InputByteStream')->getMock(); $is1->expects($this->once()) ->method('flushBuffers'); @@ -172,8 +171,8 @@ public function testBindingOtherStreamsMirrorsFlushOperations() public function testUnbindingStreamPreventsFurtherWrites() { $bs = $this->_createArrayStream(''); - $is1 = $this->getMock('Swift_InputByteStream'); - $is2 = $this->getMock('Swift_InputByteStream'); + $is1 = $this->getMockBuilder('Swift_InputByteStream')->getMock(); + $is2 = $this->getMockBuilder('Swift_InputByteStream')->getMock(); $is1->expects($this->at(0)) ->method('write') @@ -195,8 +194,6 @@ public function testUnbindingStreamPreventsFurtherWrites() $bs->write('y'); } - // -- Creation Methods - private function _createArrayStream($input) { return new Swift_ByteStream_ArrayByteStream($input); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php index 41f8f70..0d56736 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php @@ -18,7 +18,7 @@ class Swift_CharacterReader_UsAsciiReaderTest extends \PHPUnit_Framework_TestCas private $_reader; - public function setUp() + protected function setUp() { $this->_reader = new Swift_CharacterReader_UsAsciiReader(); } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php index 34e9c91..ec17eeb 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php @@ -4,7 +4,7 @@ class Swift_CharacterReader_Utf8ReaderTest extends \PHPUnit_Framework_TestCase { private $_reader; - public function setUp() + protected function setUp() { $this->_reader = new Swift_CharacterReader_Utf8Reader(); } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php index e22e496..977051e 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php @@ -103,7 +103,7 @@ public function testReadCharactersAreInTact() ); $this->assertIdenticalBinary(pack('C*', 0xD1, 0x85), $stream->read(1)); - $this->assertSame(false, $stream->read(1)); + $this->assertFalse($stream->read(1)); } public function testCharactersCanBeReadAsByteArrays() @@ -146,7 +146,7 @@ public function testCharactersCanBeReadAsByteArrays() ); $this->assertEquals(array(0xD1, 0x85), $stream->readBytes(1)); - $this->assertSame(false, $stream->readBytes(1)); + $this->assertFalse($stream->readBytes(1)); } public function testRequestingLargeCharCountPastEndOfStream() @@ -169,7 +169,7 @@ public function testRequestingLargeCharCountPastEndOfStream() $stream->read(100) ); - $this->assertSame(false, $stream->read(1)); + $this->assertFalse($stream->read(1)); } public function testRequestingByteArrayCountPastEndOfStream() @@ -192,7 +192,7 @@ public function testRequestingByteArrayCountPastEndOfStream() $stream->readBytes(100) ); - $this->assertSame(false, $stream->readBytes(1)); + $this->assertFalse($stream->readBytes(1)); } public function testPointerOffsetCanBeSet() @@ -240,7 +240,7 @@ public function testContentsCanBeFlushed() $stream->flushContents(); - $this->assertSame(false, $stream->read(1)); + $this->assertFalse($stream->read(1)); } public function testByteStreamCanBeImportingUsesValidator() @@ -308,7 +308,7 @@ public function testImportingStreamProducesCorrectCharArray() $this->assertIdenticalBinary(pack('C*', 0xD0, 0xB6), $stream->read(1)); $this->assertIdenticalBinary(pack('C*', 0xD0, 0xBE), $stream->read(1)); - $this->assertSame(false, $stream->read(1)); + $this->assertFalse($stream->read(1)); } public function testAlgorithmWithFixedWidthCharsets() @@ -332,11 +332,9 @@ public function testAlgorithmWithFixedWidthCharsets() $this->assertIdenticalBinary(pack('C*', 0xD0, 0xBB), $stream->read(1)); $this->assertIdenticalBinary(pack('C*', 0xD0, 0xB0), $stream->read(1)); - $this->assertSame(false, $stream->read(1)); + $this->assertFalse($stream->read(1)); } - // -- Creation methods - private function _getReader() { return $this->getMockery('Swift_CharacterReader'); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php index bc4a79b..ccd14f6 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php @@ -2,7 +2,9 @@ class One { - public $arg1, $arg2; + public $arg1; + public $arg2; + public function __construct($arg1 = null, $arg2 = null) { $this->arg1 = $arg1; @@ -14,7 +16,7 @@ class Swift_DependencyContainerTest extends \PHPUnit_Framework_TestCase { private $_container; - public function setUp() + protected function setUp() { $this->_container = new Swift_DependencyContainer(); } @@ -39,7 +41,7 @@ public function testHasReturnsFalseForUnregisteredValue() public function testRegisterAndLookupNewInstance() { $this->_container->register('one')->asNewInstanceOf('One'); - $this->assertInstanceof('One', $this->_container->lookup('one')); + $this->assertInstanceOf('One', $this->_container->lookup('one')); } public function testHasReturnsTrueForRegisteredInstance() @@ -59,7 +61,7 @@ public function testNewInstanceIsAlwaysNew() public function testRegisterAndLookupSharedInstance() { $this->_container->register('one')->asSharedInstanceOf('One'); - $this->assertInstanceof('One', $this->_container->lookup('one')); + $this->assertInstanceOf('One', $this->_container->lookup('one')); } public function testHasReturnsTrueForSharedInstance() diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php index 1e712fe..b89eb9f 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php @@ -4,7 +4,7 @@ class Swift_Encoder_Base64EncoderTest extends \PHPUnit_Framework_TestCase { private $_encoder; - public function setUp() + protected function setUp() { $this->_encoder = new Swift_Encoder_Base64Encoder(); } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php index adf485d..6740f22 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php @@ -372,10 +372,29 @@ public function testFirstLineLengthCanBeDifferent() ); } - // -- Creation methods + public function testTextIsPreWrapped() + { + $encoder = $this->createEncoder(); + + $input = str_repeat('a', 70)."\r\n". + str_repeat('a', 70)."\r\n". + str_repeat('a', 70); + + $this->assertEquals( + $input, $encoder->encodeString($input) + ); + } private function _createCharStream() { return $this->getMockery('Swift_CharacterStream')->shouldIgnoreMissing(); } + + private function createEncoder() + { + $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); + $charStream = new Swift_CharacterStream_NgCharacterStream($factory, 'utf-8'); + + return new Swift_Encoder_QpEncoder($charStream); + } } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php index 7e59802..a78bc3a 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php @@ -22,8 +22,6 @@ public function testSourceIsBuffer() $this->assertEquals($transport, $ref); } - // -- Creation Methods - private function _createEvent(Swift_Transport $source, $command, $successCodes = array()) { return new Swift_Events_CommandEvent($source, $command, $successCodes); @@ -31,6 +29,6 @@ private function _createEvent(Swift_Transport $source, $command, $successCodes = private function _createTransport() { - return $this->getMock('Swift_Transport'); + return $this->getMockBuilder('Swift_Transport')->getMock(); } } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php index 62a91be..0cfe3ca 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php @@ -25,8 +25,6 @@ public function testBubbleCanBeCancelledInEvent() $this->assertTrue($evt->bubbleCancelled()); } - // -- Creation Methods - private function _createEvent($source) { return new Swift_Events_EventObject($source); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php index e0f3e36..6f611ac 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php @@ -26,8 +26,6 @@ public function testSourceIsBuffer() $this->assertEquals($transport, $ref); } - // -- Creation Methods - private function _createEvent(Swift_Transport $source, $response, $result) { return new Swift_Events_ResponseEvent($source, $response, $result); @@ -35,6 +33,6 @@ private function _createEvent(Swift_Transport $source, $response, $result) private function _createTransport() { - return $this->getMock('Swift_Transport'); + return $this->getMockBuilder('Swift_Transport')->getMock(); } } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php index 8003870..c4a6a7e 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php @@ -79,8 +79,6 @@ public function testFailedRecipientsGetsPickedUpCorrectly() $this->assertEquals(array(), $evt->getFailedRecipients()); } - // -- Creation Methods - private function _createEvent(Swift_Transport $source, Swift_Mime_Message $message) { @@ -89,11 +87,11 @@ private function _createEvent(Swift_Transport $source, private function _createTransport() { - return $this->getMock('Swift_Transport'); + return $this->getMockBuilder('Swift_Transport')->getMock(); } private function _createMessage() { - return $this->getMock('Swift_Mime_Message'); + return $this->getMockBuilder('Swift_Mime_Message')->getMock(); } } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php index 52ae07c..3f063ff 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php @@ -4,26 +4,26 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit_Framework_TestCase { private $_dispatcher; - public function setUp() + protected function setUp() { $this->_dispatcher = new Swift_Events_SimpleEventDispatcher(); } public function testSendEventCanBeCreated() { - $transport = $this->getMock('Swift_Transport'); - $message = $this->getMock('Swift_Mime_Message'); + $transport = $this->getMockBuilder('Swift_Transport')->getMock(); + $message = $this->getMockBuilder('Swift_Mime_Message')->getMock(); $evt = $this->_dispatcher->createSendEvent($transport, $message); - $this->assertInstanceof('Swift_Events_SendEvent', $evt); + $this->assertInstanceOf('Swift_Events_SendEvent', $evt); $this->assertSame($message, $evt->getMessage()); $this->assertSame($transport, $evt->getTransport()); } public function testCommandEventCanBeCreated() { - $buf = $this->getMock('Swift_Transport'); + $buf = $this->getMockBuilder('Swift_Transport')->getMock(); $evt = $this->_dispatcher->createCommandEvent($buf, "FOO\r\n", array(250)); - $this->assertInstanceof('Swift_Events_CommandEvent', $evt); + $this->assertInstanceOf('Swift_Events_CommandEvent', $evt); $this->assertSame($buf, $evt->getSource()); $this->assertEquals("FOO\r\n", $evt->getCommand()); $this->assertEquals(array(250), $evt->getSuccessCodes()); @@ -31,9 +31,9 @@ public function testCommandEventCanBeCreated() public function testResponseEventCanBeCreated() { - $buf = $this->getMock('Swift_Transport'); + $buf = $this->getMockBuilder('Swift_Transport')->getMock(); $evt = $this->_dispatcher->createResponseEvent($buf, "250 Ok\r\n", true); - $this->assertInstanceof('Swift_Events_ResponseEvent', $evt); + $this->assertInstanceOf('Swift_Events_ResponseEvent', $evt); $this->assertSame($buf, $evt->getSource()); $this->assertEquals("250 Ok\r\n", $evt->getResponse()); $this->assertTrue($evt->isValid()); @@ -41,30 +41,30 @@ public function testResponseEventCanBeCreated() public function testTransportChangeEventCanBeCreated() { - $transport = $this->getMock('Swift_Transport'); + $transport = $this->getMockBuilder('Swift_Transport')->getMock(); $evt = $this->_dispatcher->createTransportChangeEvent($transport); - $this->assertInstanceof('Swift_Events_TransportChangeEvent', $evt); + $this->assertInstanceOf('Swift_Events_TransportChangeEvent', $evt); $this->assertSame($transport, $evt->getSource()); } public function testTransportExceptionEventCanBeCreated() { - $transport = $this->getMock('Swift_Transport'); + $transport = $this->getMockBuilder('Swift_Transport')->getMock(); $ex = new Swift_TransportException(''); $evt = $this->_dispatcher->createTransportExceptionEvent($transport, $ex); - $this->assertInstanceof('Swift_Events_TransportExceptionEvent', $evt); + $this->assertInstanceOf('Swift_Events_TransportExceptionEvent', $evt); $this->assertSame($transport, $evt->getSource()); $this->assertSame($ex, $evt->getException()); } public function testListenersAreNotifiedOfDispatchedEvent() { - $transport = $this->getMock('Swift_Transport'); + $transport = $this->getMockBuilder('Swift_Transport')->getMock(); $evt = $this->_dispatcher->createTransportChangeEvent($transport); - $listenerA = $this->getMock('Swift_Events_TransportChangeListener'); - $listenerB = $this->getMock('Swift_Events_TransportChangeListener'); + $listenerA = $this->getMockBuilder('Swift_Events_TransportChangeListener')->getMock(); + $listenerB = $this->getMockBuilder('Swift_Events_TransportChangeListener')->getMock(); $this->_dispatcher->bindEventListener($listenerA); $this->_dispatcher->bindEventListener($listenerB); @@ -81,13 +81,13 @@ public function testListenersAreNotifiedOfDispatchedEvent() public function testListenersAreOnlyCalledIfImplementingCorrectInterface() { - $transport = $this->getMock('Swift_Transport'); - $message = $this->getMock('Swift_Mime_Message'); + $transport = $this->getMockBuilder('Swift_Transport')->getMock(); + $message = $this->getMockBuilder('Swift_Mime_Message')->getMock(); $evt = $this->_dispatcher->createSendEvent($transport, $message); - $targetListener = $this->getMock('Swift_Events_SendListener'); - $otherListener = $this->getMock('Swift_Events_TransportChangeListener'); + $targetListener = $this->getMockBuilder('Swift_Events_SendListener')->getMock(); + $otherListener = $this->getMockBuilder('DummyListener')->getMock(); $this->_dispatcher->bindEventListener($targetListener); $this->_dispatcher->bindEventListener($otherListener); @@ -103,13 +103,13 @@ public function testListenersAreOnlyCalledIfImplementingCorrectInterface() public function testListenersCanCancelBubblingOfEvent() { - $transport = $this->getMock('Swift_Transport'); - $message = $this->getMock('Swift_Mime_Message'); + $transport = $this->getMockBuilder('Swift_Transport')->getMock(); + $message = $this->getMockBuilder('Swift_Mime_Message')->getMock(); $evt = $this->_dispatcher->createSendEvent($transport, $message); - $listenerA = $this->getMock('Swift_Events_SendListener'); - $listenerB = $this->getMock('Swift_Events_SendListener'); + $listenerA = $this->getMockBuilder('Swift_Events_SendListener')->getMock(); + $listenerB = $this->getMockBuilder('Swift_Events_SendListener')->getMock(); $this->_dispatcher->bindEventListener($listenerA); $this->_dispatcher->bindEventListener($listenerB); @@ -133,3 +133,10 @@ private function _createDispatcher(array $map) return new Swift_Events_SimpleEventDispatcher($map); } } + +class DummyListener implements Swift_Events_EventListener +{ + public function sendPerformed(Swift_Events_SendEvent $evt) + { + } +} diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php index 40bec83..a260ccb 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php @@ -18,8 +18,6 @@ public function testSourceIsTransport() $this->assertEquals($transport, $ref); } - // -- Creation Methods - private function _createEvent(Swift_Transport $source) { return new Swift_Events_TransportChangeEvent($source); @@ -27,6 +25,6 @@ private function _createEvent(Swift_Transport $source) private function _createTransport() { - return $this->getMock('Swift_Transport'); + return $this->getMockBuilder('Swift_Transport')->getMock(); } } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php index 86c636b..731dfad 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php @@ -24,8 +24,6 @@ public function testSourceIsTransport() ); } - // -- Creation Methods - private function _createEvent(Swift_Transport $transport, Swift_TransportException $ex) { return new Swift_Events_TransportExceptionEvent($transport, $ex); @@ -33,7 +31,7 @@ private function _createEvent(Swift_Transport $transport, Swift_TransportExcepti private function _createTransport() { - return $this->getMock('Swift_Transport'); + return $this->getMockBuilder('Swift_Transport')->getMock(); } private function _createException() diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php index 36512cf..f2ed5dd 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php @@ -218,8 +218,6 @@ public function testNsKeyCanBeCleared() $this->assertFalse($cache->hasKey($this->_key1, 'bar')); } - // -- Creation methods - private function _createCache($is) { return new Swift_KeyCache_ArrayKeyCache($is); @@ -227,16 +225,16 @@ private function _createCache($is) private function _createKeyCacheInputStream() { - return $this->getMock('Swift_KeyCache_KeyCacheInputStream'); + return $this->getMockBuilder('Swift_KeyCache_KeyCacheInputStream')->getMock(); } private function _createOutputStream() { - return $this->getMock('Swift_OutputByteStream'); + return $this->getMockBuilder('Swift_OutputByteStream')->getMock(); } private function _createInputStream() { - return $this->getMock('Swift_InputByteStream'); + return $this->getMockBuilder('Swift_InputByteStream')->getMock(); } } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php index 691c1e7..38fbc0d 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php @@ -6,7 +6,7 @@ class Swift_KeyCache_SimpleKeyCacheInputStreamTest extends \PHPUnit_Framework_Te public function testStreamWritesToCacheInAppendMode() { - $cache = $this->getMock('Swift_KeyCache'); + $cache = $this->getMockBuilder('Swift_KeyCache')->getMock(); $cache->expects($this->at(0)) ->method('setString') ->with($this->_nsKey, 'foo', 'a', Swift_KeyCache::MODE_APPEND); @@ -29,7 +29,7 @@ public function testStreamWritesToCacheInAppendMode() public function testFlushContentClearsKey() { - $cache = $this->getMock('Swift_KeyCache'); + $cache = $this->getMockBuilder('Swift_KeyCache')->getMock(); $cache->expects($this->once()) ->method('clearKey') ->with($this->_nsKey, 'foo'); @@ -44,7 +44,7 @@ public function testFlushContentClearsKey() public function testClonedStreamStillReferencesSameCache() { - $cache = $this->getMock('Swift_KeyCache'); + $cache = $this->getMockBuilder('Swift_KeyCache')->getMock(); $cache->expects($this->at(0)) ->method('setString') ->with($this->_nsKey, 'foo', 'a', Swift_KeyCache::MODE_APPEND); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php index db0b35a..74951a7 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php @@ -123,8 +123,6 @@ public function testRegisterPluginDelegatesToTransport() $mailer->registerPlugin($plugin); } - // -- Creation methods - private function _createPlugin() { return $this->getMockery('Swift_Events_EventListener')->shouldIgnoreMissing(); @@ -140,11 +138,6 @@ private function _createMessage() return $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing(); } - private function _createIterator() - { - return $this->getMockery('Swift_Mailer_RecipientIterator')->shouldIgnoreMissing(); - } - private function _createMailer(Swift_Transport $transport) { return new Swift_Mailer($transport); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MessageTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MessageTest.php index c9e7383..35a568c 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MessageTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MessageTest.php @@ -54,7 +54,6 @@ public function testBodySwap() $this->assertNotEquals($id_1, $id_2, 'Message Ids are the same'); } - // -- Private helpers protected function _recursiveObjectCloningCheck($obj1, $obj2, $obj1_clone) { $obj1_properties = (array) $obj1; @@ -123,7 +122,7 @@ protected function _recursiveArrayCloningCheck($array1, $array2, $array1_clone) $arr2_value = $array2[$key]; $arr1_clone_value = $array1_clone[$key]; - return $this->_recursiveArrayCloningCheck($obj1_value, $obj2_value, $obj1_clone_value); + return $this->_recursiveArrayCloningCheck($arr1_value, $arr2_value, $arr1_clone_value); } } } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php index dc8ea09..3efe6ec 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php @@ -379,7 +379,7 @@ public function testBoundaryNeverChanges() $this->_createEncoder(), $this->_createCache() ); $firstBoundary = $entity->getBoundary(); - for ($i = 0; $i < 10; $i++) { + for ($i = 0; $i < 10; ++$i) { $this->assertEquals($firstBoundary, $entity->getBoundary()); } } @@ -540,13 +540,13 @@ public function testChildrenAppearNestedInString() $child1 = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, "Content-Type: text/plain\r\n". "\r\n". - 'foobar' + 'foobar', 'text/plain' ); $child2 = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, "Content-Type: text/html\r\n". "\r\n". - 'foobar' + 'foobar', 'text/html' ); $headers->shouldReceive('toString') @@ -623,7 +623,7 @@ public function testMixingLevelsIsHierarchical() "\r\n". 'data'. "\r\n\r\n--xxx--\r\n". - "\$~", + '$~', $entity->toString() ); } @@ -740,6 +740,46 @@ public function testOrderingTextBeforeHtml() ); } + public function testOrderingEqualContentTypesMaintainsOriginalOrdering() + { + $firstChild = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, + "Content-Type: text/plain\r\n". + "\r\n". + 'PART 1', + 'text/plain' + ); + $secondChild = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, + "Content-Type: text/plain\r\n". + "\r\n". + 'PART 2', + 'text/plain' + ); + $headers = $this->_createHeaderSet(array(), false); + $headers->shouldReceive('toString') + ->zeroOrMoreTimes() + ->andReturn("Content-Type: multipart/alternative; boundary=\"xxx\"\r\n"); + + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setBoundary('xxx'); + $entity->setChildren(array($firstChild, $secondChild)); + + $this->assertEquals( + "Content-Type: multipart/alternative; boundary=\"xxx\"\r\n". + "\r\n\r\n--xxx\r\n". + "Content-Type: text/plain\r\n". + "\r\n". + 'PART 1'. + "\r\n\r\n--xxx\r\n". + "Content-Type: text/plain\r\n". + "\r\n". + 'PART 2'. + "\r\n\r\n--xxx--\r\n", + $entity->toString() + ); + } + public function testUnsettingChildrenRestoresContentType() { $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false); @@ -948,8 +988,6 @@ public function testFluidInterface() ); } - // -- Private helpers - abstract protected function _createEntity($headers, $encoder, $cache); protected function _createChild($level = null, $string = '', $stub = true) @@ -969,7 +1007,7 @@ protected function _createChild($level = null, $string = '', $stub = true) protected function _createEncoder($name = 'quoted-printable', $stub = true) { - $encoder = $this->getMock('Swift_Mime_ContentEncoder'); + $encoder = $this->getMockBuilder('Swift_Mime_ContentEncoder')->getMock(); $encoder->expects($this->any()) ->method('getName') ->will($this->returnValue($name)); @@ -1049,6 +1087,6 @@ protected function _createOutputStream($data = null, $stub = true) protected function _createInputStream($stub = true) { - return $this->getMock('Swift_InputByteStream'); + return $this->getMockBuilder('Swift_InputByteStream')->getMock(); } } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php index bd2499c..2c1e581 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php @@ -282,8 +282,6 @@ public function testFluidInterface() ); } - // -- Private helpers - protected function _createEntity($headers, $encoder, $cache) { return $this->_createAttachment($headers, $encoder, $cache); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php index 0442af3..1571fce 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php @@ -4,7 +4,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes { private $_encoder; - public function setUp() + protected function setUp() { $this->_encoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder(); } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php index 526cedc..ca44e11 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php @@ -50,7 +50,7 @@ public function testLineLengthCanBeSpecified() $encoder = $this->_getEncoder('7bit'); $chars = array(); - for ($i = 0; $i < 50; $i++) { + for ($i = 0; $i < 50; ++$i) { $chars[] = 'a'; } $input = implode(' ', $chars); //99 chars long @@ -75,7 +75,7 @@ public function testLineLengthCanBeSpecifiedInByteStream() ->zeroOrMoreTimes() ->andReturnUsing($collection); - for ($i = 0; $i < 50; $i++) { + for ($i = 0; $i < 50; ++$i) { $os->shouldReceive('read') ->once() ->andReturn('a '); @@ -154,8 +154,6 @@ public function testCanonicEncodeByteStreamGeneratesCorrectCrlf($test, $expected $this->assertEquals($expected, $collection->content); } - // -- Private helpers - private function _getEncoder($name, $canonical = false) { return new Swift_Mime_ContentEncoder_PlainContentEncoder($name, $canonical); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php index 66fa8f3..7762bbe 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php @@ -472,16 +472,36 @@ public function testObserverInterfaceCanChangeCharset() $encoder->charsetChanged('windows-1252'); } - // -- Creation Methods + public function testTextIsPreWrapped() + { + $encoder = $this->createEncoder(); + + $input = str_repeat('a', 70)."\r\n". + str_repeat('a', 70)."\r\n". + str_repeat('a', 70); + + $os = new Swift_ByteStream_ArrayByteStream(); + $is = new Swift_ByteStream_ArrayByteStream(); + $is->write($input); + + $encoder->encodeByteStream($is, $os); + + $this->assertEquals( + $input, $os->read(PHP_INT_MAX) + ); + } private function _createCharacterStream($stub = false) { return $this->getMockery('Swift_CharacterStream')->shouldIgnoreMissing(); } - private function _createEncoder($charStream) + private function createEncoder() { - return new Swift_Mime_HeaderEncoder_QpHeaderEncoder($charStream); + $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); + $charStream = new Swift_CharacterStream_NgCharacterStream($factory, 'utf-8'); + + return new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); } private function _createOutputByteStream($stub = false) diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php index f4c3ac8..3a1fc51 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php @@ -43,8 +43,6 @@ public function testDefaultDispositionIsInline() ); } - // -- Private helpers - protected function _createAttachment($headers, $encoder, $cache, $mimeTypes = array()) { return $this->_createEmbeddedFile($headers, $encoder, $cache, $mimeTypes); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php index 54a792a..b5a10fe 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php @@ -209,8 +209,6 @@ public function testEqualsNeverAppearsAtEndOfLine() $this->assertEquals($output, $encoder->encodeString($input)); } - // -- Creation Methods - private function _createEncoder($charStream) { return new Swift_Mime_HeaderEncoder_QpHeaderEncoder($charStream); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php index 0f3fe14..cd027cc 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php @@ -371,8 +371,6 @@ public function testGetParameter() $this->assertEquals('utf-8', $header->getParameter('charset')); } - // -- Private helper - private function _getHeader($name, $encoder, $paramEncoder) { $header = new Swift_Mime_Headers_ParameterizedHeader($name, $encoder, diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php index af69088..738ac68 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php @@ -181,7 +181,7 @@ public function testDelSpIsReturnedFromHeader() 'Content-Type' => $cType, )), $this->_createEncoder(), $this->_createCache() ); - $this->assertSame(false, $part->getDelSp()); + $this->assertFalse($part->getDelSp()); } public function testDelSpIsSetInHeader() @@ -218,8 +218,6 @@ public function testFluidInterface() ); } - // -- Private helpers - //abstract protected function _createEntity($headers, $encoder, $cache) { diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php index 0d5573f..6a87abf 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php @@ -4,7 +4,7 @@ class Swift_Mime_SimpleHeaderFactoryTest extends \PHPUnit_Framework_TestCase { private $_factory; - public function setUp() + protected function setUp() { $this->_factory = $this->_createFactory(); } @@ -12,7 +12,7 @@ public function setUp() public function testMailboxHeaderIsCorrectType() { $header = $this->_factory->createMailboxHeader('X-Foo'); - $this->assertInstanceof('Swift_Mime_Headers_MailboxHeader', $header); + $this->assertInstanceOf('Swift_Mime_Headers_MailboxHeader', $header); } public function testMailboxHeaderHasCorrectName() @@ -32,7 +32,7 @@ public function testMailboxHeaderHasCorrectModel() public function testDateHeaderHasCorrectType() { $header = $this->_factory->createDateHeader('X-Date'); - $this->assertInstanceof('Swift_Mime_Headers_DateHeader', $header); + $this->assertInstanceOf('Swift_Mime_Headers_DateHeader', $header); } public function testDateHeaderHasCorrectName() @@ -50,7 +50,7 @@ public function testDateHeaderHasCorrectModel() public function testTextHeaderHasCorrectType() { $header = $this->_factory->createTextHeader('X-Foo'); - $this->assertInstanceof('Swift_Mime_Headers_UnstructuredHeader', $header); + $this->assertInstanceOf('Swift_Mime_Headers_UnstructuredHeader', $header); } public function testTextHeaderHasCorrectName() @@ -68,7 +68,7 @@ public function testTextHeaderHasCorrectModel() public function testParameterizedHeaderHasCorrectType() { $header = $this->_factory->createParameterizedHeader('X-Foo'); - $this->assertInstanceof('Swift_Mime_Headers_ParameterizedHeader', $header); + $this->assertInstanceOf('Swift_Mime_Headers_ParameterizedHeader', $header); } public function testParameterizedHeaderHasCorrectName() @@ -94,7 +94,7 @@ public function testParameterizedHeaderHasCorrectParams() public function testIdHeaderHasCorrectType() { $header = $this->_factory->createIdHeader('X-ID'); - $this->assertInstanceof('Swift_Mime_Headers_IdentificationHeader', $header); + $this->assertInstanceOf('Swift_Mime_Headers_IdentificationHeader', $header); } public function testIdHeaderHasCorrectName() @@ -112,7 +112,7 @@ public function testIdHeaderHasCorrectModel() public function testPathHeaderHasCorrectType() { $header = $this->_factory->createPathHeader('X-Path'); - $this->assertInstanceof('Swift_Mime_Headers_PathHeader', $header); + $this->assertInstanceOf('Swift_Mime_Headers_PathHeader', $header); } public function testPathHeaderHasCorrectName() @@ -143,8 +143,6 @@ public function testCharsetChangeNotificationNotifiesEncoders() $factory->charsetChanged('utf-8'); } - // -- Creation methods - private function _createFactory($encoder = null, $paramEncoder = null) { return new Swift_Mime_SimpleHeaderFactory( @@ -158,11 +156,11 @@ private function _createFactory($encoder = null, $paramEncoder = null) private function _createHeaderEncoder() { - return $this->getMock('Swift_Mime_HeaderEncoder'); + return $this->getMockBuilder('Swift_Mime_HeaderEncoder')->getMock(); } private function _createParamEncoder() { - return $this->getMock('Swift_Encoder'); + return $this->getMockBuilder('Swift_Encoder')->getMock(); } } diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php index a781a08..bed1c13 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php @@ -357,8 +357,13 @@ public function testRemoveWithSpecifiedIndexRemovesHeader() $set = $this->_createSet($factory); $set->addIdHeader('Message-ID', 'some@id'); $set->addIdHeader('Message-ID', 'other@id'); + $set->remove('Message-ID', 0); + $this->assertFalse($set->has('Message-ID', 0)); + $this->assertTrue($set->has('Message-ID', 1)); + $this->assertTrue($set->has('Message-ID')); $set->remove('Message-ID', 1); $this->assertFalse($set->has('Message-ID', 1)); + $this->assertFalse($set->has('Message-ID')); } public function testRemoveWithSpecifiedIndexLeavesOtherHeaders() @@ -495,7 +500,7 @@ public function testNewInstance() { $set = $this->_createSet($this->_createFactory()); $instance = $set->newInstance(); - $this->assertInstanceof('Swift_Mime_HeaderSet', $instance); + $this->assertInstanceOf('Swift_Mime_HeaderSet', $instance); } public function testToStringJoinsHeadersTogether() @@ -704,8 +709,6 @@ public function testCharsetChangeNotifiesFactory() $set->setCharset('utf-8'); } - // -- Creation methods - private function _createSet($factory) { return new Swift_Mime_SimpleHeaderSet($factory); @@ -713,12 +716,12 @@ private function _createSet($factory) private function _createFactory() { - return $this->getMock('Swift_Mime_HeaderFactory'); + return $this->getMockBuilder('Swift_Mime_HeaderFactory')->getMock(); } private function _createHeader($name, $body = '') { - $header = $this->getMock('Swift_Mime_Header'); + $header = $this->getMockBuilder('Swift_Mime_Header')->getMock(); $header->expects($this->any()) ->method('getFieldName') ->will($this->returnValue($name)); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php index a2cbbca..e5d225c 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php @@ -652,7 +652,7 @@ public function testPriorityIsSetInHeader() $this->_createHeaderSet(array('X-Priority' => $prio)), $this->_createEncoder(), $this->_createCache() ); - $message->setPriority(5); + $message->setPriority($message::PRIORITY_LOWEST); } public function testPriorityHeaderIsAddedIfNoneSet() @@ -667,7 +667,7 @@ public function testPriorityHeaderIsAddedIfNoneSet() $message = $this->_createMessage($headers, $this->_createEncoder(), $this->_createCache() ); - $message->setPriority(4); + $message->setPriority($message::PRIORITY_LOW); } public function testReadReceiptAddressReadFromHeader() @@ -802,15 +802,13 @@ public function testFluidInterface() ->setTo(array('chris@site.tld', 'mark@site.tld')) ->setCc('john@somewhere.tld') ->setBcc(array('one@site', 'two@site' => 'Two')) - ->setPriority(4) + ->setPriority($message::PRIORITY_LOW) ->setReadReceiptTo('a@b') ->attach($child) ->detach($child) ); } - // -- Private helpers - //abstract protected function _createEntity($headers, $encoder, $cache) { diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php index b54d7f8..fa2a8d4 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php @@ -2,8 +2,6 @@ class Swift_Mime_SimpleMimeEntityTest extends Swift_Mime_AbstractMimeEntityTest { - // -- Private helpers - protected function _createEntity($headerFactory, $encoder, $cache) { return new Swift_Mime_SimpleMimeEntity($headerFactory, $encoder, $cache, new Swift_Mime_Grammar()); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php index 9763b71..463e4eb 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php @@ -29,7 +29,7 @@ public function testPluginStopsConnectionAfterThreshold() $evt = $this->_createSendEvent($transport); $plugin = new Swift_Plugins_AntiFloodPlugin(10); - for ($i = 0; $i < 12; $i++) { + for ($i = 0; $i < 12; ++$i) { $plugin->sendPerformed($evt); } } @@ -45,14 +45,14 @@ public function testPluginCanStopAndStartMultipleTimes() $evt = $this->_createSendEvent($transport); $plugin = new Swift_Plugins_AntiFloodPlugin(2); - for ($i = 0; $i < 11; $i++) { + for ($i = 0; $i < 11; ++$i) { $plugin->sendPerformed($evt); } } public function testPluginCanSleepDuringRestart() { - $sleeper = $this->getMock('Swift_Plugins_Sleeper'); + $sleeper = $this->getMockBuilder('Swift_Plugins_Sleeper')->getMock(); $sleeper->expects($this->once()) ->method('sleep') ->with(10); @@ -66,16 +66,14 @@ public function testPluginCanSleepDuringRestart() $evt = $this->_createSendEvent($transport); $plugin = new Swift_Plugins_AntiFloodPlugin(99, 10, $sleeper); - for ($i = 0; $i < 101; $i++) { + for ($i = 0; $i < 101; ++$i) { $plugin->sendPerformed($evt); } } - // -- Creation Methods - private function _createTransport() { - return $this->getMock('Swift_Transport'); + return $this->getMockBuilder('Swift_Transport')->getMock(); } private function _createSendEvent($transport) diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php index f140993..869cfc8 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php @@ -2,7 +2,11 @@ class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit_Framework_TestCase { - public function setUp() + private $_monitor; + + private $_bytes = 0; + + protected function setUp() { $this->_monitor = new Swift_Plugins_BandwidthMonitorPlugin(); } @@ -65,8 +69,6 @@ public function testBytesOutIncreasesAccordingToMessageLength() $this->assertEquals(12, $this->_monitor->getBytesOut()); } - // -- Creation Methods - private function _createSendEvent($message) { $evt = $this->getMockBuilder('Swift_Events_SendEvent') @@ -106,7 +108,7 @@ private function _createResponseEvent($response) private function _createMessageWithByteCount($bytes) { $this->_bytes = $bytes; - $msg = $this->getMock('Swift_Mime_Message'); + $msg = $this->getMockBuilder('Swift_Mime_Message')->getMock(); $msg->expects($this->any()) ->method('toByteStream') ->will($this->returnCallback(array($this, '_write'))); @@ -117,7 +119,6 @@ private function _createMessageWithByteCount($bytes) return $msg; } - private $_bytes = 0; public function _write($is) { for ($i = 0; $i < $this->_bytes; ++$i) { diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php index 7f4cdef..8019dfb 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php @@ -177,8 +177,6 @@ public function testReplacementsCanBeTakenFromCustomReplacementsObject() $plugin->sendPerformed($evt); } - // -- Creation methods - private function _createMessage($headers, $to = array(), $from = null, $subject = null, $body = null) { diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php index bd1fd97..bfe4cb7 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php @@ -123,11 +123,9 @@ public function testExceptionsArePassedToDelegateAndLeftToBubbleUp() } } - // -- Creation Methods - private function _createLogger() { - return $this->getMock('Swift_Plugins_Logger'); + return $this->getMockBuilder('Swift_Plugins_Logger')->getMock(); } private function _createPlugin($logger) @@ -161,7 +159,7 @@ private function _createResponseEvent($response) private function _createTransport() { - return $this->getMock('Swift_Transport'); + return $this->getMockBuilder('Swift_Transport')->getMock(); } private function _createTransportChangeEvent() diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php index 1227c24..cbd368f 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php @@ -69,11 +69,9 @@ public function testPluginCanBindToSpecificTransport() $plugin->beforeTransportStarted($evt); } - // -- Creation Methods - private function _createTransport() { - return $this->getMock('Swift_Transport'); + return $this->getMockBuilder('Swift_Transport')->getMock(); } private function _createTransportChangeEvent($transport) @@ -93,7 +91,7 @@ private function _createTransportChangeEvent($transport) public function _createConnection() { - return $this->getMock('Swift_Plugins_Pop_Pop3Connection'); + return $this->getMockBuilder('Swift_Plugins_Pop_Pop3Connection')->getMock(); } public function _createPlugin($host, $port, $crypto = null) diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php index 4cc7e89..bfd5669 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php @@ -169,8 +169,6 @@ public function testArrayOfRecipientsCanBeExplicitlyDefined() $this->assertEquals($message->getBcc(), array('fabien@example.com' => 'Fabien')); } - // -- Creation Methods - private function _createSendEvent(Swift_Mime_Message $message) { $evt = $this->getMockBuilder('Swift_Events_SendEvent') diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php index 8101883..5ba5d5c 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php @@ -69,8 +69,6 @@ public function testReportingFailedBcc() $plugin->sendPerformed($evt); } - // -- Creation Methods - private function _createMessage() { return $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php index 4d31c3c..20aae57 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php @@ -5,10 +5,10 @@ class Swift_Plugins_Reporters_HitReporterTest extends \PHPUnit_Framework_TestCas private $_hitReporter; private $_message; - public function setUp() + protected function setUp() { $this->_hitReporter = new Swift_Plugins_Reporters_HitReporter(); - $this->_message = $this->getMock('Swift_Mime_Message'); + $this->_message = $this->getMockBuilder('Swift_Mime_Message')->getMock(); } public function testReportingFail() diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php index 3e78fca..fb0bc97 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php @@ -5,10 +5,10 @@ class Swift_Plugins_Reporters_HtmlReporterTest extends \PHPUnit_Framework_TestCa private $_html; private $_message; - public function setUp() + protected function setUp() { $this->_html = new Swift_Plugins_Reporters_HtmlReporter(); - $this->_message = $this->getMock('Swift_Mime_Message'); + $this->_message = $this->getMockBuilder('Swift_Mime_Message')->getMock(); } public function testReportingPass() diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php index a50f14f..309f506 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php @@ -66,8 +66,6 @@ public function testMessagesPerMinuteThrottling() } } - // -- Creation Methods - private function _createSleeper() { return $this->getMockery('Swift_Plugins_Sleeper'); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php index 13c1b4c..5eda223 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php @@ -2,12 +2,10 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase { - public function setUp() + protected function setUp() { - if (version_compare(phpversion(), '5.4', '<') && !defined('OPENSSL_ALGO_SHA256')) { - $this->markTestSkipped( - 'skipping because of https://bugs.php.net/bug.php?id=61421' - ); + if (PHP_VERSION_ID < 50400 && !defined('OPENSSL_ALGO_SHA256')) { + $this->markTestSkipped('skipping because of https://bugs.php.net/bug.php?id=61421'); } } @@ -29,12 +27,13 @@ public function testBasicSigningHeaderManipulation() $signer->addSignature($headers); } - // Default Signing - public function testSigningDefaults() + // SHA1 Signing + public function testSigningSHA1() { $headerSet = $this->_createHeaderSet(); $messageContent = 'Hello World'; $signer = new Swift_Signers_DKIMSigner(file_get_contents(dirname(dirname(dirname(__DIR__))).'/_samples/dkim/dkim.test.priv'), 'dummy.nxdomain.be', 'dummySelector'); + $signer->setHashAlgorithm('rsa-sha1'); $signer->setSignatureTimestamp('1299879181'); $altered = $signer->getAlteredHeaders(); $this->assertEquals(array('DKIM-Signature'), $altered); @@ -147,7 +146,6 @@ public function testSigningSimpleRelaxed256() $this->assertEquals($sig->getValue(), 'v=1; a=rsa-sha256; bh=f+W+hu8dIhf2VAni89o8lF6WKTXi7nViA4RrMdpD5/U=; d=dummy.nxdomain.be; h=; i=@dummy.nxdomain.be; s=dummySelector; c=simple/relaxed; t=1299879181; b=M5eomH/zamyzix9kOes+6YLzQZxuJdBP4x3nP9zF2N26eMLG2/cBKbnNyqiOTDhJdYfWPbLIa 1CWnjST0j5p4CpeOkGYuiE+M4TWEZwhRmRWootlPO3Ii6XpbBJKFk1o9zviS7OmXblUUE4aqb yRSIMDhtLdCK5GlaCneFLN7RQ='); } - // -- Creation Methods private function _createHeaderSet() { $cache = new Swift_KeyCache_ArrayKeyCache(new Swift_KeyCache_SimpleKeyCacheInputStream()); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/OpenDKIMSignerTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/OpenDKIMSignerTest.php index 00e48c1..ce99bc6 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/OpenDKIMSignerTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/OpenDKIMSignerTest.php @@ -5,7 +5,7 @@ */ class Swift_Signers_OpenDKIMSignerTest extends \SwiftMailerTestCase { - public function setUp() + protected function setUp() { if (!extension_loaded('opendkim')) { $this->markTestSkipped( diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php index df745ef..5069c1f 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php @@ -9,7 +9,7 @@ class Swift_Signers_SMimeSignerTest extends \PHPUnit_Framework_TestCase protected $samplesDir; - public function setUp() + protected function setUp() { $this->replacementFactory = Swift_DependencyContainer::getInstance() ->lookup('transport.replacementfactory'); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php index e4d4f48..c85bdc1 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php @@ -122,8 +122,6 @@ public function testConvertingAllLineEndingsToCRLFWhenInputContainsLFLF() ); } - // -- Creation methods - private function _createFilter($search, $replace) { return new Swift_StreamFilters_ByteArrayReplacementFilter($search, $replace); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php index bd44f5c..c14d5dc 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php @@ -5,7 +5,7 @@ class Swift_StreamFilters_StringReplacementFilterFactoryTest extends \PHPUnit_Fr public function testInstancesOfStringReplacementFilterAreCreated() { $factory = $this->_createFactory(); - $this->assertInstanceof( + $this->assertInstanceOf( 'Swift_StreamFilters_StringReplacementFilter', $factory->createFilter('a', 'b') ); @@ -29,8 +29,6 @@ public function testDifferingInstancesAreNotCached() ); } - // -- Creation methods - private function _createFactory() { return new Swift_StreamFilters_StringReplacementFilterFactory(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php index 7a98a2f..681e235 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php @@ -46,7 +46,11 @@ public function testShouldBufferReturnsTrueIfAnyOfMultipleMatchesAtEndOfString() ); } - // -- Creation methods + public function testShouldBufferReturnsFalseOnEmptyBuffer() + { + $filter = $this->_createFilter("\r\n", "\n"); + $this->assertFalse($filter->shouldBuffer('')); + } private function _createFilter($search, $replace) { diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php index 121aaba..81bda4f 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php @@ -551,8 +551,6 @@ public function testExceptionBubblesCanBeCancelled() $smtp->start(); } - // -- Creation Methods - protected function _createEventDispatcher($stub = true) { return $this->getMockery('Swift_Events_EventDispatcher')->shouldIgnoreMissing(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php index f64b071..aca03a9 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php @@ -4,7 +4,7 @@ class Swift_Transport_Esmtp_Auth_CramMd5AuthenticatorTest extends \SwiftMailerTe { private $_agent; - public function setUp() + protected function setUp() { $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing(); } @@ -57,8 +57,6 @@ public function testAuthenticationFailureSendRsetAndReturnFalse() ); } - // -- Private helpers - private function _getAuthenticator() { return new Swift_Transport_Esmtp_Auth_CramMd5Authenticator(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php index fc6e806..13f0209 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php @@ -4,7 +4,7 @@ class Swift_Transport_Esmtp_Auth_LoginAuthenticatorTest extends \SwiftMailerTest { private $_agent; - public function setUp() + protected function setUp() { $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing(); } @@ -57,8 +57,6 @@ public function testAuthenticationFailureSendRsetAndReturnFalse() ); } - // -- Private helpers - private function _getAuthenticator() { return new Swift_Transport_Esmtp_Auth_LoginAuthenticator(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/NTLMAuthenticatorTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/NTLMAuthenticatorTest.php index dd26294..911d258 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/NTLMAuthenticatorTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/NTLMAuthenticatorTest.php @@ -6,12 +6,10 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC private $_message2 = '4e544c4d53535000020000000c000c003000000035828980514246973ea892c10000000000000000460046003c00000054004500530054004e00540002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d0000000000'; private $_message3 = '4e544c4d5353500003000000180018006000000076007600780000000c000c0040000000080008004c0000000c000c0054000000000000009a0000000102000054004500530054004e00540074006500730074004d0045004d00420045005200bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000'; - public function setUp() + protected function setUp() { - if (!function_exists('mcrypt_module_open') || !function_exists('openssl_random_pseudo_bytes') || !function_exists('bcmul') || !function_exists('iconv')) { - $this->markTestSkipped( - 'One of the required functions is not available.' - ); + if (!function_exists('openssl_encrypt') || !function_exists('openssl_random_pseudo_bytes') || !function_exists('bcmul') || !function_exists('iconv')) { + $this->markTestSkipped('One of the required functions is not available.'); } } @@ -26,9 +24,7 @@ public function testMessage1Generator() $login = $this->_getAuthenticator(); $message1 = $this->_invokePrivateMethod('createMessage1', $login); - $this->assertEquals($this->_message1, bin2hex($message1), - '%s: We send the smallest ntlm message which should never fail.' - ); + $this->assertEquals($this->_message1, bin2hex($message1), '%s: We send the smallest ntlm message which should never fail.'); } public function testLMv1Generator() @@ -40,9 +36,7 @@ public function testLMv1Generator() $login = $this->_getAuthenticator(); $lmv1Result = $this->_invokePrivateMethod('createLMPassword', $login, array($password, $this->hex2bin($challenge))); - $this->assertEquals($lmv1, bin2hex($lmv1Result), - '%s: The keys should be the same cause we use the same values to generate them.' - ); + $this->assertEquals($lmv1, bin2hex($lmv1Result), '%s: The keys should be the same cause we use the same values to generate them.'); } public function testLMv2Generator() @@ -56,9 +50,7 @@ public function testLMv2Generator() $login = $this->_getAuthenticator(); $lmv2Result = $this->_invokePrivateMethod('createLMv2Password', $login, array($password, $username, $domain, $this->hex2bin($challenge), $this->hex2bin('ffffff0011223344'))); - $this->assertEquals($lmv2, bin2hex($lmv2Result), - '%s: The keys should be the same cause we use the same values to generate them.' - ); + $this->assertEquals($lmv2, bin2hex($lmv2Result), '%s: The keys should be the same cause we use the same values to generate them.'); } public function testMessage3v1Generator() @@ -73,9 +65,7 @@ public function testMessage3v1Generator() $login = $this->_getAuthenticator(); $message3 = $this->_invokePrivateMethod('createMessage3', $login, array($domain, $username, $workstation, $this->hex2bin($lmResponse), $this->hex2bin($ntlmResponse))); - $this->assertEquals($message3T, bin2hex($message3), - '%s: We send the same information as the example is created with so this should be the same' - ); + $this->assertEquals($message3T, bin2hex($message3), '%s: We send the same information as the example is created with so this should be the same'); } public function testMessage3v2Generator() @@ -89,9 +79,7 @@ public function testMessage3v2Generator() $login = $this->_getAuthenticator(); $message3 = $this->_invokePrivateMethod('createMessage3', $login, array($domain, $username, $workstation, $this->hex2bin($lmResponse), $this->hex2bin($ntlmResponse))); - $this->assertEquals($this->_message3, bin2hex($message3), - '%s: We send the same information as the example is created with so this should be the same' - ); + $this->assertEquals($this->_message3, bin2hex($message3), '%s: We send the same information as the example is created with so this should be the same'); } public function testGetDomainAndUsername() @@ -101,12 +89,8 @@ public function testGetDomainAndUsername() $login = $this->_getAuthenticator(); list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username)); - $this->assertEquals('DOMAIN', $domain, - '%s: the fetched domain did not match' - ); - $this->assertEquals('user', $user, - '%s: the fetched user did not match' - ); + $this->assertEquals('DOMAIN', $domain, '%s: the fetched domain did not match'); + $this->assertEquals('user', $user, '%s: the fetched user did not match'); } public function testGetDomainAndUsernameWithExtension() @@ -116,12 +100,8 @@ public function testGetDomainAndUsernameWithExtension() $login = $this->_getAuthenticator(); list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username)); - $this->assertEquals('domain.com', $domain, - '%s: the fetched domain did not match' - ); - $this->assertEquals('user', $user, - '%s: the fetched user did not match' - ); + $this->assertEquals('domain.com', $domain, '%s: the fetched domain did not match'); + $this->assertEquals('user', $user, '%s: the fetched user did not match'); } public function testGetDomainAndUsernameWithAtSymbol() @@ -131,12 +111,8 @@ public function testGetDomainAndUsernameWithAtSymbol() $login = $this->_getAuthenticator(); list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username)); - $this->assertEquals('DOMAIN', $domain, - '%s: the fetched domain did not match' - ); - $this->assertEquals('user', $user, - '%s: the fetched user did not match' - ); + $this->assertEquals('DOMAIN', $domain, '%s: the fetched domain did not match'); + $this->assertEquals('user', $user, '%s: the fetched user did not match'); } public function testGetDomainAndUsernameWithAtSymbolAndExtension() @@ -146,12 +122,19 @@ public function testGetDomainAndUsernameWithAtSymbolAndExtension() $login = $this->_getAuthenticator(); list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username)); - $this->assertEquals('domain.com', $domain, - '%s: the fetched domain did not match' - ); - $this->assertEquals('user', $user, - '%s: the fetched user did not match' - ); + $this->assertEquals('domain.com', $domain, '%s: the fetched domain did not match'); + $this->assertEquals('user', $user, '%s: the fetched user did not match'); + } + + public function testGetDomainAndUsernameWithoutDomain() + { + $username = 'user'; + + $login = $this->_getAuthenticator(); + list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username)); + + $this->assertEquals('', $domain, '%s: the fetched domain did not match'); + $this->assertEquals('user', $user, '%s: the fetched user did not match'); } public function testSuccessfulAuthentication() @@ -174,9 +157,7 @@ public function testSuccessfulAuthentication() $this->_invokePrivateMethod('createMessage3', $ntlm, array($domain, $username, $this->hex2bin('4d0045004d00420045005200'), $this->hex2bin('bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9'), $this->hex2bin('caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000')) ))."\r\n", array(235)); - $this->assertTrue($ntlm->authenticate($agent, $username.'@'.$domain, $secret, $this->hex2bin('30fa7e3c677bc301'), $this->hex2bin('f5ce3d2401c8f6e9')), - '%s: The buffer accepted all commands authentication should succeed' - ); + $this->assertTrue($ntlm->authenticate($agent, $username.'@'.$domain, $secret, $this->hex2bin('30fa7e3c677bc301'), $this->hex2bin('f5ce3d2401c8f6e9')), '%s: The buffer accepted all commands authentication should succeed'); } public function testAuthenticationFailureSendRsetAndReturnFalse() @@ -197,12 +178,9 @@ public function testAuthenticationFailureSendRsetAndReturnFalse() ->once() ->with("RSET\r\n", array(250)); - $this->assertFalse($ntlm->authenticate($agent, $username.'@'.$domain, $secret, $this->hex2bin('30fa7e3c677bc301'), $this->hex2bin('f5ce3d2401c8f6e9')), - '%s: Authentication fails, so RSET should be sent' - ); + $this->assertFalse($ntlm->authenticate($agent, $username.'@'.$domain, $secret, $this->hex2bin('30fa7e3c677bc301'), $this->hex2bin('f5ce3d2401c8f6e9')), '%s: Authentication fails, so RSET should be sent'); } - // -- Private helpers private function _getAuthenticator() { return new Swift_Transport_Esmtp_Auth_NTLMAuthenticator(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php index 4fe9db8..73a9062 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php @@ -4,7 +4,7 @@ class Swift_Transport_Esmtp_Auth_PlainAuthenticatorTest extends \SwiftMailerTest { private $_agent; - public function setUp() + protected function setUp() { $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing(); } @@ -60,8 +60,6 @@ public function testAuthenticationFailureSendRsetAndReturnFalse() ); } - // -- Private helpers - private function _getAuthenticator() { return new Swift_Transport_Esmtp_Auth_PlainAuthenticator(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php index 64327d4..d52328a 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php @@ -4,7 +4,7 @@ class Swift_Transport_Esmtp_AuthHandlerTest extends \SwiftMailerTestCase { private $_agent; - public function setUp() + protected function setUp() { $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing(); } @@ -148,8 +148,6 @@ public function testFirstAuthenticatorToPassBreaksChain() $auth->afterEhlo($this->_agent); } - // -- Private helpers - private function _createHandler($authenticators) { return new Swift_Transport_Esmtp_AuthHandler($authenticators); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php index 44e5413..166e160 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php @@ -1,16 +1,15 @@ shouldReceive('getPriorityOver') ->zeroOrMoreTimes() ->with('STARTTLS') - ->andReturn(0); + ->andReturn(1); $ext2->shouldReceive('getHandledKeyword') ->zeroOrMoreTimes() ->andReturn('STARTTLS'); @@ -142,7 +141,7 @@ public function testExtensionsCanModifyMailFromParams() { $buf = $this->_getBuffer(); $dispatcher = $this->_createEventDispatcher(); - $smtp = new EsmtpTransportFixture($buf, array(), $dispatcher); + $smtp = new Swift_Transport_EsmtpTransport($buf, array(), $dispatcher); $ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing(); $ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing(); $ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing(); @@ -228,7 +227,7 @@ public function testExtensionsCanModifyRcptParams() { $buf = $this->_getBuffer(); $dispatcher = $this->_createEventDispatcher(); - $smtp = new EsmtpTransportFixture($buf, array(), $dispatcher); + $smtp = new Swift_Transport_EsmtpTransport($buf, array(), $dispatcher); $ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing(); $ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing(); $ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php index 95a9ce2..e6cca15 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php @@ -1,7 +1,6 @@ registerPlugin($plugin); } - // -- Private helpers - private function _getTransport(array $transports) { $transport = new Swift_Transport_FailoverTransport(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php index 273f135..f6bb819 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php @@ -682,7 +682,7 @@ public function testFailureReferenceIsPassedToDelegates() $t1->shouldReceive('send') ->once() ->with($message, \Mockery::on(function (&$var) use (&$failures, $testCase) { - return $testCase->varsAreReferences($var, $failures); + return $testCase->varsAreReferences($var, $failures); })) ->andReturnUsing(function () use (&$connectionState) { if ($connectionState) { @@ -719,7 +719,7 @@ public function testRegisterPluginDelegatesToLoadedTransports() public function varsAreReferences(&$ref1, &$ref2) { if (is_object($ref2)) { - return ($ref1 === $ref2); + return $ref1 === $ref2; } if ($ref1 !== $ref2) { return false; @@ -734,8 +734,6 @@ public function varsAreReferences(&$ref1, &$ref2) return $isRef; } - // -- Private helpers - private function _getTransport(array $transports) { $transport = new Swift_Transport_LoadBalancedTransport(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php index d86d11a..6672a3d 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php @@ -1,5 +1,8 @@ _createTransport($invoker, $dispatcher); $headers = $this->_createHeaders(); - $message = $this->_createMessage($headers); + $message = $this->_createMessageWithRecipient($headers); $invoker->shouldReceive('mail') ->once(); @@ -27,7 +30,7 @@ public function testTransportUsesToFieldBodyInSending() $headers = $this->_createHeaders(array( 'To' => $to, )); - $message = $this->_createMessage($headers); + $message = $this->_createMessageWithRecipient($headers); $to->shouldReceive('getFieldBody') ->zeroOrMoreTimes() @@ -49,7 +52,7 @@ public function testTransportUsesSubjectFieldBodyInSending() $headers = $this->_createHeaders(array( 'Subject' => $subj, )); - $message = $this->_createMessage($headers); + $message = $this->_createMessageWithRecipient($headers); $subj->shouldReceive('getFieldBody') ->zeroOrMoreTimes() @@ -68,7 +71,7 @@ public function testTransportUsesBodyOfMessage() $transport = $this->_createTransport($invoker, $dispatcher); $headers = $this->_createHeaders(); - $message = $this->_createMessage($headers); + $message = $this->_createMessageWithRecipient($headers); $message->shouldReceive('toString') ->zeroOrMoreTimes() @@ -84,25 +87,154 @@ public function testTransportUsesBodyOfMessage() $transport->send($message); } - public function testTransportUsesHeadersFromMessage() + public function testTransportSettingUsingReturnPathForExtraParams() { $invoker = $this->_createInvoker(); $dispatcher = $this->_createEventDispatcher(); $transport = $this->_createTransport($invoker, $dispatcher); $headers = $this->_createHeaders(); - $message = $this->_createMessage($headers); + $message = $this->_createMessageWithRecipient($headers); - $message->shouldReceive('toString') + $message->shouldReceive('getReturnPath') ->zeroOrMoreTimes() ->andReturn( + 'foo@bar' + ); + $invoker->shouldReceive('mail') + ->once() + ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), '-ffoo@bar'); + + $transport->send($message); + } + + public function testTransportSettingEmptyExtraParams() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $headers = $this->_createHeaders(); + $message = $this->_createMessageWithRecipient($headers); + + $message->shouldReceive('getReturnPath') + ->zeroOrMoreTimes() + ->andReturn(null); + $message->shouldReceive('getSender') + ->zeroOrMoreTimes() + ->andReturn(null); + $message->shouldReceive('getFrom') + ->zeroOrMoreTimes() + ->andReturn(null); + $invoker->shouldReceive('mail') + ->once() + ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), null); + + $transport->send($message); + } + + public function testTransportSettingSettingExtraParamsWithF() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + $transport->setExtraParams('-x\'foo\' -f%s'); + + $headers = $this->_createHeaders(); + $message = $this->_createMessageWithRecipient($headers); + + $message->shouldReceive('getReturnPath') + ->zeroOrMoreTimes() + ->andReturn( + 'foo@bar' + ); + $message->shouldReceive('getSender') + ->zeroOrMoreTimes() + ->andReturn(null); + $message->shouldReceive('getFrom') + ->zeroOrMoreTimes() + ->andReturn(null); + $invoker->shouldReceive('mail') + ->once() + ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), '-x\'foo\' -ffoo@bar'); + + $transport->send($message); + } + + public function testTransportSettingSettingExtraParamsWithoutF() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + $transport->setExtraParams('-x\'foo\''); + + $headers = $this->_createHeaders(); + $message = $this->_createMessageWithRecipient($headers); + + $message->shouldReceive('getReturnPath') + ->zeroOrMoreTimes() + ->andReturn( + 'foo@bar' + ); + $message->shouldReceive('getSender') + ->zeroOrMoreTimes() + ->andReturn(null); + $message->shouldReceive('getFrom') + ->zeroOrMoreTimes() + ->andReturn(null); + $invoker->shouldReceive('mail') + ->once() + ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), '-x\'foo\''); + + $transport->send($message); + } + + public function testTransportSettingInvalidFromEmail() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $headers = $this->_createHeaders(); + $message = $this->_createMessageWithRecipient($headers); + + $message->shouldReceive('getReturnPath') + ->zeroOrMoreTimes() + ->andReturn( + '"attacker\" -oQ/tmp/ -X/var/www/cache/phpcode.php "@email.com' + ); + $message->shouldReceive('getSender') + ->zeroOrMoreTimes() + ->andReturn(null); + $message->shouldReceive('getFrom') + ->zeroOrMoreTimes() + ->andReturn(null); + $invoker->shouldReceive('mail') + ->once() + ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), null); + + $transport->send($message); + } + + public function testTransportUsesHeadersFromMessage() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $headers = $this->_createHeaders(); + $message = $this->_createMessageWithRecipient($headers); + + $message->shouldReceive('toString') + ->zeroOrMoreTimes() + ->andReturn( "Subject: Stuff\r\n". "\r\n". 'This body' - ); + ); $invoker->shouldReceive('mail') - ->once() - ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), 'Subject: Stuff'.PHP_EOL, \Mockery::any()); + ->once() + ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), 'Subject: Stuff'.PHP_EOL, \Mockery::any()); $transport->send($message); } @@ -163,7 +295,7 @@ public function testToHeaderIsRemovedFromHeaderSetDuringSending() $headers = $this->_createHeaders(array( 'To' => $to, )); - $message = $this->_createMessage($headers); + $message = $this->_createMessageWithRecipient($headers); $headers->shouldReceive('remove') ->once() @@ -187,7 +319,7 @@ public function testSubjectHeaderIsRemovedFromHeaderSetDuringSending() $headers = $this->_createHeaders(array( 'Subject' => $subject, )); - $message = $this->_createMessage($headers); + $message = $this->_createMessageWithRecipient($headers); $headers->shouldReceive('remove') ->once() @@ -211,7 +343,7 @@ public function testToHeaderIsPutBackAfterSending() $headers = $this->_createHeaders(array( 'To' => $to, )); - $message = $this->_createMessage($headers); + $message = $this->_createMessageWithRecipient($headers); $headers->shouldReceive('set') ->once() @@ -235,7 +367,7 @@ public function testSubjectHeaderIsPutBackAfterSending() $headers = $this->_createHeaders(array( 'Subject' => $subject, )); - $message = $this->_createMessage($headers); + $message = $this->_createMessageWithRecipient($headers); $headers->shouldReceive('set') ->once() @@ -249,7 +381,89 @@ public function testSubjectHeaderIsPutBackAfterSending() $transport->send($message); } - // -- Creation Methods + public function testMessageHeadersOnlyHavePHPEolsDuringSending() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $subject = $this->_createHeader(); + $subject->shouldReceive('getFieldBody')->andReturn("Foo\r\nBar"); + + $headers = $this->_createHeaders(array( + 'Subject' => $subject, + )); + $message = $this->_createMessageWithRecipient($headers); + $message->shouldReceive('toString') + ->zeroOrMoreTimes() + ->andReturn( + "From: Foo\r\n\r\n". + "\r\n". + "This\r\n". + 'body' + ); + + if ("\r\n" != PHP_EOL) { + $expectedHeaders = "From: Foo\n\n"; + $expectedSubject = "Foo\nBar"; + $expectedBody = "This\nbody"; + } else { + $expectedHeaders = "From: Foo\r\n\r\n"; + $expectedSubject = "Foo\r\nBar"; + $expectedBody = "This\r\nbody"; + } + + $invoker->shouldReceive('mail') + ->once() + ->with(\Mockery::any(), $expectedSubject, $expectedBody, $expectedHeaders, \Mockery::any()); + + $transport->send($message); + } + + /** + * @expectedException \Swift_TransportException + * @expectedExceptionMessage Cannot send message without a recipient + */ + public function testExceptionWhenNoRecipients() + { + $invoker = $this->_createInvoker(); + $invoker->shouldReceive('mail'); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $headers = $this->_createHeaders(); + $message = $this->_createMessage($headers); + + $transport->send($message); + } + + public function noExceptionWhenRecipientsExistProvider() + { + return array( + array('To'), + array('Cc'), + array('Bcc'), + ); + } + + /** + * @dataProvider noExceptionWhenRecipientsExistProvider + * + * @param string $header + */ + public function testNoExceptionWhenRecipientsExist($header) + { + $invoker = $this->_createInvoker(); + $invoker->shouldReceive('mail'); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $headers = $this->_createHeaders(); + $message = $this->_createMessage($headers); + $message->shouldReceive(sprintf('get%s', $header))->andReturn(array('foo@bar' => 'Foo')); + + $transport->send($message); + } private function _createTransport($invoker, $dispatcher) { @@ -276,6 +490,14 @@ private function _createMessage($headers) return $message; } + private function _createMessageWithRecipient($headers, $recipient = array('foo@bar' => 'Foo')) + { + $message = $this->_createMessage($headers); + $message->shouldReceive('getTo')->andReturn($recipient); + + return $message; + } + private function _createHeaders($headers = array()) { $set = $this->getMockery('Swift_Mime_HeaderSet')->shouldIgnoreMissing(); diff --git a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php index c704c3c..9040f9e 100644 --- a/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php +++ b/application/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php @@ -1,7 +1,6 @@ setWriteTranslations(array('x' => 'y', 'a' => 'b')); } - // -- Creation methods - private function _createBuffer($replacementFactory) { return new Swift_Transport_StreamBuffer($replacementFactory); @@ -35,11 +33,11 @@ private function _createBuffer($replacementFactory) private function _createFactory() { - return $this->getMock('Swift_ReplacementFilterFactory'); + return $this->getMockBuilder('Swift_ReplacementFilterFactory')->getMock(); } public function _createFilter() { - return $this->getMock('Swift_StreamFilter'); + return $this->getMockBuilder('Swift_StreamFilter')->getMock(); } } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/.gitignore b/application/vendor/symfony/console/.gitignore similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/.gitignore rename to application/vendor/symfony/console/.gitignore diff --git a/application/vendor/symfony/console/Application.php b/application/vendor/symfony/console/Application.php new file mode 100644 index 0000000..5ad89c1 --- /dev/null +++ b/application/vendor/symfony/console/Application.php @@ -0,0 +1,1145 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console; + +use Symfony\Component\Console\Descriptor\TextDescriptor; +use Symfony\Component\Console\Descriptor\XmlDescriptor; +use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Helper\DebugFormatterHelper; +use Symfony\Component\Console\Helper\Helper; +use Symfony\Component\Console\Helper\ProcessHelper; +use Symfony\Component\Console\Helper\QuestionHelper; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\ArgvInput; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Input\InputDefinition; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputAwareInterface; +use Symfony\Component\Console\Output\BufferedOutput; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\Console\Output\ConsoleOutputInterface; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Command\HelpCommand; +use Symfony\Component\Console\Command\ListCommand; +use Symfony\Component\Console\Helper\HelperSet; +use Symfony\Component\Console\Helper\FormatterHelper; +use Symfony\Component\Console\Helper\DialogHelper; +use Symfony\Component\Console\Helper\ProgressHelper; +use Symfony\Component\Console\Helper\TableHelper; +use Symfony\Component\Console\Event\ConsoleCommandEvent; +use Symfony\Component\Console\Event\ConsoleExceptionEvent; +use Symfony\Component\Console\Event\ConsoleTerminateEvent; +use Symfony\Component\Debug\Exception\FatalThrowableError; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; + +/** + * An Application is the container for a collection of commands. + * + * It is the main entry point of a Console application. + * + * This class is optimized for a standard CLI environment. + * + * Usage: + * + * $app = new Application('myapp', '1.0 (stable)'); + * $app->add(new SimpleCommand()); + * $app->run(); + * + * @author Fabien Potencier + */ +class Application +{ + private $commands = array(); + private $wantHelps = false; + private $runningCommand; + private $name; + private $version; + private $catchExceptions = true; + private $autoExit = true; + private $definition; + private $helperSet; + private $dispatcher; + private $terminalDimensions; + private $defaultCommand; + private $initialized; + + /** + * @param string $name The name of the application + * @param string $version The version of the application + */ + public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN') + { + $this->name = $name; + $this->version = $version; + $this->defaultCommand = 'list'; + } + + public function setDispatcher(EventDispatcherInterface $dispatcher) + { + $this->dispatcher = $dispatcher; + } + + /** + * Runs the current application. + * + * @return int 0 if everything went fine, or an error code + * + * @throws \Exception When running fails. Bypass this when {@link setCatchExceptions()}. + */ + public function run(InputInterface $input = null, OutputInterface $output = null) + { + if (null === $input) { + $input = new ArgvInput(); + } + + if (null === $output) { + $output = new ConsoleOutput(); + } + + $this->configureIO($input, $output); + + try { + $e = null; + $exitCode = $this->doRun($input, $output); + } catch (\Exception $e) { + } + + if (null !== $e) { + if (!$this->catchExceptions) { + throw $e; + } + + if ($output instanceof ConsoleOutputInterface) { + $this->renderException($e, $output->getErrorOutput()); + } else { + $this->renderException($e, $output); + } + + $exitCode = $e->getCode(); + if (is_numeric($exitCode)) { + $exitCode = (int) $exitCode; + if (0 === $exitCode) { + $exitCode = 1; + } + } else { + $exitCode = 1; + } + } + + if ($this->autoExit) { + if ($exitCode > 255) { + $exitCode = 255; + } + + exit($exitCode); + } + + return $exitCode; + } + + /** + * Runs the current application. + * + * @return int 0 if everything went fine, or an error code + */ + public function doRun(InputInterface $input, OutputInterface $output) + { + if (true === $input->hasParameterOption(array('--version', '-V'))) { + $output->writeln($this->getLongVersion()); + + return 0; + } + + $name = $this->getCommandName($input); + if (true === $input->hasParameterOption(array('--help', '-h'))) { + if (!$name) { + $name = 'help'; + $input = new ArrayInput(array('command' => 'help')); + } else { + $this->wantHelps = true; + } + } + + if (!$name) { + $name = $this->defaultCommand; + $definition = $this->getDefinition(); + $definition->setArguments(array_merge( + $definition->getArguments(), + array( + 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name), + ) + )); + } + + $this->runningCommand = null; + // the command name MUST be the first element of the input + $command = $this->find($name); + + $this->runningCommand = $command; + $exitCode = $this->doRunCommand($command, $input, $output); + $this->runningCommand = null; + + return $exitCode; + } + + public function setHelperSet(HelperSet $helperSet) + { + $this->helperSet = $helperSet; + } + + /** + * Get the helper set associated with the command. + * + * @return HelperSet The HelperSet instance associated with this command + */ + public function getHelperSet() + { + if (!$this->helperSet) { + $this->helperSet = $this->getDefaultHelperSet(); + } + + return $this->helperSet; + } + + public function setDefinition(InputDefinition $definition) + { + $this->definition = $definition; + } + + /** + * Gets the InputDefinition related to this Application. + * + * @return InputDefinition The InputDefinition instance + */ + public function getDefinition() + { + if (!$this->definition) { + $this->definition = $this->getDefaultInputDefinition(); + } + + return $this->definition; + } + + /** + * Gets the help message. + * + * @return string A help message + */ + public function getHelp() + { + return $this->getLongVersion(); + } + + /** + * Sets whether to catch exceptions or not during commands execution. + * + * @param bool $boolean Whether to catch exceptions or not during commands execution + */ + public function setCatchExceptions($boolean) + { + $this->catchExceptions = (bool) $boolean; + } + + /** + * Sets whether to automatically exit after a command execution or not. + * + * @param bool $boolean Whether to automatically exit after a command execution or not + */ + public function setAutoExit($boolean) + { + $this->autoExit = (bool) $boolean; + } + + /** + * Gets the name of the application. + * + * @return string The application name + */ + public function getName() + { + return $this->name; + } + + /** + * Sets the application name. + * + * @param string $name The application name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Gets the application version. + * + * @return string The application version + */ + public function getVersion() + { + return $this->version; + } + + /** + * Sets the application version. + * + * @param string $version The application version + */ + public function setVersion($version) + { + $this->version = $version; + } + + /** + * Returns the long version of the application. + * + * @return string The long application version + */ + public function getLongVersion() + { + if ('UNKNOWN' !== $this->getName()) { + if ('UNKNOWN' !== $this->getVersion()) { + return sprintf('%s version %s', $this->getName(), $this->getVersion()); + } + + return sprintf('%s', $this->getName()); + } + + return 'Console Tool'; + } + + /** + * Registers a new command. + * + * @param string $name The command name + * + * @return Command The newly created command + */ + public function register($name) + { + return $this->add(new Command($name)); + } + + /** + * Adds an array of command objects. + * + * If a Command is not enabled it will not be added. + * + * @param Command[] $commands An array of commands + */ + public function addCommands(array $commands) + { + foreach ($commands as $command) { + $this->add($command); + } + } + + /** + * Adds a command object. + * + * If a command with the same name already exists, it will be overridden. + * If the command is not enabled it will not be added. + * + * @return Command|null The registered command if enabled or null + */ + public function add(Command $command) + { + $this->init(); + + $command->setApplication($this); + + if (!$command->isEnabled()) { + $command->setApplication(null); + + return; + } + + if (null === $command->getDefinition()) { + throw new \LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command))); + } + + $this->commands[$command->getName()] = $command; + + foreach ($command->getAliases() as $alias) { + $this->commands[$alias] = $command; + } + + return $command; + } + + /** + * Returns a registered command by name or alias. + * + * @param string $name The command name or alias + * + * @return Command A Command object + * + * @throws \InvalidArgumentException When given command name does not exist + */ + public function get($name) + { + $this->init(); + + if (!isset($this->commands[$name])) { + throw new \InvalidArgumentException(sprintf('The command "%s" does not exist.', $name)); + } + + $command = $this->commands[$name]; + + if ($this->wantHelps) { + $this->wantHelps = false; + + $helpCommand = $this->get('help'); + $helpCommand->setCommand($command); + + return $helpCommand; + } + + return $command; + } + + /** + * Returns true if the command exists, false otherwise. + * + * @param string $name The command name or alias + * + * @return bool true if the command exists, false otherwise + */ + public function has($name) + { + $this->init(); + + return isset($this->commands[$name]); + } + + /** + * Returns an array of all unique namespaces used by currently registered commands. + * + * It does not return the global namespace which always exists. + * + * @return string[] An array of namespaces + */ + public function getNamespaces() + { + $namespaces = array(); + foreach ($this->all() as $command) { + $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName())); + + foreach ($command->getAliases() as $alias) { + $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias)); + } + } + + return array_values(array_unique(array_filter($namespaces))); + } + + /** + * Finds a registered namespace by a name or an abbreviation. + * + * @param string $namespace A namespace or abbreviation to search for + * + * @return string A registered namespace + * + * @throws \InvalidArgumentException When namespace is incorrect or ambiguous + */ + public function findNamespace($namespace) + { + $allNamespaces = $this->getNamespaces(); + $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace); + $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces); + + if (empty($namespaces)) { + $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); + + if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) { + if (1 == count($alternatives)) { + $message .= "\n\nDid you mean this?\n "; + } else { + $message .= "\n\nDid you mean one of these?\n "; + } + + $message .= implode("\n ", $alternatives); + } + + throw new \InvalidArgumentException($message); + } + + $exact = in_array($namespace, $namespaces, true); + if (count($namespaces) > 1 && !$exact) { + throw new \InvalidArgumentException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces)))); + } + + return $exact ? $namespace : reset($namespaces); + } + + /** + * Finds a command by name or alias. + * + * Contrary to get, this command tries to find the best + * match if you give it an abbreviation of a name or alias. + * + * @param string $name A command name or a command alias + * + * @return Command A Command instance + * + * @throws \InvalidArgumentException When command name is incorrect or ambiguous + */ + public function find($name) + { + $this->init(); + $aliases = array(); + $allCommands = array_keys($this->commands); + $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name); + $commands = preg_grep('{^'.$expr.'}', $allCommands); + + if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) { + if (false !== $pos = strrpos($name, ':')) { + // check if a namespace exists and contains commands + $this->findNamespace(substr($name, 0, $pos)); + } + + $message = sprintf('Command "%s" is not defined.', $name); + + if ($alternatives = $this->findAlternatives($name, $allCommands)) { + if (1 == count($alternatives)) { + $message .= "\n\nDid you mean this?\n "; + } else { + $message .= "\n\nDid you mean one of these?\n "; + } + $message .= implode("\n ", $alternatives); + } + + throw new \InvalidArgumentException($message); + } + + // filter out aliases for commands which are already on the list + if (count($commands) > 1) { + $commandList = $this->commands; + $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) { + $commandName = $commandList[$nameOrAlias]->getName(); + $aliases[$nameOrAlias] = $commandName; + + return $commandName === $nameOrAlias || !in_array($commandName, $commands); + }); + } + + $exact = in_array($name, $commands, true) || isset($aliases[$name]); + if (!$exact && count($commands) > 1) { + $suggestions = $this->getAbbreviationSuggestions(array_values($commands)); + + throw new \InvalidArgumentException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions)); + } + + return $this->get($exact ? $name : reset($commands)); + } + + /** + * Gets the commands (registered in the given namespace if provided). + * + * The array keys are the full names and the values the command instances. + * + * @param string $namespace A namespace name + * + * @return Command[] An array of Command instances + */ + public function all($namespace = null) + { + $this->init(); + + if (null === $namespace) { + return $this->commands; + } + + $commands = array(); + foreach ($this->commands as $name => $command) { + if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) { + $commands[$name] = $command; + } + } + + return $commands; + } + + /** + * Returns an array of possible abbreviations given a set of names. + * + * @param array $names An array of names + * + * @return array An array of abbreviations + */ + public static function getAbbreviations($names) + { + $abbrevs = array(); + foreach ($names as $name) { + for ($len = strlen($name); $len > 0; --$len) { + $abbrev = substr($name, 0, $len); + $abbrevs[$abbrev][] = $name; + } + } + + return $abbrevs; + } + + /** + * Returns a text representation of the Application. + * + * @param string $namespace An optional namespace name + * @param bool $raw Whether to return raw command list + * + * @return string A string representing the Application + * + * @deprecated since version 2.3, to be removed in 3.0. + */ + public function asText($namespace = null, $raw = false) + { + @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED); + + $descriptor = new TextDescriptor(); + $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw); + $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true)); + + return $output->fetch(); + } + + /** + * Returns an XML representation of the Application. + * + * @param string $namespace An optional namespace name + * @param bool $asDom Whether to return a DOM or an XML string + * + * @return string|\DOMDocument An XML string representing the Application + * + * @deprecated since version 2.3, to be removed in 3.0. + */ + public function asXml($namespace = null, $asDom = false) + { + @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED); + + $descriptor = new XmlDescriptor(); + + if ($asDom) { + return $descriptor->getApplicationDocument($this, $namespace); + } + + $output = new BufferedOutput(); + $descriptor->describe($output, $this, array('namespace' => $namespace)); + + return $output->fetch(); + } + + /** + * Renders a caught exception. + */ + public function renderException($e, $output) + { + $output->writeln(''); + + do { + $title = sprintf(' [%s] ', get_class($e)); + + $len = Helper::strlen($title); + + $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX; + // HHVM only accepts 32 bits integer in str_split, even when PHP_INT_MAX is a 64 bit integer: https://github.com/facebook/hhvm/issues/1327 + if (defined('HHVM_VERSION') && $width > 1 << 31) { + $width = 1 << 31; + } + $lines = array(); + foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) { + foreach ($this->splitStringByWidth($line, $width - 4) as $line) { + // pre-format lines to get the right string length + $lineLength = Helper::strlen($line) + 4; + $lines[] = array($line, $lineLength); + + $len = max($lineLength, $len); + } + } + + $messages = array(); + $messages[] = $emptyLine = sprintf('%s', str_repeat(' ', $len)); + $messages[] = sprintf('%s%s', $title, str_repeat(' ', max(0, $len - Helper::strlen($title)))); + foreach ($lines as $line) { + $messages[] = sprintf(' %s %s', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1])); + } + $messages[] = $emptyLine; + $messages[] = ''; + + $output->writeln($messages); + + if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { + $output->writeln('Exception trace:'); + + // exception related properties + $trace = $e->getTrace(); + array_unshift($trace, array( + 'function' => '', + 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a', + 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a', + 'args' => array(), + )); + + for ($i = 0, $count = count($trace); $i < $count; ++$i) { + $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : ''; + $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : ''; + $function = $trace[$i]['function']; + $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a'; + $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a'; + + $output->writeln(sprintf(' %s%s%s() at %s:%s', $class, $type, $function, $file, $line)); + } + + $output->writeln(''); + } + } while ($e = $e->getPrevious()); + + if (null !== $this->runningCommand) { + $output->writeln(sprintf('%s', sprintf($this->runningCommand->getSynopsis(), $this->getName()))); + $output->writeln(''); + } + } + + /** + * Tries to figure out the terminal width in which this application runs. + * + * @return int|null + */ + protected function getTerminalWidth() + { + $dimensions = $this->getTerminalDimensions(); + + return $dimensions[0]; + } + + /** + * Tries to figure out the terminal height in which this application runs. + * + * @return int|null + */ + protected function getTerminalHeight() + { + $dimensions = $this->getTerminalDimensions(); + + return $dimensions[1]; + } + + /** + * Tries to figure out the terminal dimensions based on the current environment. + * + * @return array Array containing width and height + */ + public function getTerminalDimensions() + { + if ($this->terminalDimensions) { + return $this->terminalDimensions; + } + + if ('\\' === DIRECTORY_SEPARATOR) { + // extract [w, H] from "wxh (WxH)" + if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) { + return array((int) $matches[1], (int) $matches[2]); + } + // extract [w, h] from "wxh" + if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) { + return array((int) $matches[1], (int) $matches[2]); + } + } + + if ($sttyString = $this->getSttyColumns()) { + // extract [w, h] from "rows h; columns w;" + if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) { + return array((int) $matches[2], (int) $matches[1]); + } + // extract [w, h] from "; h rows; w columns" + if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) { + return array((int) $matches[2], (int) $matches[1]); + } + } + + return array(null, null); + } + + /** + * Sets terminal dimensions. + * + * Can be useful to force terminal dimensions for functional tests. + * + * @param int $width The width + * @param int $height The height + * + * @return $this + */ + public function setTerminalDimensions($width, $height) + { + $this->terminalDimensions = array($width, $height); + + return $this; + } + + /** + * Configures the input and output instances based on the user arguments and options. + */ + protected function configureIO(InputInterface $input, OutputInterface $output) + { + if (true === $input->hasParameterOption(array('--ansi'))) { + $output->setDecorated(true); + } elseif (true === $input->hasParameterOption(array('--no-ansi'))) { + $output->setDecorated(false); + } + + if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) { + $input->setInteractive(false); + } elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('question')) { + $inputStream = $this->getHelperSet()->get('question')->getInputStream(); + if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) { + $input->setInteractive(false); + } + } + + if (true === $input->hasParameterOption(array('--quiet', '-q'))) { + $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); + $input->setInteractive(false); + } else { + if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) { + $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG); + } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) { + $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); + } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) { + $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); + } + } + } + + /** + * Runs the current command. + * + * If an event dispatcher has been attached to the application, + * events are also dispatched during the life-cycle of the command. + * + * @return int 0 if everything went fine, or an error code + */ + protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output) + { + foreach ($command->getHelperSet() as $helper) { + if ($helper instanceof InputAwareInterface) { + $helper->setInput($input); + } + } + + if (null === $this->dispatcher) { + return $command->run($input, $output); + } + + $event = new ConsoleCommandEvent($command, $input, $output); + $e = null; + + try { + $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event); + + if ($event->commandShouldRun()) { + $exitCode = $command->run($input, $output); + } else { + $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED; + } + } catch (\Exception $e) { + } catch (\Throwable $e) { + } + if (null !== $e) { + $x = $e instanceof \Exception ? $e : new FatalThrowableError($e); + $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode()); + $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event); + + if ($x !== $event->getException()) { + $e = $event->getException(); + } + $exitCode = $e->getCode(); + } + + $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode); + $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event); + + if (null !== $e) { + throw $e; + } + + return $event->getExitCode(); + } + + /** + * Gets the name of the command based on input. + * + * @return string The command name + */ + protected function getCommandName(InputInterface $input) + { + return $input->getFirstArgument(); + } + + /** + * Gets the default input definition. + * + * @return InputDefinition An InputDefinition instance + */ + protected function getDefaultInputDefinition() + { + return new InputDefinition(array( + new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), + + new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'), + new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'), + new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'), + new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'), + new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'), + new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'), + new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'), + )); + } + + /** + * Gets the default commands that should always be available. + * + * @return Command[] An array of default Command instances + */ + protected function getDefaultCommands() + { + return array(new HelpCommand(), new ListCommand()); + } + + /** + * Gets the default helper set with the helpers that should always be available. + * + * @return HelperSet A HelperSet instance + */ + protected function getDefaultHelperSet() + { + return new HelperSet(array( + new FormatterHelper(), + new DialogHelper(false), + new ProgressHelper(false), + new TableHelper(false), + new DebugFormatterHelper(), + new ProcessHelper(), + new QuestionHelper(), + )); + } + + /** + * Runs and parses stty -a if it's available, suppressing any error output. + * + * @return string + */ + private function getSttyColumns() + { + if (!function_exists('proc_open')) { + return; + } + + $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w')); + $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true)); + if (is_resource($process)) { + $info = stream_get_contents($pipes[1]); + fclose($pipes[1]); + fclose($pipes[2]); + proc_close($process); + + return $info; + } + } + + /** + * Runs and parses mode CON if it's available, suppressing any error output. + * + * @return string|null x or null if it could not be parsed + */ + private function getConsoleMode() + { + if (!function_exists('proc_open')) { + return; + } + + $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w')); + $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true)); + if (is_resource($process)) { + $info = stream_get_contents($pipes[1]); + fclose($pipes[1]); + fclose($pipes[2]); + proc_close($process); + + if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { + return $matches[2].'x'.$matches[1]; + } + } + } + + /** + * Returns abbreviated suggestions in string format. + * + * @param array $abbrevs Abbreviated suggestions to convert + * + * @return string A formatted string of abbreviated suggestions + */ + private function getAbbreviationSuggestions($abbrevs) + { + return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : ''); + } + + /** + * Returns the namespace part of the command name. + * + * This method is not part of public API and should not be used directly. + * + * @param string $name The full name of the command + * @param string $limit The maximum number of parts of the namespace + * + * @return string The namespace of the command + */ + public function extractNamespace($name, $limit = null) + { + $parts = explode(':', $name); + array_pop($parts); + + return implode(':', null === $limit ? $parts : array_slice($parts, 0, $limit)); + } + + /** + * Finds alternative of $name among $collection, + * if nothing is found in $collection, try in $abbrevs. + * + * @param string $name The string + * @param iterable $collection The collection + * + * @return string[] A sorted array of similar string + */ + private function findAlternatives($name, $collection) + { + $threshold = 1e3; + $alternatives = array(); + + $collectionParts = array(); + foreach ($collection as $item) { + $collectionParts[$item] = explode(':', $item); + } + + foreach (explode(':', $name) as $i => $subname) { + foreach ($collectionParts as $collectionName => $parts) { + $exists = isset($alternatives[$collectionName]); + if (!isset($parts[$i]) && $exists) { + $alternatives[$collectionName] += $threshold; + continue; + } elseif (!isset($parts[$i])) { + continue; + } + + $lev = levenshtein($subname, $parts[$i]); + if ($lev <= strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) { + $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev; + } elseif ($exists) { + $alternatives[$collectionName] += $threshold; + } + } + } + + foreach ($collection as $item) { + $lev = levenshtein($name, $item); + if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) { + $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev; + } + } + + $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; }); + asort($alternatives); + + return array_keys($alternatives); + } + + /** + * Sets the default Command name. + * + * @param string $commandName The Command name + */ + public function setDefaultCommand($commandName) + { + $this->defaultCommand = $commandName; + } + + private function splitStringByWidth($string, $width) + { + // str_split is not suitable for multi-byte characters, we should use preg_split to get char array properly. + // additionally, array_slice() is not enough as some character has doubled width. + // we need a function to split string not by character count but by string width + + if (!function_exists('mb_strwidth')) { + return str_split($string, $width); + } + + if (false === $encoding = mb_detect_encoding($string, null, true)) { + return str_split($string, $width); + } + + $utf8String = mb_convert_encoding($string, 'utf8', $encoding); + $lines = array(); + $line = ''; + foreach (preg_split('//u', $utf8String) as $char) { + // test if $char could be appended to current line + if (mb_strwidth($line.$char, 'utf8') <= $width) { + $line .= $char; + continue; + } + // if not, push current line to array and make new line + $lines[] = str_pad($line, $width); + $line = $char; + } + + $lines[] = count($lines) ? str_pad($line, $width) : $line; + + mb_convert_variables($encoding, 'utf8', $lines); + + return $lines; + } + + /** + * Returns all namespaces of the command name. + * + * @param string $name The full name of the command + * + * @return string[] The namespaces of the command + */ + private function extractAllNamespaces($name) + { + // -1 as third argument is needed to skip the command short name when exploding + $parts = explode(':', $name, -1); + $namespaces = array(); + + foreach ($parts as $part) { + if (count($namespaces)) { + $namespaces[] = end($namespaces).':'.$part; + } else { + $namespaces[] = $part; + } + } + + return $namespaces; + } + + private function init() + { + if ($this->initialized) { + return; + } + $this->initialized = true; + + foreach ($this->getDefaultCommands() as $command) { + $this->add($command); + } + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/CHANGELOG.md b/application/vendor/symfony/console/CHANGELOG.md similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/CHANGELOG.md rename to application/vendor/symfony/console/CHANGELOG.md diff --git a/application/vendor/symfony/console/Command/Command.php b/application/vendor/symfony/console/Command/Command.php new file mode 100644 index 0000000..3fe12e8 --- /dev/null +++ b/application/vendor/symfony/console/Command/Command.php @@ -0,0 +1,655 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Command; + +use Symfony\Component\Console\Descriptor\TextDescriptor; +use Symfony\Component\Console\Descriptor\XmlDescriptor; +use Symfony\Component\Console\Input\InputDefinition; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\BufferedOutput; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Helper\HelperSet; + +/** + * Base class for all commands. + * + * @author Fabien Potencier + */ +class Command +{ + private $application; + private $name; + private $processTitle; + private $aliases = array(); + private $definition; + private $help; + private $description; + private $ignoreValidationErrors = false; + private $applicationDefinitionMerged = false; + private $applicationDefinitionMergedWithArgs = false; + private $code; + private $synopsis = array(); + private $usages = array(); + private $helperSet; + + /** + * @param string|null $name The name of the command; passing null means it must be set in configure() + * + * @throws \LogicException When the command name is empty + */ + public function __construct($name = null) + { + $this->definition = new InputDefinition(); + + if (null !== $name) { + $this->setName($name); + } + + $this->configure(); + + if (!$this->name) { + throw new \LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this))); + } + } + + /** + * Ignores validation errors. + * + * This is mainly useful for the help command. + */ + public function ignoreValidationErrors() + { + $this->ignoreValidationErrors = true; + } + + public function setApplication(Application $application = null) + { + $this->application = $application; + if ($application) { + $this->setHelperSet($application->getHelperSet()); + } else { + $this->helperSet = null; + } + } + + public function setHelperSet(HelperSet $helperSet) + { + $this->helperSet = $helperSet; + } + + /** + * Gets the helper set. + * + * @return HelperSet A HelperSet instance + */ + public function getHelperSet() + { + return $this->helperSet; + } + + /** + * Gets the application instance for this command. + * + * @return Application An Application instance + */ + public function getApplication() + { + return $this->application; + } + + /** + * Checks whether the command is enabled or not in the current environment. + * + * Override this to check for x or y and return false if the command can not + * run properly under the current conditions. + * + * @return bool + */ + public function isEnabled() + { + return true; + } + + /** + * Configures the current command. + */ + protected function configure() + { + } + + /** + * Executes the current command. + * + * This method is not abstract because you can use this class + * as a concrete class. In this case, instead of defining the + * execute() method, you set the code to execute by passing + * a Closure to the setCode() method. + * + * @return null|int null or 0 if everything went fine, or an error code + * + * @throws \LogicException When this abstract method is not implemented + * + * @see setCode() + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + throw new \LogicException('You must override the execute() method in the concrete command class.'); + } + + /** + * Interacts with the user. + * + * This method is executed before the InputDefinition is validated. + * This means that this is the only place where the command can + * interactively ask for values of missing required arguments. + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + } + + /** + * Initializes the command just after the input has been validated. + * + * This is mainly useful when a lot of commands extends one main command + * where some things need to be initialized based on the input arguments and options. + */ + protected function initialize(InputInterface $input, OutputInterface $output) + { + } + + /** + * Runs the command. + * + * The code to execute is either defined directly with the + * setCode() method or by overriding the execute() method + * in a sub-class. + * + * @return int The command exit code + * + * @throws \Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. + * + * @see setCode() + * @see execute() + */ + public function run(InputInterface $input, OutputInterface $output) + { + // force the creation of the synopsis before the merge with the app definition + $this->getSynopsis(true); + $this->getSynopsis(false); + + // add the application arguments and options + $this->mergeApplicationDefinition(); + + // bind the input against the command specific arguments/options + try { + $input->bind($this->definition); + } catch (\Exception $e) { + if (!$this->ignoreValidationErrors) { + throw $e; + } + } + + $this->initialize($input, $output); + + if (null !== $this->processTitle) { + if (function_exists('cli_set_process_title')) { + if (!@cli_set_process_title($this->processTitle)) { + if ('Darwin' === PHP_OS) { + $output->writeln('Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.'); + } else { + cli_set_process_title($this->processTitle); + } + } + } elseif (function_exists('setproctitle')) { + setproctitle($this->processTitle); + } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) { + $output->writeln('Install the proctitle PECL to be able to change the process title.'); + } + } + + if ($input->isInteractive()) { + $this->interact($input, $output); + } + + // The command name argument is often omitted when a command is executed directly with its run() method. + // It would fail the validation if we didn't make sure the command argument is present, + // since it's required by the application. + if ($input->hasArgument('command') && null === $input->getArgument('command')) { + $input->setArgument('command', $this->getName()); + } + + $input->validate(); + + if ($this->code) { + $statusCode = call_user_func($this->code, $input, $output); + } else { + $statusCode = $this->execute($input, $output); + } + + return is_numeric($statusCode) ? (int) $statusCode : 0; + } + + /** + * Sets the code to execute when running this command. + * + * If this method is used, it overrides the code defined + * in the execute() method. + * + * @param callable $code A callable(InputInterface $input, OutputInterface $output) + * + * @return $this + * + * @throws \InvalidArgumentException + * + * @see execute() + */ + public function setCode($code) + { + if (!is_callable($code)) { + throw new \InvalidArgumentException('Invalid callable provided to Command::setCode.'); + } + + $this->code = $code; + + return $this; + } + + /** + * Merges the application definition with the command definition. + * + * This method is not part of public API and should not be used directly. + * + * @param bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments + */ + public function mergeApplicationDefinition($mergeArgs = true) + { + if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) { + return; + } + + $this->definition->addOptions($this->application->getDefinition()->getOptions()); + + if ($mergeArgs) { + $currentArguments = $this->definition->getArguments(); + $this->definition->setArguments($this->application->getDefinition()->getArguments()); + $this->definition->addArguments($currentArguments); + } + + $this->applicationDefinitionMerged = true; + if ($mergeArgs) { + $this->applicationDefinitionMergedWithArgs = true; + } + } + + /** + * Sets an array of argument and option instances. + * + * @param array|InputDefinition $definition An array of argument and option instances or a definition instance + * + * @return $this + */ + public function setDefinition($definition) + { + if ($definition instanceof InputDefinition) { + $this->definition = $definition; + } else { + $this->definition->setDefinition($definition); + } + + $this->applicationDefinitionMerged = false; + + return $this; + } + + /** + * Gets the InputDefinition attached to this Command. + * + * @return InputDefinition An InputDefinition instance + */ + public function getDefinition() + { + return $this->definition; + } + + /** + * Gets the InputDefinition to be used to create XML and Text representations of this Command. + * + * Can be overridden to provide the original command representation when it would otherwise + * be changed by merging with the application InputDefinition. + * + * This method is not part of public API and should not be used directly. + * + * @return InputDefinition An InputDefinition instance + */ + public function getNativeDefinition() + { + return $this->getDefinition(); + } + + /** + * Adds an argument. + * + * @param string $name The argument name + * @param int $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL + * @param string $description A description text + * @param mixed $default The default value (for InputArgument::OPTIONAL mode only) + * + * @return $this + */ + public function addArgument($name, $mode = null, $description = '', $default = null) + { + $this->definition->addArgument(new InputArgument($name, $mode, $description, $default)); + + return $this; + } + + /** + * Adds an option. + * + * @param string $name The option name + * @param string $shortcut The shortcut (can be null) + * @param int $mode The option mode: One of the InputOption::VALUE_* constants + * @param string $description A description text + * @param mixed $default The default value (must be null for InputOption::VALUE_NONE) + * + * @return $this + */ + public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null) + { + $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default)); + + return $this; + } + + /** + * Sets the name of the command. + * + * This method can set both the namespace and the name if + * you separate them by a colon (:) + * + * $command->setName('foo:bar'); + * + * @param string $name The command name + * + * @return $this + * + * @throws \InvalidArgumentException When the name is invalid + */ + public function setName($name) + { + $this->validateName($name); + + $this->name = $name; + + return $this; + } + + /** + * Sets the process title of the command. + * + * This feature should be used only when creating a long process command, + * like a daemon. + * + * PHP 5.5+ or the proctitle PECL library is required + * + * @param string $title The process title + * + * @return $this + */ + public function setProcessTitle($title) + { + $this->processTitle = $title; + + return $this; + } + + /** + * Returns the command name. + * + * @return string The command name + */ + public function getName() + { + return $this->name; + } + + /** + * Sets the description for the command. + * + * @param string $description The description for the command + * + * @return $this + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Returns the description for the command. + * + * @return string The description for the command + */ + public function getDescription() + { + return $this->description; + } + + /** + * Sets the help for the command. + * + * @param string $help The help for the command + * + * @return $this + */ + public function setHelp($help) + { + $this->help = $help; + + return $this; + } + + /** + * Returns the help for the command. + * + * @return string The help for the command + */ + public function getHelp() + { + return $this->help; + } + + /** + * Returns the processed help for the command replacing the %command.name% and + * %command.full_name% patterns with the real values dynamically. + * + * @return string The processed help for the command + */ + public function getProcessedHelp() + { + $name = $this->name; + + $placeholders = array( + '%command.name%', + '%command.full_name%', + ); + $replacements = array( + $name, + $_SERVER['PHP_SELF'].' '.$name, + ); + + return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription()); + } + + /** + * Sets the aliases for the command. + * + * @param string[] $aliases An array of aliases for the command + * + * @return $this + * + * @throws \InvalidArgumentException When an alias is invalid + */ + public function setAliases($aliases) + { + if (!is_array($aliases) && !$aliases instanceof \Traversable) { + throw new \InvalidArgumentException('$aliases must be an array or an instance of \Traversable'); + } + + foreach ($aliases as $alias) { + $this->validateName($alias); + } + + $this->aliases = $aliases; + + return $this; + } + + /** + * Returns the aliases for the command. + * + * @return array An array of aliases for the command + */ + public function getAliases() + { + return $this->aliases; + } + + /** + * Returns the synopsis for the command. + * + * @param bool $short Whether to show the short version of the synopsis (with options folded) or not + * + * @return string The synopsis + */ + public function getSynopsis($short = false) + { + $key = $short ? 'short' : 'long'; + + if (!isset($this->synopsis[$key])) { + $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short))); + } + + return $this->synopsis[$key]; + } + + /** + * Add a command usage example. + * + * @param string $usage The usage, it'll be prefixed with the command name + * + * @return $this + */ + public function addUsage($usage) + { + if (0 !== strpos($usage, $this->name)) { + $usage = sprintf('%s %s', $this->name, $usage); + } + + $this->usages[] = $usage; + + return $this; + } + + /** + * Returns alternative usages of the command. + * + * @return array + */ + public function getUsages() + { + return $this->usages; + } + + /** + * Gets a helper instance by name. + * + * @param string $name The helper name + * + * @return mixed The helper value + * + * @throws \LogicException if no HelperSet is defined + * @throws \InvalidArgumentException if the helper is not defined + */ + public function getHelper($name) + { + if (null === $this->helperSet) { + throw new \LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name)); + } + + return $this->helperSet->get($name); + } + + /** + * Returns a text representation of the command. + * + * @return string A string representing the command + * + * @deprecated since version 2.3, to be removed in 3.0. + */ + public function asText() + { + @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED); + + $descriptor = new TextDescriptor(); + $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true); + $descriptor->describe($output, $this, array('raw_output' => true)); + + return $output->fetch(); + } + + /** + * Returns an XML representation of the command. + * + * @param bool $asDom Whether to return a DOM or an XML string + * + * @return string|\DOMDocument An XML string representing the command + * + * @deprecated since version 2.3, to be removed in 3.0. + */ + public function asXml($asDom = false) + { + @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED); + + $descriptor = new XmlDescriptor(); + + if ($asDom) { + return $descriptor->getCommandDocument($this); + } + + $output = new BufferedOutput(); + $descriptor->describe($output, $this); + + return $output->fetch(); + } + + /** + * Validates a command name. + * + * It must be non-empty and parts can optionally be separated by ":". + * + * @param string $name + * + * @throws \InvalidArgumentException When the name is invalid + */ + private function validateName($name) + { + if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) { + throw new \InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name)); + } + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Command/HelpCommand.php b/application/vendor/symfony/console/Command/HelpCommand.php similarity index 90% rename from application/vendor/symfony/console/Symfony/Component/Console/Command/HelpCommand.php rename to application/vendor/symfony/console/Command/HelpCommand.php index 4cf9362..27e23e1 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Command/HelpCommand.php +++ b/application/vendor/symfony/console/Command/HelpCommand.php @@ -38,11 +38,11 @@ protected function configure() ->setDefinition(array( new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'), new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'), - new InputOption('format', null, InputOption::VALUE_REQUIRED, 'To output help in other formats', 'txt'), + new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'), )) ->setDescription('Displays help for a command') - ->setHelp(<<setHelp(<<<'EOF' The %command.name% command displays help for a given command: php %command.full_name% list @@ -57,11 +57,6 @@ protected function configure() ; } - /** - * Sets the command. - * - * @param Command $command The command to set - */ public function setCommand(Command $command) { $this->command = $command; @@ -77,6 +72,8 @@ protected function execute(InputInterface $input, OutputInterface $output) } if ($input->getOption('xml')) { + @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED); + $input->setOption('format', 'xml'); } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Command/ListCommand.php b/application/vendor/symfony/console/Command/ListCommand.php similarity index 91% rename from application/vendor/symfony/console/Symfony/Component/Console/Command/ListCommand.php rename to application/vendor/symfony/console/Command/ListCommand.php index 58868e4..5e1b926 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Command/ListCommand.php +++ b/application/vendor/symfony/console/Command/ListCommand.php @@ -34,7 +34,7 @@ protected function configure() ->setName('list') ->setDefinition($this->createDefinition()) ->setDescription('Lists commands') - ->setHelp(<<setHelp(<<<'EOF' The %command.name% command lists all commands: php %command.full_name% @@ -69,6 +69,8 @@ public function getNativeDefinition() protected function execute(InputInterface $input, OutputInterface $output) { if ($input->getOption('xml')) { + @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED); + $input->setOption('format', 'xml'); } @@ -89,7 +91,7 @@ private function createDefinition() new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'), new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'), - new InputOption('format', null, InputOption::VALUE_REQUIRED, 'To output list in other formats', 'txt'), + new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'), )); } } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/ConsoleEvents.php b/application/vendor/symfony/console/ConsoleEvents.php similarity index 95% rename from application/vendor/symfony/console/Symfony/Component/Console/ConsoleEvents.php rename to application/vendor/symfony/console/ConsoleEvents.php index 1ed41b7..6dae6ce 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/ConsoleEvents.php +++ b/application/vendor/symfony/console/ConsoleEvents.php @@ -27,8 +27,6 @@ final class ConsoleEvents * instance. * * @Event - * - * @var string */ const COMMAND = 'console.command'; @@ -40,8 +38,6 @@ final class ConsoleEvents * instance. * * @Event - * - * @var string */ const TERMINATE = 'console.terminate'; @@ -54,8 +50,6 @@ final class ConsoleEvents * instance. * * @Event - * - * @var string */ const EXCEPTION = 'console.exception'; } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/ApplicationDescription.php b/application/vendor/symfony/console/Descriptor/ApplicationDescription.php similarity index 90% rename from application/vendor/symfony/console/Symfony/Component/Console/Descriptor/ApplicationDescription.php rename to application/vendor/symfony/console/Descriptor/ApplicationDescription.php index c481be4..2100b94 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/ApplicationDescription.php +++ b/application/vendor/symfony/console/Descriptor/ApplicationDescription.php @@ -23,14 +23,7 @@ class ApplicationDescription { const GLOBAL_NAMESPACE = '_global'; - /** - * @var Application - */ private $application; - - /** - * @var null|string - */ private $namespace; /** @@ -48,12 +41,6 @@ class ApplicationDescription */ private $aliases; - /** - * Constructor. - * - * @param Application $application - * @param string|null $namespace - */ public function __construct(Application $application, $namespace = null) { $this->application = $application; @@ -129,22 +116,22 @@ private function inspectApplication() } /** - * @param array $commands - * * @return array */ private function sortCommands(array $commands) { $namespacedCommands = array(); + $globalCommands = array(); foreach ($commands as $name => $command) { $key = $this->application->extractNamespace($name, 1); if (!$key) { - $key = '_global'; + $globalCommands['_global'][$name] = $command; + } else { + $namespacedCommands[$key][$name] = $command; } - - $namespacedCommands[$key][$name] = $command; } ksort($namespacedCommands); + $namespacedCommands = array_merge($globalCommands, $namespacedCommands); foreach ($namespacedCommands as &$commandsSet) { ksort($commandsSet); diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/Descriptor.php b/application/vendor/symfony/console/Descriptor/Descriptor.php similarity index 88% rename from application/vendor/symfony/console/Symfony/Component/Console/Descriptor/Descriptor.php rename to application/vendor/symfony/console/Descriptor/Descriptor.php index 49e2193..469bbd7 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/Descriptor.php +++ b/application/vendor/symfony/console/Descriptor/Descriptor.php @@ -72,9 +72,6 @@ protected function write($content, $decorated = false) /** * Describes an InputArgument instance. * - * @param InputArgument $argument - * @param array $options - * * @return string|mixed */ abstract protected function describeInputArgument(InputArgument $argument, array $options = array()); @@ -82,9 +79,6 @@ abstract protected function describeInputArgument(InputArgument $argument, array /** * Describes an InputOption instance. * - * @param InputOption $option - * @param array $options - * * @return string|mixed */ abstract protected function describeInputOption(InputOption $option, array $options = array()); @@ -92,9 +86,6 @@ abstract protected function describeInputOption(InputOption $option, array $opti /** * Describes an InputDefinition instance. * - * @param InputDefinition $definition - * @param array $options - * * @return string|mixed */ abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array()); @@ -102,9 +93,6 @@ abstract protected function describeInputDefinition(InputDefinition $definition, /** * Describes a Command instance. * - * @param Command $command - * @param array $options - * * @return string|mixed */ abstract protected function describeCommand(Command $command, array $options = array()); @@ -112,9 +100,6 @@ abstract protected function describeCommand(Command $command, array $options = a /** * Describes an Application instance. * - * @param Application $application - * @param array $options - * * @return string|mixed */ abstract protected function describeApplication(Application $application, array $options = array()); diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/DescriptorInterface.php b/application/vendor/symfony/console/Descriptor/DescriptorInterface.php similarity index 94% rename from application/vendor/symfony/console/Symfony/Component/Console/Descriptor/DescriptorInterface.php rename to application/vendor/symfony/console/Descriptor/DescriptorInterface.php index 3929b6d..5d3339a 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/DescriptorInterface.php +++ b/application/vendor/symfony/console/Descriptor/DescriptorInterface.php @@ -21,7 +21,7 @@ interface DescriptorInterface { /** - * Describes an InputArgument instance. + * Describes an object if supported. * * @param OutputInterface $output * @param object $object diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/JsonDescriptor.php b/application/vendor/symfony/console/Descriptor/JsonDescriptor.php similarity index 86% rename from application/vendor/symfony/console/Symfony/Component/Console/Descriptor/JsonDescriptor.php rename to application/vendor/symfony/console/Descriptor/JsonDescriptor.php index 13785a4..0a22274 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/JsonDescriptor.php +++ b/application/vendor/symfony/console/Descriptor/JsonDescriptor.php @@ -81,9 +81,6 @@ protected function describeApplication(Application $application, array $options /** * Writes data as json. * - * @param array $data - * @param array $options - * * @return array|string */ private function writeData(array $data, array $options) @@ -92,8 +89,6 @@ private function writeData(array $data, array $options) } /** - * @param InputArgument $argument - * * @return array */ private function getInputArgumentData(InputArgument $argument) @@ -102,32 +97,28 @@ private function getInputArgumentData(InputArgument $argument) 'name' => $argument->getName(), 'is_required' => $argument->isRequired(), 'is_array' => $argument->isArray(), - 'description' => $argument->getDescription(), - 'default' => $argument->getDefault(), + 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()), + 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(), ); } /** - * @param InputOption $option - * * @return array */ private function getInputOptionData(InputOption $option) { return array( 'name' => '--'.$option->getName(), - 'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '', + 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '', 'accept_value' => $option->acceptValue(), 'is_value_required' => $option->isValueRequired(), 'is_multiple' => $option->isArray(), - 'description' => $option->getDescription(), - 'default' => $option->getDefault(), + 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()), + 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(), ); } /** - * @param InputDefinition $definition - * * @return array */ private function getInputDefinitionData(InputDefinition $definition) @@ -146,8 +137,6 @@ private function getInputDefinitionData(InputDefinition $definition) } /** - * @param Command $command - * * @return array */ private function getCommandData(Command $command) @@ -157,10 +146,9 @@ private function getCommandData(Command $command) return array( 'name' => $command->getName(), - 'usage' => $command->getSynopsis(), + 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()), 'description' => $command->getDescription(), 'help' => $command->getProcessedHelp(), - 'aliases' => $command->getAliases(), 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()), ); } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php b/application/vendor/symfony/console/Descriptor/MarkdownDescriptor.php similarity index 84% rename from application/vendor/symfony/console/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php rename to application/vendor/symfony/console/Descriptor/MarkdownDescriptor.php index 78d48b9..76399ca 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php +++ b/application/vendor/symfony/console/Descriptor/MarkdownDescriptor.php @@ -13,6 +13,7 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Helper\Helper; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; @@ -36,7 +37,7 @@ protected function describeInputArgument(InputArgument $argument, array $options .'* Name: '.($argument->getName() ?: '')."\n" .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n" .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n" - .'* Description: '.($argument->getDescription() ?: '')."\n" + .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '')."\n" .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`' ); } @@ -49,11 +50,11 @@ protected function describeInputOption(InputOption $option, array $options = arr $this->write( '**'.$option->getName().':**'."\n\n" .'* Name: `--'.$option->getName().'`'."\n" - .'* Shortcut: '.($option->getShortcut() ? '`-'.implode('|-', explode('|', $option->getShortcut())).'`' : '')."\n" + .'* Shortcut: '.($option->getShortcut() ? '`-'.str_replace('|', '|-', $option->getShortcut()).'`' : '')."\n" .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n" .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n" .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n" - .'* Description: '.($option->getDescription() ?: '')."\n" + .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '')."\n" .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`' ); } @@ -94,14 +95,16 @@ protected function describeCommand(Command $command, array $options = array()) $this->write( $command->getName()."\n" - .str_repeat('-', strlen($command->getName()))."\n\n" + .str_repeat('-', Helper::strlen($command->getName()))."\n\n" .'* Description: '.($command->getDescription() ?: '')."\n" - .'* Usage: `'.$command->getSynopsis().'`'."\n" - .'* Aliases: '.(count($command->getAliases()) ? '`'.implode('`, `', $command->getAliases()).'`' : '') + .'* Usage:'."\n\n" + .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) { + return $carry.' * `'.$usage.'`'."\n"; + }) ); if ($help = $command->getProcessedHelp()) { - $this->write("\n\n"); + $this->write("\n"); $this->write($help); } @@ -119,7 +122,7 @@ protected function describeApplication(Application $application, array $options $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null; $description = new ApplicationDescription($application, $describedNamespace); - $this->write($application->getName()."\n".str_repeat('=', strlen($application->getName()))); + $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName()))); foreach ($description->getNamespaces() as $namespace) { if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) { diff --git a/application/vendor/symfony/console/Descriptor/TextDescriptor.php b/application/vendor/symfony/console/Descriptor/TextDescriptor.php new file mode 100644 index 0000000..1d64324 --- /dev/null +++ b/application/vendor/symfony/console/Descriptor/TextDescriptor.php @@ -0,0 +1,303 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Descriptor; + +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Helper\Helper; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputDefinition; +use Symfony\Component\Console\Input\InputOption; + +/** + * Text descriptor. + * + * @author Jean-François Simon + * + * @internal + */ +class TextDescriptor extends Descriptor +{ + /** + * {@inheritdoc} + */ + protected function describeInputArgument(InputArgument $argument, array $options = array()) + { + if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) { + $default = sprintf(' [default: %s]', $this->formatDefaultValue($argument->getDefault())); + } else { + $default = ''; + } + + $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName()); + $spacingWidth = $totalWidth - strlen($argument->getName()); + + $this->writeText(sprintf(' %s %s%s%s', + $argument->getName(), + str_repeat(' ', $spacingWidth), + // + 4 = 2 spaces before , 2 spaces after + preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()), + $default + ), $options); + } + + /** + * {@inheritdoc} + */ + protected function describeInputOption(InputOption $option, array $options = array()) + { + if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) { + $default = sprintf(' [default: %s]', $this->formatDefaultValue($option->getDefault())); + } else { + $default = ''; + } + + $value = ''; + if ($option->acceptValue()) { + $value = '='.strtoupper($option->getName()); + + if ($option->isValueOptional()) { + $value = '['.$value.']'; + } + } + + $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option)); + $synopsis = sprintf('%s%s', + $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ', + sprintf('--%s%s', $option->getName(), $value) + ); + + $spacingWidth = $totalWidth - Helper::strlen($synopsis); + + $this->writeText(sprintf(' %s %s%s%s%s', + $synopsis, + str_repeat(' ', $spacingWidth), + // + 4 = 2 spaces before , 2 spaces after + preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()), + $default, + $option->isArray() ? ' (multiple values allowed)' : '' + ), $options); + } + + /** + * {@inheritdoc} + */ + protected function describeInputDefinition(InputDefinition $definition, array $options = array()) + { + $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions()); + foreach ($definition->getArguments() as $argument) { + $totalWidth = max($totalWidth, Helper::strlen($argument->getName())); + } + + if ($definition->getArguments()) { + $this->writeText('Arguments:', $options); + $this->writeText("\n"); + foreach ($definition->getArguments() as $argument) { + $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth))); + $this->writeText("\n"); + } + } + + if ($definition->getArguments() && $definition->getOptions()) { + $this->writeText("\n"); + } + + if ($definition->getOptions()) { + $laterOptions = array(); + + $this->writeText('Options:', $options); + foreach ($definition->getOptions() as $option) { + if (strlen($option->getShortcut()) > 1) { + $laterOptions[] = $option; + continue; + } + $this->writeText("\n"); + $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth))); + } + foreach ($laterOptions as $option) { + $this->writeText("\n"); + $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth))); + } + } + } + + /** + * {@inheritdoc} + */ + protected function describeCommand(Command $command, array $options = array()) + { + $command->getSynopsis(true); + $command->getSynopsis(false); + $command->mergeApplicationDefinition(false); + + $this->writeText('Usage:', $options); + foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) { + $this->writeText("\n"); + $this->writeText(' '.OutputFormatter::escape($usage), $options); + } + $this->writeText("\n"); + + $definition = $command->getNativeDefinition(); + if ($definition->getOptions() || $definition->getArguments()) { + $this->writeText("\n"); + $this->describeInputDefinition($definition, $options); + $this->writeText("\n"); + } + + if ($help = $command->getProcessedHelp()) { + $this->writeText("\n"); + $this->writeText('Help:', $options); + $this->writeText("\n"); + $this->writeText(' '.str_replace("\n", "\n ", $help), $options); + $this->writeText("\n"); + } + } + + /** + * {@inheritdoc} + */ + protected function describeApplication(Application $application, array $options = array()) + { + $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null; + $description = new ApplicationDescription($application, $describedNamespace); + + if (isset($options['raw_text']) && $options['raw_text']) { + $width = $this->getColumnWidth($description->getCommands()); + + foreach ($description->getCommands() as $command) { + $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options); + $this->writeText("\n"); + } + } else { + if ('' != $help = $application->getHelp()) { + $this->writeText("$help\n\n", $options); + } + + $this->writeText("Usage:\n", $options); + $this->writeText(" command [options] [arguments]\n\n", $options); + + $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options); + + $this->writeText("\n"); + $this->writeText("\n"); + + $width = $this->getColumnWidth($description->getCommands()); + + if ($describedNamespace) { + $this->writeText(sprintf('Available commands for the "%s" namespace:', $describedNamespace), $options); + } else { + $this->writeText('Available commands:', $options); + } + + // add commands by namespace + foreach ($description->getNamespaces() as $namespace) { + if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) { + $this->writeText("\n"); + $this->writeText(' '.$namespace['id'].'', $options); + } + + foreach ($namespace['commands'] as $name) { + $this->writeText("\n"); + $spacingWidth = $width - Helper::strlen($name); + $this->writeText(sprintf(' %s%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options); + } + } + + $this->writeText("\n"); + } + } + + /** + * {@inheritdoc} + */ + private function writeText($content, array $options = array()) + { + $this->write( + isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content, + isset($options['raw_output']) ? !$options['raw_output'] : true + ); + } + + /** + * Formats input option/argument default value. + * + * @param mixed $default + * + * @return string + */ + private function formatDefaultValue($default) + { + if (INF === $default) { + return 'INF'; + } + + if (is_string($default)) { + $default = OutputFormatter::escape($default); + } elseif (is_array($default)) { + foreach ($default as $key => $value) { + if (is_string($value)) { + $default[$key] = OutputFormatter::escape($value); + } + } + } + + if (\PHP_VERSION_ID < 50400) { + return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default)); + } + + return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); + } + + /** + * @param Command[] $commands + * + * @return int + */ + private function getColumnWidth(array $commands) + { + $widths = array(); + + foreach ($commands as $command) { + $widths[] = Helper::strlen($command->getName()); + foreach ($command->getAliases() as $alias) { + $widths[] = Helper::strlen($alias); + } + } + + return max($widths) + 2; + } + + /** + * @param InputOption[] $options + * + * @return int + */ + private function calculateTotalWidthForOptions(array $options) + { + $totalWidth = 0; + foreach ($options as $option) { + // "-" + shortcut + ", --" + name + $nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName()); + + if ($option->acceptValue()) { + $valueLength = 1 + Helper::strlen($option->getName()); // = + value + $valueLength += $option->isValueOptional() ? 2 : 0; // [ + ] + + $nameLength += $valueLength; + } + $totalWidth = max($totalWidth, $nameLength); + } + + return $totalWidth; + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/XmlDescriptor.php b/application/vendor/symfony/console/Descriptor/XmlDescriptor.php similarity index 90% rename from application/vendor/symfony/console/Symfony/Component/Console/Descriptor/XmlDescriptor.php rename to application/vendor/symfony/console/Descriptor/XmlDescriptor.php index 5054686..c42fa42 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/XmlDescriptor.php +++ b/application/vendor/symfony/console/Descriptor/XmlDescriptor.php @@ -27,8 +27,6 @@ class XmlDescriptor extends Descriptor { /** - * @param InputDefinition $definition - * * @return \DOMDocument */ public function getInputDefinitionDocument(InputDefinition $definition) @@ -50,8 +48,6 @@ public function getInputDefinitionDocument(InputDefinition $definition) } /** - * @param Command $command - * * @return \DOMDocument */ public function getCommandDocument(Command $command) @@ -65,8 +61,11 @@ public function getCommandDocument(Command $command) $commandXML->setAttribute('id', $command->getName()); $commandXML->setAttribute('name', $command->getName()); - $commandXML->appendChild($usageXML = $dom->createElement('usage')); - $usageXML->appendChild($dom->createTextNode(sprintf($command->getSynopsis(), ''))); + $commandXML->appendChild($usagesXML = $dom->createElement('usages')); + + foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) { + $usagesXML->appendChild($dom->createElement('usage', $usage)); + } $commandXML->appendChild($descriptionXML = $dom->createElement('description')); $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription()))); @@ -74,12 +73,6 @@ public function getCommandDocument(Command $command) $commandXML->appendChild($helpXML = $dom->createElement('help')); $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp()))); - $commandXML->appendChild($aliasesXML = $dom->createElement('aliases')); - foreach ($command->getAliases() as $alias) { - $aliasesXML->appendChild($aliasXML = $dom->createElement('alias')); - $aliasXML->appendChild($dom->createTextNode($alias)); - } - $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition()); $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0)); @@ -97,9 +90,9 @@ public function getApplicationDocument(Application $application, $namespace = nu $dom = new \DOMDocument('1.0', 'UTF-8'); $dom->appendChild($rootXml = $dom->createElement('symfony')); - if ($application->getName() !== 'UNKNOWN') { + if ('UNKNOWN' !== $application->getName()) { $rootXml->setAttribute('name', $application->getName()); - if ($application->getVersion() !== 'UNKNOWN') { + if ('UNKNOWN' !== $application->getVersion()) { $rootXml->setAttribute('version', $application->getVersion()); } } @@ -175,9 +168,6 @@ protected function describeApplication(Application $application, array $options /** * Appends document children to parent node. - * - * @param \DOMNode $parentNode - * @param \DOMNode $importedParent */ private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent) { @@ -189,8 +179,6 @@ private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent) /** * Writes DOM document. * - * @param \DOMDocument $dom - * * @return \DOMDocument|string */ private function writeDocument(\DOMDocument $dom) @@ -200,8 +188,6 @@ private function writeDocument(\DOMDocument $dom) } /** - * @param InputArgument $argument - * * @return \DOMDocument */ private function getInputArgumentDocument(InputArgument $argument) @@ -226,8 +212,6 @@ private function getInputArgumentDocument(InputArgument $argument) } /** - * @param InputOption $option - * * @return \DOMDocument */ private function getInputOptionDocument(InputOption $option) @@ -239,7 +223,7 @@ private function getInputOptionDocument(InputOption $option) $pos = strpos($option->getShortcut(), '|'); if (false !== $pos) { $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos)); - $objectXML->setAttribute('shortcuts', '-'.implode('|-', explode('|', $option->getShortcut()))); + $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut())); } else { $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : ''); } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Event/ConsoleCommandEvent.php b/application/vendor/symfony/console/Event/ConsoleCommandEvent.php similarity index 81% rename from application/vendor/symfony/console/Symfony/Component/Console/Event/ConsoleCommandEvent.php rename to application/vendor/symfony/console/Event/ConsoleCommandEvent.php index 56f5526..2f517c1 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Event/ConsoleCommandEvent.php +++ b/application/vendor/symfony/console/Event/ConsoleCommandEvent.php @@ -19,19 +19,17 @@ class ConsoleCommandEvent extends ConsoleEvent { /** - * The return code for skipped commands, this will also be passed into the terminate event + * The return code for skipped commands, this will also be passed into the terminate event. */ const RETURN_CODE_DISABLED = 113; /** - * Indicates if the command should be run or skipped - * - * @var bool + * Indicates if the command should be run or skipped. */ private $commandShouldRun = true; /** - * Disables the command, so it won't be run + * Disables the command, so it won't be run. * * @return bool */ @@ -41,7 +39,7 @@ public function disableCommand() } /** - * Enables the command + * Enables the command. * * @return bool */ @@ -51,7 +49,7 @@ public function enableCommand() } /** - * Returns true if the command is runnable, false otherwise + * Returns true if the command is runnable, false otherwise. * * @return bool */ diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Event/ConsoleEvent.php b/application/vendor/symfony/console/Event/ConsoleEvent.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Event/ConsoleEvent.php rename to application/vendor/symfony/console/Event/ConsoleEvent.php diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Event/ConsoleExceptionEvent.php b/application/vendor/symfony/console/Event/ConsoleExceptionEvent.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Event/ConsoleExceptionEvent.php rename to application/vendor/symfony/console/Event/ConsoleExceptionEvent.php diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Event/ConsoleTerminateEvent.php b/application/vendor/symfony/console/Event/ConsoleTerminateEvent.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Event/ConsoleTerminateEvent.php rename to application/vendor/symfony/console/Event/ConsoleTerminateEvent.php diff --git a/application/vendor/symfony/console/Exception/RuntimeException.php b/application/vendor/symfony/console/Exception/RuntimeException.php new file mode 100644 index 0000000..1324558 --- /dev/null +++ b/application/vendor/symfony/console/Exception/RuntimeException.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Exception; + +/** + * @author Jérôme Tamarelle + */ +class RuntimeException extends \RuntimeException +{ +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatter.php b/application/vendor/symfony/console/Formatter/OutputFormatter.php similarity index 81% rename from application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatter.php rename to application/vendor/symfony/console/Formatter/OutputFormatter.php index 331b204..c8a6a78 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatter.php +++ b/application/vendor/symfony/console/Formatter/OutputFormatter.php @@ -15,8 +15,6 @@ * Formatter class for console output. * * @author Konstantin Kudryashov - * - * @api */ class OutputFormatter implements OutputFormatterInterface { @@ -33,7 +31,30 @@ class OutputFormatter implements OutputFormatterInterface */ public static function escape($text) { - return preg_replace('/([^\\\\]?) FormatterStyle" instances - * - * @api */ public function __construct($decorated = false, array $styles = array()) { @@ -61,11 +80,7 @@ public function __construct($decorated = false, array $styles = array()) } /** - * Sets the decorated flag. - * - * @param bool $decorated Whether to decorate the messages or not - * - * @api + * {@inheritdoc} */ public function setDecorated($decorated) { @@ -73,11 +88,7 @@ public function setDecorated($decorated) } /** - * Gets the decorated flag. - * - * @return bool true if the output will decorate messages, false otherwise - * - * @api + * {@inheritdoc} */ public function isDecorated() { @@ -85,12 +96,7 @@ public function isDecorated() } /** - * Sets a new style. - * - * @param string $name The style name - * @param OutputFormatterStyleInterface $style The style instance - * - * @api + * {@inheritdoc} */ public function setStyle($name, OutputFormatterStyleInterface $style) { @@ -98,13 +104,7 @@ public function setStyle($name, OutputFormatterStyleInterface $style) } /** - * Checks if output formatter has style with specified name. - * - * @param string $name - * - * @return bool - * - * @api + * {@inheritdoc} */ public function hasStyle($name) { @@ -112,15 +112,7 @@ public function hasStyle($name) } /** - * Gets style options from style with specified name. - * - * @param string $name - * - * @return OutputFormatterStyleInterface - * - * @throws \InvalidArgumentException When style isn't defined - * - * @api + * {@inheritdoc} */ public function getStyle($name) { @@ -132,20 +124,14 @@ public function getStyle($name) } /** - * Formats a message according to the given styles. - * - * @param string $message The message to style - * - * @return string The styled message - * - * @api + * {@inheritdoc} */ public function format($message) { $message = (string) $message; $offset = 0; $output = ''; - $tagRegex = '[a-z][a-z0-9_=;-]*'; + $tagRegex = '[a-z][a-z0-9_=;-]*+'; preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE); foreach ($matches[0] as $i => $match) { $pos = $match[1]; @@ -180,6 +166,10 @@ public function format($message) $output .= $this->applyCurrentStyle(substr($message, $offset)); + if (false !== strpos($output, "\0")) { + return strtr($output, array("\0" => '\\', '\\<' => '<')); + } + return str_replace('\\<', '<', $output); } @@ -196,7 +186,7 @@ public function getStyleStack() * * @param string $string * - * @return OutputFormatterStyle|bool false if string is not format string + * @return OutputFormatterStyle|false false if string is not format string */ private function createStyleFromString($string) { diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterInterface.php b/application/vendor/symfony/console/Formatter/OutputFormatterInterface.php similarity index 93% rename from application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterInterface.php rename to application/vendor/symfony/console/Formatter/OutputFormatterInterface.php index 52efa31..281e240 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterInterface.php +++ b/application/vendor/symfony/console/Formatter/OutputFormatterInterface.php @@ -15,8 +15,6 @@ * Formatter interface for console output. * * @author Konstantin Kudryashov - * - * @api */ interface OutputFormatterInterface { @@ -24,8 +22,6 @@ interface OutputFormatterInterface * Sets the decorated flag. * * @param bool $decorated Whether to decorate the messages or not - * - * @api */ public function setDecorated($decorated); @@ -33,8 +29,6 @@ public function setDecorated($decorated); * Gets the decorated flag. * * @return bool true if the output will decorate messages, false otherwise - * - * @api */ public function isDecorated(); @@ -43,8 +37,6 @@ public function isDecorated(); * * @param string $name The style name * @param OutputFormatterStyleInterface $style The style instance - * - * @api */ public function setStyle($name, OutputFormatterStyleInterface $style); @@ -54,8 +46,6 @@ public function setStyle($name, OutputFormatterStyleInterface $style); * @param string $name * * @return bool - * - * @api */ public function hasStyle($name); @@ -66,7 +56,7 @@ public function hasStyle($name); * * @return OutputFormatterStyleInterface * - * @api + * @throws \InvalidArgumentException When style isn't defined */ public function getStyle($name); @@ -76,8 +66,6 @@ public function getStyle($name); * @param string $message The message to style * * @return string The styled message - * - * @api */ public function format($message); } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyle.php b/application/vendor/symfony/console/Formatter/OutputFormatterStyle.php similarity index 97% rename from application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyle.php rename to application/vendor/symfony/console/Formatter/OutputFormatterStyle.php index ee62cdb..e15b132 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyle.php +++ b/application/vendor/symfony/console/Formatter/OutputFormatterStyle.php @@ -15,8 +15,6 @@ * Formatter style class for defining styles. * * @author Konstantin Kudryashov - * - * @api */ class OutputFormatterStyle implements OutputFormatterStyleInterface { @@ -60,8 +58,6 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface * @param string|null $foreground The style foreground color name * @param string|null $background The style background color name * @param array $options The style options - * - * @api */ public function __construct($foreground = null, $background = null, array $options = array()) { @@ -82,8 +78,6 @@ public function __construct($foreground = null, $background = null, array $optio * @param string|null $color The color name * * @throws \InvalidArgumentException When the color name isn't defined - * - * @api */ public function setForeground($color = null) { @@ -110,8 +104,6 @@ public function setForeground($color = null) * @param string|null $color The color name * * @throws \InvalidArgumentException When the color name isn't defined - * - * @api */ public function setBackground($color = null) { @@ -138,8 +130,6 @@ public function setBackground($color = null) * @param string $option The option name * * @throws \InvalidArgumentException When the option name isn't defined - * - * @api */ public function setOption($option) { @@ -180,9 +170,7 @@ public function unsetOption($option) } /** - * Sets multiple style options at once. - * - * @param array $options + * {@inheritdoc} */ public function setOptions(array $options) { diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php b/application/vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php similarity index 92% rename from application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php rename to application/vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php index e8642b3..4c7dc41 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php +++ b/application/vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php @@ -15,8 +15,6 @@ * Formatter style interface for defining styles. * * @author Konstantin Kudryashov - * - * @api */ interface OutputFormatterStyleInterface { @@ -24,8 +22,6 @@ interface OutputFormatterStyleInterface * Sets style foreground color. * * @param string $color The color name - * - * @api */ public function setForeground($color = null); @@ -33,8 +29,6 @@ public function setForeground($color = null); * Sets style background color. * * @param string $color The color name - * - * @api */ public function setBackground($color = null); @@ -42,8 +36,6 @@ public function setBackground($color = null); * Sets some specific style option. * * @param string $option The option name - * - * @api */ public function setOption($option); @@ -56,8 +48,6 @@ public function unsetOption($option); /** * Sets multiple style options at once. - * - * @param array $options */ public function setOptions(array $options); diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php b/application/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php similarity index 86% rename from application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php rename to application/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php index b64c87f..b560087 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php +++ b/application/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php @@ -21,16 +21,8 @@ class OutputFormatterStyleStack */ private $styles; - /** - * @var OutputFormatterStyleInterface - */ private $emptyStyle; - /** - * Constructor. - * - * @param OutputFormatterStyleInterface|null $emptyStyle - */ public function __construct(OutputFormatterStyleInterface $emptyStyle = null) { $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle(); @@ -47,8 +39,6 @@ public function reset() /** * Pushes a style in the stack. - * - * @param OutputFormatterStyleInterface $style */ public function push(OutputFormatterStyleInterface $style) { @@ -58,8 +48,6 @@ public function push(OutputFormatterStyleInterface $style) /** * Pops a style from the stack. * - * @param OutputFormatterStyleInterface|null $style - * * @return OutputFormatterStyleInterface * * @throws \InvalidArgumentException When style tags incorrectly nested @@ -100,9 +88,7 @@ public function getCurrent() } /** - * @param OutputFormatterStyleInterface $emptyStyle - * - * @return OutputFormatterStyleStack + * @return $this */ public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle) { diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/DebugFormatterHelper.php b/application/vendor/symfony/console/Helper/DebugFormatterHelper.php similarity index 92% rename from application/vendor/symfony/console/Symfony/Component/Console/Helper/DebugFormatterHelper.php rename to application/vendor/symfony/console/Helper/DebugFormatterHelper.php index 0b4b937..1119b79 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Helper/DebugFormatterHelper.php +++ b/application/vendor/symfony/console/Helper/DebugFormatterHelper.php @@ -25,7 +25,7 @@ class DebugFormatterHelper extends Helper private $count = -1; /** - * Starts a debug formatting session + * Starts a debug formatting session. * * @param string $id The id of the formatting session * @param string $message The message to display @@ -41,7 +41,7 @@ public function start($id, $message, $prefix = 'RUN') } /** - * Adds progress to a formatting session + * Adds progress to a formatting session. * * @param string $id The id of the formatting session * @param string $buffer The message to display @@ -61,7 +61,7 @@ public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPr unset($this->started[$id]['out']); } if (!isset($this->started[$id]['err'])) { - $message .= sprintf("%s %s ", $this->getBorder($id), $errorPrefix); + $message .= sprintf('%s %s ', $this->getBorder($id), $errorPrefix); $this->started[$id]['err'] = true; } @@ -72,7 +72,7 @@ public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPr unset($this->started[$id]['err']); } if (!isset($this->started[$id]['out'])) { - $message .= sprintf("%s %s ", $this->getBorder($id), $prefix); + $message .= sprintf('%s %s ', $this->getBorder($id), $prefix); $this->started[$id]['out'] = true; } @@ -83,7 +83,7 @@ public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPr } /** - * Stops a formatting session + * Stops a formatting session. * * @param string $id The id of the formatting session * @param string $message The message to display diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/DescriptorHelper.php b/application/vendor/symfony/console/Helper/DescriptorHelper.php similarity index 97% rename from application/vendor/symfony/console/Symfony/Component/Console/Helper/DescriptorHelper.php rename to application/vendor/symfony/console/Helper/DescriptorHelper.php index c324c99..17fffe5 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Helper/DescriptorHelper.php +++ b/application/vendor/symfony/console/Helper/DescriptorHelper.php @@ -30,9 +30,6 @@ class DescriptorHelper extends Helper */ private $descriptors = array(); - /** - * Constructor. - */ public function __construct() { $this @@ -77,7 +74,7 @@ public function describe(OutputInterface $output, $object, array $options = arra * @param string $format * @param DescriptorInterface $descriptor * - * @return DescriptorHelper + * @return $this */ public function register($format, DescriptorInterface $descriptor) { diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/DialogHelper.php b/application/vendor/symfony/console/Helper/DialogHelper.php similarity index 92% rename from application/vendor/symfony/console/Symfony/Component/Console/Helper/DialogHelper.php rename to application/vendor/symfony/console/Helper/DialogHelper.php index 31634dd..0a5939a 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Helper/DialogHelper.php +++ b/application/vendor/symfony/console/Helper/DialogHelper.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Console\Helper; +use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Formatter\OutputFormatterStyle; @@ -19,8 +20,8 @@ * * @author Fabien Potencier * - * @deprecated Deprecated since version 2.5, to be removed in 3.0. - * Use the question helper instead. + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link \Symfony\Component\Console\Helper\QuestionHelper} instead. */ class DialogHelper extends InputAwareHelper { @@ -28,6 +29,13 @@ class DialogHelper extends InputAwareHelper private static $shell; private static $stty; + public function __construct($triggerDeprecationError = true) + { + if ($triggerDeprecationError) { + @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED); + } + } + /** * Asks the user to select a value. * @@ -45,11 +53,15 @@ class DialogHelper extends InputAwareHelper */ public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false) { + if ($output instanceof ConsoleOutputInterface) { + $output = $output->getErrorOutput(); + } + $width = max(array_map('strlen', array_keys($choices))); $messages = (array) $question; foreach ($choices as $key => $value) { - $messages[] = sprintf(" [%-${width}s] %s", $key, $value); + $messages[] = sprintf(" [%-{$width}s] %s", $key, $value); } $output->writeln($messages); @@ -105,6 +117,10 @@ public function ask(OutputInterface $output, $question, $default = null, array $ return $default; } + if ($output instanceof ConsoleOutputInterface) { + $output = $output->getErrorOutput(); + } + $output->write($question); $inputStream = $this->inputStream ?: STDIN; @@ -143,7 +159,7 @@ public function ask(OutputInterface $output, $question, $default = null, array $ $output->write("\033[1D"); } - if ($i === 0) { + if (0 === $i) { $ofs = -1; $matches = $autocomplete; $numMatches = count($matches); @@ -262,6 +278,10 @@ public function askConfirmation(OutputInterface $output, $question, $default = t */ public function askHiddenResponse(OutputInterface $output, $question, $fallback = true) { + if ($output instanceof ConsoleOutputInterface) { + $output = $output->getErrorOutput(); + } + if ('\\' === DIRECTORY_SEPARATOR) { $exe = __DIR__.'/../Resources/bin/hiddeninput.exe'; @@ -304,7 +324,7 @@ public function askHiddenResponse(OutputInterface $output, $question, $fallback if (false !== $shell = $this->getShell()) { $output->write($question); - $readCmd = $shell === 'csh' ? 'set mypassword = $<' : 'read -r mypassword'; + $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword'; $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd); $value = rtrim(shell_exec($command)); $output->writeln(''); @@ -392,7 +412,7 @@ public function setInputStream($stream) /** * Returns the helper's input stream. * - * @return string + * @return resource|null The input stream or null if the default STDIN is used */ public function getInputStream() { @@ -442,7 +462,7 @@ private function hasSttyAvailable() exec('stty 2>&1', $output, $exitcode); - return self::$stty = $exitcode === 0; + return self::$stty = 0 === $exitcode; } /** @@ -451,7 +471,7 @@ private function hasSttyAvailable() * @param callable $interviewer A callable that will ask for a question and return the result * @param OutputInterface $output An Output instance * @param callable $validator A PHP callback - * @param int|false $attempts Max number of times to ask before giving up ; false will ask infinitely + * @param int|false $attempts Max number of times to ask before giving up; false will ask infinitely * * @return string The validated response * @@ -459,6 +479,10 @@ private function hasSttyAvailable() */ private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts) { + if ($output instanceof ConsoleOutputInterface) { + $output = $output->getErrorOutput(); + } + $e = null; while (false === $attempts || $attempts--) { if (null !== $e) { diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/FormatterHelper.php b/application/vendor/symfony/console/Helper/FormatterHelper.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Helper/FormatterHelper.php rename to application/vendor/symfony/console/Helper/FormatterHelper.php diff --git a/application/vendor/symfony/console/Helper/Helper.php b/application/vendor/symfony/console/Helper/Helper.php new file mode 100644 index 0000000..8bf82a1 --- /dev/null +++ b/application/vendor/symfony/console/Helper/Helper.php @@ -0,0 +1,124 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Helper; + +use Symfony\Component\Console\Formatter\OutputFormatterInterface; + +/** + * Helper is the base class for all helper classes. + * + * @author Fabien Potencier + */ +abstract class Helper implements HelperInterface +{ + protected $helperSet = null; + + /** + * {@inheritdoc} + */ + public function setHelperSet(HelperSet $helperSet = null) + { + $this->helperSet = $helperSet; + } + + /** + * {@inheritdoc} + */ + public function getHelperSet() + { + return $this->helperSet; + } + + /** + * Returns the length of a string, using mb_strwidth if it is available. + * + * @param string $string The string to check its length + * + * @return int The length of the string + */ + public static function strlen($string) + { + if (!function_exists('mb_strwidth')) { + return strlen($string); + } + + if (false === $encoding = mb_detect_encoding($string, null, true)) { + return strlen($string); + } + + return mb_strwidth($string, $encoding); + } + + public static function formatTime($secs) + { + static $timeFormats = array( + array(0, '< 1 sec'), + array(1, '1 sec'), + array(2, 'secs', 1), + array(60, '1 min'), + array(120, 'mins', 60), + array(3600, '1 hr'), + array(7200, 'hrs', 3600), + array(86400, '1 day'), + array(172800, 'days', 86400), + ); + + foreach ($timeFormats as $index => $format) { + if ($secs >= $format[0]) { + if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0]) + || $index == count($timeFormats) - 1 + ) { + if (2 == count($format)) { + return $format[1]; + } + + return floor($secs / $format[2]).' '.$format[1]; + } + } + } + } + + public static function formatMemory($memory) + { + if ($memory >= 1024 * 1024 * 1024) { + return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024); + } + + if ($memory >= 1024 * 1024) { + return sprintf('%.1f MiB', $memory / 1024 / 1024); + } + + if ($memory >= 1024) { + return sprintf('%d KiB', $memory / 1024); + } + + return sprintf('%d B', $memory); + } + + public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string) + { + return self::strlen(self::removeDecoration($formatter, $string)); + } + + public static function removeDecoration(OutputFormatterInterface $formatter, $string) + { + $isDecorated = $formatter->isDecorated(); + $formatter->setDecorated(false); + // remove <...> formatting + $string = $formatter->format($string); + // remove already formatted characters + $string = preg_replace("/\033\[[^m]*m/", '', $string); + $formatter->setDecorated($isDecorated); + + return $string; + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/HelperInterface.php b/application/vendor/symfony/console/Helper/HelperInterface.php similarity index 87% rename from application/vendor/symfony/console/Symfony/Component/Console/Helper/HelperInterface.php rename to application/vendor/symfony/console/Helper/HelperInterface.php index 6d39449..1ce8235 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Helper/HelperInterface.php +++ b/application/vendor/symfony/console/Helper/HelperInterface.php @@ -15,17 +15,11 @@ * HelperInterface is the interface all helpers must implement. * * @author Fabien Potencier - * - * @api */ interface HelperInterface { /** * Sets the helper set associated with this helper. - * - * @param HelperSet $helperSet A HelperSet instance - * - * @api */ public function setHelperSet(HelperSet $helperSet = null); @@ -33,8 +27,6 @@ public function setHelperSet(HelperSet $helperSet = null); * Gets the helper set associated with this helper. * * @return HelperSet A HelperSet instance - * - * @api */ public function getHelperSet(); @@ -42,8 +34,6 @@ public function getHelperSet(); * Returns the canonical name of this helper. * * @return string The canonical name - * - * @api */ public function getName(); } diff --git a/application/vendor/symfony/console/Helper/HelperSet.php b/application/vendor/symfony/console/Helper/HelperSet.php new file mode 100644 index 0000000..6ae1627 --- /dev/null +++ b/application/vendor/symfony/console/Helper/HelperSet.php @@ -0,0 +1,115 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Helper; + +use Symfony\Component\Console\Command\Command; + +/** + * HelperSet represents a set of helpers to be used with a command. + * + * @author Fabien Potencier + */ +class HelperSet implements \IteratorAggregate +{ + /** + * @var Helper[] + */ + private $helpers = array(); + private $command; + + /** + * @param Helper[] $helpers An array of helper + */ + public function __construct(array $helpers = array()) + { + foreach ($helpers as $alias => $helper) { + $this->set($helper, is_int($alias) ? null : $alias); + } + } + + /** + * Sets a helper. + * + * @param HelperInterface $helper The helper instance + * @param string $alias An alias + */ + public function set(HelperInterface $helper, $alias = null) + { + $this->helpers[$helper->getName()] = $helper; + if (null !== $alias) { + $this->helpers[$alias] = $helper; + } + + $helper->setHelperSet($this); + } + + /** + * Returns true if the helper if defined. + * + * @param string $name The helper name + * + * @return bool true if the helper is defined, false otherwise + */ + public function has($name) + { + return isset($this->helpers[$name]); + } + + /** + * Gets a helper value. + * + * @param string $name The helper name + * + * @return HelperInterface The helper instance + * + * @throws \InvalidArgumentException if the helper is not defined + */ + public function get($name) + { + if (!$this->has($name)) { + throw new \InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name)); + } + + if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) { + @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED); + } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) { + @trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED); + } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) { + @trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED); + } + + return $this->helpers[$name]; + } + + public function setCommand(Command $command = null) + { + $this->command = $command; + } + + /** + * Gets the command associated with this helper set. + * + * @return Command A Command instance + */ + public function getCommand() + { + return $this->command; + } + + /** + * @return Helper[] + */ + public function getIterator() + { + return new \ArrayIterator($this->helpers); + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/InputAwareHelper.php b/application/vendor/symfony/console/Helper/InputAwareHelper.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Helper/InputAwareHelper.php rename to application/vendor/symfony/console/Helper/InputAwareHelper.php diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/ProcessHelper.php b/application/vendor/symfony/console/Helper/ProcessHelper.php similarity index 94% rename from application/vendor/symfony/console/Symfony/Component/Console/Helper/ProcessHelper.php rename to application/vendor/symfony/console/Helper/ProcessHelper.php index 0c9da73..a811eb4 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Helper/ProcessHelper.php +++ b/application/vendor/symfony/console/Helper/ProcessHelper.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Console\Helper; +use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\Exception\ProcessFailedException; use Symfony\Component\Process\Process; @@ -37,6 +38,10 @@ class ProcessHelper extends Helper */ public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE) { + if ($output instanceof ConsoleOutputInterface) { + $output = $output->getErrorOutput(); + } + $formatter = $this->getHelperSet()->get('debug_formatter'); if (is_array($cmd)) { @@ -109,6 +114,10 @@ public function mustRun(OutputInterface $output, $cmd, $error = null, $callback */ public function wrapCallback(OutputInterface $output, Process $process, $callback = null) { + if ($output instanceof ConsoleOutputInterface) { + $output = $output->getErrorOutput(); + } + $formatter = $this->getHelperSet()->get('debug_formatter'); $that = $this; diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/ProgressBar.php b/application/vendor/symfony/console/Helper/ProgressBar.php similarity index 86% rename from application/vendor/symfony/console/Symfony/Component/Console/Helper/ProgressBar.php rename to application/vendor/symfony/console/Helper/ProgressBar.php index 1cae64b..4d4c0e3 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Helper/ProgressBar.php +++ b/application/vendor/symfony/console/Helper/ProgressBar.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Console\Helper; +use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; /** @@ -21,39 +22,37 @@ */ class ProgressBar { - // options private $barWidth = 28; private $barChar; private $emptyBarChar = '-'; private $progressChar = '>'; - private $format = null; + private $format; + private $internalFormat; private $redrawFreq = 1; - - /** - * @var OutputInterface - */ private $output; private $step = 0; private $max; private $startTime; private $stepWidth; private $percent = 0.0; - private $lastMessagesLength = 0; private $formatLineCount; - private $messages; + private $messages = array(); private $overwrite = true; + private $firstRun = true; private static $formatters; private static $formats; /** - * Constructor. - * * @param OutputInterface $output An OutputInterface instance * @param int $max Maximum steps (0 if unknown) */ public function __construct(OutputInterface $output, $max = 0) { + if ($output instanceof ConsoleOutputInterface) { + $output = $output->getErrorOutput(); + } + $this->output = $output; $this->setMaxSteps($max); @@ -61,14 +60,10 @@ public function __construct(OutputInterface $output, $max = 0) // disable overwrite when output does not support ANSI codes. $this->overwrite = false; - if ($this->max > 10) { - // set a reasonable redraw frequency so output isn't flooded - $this->setRedrawFrequency($max / 10); - } + // set a reasonable redraw frequency so output isn't flooded + $this->setRedrawFrequency($max / 10); } - $this->setFormat($this->determineBestFormat()); - $this->startTime = time(); } @@ -138,6 +133,16 @@ public static function getFormatDefinition($name) return isset(self::$formats[$name]) ? self::$formats[$name] : null; } + /** + * Associates a text with a named placeholder. + * + * The text is displayed when the progress bar is rendered but only + * when the corresponding placeholder is part of the custom format line + * (by wrapping the name with %). + * + * @param string $message The text to associate with the placeholder + * @param string $name The name of the placeholder + */ public function setMessage($message, $name = 'message') { $this->messages[$name] = $message; @@ -171,12 +176,14 @@ public function getMaxSteps() /** * Gets the progress bar step. * - * @deprecated since 2.6, to be removed in 3.0. Use {@link getProgress()} instead. + * @deprecated since version 2.6, to be removed in 3.0. Use {@link getProgress()} instead. * * @return int The progress bar step */ public function getStep() { + @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED); + return $this->getProgress(); } @@ -303,26 +310,18 @@ public function getProgressCharacter() */ public function setFormat($format) { - // try to use the _nomax variant if available - if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) { - $this->format = self::getFormatDefinition($format.'_nomax'); - } elseif (null !== self::getFormatDefinition($format)) { - $this->format = self::getFormatDefinition($format); - } else { - $this->format = $format; - } - - $this->formatLineCount = substr_count($this->format, "\n"); + $this->format = null; + $this->internalFormat = $format; } /** * Sets the redraw frequency. * - * @param int $freq The frequency in steps + * @param int|float $freq The frequency in steps */ public function setRedrawFrequency($freq) { - $this->redrawFreq = (int) $freq; + $this->redrawFreq = max((int) $freq, 1); } /** @@ -358,7 +357,7 @@ public function advance($step = 1) /** * Sets the current progress. * - * @deprecated since 2.6, to be removed in 3.0. Use {@link setProgress()} instead. + * @deprecated since version 2.6, to be removed in 3.0. Use {@link setProgress()} instead. * * @param int $step The current progress * @@ -366,6 +365,8 @@ public function advance($step = 1) */ public function setCurrent($step) { + @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED); + $this->setProgress($step); } @@ -432,6 +433,10 @@ public function display() return; } + if (null === $this->format) { + $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat()); + } + // these 3 variables can be removed in favor of using $this in the closure when support for PHP 5.3 will be dropped. $self = $this; $output = $this->output; @@ -466,13 +471,36 @@ public function clear() return; } - $this->overwrite(str_repeat("\n", $this->formatLineCount)); + if (null === $this->format) { + $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat()); + } + + $this->overwrite(''); + } + + /** + * Sets the progress bar format. + * + * @param string $format The format + */ + private function setRealFormat($format) + { + // try to use the _nomax variant if available + if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) { + $this->format = self::getFormatDefinition($format.'_nomax'); + } elseif (null !== self::getFormatDefinition($format)) { + $this->format = self::getFormatDefinition($format); + } else { + $this->format = $format; + } + + $this->formatLineCount = substr_count($this->format, "\n"); } /** * Sets the progress bar maximal steps. * - * @param int The progress bar max steps + * @param int $max The progress bar max steps */ private function setMaxSteps($max) { @@ -487,37 +515,26 @@ private function setMaxSteps($max) */ private function overwrite($message) { - $lines = explode("\n", $message); + if ($this->overwrite) { + if (!$this->firstRun) { + // Move the cursor to the beginning of the line + $this->output->write("\x0D"); + + // Erase the line + $this->output->write("\x1B[2K"); - // append whitespace to match the line's length - if (null !== $this->lastMessagesLength) { - foreach ($lines as $i => $line) { - if ($this->lastMessagesLength > Helper::strlenWithoutDecoration($this->output->getFormatter(), $line)) { - $lines[$i] = str_pad($line, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT); + // Erase previous lines + if ($this->formatLineCount > 0) { + $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount)); } } - } - - if ($this->overwrite) { - // move back to the beginning of the progress bar before redrawing it - $this->output->write("\x0D"); } elseif ($this->step > 0) { - // move to new line $this->output->writeln(''); } - if ($this->formatLineCount) { - $this->output->write(sprintf("\033[%dA", $this->formatLineCount)); - } - $this->output->write(implode("\n", $lines)); + $this->firstRun = false; - $this->lastMessagesLength = 0; - foreach ($lines as $line) { - $len = Helper::strlenWithoutDecoration($this->output->getFormatter(), $line); - if ($len > $this->lastMessagesLength) { - $this->lastMessagesLength = $len; - } - } + $this->output->write($message); } private function determineBestFormat() diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/ProgressHelper.php b/application/vendor/symfony/console/Helper/ProgressHelper.php similarity index 94% rename from application/vendor/symfony/console/Symfony/Component/Console/Helper/ProgressHelper.php rename to application/vendor/symfony/console/Helper/ProgressHelper.php index b82486d..20b3468 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Helper/ProgressHelper.php +++ b/application/vendor/symfony/console/Helper/ProgressHelper.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Console\Helper; use Symfony\Component\Console\Output\NullOutput; +use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; /** @@ -20,7 +21,8 @@ * @author Chris Jones * @author Fabien Potencier * - * @deprecated Deprecated since 2.5, to be removed in 3.0; use ProgressBar instead. + * @deprecated since version 2.5, to be removed in 3.0 + * Use {@link ProgressBar} instead. */ class ProgressHelper extends Helper { @@ -117,6 +119,13 @@ class ProgressHelper extends Helper array(604800, 'days', 86400), ); + public function __construct($triggerDeprecationError = true) + { + if ($triggerDeprecationError) { + @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED); + } + } + /** * Sets the progress bar width. * @@ -185,6 +194,10 @@ public function setRedrawFrequency($freq) */ public function start(OutputInterface $output, $max = null) { + if ($output instanceof ConsoleOutputInterface) { + $output = $output->getErrorOutput(); + } + $this->startTime = time(); $this->current = 0; $this->max = (int) $max; @@ -358,8 +371,6 @@ private function generate($finish = false) } if (isset($this->formatVars['bar'])) { - $completeBars = 0; - if ($this->max > 0) { $completeBars = floor($percent * $this->barWidth); } else { @@ -412,7 +423,7 @@ private function humaneTime($secs) $text = ''; foreach ($this->timeFormats as $format) { if ($secs < $format[0]) { - if (count($format) == 2) { + if (2 == count($format)) { $text = $format[1]; break; } else { diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/QuestionHelper.php b/application/vendor/symfony/console/Helper/QuestionHelper.php similarity index 81% rename from application/vendor/symfony/console/Symfony/Component/Console/Helper/QuestionHelper.php rename to application/vendor/symfony/console/Helper/QuestionHelper.php index caa0914..36187f8 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Helper/QuestionHelper.php +++ b/application/vendor/symfony/console/Helper/QuestionHelper.php @@ -11,11 +11,14 @@ namespace Symfony\Component\Console\Helper; +use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Question\ChoiceQuestion; +use Symfony\Component\Console\Exception\RuntimeException; /** * The QuestionHelper class provides helpers to interact with the user. @@ -31,17 +34,23 @@ class QuestionHelper extends Helper /** * Asks a question to the user. * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance - * @param Question $question The question to ask - * - * @return string The user answer + * @return mixed The user answer * * @throws \RuntimeException If there is no data to read in the input stream */ public function ask(InputInterface $input, OutputInterface $output, Question $question) { + if ($output instanceof ConsoleOutputInterface) { + $output = $output->getErrorOutput(); + } + if (!$input->isInteractive()) { + if ($question instanceof ChoiceQuestion) { + $choices = $question->getChoices(); + + return $choices[$question->getDefault()]; + } + return $question->getDefault(); } @@ -77,7 +86,7 @@ public function setInputStream($stream) } /** - * Returns the helper's input stream + * Returns the helper's input stream. * * @return resource */ @@ -99,9 +108,6 @@ public function getName() * * This method is public for PHP 5.3 compatibility, it should be private. * - * @param OutputInterface $output - * @param Question $question - * * @return bool|mixed|null|string * * @throws \Exception @@ -109,25 +115,11 @@ public function getName() */ public function doAsk(OutputInterface $output, Question $question) { - $inputStream = $this->inputStream ?: STDIN; - - $message = $question->getQuestion(); - if ($question instanceof ChoiceQuestion) { - $width = max(array_map('strlen', array_keys($question->getChoices()))); - - $messages = (array) $question->getQuestion(); - foreach ($question->getChoices() as $key => $value) { - $messages[] = sprintf(" [%-${width}s] %s", $key, $value); - } - - $output->writeln($messages); - - $message = $question->getPrompt(); - } - - $output->write($message); + $this->writePrompt($output, $question); + $inputStream = $this->inputStream ?: STDIN; $autocomplete = $question->getAutocompleterValues(); + if (null === $autocomplete || !$this->hasSttyAvailable()) { $ret = false; if ($question->isHidden()) { @@ -143,12 +135,12 @@ public function doAsk(OutputInterface $output, Question $question) if (false === $ret) { $ret = fgets($inputStream, 4096); if (false === $ret) { - throw new \RuntimeException('Aborted'); + throw new RuntimeException('Aborted'); } $ret = trim($ret); } } else { - $ret = trim($this->autocomplete($output, $question, $inputStream)); + $ret = trim($this->autocomplete($output, $question, $inputStream, is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false))); } $ret = strlen($ret) > 0 ? $ret : $question->getDefault(); @@ -160,17 +152,56 @@ public function doAsk(OutputInterface $output, Question $question) return $ret; } + /** + * Outputs the question prompt. + */ + protected function writePrompt(OutputInterface $output, Question $question) + { + $message = $question->getQuestion(); + + if ($question instanceof ChoiceQuestion) { + $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices()))); + + $messages = (array) $question->getQuestion(); + foreach ($question->getChoices() as $key => $value) { + $width = $maxWidth - $this->strlen($key); + $messages[] = ' ['.$key.str_repeat(' ', $width).'] '.$value; + } + + $output->writeln($messages); + + $message = $question->getPrompt(); + } + + $output->write($message); + } + + /** + * Outputs an error message. + */ + protected function writeError(OutputInterface $output, \Exception $error) + { + if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) { + $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error'); + } else { + $message = ''.$error->getMessage().''; + } + + $output->writeln($message); + } + /** * Autocompletes a question. * * @param OutputInterface $output * @param Question $question + * @param resource $inputStream + * @param array $autocomplete * * @return string */ - private function autocomplete(OutputInterface $output, Question $question, $inputStream) + private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete) { - $autocomplete = $question->getAutocompleterValues(); $ret = ''; $i = 0; @@ -193,12 +224,12 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu // Backspace Character if ("\177" === $c) { if (0 === $numMatches && 0 !== $i) { - $i--; + --$i; // Move cursor backwards $output->write("\033[1D"); } - if ($i === 0) { + if (0 === $i) { $ofs = -1; $matches = $autocomplete; $numMatches = count($matches); @@ -246,14 +277,14 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu } else { $output->write($c); $ret .= $c; - $i++; + ++$i; $numMatches = 0; $ofs = 0; foreach ($autocomplete as $value) { // If typed characters match the beginning chunk of value (e.g. [AcmeDe]moBundle) - if (0 === strpos($value, $ret) && $i !== strlen($value)) { + if (0 === strpos($value, $ret)) { $matches[$numMatches++] = $value; } } @@ -266,7 +297,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu // Save cursor position $output->write("\0337"); // Write highlighted text - $output->write(''.substr($matches[$ofs], $i).''); + $output->write(''.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).''); // Restore cursor position $output->write("\0338"); } @@ -281,7 +312,8 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu /** * Gets a hidden response from user. * - * @param OutputInterface $output An Output instance + * @param OutputInterface $output An Output instance + * @param resource $inputStream The handler resource * * @return string The answer * @@ -317,7 +349,7 @@ private function getHiddenResponse(OutputInterface $output, $inputStream) shell_exec(sprintf('stty %s', $sttyMode)); if (false === $value) { - throw new \RuntimeException('Aborted'); + throw new RuntimeException('Aborted'); } $value = trim($value); @@ -327,7 +359,7 @@ private function getHiddenResponse(OutputInterface $output, $inputStream) } if (false !== $shell = $this->getShell()) { - $readCmd = $shell === 'csh' ? 'set mypassword = $<' : 'read -r mypassword'; + $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword'; $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd); $value = rtrim(shell_exec($command)); $output->writeln(''); @@ -335,7 +367,7 @@ private function getHiddenResponse(OutputInterface $output, $inputStream) return $value; } - throw new \RuntimeException('Unable to hide the response.'); + throw new RuntimeException('Unable to hide the response.'); } /** @@ -345,7 +377,7 @@ private function getHiddenResponse(OutputInterface $output, $inputStream) * @param OutputInterface $output An Output instance * @param Question $question A Question instance * - * @return string The validated response + * @return mixed The validated response * * @throws \Exception In case the max number of attempts has been reached and no valid response has been given */ @@ -355,17 +387,13 @@ private function validateAttempts($interviewer, OutputInterface $output, Questio $attempts = $question->getMaxAttempts(); while (null === $attempts || $attempts--) { if (null !== $error) { - if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) { - $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error'); - } else { - $message = ''.$error->getMessage().''; - } - - $output->writeln($message); + $this->writeError($output, $error); } try { return call_user_func($question->getValidator(), $interviewer()); + } catch (RuntimeException $e) { + throw $e; } catch (\Exception $error) { } } @@ -413,6 +441,6 @@ private function hasSttyAvailable() exec('stty 2>&1', $output, $exitcode); - return self::$stty = $exitcode === 0; + return self::$stty = 0 === $exitcode; } } diff --git a/application/vendor/symfony/console/Helper/SymfonyQuestionHelper.php b/application/vendor/symfony/console/Helper/SymfonyQuestionHelper.php new file mode 100644 index 0000000..e51e422 --- /dev/null +++ b/application/vendor/symfony/console/Helper/SymfonyQuestionHelper.php @@ -0,0 +1,119 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Helper; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Question\ChoiceQuestion; +use Symfony\Component\Console\Question\ConfirmationQuestion; +use Symfony\Component\Console\Question\Question; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Console\Formatter\OutputFormatter; + +/** + * Symfony Style Guide compliant question helper. + * + * @author Kevin Bond + */ +class SymfonyQuestionHelper extends QuestionHelper +{ + /** + * {@inheritdoc} + */ + public function ask(InputInterface $input, OutputInterface $output, Question $question) + { + $validator = $question->getValidator(); + $question->setValidator(function ($value) use ($validator) { + if (null !== $validator) { + $value = $validator($value); + } else { + // make required + if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) { + throw new \Exception('A value is required.'); + } + } + + return $value; + }); + + return parent::ask($input, $output, $question); + } + + /** + * {@inheritdoc} + */ + protected function writePrompt(OutputInterface $output, Question $question) + { + $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion()); + $default = $question->getDefault(); + + switch (true) { + case null === $default: + $text = sprintf(' %s:', $text); + + break; + + case $question instanceof ConfirmationQuestion: + $text = sprintf(' %s (yes/no) [%s]:', $text, $default ? 'yes' : 'no'); + + break; + + case $question instanceof ChoiceQuestion && $question->isMultiselect(): + $choices = $question->getChoices(); + $default = explode(',', $default); + + foreach ($default as $key => $value) { + $default[$key] = $choices[trim($value)]; + } + + $text = sprintf(' %s [%s]:', $text, OutputFormatter::escape(implode(', ', $default))); + + break; + + case $question instanceof ChoiceQuestion: + $choices = $question->getChoices(); + $text = sprintf(' %s [%s]:', $text, OutputFormatter::escape($choices[$default])); + + break; + + default: + $text = sprintf(' %s [%s]:', $text, OutputFormatter::escape($default)); + } + + $output->writeln($text); + + if ($question instanceof ChoiceQuestion) { + $width = max(array_map('strlen', array_keys($question->getChoices()))); + + foreach ($question->getChoices() as $key => $value) { + $output->writeln(sprintf(" [%-${width}s] %s", $key, $value)); + } + } + + $output->write(' > '); + } + + /** + * {@inheritdoc} + */ + protected function writeError(OutputInterface $output, \Exception $error) + { + if ($output instanceof SymfonyStyle) { + $output->newLine(); + $output->error($error->getMessage()); + + return; + } + + parent::writeError($output, $error); + } +} diff --git a/application/vendor/symfony/console/Helper/Table.php b/application/vendor/symfony/console/Helper/Table.php new file mode 100644 index 0000000..15ad1ed --- /dev/null +++ b/application/vendor/symfony/console/Helper/Table.php @@ -0,0 +1,617 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Helper; + +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Provides helpers to display a table. + * + * @author Fabien Potencier + * @author Саша Стаменковић + * @author Abdellatif Ait boudad + */ +class Table +{ + /** + * Table headers. + */ + private $headers = array(); + + /** + * Table rows. + */ + private $rows = array(); + + /** + * Column widths cache. + */ + private $columnWidths = array(); + + /** + * Number of columns cache. + * + * @var int + */ + private $numberOfColumns; + + /** + * @var OutputInterface + */ + private $output; + + /** + * @var TableStyle + */ + private $style; + + private static $styles; + + public function __construct(OutputInterface $output) + { + $this->output = $output; + + if (!self::$styles) { + self::$styles = self::initStyles(); + } + + $this->setStyle('default'); + } + + /** + * Sets a style definition. + * + * @param string $name The style name + * @param TableStyle $style A TableStyle instance + */ + public static function setStyleDefinition($name, TableStyle $style) + { + if (!self::$styles) { + self::$styles = self::initStyles(); + } + + self::$styles[$name] = $style; + } + + /** + * Gets a style definition by name. + * + * @param string $name The style name + * + * @return TableStyle + */ + public static function getStyleDefinition($name) + { + if (!self::$styles) { + self::$styles = self::initStyles(); + } + + if (isset(self::$styles[$name])) { + return self::$styles[$name]; + } + + throw new \InvalidArgumentException(sprintf('Style "%s" is not defined.', $name)); + } + + /** + * Sets table style. + * + * @param TableStyle|string $name The style name or a TableStyle instance + * + * @return $this + */ + public function setStyle($name) + { + $this->style = $this->resolveStyle($name); + + return $this; + } + + /** + * Gets the current table style. + * + * @return TableStyle + */ + public function getStyle() + { + return $this->style; + } + + public function setHeaders(array $headers) + { + $headers = array_values($headers); + if (!empty($headers) && !is_array($headers[0])) { + $headers = array($headers); + } + + $this->headers = $headers; + + return $this; + } + + public function setRows(array $rows) + { + $this->rows = array(); + + return $this->addRows($rows); + } + + public function addRows(array $rows) + { + foreach ($rows as $row) { + $this->addRow($row); + } + + return $this; + } + + public function addRow($row) + { + if ($row instanceof TableSeparator) { + $this->rows[] = $row; + + return $this; + } + + if (!is_array($row)) { + throw new \InvalidArgumentException('A row must be an array or a TableSeparator instance.'); + } + + $this->rows[] = array_values($row); + + return $this; + } + + public function setRow($column, array $row) + { + $this->rows[$column] = $row; + + return $this; + } + + /** + * Renders table to output. + * + * Example: + * + * +---------------+-----------------------+------------------+ + * | ISBN | Title | Author | + * +---------------+-----------------------+------------------+ + * | 99921-58-10-7 | Divine Comedy | Dante Alighieri | + * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | + * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | + * +---------------+-----------------------+------------------+ + * + */ + public function render() + { + $this->calculateNumberOfColumns(); + $this->rows = $this->buildTableRows($this->rows); + $this->headers = $this->buildTableRows($this->headers); + + $this->renderRowSeparator(); + if (!empty($this->headers)) { + foreach ($this->headers as $header) { + $this->renderRow($header, $this->style->getCellHeaderFormat()); + $this->renderRowSeparator(); + } + } + foreach ($this->rows as $row) { + if ($row instanceof TableSeparator) { + $this->renderRowSeparator(); + } else { + $this->renderRow($row, $this->style->getCellRowFormat()); + } + } + if (!empty($this->rows)) { + $this->renderRowSeparator(); + } + + $this->cleanup(); + } + + /** + * Renders horizontal header separator. + * + * Example: +-----+-----------+-------+ + */ + private function renderRowSeparator() + { + if (0 === $count = $this->numberOfColumns) { + return; + } + + if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) { + return; + } + + $markup = $this->style->getCrossingChar(); + for ($column = 0; $column < $count; ++$column) { + $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->getColumnWidth($column)).$this->style->getCrossingChar(); + } + + $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup)); + } + + /** + * Renders vertical column separator. + */ + private function renderColumnSeparator() + { + return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()); + } + + /** + * Renders table row. + * + * Example: | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | + * + * @param array $row + * @param string $cellFormat + */ + private function renderRow(array $row, $cellFormat) + { + if (empty($row)) { + return; + } + + $rowContent = $this->renderColumnSeparator(); + foreach ($this->getRowColumns($row) as $column) { + $rowContent .= $this->renderCell($row, $column, $cellFormat); + $rowContent .= $this->renderColumnSeparator(); + } + $this->output->writeln($rowContent); + } + + /** + * Renders table cell with padding. + * + * @param array $row + * @param int $column + * @param string $cellFormat + */ + private function renderCell(array $row, $column, $cellFormat) + { + $cell = isset($row[$column]) ? $row[$column] : ''; + $width = $this->getColumnWidth($column); + if ($cell instanceof TableCell && $cell->getColspan() > 1) { + // add the width of the following columns(numbers of colspan). + foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) { + $width += $this->getColumnSeparatorWidth() + $this->getColumnWidth($nextColumn); + } + } + + // str_pad won't work properly with multi-byte strings, we need to fix the padding + if (function_exists('mb_strwidth') && false !== $encoding = mb_detect_encoding($cell)) { + $width += strlen($cell) - mb_strwidth($cell, $encoding); + } + + if ($cell instanceof TableSeparator) { + return sprintf($this->style->getBorderFormat(), str_repeat($this->style->getHorizontalBorderChar(), $width)); + } + + $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell); + $content = sprintf($this->style->getCellRowContentFormat(), $cell); + + return sprintf($cellFormat, str_pad($content, $width, $this->style->getPaddingChar(), $this->style->getPadType())); + } + + /** + * Calculate number of columns for this table. + */ + private function calculateNumberOfColumns() + { + if (null !== $this->numberOfColumns) { + return; + } + + $columns = array(0); + foreach (array_merge($this->headers, $this->rows) as $row) { + if ($row instanceof TableSeparator) { + continue; + } + + $columns[] = $this->getNumberOfColumns($row); + } + + $this->numberOfColumns = max($columns); + } + + private function buildTableRows($rows) + { + $unmergedRows = array(); + for ($rowKey = 0; $rowKey < count($rows); ++$rowKey) { + $rows = $this->fillNextRows($rows, $rowKey); + + // Remove any new line breaks and replace it with a new line + foreach ($rows[$rowKey] as $column => $cell) { + if (!strstr($cell, "\n")) { + continue; + } + $lines = explode("\n", str_replace("\n", "\n", $cell)); + foreach ($lines as $lineKey => $line) { + if ($cell instanceof TableCell) { + $line = new TableCell($line, array('colspan' => $cell->getColspan())); + } + if (0 === $lineKey) { + $rows[$rowKey][$column] = $line; + } else { + $unmergedRows[$rowKey][$lineKey][$column] = $line; + } + } + } + } + + $tableRows = array(); + foreach ($rows as $rowKey => $row) { + $tableRows[] = $this->fillCells($row); + if (isset($unmergedRows[$rowKey])) { + $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]); + } + } + + return $tableRows; + } + + /** + * fill rows that contains rowspan > 1. + * + * @param array $rows + * @param int $line + * + * @return array + */ + private function fillNextRows(array $rows, $line) + { + $unmergedRows = array(); + foreach ($rows[$line] as $column => $cell) { + if ($cell instanceof TableCell && $cell->getRowspan() > 1) { + $nbLines = $cell->getRowspan() - 1; + $lines = array($cell); + if (strstr($cell, "\n")) { + $lines = explode("\n", str_replace("\n", "\n", $cell)); + $nbLines = count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines; + + $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan())); + unset($lines[0]); + } + + // create a two dimensional array (rowspan x colspan) + $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows); + foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) { + $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : ''; + $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan())); + if ($nbLines === $unmergedRowKey - $line) { + break; + } + } + } + } + + foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) { + // we need to know if $unmergedRow will be merged or inserted into $rows + if (isset($rows[$unmergedRowKey]) && is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) { + foreach ($unmergedRow as $cellKey => $cell) { + // insert cell into row at cellKey position + array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell)); + } + } else { + $row = $this->copyRow($rows, $unmergedRowKey - 1); + foreach ($unmergedRow as $column => $cell) { + if (!empty($cell)) { + $row[$column] = $unmergedRow[$column]; + } + } + array_splice($rows, $unmergedRowKey, 0, array($row)); + } + } + + return $rows; + } + + /** + * fill cells for a row that contains colspan > 1. + * + * @return array + */ + private function fillCells($row) + { + $newRow = array(); + foreach ($row as $column => $cell) { + $newRow[] = $cell; + if ($cell instanceof TableCell && $cell->getColspan() > 1) { + foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) { + // insert empty value at column position + $newRow[] = ''; + } + } + } + + return $newRow ?: $row; + } + + /** + * @param array $rows + * @param int $line + * + * @return array + */ + private function copyRow(array $rows, $line) + { + $row = $rows[$line]; + foreach ($row as $cellKey => $cellValue) { + $row[$cellKey] = ''; + if ($cellValue instanceof TableCell) { + $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan())); + } + } + + return $row; + } + + /** + * Gets number of columns by row. + * + * @return int + */ + private function getNumberOfColumns(array $row) + { + $columns = count($row); + foreach ($row as $column) { + $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0; + } + + return $columns; + } + + /** + * Gets list of columns for the given row. + * + * @return array + */ + private function getRowColumns(array $row) + { + $columns = range(0, $this->numberOfColumns - 1); + foreach ($row as $cellKey => $cell) { + if ($cell instanceof TableCell && $cell->getColspan() > 1) { + // exclude grouped columns. + $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1)); + } + } + + return $columns; + } + + /** + * Gets column width. + * + * @param int $column + * + * @return int + */ + private function getColumnWidth($column) + { + if (isset($this->columnWidths[$column])) { + return $this->columnWidths[$column]; + } + + $lengths = array(); + + foreach (array_merge($this->headers, $this->rows) as $row) { + if ($row instanceof TableSeparator) { + continue; + } + + foreach ($row as $i => $cell) { + if ($cell instanceof TableCell) { + $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell); + $textLength = Helper::strlen($textContent); + if ($textLength > 0) { + $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan())); + foreach ($contentColumns as $position => $content) { + $row[$i + $position] = $content; + } + } + } + } + + $lengths[] = $this->getCellWidth($row, $column); + } + + return $this->columnWidths[$column] = max($lengths) + strlen($this->style->getCellRowContentFormat()) - 2; + } + + /** + * Gets column width. + * + * @return int + */ + private function getColumnSeparatorWidth() + { + return strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar())); + } + + /** + * Gets cell width. + * + * @param array $row + * @param int $column + * + * @return int + */ + private function getCellWidth(array $row, $column) + { + if (isset($row[$column])) { + $cell = $row[$column]; + $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell); + + return $cellWidth; + } + + return 0; + } + + /** + * Called after rendering to cleanup cache data. + */ + private function cleanup() + { + $this->columnWidths = array(); + $this->numberOfColumns = null; + } + + private static function initStyles() + { + $borderless = new TableStyle(); + $borderless + ->setHorizontalBorderChar('=') + ->setVerticalBorderChar(' ') + ->setCrossingChar(' ') + ; + + $compact = new TableStyle(); + $compact + ->setHorizontalBorderChar('') + ->setVerticalBorderChar(' ') + ->setCrossingChar('') + ->setCellRowContentFormat('%s') + ; + + $styleGuide = new TableStyle(); + $styleGuide + ->setHorizontalBorderChar('-') + ->setVerticalBorderChar(' ') + ->setCrossingChar(' ') + ->setCellHeaderFormat('%s') + ; + + return array( + 'default' => new TableStyle(), + 'borderless' => $borderless, + 'compact' => $compact, + 'symfony-style-guide' => $styleGuide, + ); + } + + private function resolveStyle($name) + { + if ($name instanceof TableStyle) { + return $name; + } + + if (isset(self::$styles[$name])) { + return self::$styles[$name]; + } + + throw new \InvalidArgumentException(sprintf('Style "%s" is not defined.', $name)); + } +} diff --git a/application/vendor/symfony/console/Helper/TableCell.php b/application/vendor/symfony/console/Helper/TableCell.php new file mode 100644 index 0000000..8562f72 --- /dev/null +++ b/application/vendor/symfony/console/Helper/TableCell.php @@ -0,0 +1,74 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Helper; + +/** + * @author Abdellatif Ait boudad + */ +class TableCell +{ + private $value; + private $options = array( + 'rowspan' => 1, + 'colspan' => 1, + ); + + /** + * @param string $value + * @param array $options + */ + public function __construct($value = '', array $options = array()) + { + if (is_numeric($value) && !is_string($value)) { + $value = (string) $value; + } + + $this->value = $value; + + // check option names + if ($diff = array_diff(array_keys($options), array_keys($this->options))) { + throw new \InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff))); + } + + $this->options = array_merge($this->options, $options); + } + + /** + * Returns the cell value. + * + * @return string + */ + public function __toString() + { + return $this->value; + } + + /** + * Gets number of colspan. + * + * @return int + */ + public function getColspan() + { + return (int) $this->options['colspan']; + } + + /** + * Gets number of rowspan. + * + * @return int + */ + public function getRowspan() + { + return (int) $this->options['rowspan']; + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/TableHelper.php b/application/vendor/symfony/console/Helper/TableHelper.php similarity index 89% rename from application/vendor/symfony/console/Symfony/Component/Console/Helper/TableHelper.php rename to application/vendor/symfony/console/Helper/TableHelper.php index fc6861c..b03f51f 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Helper/TableHelper.php +++ b/application/vendor/symfony/console/Helper/TableHelper.php @@ -20,7 +20,8 @@ * @author Саша Стаменковић * @author Fabien Potencier * - * @deprecated Deprecated since 2.5, to be removed in 3.0; use Table instead. + * @deprecated since version 2.5, to be removed in 3.0 + * Use {@link Table} instead. */ class TableHelper extends Helper { @@ -28,13 +29,14 @@ class TableHelper extends Helper const LAYOUT_BORDERLESS = 1; const LAYOUT_COMPACT = 2; - /** - * @var Table - */ private $table; - public function __construct() + public function __construct($triggerDeprecationError = true) { + if ($triggerDeprecationError) { + @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED); + } + $this->table = new Table(new NullOutput()); } @@ -43,7 +45,7 @@ public function __construct() * * @param int $layout self::LAYOUT_* * - * @return TableHelper + * @return $this * * @throws \InvalidArgumentException when the table layout is not known */ @@ -64,7 +66,7 @@ public function setLayout($layout) default: throw new \InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout)); - }; + } return $this; } @@ -109,7 +111,7 @@ public function setRow($column, array $row) * * @param string $paddingChar * - * @return TableHelper + * @return $this */ public function setPaddingChar($paddingChar) { @@ -123,7 +125,7 @@ public function setPaddingChar($paddingChar) * * @param string $horizontalBorderChar * - * @return TableHelper + * @return $this */ public function setHorizontalBorderChar($horizontalBorderChar) { @@ -137,7 +139,7 @@ public function setHorizontalBorderChar($horizontalBorderChar) * * @param string $verticalBorderChar * - * @return TableHelper + * @return $this */ public function setVerticalBorderChar($verticalBorderChar) { @@ -151,7 +153,7 @@ public function setVerticalBorderChar($verticalBorderChar) * * @param string $crossingChar * - * @return TableHelper + * @return $this */ public function setCrossingChar($crossingChar) { @@ -165,7 +167,7 @@ public function setCrossingChar($crossingChar) * * @param string $cellHeaderFormat * - * @return TableHelper + * @return $this */ public function setCellHeaderFormat($cellHeaderFormat) { @@ -179,7 +181,7 @@ public function setCellHeaderFormat($cellHeaderFormat) * * @param string $cellRowFormat * - * @return TableHelper + * @return $this */ public function setCellRowFormat($cellRowFormat) { @@ -193,7 +195,7 @@ public function setCellRowFormat($cellRowFormat) * * @param string $cellRowContentFormat * - * @return TableHelper + * @return $this */ public function setCellRowContentFormat($cellRowContentFormat) { @@ -207,7 +209,7 @@ public function setCellRowContentFormat($cellRowContentFormat) * * @param string $borderFormat * - * @return TableHelper + * @return $this */ public function setBorderFormat($borderFormat) { @@ -221,7 +223,7 @@ public function setBorderFormat($borderFormat) * * @param int $padType STR_PAD_* * - * @return TableHelper + * @return $this */ public function setPadType($padType) { @@ -241,8 +243,6 @@ public function setPadType($padType) * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | * +---------------+-----------------------+------------------+ - * - * @param OutputInterface $output */ public function render(OutputInterface $output) { diff --git a/application/vendor/symfony/console/Helper/TableSeparator.php b/application/vendor/symfony/console/Helper/TableSeparator.php new file mode 100644 index 0000000..c7b8dc9 --- /dev/null +++ b/application/vendor/symfony/console/Helper/TableSeparator.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Helper; + +/** + * Marks a row as being a separator. + * + * @author Fabien Potencier + */ +class TableSeparator extends TableCell +{ + public function __construct(array $options = array()) + { + parent::__construct('', $options); + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/TableStyle.php b/application/vendor/symfony/console/Helper/TableStyle.php similarity index 91% rename from application/vendor/symfony/console/Symfony/Component/Console/Helper/TableStyle.php rename to application/vendor/symfony/console/Helper/TableStyle.php index 580f9ab..b00f12e 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Helper/TableStyle.php +++ b/application/vendor/symfony/console/Helper/TableStyle.php @@ -34,7 +34,7 @@ class TableStyle * * @param string $paddingChar * - * @return TableStyle + * @return $this */ public function setPaddingChar($paddingChar) { @@ -62,7 +62,7 @@ public function getPaddingChar() * * @param string $horizontalBorderChar * - * @return TableStyle + * @return $this */ public function setHorizontalBorderChar($horizontalBorderChar) { @@ -86,7 +86,7 @@ public function getHorizontalBorderChar() * * @param string $verticalBorderChar * - * @return TableStyle + * @return $this */ public function setVerticalBorderChar($verticalBorderChar) { @@ -110,7 +110,7 @@ public function getVerticalBorderChar() * * @param string $crossingChar * - * @return TableStyle + * @return $this */ public function setCrossingChar($crossingChar) { @@ -134,7 +134,7 @@ public function getCrossingChar() * * @param string $cellHeaderFormat * - * @return TableStyle + * @return $this */ public function setCellHeaderFormat($cellHeaderFormat) { @@ -158,7 +158,7 @@ public function getCellHeaderFormat() * * @param string $cellRowFormat * - * @return TableStyle + * @return $this */ public function setCellRowFormat($cellRowFormat) { @@ -182,7 +182,7 @@ public function getCellRowFormat() * * @param string $cellRowContentFormat * - * @return TableStyle + * @return $this */ public function setCellRowContentFormat($cellRowContentFormat) { @@ -206,7 +206,7 @@ public function getCellRowContentFormat() * * @param string $borderFormat * - * @return TableStyle + * @return $this */ public function setBorderFormat($borderFormat) { @@ -230,10 +230,14 @@ public function getBorderFormat() * * @param int $padType STR_PAD_* * - * @return TableStyle + * @return $this */ public function setPadType($padType) { + if (!in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) { + throw new \InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).'); + } + $this->padType = $padType; return $this; diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php b/application/vendor/symfony/console/Input/ArgvInput.php similarity index 81% rename from application/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php rename to application/vendor/symfony/console/Input/ArgvInput.php index 43cbe72..62c658b 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php +++ b/application/vendor/symfony/console/Input/ArgvInput.php @@ -35,8 +35,6 @@ * * @see http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html * @see http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02 - * - * @api */ class ArgvInput extends Input { @@ -44,12 +42,8 @@ class ArgvInput extends Input private $parsed; /** - * Constructor. - * - * @param array $argv An array of parameters from the CLI (in the argv format) - * @param InputDefinition $definition A InputDefinition instance - * - * @api + * @param array|null $argv An array of parameters from the CLI (in the argv format) + * @param InputDefinition|null $definition A InputDefinition instance */ public function __construct(array $argv = null, InputDefinition $definition = null) { @@ -71,7 +65,7 @@ protected function setTokens(array $tokens) } /** - * Processes command line arguments. + * {@inheritdoc} */ protected function parse() { @@ -95,7 +89,7 @@ protected function parse() /** * Parses a short option. * - * @param string $token The current token. + * @param string $token The current token */ private function parseShortOption($token) { @@ -149,7 +143,10 @@ private function parseLongOption($token) $name = substr($token, 2); if (false !== $pos = strpos($name, '=')) { - $this->addLongOption(substr($name, 0, $pos), substr($name, $pos + 1)); + if (0 === strlen($value = substr($name, $pos + 1))) { + array_unshift($this->parsed, null); + } + $this->addLongOption(substr($name, 0, $pos), $value); } else { $this->addLongOption($name, null); } @@ -178,7 +175,12 @@ private function parseArgument($token) // unexpected argument } else { - throw new \RuntimeException('Too many arguments.'); + $all = $this->definition->getArguments(); + if (count($all)) { + throw new \RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all)))); + } + + throw new \RuntimeException(sprintf('No arguments expected, got "%s".', $token)); } } @@ -215,8 +217,8 @@ private function addLongOption($name, $value) $option = $this->definition->getOption($name); - // Convert false values (from a previous call to substr()) to null - if (false === $value) { + // Convert empty values to null + if (!isset($value[0])) { $value = null; } @@ -231,7 +233,7 @@ private function addLongOption($name, $value) if (isset($next[0]) && '-' !== $next[0]) { $value = $next; } elseif (empty($next)) { - $value = ''; + $value = null; } else { array_unshift($this->parsed, $next); } @@ -255,9 +257,7 @@ private function addLongOption($name, $value) } /** - * Returns the first argument from the raw parameters (not parsed). - * - * @return string The value of the first argument or null otherwise + * {@inheritdoc} */ public function getFirstArgument() { @@ -271,14 +271,7 @@ public function getFirstArgument() } /** - * Returns true if the raw parameters (not parsed) contain a value. - * - * This method is to be used to introspect the input parameters - * before they have been validated. It must be used carefully. - * - * @param string|array $values The value(s) to look for in the raw parameters (can be an array) - * - * @return bool true if the value is contained in the raw parameters + * {@inheritdoc} */ public function hasParameterOption($values) { @@ -286,7 +279,11 @@ public function hasParameterOption($values) foreach ($this->tokens as $token) { foreach ($values as $value) { - if ($token === $value || 0 === strpos($token, $value.'=')) { + // Options with values: + // For long options, test for '--option=' at beginning + // For short options, test for '-o' at beginning + $leading = 0 === strpos($value, '--') ? $value.'=' : $value; + if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) { return true; } } @@ -296,15 +293,7 @@ public function hasParameterOption($values) } /** - * Returns the value of a raw option (not parsed). - * - * This method is to be used to introspect the input parameters - * before they have been validated. It must be used carefully. - * - * @param string|array $values The value(s) to look for in the raw parameters (can be an array) - * @param mixed $default The default value to return if no result is found - * - * @return mixed The option value + * {@inheritdoc} */ public function getParameterOption($values, $default = false) { @@ -315,13 +304,16 @@ public function getParameterOption($values, $default = false) $token = array_shift($tokens); foreach ($values as $value) { - if ($token === $value || 0 === strpos($token, $value.'=')) { - if (false !== $pos = strpos($token, '=')) { - return substr($token, $pos + 1); - } - + if ($token === $value) { return array_shift($tokens); } + // Options with values: + // For long options, test for '--option=' at beginning + // For short options, test for '-o' at beginning + $leading = 0 === strpos($value, '--') ? $value.'=' : $value; + if ('' !== $leading && 0 === strpos($token, $leading)) { + return substr($token, strlen($leading)); + } } } @@ -341,7 +333,7 @@ public function __toString() return $match[1].$self->escapeToken($match[2]); } - if ($token && $token[0] !== '-') { + if ($token && '-' !== $token[0]) { return $self->escapeToken($token); } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Input/ArrayInput.php b/application/vendor/symfony/console/Input/ArrayInput.php similarity index 76% rename from application/vendor/symfony/console/Symfony/Component/Console/Input/ArrayInput.php rename to application/vendor/symfony/console/Input/ArrayInput.php index 5743bb8..eb921fd 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Input/ArrayInput.php +++ b/application/vendor/symfony/console/Input/ArrayInput.php @@ -19,21 +19,11 @@ * $input = new ArrayInput(array('name' => 'foo', '--bar' => 'foobar')); * * @author Fabien Potencier - * - * @api */ class ArrayInput extends Input { private $parameters; - /** - * Constructor. - * - * @param array $parameters An array of parameters - * @param InputDefinition $definition A InputDefinition instance - * - * @api - */ public function __construct(array $parameters, InputDefinition $definition = null) { $this->parameters = $parameters; @@ -42,9 +32,7 @@ public function __construct(array $parameters, InputDefinition $definition = nul } /** - * Returns the first argument from the raw parameters (not parsed). - * - * @return string The value of the first argument or null otherwise + * {@inheritdoc} */ public function getFirstArgument() { @@ -58,14 +46,7 @@ public function getFirstArgument() } /** - * Returns true if the raw parameters (not parsed) contain a value. - * - * This method is to be used to introspect the input parameters - * before they have been validated. It must be used carefully. - * - * @param string|array $values The values to look for in the raw parameters (can be an array) - * - * @return bool true if the value is contained in the raw parameters + * {@inheritdoc} */ public function hasParameterOption($values) { @@ -85,15 +66,7 @@ public function hasParameterOption($values) } /** - * Returns the value of a raw option (not parsed). - * - * This method is to be used to introspect the input parameters - * before they have been validated. It must be used carefully. - * - * @param string|array $values The value(s) to look for in the raw parameters (can be an array) - * @param mixed $default The default value to return if no result is found - * - * @return mixed The option value + * {@inheritdoc} */ public function getParameterOption($values, $default = false) { @@ -122,9 +95,15 @@ public function __toString() $params = array(); foreach ($this->parameters as $param => $val) { if ($param && '-' === $param[0]) { - $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : ''); + if (is_array($val)) { + foreach ($val as $v) { + $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : ''); + } + } else { + $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : ''); + } } else { - $params[] = $this->escapeToken($val); + $params[] = is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val); } } @@ -132,7 +111,7 @@ public function __toString() } /** - * Processes command line arguments. + * {@inheritdoc} */ protected function parse() { diff --git a/application/vendor/symfony/console/Input/Input.php b/application/vendor/symfony/console/Input/Input.php new file mode 100644 index 0000000..16f8279 --- /dev/null +++ b/application/vendor/symfony/console/Input/Input.php @@ -0,0 +1,183 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Input; + +/** + * Input is the base class for all concrete Input classes. + * + * Three concrete classes are provided by default: + * + * * `ArgvInput`: The input comes from the CLI arguments (argv) + * * `StringInput`: The input is provided as a string + * * `ArrayInput`: The input is provided as an array + * + * @author Fabien Potencier + */ +abstract class Input implements InputInterface +{ + protected $definition; + protected $options = array(); + protected $arguments = array(); + protected $interactive = true; + + public function __construct(InputDefinition $definition = null) + { + if (null === $definition) { + $this->definition = new InputDefinition(); + } else { + $this->bind($definition); + $this->validate(); + } + } + + /** + * {@inheritdoc} + */ + public function bind(InputDefinition $definition) + { + $this->arguments = array(); + $this->options = array(); + $this->definition = $definition; + + $this->parse(); + } + + /** + * Processes command line arguments. + */ + abstract protected function parse(); + + /** + * {@inheritdoc} + */ + public function validate() + { + $definition = $this->definition; + $givenArguments = $this->arguments; + + $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) { + return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired(); + }); + + if (count($missingArguments) > 0) { + throw new \RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments))); + } + } + + /** + * {@inheritdoc} + */ + public function isInteractive() + { + return $this->interactive; + } + + /** + * {@inheritdoc} + */ + public function setInteractive($interactive) + { + $this->interactive = (bool) $interactive; + } + + /** + * {@inheritdoc} + */ + public function getArguments() + { + return array_merge($this->definition->getArgumentDefaults(), $this->arguments); + } + + /** + * {@inheritdoc} + */ + public function getArgument($name) + { + if (!$this->definition->hasArgument($name)) { + throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); + } + + return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault(); + } + + /** + * {@inheritdoc} + */ + public function setArgument($name, $value) + { + if (!$this->definition->hasArgument($name)) { + throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); + } + + $this->arguments[$name] = $value; + } + + /** + * {@inheritdoc} + */ + public function hasArgument($name) + { + return $this->definition->hasArgument($name); + } + + /** + * {@inheritdoc} + */ + public function getOptions() + { + return array_merge($this->definition->getOptionDefaults(), $this->options); + } + + /** + * {@inheritdoc} + */ + public function getOption($name) + { + if (!$this->definition->hasOption($name)) { + throw new \InvalidArgumentException(sprintf('The "%s" option does not exist.', $name)); + } + + return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault(); + } + + /** + * {@inheritdoc} + */ + public function setOption($name, $value) + { + if (!$this->definition->hasOption($name)) { + throw new \InvalidArgumentException(sprintf('The "%s" option does not exist.', $name)); + } + + $this->options[$name] = $value; + } + + /** + * {@inheritdoc} + */ + public function hasOption($name) + { + return $this->definition->hasOption($name); + } + + /** + * Escapes a token through escapeshellarg if it contains unsafe chars. + * + * @param string $token + * + * @return string + */ + public function escapeToken($token) + { + return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token); + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Input/InputArgument.php b/application/vendor/symfony/console/Input/InputArgument.php similarity index 98% rename from application/vendor/symfony/console/Symfony/Component/Console/Input/InputArgument.php rename to application/vendor/symfony/console/Input/InputArgument.php index 1167da9..29b8001 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Input/InputArgument.php +++ b/application/vendor/symfony/console/Input/InputArgument.php @@ -15,8 +15,6 @@ * Represents a command line argument. * * @author Fabien Potencier - * - * @api */ class InputArgument { @@ -30,16 +28,12 @@ class InputArgument private $description; /** - * Constructor. - * * @param string $name The argument name * @param int $mode The argument mode: self::REQUIRED or self::OPTIONAL * @param string $description A description text * @param mixed $default The default value (for self::OPTIONAL mode only) * * @throws \InvalidArgumentException When argument mode is not valid - * - * @api */ public function __construct($name, $mode = null, $description = '', $default = null) { diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Input/InputAwareInterface.php b/application/vendor/symfony/console/Input/InputAwareInterface.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Input/InputAwareInterface.php rename to application/vendor/symfony/console/Input/InputAwareInterface.php diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Input/InputDefinition.php b/application/vendor/symfony/console/Input/InputDefinition.php similarity index 85% rename from application/vendor/symfony/console/Symfony/Component/Console/Input/InputDefinition.php rename to application/vendor/symfony/console/Input/InputDefinition.php index 48edb16..5e5a3ad 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Input/InputDefinition.php +++ b/application/vendor/symfony/console/Input/InputDefinition.php @@ -26,8 +26,6 @@ * )); * * @author Fabien Potencier - * - * @api */ class InputDefinition { @@ -39,11 +37,7 @@ class InputDefinition private $shortcuts; /** - * Constructor. - * * @param array $definition An array of InputArgument and InputOption instance - * - * @api */ public function __construct(array $definition = array()) { @@ -52,10 +46,6 @@ public function __construct(array $definition = array()) /** * Sets the definition of the input. - * - * @param array $definition The definition array - * - * @api */ public function setDefinition(array $definition) { @@ -77,8 +67,6 @@ public function setDefinition(array $definition) * Sets the InputArgument objects. * * @param InputArgument[] $arguments An array of InputArgument objects - * - * @api */ public function setArguments($arguments = array()) { @@ -93,8 +81,6 @@ public function setArguments($arguments = array()) * Adds an array of InputArgument objects. * * @param InputArgument[] $arguments An array of InputArgument objects - * - * @api */ public function addArguments($arguments = array()) { @@ -106,13 +92,7 @@ public function addArguments($arguments = array()) } /** - * Adds an InputArgument object. - * - * @param InputArgument $argument An InputArgument object - * * @throws \LogicException When incorrect argument is given - * - * @api */ public function addArgument(InputArgument $argument) { @@ -149,8 +129,6 @@ public function addArgument(InputArgument $argument) * @return InputArgument An InputArgument object * * @throws \InvalidArgumentException When argument given doesn't exist - * - * @api */ public function getArgument($name) { @@ -169,8 +147,6 @@ public function getArgument($name) * @param string|int $name The InputArgument name or position * * @return bool true if the InputArgument object exists, false otherwise - * - * @api */ public function hasArgument($name) { @@ -183,8 +159,6 @@ public function hasArgument($name) * Gets the array of InputArgument objects. * * @return InputArgument[] An array of InputArgument objects - * - * @api */ public function getArguments() { @@ -230,8 +204,6 @@ public function getArgumentDefaults() * Sets the InputOption objects. * * @param InputOption[] $options An array of InputOption objects - * - * @api */ public function setOptions($options = array()) { @@ -244,8 +216,6 @@ public function setOptions($options = array()) * Adds an array of InputOption objects. * * @param InputOption[] $options An array of InputOption objects - * - * @api */ public function addOptions($options = array()) { @@ -255,13 +225,7 @@ public function addOptions($options = array()) } /** - * Adds an InputOption object. - * - * @param InputOption $option An InputOption object - * * @throws \LogicException When option given already exist - * - * @api */ public function addOption(InputOption $option) { @@ -293,8 +257,6 @@ public function addOption(InputOption $option) * @return InputOption A InputOption object * * @throws \InvalidArgumentException When option given doesn't exist - * - * @api */ public function getOption($name) { @@ -308,11 +270,12 @@ public function getOption($name) /** * Returns true if an InputOption object exists by name. * + * This method can't be used to check if the user included the option when + * executing the command (use getOption() instead). + * * @param string $name The InputOption name * * @return bool true if the InputOption object exists, false otherwise - * - * @api */ public function hasOption($name) { @@ -323,8 +286,6 @@ public function hasOption($name) * Gets the array of InputOption objects. * * @return InputOption[] An array of InputOption objects - * - * @api */ public function getOptions() { @@ -346,7 +307,7 @@ public function hasShortcut($name) /** * Gets an InputOption by shortcut. * - * @param string $shortcut the Shortcut name + * @param string $shortcut The Shortcut name * * @return InputOption An InputOption object */ @@ -391,22 +352,50 @@ private function shortcutToName($shortcut) /** * Gets the synopsis. * + * @param bool $short Whether to return the short version (with options folded) or not + * * @return string The synopsis */ - public function getSynopsis() + public function getSynopsis($short = false) { $elements = array(); - foreach ($this->getOptions() as $option) { - $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : ''; - $elements[] = sprintf('['.($option->isValueRequired() ? '%s--%s="..."' : ($option->isValueOptional() ? '%s--%s[="..."]' : '%s--%s')).']', $shortcut, $option->getName()); + + if ($short && $this->getOptions()) { + $elements[] = '[options]'; + } elseif (!$short) { + foreach ($this->getOptions() as $option) { + $value = ''; + if ($option->acceptValue()) { + $value = sprintf( + ' %s%s%s', + $option->isValueOptional() ? '[' : '', + strtoupper($option->getName()), + $option->isValueOptional() ? ']' : '' + ); + } + + $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : ''; + $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value); + } + } + + if (count($elements) && $this->getArguments()) { + $elements[] = '[--]'; } foreach ($this->getArguments() as $argument) { - $elements[] = sprintf($argument->isRequired() ? '%s' : '[%s]', $argument->getName().($argument->isArray() ? '1' : '')); + $element = '<'.$argument->getName().'>'; + if (!$argument->isRequired()) { + $element = '['.$element.']'; + } elseif ($argument->isArray()) { + $element = $element.' ('.$element.')'; + } if ($argument->isArray()) { - $elements[] = sprintf('... [%sN]', $argument->getName()); + $element .= '...'; } + + $elements[] = $element; } return implode(' ', $elements); @@ -417,10 +406,12 @@ public function getSynopsis() * * @return string A string representing the InputDefinition * - * @deprecated Deprecated since version 2.3, to be removed in 3.0. + * @deprecated since version 2.3, to be removed in 3.0. */ public function asText() { + @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED); + $descriptor = new TextDescriptor(); $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true); $descriptor->describe($output, $this, array('raw_output' => true)); @@ -435,10 +426,12 @@ public function asText() * * @return string|\DOMDocument An XML string representing the InputDefinition * - * @deprecated Deprecated since version 2.3, to be removed in 3.0. + * @deprecated since version 2.3, to be removed in 3.0. */ public function asXml($asDom = false) { + @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED); + $descriptor = new XmlDescriptor(); if ($asDom) { diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Input/InputInterface.php b/application/vendor/symfony/console/Input/InputInterface.php similarity index 80% rename from application/vendor/symfony/console/Symfony/Component/Console/Input/InputInterface.php rename to application/vendor/symfony/console/Input/InputInterface.php index 6ef2f26..ac14de7 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Input/InputInterface.php +++ b/application/vendor/symfony/console/Input/InputInterface.php @@ -21,7 +21,7 @@ interface InputInterface /** * Returns the first argument from the raw parameters (not parsed). * - * @return string The value of the first argument or null otherwise + * @return string|null The value of the first argument or null otherwise */ public function getFirstArgument(); @@ -30,6 +30,8 @@ public function getFirstArgument(); * * This method is to be used to introspect the input parameters * before they have been validated. It must be used carefully. + * Does not necessarily return the correct result for short options + * when multiple flags are combined in the same option. * * @param string|array $values The values to look for in the raw parameters (can be an array) * @@ -42,6 +44,8 @@ public function hasParameterOption($values); * * This method is to be used to introspect the input parameters * before they have been validated. It must be used carefully. + * Does not necessarily return the correct result for short options + * when multiple flags are combined in the same option. * * @param string|array $values The value(s) to look for in the raw parameters (can be an array) * @param mixed $default The default value to return if no result is found @@ -52,17 +56,13 @@ public function getParameterOption($values, $default = false); /** * Binds the current Input instance with the given arguments and options. - * - * @param InputDefinition $definition A InputDefinition instance */ public function bind(InputDefinition $definition); /** - * Validates if arguments given are correct. - * - * Throws an exception when not enough arguments are given. + * Validates the input. * - * @throws \RuntimeException + * @throws \RuntimeException When not enough arguments are given */ public function validate(); @@ -74,11 +74,13 @@ public function validate(); public function getArguments(); /** - * Gets argument by name. + * Returns the argument value for a given argument name. * - * @param string $name The name of the argument + * @param string $name The argument name * - * @return mixed + * @return mixed The argument value + * + * @throws \InvalidArgumentException When argument given doesn't exist */ public function getArgument($name); @@ -109,11 +111,13 @@ public function hasArgument($name); public function getOptions(); /** - * Gets an option by name. + * Returns the option value for a given option name. * - * @param string $name The name of the option + * @param string $name The option name * - * @return mixed + * @return mixed The option value + * + * @throws \InvalidArgumentException When option given doesn't exist */ public function getOption($name); diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Input/InputOption.php b/application/vendor/symfony/console/Input/InputOption.php similarity index 96% rename from application/vendor/symfony/console/Symfony/Component/Console/Input/InputOption.php rename to application/vendor/symfony/console/Input/InputOption.php index 3a48ca3..c2b57c7 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Input/InputOption.php +++ b/application/vendor/symfony/console/Input/InputOption.php @@ -15,8 +15,6 @@ * Represents a command line option. * * @author Fabien Potencier - * - * @api */ class InputOption { @@ -32,17 +30,13 @@ class InputOption private $description; /** - * Constructor. - * * @param string $name The option name * @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts * @param int $mode The option mode: One of the VALUE_* constants * @param string $description A description text - * @param mixed $default The default value (must be null for self::VALUE_REQUIRED or self::VALUE_NONE) + * @param mixed $default The default value (must be null for self::VALUE_NONE) * * @throws \InvalidArgumentException If option mode is invalid or incompatible - * - * @api */ public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null) { @@ -196,11 +190,9 @@ public function getDescription() /** * Checks whether the given option equals this one. * - * @param InputOption $option option to compare - * * @return bool */ - public function equals(InputOption $option) + public function equals(self $option) { return $option->getName() === $this->getName() && $option->getShortcut() === $this->getShortcut() diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Input/StringInput.php b/application/vendor/symfony/console/Input/StringInput.php similarity index 88% rename from application/vendor/symfony/console/Symfony/Component/Console/Input/StringInput.php rename to application/vendor/symfony/console/Input/StringInput.php index 6537e27..754d712 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Input/StringInput.php +++ b/application/vendor/symfony/console/Input/StringInput.php @@ -19,8 +19,6 @@ * $input = new StringInput('foo --bar="foobar"'); * * @author Fabien Potencier - * - * @api */ class StringInput extends ArgvInput { @@ -28,17 +26,17 @@ class StringInput extends ArgvInput const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')'; /** - * Constructor. - * - * @param string $input An array of parameters from the CLI (in the argv format) + * @param string $input A string representing the parameters from the CLI * @param InputDefinition $definition A InputDefinition instance * * @deprecated The second argument is deprecated as it does not work (will be removed in 3.0), use 'bind' method instead - * - * @api */ public function __construct($input, InputDefinition $definition = null) { + if ($definition) { + @trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED); + } + parent::__construct(array(), null); $this->setTokens($this->tokenize($input)); diff --git a/application/vendor/symfony/console/LICENSE b/application/vendor/symfony/console/LICENSE new file mode 100644 index 0000000..21d7fb9 --- /dev/null +++ b/application/vendor/symfony/console/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2018 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Logger/ConsoleLogger.php b/application/vendor/symfony/console/Logger/ConsoleLogger.php similarity index 89% rename from application/vendor/symfony/console/Symfony/Component/Console/Logger/ConsoleLogger.php rename to application/vendor/symfony/console/Logger/ConsoleLogger.php index cf5d49c..d1aba10 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Logger/ConsoleLogger.php +++ b/application/vendor/symfony/console/Logger/ConsoleLogger.php @@ -18,23 +18,18 @@ use Symfony\Component\Console\Output\ConsoleOutputInterface; /** - * PSR-3 compliant console logger + * PSR-3 compliant console logger. * * @author Kévin Dunglas - * @link http://www.php-fig.org/psr/psr-3/ + * + * @see http://www.php-fig.org/psr/psr-3/ */ class ConsoleLogger extends AbstractLogger { const INFO = 'info'; const ERROR = 'error'; - /** - * @var OutputInterface - */ private $output; - /** - * @var array - */ private $verbosityLevelMap = array( LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL, LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL, @@ -45,9 +40,6 @@ class ConsoleLogger extends AbstractLogger LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE, LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG, ); - /** - * @var array - */ private $formatLevelMap = array( LogLevel::EMERGENCY => self::ERROR, LogLevel::ALERT => self::ERROR, @@ -59,11 +51,6 @@ class ConsoleLogger extends AbstractLogger LogLevel::DEBUG => self::INFO, ); - /** - * @param OutputInterface $output - * @param array $verbosityLevelMap - * @param array $formatLevelMap - */ public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array()) { $this->output = $output; @@ -81,7 +68,7 @@ public function log($level, $message, array $context = array()) } // Write to the error output if necessary and available - if ($this->formatLevelMap[$level] === self::ERROR && $this->output instanceof ConsoleOutputInterface) { + if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) { $output = $this->output->getErrorOutput(); } else { $output = $this->output; @@ -93,7 +80,7 @@ public function log($level, $message, array $context = array()) } /** - * Interpolates context values into the message placeholders + * Interpolates context values into the message placeholders. * * @author PHP Framework Interoperability Group * diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Output/BufferedOutput.php b/application/vendor/symfony/console/Output/BufferedOutput.php similarity index 91% rename from application/vendor/symfony/console/Symfony/Component/Console/Output/BufferedOutput.php rename to application/vendor/symfony/console/Output/BufferedOutput.php index 5682fc2..8afc893 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Output/BufferedOutput.php +++ b/application/vendor/symfony/console/Output/BufferedOutput.php @@ -16,9 +16,6 @@ */ class BufferedOutput extends Output { - /** - * @var string - */ private $buffer = ''; /** @@ -42,7 +39,7 @@ protected function doWrite($message, $newline) $this->buffer .= $message; if ($newline) { - $this->buffer .= "\n"; + $this->buffer .= PHP_EOL; } } } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Output/ConsoleOutput.php b/application/vendor/symfony/console/Output/ConsoleOutput.php similarity index 89% rename from application/vendor/symfony/console/Symfony/Component/Console/Output/ConsoleOutput.php rename to application/vendor/symfony/console/Output/ConsoleOutput.php index 50ef4df..84efb98 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Output/ConsoleOutput.php +++ b/application/vendor/symfony/console/Output/ConsoleOutput.php @@ -25,30 +25,26 @@ * $output = new StreamOutput(fopen('php://stdout', 'w')); * * @author Fabien Potencier - * - * @api */ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface { - /** - * @var StreamOutput - */ private $stderr; /** - * Constructor. - * * @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface) * @param bool|null $decorated Whether to decorate messages (null for auto-guessing) * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter) - * - * @api */ public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null) { parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter); + $actualDecorated = $this->isDecorated(); $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter()); + + if (null === $decorated) { + $this->setDecorated($actualDecorated && $this->stderr->isDecorated()); + } } /** @@ -124,7 +120,13 @@ protected function hasStderrSupport() */ private function isRunningOS400() { - return 'OS400' === php_uname('s'); + $checks = array( + function_exists('php_uname') ? php_uname('s') : '', + getenv('OSTYPE'), + PHP_OS, + ); + + return false !== stripos(implode(';', $checks), 'OS400'); } /** diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Output/ConsoleOutputInterface.php b/application/vendor/symfony/console/Output/ConsoleOutputInterface.php similarity index 87% rename from application/vendor/symfony/console/Symfony/Component/Console/Output/ConsoleOutputInterface.php rename to application/vendor/symfony/console/Output/ConsoleOutputInterface.php index 5eb4fc7..b44ea7e 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Output/ConsoleOutputInterface.php +++ b/application/vendor/symfony/console/Output/ConsoleOutputInterface.php @@ -26,10 +26,5 @@ interface ConsoleOutputInterface extends OutputInterface */ public function getErrorOutput(); - /** - * Sets the OutputInterface used for errors. - * - * @param OutputInterface $error - */ public function setErrorOutput(OutputInterface $error); } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Output/NullOutput.php b/application/vendor/symfony/console/Output/NullOutput.php similarity index 93% rename from application/vendor/symfony/console/Symfony/Component/Console/Output/NullOutput.php rename to application/vendor/symfony/console/Output/NullOutput.php index 557f8af..bd3b7e6 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Output/NullOutput.php +++ b/application/vendor/symfony/console/Output/NullOutput.php @@ -21,8 +21,6 @@ * * @author Fabien Potencier * @author Tobias Schultze - * - * @api */ class NullOutput implements OutputInterface { @@ -75,21 +73,33 @@ public function getVerbosity() return self::VERBOSITY_QUIET; } + /** + * {@inheritdoc} + */ public function isQuiet() { return true; } + /** + * {@inheritdoc} + */ public function isVerbose() { return false; } + /** + * {@inheritdoc} + */ public function isVeryVerbose() { return false; } + /** + * {@inheritdoc} + */ public function isDebug() { return false; diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Output/Output.php b/application/vendor/symfony/console/Output/Output.php similarity index 96% rename from application/vendor/symfony/console/Symfony/Component/Console/Output/Output.php rename to application/vendor/symfony/console/Output/Output.php index cb0e40d..e7e165e 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Output/Output.php +++ b/application/vendor/symfony/console/Output/Output.php @@ -26,8 +26,6 @@ * * quiet: -q (no output) * * @author Fabien Potencier - * - * @api */ abstract class Output implements OutputInterface { @@ -35,13 +33,9 @@ abstract class Output implements OutputInterface private $formatter; /** - * Constructor. - * * @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface) * @param bool $decorated Whether to decorate messages * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter) - * - * @api */ public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null) { @@ -98,21 +92,33 @@ public function getVerbosity() return $this->verbosity; } + /** + * {@inheritdoc} + */ public function isQuiet() { return self::VERBOSITY_QUIET === $this->verbosity; } + /** + * {@inheritdoc} + */ public function isVerbose() { return self::VERBOSITY_VERBOSE <= $this->verbosity; } + /** + * {@inheritdoc} + */ public function isVeryVerbose() { return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity; } + /** + * {@inheritdoc} + */ public function isDebug() { return self::VERBOSITY_DEBUG <= $this->verbosity; diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Output/OutputInterface.php b/application/vendor/symfony/console/Output/OutputInterface.php similarity index 89% rename from application/vendor/symfony/console/Symfony/Component/Console/Output/OutputInterface.php rename to application/vendor/symfony/console/Output/OutputInterface.php index f7f3063..ff007e6 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Output/OutputInterface.php +++ b/application/vendor/symfony/console/Output/OutputInterface.php @@ -17,8 +17,6 @@ * OutputInterface is the interface implemented by all Output classes. * * @author Fabien Potencier - * - * @api */ interface OutputInterface { @@ -40,20 +38,16 @@ interface OutputInterface * @param int $type The type of output (one of the OUTPUT constants) * * @throws \InvalidArgumentException When unknown output type is given - * - * @api */ public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL); /** * Writes a message to the output and adds a newline at the end. * - * @param string|array $messages The message as an array of lines of a single string + * @param string|array $messages The message as an array of lines or a single string * @param int $type The type of output (one of the OUTPUT constants) * * @throws \InvalidArgumentException When unknown output type is given - * - * @api */ public function writeln($messages, $type = self::OUTPUT_NORMAL); @@ -61,8 +55,6 @@ public function writeln($messages, $type = self::OUTPUT_NORMAL); * Sets the verbosity of the output. * * @param int $level The level of verbosity (one of the VERBOSITY constants) - * - * @api */ public function setVerbosity($level); @@ -70,8 +62,6 @@ public function setVerbosity($level); * Gets the current verbosity of the output. * * @return int The current level of verbosity (one of the VERBOSITY constants) - * - * @api */ public function getVerbosity(); @@ -79,8 +69,6 @@ public function getVerbosity(); * Sets the decorated flag. * * @param bool $decorated Whether to decorate the messages - * - * @api */ public function setDecorated($decorated); @@ -88,26 +76,15 @@ public function setDecorated($decorated); * Gets the decorated flag. * * @return bool true if the output will decorate messages, false otherwise - * - * @api */ public function isDecorated(); - /** - * Sets output formatter. - * - * @param OutputFormatterInterface $formatter - * - * @api - */ public function setFormatter(OutputFormatterInterface $formatter); /** * Returns current output formatter instance. * * @return OutputFormatterInterface - * - * @api */ public function getFormatter(); } diff --git a/application/vendor/symfony/console/Output/StreamOutput.php b/application/vendor/symfony/console/Output/StreamOutput.php new file mode 100644 index 0000000..b0897b2 --- /dev/null +++ b/application/vendor/symfony/console/Output/StreamOutput.php @@ -0,0 +1,114 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Output; + +use Symfony\Component\Console\Formatter\OutputFormatterInterface; + +/** + * StreamOutput writes the output to a given stream. + * + * Usage: + * + * $output = new StreamOutput(fopen('php://stdout', 'w')); + * + * As `StreamOutput` can use any stream, you can also use a file: + * + * $output = new StreamOutput(fopen('/path/to/output.log', 'a', false)); + * + * @author Fabien Potencier + */ +class StreamOutput extends Output +{ + private $stream; + + /** + * @param resource $stream A stream resource + * @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface) + * @param bool|null $decorated Whether to decorate messages (null for auto-guessing) + * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter) + * + * @throws \InvalidArgumentException When first argument is not a real stream + */ + public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null) + { + if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) { + throw new \InvalidArgumentException('The StreamOutput class needs a stream as its first argument.'); + } + + $this->stream = $stream; + + if (null === $decorated) { + $decorated = $this->hasColorSupport(); + } + + parent::__construct($verbosity, $decorated, $formatter); + } + + /** + * Gets the stream attached to this StreamOutput instance. + * + * @return resource A stream resource + */ + public function getStream() + { + return $this->stream; + } + + /** + * {@inheritdoc} + */ + protected function doWrite($message, $newline) + { + if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) { + // should never happen + throw new \RuntimeException('Unable to write output.'); + } + + fflush($this->stream); + } + + /** + * Returns true if the stream supports colorization. + * + * Colorization is disabled if not supported by the stream: + * + * This is tricky on Windows, because Cygwin, Msys2 etc emulate pseudo + * terminals via named pipes, so we can only check the environment. + * + * Reference: Composer\XdebugHandler\Process::supportsColor + * https://github.com/composer/xdebug-handler + * + * @return bool true if the stream supports colorization, false otherwise + */ + protected function hasColorSupport() + { + if (DIRECTORY_SEPARATOR === '\\') { + return (function_exists('sapi_windows_vt100_support') + && @sapi_windows_vt100_support($this->stream)) + || false !== getenv('ANSICON') + || 'ON' === getenv('ConEmuANSI') + || 'xterm' === getenv('TERM'); + } + + if (function_exists('stream_isatty')) { + return @stream_isatty($this->stream); + } + + if (function_exists('posix_isatty')) { + return @posix_isatty($this->stream); + } + + $stat = @fstat($this->stream); + // Check if formatted mode is S_IFCHR + return $stat ? 0020000 === ($stat['mode'] & 0170000) : false; + } +} diff --git a/application/vendor/symfony/console/Question/ChoiceQuestion.php b/application/vendor/symfony/console/Question/ChoiceQuestion.php new file mode 100644 index 0000000..7417f67 --- /dev/null +++ b/application/vendor/symfony/console/Question/ChoiceQuestion.php @@ -0,0 +1,187 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Question; + +/** + * Represents a choice question. + * + * @author Fabien Potencier + */ +class ChoiceQuestion extends Question +{ + private $choices; + private $multiselect = false; + private $prompt = ' > '; + private $errorMessage = 'Value "%s" is invalid'; + + /** + * @param string $question The question to ask to the user + * @param array $choices The list of available choices + * @param mixed $default The default answer to return + */ + public function __construct($question, array $choices, $default = null) + { + if (!$choices) { + throw new \LogicException('Choice question must have at least 1 choice available.'); + } + + parent::__construct($question, $default); + + $this->choices = $choices; + $this->setValidator($this->getDefaultValidator()); + $this->setAutocompleterValues($choices); + } + + /** + * Returns available choices. + * + * @return array + */ + public function getChoices() + { + return $this->choices; + } + + /** + * Sets multiselect option. + * + * When multiselect is set to true, multiple choices can be answered. + * + * @param bool $multiselect + * + * @return $this + */ + public function setMultiselect($multiselect) + { + $this->multiselect = $multiselect; + $this->setValidator($this->getDefaultValidator()); + + return $this; + } + + /** + * Returns whether the choices are multiselect. + * + * @return bool + */ + public function isMultiselect() + { + return $this->multiselect; + } + + /** + * Gets the prompt for choices. + * + * @return string + */ + public function getPrompt() + { + return $this->prompt; + } + + /** + * Sets the prompt for choices. + * + * @param string $prompt + * + * @return $this + */ + public function setPrompt($prompt) + { + $this->prompt = $prompt; + + return $this; + } + + /** + * Sets the error message for invalid values. + * + * The error message has a string placeholder (%s) for the invalid value. + * + * @param string $errorMessage + * + * @return $this + */ + public function setErrorMessage($errorMessage) + { + $this->errorMessage = $errorMessage; + $this->setValidator($this->getDefaultValidator()); + + return $this; + } + + /** + * Returns the default answer validator. + * + * @return callable + */ + private function getDefaultValidator() + { + $choices = $this->choices; + $errorMessage = $this->errorMessage; + $multiselect = $this->multiselect; + $isAssoc = $this->isAssoc($choices); + + return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) { + // Collapse all spaces. + $selectedChoices = str_replace(' ', '', $selected); + + if ($multiselect) { + // Check for a separated comma values + if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) { + throw new \InvalidArgumentException(sprintf($errorMessage, $selected)); + } + $selectedChoices = explode(',', $selectedChoices); + } else { + $selectedChoices = array($selected); + } + + $multiselectChoices = array(); + foreach ($selectedChoices as $value) { + $results = array(); + foreach ($choices as $key => $choice) { + if ($choice === $value) { + $results[] = $key; + } + } + + if (count($results) > 1) { + throw new \InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results))); + } + + $result = array_search($value, $choices); + + if (!$isAssoc) { + if (false !== $result) { + $result = $choices[$result]; + } elseif (isset($choices[$value])) { + $result = $choices[$value]; + } + } elseif (false === $result && isset($choices[$value])) { + $result = $value; + } + + if (false === $result) { + throw new \InvalidArgumentException(sprintf($errorMessage, $value)); + } + + $multiselectChoices[] = (string) $result; + } + + if ($multiselect) { + return $multiselectChoices; + } + + return current($multiselectChoices); + }; + } +} diff --git a/application/vendor/symfony/console/Question/ConfirmationQuestion.php b/application/vendor/symfony/console/Question/ConfirmationQuestion.php new file mode 100644 index 0000000..40f54b4 --- /dev/null +++ b/application/vendor/symfony/console/Question/ConfirmationQuestion.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Question; + +/** + * Represents a yes/no question. + * + * @author Fabien Potencier + */ +class ConfirmationQuestion extends Question +{ + private $trueAnswerRegex; + + /** + * @param string $question The question to ask to the user + * @param bool $default The default answer to return, true or false + * @param string $trueAnswerRegex A regex to match the "yes" answer + */ + public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i') + { + parent::__construct($question, (bool) $default); + + $this->trueAnswerRegex = $trueAnswerRegex; + $this->setNormalizer($this->getDefaultNormalizer()); + } + + /** + * Returns the default answer normalizer. + * + * @return callable + */ + private function getDefaultNormalizer() + { + $default = $this->getDefault(); + $regex = $this->trueAnswerRegex; + + return function ($answer) use ($default, $regex) { + if (is_bool($answer)) { + return $answer; + } + + $answerIsTrue = (bool) preg_match($regex, $answer); + if (false === $default) { + return $answer && $answerIsTrue; + } + + return !$answer || $answerIsTrue; + }; + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Question/Question.php b/application/vendor/symfony/console/Question/Question.php similarity index 84% rename from application/vendor/symfony/console/Symfony/Component/Console/Question/Question.php rename to application/vendor/symfony/console/Question/Question.php index 9f776d5..d94836b 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Question/Question.php +++ b/application/vendor/symfony/console/Question/Question.php @@ -28,8 +28,6 @@ class Question private $normalizer; /** - * Constructor. - * * @param string $question The question to ask to the user * @param mixed $default The default answer to return if the user enters nothing */ @@ -74,7 +72,7 @@ public function isHidden() * * @param bool $hidden * - * @return Question The current instance + * @return $this * * @throws \LogicException In case the autocompleter is also used */ @@ -104,7 +102,7 @@ public function isHiddenFallback() * * @param bool $fallback * - * @return Question The current instance + * @return $this */ public function setHiddenFallback($fallback) { @@ -116,7 +114,7 @@ public function setHiddenFallback($fallback) /** * Gets values for the autocompleter. * - * @return null|array|\Traversable + * @return null|iterable */ public function getAutocompleterValues() { @@ -126,19 +124,21 @@ public function getAutocompleterValues() /** * Sets values for the autocompleter. * - * @param null|array|\Traversable $values + * @param null|iterable $values * - * @return Question The current instance + * @return $this * * @throws \InvalidArgumentException * @throws \LogicException */ public function setAutocompleterValues($values) { - if (null !== $values && !is_array($values)) { - if (!$values instanceof \Traversable || $values instanceof \Countable) { - throw new \InvalidArgumentException('Autocompleter values can be either an array, `null` or an object implementing both `Countable` and `Traversable` interfaces.'); - } + if (is_array($values)) { + $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values); + } + + if (null !== $values && !is_array($values) && !$values instanceof \Traversable) { + throw new \InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.'); } if ($this->hidden) { @@ -155,7 +155,7 @@ public function setAutocompleterValues($values) * * @param null|callable $validator * - * @return Question The current instance + * @return $this */ public function setValidator($validator) { @@ -181,9 +181,9 @@ public function getValidator() * * @param null|int $attempts * - * @return Question The current instance + * @return $this * - * @throws \InvalidArgumentException In case the number of attempts is invalid. + * @throws \InvalidArgumentException in case the number of attempts is invalid */ public function setMaxAttempts($attempts) { @@ -213,9 +213,9 @@ public function getMaxAttempts() * * The normalizer can be a callable (a string), a closure or a class implementing __invoke. * - * @param string|\Closure $normalizer + * @param callable $normalizer * - * @return Question The current instance + * @return $this */ public function setNormalizer($normalizer) { @@ -229,10 +229,15 @@ public function setNormalizer($normalizer) * * The normalizer can ba a callable (a string), a closure or a class implementing __invoke. * - * @return string|\Closure + * @return callable */ public function getNormalizer() { return $this->normalizer; } + + protected function isAssoc($array) + { + return (bool) count(array_filter(array_keys($array), 'is_string')); + } } diff --git a/application/vendor/symfony/console/README.md b/application/vendor/symfony/console/README.md new file mode 100644 index 0000000..664a37c --- /dev/null +++ b/application/vendor/symfony/console/README.md @@ -0,0 +1,20 @@ +Console Component +================= + +The Console component eases the creation of beautiful and testable command line +interfaces. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/console/index.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) + +Credits +------- + +`Resources/bin/hiddeninput.exe` is a third party binary provided within this +component. Find sources and license at https://github.com/Seldaek/hidden-input. diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Resources/bin/hiddeninput.exe b/application/vendor/symfony/console/Resources/bin/hiddeninput.exe similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Resources/bin/hiddeninput.exe rename to application/vendor/symfony/console/Resources/bin/hiddeninput.exe diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Shell.php b/application/vendor/symfony/console/Shell.php similarity index 97% rename from application/vendor/symfony/console/Symfony/Component/Console/Shell.php rename to application/vendor/symfony/console/Shell.php index eaaadfd..b2e234c 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Shell.php +++ b/application/vendor/symfony/console/Shell.php @@ -34,12 +34,8 @@ class Shell private $processIsolation = false; /** - * Constructor. - * * If there is no readline support for the current PHP executable * a \RuntimeException exception is thrown. - * - * @param Application $application An application instance */ public function __construct(Application $application) { @@ -67,7 +63,7 @@ public function run() if ($this->processIsolation) { $finder = new PhpExecutableFinder(); $php = $finder->find(); - $this->output->writeln(<<output->writeln(<<<'EOF' Running with process isolation, you should consider this: * each command is executed as separate process, * commands don't support interactivity, all params must be passed explicitly, diff --git a/application/vendor/symfony/console/Style/OutputStyle.php b/application/vendor/symfony/console/Style/OutputStyle.php new file mode 100644 index 0000000..f3bf291 --- /dev/null +++ b/application/vendor/symfony/console/Style/OutputStyle.php @@ -0,0 +1,113 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Style; + +use Symfony\Component\Console\Formatter\OutputFormatterInterface; +use Symfony\Component\Console\Helper\ProgressBar; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Decorates output to add console style guide helpers. + * + * @author Kevin Bond + */ +abstract class OutputStyle implements OutputInterface, StyleInterface +{ + private $output; + + public function __construct(OutputInterface $output) + { + $this->output = $output; + } + + /** + * {@inheritdoc} + */ + public function newLine($count = 1) + { + $this->output->write(str_repeat(PHP_EOL, $count)); + } + + /** + * @param int $max + * + * @return ProgressBar + */ + public function createProgressBar($max = 0) + { + return new ProgressBar($this->output, $max); + } + + /** + * {@inheritdoc} + */ + public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL) + { + $this->output->write($messages, $newline, $type); + } + + /** + * {@inheritdoc} + */ + public function writeln($messages, $type = self::OUTPUT_NORMAL) + { + $this->output->writeln($messages, $type); + } + + /** + * {@inheritdoc} + */ + public function setVerbosity($level) + { + $this->output->setVerbosity($level); + } + + /** + * {@inheritdoc} + */ + public function getVerbosity() + { + return $this->output->getVerbosity(); + } + + /** + * {@inheritdoc} + */ + public function setDecorated($decorated) + { + $this->output->setDecorated($decorated); + } + + /** + * {@inheritdoc} + */ + public function isDecorated() + { + return $this->output->isDecorated(); + } + + /** + * {@inheritdoc} + */ + public function setFormatter(OutputFormatterInterface $formatter) + { + $this->output->setFormatter($formatter); + } + + /** + * {@inheritdoc} + */ + public function getFormatter() + { + return $this->output->getFormatter(); + } +} diff --git a/application/vendor/symfony/console/Style/StyleInterface.php b/application/vendor/symfony/console/Style/StyleInterface.php new file mode 100644 index 0000000..475c268 --- /dev/null +++ b/application/vendor/symfony/console/Style/StyleInterface.php @@ -0,0 +1,154 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Style; + +/** + * Output style helpers. + * + * @author Kevin Bond + */ +interface StyleInterface +{ + /** + * Formats a command title. + * + * @param string $message + */ + public function title($message); + + /** + * Formats a section title. + * + * @param string $message + */ + public function section($message); + + /** + * Formats a list. + */ + public function listing(array $elements); + + /** + * Formats informational text. + * + * @param string|array $message + */ + public function text($message); + + /** + * Formats a success result bar. + * + * @param string|array $message + */ + public function success($message); + + /** + * Formats an error result bar. + * + * @param string|array $message + */ + public function error($message); + + /** + * Formats an warning result bar. + * + * @param string|array $message + */ + public function warning($message); + + /** + * Formats a note admonition. + * + * @param string|array $message + */ + public function note($message); + + /** + * Formats a caution admonition. + * + * @param string|array $message + */ + public function caution($message); + + /** + * Formats a table. + */ + public function table(array $headers, array $rows); + + /** + * Asks a question. + * + * @param string $question + * @param string|null $default + * @param callable|null $validator + * + * @return mixed + */ + public function ask($question, $default = null, $validator = null); + + /** + * Asks a question with the user input hidden. + * + * @param string $question + * @param callable|null $validator + * + * @return mixed + */ + public function askHidden($question, $validator = null); + + /** + * Asks for confirmation. + * + * @param string $question + * @param bool $default + * + * @return bool + */ + public function confirm($question, $default = true); + + /** + * Asks a choice question. + * + * @param string $question + * @param array $choices + * @param string|int|null $default + * + * @return mixed + */ + public function choice($question, array $choices, $default = null); + + /** + * Add newline(s). + * + * @param int $count The number of newlines + */ + public function newLine($count = 1); + + /** + * Starts the progress output. + * + * @param int $max Maximum steps (0 if unknown) + */ + public function progressStart($max = 0); + + /** + * Advances the progress output X steps. + * + * @param int $step Number of steps to advance + */ + public function progressAdvance($step = 1); + + /** + * Finishes the progress output. + */ + public function progressFinish(); +} diff --git a/application/vendor/symfony/console/Style/SymfonyStyle.php b/application/vendor/symfony/console/Style/SymfonyStyle.php new file mode 100644 index 0000000..bf25c06 --- /dev/null +++ b/application/vendor/symfony/console/Style/SymfonyStyle.php @@ -0,0 +1,414 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Style; + +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Helper\Helper; +use Symfony\Component\Console\Helper\ProgressBar; +use Symfony\Component\Console\Helper\SymfonyQuestionHelper; +use Symfony\Component\Console\Helper\Table; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\BufferedOutput; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Question\ChoiceQuestion; +use Symfony\Component\Console\Question\ConfirmationQuestion; +use Symfony\Component\Console\Question\Question; + +/** + * Output decorator helpers for the Symfony Style Guide. + * + * @author Kevin Bond + */ +class SymfonyStyle extends OutputStyle +{ + const MAX_LINE_LENGTH = 120; + + private $input; + private $questionHelper; + private $progressBar; + private $lineLength; + private $bufferedOutput; + + public function __construct(InputInterface $input, OutputInterface $output) + { + $this->input = $input; + $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter()); + // Windows cmd wraps lines as soon as the terminal width is reached, whether there are following chars or not. + $this->lineLength = min($this->getTerminalWidth() - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH); + + parent::__construct($output); + } + + /** + * Formats a message as a block of text. + * + * @param string|array $messages The message to write in the block + * @param string|null $type The block type (added in [] on first line) + * @param string|null $style The style to apply to the whole block + * @param string $prefix The prefix for the block + * @param bool $padding Whether to add vertical padding + */ + public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false) + { + $this->autoPrependBlock(); + $messages = is_array($messages) ? array_values($messages) : array($messages); + $indentLength = 0; + $lines = array(); + + if (null !== $type) { + $typePrefix = sprintf('[%s] ', $type); + $indentLength = strlen($typePrefix); + $lineIndentation = str_repeat(' ', $indentLength); + } + + // wrap and add newlines for each element + foreach ($messages as $key => $message) { + $message = OutputFormatter::escape($message); + $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - Helper::strlen($prefix) - $indentLength, PHP_EOL, true))); + + // prefix each line with a number of spaces equivalent to the type length + if (null !== $type) { + foreach ($lines as &$line) { + $line = $lineIndentation === substr($line, 0, $indentLength) ? $line : $lineIndentation.$line; + } + } + + if (count($messages) > 1 && $key < count($messages) - 1) { + $lines[] = ''; + } + } + + if (null !== $type) { + $lines[0] = substr_replace($lines[0], $typePrefix, 0, $indentLength); + } + + if ($padding && $this->isDecorated()) { + array_unshift($lines, ''); + $lines[] = ''; + } + + foreach ($lines as &$line) { + $line = sprintf('%s%s', $prefix, $line); + $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line)); + + if ($style) { + $line = sprintf('<%s>%s', $style, $line); + } + } + + $this->writeln($lines); + $this->newLine(); + } + + /** + * {@inheritdoc} + */ + public function title($message) + { + $this->autoPrependBlock(); + $this->writeln(array( + sprintf('%s', OutputFormatter::escapeTrailingBackslash($message)), + sprintf('%s', str_repeat('=', strlen($message))), + )); + $this->newLine(); + } + + /** + * {@inheritdoc} + */ + public function section($message) + { + $this->autoPrependBlock(); + $this->writeln(array( + sprintf('%s', OutputFormatter::escapeTrailingBackslash($message)), + sprintf('%s', str_repeat('-', strlen($message))), + )); + $this->newLine(); + } + + /** + * {@inheritdoc} + */ + public function listing(array $elements) + { + $this->autoPrependText(); + $elements = array_map(function ($element) { + return sprintf(' * %s', $element); + }, $elements); + + $this->writeln($elements); + $this->newLine(); + } + + /** + * {@inheritdoc} + */ + public function text($message) + { + $this->autoPrependText(); + + if (!is_array($message)) { + $this->writeln(sprintf(' // %s', $message)); + + return; + } + + foreach ($message as $element) { + $this->text($element); + } + } + + /** + * {@inheritdoc} + */ + public function success($message) + { + $this->block($message, 'OK', 'fg=black;bg=green', ' ', true); + } + + /** + * {@inheritdoc} + */ + public function error($message) + { + $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true); + } + + /** + * {@inheritdoc} + */ + public function warning($message) + { + $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true); + } + + /** + * {@inheritdoc} + */ + public function note($message) + { + $this->block($message, 'NOTE', 'fg=yellow', ' ! '); + } + + /** + * {@inheritdoc} + */ + public function caution($message) + { + $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true); + } + + /** + * {@inheritdoc} + */ + public function table(array $headers, array $rows) + { + $style = clone Table::getStyleDefinition('symfony-style-guide'); + $style->setCellHeaderFormat('%s'); + + $table = new Table($this); + $table->setHeaders($headers); + $table->setRows($rows); + $table->setStyle($style); + + $table->render(); + $this->newLine(); + } + + /** + * {@inheritdoc} + */ + public function ask($question, $default = null, $validator = null) + { + $question = new Question($question, $default); + $question->setValidator($validator); + + return $this->askQuestion($question); + } + + /** + * {@inheritdoc} + */ + public function askHidden($question, $validator = null) + { + $question = new Question($question); + + $question->setHidden(true); + $question->setValidator($validator); + + return $this->askQuestion($question); + } + + /** + * {@inheritdoc} + */ + public function confirm($question, $default = true) + { + return $this->askQuestion(new ConfirmationQuestion($question, $default)); + } + + /** + * {@inheritdoc} + */ + public function choice($question, array $choices, $default = null) + { + if (null !== $default) { + $values = array_flip($choices); + $default = $values[$default]; + } + + return $this->askQuestion(new ChoiceQuestion($question, $choices, $default)); + } + + /** + * {@inheritdoc} + */ + public function progressStart($max = 0) + { + $this->progressBar = $this->createProgressBar($max); + $this->progressBar->start(); + } + + /** + * {@inheritdoc} + */ + public function progressAdvance($step = 1) + { + $this->getProgressBar()->advance($step); + } + + /** + * {@inheritdoc} + */ + public function progressFinish() + { + $this->getProgressBar()->finish(); + $this->newLine(2); + $this->progressBar = null; + } + + /** + * {@inheritdoc} + */ + public function createProgressBar($max = 0) + { + $progressBar = parent::createProgressBar($max); + + if ('\\' !== DIRECTORY_SEPARATOR) { + $progressBar->setEmptyBarCharacter('░'); // light shade character \u2591 + $progressBar->setProgressCharacter(''); + $progressBar->setBarCharacter('▓'); // dark shade character \u2593 + } + + return $progressBar; + } + + /** + * @return mixed + */ + public function askQuestion(Question $question) + { + if ($this->input->isInteractive()) { + $this->autoPrependBlock(); + } + + if (!$this->questionHelper) { + $this->questionHelper = new SymfonyQuestionHelper(); + } + + $answer = $this->questionHelper->ask($this->input, $this, $question); + + if ($this->input->isInteractive()) { + $this->newLine(); + $this->bufferedOutput->write("\n"); + } + + return $answer; + } + + /** + * {@inheritdoc} + */ + public function writeln($messages, $type = self::OUTPUT_NORMAL) + { + parent::writeln($messages, $type); + $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type); + } + + /** + * {@inheritdoc} + */ + public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL) + { + parent::write($messages, $newline, $type); + $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type); + } + + /** + * {@inheritdoc} + */ + public function newLine($count = 1) + { + parent::newLine($count); + $this->bufferedOutput->write(str_repeat("\n", $count)); + } + + /** + * @return ProgressBar + */ + private function getProgressBar() + { + if (!$this->progressBar) { + throw new \RuntimeException('The ProgressBar is not started.'); + } + + return $this->progressBar; + } + + private function getTerminalWidth() + { + $application = new Application(); + $dimensions = $application->getTerminalDimensions(); + + return $dimensions[0] ?: self::MAX_LINE_LENGTH; + } + + private function autoPrependBlock() + { + $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2); + + if (!isset($chars[0])) { + return $this->newLine(); //empty history, so we should start with a new line. + } + //Prepend new line for each non LF chars (This means no blank line was output before) + $this->newLine(2 - substr_count($chars, "\n")); + } + + private function autoPrependText() + { + $fetched = $this->bufferedOutput->fetch(); + //Prepend new line if last char isn't EOL: + if ("\n" !== substr($fetched, -1)) { + $this->newLine(); + } + } + + private function reduceBuffer($messages) + { + // We need to know if the two last chars are PHP_EOL + // Preserve the last 4 chars inserted (PHP_EOL on windows is two chars) in the history buffer + return array_map(function ($value) { + return substr($value, -4); + }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages)); + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Application.php b/application/vendor/symfony/console/Symfony/Component/Console/Application.php deleted file mode 100644 index 81e7fc2..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Application.php +++ /dev/null @@ -1,1173 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console; - -use Symfony\Component\Console\Descriptor\TextDescriptor; -use Symfony\Component\Console\Descriptor\XmlDescriptor; -use Symfony\Component\Console\Helper\DebugFormatterHelper; -use Symfony\Component\Console\Helper\ProcessHelper; -use Symfony\Component\Console\Helper\QuestionHelper; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\ArgvInput; -use Symfony\Component\Console\Input\ArrayInput; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputAwareInterface; -use Symfony\Component\Console\Output\BufferedOutput; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Output\ConsoleOutput; -use Symfony\Component\Console\Output\ConsoleOutputInterface; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Command\HelpCommand; -use Symfony\Component\Console\Command\ListCommand; -use Symfony\Component\Console\Helper\HelperSet; -use Symfony\Component\Console\Helper\FormatterHelper; -use Symfony\Component\Console\Helper\DialogHelper; -use Symfony\Component\Console\Helper\ProgressHelper; -use Symfony\Component\Console\Helper\TableHelper; -use Symfony\Component\Console\Event\ConsoleCommandEvent; -use Symfony\Component\Console\Event\ConsoleExceptionEvent; -use Symfony\Component\Console\Event\ConsoleTerminateEvent; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * An Application is the container for a collection of commands. - * - * It is the main entry point of a Console application. - * - * This class is optimized for a standard CLI environment. - * - * Usage: - * - * $app = new Application('myapp', '1.0 (stable)'); - * $app->add(new SimpleCommand()); - * $app->run(); - * - * @author Fabien Potencier - * - * @api - */ -class Application -{ - private $commands = array(); - private $wantHelps = false; - private $runningCommand; - private $name; - private $version; - private $catchExceptions = true; - private $autoExit = true; - private $definition; - private $helperSet; - private $dispatcher; - private $terminalDimensions; - private $defaultCommand; - - /** - * Constructor. - * - * @param string $name The name of the application - * @param string $version The version of the application - * - * @api - */ - public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN') - { - $this->name = $name; - $this->version = $version; - $this->defaultCommand = 'list'; - $this->helperSet = $this->getDefaultHelperSet(); - $this->definition = $this->getDefaultInputDefinition(); - - foreach ($this->getDefaultCommands() as $command) { - $this->add($command); - } - } - - public function setDispatcher(EventDispatcherInterface $dispatcher) - { - $this->dispatcher = $dispatcher; - } - - /** - * Runs the current application. - * - * @param InputInterface $input An Input instance - * @param OutputInterface $output An Output instance - * - * @return int 0 if everything went fine, or an error code - * - * @throws \Exception When doRun returns Exception - * - * @api - */ - public function run(InputInterface $input = null, OutputInterface $output = null) - { - if (null === $input) { - $input = new ArgvInput(); - } - - if (null === $output) { - $output = new ConsoleOutput(); - } - - $this->configureIO($input, $output); - - try { - $exitCode = $this->doRun($input, $output); - } catch (\Exception $e) { - if (!$this->catchExceptions) { - throw $e; - } - - if ($output instanceof ConsoleOutputInterface) { - $this->renderException($e, $output->getErrorOutput()); - } else { - $this->renderException($e, $output); - } - - $exitCode = $e->getCode(); - if (is_numeric($exitCode)) { - $exitCode = (int) $exitCode; - if (0 === $exitCode) { - $exitCode = 1; - } - } else { - $exitCode = 1; - } - } - - if ($this->autoExit) { - if ($exitCode > 255) { - $exitCode = 255; - } - - exit($exitCode); - } - - return $exitCode; - } - - /** - * Runs the current application. - * - * @param InputInterface $input An Input instance - * @param OutputInterface $output An Output instance - * - * @return int 0 if everything went fine, or an error code - */ - public function doRun(InputInterface $input, OutputInterface $output) - { - if (true === $input->hasParameterOption(array('--version', '-V'))) { - $output->writeln($this->getLongVersion()); - - return 0; - } - - $name = $this->getCommandName($input); - if (true === $input->hasParameterOption(array('--help', '-h'))) { - if (!$name) { - $name = 'help'; - $input = new ArrayInput(array('command' => 'help')); - } else { - $this->wantHelps = true; - } - } - - if (!$name) { - $name = $this->defaultCommand; - $input = new ArrayInput(array('command' => $this->defaultCommand)); - } - - // the command name MUST be the first element of the input - $command = $this->find($name); - - $this->runningCommand = $command; - $exitCode = $this->doRunCommand($command, $input, $output); - $this->runningCommand = null; - - return $exitCode; - } - - /** - * Set a helper set to be used with the command. - * - * @param HelperSet $helperSet The helper set - * - * @api - */ - public function setHelperSet(HelperSet $helperSet) - { - $this->helperSet = $helperSet; - } - - /** - * Get the helper set associated with the command. - * - * @return HelperSet The HelperSet instance associated with this command - * - * @api - */ - public function getHelperSet() - { - return $this->helperSet; - } - - /** - * Set an input definition set to be used with this application. - * - * @param InputDefinition $definition The input definition - * - * @api - */ - public function setDefinition(InputDefinition $definition) - { - $this->definition = $definition; - } - - /** - * Gets the InputDefinition related to this Application. - * - * @return InputDefinition The InputDefinition instance - */ - public function getDefinition() - { - return $this->definition; - } - - /** - * Gets the help message. - * - * @return string A help message. - */ - public function getHelp() - { - return $this->getLongVersion(); - } - - /** - * Sets whether to catch exceptions or not during commands execution. - * - * @param bool $boolean Whether to catch exceptions or not during commands execution - * - * @api - */ - public function setCatchExceptions($boolean) - { - $this->catchExceptions = (bool) $boolean; - } - - /** - * Sets whether to automatically exit after a command execution or not. - * - * @param bool $boolean Whether to automatically exit after a command execution or not - * - * @api - */ - public function setAutoExit($boolean) - { - $this->autoExit = (bool) $boolean; - } - - /** - * Gets the name of the application. - * - * @return string The application name - * - * @api - */ - public function getName() - { - return $this->name; - } - - /** - * Sets the application name. - * - * @param string $name The application name - * - * @api - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * Gets the application version. - * - * @return string The application version - * - * @api - */ - public function getVersion() - { - return $this->version; - } - - /** - * Sets the application version. - * - * @param string $version The application version - * - * @api - */ - public function setVersion($version) - { - $this->version = $version; - } - - /** - * Returns the long version of the application. - * - * @return string The long application version - * - * @api - */ - public function getLongVersion() - { - if ('UNKNOWN' !== $this->getName() && 'UNKNOWN' !== $this->getVersion()) { - return sprintf('%s version %s', $this->getName(), $this->getVersion()); - } - - return 'Console Tool'; - } - - /** - * Registers a new command. - * - * @param string $name The command name - * - * @return Command The newly created command - * - * @api - */ - public function register($name) - { - return $this->add(new Command($name)); - } - - /** - * Adds an array of command objects. - * - * @param Command[] $commands An array of commands - * - * @api - */ - public function addCommands(array $commands) - { - foreach ($commands as $command) { - $this->add($command); - } - } - - /** - * Adds a command object. - * - * If a command with the same name already exists, it will be overridden. - * - * @param Command $command A Command object - * - * @return Command The registered command - * - * @api - */ - public function add(Command $command) - { - $command->setApplication($this); - - if (!$command->isEnabled()) { - $command->setApplication(null); - - return; - } - - if (null === $command->getDefinition()) { - throw new \LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command))); - } - - $this->commands[$command->getName()] = $command; - - foreach ($command->getAliases() as $alias) { - $this->commands[$alias] = $command; - } - - return $command; - } - - /** - * Returns a registered command by name or alias. - * - * @param string $name The command name or alias - * - * @return Command A Command object - * - * @throws \InvalidArgumentException When command name given does not exist - * - * @api - */ - public function get($name) - { - if (!isset($this->commands[$name])) { - throw new \InvalidArgumentException(sprintf('The command "%s" does not exist.', $name)); - } - - $command = $this->commands[$name]; - - if ($this->wantHelps) { - $this->wantHelps = false; - - $helpCommand = $this->get('help'); - $helpCommand->setCommand($command); - - return $helpCommand; - } - - return $command; - } - - /** - * Returns true if the command exists, false otherwise. - * - * @param string $name The command name or alias - * - * @return bool true if the command exists, false otherwise - * - * @api - */ - public function has($name) - { - return isset($this->commands[$name]); - } - - /** - * Returns an array of all unique namespaces used by currently registered commands. - * - * It does not returns the global namespace which always exists. - * - * @return array An array of namespaces - */ - public function getNamespaces() - { - $namespaces = array(); - foreach ($this->commands as $command) { - $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName())); - - foreach ($command->getAliases() as $alias) { - $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias)); - } - } - - return array_values(array_unique(array_filter($namespaces))); - } - - /** - * Finds a registered namespace by a name or an abbreviation. - * - * @param string $namespace A namespace or abbreviation to search for - * - * @return string A registered namespace - * - * @throws \InvalidArgumentException When namespace is incorrect or ambiguous - */ - public function findNamespace($namespace) - { - $allNamespaces = $this->getNamespaces(); - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace); - $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces); - - if (empty($namespaces)) { - $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); - - if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) { - if (1 == count($alternatives)) { - $message .= "\n\nDid you mean this?\n "; - } else { - $message .= "\n\nDid you mean one of these?\n "; - } - - $message .= implode("\n ", $alternatives); - } - - throw new \InvalidArgumentException($message); - } - - $exact = in_array($namespace, $namespaces, true); - if (count($namespaces) > 1 && !$exact) { - throw new \InvalidArgumentException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces)))); - } - - return $exact ? $namespace : reset($namespaces); - } - - /** - * Finds a command by name or alias. - * - * Contrary to get, this command tries to find the best - * match if you give it an abbreviation of a name or alias. - * - * @param string $name A command name or a command alias - * - * @return Command A Command instance - * - * @throws \InvalidArgumentException When command name is incorrect or ambiguous - * - * @api - */ - public function find($name) - { - $allCommands = array_keys($this->commands); - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name); - $commands = preg_grep('{^'.$expr.'}', $allCommands); - - if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) { - if (false !== $pos = strrpos($name, ':')) { - // check if a namespace exists and contains commands - $this->findNamespace(substr($name, 0, $pos)); - } - - $message = sprintf('Command "%s" is not defined.', $name); - - if ($alternatives = $this->findAlternatives($name, $allCommands)) { - if (1 == count($alternatives)) { - $message .= "\n\nDid you mean this?\n "; - } else { - $message .= "\n\nDid you mean one of these?\n "; - } - $message .= implode("\n ", $alternatives); - } - - throw new \InvalidArgumentException($message); - } - - // filter out aliases for commands which are already on the list - if (count($commands) > 1) { - $commandList = $this->commands; - $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands) { - $commandName = $commandList[$nameOrAlias]->getName(); - - return $commandName === $nameOrAlias || !in_array($commandName, $commands); - }); - } - - $exact = in_array($name, $commands, true); - if (count($commands) > 1 && !$exact) { - $suggestions = $this->getAbbreviationSuggestions(array_values($commands)); - - throw new \InvalidArgumentException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions)); - } - - return $this->get($exact ? $name : reset($commands)); - } - - /** - * Gets the commands (registered in the given namespace if provided). - * - * The array keys are the full names and the values the command instances. - * - * @param string $namespace A namespace name - * - * @return Command[] An array of Command instances - * - * @api - */ - public function all($namespace = null) - { - if (null === $namespace) { - return $this->commands; - } - - $commands = array(); - foreach ($this->commands as $name => $command) { - if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) { - $commands[$name] = $command; - } - } - - return $commands; - } - - /** - * Returns an array of possible abbreviations given a set of names. - * - * @param array $names An array of names - * - * @return array An array of abbreviations - */ - public static function getAbbreviations($names) - { - $abbrevs = array(); - foreach ($names as $name) { - for ($len = strlen($name); $len > 0; --$len) { - $abbrev = substr($name, 0, $len); - $abbrevs[$abbrev][] = $name; - } - } - - return $abbrevs; - } - - /** - * Returns a text representation of the Application. - * - * @param string $namespace An optional namespace name - * @param bool $raw Whether to return raw command list - * - * @return string A string representing the Application - * - * @deprecated Deprecated since version 2.3, to be removed in 3.0. - */ - public function asText($namespace = null, $raw = false) - { - $descriptor = new TextDescriptor(); - $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw); - $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true)); - - return $output->fetch(); - } - - /** - * Returns an XML representation of the Application. - * - * @param string $namespace An optional namespace name - * @param bool $asDom Whether to return a DOM or an XML string - * - * @return string|\DOMDocument An XML string representing the Application - * - * @deprecated Deprecated since version 2.3, to be removed in 3.0. - */ - public function asXml($namespace = null, $asDom = false) - { - $descriptor = new XmlDescriptor(); - - if ($asDom) { - return $descriptor->getApplicationDocument($this, $namespace); - } - - $output = new BufferedOutput(); - $descriptor->describe($output, $this, array('namespace' => $namespace)); - - return $output->fetch(); - } - - /** - * Renders a caught exception. - * - * @param \Exception $e An exception instance - * @param OutputInterface $output An OutputInterface instance - */ - public function renderException($e, $output) - { - do { - $title = sprintf(' [%s] ', get_class($e)); - - $len = $this->stringWidth($title); - - $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX; - // HHVM only accepts 32 bits integer in str_split, even when PHP_INT_MAX is a 64 bit integer: https://github.com/facebook/hhvm/issues/1327 - if (defined('HHVM_VERSION') && $width > 1 << 31) { - $width = 1 << 31; - } - $formatter = $output->getFormatter(); - $lines = array(); - foreach (preg_split('/\r?\n/', $e->getMessage()) as $line) { - foreach ($this->splitStringByWidth($line, $width - 4) as $line) { - // pre-format lines to get the right string length - $lineLength = $this->stringWidth(preg_replace('/\[[^m]*m/', '', $formatter->format($line))) + 4; - $lines[] = array($line, $lineLength); - - $len = max($lineLength, $len); - } - } - - $messages = array('', ''); - $messages[] = $emptyLine = $formatter->format(sprintf('%s', str_repeat(' ', $len))); - $messages[] = $formatter->format(sprintf('%s%s', $title, str_repeat(' ', max(0, $len - $this->stringWidth($title))))); - foreach ($lines as $line) { - $messages[] = $formatter->format(sprintf(' %s %s', $line[0], str_repeat(' ', $len - $line[1]))); - } - $messages[] = $emptyLine; - $messages[] = ''; - $messages[] = ''; - - $output->writeln($messages, OutputInterface::OUTPUT_RAW); - - if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { - $output->writeln('Exception trace:'); - - // exception related properties - $trace = $e->getTrace(); - array_unshift($trace, array( - 'function' => '', - 'file' => $e->getFile() !== null ? $e->getFile() : 'n/a', - 'line' => $e->getLine() !== null ? $e->getLine() : 'n/a', - 'args' => array(), - )); - - for ($i = 0, $count = count($trace); $i < $count; ++$i) { - $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : ''; - $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : ''; - $function = $trace[$i]['function']; - $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a'; - $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a'; - - $output->writeln(sprintf(' %s%s%s() at %s:%s', $class, $type, $function, $file, $line)); - } - - $output->writeln(''); - $output->writeln(''); - } - } while ($e = $e->getPrevious()); - - if (null !== $this->runningCommand) { - $output->writeln(sprintf('%s', sprintf($this->runningCommand->getSynopsis(), $this->getName()))); - $output->writeln(''); - $output->writeln(''); - } - } - - /** - * Tries to figure out the terminal width in which this application runs. - * - * @return int|null - */ - protected function getTerminalWidth() - { - $dimensions = $this->getTerminalDimensions(); - - return $dimensions[0]; - } - - /** - * Tries to figure out the terminal height in which this application runs. - * - * @return int|null - */ - protected function getTerminalHeight() - { - $dimensions = $this->getTerminalDimensions(); - - return $dimensions[1]; - } - - /** - * Tries to figure out the terminal dimensions based on the current environment. - * - * @return array Array containing width and height - */ - public function getTerminalDimensions() - { - if ($this->terminalDimensions) { - return $this->terminalDimensions; - } - - if ('\\' === DIRECTORY_SEPARATOR) { - // extract [w, H] from "wxh (WxH)" - if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) { - return array((int) $matches[1], (int) $matches[2]); - } - // extract [w, h] from "wxh" - if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) { - return array((int) $matches[1], (int) $matches[2]); - } - } - - if ($sttyString = $this->getSttyColumns()) { - // extract [w, h] from "rows h; columns w;" - if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) { - return array((int) $matches[2], (int) $matches[1]); - } - // extract [w, h] from "; h rows; w columns" - if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) { - return array((int) $matches[2], (int) $matches[1]); - } - } - - return array(null, null); - } - - /** - * Sets terminal dimensions. - * - * Can be useful to force terminal dimensions for functional tests. - * - * @param int $width The width - * @param int $height The height - * - * @return Application The current application - */ - public function setTerminalDimensions($width, $height) - { - $this->terminalDimensions = array($width, $height); - - return $this; - } - - /** - * Configures the input and output instances based on the user arguments and options. - * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance - */ - protected function configureIO(InputInterface $input, OutputInterface $output) - { - if (true === $input->hasParameterOption(array('--ansi'))) { - $output->setDecorated(true); - } elseif (true === $input->hasParameterOption(array('--no-ansi'))) { - $output->setDecorated(false); - } - - if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) { - $input->setInteractive(false); - } elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('question')) { - $inputStream = $this->getHelperSet()->get('question')->getInputStream(); - if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) { - $input->setInteractive(false); - } - } - - if (true === $input->hasParameterOption(array('--quiet', '-q'))) { - $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); - } else { - if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) { - $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG); - } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || $input->getParameterOption('--verbose') === 2) { - $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); - } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) { - $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); - } - } - } - - /** - * Runs the current command. - * - * If an event dispatcher has been attached to the application, - * events are also dispatched during the life-cycle of the command. - * - * @param Command $command A Command instance - * @param InputInterface $input An Input instance - * @param OutputInterface $output An Output instance - * - * @return int 0 if everything went fine, or an error code - * - * @throws \Exception when the command being run threw an exception - */ - protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output) - { - foreach ($command->getHelperSet() as $helper) { - if ($helper instanceof InputAwareInterface) { - $helper->setInput($input); - } - } - - if (null === $this->dispatcher) { - return $command->run($input, $output); - } - - $event = new ConsoleCommandEvent($command, $input, $output); - $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event); - - if ($event->commandShouldRun()) { - try { - $exitCode = $command->run($input, $output); - } catch (\Exception $e) { - $event = new ConsoleTerminateEvent($command, $input, $output, $e->getCode()); - $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event); - - $event = new ConsoleExceptionEvent($command, $input, $output, $e, $event->getExitCode()); - $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event); - - throw $event->getException(); - } - } else { - $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED; - } - - $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode); - $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event); - - return $event->getExitCode(); - } - - /** - * Gets the name of the command based on input. - * - * @param InputInterface $input The input interface - * - * @return string The command name - */ - protected function getCommandName(InputInterface $input) - { - return $input->getFirstArgument(); - } - - /** - * Gets the default input definition. - * - * @return InputDefinition An InputDefinition instance - */ - protected function getDefaultInputDefinition() - { - return new InputDefinition(array( - new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), - - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'), - new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'), - new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'), - new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'), - new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'), - new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'), - new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'), - )); - } - - /** - * Gets the default commands that should always be available. - * - * @return Command[] An array of default Command instances - */ - protected function getDefaultCommands() - { - return array(new HelpCommand(), new ListCommand()); - } - - /** - * Gets the default helper set with the helpers that should always be available. - * - * @return HelperSet A HelperSet instance - */ - protected function getDefaultHelperSet() - { - return new HelperSet(array( - new FormatterHelper(), - new DialogHelper(), - new ProgressHelper(), - new TableHelper(), - new DebugFormatterHelper(), - new ProcessHelper(), - new QuestionHelper(), - )); - } - - /** - * Runs and parses stty -a if it's available, suppressing any error output. - * - * @return string - */ - private function getSttyColumns() - { - if (!function_exists('proc_open')) { - return; - } - - $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w')); - $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true)); - if (is_resource($process)) { - $info = stream_get_contents($pipes[1]); - fclose($pipes[1]); - fclose($pipes[2]); - proc_close($process); - - return $info; - } - } - - /** - * Runs and parses mode CON if it's available, suppressing any error output. - * - * @return string x or null if it could not be parsed - */ - private function getConsoleMode() - { - if (!function_exists('proc_open')) { - return; - } - - $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w')); - $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true)); - if (is_resource($process)) { - $info = stream_get_contents($pipes[1]); - fclose($pipes[1]); - fclose($pipes[2]); - proc_close($process); - - if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { - return $matches[2].'x'.$matches[1]; - } - } - } - - /** - * Returns abbreviated suggestions in string format. - * - * @param array $abbrevs Abbreviated suggestions to convert - * - * @return string A formatted string of abbreviated suggestions - */ - private function getAbbreviationSuggestions($abbrevs) - { - return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : ''); - } - - /** - * Returns the namespace part of the command name. - * - * This method is not part of public API and should not be used directly. - * - * @param string $name The full name of the command - * @param string $limit The maximum number of parts of the namespace - * - * @return string The namespace of the command - */ - public function extractNamespace($name, $limit = null) - { - $parts = explode(':', $name); - array_pop($parts); - - return implode(':', null === $limit ? $parts : array_slice($parts, 0, $limit)); - } - - /** - * Finds alternative of $name among $collection, - * if nothing is found in $collection, try in $abbrevs. - * - * @param string $name The string - * @param array|\Traversable $collection The collection - * - * @return array A sorted array of similar string - */ - private function findAlternatives($name, $collection) - { - $threshold = 1e3; - $alternatives = array(); - - $collectionParts = array(); - foreach ($collection as $item) { - $collectionParts[$item] = explode(':', $item); - } - - foreach (explode(':', $name) as $i => $subname) { - foreach ($collectionParts as $collectionName => $parts) { - $exists = isset($alternatives[$collectionName]); - if (!isset($parts[$i]) && $exists) { - $alternatives[$collectionName] += $threshold; - continue; - } elseif (!isset($parts[$i])) { - continue; - } - - $lev = levenshtein($subname, $parts[$i]); - if ($lev <= strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) { - $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev; - } elseif ($exists) { - $alternatives[$collectionName] += $threshold; - } - } - } - - foreach ($collection as $item) { - $lev = levenshtein($name, $item); - if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) { - $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev; - } - } - - $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; }); - asort($alternatives); - - return array_keys($alternatives); - } - - /** - * Sets the default Command name. - * - * @param string $commandName The Command name - */ - public function setDefaultCommand($commandName) - { - $this->defaultCommand = $commandName; - } - - private function stringWidth($string) - { - if (!function_exists('mb_strwidth')) { - return strlen($string); - } - - if (false === $encoding = mb_detect_encoding($string)) { - return strlen($string); - } - - return mb_strwidth($string, $encoding); - } - - private function splitStringByWidth($string, $width) - { - // str_split is not suitable for multi-byte characters, we should use preg_split to get char array properly. - // additionally, array_slice() is not enough as some character has doubled width. - // we need a function to split string not by character count but by string width - - if (!function_exists('mb_strwidth')) { - return str_split($string, $width); - } - - if (false === $encoding = mb_detect_encoding($string)) { - return str_split($string, $width); - } - - $utf8String = mb_convert_encoding($string, 'utf8', $encoding); - $lines = array(); - $line = ''; - foreach (preg_split('//u', $utf8String) as $char) { - // test if $char could be appended to current line - if (mb_strwidth($line.$char, 'utf8') <= $width) { - $line .= $char; - continue; - } - // if not, push current line to array and make new line - $lines[] = str_pad($line, $width); - $line = $char; - } - if ('' !== $line) { - $lines[] = count($lines) ? str_pad($line, $width) : $line; - } - - mb_convert_variables($encoding, 'utf8', $lines); - - return $lines; - } - - /** - * Returns all namespaces of the command name. - * - * @param string $name The full name of the command - * - * @return array The namespaces of the command - */ - private function extractAllNamespaces($name) - { - // -1 as third argument is needed to skip the command short name when exploding - $parts = explode(':', $name, -1); - $namespaces = array(); - - foreach ($parts as $part) { - if (count($namespaces)) { - $namespaces[] = end($namespaces).':'.$part; - } else { - $namespaces[] = $part; - } - } - - return $namespaces; - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Command/Command.php b/application/vendor/symfony/console/Symfony/Component/Console/Command/Command.php deleted file mode 100644 index 20dd85b..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Command/Command.php +++ /dev/null @@ -1,661 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Command; - -use Symfony\Component\Console\Descriptor\TextDescriptor; -use Symfony\Component\Console\Descriptor\XmlDescriptor; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\BufferedOutput; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Application; -use Symfony\Component\Console\Helper\HelperSet; - -/** - * Base class for all commands. - * - * @author Fabien Potencier - * - * @api - */ -class Command -{ - private $application; - private $name; - private $processTitle; - private $aliases = array(); - private $definition; - private $help; - private $description; - private $ignoreValidationErrors = false; - private $applicationDefinitionMerged = false; - private $applicationDefinitionMergedWithArgs = false; - private $code; - private $synopsis; - private $helperSet; - - /** - * Constructor. - * - * @param string|null $name The name of the command; passing null means it must be set in configure() - * - * @throws \LogicException When the command name is empty - * - * @api - */ - public function __construct($name = null) - { - $this->definition = new InputDefinition(); - - if (null !== $name) { - $this->setName($name); - } - - $this->configure(); - - if (!$this->name) { - throw new \LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this))); - } - } - - /** - * Ignores validation errors. - * - * This is mainly useful for the help command. - */ - public function ignoreValidationErrors() - { - $this->ignoreValidationErrors = true; - } - - /** - * Sets the application instance for this command. - * - * @param Application $application An Application instance - * - * @api - */ - public function setApplication(Application $application = null) - { - $this->application = $application; - if ($application) { - $this->setHelperSet($application->getHelperSet()); - } else { - $this->helperSet = null; - } - } - - /** - * Sets the helper set. - * - * @param HelperSet $helperSet A HelperSet instance - */ - public function setHelperSet(HelperSet $helperSet) - { - $this->helperSet = $helperSet; - } - - /** - * Gets the helper set. - * - * @return HelperSet A HelperSet instance - */ - public function getHelperSet() - { - return $this->helperSet; - } - - /** - * Gets the application instance for this command. - * - * @return Application An Application instance - * - * @api - */ - public function getApplication() - { - return $this->application; - } - - /** - * Checks whether the command is enabled or not in the current environment. - * - * Override this to check for x or y and return false if the command can not - * run properly under the current conditions. - * - * @return bool - */ - public function isEnabled() - { - return true; - } - - /** - * Configures the current command. - */ - protected function configure() - { - } - - /** - * Executes the current command. - * - * This method is not abstract because you can use this class - * as a concrete class. In this case, instead of defining the - * execute() method, you set the code to execute by passing - * a Closure to the setCode() method. - * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance - * - * @return null|int null or 0 if everything went fine, or an error code - * - * @throws \LogicException When this abstract method is not implemented - * - * @see setCode() - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - throw new \LogicException('You must override the execute() method in the concrete command class.'); - } - - /** - * Interacts with the user. - * - * This method is executed before the InputDefinition is validated. - * This means that this is the only place where the command can - * interactively ask for values of missing required arguments. - * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - } - - /** - * Initializes the command just after the input has been validated. - * - * This is mainly useful when a lot of commands extends one main command - * where some things need to be initialized based on the input arguments and options. - * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance - */ - protected function initialize(InputInterface $input, OutputInterface $output) - { - } - - /** - * Runs the command. - * - * The code to execute is either defined directly with the - * setCode() method or by overriding the execute() method - * in a sub-class. - * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance - * - * @return int The command exit code - * - * @throws \Exception - * - * @see setCode() - * @see execute() - * - * @api - */ - public function run(InputInterface $input, OutputInterface $output) - { - // force the creation of the synopsis before the merge with the app definition - $this->getSynopsis(); - - // add the application arguments and options - $this->mergeApplicationDefinition(); - - // bind the input against the command specific arguments/options - try { - $input->bind($this->definition); - } catch (\Exception $e) { - if (!$this->ignoreValidationErrors) { - throw $e; - } - } - - $this->initialize($input, $output); - - if (null !== $this->processTitle) { - if (function_exists('cli_set_process_title')) { - cli_set_process_title($this->processTitle); - } elseif (function_exists('setproctitle')) { - setproctitle($this->processTitle); - } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) { - $output->writeln('Install the proctitle PECL to be able to change the process title.'); - } - } - - if ($input->isInteractive()) { - $this->interact($input, $output); - } - - $input->validate(); - - if ($this->code) { - $statusCode = call_user_func($this->code, $input, $output); - } else { - $statusCode = $this->execute($input, $output); - } - - return is_numeric($statusCode) ? (int) $statusCode : 0; - } - - /** - * Sets the code to execute when running this command. - * - * If this method is used, it overrides the code defined - * in the execute() method. - * - * @param callable $code A callable(InputInterface $input, OutputInterface $output) - * - * @return Command The current instance - * - * @throws \InvalidArgumentException - * - * @see execute() - * - * @api - */ - public function setCode($code) - { - if (!is_callable($code)) { - throw new \InvalidArgumentException('Invalid callable provided to Command::setCode.'); - } - - $this->code = $code; - - return $this; - } - - /** - * Merges the application definition with the command definition. - * - * This method is not part of public API and should not be used directly. - * - * @param bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments - */ - public function mergeApplicationDefinition($mergeArgs = true) - { - if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) { - return; - } - - if ($mergeArgs) { - $currentArguments = $this->definition->getArguments(); - $this->definition->setArguments($this->application->getDefinition()->getArguments()); - $this->definition->addArguments($currentArguments); - } - - $this->definition->addOptions($this->application->getDefinition()->getOptions()); - - $this->applicationDefinitionMerged = true; - if ($mergeArgs) { - $this->applicationDefinitionMergedWithArgs = true; - } - } - - /** - * Sets an array of argument and option instances. - * - * @param array|InputDefinition $definition An array of argument and option instances or a definition instance - * - * @return Command The current instance - * - * @api - */ - public function setDefinition($definition) - { - if ($definition instanceof InputDefinition) { - $this->definition = $definition; - } else { - $this->definition->setDefinition($definition); - } - - $this->applicationDefinitionMerged = false; - - return $this; - } - - /** - * Gets the InputDefinition attached to this Command. - * - * @return InputDefinition An InputDefinition instance - * - * @api - */ - public function getDefinition() - { - return $this->definition; - } - - /** - * Gets the InputDefinition to be used to create XML and Text representations of this Command. - * - * Can be overridden to provide the original command representation when it would otherwise - * be changed by merging with the application InputDefinition. - * - * This method is not part of public API and should not be used directly. - * - * @return InputDefinition An InputDefinition instance - */ - public function getNativeDefinition() - { - return $this->getDefinition(); - } - - /** - * Adds an argument. - * - * @param string $name The argument name - * @param int $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL - * @param string $description A description text - * @param mixed $default The default value (for InputArgument::OPTIONAL mode only) - * - * @return Command The current instance - * - * @api - */ - public function addArgument($name, $mode = null, $description = '', $default = null) - { - $this->definition->addArgument(new InputArgument($name, $mode, $description, $default)); - - return $this; - } - - /** - * Adds an option. - * - * @param string $name The option name - * @param string $shortcut The shortcut (can be null) - * @param int $mode The option mode: One of the InputOption::VALUE_* constants - * @param string $description A description text - * @param mixed $default The default value (must be null for InputOption::VALUE_REQUIRED or InputOption::VALUE_NONE) - * - * @return Command The current instance - * - * @api - */ - public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null) - { - $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default)); - - return $this; - } - - /** - * Sets the name of the command. - * - * This method can set both the namespace and the name if - * you separate them by a colon (:) - * - * $command->setName('foo:bar'); - * - * @param string $name The command name - * - * @return Command The current instance - * - * @throws \InvalidArgumentException When the name is invalid - * - * @api - */ - public function setName($name) - { - $this->validateName($name); - - $this->name = $name; - - return $this; - } - - /** - * Sets the process title of the command. - * - * This feature should be used only when creating a long process command, - * like a daemon. - * - * PHP 5.5+ or the proctitle PECL library is required - * - * @param string $title The process title - * - * @return Command The current instance - */ - public function setProcessTitle($title) - { - $this->processTitle = $title; - - return $this; - } - - /** - * Returns the command name. - * - * @return string The command name - * - * @api - */ - public function getName() - { - return $this->name; - } - - /** - * Sets the description for the command. - * - * @param string $description The description for the command - * - * @return Command The current instance - * - * @api - */ - public function setDescription($description) - { - $this->description = $description; - - return $this; - } - - /** - * Returns the description for the command. - * - * @return string The description for the command - * - * @api - */ - public function getDescription() - { - return $this->description; - } - - /** - * Sets the help for the command. - * - * @param string $help The help for the command - * - * @return Command The current instance - * - * @api - */ - public function setHelp($help) - { - $this->help = $help; - - return $this; - } - - /** - * Returns the help for the command. - * - * @return string The help for the command - * - * @api - */ - public function getHelp() - { - return $this->help; - } - - /** - * Returns the processed help for the command replacing the %command.name% and - * %command.full_name% patterns with the real values dynamically. - * - * @return string The processed help for the command - */ - public function getProcessedHelp() - { - $name = $this->name; - - $placeholders = array( - '%command.name%', - '%command.full_name%', - ); - $replacements = array( - $name, - $_SERVER['PHP_SELF'].' '.$name, - ); - - return str_replace($placeholders, $replacements, $this->getHelp()); - } - - /** - * Sets the aliases for the command. - * - * @param string[] $aliases An array of aliases for the command - * - * @return Command The current instance - * - * @throws \InvalidArgumentException When an alias is invalid - * - * @api - */ - public function setAliases($aliases) - { - if (!is_array($aliases) && !$aliases instanceof \Traversable) { - throw new \InvalidArgumentException('$aliases must be an array or an instance of \Traversable'); - } - - foreach ($aliases as $alias) { - $this->validateName($alias); - } - - $this->aliases = $aliases; - - return $this; - } - - /** - * Returns the aliases for the command. - * - * @return array An array of aliases for the command - * - * @api - */ - public function getAliases() - { - return $this->aliases; - } - - /** - * Returns the synopsis for the command. - * - * @return string The synopsis - */ - public function getSynopsis() - { - if (null === $this->synopsis) { - $this->synopsis = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis())); - } - - return $this->synopsis; - } - - /** - * Gets a helper instance by name. - * - * @param string $name The helper name - * - * @return mixed The helper value - * - * @throws \InvalidArgumentException if the helper is not defined - * - * @api - */ - public function getHelper($name) - { - return $this->helperSet->get($name); - } - - /** - * Returns a text representation of the command. - * - * @return string A string representing the command - * - * @deprecated Deprecated since version 2.3, to be removed in 3.0. - */ - public function asText() - { - $descriptor = new TextDescriptor(); - $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true); - $descriptor->describe($output, $this, array('raw_output' => true)); - - return $output->fetch(); - } - - /** - * Returns an XML representation of the command. - * - * @param bool $asDom Whether to return a DOM or an XML string - * - * @return string|\DOMDocument An XML string representing the command - * - * @deprecated Deprecated since version 2.3, to be removed in 3.0. - */ - public function asXml($asDom = false) - { - $descriptor = new XmlDescriptor(); - - if ($asDom) { - return $descriptor->getCommandDocument($this); - } - - $output = new BufferedOutput(); - $descriptor->describe($output, $this); - - return $output->fetch(); - } - - /** - * Validates a command name. - * - * It must be non-empty and parts can optionally be separated by ":". - * - * @param string $name - * - * @throws \InvalidArgumentException When the name is invalid - */ - private function validateName($name) - { - if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) { - throw new \InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name)); - } - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/TextDescriptor.php b/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/TextDescriptor.php deleted file mode 100644 index fcc4411..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Descriptor/TextDescriptor.php +++ /dev/null @@ -1,255 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Descriptor; - -use Symfony\Component\Console\Application; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputOption; - -/** - * Text descriptor. - * - * @author Jean-François Simon - * - * @internal - */ -class TextDescriptor extends Descriptor -{ - /** - * {@inheritdoc} - */ - protected function describeInputArgument(InputArgument $argument, array $options = array()) - { - if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) { - $default = sprintf(' (default: %s)', $this->formatDefaultValue($argument->getDefault())); - } else { - $default = ''; - } - - $nameWidth = isset($options['name_width']) ? $options['name_width'] : strlen($argument->getName()); - - $this->writeText(sprintf(" %-${nameWidth}s %s%s", - $argument->getName(), - str_replace("\n", "\n".str_repeat(' ', $nameWidth + 2), $argument->getDescription()), - $default - ), $options); - } - - /** - * {@inheritdoc} - */ - protected function describeInputOption(InputOption $option, array $options = array()) - { - if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) { - $default = sprintf(' (default: %s)', $this->formatDefaultValue($option->getDefault())); - } else { - $default = ''; - } - - $nameWidth = isset($options['name_width']) ? $options['name_width'] : strlen($option->getName()); - $nameWithShortcutWidth = $nameWidth - strlen($option->getName()) - 2; - - $this->writeText(sprintf(" %s %-${nameWithShortcutWidth}s%s%s%s", - '--'.$option->getName(), - $option->getShortcut() ? sprintf('(-%s) ', $option->getShortcut()) : '', - str_replace("\n", "\n".str_repeat(' ', $nameWidth + 2), $option->getDescription()), - $default, - $option->isArray() ? ' (multiple values allowed)' : '' - ), $options); - } - - /** - * {@inheritdoc} - */ - protected function describeInputDefinition(InputDefinition $definition, array $options = array()) - { - $nameWidth = 0; - foreach ($definition->getOptions() as $option) { - $nameLength = strlen($option->getName()) + 2; - if ($option->getShortcut()) { - $nameLength += strlen($option->getShortcut()) + 3; - } - $nameWidth = max($nameWidth, $nameLength); - } - foreach ($definition->getArguments() as $argument) { - $nameWidth = max($nameWidth, strlen($argument->getName())); - } - ++$nameWidth; - - if ($definition->getArguments()) { - $this->writeText('Arguments:', $options); - $this->writeText("\n"); - foreach ($definition->getArguments() as $argument) { - $this->describeInputArgument($argument, array_merge($options, array('name_width' => $nameWidth))); - $this->writeText("\n"); - } - } - - if ($definition->getArguments() && $definition->getOptions()) { - $this->writeText("\n"); - } - - if ($definition->getOptions()) { - $this->writeText('Options:', $options); - $this->writeText("\n"); - foreach ($definition->getOptions() as $option) { - $this->describeInputOption($option, array_merge($options, array('name_width' => $nameWidth))); - $this->writeText("\n"); - } - } - } - - /** - * {@inheritdoc} - */ - protected function describeCommand(Command $command, array $options = array()) - { - $command->getSynopsis(); - $command->mergeApplicationDefinition(false); - - $this->writeText('Usage:', $options); - $this->writeText("\n"); - $this->writeText(' '.$command->getSynopsis(), $options); - $this->writeText("\n"); - - if (count($command->getAliases()) > 0) { - $this->writeText("\n"); - $this->writeText('Aliases: '.implode(', ', $command->getAliases()).'', $options); - } - - if ($definition = $command->getNativeDefinition()) { - $this->writeText("\n"); - $this->describeInputDefinition($definition, $options); - } - - $this->writeText("\n"); - - if ($help = $command->getProcessedHelp()) { - $this->writeText('Help:', $options); - $this->writeText("\n"); - $this->writeText(' '.str_replace("\n", "\n ", $help), $options); - $this->writeText("\n"); - } - } - - /** - * {@inheritdoc} - */ - protected function describeApplication(Application $application, array $options = array()) - { - $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null; - $description = new ApplicationDescription($application, $describedNamespace); - - if (isset($options['raw_text']) && $options['raw_text']) { - $width = $this->getColumnWidth($description->getCommands()); - - foreach ($description->getCommands() as $command) { - $this->writeText(sprintf("%-${width}s %s", $command->getName(), $command->getDescription()), $options); - $this->writeText("\n"); - } - } else { - if ('' != $help = $application->getHelp()) { - $this->writeText("$help\n\n", $options); - } - - $this->writeText("Usage:\n", $options); - $this->writeText(" command [options] [arguments]\n\n", $options); - $this->writeText('Options:', $options); - - $inputOptions = $application->getDefinition()->getOptions(); - - $width = 0; - foreach ($inputOptions as $option) { - $nameLength = strlen($option->getName()) + 2; - if ($option->getShortcut()) { - $nameLength += strlen($option->getShortcut()) + 3; - } - $width = max($width, $nameLength); - } - ++$width; - - foreach ($inputOptions as $option) { - $this->writeText("\n", $options); - $this->describeInputOption($option, array_merge($options, array('name_width' => $width))); - } - - $this->writeText("\n\n", $options); - - $width = $this->getColumnWidth($description->getCommands()); - - if ($describedNamespace) { - $this->writeText(sprintf('Available commands for the "%s" namespace:', $describedNamespace), $options); - } else { - $this->writeText('Available commands:', $options); - } - - // add commands by namespace - foreach ($description->getNamespaces() as $namespace) { - if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) { - $this->writeText("\n"); - $this->writeText(''.$namespace['id'].'', $options); - } - - foreach ($namespace['commands'] as $name) { - $this->writeText("\n"); - $this->writeText(sprintf(" %-${width}s %s", $name, $description->getCommand($name)->getDescription()), $options); - } - } - - $this->writeText("\n"); - } - } - - /** - * {@inheritdoc} - */ - private function writeText($content, array $options = array()) - { - $this->write( - isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content, - isset($options['raw_output']) ? !$options['raw_output'] : true - ); - } - - /** - * Formats input option/argument default value. - * - * @param mixed $default - * - * @return string - */ - private function formatDefaultValue($default) - { - if (PHP_VERSION_ID < 50400) { - return str_replace('\/', '/', json_encode($default)); - } - - return json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); - } - - /** - * @param Command[] $commands - * - * @return int - */ - private function getColumnWidth(array $commands) - { - $width = 0; - foreach ($commands as $command) { - $width = strlen($command->getName()) > $width ? strlen($command->getName()) : $width; - } - - return $width + 2; - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/Helper.php b/application/vendor/symfony/console/Symfony/Component/Console/Helper/Helper.php deleted file mode 100644 index b288d44..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Helper/Helper.php +++ /dev/null @@ -1,121 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Formatter\OutputFormatterInterface; - -/** - * Helper is the base class for all helper classes. - * - * @author Fabien Potencier - */ -abstract class Helper implements HelperInterface -{ - protected $helperSet = null; - - /** - * Sets the helper set associated with this helper. - * - * @param HelperSet $helperSet A HelperSet instance - */ - public function setHelperSet(HelperSet $helperSet = null) - { - $this->helperSet = $helperSet; - } - - /** - * Gets the helper set associated with this helper. - * - * @return HelperSet A HelperSet instance - */ - public function getHelperSet() - { - return $this->helperSet; - } - - /** - * Returns the length of a string, using mb_strwidth if it is available. - * - * @param string $string The string to check its length - * - * @return int The length of the string - */ - public static function strlen($string) - { - if (!function_exists('mb_strwidth')) { - return strlen($string); - } - - if (false === $encoding = mb_detect_encoding($string)) { - return strlen($string); - } - - return mb_strwidth($string, $encoding); - } - - public static function formatTime($secs) - { - static $timeFormats = array( - array(0, '< 1 sec'), - array(2, '1 sec'), - array(59, 'secs', 1), - array(60, '1 min'), - array(3600, 'mins', 60), - array(5400, '1 hr'), - array(86400, 'hrs', 3600), - array(129600, '1 day'), - array(604800, 'days', 86400), - ); - - foreach ($timeFormats as $format) { - if ($secs >= $format[0]) { - continue; - } - - if (2 == count($format)) { - return $format[1]; - } - - return ceil($secs / $format[2]).' '.$format[1]; - } - } - - public static function formatMemory($memory) - { - if ($memory >= 1024 * 1024 * 1024) { - return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024); - } - - if ($memory >= 1024 * 1024) { - return sprintf('%.1f MiB', $memory / 1024 / 1024); - } - - if ($memory >= 1024) { - return sprintf('%d KiB', $memory / 1024); - } - - return sprintf('%d B', $memory); - } - - public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string) - { - $isDecorated = $formatter->isDecorated(); - $formatter->setDecorated(false); - // remove <...> formatting - $string = $formatter->format($string); - // remove already formatted characters - $string = preg_replace("/\033\[[^m]*m/", '', $string); - $formatter->setDecorated($isDecorated); - - return self::strlen($string); - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/HelperSet.php b/application/vendor/symfony/console/Symfony/Component/Console/Helper/HelperSet.php deleted file mode 100644 index 467be86..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Helper/HelperSet.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Command\Command; - -/** - * HelperSet represents a set of helpers to be used with a command. - * - * @author Fabien Potencier - */ -class HelperSet implements \IteratorAggregate -{ - private $helpers = array(); - private $command; - - /** - * Constructor. - * - * @param Helper[] $helpers An array of helper. - */ - public function __construct(array $helpers = array()) - { - foreach ($helpers as $alias => $helper) { - $this->set($helper, is_int($alias) ? null : $alias); - } - } - - /** - * Sets a helper. - * - * @param HelperInterface $helper The helper instance - * @param string $alias An alias - */ - public function set(HelperInterface $helper, $alias = null) - { - $this->helpers[$helper->getName()] = $helper; - if (null !== $alias) { - $this->helpers[$alias] = $helper; - } - - $helper->setHelperSet($this); - } - - /** - * Returns true if the helper if defined. - * - * @param string $name The helper name - * - * @return bool true if the helper is defined, false otherwise - */ - public function has($name) - { - return isset($this->helpers[$name]); - } - - /** - * Gets a helper value. - * - * @param string $name The helper name - * - * @return HelperInterface The helper instance - * - * @throws \InvalidArgumentException if the helper is not defined - */ - public function get($name) - { - if (!$this->has($name)) { - throw new \InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name)); - } - - return $this->helpers[$name]; - } - - /** - * Sets the command associated with this helper set. - * - * @param Command $command A Command instance - */ - public function setCommand(Command $command = null) - { - $this->command = $command; - } - - /** - * Gets the command associated with this helper set. - * - * @return Command A Command instance - */ - public function getCommand() - { - return $this->command; - } - - public function getIterator() - { - return new \ArrayIterator($this->helpers); - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/Table.php b/application/vendor/symfony/console/Symfony/Component/Console/Helper/Table.php deleted file mode 100644 index 69c60b3..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Helper/Table.php +++ /dev/null @@ -1,410 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Provides helpers to display a table. - * - * @author Fabien Potencier - * @author Саша Стаменковић - */ -class Table -{ - /** - * Table headers. - * - * @var array - */ - private $headers = array(); - - /** - * Table rows. - * - * @var array - */ - private $rows = array(); - - /** - * Column widths cache. - * - * @var array - */ - private $columnWidths = array(); - - /** - * Number of columns cache. - * - * @var array - */ - private $numberOfColumns; - - /** - * @var OutputInterface - */ - private $output; - - /** - * @var TableStyle - */ - private $style; - - private static $styles; - - public function __construct(OutputInterface $output) - { - $this->output = $output; - - if (!self::$styles) { - self::$styles = self::initStyles(); - } - - $this->setStyle('default'); - } - - /** - * Sets a style definition. - * - * @param string $name The style name - * @param TableStyle $style A TableStyle instance - */ - public static function setStyleDefinition($name, TableStyle $style) - { - if (!self::$styles) { - self::$styles = self::initStyles(); - } - - self::$styles[$name] = $style; - } - - /** - * Gets a style definition by name. - * - * @param string $name The style name - * - * @return TableStyle A TableStyle instance - */ - public static function getStyleDefinition($name) - { - if (!self::$styles) { - self::$styles = self::initStyles(); - } - - if (!self::$styles[$name]) { - throw new \InvalidArgumentException(sprintf('Style "%s" is not defined.', $name)); - } - - return self::$styles[$name]; - } - - /** - * Sets table style. - * - * @param TableStyle|string $name The style name or a TableStyle instance - * - * @return Table - */ - public function setStyle($name) - { - if ($name instanceof TableStyle) { - $this->style = $name; - } elseif (isset(self::$styles[$name])) { - $this->style = self::$styles[$name]; - } else { - throw new \InvalidArgumentException(sprintf('Style "%s" is not defined.', $name)); - } - - return $this; - } - - /** - * Gets the current table style. - * - * @return TableStyle - */ - public function getStyle() - { - return $this->style; - } - - public function setHeaders(array $headers) - { - $this->headers = array_values($headers); - - return $this; - } - - public function setRows(array $rows) - { - $this->rows = array(); - - return $this->addRows($rows); - } - - public function addRows(array $rows) - { - foreach ($rows as $row) { - $this->addRow($row); - } - - return $this; - } - - public function addRow($row) - { - if ($row instanceof TableSeparator) { - $this->rows[] = $row; - - return $this; - } - - if (!is_array($row)) { - throw new \InvalidArgumentException('A row must be an array or a TableSeparator instance.'); - } - - $this->rows[] = array_values($row); - - end($this->rows); - $rowKey = key($this->rows); - reset($this->rows); - - foreach ($row as $key => $cellValue) { - if (false === strpos($cellValue, "\n")) { - continue; - } - - $lines = explode("\n", $cellValue); - $this->rows[$rowKey][$key] = $lines[0]; - unset($lines[0]); - - foreach ($lines as $lineKey => $line) { - $nextRowKey = $rowKey + $lineKey + 1; - - if (isset($this->rows[$nextRowKey])) { - $this->rows[$nextRowKey][$key] = $line; - } else { - $this->rows[$nextRowKey] = array($key => $line); - } - } - } - - return $this; - } - - public function setRow($column, array $row) - { - $this->rows[$column] = $row; - - return $this; - } - - /** - * Renders table to output. - * - * Example: - * +---------------+-----------------------+------------------+ - * | ISBN | Title | Author | - * +---------------+-----------------------+------------------+ - * | 99921-58-10-7 | Divine Comedy | Dante Alighieri | - * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | - * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | - * +---------------+-----------------------+------------------+ - */ - public function render() - { - $this->renderRowSeparator(); - $this->renderRow($this->headers, $this->style->getCellHeaderFormat()); - if (!empty($this->headers)) { - $this->renderRowSeparator(); - } - foreach ($this->rows as $row) { - if ($row instanceof TableSeparator) { - $this->renderRowSeparator(); - } else { - $this->renderRow($row, $this->style->getCellRowFormat()); - } - } - if (!empty($this->rows)) { - $this->renderRowSeparator(); - } - - $this->cleanup(); - } - - /** - * Renders horizontal header separator. - * - * Example: +-----+-----------+-------+ - */ - private function renderRowSeparator() - { - if (0 === $count = $this->getNumberOfColumns()) { - return; - } - - if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) { - return; - } - - $markup = $this->style->getCrossingChar(); - for ($column = 0; $column < $count; $column++) { - $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->getColumnWidth($column)).$this->style->getCrossingChar(); - } - - $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup)); - } - - /** - * Renders vertical column separator. - */ - private function renderColumnSeparator() - { - $this->output->write(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar())); - } - - /** - * Renders table row. - * - * Example: | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | - * - * @param array $row - * @param string $cellFormat - */ - private function renderRow(array $row, $cellFormat) - { - if (empty($row)) { - return; - } - - $this->renderColumnSeparator(); - for ($column = 0, $count = $this->getNumberOfColumns(); $column < $count; $column++) { - $this->renderCell($row, $column, $cellFormat); - $this->renderColumnSeparator(); - } - $this->output->writeln(''); - } - - /** - * Renders table cell with padding. - * - * @param array $row - * @param int $column - * @param string $cellFormat - */ - private function renderCell(array $row, $column, $cellFormat) - { - $cell = isset($row[$column]) ? $row[$column] : ''; - $width = $this->getColumnWidth($column); - - // str_pad won't work properly with multi-byte strings, we need to fix the padding - if (function_exists('mb_strwidth') && false !== $encoding = mb_detect_encoding($cell)) { - $width += strlen($cell) - mb_strwidth($cell, $encoding); - } - - $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell); - - $content = sprintf($this->style->getCellRowContentFormat(), $cell); - - $this->output->write(sprintf($cellFormat, str_pad($content, $width, $this->style->getPaddingChar(), $this->style->getPadType()))); - } - - /** - * Gets number of columns for this table. - * - * @return int - */ - private function getNumberOfColumns() - { - if (null !== $this->numberOfColumns) { - return $this->numberOfColumns; - } - - $columns = array(count($this->headers)); - foreach ($this->rows as $row) { - $columns[] = count($row); - } - - return $this->numberOfColumns = max($columns); - } - - /** - * Gets column width. - * - * @param int $column - * - * @return int - */ - private function getColumnWidth($column) - { - if (isset($this->columnWidths[$column])) { - return $this->columnWidths[$column]; - } - - $lengths = array($this->getCellWidth($this->headers, $column)); - foreach ($this->rows as $row) { - if ($row instanceof TableSeparator) { - continue; - } - - $lengths[] = $this->getCellWidth($row, $column); - } - - return $this->columnWidths[$column] = max($lengths) + strlen($this->style->getCellRowContentFormat()) - 2; - } - - /** - * Gets cell width. - * - * @param array $row - * @param int $column - * - * @return int - */ - private function getCellWidth(array $row, $column) - { - return isset($row[$column]) ? Helper::strlenWithoutDecoration($this->output->getFormatter(), $row[$column]) : 0; - } - - /** - * Called after rendering to cleanup cache data. - */ - private function cleanup() - { - $this->columnWidths = array(); - $this->numberOfColumns = null; - } - - private static function initStyles() - { - $borderless = new TableStyle(); - $borderless - ->setHorizontalBorderChar('=') - ->setVerticalBorderChar(' ') - ->setCrossingChar(' ') - ; - - $compact = new TableStyle(); - $compact - ->setHorizontalBorderChar('') - ->setVerticalBorderChar(' ') - ->setCrossingChar('') - ->setCellRowContentFormat('%s') - ; - - return array( - 'default' => new TableStyle(), - 'borderless' => $borderless, - 'compact' => $compact, - ); - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Helper/TableSeparator.php b/application/vendor/symfony/console/Symfony/Component/Console/Helper/TableSeparator.php deleted file mode 100644 index 1f6981b..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Helper/TableSeparator.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -/** - * Marks a row as being a separator. - * - * @author Fabien Potencier - */ -class TableSeparator -{ -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Input/Input.php b/application/vendor/symfony/console/Symfony/Component/Console/Input/Input.php deleted file mode 100644 index 5e7c140..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Input/Input.php +++ /dev/null @@ -1,226 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Input; - -/** - * Input is the base class for all concrete Input classes. - * - * Three concrete classes are provided by default: - * - * * `ArgvInput`: The input comes from the CLI arguments (argv) - * * `StringInput`: The input is provided as a string - * * `ArrayInput`: The input is provided as an array - * - * @author Fabien Potencier - */ -abstract class Input implements InputInterface -{ - /** - * @var InputDefinition - */ - protected $definition; - protected $options = array(); - protected $arguments = array(); - protected $interactive = true; - - /** - * Constructor. - * - * @param InputDefinition $definition A InputDefinition instance - */ - public function __construct(InputDefinition $definition = null) - { - if (null === $definition) { - $this->definition = new InputDefinition(); - } else { - $this->bind($definition); - $this->validate(); - } - } - - /** - * Binds the current Input instance with the given arguments and options. - * - * @param InputDefinition $definition A InputDefinition instance - */ - public function bind(InputDefinition $definition) - { - $this->arguments = array(); - $this->options = array(); - $this->definition = $definition; - - $this->parse(); - } - - /** - * Processes command line arguments. - */ - abstract protected function parse(); - - /** - * Validates the input. - * - * @throws \RuntimeException When not enough arguments are given - */ - public function validate() - { - if (count($this->arguments) < $this->definition->getArgumentRequiredCount()) { - throw new \RuntimeException('Not enough arguments.'); - } - } - - /** - * Checks if the input is interactive. - * - * @return bool Returns true if the input is interactive - */ - public function isInteractive() - { - return $this->interactive; - } - - /** - * Sets the input interactivity. - * - * @param bool $interactive If the input should be interactive - */ - public function setInteractive($interactive) - { - $this->interactive = (bool) $interactive; - } - - /** - * Returns the argument values. - * - * @return array An array of argument values - */ - public function getArguments() - { - return array_merge($this->definition->getArgumentDefaults(), $this->arguments); - } - - /** - * Returns the argument value for a given argument name. - * - * @param string $name The argument name - * - * @return mixed The argument value - * - * @throws \InvalidArgumentException When argument given doesn't exist - */ - public function getArgument($name) - { - if (!$this->definition->hasArgument($name)) { - throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); - } - - return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault(); - } - - /** - * Sets an argument value by name. - * - * @param string $name The argument name - * @param string $value The argument value - * - * @throws \InvalidArgumentException When argument given doesn't exist - */ - public function setArgument($name, $value) - { - if (!$this->definition->hasArgument($name)) { - throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); - } - - $this->arguments[$name] = $value; - } - - /** - * Returns true if an InputArgument object exists by name or position. - * - * @param string|int $name The InputArgument name or position - * - * @return bool true if the InputArgument object exists, false otherwise - */ - public function hasArgument($name) - { - return $this->definition->hasArgument($name); - } - - /** - * Returns the options values. - * - * @return array An array of option values - */ - public function getOptions() - { - return array_merge($this->definition->getOptionDefaults(), $this->options); - } - - /** - * Returns the option value for a given option name. - * - * @param string $name The option name - * - * @return mixed The option value - * - * @throws \InvalidArgumentException When option given doesn't exist - */ - public function getOption($name) - { - if (!$this->definition->hasOption($name)) { - throw new \InvalidArgumentException(sprintf('The "%s" option does not exist.', $name)); - } - - return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault(); - } - - /** - * Sets an option value by name. - * - * @param string $name The option name - * @param string|bool $value The option value - * - * @throws \InvalidArgumentException When option given doesn't exist - */ - public function setOption($name, $value) - { - if (!$this->definition->hasOption($name)) { - throw new \InvalidArgumentException(sprintf('The "%s" option does not exist.', $name)); - } - - $this->options[$name] = $value; - } - - /** - * Returns true if an InputOption object exists by name. - * - * @param string $name The InputOption name - * - * @return bool true if the InputOption object exists, false otherwise - */ - public function hasOption($name) - { - return $this->definition->hasOption($name); - } - - /** - * Escapes a token through escapeshellarg if it contains unsafe chars. - * - * @param string $token - * - * @return string - */ - public function escapeToken($token) - { - return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token); - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/LICENSE b/application/vendor/symfony/console/Symfony/Component/Console/LICENSE deleted file mode 100644 index 43028bc..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Output/StreamOutput.php b/application/vendor/symfony/console/Symfony/Component/Console/Output/StreamOutput.php deleted file mode 100644 index 494cded..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Output/StreamOutput.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Output; - -use Symfony\Component\Console\Formatter\OutputFormatterInterface; - -/** - * StreamOutput writes the output to a given stream. - * - * Usage: - * - * $output = new StreamOutput(fopen('php://stdout', 'w')); - * - * As `StreamOutput` can use any stream, you can also use a file: - * - * $output = new StreamOutput(fopen('/path/to/output.log', 'a', false)); - * - * @author Fabien Potencier - * - * @api - */ -class StreamOutput extends Output -{ - private $stream; - - /** - * Constructor. - * - * @param mixed $stream A stream resource - * @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface) - * @param bool|null $decorated Whether to decorate messages (null for auto-guessing) - * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter) - * - * @throws \InvalidArgumentException When first argument is not a real stream - * - * @api - */ - public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null) - { - if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) { - throw new \InvalidArgumentException('The StreamOutput class needs a stream as its first argument.'); - } - - $this->stream = $stream; - - if (null === $decorated) { - $decorated = $this->hasColorSupport(); - } - - parent::__construct($verbosity, $decorated, $formatter); - } - - /** - * Gets the stream attached to this StreamOutput instance. - * - * @return resource A stream resource - */ - public function getStream() - { - return $this->stream; - } - - /** - * {@inheritdoc} - */ - protected function doWrite($message, $newline) - { - if (false === @fwrite($this->stream, $message.($newline ? PHP_EOL : ''))) { - // should never happen - throw new \RuntimeException('Unable to write output.'); - } - - fflush($this->stream); - } - - /** - * Returns true if the stream supports colorization. - * - * Colorization is disabled if not supported by the stream: - * - * - Windows without Ansicon and ConEmu - * - non tty consoles - * - * @return bool true if the stream supports colorization, false otherwise - */ - protected function hasColorSupport() - { - if (DIRECTORY_SEPARATOR === '\\') { - return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'); - } - - return function_exists('posix_isatty') && @posix_isatty($this->stream); - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Question/ChoiceQuestion.php b/application/vendor/symfony/console/Symfony/Component/Console/Question/ChoiceQuestion.php deleted file mode 100644 index 7a67e4c..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Question/ChoiceQuestion.php +++ /dev/null @@ -1,151 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Question; - -/** - * Represents a choice question. - * - * @author Fabien Potencier - */ -class ChoiceQuestion extends Question -{ - private $choices; - private $multiselect = false; - private $prompt = ' > '; - private $errorMessage = 'Value "%s" is invalid'; - - /** - * Constructor. - * - * @param string $question The question to ask to the user - * @param array $choices The list of available choices - * @param mixed $default The default answer to return - */ - public function __construct($question, array $choices, $default = null) - { - parent::__construct($question, $default); - - $this->choices = $choices; - $this->setValidator($this->getDefaultValidator()); - $this->setAutocompleterValues(array_keys($choices)); - } - - /** - * Returns available choices. - * - * @return array - */ - public function getChoices() - { - return $this->choices; - } - - /** - * Sets multiselect option. - * - * When multiselect is set to true, multiple choices can be answered. - * - * @param bool $multiselect - * - * @return ChoiceQuestion The current instance - */ - public function setMultiselect($multiselect) - { - $this->multiselect = $multiselect; - $this->setValidator($this->getDefaultValidator()); - - return $this; - } - - /** - * Gets the prompt for choices. - * - * @return string - */ - public function getPrompt() - { - return $this->prompt; - } - - /** - * Sets the prompt for choices. - * - * @param string $prompt - * - * @return ChoiceQuestion The current instance - */ - public function setPrompt($prompt) - { - $this->prompt = $prompt; - - return $this; - } - - /** - * Sets the error message for invalid values. - * - * The error message has a string placeholder (%s) for the invalid value. - * - * @param string $errorMessage - * - * @return ChoiceQuestion The current instance - */ - public function setErrorMessage($errorMessage) - { - $this->errorMessage = $errorMessage; - $this->setValidator($this->getDefaultValidator()); - - return $this; - } - - /** - * Returns the default answer validator. - * - * @return callable - */ - private function getDefaultValidator() - { - $choices = $this->choices; - $errorMessage = $this->errorMessage; - $multiselect = $this->multiselect; - - return function ($selected) use ($choices, $errorMessage, $multiselect) { - // Collapse all spaces. - $selectedChoices = str_replace(' ', '', $selected); - - if ($multiselect) { - // Check for a separated comma values - if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) { - throw new \InvalidArgumentException(sprintf($errorMessage, $selected)); - } - $selectedChoices = explode(',', $selectedChoices); - } else { - $selectedChoices = array($selected); - } - - $multiselectChoices = array(); - foreach ($selectedChoices as $value) { - if (empty($choices[$value])) { - throw new \InvalidArgumentException(sprintf($errorMessage, $value)); - } - - $multiselectChoices[] = $choices[$value]; - } - - if ($multiselect) { - return $multiselectChoices; - } - - return $choices[$selected]; - }; - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Question/ConfirmationQuestion.php b/application/vendor/symfony/console/Symfony/Component/Console/Question/ConfirmationQuestion.php deleted file mode 100644 index 09ac74f..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Question/ConfirmationQuestion.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Question; - -/** - * Represents a yes/no question. - * - * @author Fabien Potencier - */ -class ConfirmationQuestion extends Question -{ - /** - * Constructor. - * - * @param string $question The question to ask to the user - * @param bool $default The default answer to return, true or false - */ - public function __construct($question, $default = true) - { - parent::__construct($question, (bool) $default); - - $this->setNormalizer($this->getDefaultNormalizer()); - } - - /** - * Returns the default answer normalizer. - * - * @return callable - */ - private function getDefaultNormalizer() - { - $default = $this->getDefault(); - - return function ($answer) use ($default) { - if (is_bool($answer)) { - return $answer; - } - - if (false === $default) { - return $answer && 'y' === strtolower($answer[0]); - } - - return !$answer || 'y' === strtolower($answer[0]); - }; - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/README.md b/application/vendor/symfony/console/Symfony/Component/Console/README.md deleted file mode 100644 index 25f700c..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/README.md +++ /dev/null @@ -1,67 +0,0 @@ -Console Component -================= - -Console eases the creation of beautiful and testable command line interfaces. - -The Application object manages the CLI application: - -```php -use Symfony\Component\Console\Application; - -$console = new Application(); -$console->run(); -``` - -The ``run()`` method parses the arguments and options passed on the command -line and executes the right command. - -Registering a new command can easily be done via the ``register()`` method, -which returns a ``Command`` instance: - -```php -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - -$console - ->register('ls') - ->setDefinition(array( - new InputArgument('dir', InputArgument::REQUIRED, 'Directory name'), - )) - ->setDescription('Displays the files in the given directory') - ->setCode(function (InputInterface $input, OutputInterface $output) { - $dir = $input->getArgument('dir'); - - $output->writeln(sprintf('Dir listing for %s', $dir)); - }) -; -``` - -You can also register new commands via classes. - -The component provides a lot of features like output coloring, input and -output abstractions (so that you can easily unit-test your commands), -validation, automatic help messages, ... - -Tests ------ - -You can run the unit tests with the following command: - - $ cd path/to/Symfony/Component/Console/ - $ composer install - $ phpunit - -Third Party ------------ - -`Resources/bin/hiddeninput.exe` is a third party binary provided within this -component. Find sources and license at https://github.com/Seldaek/hidden-input. - -Resources ---------- - -[The Console Component](https://symfony.com/doc/current/components/console.html) - -[How to create a Console Command](https://symfony.com/doc/current/cookbook/console/console_command.html) diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Command/CommandTest.php b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Command/CommandTest.php deleted file mode 100644 index 85d51e6..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Command/CommandTest.php +++ /dev/null @@ -1,339 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Command; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Helper\FormatterHelper; -use Symfony\Component\Console\Application; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\StringInput; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Output\NullOutput; -use Symfony\Component\Console\Tester\CommandTester; - -class CommandTest extends \PHPUnit_Framework_TestCase -{ - protected static $fixturesPath; - - public static function setUpBeforeClass() - { - self::$fixturesPath = __DIR__.'/../Fixtures/'; - require_once self::$fixturesPath.'/TestCommand.php'; - } - - public function testConstructor() - { - $command = new Command('foo:bar'); - $this->assertEquals('foo:bar', $command->getName(), '__construct() takes the command name as its first argument'); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage The command defined in "Symfony\Component\Console\Command\Command" cannot have an empty name. - */ - public function testCommandNameCannotBeEmpty() - { - new Command(); - } - - public function testSetApplication() - { - $application = new Application(); - $command = new \TestCommand(); - $command->setApplication($application); - $this->assertEquals($application, $command->getApplication(), '->setApplication() sets the current application'); - } - - public function testSetGetDefinition() - { - $command = new \TestCommand(); - $ret = $command->setDefinition($definition = new InputDefinition()); - $this->assertEquals($command, $ret, '->setDefinition() implements a fluent interface'); - $this->assertEquals($definition, $command->getDefinition(), '->setDefinition() sets the current InputDefinition instance'); - $command->setDefinition(array(new InputArgument('foo'), new InputOption('bar'))); - $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->setDefinition() also takes an array of InputArguments and InputOptions as an argument'); - $this->assertTrue($command->getDefinition()->hasOption('bar'), '->setDefinition() also takes an array of InputArguments and InputOptions as an argument'); - $command->setDefinition(new InputDefinition()); - } - - public function testAddArgument() - { - $command = new \TestCommand(); - $ret = $command->addArgument('foo'); - $this->assertEquals($command, $ret, '->addArgument() implements a fluent interface'); - $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->addArgument() adds an argument to the command'); - } - - public function testAddOption() - { - $command = new \TestCommand(); - $ret = $command->addOption('foo'); - $this->assertEquals($command, $ret, '->addOption() implements a fluent interface'); - $this->assertTrue($command->getDefinition()->hasOption('foo'), '->addOption() adds an option to the command'); - } - - public function testGetNamespaceGetNameSetName() - { - $command = new \TestCommand(); - $this->assertEquals('namespace:name', $command->getName(), '->getName() returns the command name'); - $command->setName('foo'); - $this->assertEquals('foo', $command->getName(), '->setName() sets the command name'); - - $ret = $command->setName('foobar:bar'); - $this->assertEquals($command, $ret, '->setName() implements a fluent interface'); - $this->assertEquals('foobar:bar', $command->getName(), '->setName() sets the command name'); - } - - /** - * @dataProvider provideInvalidCommandNames - */ - public function testInvalidCommandNames($name) - { - $this->setExpectedException('InvalidArgumentException', sprintf('Command name "%s" is invalid.', $name)); - - $command = new \TestCommand(); - $command->setName($name); - } - - public function provideInvalidCommandNames() - { - return array( - array(''), - array('foo:'), - ); - } - - public function testGetSetDescription() - { - $command = new \TestCommand(); - $this->assertEquals('description', $command->getDescription(), '->getDescription() returns the description'); - $ret = $command->setDescription('description1'); - $this->assertEquals($command, $ret, '->setDescription() implements a fluent interface'); - $this->assertEquals('description1', $command->getDescription(), '->setDescription() sets the description'); - } - - public function testGetSetHelp() - { - $command = new \TestCommand(); - $this->assertEquals('help', $command->getHelp(), '->getHelp() returns the help'); - $ret = $command->setHelp('help1'); - $this->assertEquals($command, $ret, '->setHelp() implements a fluent interface'); - $this->assertEquals('help1', $command->getHelp(), '->setHelp() sets the help'); - } - - public function testGetProcessedHelp() - { - $command = new \TestCommand(); - $command->setHelp('The %command.name% command does... Example: php %command.full_name%.'); - $this->assertContains('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly'); - $this->assertNotContains('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name%'); - } - - public function testGetSetAliases() - { - $command = new \TestCommand(); - $this->assertEquals(array('name'), $command->getAliases(), '->getAliases() returns the aliases'); - $ret = $command->setAliases(array('name1')); - $this->assertEquals($command, $ret, '->setAliases() implements a fluent interface'); - $this->assertEquals(array('name1'), $command->getAliases(), '->setAliases() sets the aliases'); - } - - public function testGetSynopsis() - { - $command = new \TestCommand(); - $command->addOption('foo'); - $command->addArgument('foo'); - $this->assertEquals('namespace:name [--foo] [foo]', $command->getSynopsis(), '->getSynopsis() returns the synopsis'); - } - - public function testGetHelper() - { - $application = new Application(); - $command = new \TestCommand(); - $command->setApplication($application); - $formatterHelper = new FormatterHelper(); - $this->assertEquals($formatterHelper->getName(), $command->getHelper('formatter')->getName(), '->getHelper() returns the correct helper'); - } - - public function testMergeApplicationDefinition() - { - $application1 = new Application(); - $application1->getDefinition()->addArguments(array(new InputArgument('foo'))); - $application1->getDefinition()->addOptions(array(new InputOption('bar'))); - $command = new \TestCommand(); - $command->setApplication($application1); - $command->setDefinition($definition = new InputDefinition(array(new InputArgument('bar'), new InputOption('foo')))); - - $r = new \ReflectionObject($command); - $m = $r->getMethod('mergeApplicationDefinition'); - $m->setAccessible(true); - $m->invoke($command); - $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition() merges the application arguments and the command arguments'); - $this->assertTrue($command->getDefinition()->hasArgument('bar'), '->mergeApplicationDefinition() merges the application arguments and the command arguments'); - $this->assertTrue($command->getDefinition()->hasOption('foo'), '->mergeApplicationDefinition() merges the application options and the command options'); - $this->assertTrue($command->getDefinition()->hasOption('bar'), '->mergeApplicationDefinition() merges the application options and the command options'); - - $m->invoke($command); - $this->assertEquals(3, $command->getDefinition()->getArgumentCount(), '->mergeApplicationDefinition() does not try to merge twice the application arguments and options'); - } - - public function testMergeApplicationDefinitionWithoutArgsThenWithArgsAddsArgs() - { - $application1 = new Application(); - $application1->getDefinition()->addArguments(array(new InputArgument('foo'))); - $application1->getDefinition()->addOptions(array(new InputOption('bar'))); - $command = new \TestCommand(); - $command->setApplication($application1); - $command->setDefinition($definition = new InputDefinition(array())); - - $r = new \ReflectionObject($command); - $m = $r->getMethod('mergeApplicationDefinition'); - $m->setAccessible(true); - $m->invoke($command, false); - $this->assertTrue($command->getDefinition()->hasOption('bar'), '->mergeApplicationDefinition(false) merges the application and the command options'); - $this->assertFalse($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition(false) does not merge the application arguments'); - - $m->invoke($command, true); - $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition(true) merges the application arguments and the command arguments'); - - $m->invoke($command); - $this->assertEquals(2, $command->getDefinition()->getArgumentCount(), '->mergeApplicationDefinition() does not try to merge twice the application arguments'); - } - - public function testRunInteractive() - { - $tester = new CommandTester(new \TestCommand()); - - $tester->execute(array(), array('interactive' => true)); - - $this->assertEquals('interact called'.PHP_EOL.'execute called'.PHP_EOL, $tester->getDisplay(), '->run() calls the interact() method if the input is interactive'); - } - - public function testRunNonInteractive() - { - $tester = new CommandTester(new \TestCommand()); - - $tester->execute(array(), array('interactive' => false)); - - $this->assertEquals('execute called'.PHP_EOL, $tester->getDisplay(), '->run() does not call the interact() method if the input is not interactive'); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage You must override the execute() method in the concrete command class. - */ - public function testExecuteMethodNeedsToBeOverridden() - { - $command = new Command('foo'); - $command->run(new StringInput(''), new NullOutput()); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The "--bar" option does not exist. - */ - public function testRunWithInvalidOption() - { - $command = new \TestCommand(); - $tester = new CommandTester($command); - $tester->execute(array('--bar' => true)); - } - - public function testRunReturnsIntegerExitCode() - { - $command = new \TestCommand(); - $exitCode = $command->run(new StringInput(''), new NullOutput()); - $this->assertSame(0, $exitCode, '->run() returns integer exit code (treats null as 0)'); - - $command = $this->getMock('TestCommand', array('execute')); - $command->expects($this->once()) - ->method('execute') - ->will($this->returnValue('2.3')); - $exitCode = $command->run(new StringInput(''), new NullOutput()); - $this->assertSame(2, $exitCode, '->run() returns integer exit code (casts numeric to int)'); - } - - public function testRunReturnsAlwaysInteger() - { - $command = new \TestCommand(); - - $this->assertSame(0, $command->run(new StringInput(''), new NullOutput())); - } - - public function testSetCode() - { - $command = new \TestCommand(); - $ret = $command->setCode(function (InputInterface $input, OutputInterface $output) { - $output->writeln('from the code...'); - }); - $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); - $tester = new CommandTester($command); - $tester->execute(array()); - $this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay()); - } - - public function testSetCodeWithNonClosureCallable() - { - $command = new \TestCommand(); - $ret = $command->setCode(array($this, 'callableMethodCommand')); - $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); - $tester = new CommandTester($command); - $tester->execute(array()); - $this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay()); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid callable provided to Command::setCode. - */ - public function testSetCodeWithNonCallable() - { - $command = new \TestCommand(); - $command->setCode(array($this, 'nonExistentMethod')); - } - - public function callableMethodCommand(InputInterface $input, OutputInterface $output) - { - $output->writeln('from the code...'); - } - - /** - * @group legacy - */ - public function testLegacyAsText() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $command = new \TestCommand(); - $command->setApplication(new Application()); - $tester = new CommandTester($command); - $tester->execute(array('command' => $command->getName())); - $this->assertStringEqualsFile(self::$fixturesPath.'/command_astext.txt', $command->asText(), '->asText() returns a text representation of the command'); - } - - /** - * @group legacy - */ - public function testLegacyAsXml() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $command = new \TestCommand(); - $command->setApplication(new Application()); - $tester = new CommandTester($command); - $tester->execute(array('command' => $command->getName())); - $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/command_asxml.txt', $command->asXml(), '->asXml() returns an XML representation of the command'); - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Command/HelpCommandTest.php b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Command/HelpCommandTest.php deleted file mode 100644 index ea69c8b..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Command/HelpCommandTest.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Command; - -use Symfony\Component\Console\Tester\CommandTester; -use Symfony\Component\Console\Command\HelpCommand; -use Symfony\Component\Console\Command\ListCommand; -use Symfony\Component\Console\Application; - -class HelpCommandTest extends \PHPUnit_Framework_TestCase -{ - public function testExecuteForCommandAlias() - { - $command = new HelpCommand(); - $command->setApplication(new Application()); - $commandTester = new CommandTester($command); - $commandTester->execute(array('command_name' => 'li')); - $this->assertRegExp('/list \[--xml\] \[--raw\] \[--format="\.\.\."\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias'); - } - - public function testExecuteForCommand() - { - $command = new HelpCommand(); - $commandTester = new CommandTester($command); - $command->setCommand(new ListCommand()); - $commandTester->execute(array()); - $this->assertRegExp('/list \[--xml\] \[--raw\] \[--format="\.\.\."\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); - } - - public function testExecuteForCommandWithXmlOption() - { - $command = new HelpCommand(); - $commandTester = new CommandTester($command); - $command->setCommand(new ListCommand()); - $commandTester->execute(array('--format' => 'xml')); - $this->assertRegExp('/getDisplay(), '->execute() returns an XML help text if --xml is passed'); - } - - public function testExecuteForApplicationCommand() - { - $application = new Application(); - $commandTester = new CommandTester($application->get('help')); - $commandTester->execute(array('command_name' => 'list')); - $this->assertRegExp('/list \[--xml\] \[--raw\] \[--format="\.\.\."\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); - } - - public function testExecuteForApplicationCommandWithXmlOption() - { - $application = new Application(); - $commandTester = new CommandTester($application->get('help')); - $commandTester->execute(array('command_name' => 'list', '--format' => 'xml')); - $this->assertRegExp('/list \[--xml\] \[--raw\] \[--format="\.\.\."\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); - $this->assertRegExp('/getDisplay(), '->execute() returns an XML help text if --format=xml is passed'); - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Command/ListCommandTest.php b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Command/ListCommandTest.php deleted file mode 100644 index fbb9fee..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Command/ListCommandTest.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Command; - -use Symfony\Component\Console\Tester\CommandTester; -use Symfony\Component\Console\Application; - -class ListCommandTest extends \PHPUnit_Framework_TestCase -{ - public function testExecuteListsCommands() - { - $application = new Application(); - $commandTester = new CommandTester($command = $application->get('list')); - $commandTester->execute(array('command' => $command->getName()), array('decorated' => false)); - - $this->assertRegExp('/help Displays help for a command/', $commandTester->getDisplay(), '->execute() returns a list of available commands'); - } - - public function testExecuteListsCommandsWithXmlOption() - { - $application = new Application(); - $commandTester = new CommandTester($command = $application->get('list')); - $commandTester->execute(array('command' => $command->getName(), '--format' => 'xml')); - $this->assertRegExp('//', $commandTester->getDisplay(), '->execute() returns a list of available commands in XML if --xml is passed'); - } - - public function testExecuteListsCommandsWithRawOption() - { - $application = new Application(); - $commandTester = new CommandTester($command = $application->get('list')); - $commandTester->execute(array('command' => $command->getName(), '--raw' => true)); - $output = <<assertEquals($output, $commandTester->getDisplay(true)); - } - - public function testExecuteListsCommandsWithNamespaceArgument() - { - require_once realpath(__DIR__.'/../Fixtures/FooCommand.php'); - $application = new Application(); - $application->add(new \FooCommand()); - $commandTester = new CommandTester($command = $application->get('list')); - $commandTester->execute(array('command' => $command->getName(), 'namespace' => 'foo', '--raw' => true)); - $output = <<assertEquals($output, $commandTester->getDisplay(true)); - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php deleted file mode 100644 index 943ea29..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Descriptor; - -use Symfony\Component\Console\Descriptor\JsonDescriptor; - -class JsonDescriptorTest extends AbstractDescriptorTest -{ - protected function getDescriptor() - { - return new JsonDescriptor(); - } - - protected function getFormat() - { - return 'json'; - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/MarkdownDescriptorTest.php b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/MarkdownDescriptorTest.php deleted file mode 100644 index c85e8a5..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/MarkdownDescriptorTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Descriptor; - -use Symfony\Component\Console\Descriptor\MarkdownDescriptor; - -class MarkdownDescriptorTest extends AbstractDescriptorTest -{ - protected function getDescriptor() - { - return new MarkdownDescriptor(); - } - - protected function getFormat() - { - return 'md'; - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.php b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.php deleted file mode 100644 index a3c49d7..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Descriptor; - -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Tests\Fixtures\DescriptorApplication1; -use Symfony\Component\Console\Tests\Fixtures\DescriptorApplication2; -use Symfony\Component\Console\Tests\Fixtures\DescriptorCommand1; -use Symfony\Component\Console\Tests\Fixtures\DescriptorCommand2; - -/** - * @author Jean-François Simon - */ -class ObjectsProvider -{ - public static function getInputArguments() - { - return array( - 'input_argument_1' => new InputArgument('argument_name', InputArgument::REQUIRED), - 'input_argument_2' => new InputArgument('argument_name', InputArgument::IS_ARRAY, 'argument description'), - 'input_argument_3' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'default_value'), - ); - } - - public static function getInputOptions() - { - return array( - 'input_option_1' => new InputOption('option_name', 'o', InputOption::VALUE_NONE), - 'input_option_2' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', 'default_value'), - 'input_option_3' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description'), - 'input_option_4' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'option description', array()), - ); - } - - public static function getInputDefinitions() - { - return array( - 'input_definition_1' => new InputDefinition(), - 'input_definition_2' => new InputDefinition(array(new InputArgument('argument_name', InputArgument::REQUIRED))), - 'input_definition_3' => new InputDefinition(array(new InputOption('option_name', 'o', InputOption::VALUE_NONE))), - 'input_definition_4' => new InputDefinition(array( - new InputArgument('argument_name', InputArgument::REQUIRED), - new InputOption('option_name', 'o', InputOption::VALUE_NONE), - )), - ); - } - - public static function getCommands() - { - return array( - 'command_1' => new DescriptorCommand1(), - 'command_2' => new DescriptorCommand2(), - ); - } - - public static function getApplications() - { - return array( - 'application_1' => new DescriptorApplication1(), - 'application_2' => new DescriptorApplication2(), - ); - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/TextDescriptorTest.php b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/TextDescriptorTest.php deleted file mode 100644 index 350b679..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/TextDescriptorTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Descriptor; - -use Symfony\Component\Console\Descriptor\TextDescriptor; - -class TextDescriptorTest extends AbstractDescriptorTest -{ - protected function getDescriptor() - { - return new TextDescriptor(); - } - - protected function getFormat() - { - return 'txt'; - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.json deleted file mode 100644 index 7f8d92e..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.json +++ /dev/null @@ -1 +0,0 @@ -{"commands":[{"name":"help","usage":"help [--xml] [--format=\"...\"] [--raw] [command_name]","description":"Displays help for a command","help":"The help<\/info> command displays help for a given command:\n\n php app\/console help list<\/info>\n\nYou can also output the help in other formats by using the --format<\/comment> option:\n\n php app\/console help --format=xml list<\/info>\n\nTo display the list of available commands, please use the list<\/info> command.","aliases":[],"definition":{"arguments":{"command_name":{"name":"command_name","is_required":false,"is_array":false,"description":"The command name","default":"help"}},"options":{"xml":{"name":"--xml","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output help as XML","default":false},"format":{"name":"--format","shortcut":"","accept_value":true,"is_value_required":true,"is_multiple":false,"description":"To output help in other formats","default":"txt"},"raw":{"name":"--raw","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output raw command help","default":false},"help":{"name":"--help","shortcut":"-h","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this help message","default":false},"quiet":{"name":"--quiet","shortcut":"-q","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not output any message","default":false},"verbose":{"name":"--verbose","shortcut":"-v|-vv|-vvv","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug","default":false},"version":{"name":"--version","shortcut":"-V","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this application version","default":false},"ansi":{"name":"--ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Force ANSI output","default":false},"no-ansi":{"name":"--no-ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Disable ANSI output","default":false},"no-interaction":{"name":"--no-interaction","shortcut":"-n","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not ask any interactive question","default":false}}}},{"name":"list","usage":"list [--xml] [--raw] [--format=\"...\"] [namespace]","description":"Lists commands","help":"The list<\/info> command lists all commands:\n\n php app\/console list<\/info>\n\nYou can also display the commands for a specific namespace:\n\n php app\/console list test<\/info>\n\nYou can also output the information in other formats by using the --format<\/comment> option:\n\n php app\/console list --format=xml<\/info>\n\nIt's also possible to get raw list of commands (useful for embedding command runner):\n\n php app\/console list --raw<\/info>","aliases":[],"definition":{"arguments":{"namespace":{"name":"namespace","is_required":false,"is_array":false,"description":"The namespace name","default":null}},"options":{"xml":{"name":"--xml","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output list as XML","default":false},"raw":{"name":"--raw","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output raw command list","default":false},"format":{"name":"--format","shortcut":"","accept_value":true,"is_value_required":true,"is_multiple":false,"description":"To output list in other formats","default":"txt"}}}}],"namespaces":[{"id":"_global","commands":["help","list"]}]} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.txt deleted file mode 100644 index f3a1968..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.txt +++ /dev/null @@ -1,17 +0,0 @@ -Console Tool - -Usage: - command [options] [arguments] - -Options: - --help (-h) Display this help message - --quiet (-q) Do not output any message - --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug - --version (-V) Display this application version - --ansi Force ANSI output - --no-ansi Disable ANSI output - --no-interaction (-n) Do not ask any interactive question - -Available commands: - help Displays help for a command - list Lists commands diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_2.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_2.json deleted file mode 100644 index 1655d47..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_2.json +++ /dev/null @@ -1 +0,0 @@ -{"commands":[{"name":"help","usage":"help [--xml] [--format=\"...\"] [--raw] [command_name]","description":"Displays help for a command","help":"The help<\/info> command displays help for a given command:\n\n php app\/console help list<\/info>\n\nYou can also output the help in other formats by using the --format<\/comment> option:\n\n php app\/console help --format=xml list<\/info>\n\nTo display the list of available commands, please use the list<\/info> command.","aliases":[],"definition":{"arguments":{"command_name":{"name":"command_name","is_required":false,"is_array":false,"description":"The command name","default":"help"}},"options":{"xml":{"name":"--xml","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output help as XML","default":false},"format":{"name":"--format","shortcut":"","accept_value":true,"is_value_required":true,"is_multiple":false,"description":"To output help in other formats","default":"txt"},"raw":{"name":"--raw","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output raw command help","default":false},"help":{"name":"--help","shortcut":"-h","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this help message","default":false},"quiet":{"name":"--quiet","shortcut":"-q","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not output any message","default":false},"verbose":{"name":"--verbose","shortcut":"-v|-vv|-vvv","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug","default":false},"version":{"name":"--version","shortcut":"-V","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this application version","default":false},"ansi":{"name":"--ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Force ANSI output","default":false},"no-ansi":{"name":"--no-ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Disable ANSI output","default":false},"no-interaction":{"name":"--no-interaction","shortcut":"-n","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not ask any interactive question","default":false}}}},{"name":"list","usage":"list [--xml] [--raw] [--format=\"...\"] [namespace]","description":"Lists commands","help":"The list<\/info> command lists all commands:\n\n php app\/console list<\/info>\n\nYou can also display the commands for a specific namespace:\n\n php app\/console list test<\/info>\n\nYou can also output the information in other formats by using the --format<\/comment> option:\n\n php app\/console list --format=xml<\/info>\n\nIt's also possible to get raw list of commands (useful for embedding command runner):\n\n php app\/console list --raw<\/info>","aliases":[],"definition":{"arguments":{"namespace":{"name":"namespace","is_required":false,"is_array":false,"description":"The namespace name","default":null}},"options":{"xml":{"name":"--xml","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output list as XML","default":false},"raw":{"name":"--raw","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"To output raw command list","default":false},"format":{"name":"--format","shortcut":"","accept_value":true,"is_value_required":true,"is_multiple":false,"description":"To output list in other formats","default":"txt"}}}},{"name":"descriptor:command1","usage":"descriptor:command1","description":"command 1 description","help":"command 1 help","aliases":["alias1","alias2"],"definition":{"arguments":[],"options":{"help":{"name":"--help","shortcut":"-h","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this help message","default":false},"quiet":{"name":"--quiet","shortcut":"-q","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not output any message","default":false},"verbose":{"name":"--verbose","shortcut":"-v|-vv|-vvv","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug","default":false},"version":{"name":"--version","shortcut":"-V","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this application version","default":false},"ansi":{"name":"--ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Force ANSI output","default":false},"no-ansi":{"name":"--no-ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Disable ANSI output","default":false},"no-interaction":{"name":"--no-interaction","shortcut":"-n","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not ask any interactive question","default":false}}}},{"name":"descriptor:command2","usage":"descriptor:command2 [-o|--option_name] argument_name","description":"command 2 description","help":"command 2 help","aliases":[],"definition":{"arguments":{"argument_name":{"name":"argument_name","is_required":true,"is_array":false,"description":"","default":null}},"options":{"option_name":{"name":"--option_name","shortcut":"-o","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"","default":false},"help":{"name":"--help","shortcut":"-h","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this help message","default":false},"quiet":{"name":"--quiet","shortcut":"-q","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not output any message","default":false},"verbose":{"name":"--verbose","shortcut":"-v|-vv|-vvv","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug","default":false},"version":{"name":"--version","shortcut":"-V","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Display this application version","default":false},"ansi":{"name":"--ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Force ANSI output","default":false},"no-ansi":{"name":"--no-ansi","shortcut":"","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Disable ANSI output","default":false},"no-interaction":{"name":"--no-interaction","shortcut":"-n","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"Do not ask any interactive question","default":false}}}}],"namespaces":[{"id":"_global","commands":["alias1","alias2","help","list"]},{"id":"descriptor","commands":["descriptor:command1","descriptor:command2"]}]} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_2.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_2.txt deleted file mode 100644 index a640a8d..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_2.txt +++ /dev/null @@ -1,22 +0,0 @@ -My Symfony application version v1.0 - -Usage: - command [options] [arguments] - -Options: - --help (-h) Display this help message - --quiet (-q) Do not output any message - --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug - --version (-V) Display this application version - --ansi Force ANSI output - --no-ansi Disable ANSI output - --no-interaction (-n) Do not ask any interactive question - -Available commands: - alias1 command 1 description - alias2 command 1 description - help Displays help for a command - list Lists commands -descriptor - descriptor:command1 command 1 description - descriptor:command2 command 2 description diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_astext1.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_astext1.txt deleted file mode 100644 index d9734fe..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_astext1.txt +++ /dev/null @@ -1,20 +0,0 @@ -Console Tool - -Usage: - command [options] [arguments] - -Options: - --help (-h) Display this help message - --quiet (-q) Do not output any message - --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug - --version (-V) Display this application version - --ansi Force ANSI output - --no-ansi Disable ANSI output - --no-interaction (-n) Do not ask any interactive question - -Available commands: - afoobar The foo:bar command - help Displays help for a command - list Lists commands -foo - foo:bar The foo:bar command diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_astext2.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_astext2.txt deleted file mode 100644 index 49992cf..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_astext2.txt +++ /dev/null @@ -1,16 +0,0 @@ -Console Tool - -Usage: - command [options] [arguments] - -Options: - --help (-h) Display this help message - --quiet (-q) Do not output any message - --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug - --version (-V) Display this application version - --ansi Force ANSI output - --no-ansi Disable ANSI output - --no-interaction (-n) Do not ask any interactive question - -Available commands for the "foo" namespace: - foo:bar The foo:bar command diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_asxml1.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_asxml1.txt deleted file mode 100644 index d956781..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_asxml1.txt +++ /dev/null @@ -1,144 +0,0 @@ - - - - - help [--xml] [--format="..."] [--raw] [command_name] - Displays help for a command - The <info>help</info> command displays help for a given command: - - <info>php app/console help list</info> - - You can also output the help in other formats by using the <comment>--format</comment> option: - - <info>php app/console help --format=xml list</info> - - To display the list of available commands, please use the <info>list</info> command. - - - - The command name - - help - - - - - - - - - - - - - - - - - - list [--xml] [--raw] [--format="..."] [namespace] - Lists commands - The <info>list</info> command lists all commands: - - <info>php app/console list</info> - - You can also display the commands for a specific namespace: - - <info>php app/console list test</info> - - You can also output the information in other formats by using the <comment>--format</comment> option: - - <info>php app/console list --format=xml</info> - - It's also possible to get raw list of commands (useful for embedding command runner): - - <info>php app/console list --raw</info> - - - - The namespace name - - - - - - - - - - - foo:bar - The foo:bar command - - - afoobar - - - - - - - - - - - - - - - - afoobar - help - list - - - foo:bar - - - diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_asxml2.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_asxml2.txt deleted file mode 100644 index 0b30b20..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_asxml2.txt +++ /dev/null @@ -1,37 +0,0 @@ - - - - - foo:bar - The foo:bar command - - - afoobar - - - - - - - - - - - - - - diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception2.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception2.txt deleted file mode 100644 index c758129..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception2.txt +++ /dev/null @@ -1,11 +0,0 @@ - - - - [InvalidArgumentException] - The "--foo" option does not exist. - - - -list [--xml] [--raw] [--format="..."] [namespace] - - diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception3.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception3.txt deleted file mode 100644 index 72a7286..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception3.txt +++ /dev/null @@ -1,27 +0,0 @@ - - - - [Exception] - Third exception comment - - - - - - - [Exception] - Second exception comment - - - - - - - [Exception] - First exception

    this is html

    - - - -foo3:bar - - diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception3decorated.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception3decorated.txt deleted file mode 100644 index b44d50b..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception3decorated.txt +++ /dev/null @@ -1,27 +0,0 @@ - - -  - [Exception]  - Third exception comment  -  - - - - -  - [Exception]  - Second exception comment  -  - - - - -  - [Exception]  - First exception 

    this is html

      -  - - -foo3:bar - - diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_run1.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_run1.txt deleted file mode 100644 index 9bd08b5..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_run1.txt +++ /dev/null @@ -1,17 +0,0 @@ -Console Tool - -Usage: - command [options] [arguments] - -Options: - --help (-h) Display this help message - --quiet (-q) Do not output any message - --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug - --version (-V) Display this application version - --ansi Force ANSI output - --no-ansi Disable ANSI output - --no-interaction (-n) Do not ask any interactive question - -Available commands: - help Displays help for a command - list Lists commands diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_run2.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_run2.txt deleted file mode 100644 index 6963c0f..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_run2.txt +++ /dev/null @@ -1,29 +0,0 @@ -Usage: - help [--xml] [--format="..."] [--raw] [command_name] - -Arguments: - command The command to execute - command_name The command name (default: "help") - -Options: - --xml To output help as XML - --format To output help in other formats (default: "txt") - --raw To output raw command help - --help (-h) Display this help message - --quiet (-q) Do not output any message - --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug - --version (-V) Display this application version - --ansi Force ANSI output - --no-ansi Disable ANSI output - --no-interaction (-n) Do not ask any interactive question - -Help: - The help command displays help for a given command: - - php app/console help list - - You can also output the help in other formats by using the --format option: - - php app/console help --format=xml list - - To display the list of available commands, please use the list command. diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_run3.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_run3.txt deleted file mode 100644 index 0139775..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_run3.txt +++ /dev/null @@ -1,27 +0,0 @@ -Usage: - list [--xml] [--raw] [--format="..."] [namespace] - -Arguments: - namespace The namespace name - -Options: - --xml To output list as XML - --raw To output raw command list - --format To output list in other formats (default: "txt") - -Help: - The list command lists all commands: - - php app/console list - - You can also display the commands for a specific namespace: - - php app/console list test - - You can also output the information in other formats by using the --format option: - - php app/console list --format=xml - - It's also possible to get raw list of commands (useful for embedding command runner): - - php app/console list --raw diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.json deleted file mode 100644 index 0c1675d..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"descriptor:command1","usage":"descriptor:command1","description":"command 1 description","help":"command 1 help","aliases":["alias1","alias2"],"definition":{"arguments":[],"options":[]}} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.md b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.md deleted file mode 100644 index 2cef9a2..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.md +++ /dev/null @@ -1,8 +0,0 @@ -descriptor:command1 -------------------- - -* Description: command 1 description -* Usage: `descriptor:command1` -* Aliases: `alias1`, `alias2` - -command 1 help diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.txt deleted file mode 100644 index 2375ac0..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.txt +++ /dev/null @@ -1,7 +0,0 @@ -Usage: - descriptor:command1 - -Aliases: alias1, alias2 - -Help: - command 1 help diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.xml b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.xml deleted file mode 100644 index dcfa6fa..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_1.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - descriptor:command1 - command 1 description - command 1 help - - alias1 - alias2 - - - - diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_2.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_2.json deleted file mode 100644 index 493b584..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_2.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"descriptor:command2","usage":"descriptor:command2 [-o|--option_name] argument_name","description":"command 2 description","help":"command 2 help","aliases":[],"definition":{"arguments":{"argument_name":{"name":"argument_name","is_required":true,"is_array":false,"description":"","default":null}},"options":{"option_name":{"name":"--option_name","shortcut":"-o","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"","default":false}}}} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_2.md b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_2.md deleted file mode 100644 index 5257c0d..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_2.md +++ /dev/null @@ -1,30 +0,0 @@ -descriptor:command2 -------------------- - -* Description: command 2 description -* Usage: `descriptor:command2 [-o|--option_name] argument_name` -* Aliases: - -command 2 help - -### Arguments: - -**argument_name:** - -* Name: argument_name -* Is required: yes -* Is array: no -* Description: -* Default: `NULL` - -### Options: - -**option_name:** - -* Name: `--option_name` -* Shortcut: `-o` -* Accept value: no -* Is value required: no -* Is multiple: no -* Description: -* Default: `false` diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_2.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_2.txt deleted file mode 100644 index 1da9f3d..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_2.txt +++ /dev/null @@ -1,11 +0,0 @@ -Usage: - descriptor:command2 [-o|--option_name] argument_name - -Arguments: - argument_name - -Options: - --option_name (-o) - -Help: - command 2 help diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_2.xml b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_2.xml deleted file mode 100644 index c411c36..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_2.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - descriptor:command2 [-o|--option_name] argument_name - command 2 description - command 2 help - - - - - - - - - - - diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_astext.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_astext.txt deleted file mode 100644 index 5d70351..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_astext.txt +++ /dev/null @@ -1,18 +0,0 @@ -Usage: - namespace:name - -Aliases: name -Arguments: - command The command to execute - -Options: - --help (-h) Display this help message - --quiet (-q) Do not output any message - --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug - --version (-V) Display this application version - --ansi Force ANSI output - --no-ansi Disable ANSI output - --no-interaction (-n) Do not ask any interactive question - -Help: - help diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/definition_astext.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/definition_astext.txt deleted file mode 100644 index a7d7e0d..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/definition_astext.txt +++ /dev/null @@ -1,11 +0,0 @@ -Arguments: - foo The foo argument - baz The baz argument (default: true) - bar The bar argument (default: ["http://foo.com/"]) - -Options: - --foo (-f) The foo option - --baz The baz option (default: false) - --bar (-b) The bar option (default: "bar") - --qux The qux option (default: ["http://foo.com/","bar"]) (multiple values allowed) - --qux2 The qux2 option (default: {"foo":"bar"}) (multiple values allowed) diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_1.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_1.json deleted file mode 100644 index b8173b6..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_1.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"argument_name","is_required":true,"is_array":false,"description":"","default":null} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_1.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_1.txt deleted file mode 100644 index 111e515..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_1.txt +++ /dev/null @@ -1 +0,0 @@ - argument_name diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_2.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_2.json deleted file mode 100644 index ef06b09..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_2.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"argument_name","is_required":false,"is_array":true,"description":"argument description","default":[]} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_2.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_2.txt deleted file mode 100644 index 9497b1c..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_2.txt +++ /dev/null @@ -1 +0,0 @@ - argument_name argument description diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_3.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_3.json deleted file mode 100644 index de8484e..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_3.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"argument_name","is_required":false,"is_array":false,"description":"argument description","default":"default_value"} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_3.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_3.txt deleted file mode 100644 index c421fc9..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_3.txt +++ /dev/null @@ -1 +0,0 @@ - argument_name argument description (default: "default_value") diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_1.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_1.json deleted file mode 100644 index c7a7d83..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_1.json +++ /dev/null @@ -1 +0,0 @@ -{"arguments":[],"options":[]} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_2.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_2.json deleted file mode 100644 index 9964a55..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_2.json +++ /dev/null @@ -1 +0,0 @@ -{"arguments":{"argument_name":{"name":"argument_name","is_required":true,"is_array":false,"description":"","default":null}},"options":[]} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_2.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_2.txt deleted file mode 100644 index 0db9f66..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_2.txt +++ /dev/null @@ -1,2 +0,0 @@ -Arguments: - argument_name diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_3.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_3.json deleted file mode 100644 index 6a86056..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_3.json +++ /dev/null @@ -1 +0,0 @@ -{"arguments":[],"options":{"option_name":{"name":"--option_name","shortcut":"-o","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"","default":false}}} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_3.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_3.txt deleted file mode 100644 index c6fb2cc..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_3.txt +++ /dev/null @@ -1,2 +0,0 @@ -Options: - --option_name (-o) diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_4.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_4.json deleted file mode 100644 index c5a0019..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_4.json +++ /dev/null @@ -1 +0,0 @@ -{"arguments":{"argument_name":{"name":"argument_name","is_required":true,"is_array":false,"description":"","default":null}},"options":{"option_name":{"name":"--option_name","shortcut":"-o","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"","default":false}}} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_4.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_4.txt deleted file mode 100644 index e17c61c..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_4.txt +++ /dev/null @@ -1,5 +0,0 @@ -Arguments: - argument_name - -Options: - --option_name (-o) diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_1.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_1.json deleted file mode 100644 index 60c5b56..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_1.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"--option_name","shortcut":"-o","accept_value":false,"is_value_required":false,"is_multiple":false,"description":"","default":false} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_1.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_1.txt deleted file mode 100644 index daf83d0..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_1.txt +++ /dev/null @@ -1 +0,0 @@ - --option_name (-o) diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_2.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_2.json deleted file mode 100644 index 04e4228..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_2.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"--option_name","shortcut":"-o","accept_value":true,"is_value_required":false,"is_multiple":false,"description":"option description","default":"default_value"} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_2.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_2.txt deleted file mode 100644 index 627e3c1..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_2.txt +++ /dev/null @@ -1 +0,0 @@ - --option_name (-o) option description (default: "default_value") diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_3.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_3.json deleted file mode 100644 index c1ea120..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_3.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"--option_name","shortcut":"-o","accept_value":true,"is_value_required":true,"is_multiple":false,"description":"option description","default":null} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_3.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_3.txt deleted file mode 100644 index b88b12d..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_3.txt +++ /dev/null @@ -1 +0,0 @@ - --option_name (-o) option description diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_4.json b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_4.json deleted file mode 100644 index 1b671d8..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_4.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"--option_name","shortcut":"-o","accept_value":true,"is_value_required":false,"is_multiple":true,"description":"option description","default":[]} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_4.txt b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_4.txt deleted file mode 100644 index 5dba5e6..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_4.txt +++ /dev/null @@ -1 +0,0 @@ - --option_name (-o) option description (multiple values allowed) diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php deleted file mode 100644 index 59c06bb..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php +++ /dev/null @@ -1,598 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Helper; - -use Symfony\Component\Console\Helper\ProgressBar; -use Symfony\Component\Console\Helper\Helper; -use Symfony\Component\Console\Output\StreamOutput; - -class ProgressBarTest extends \PHPUnit_Framework_TestCase -{ - public function testMultipleStart() - { - $bar = new ProgressBar($output = $this->getOutputStream()); - $bar->start(); - $bar->advance(); - $bar->start(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0 [>---------------------------]'). - $this->generateOutput(' 1 [->--------------------------]'). - $this->generateOutput(' 0 [>---------------------------]'), - stream_get_contents($output->getStream()) - ); - } - - public function testAdvance() - { - $bar = new ProgressBar($output = $this->getOutputStream()); - $bar->start(); - $bar->advance(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0 [>---------------------------]'). - $this->generateOutput(' 1 [->--------------------------]'), - stream_get_contents($output->getStream()) - ); - } - - public function testAdvanceWithStep() - { - $bar = new ProgressBar($output = $this->getOutputStream()); - $bar->start(); - $bar->advance(5); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0 [>---------------------------]'). - $this->generateOutput(' 5 [----->----------------------]'), - stream_get_contents($output->getStream()) - ); - } - - public function testAdvanceMultipleTimes() - { - $bar = new ProgressBar($output = $this->getOutputStream()); - $bar->start(); - $bar->advance(3); - $bar->advance(2); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0 [>---------------------------]'). - $this->generateOutput(' 3 [--->------------------------]'). - $this->generateOutput(' 5 [----->----------------------]'), - stream_get_contents($output->getStream()) - ); - } - - public function testAdvanceOverMax() - { - $bar = new ProgressBar($output = $this->getOutputStream(), 10); - $bar->setProgress(9); - $bar->advance(); - $bar->advance(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 9/10 [=========================>--] 90%'). - $this->generateOutput(' 10/10 [============================] 100%'). - $this->generateOutput(' 11/11 [============================] 100%'), - stream_get_contents($output->getStream()) - ); - } - - public function testCustomizations() - { - $bar = new ProgressBar($output = $this->getOutputStream(), 10); - $bar->setBarWidth(10); - $bar->setBarCharacter('_'); - $bar->setEmptyBarCharacter(' '); - $bar->setProgressCharacter('/'); - $bar->setFormat(' %current%/%max% [%bar%] %percent:3s%%'); - $bar->start(); - $bar->advance(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0/10 [/ ] 0%'). - $this->generateOutput(' 1/10 [_/ ] 10%'), - stream_get_contents($output->getStream()) - ); - } - - public function testDisplayWithoutStart() - { - $bar = new ProgressBar($output = $this->getOutputStream(), 50); - $bar->display(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0/50 [>---------------------------] 0%'), - stream_get_contents($output->getStream()) - ); - } - - public function testDisplayWithQuietVerbosity() - { - $bar = new ProgressBar($output = $this->getOutputStream(true, StreamOutput::VERBOSITY_QUIET), 50); - $bar->display(); - - rewind($output->getStream()); - $this->assertEquals( - '', - stream_get_contents($output->getStream()) - ); - } - - public function testFinishWithoutStart() - { - $bar = new ProgressBar($output = $this->getOutputStream(), 50); - $bar->finish(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 50/50 [============================] 100%'), - stream_get_contents($output->getStream()) - ); - } - - public function testPercent() - { - $bar = new ProgressBar($output = $this->getOutputStream(), 50); - $bar->start(); - $bar->display(); - $bar->advance(); - $bar->advance(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0/50 [>---------------------------] 0%'). - $this->generateOutput(' 0/50 [>---------------------------] 0%'). - $this->generateOutput(' 1/50 [>---------------------------] 2%'). - $this->generateOutput(' 2/50 [=>--------------------------] 4%'), - stream_get_contents($output->getStream()) - ); - } - - public function testOverwriteWithShorterLine() - { - $bar = new ProgressBar($output = $this->getOutputStream(), 50); - $bar->setFormat(' %current%/%max% [%bar%] %percent:3s%%'); - $bar->start(); - $bar->display(); - $bar->advance(); - - // set shorter format - $bar->setFormat(' %current%/%max% [%bar%]'); - $bar->advance(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0/50 [>---------------------------] 0%'). - $this->generateOutput(' 0/50 [>---------------------------] 0%'). - $this->generateOutput(' 1/50 [>---------------------------] 2%'). - $this->generateOutput(' 2/50 [=>--------------------------] '), - stream_get_contents($output->getStream()) - ); - } - - public function testStartWithMax() - { - $bar = new ProgressBar($output = $this->getOutputStream()); - $bar->setFormat('%current%/%max% [%bar%]'); - $bar->start(50); - $bar->advance(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0/50 [>---------------------------]'). - $this->generateOutput(' 1/50 [>---------------------------]'), - stream_get_contents($output->getStream()) - ); - } - - public function testSetCurrentProgress() - { - $bar = new ProgressBar($output = $this->getOutputStream(), 50); - $bar->start(); - $bar->display(); - $bar->advance(); - $bar->setProgress(15); - $bar->setProgress(25); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0/50 [>---------------------------] 0%'). - $this->generateOutput(' 0/50 [>---------------------------] 0%'). - $this->generateOutput(' 1/50 [>---------------------------] 2%'). - $this->generateOutput(' 15/50 [========>-------------------] 30%'). - $this->generateOutput(' 25/50 [==============>-------------] 50%'), - stream_get_contents($output->getStream()) - ); - } - - /** - */ - public function testSetCurrentBeforeStarting() - { - $bar = new ProgressBar($this->getOutputStream()); - $bar->setProgress(15); - $this->assertNotNull($bar->getStartTime()); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage You can't regress the progress bar - */ - public function testRegressProgress() - { - $bar = new ProgressBar($output = $this->getOutputStream(), 50); - $bar->start(); - $bar->setProgress(15); - $bar->setProgress(10); - } - - public function testRedrawFrequency() - { - $bar = $this->getMock('Symfony\Component\Console\Helper\ProgressBar', array('display'), array($output = $this->getOutputStream(), 6)); - $bar->expects($this->exactly(4))->method('display'); - - $bar->setRedrawFrequency(2); - $bar->start(); - $bar->setProgress(1); - $bar->advance(2); - $bar->advance(2); - $bar->advance(1); - } - - public function testMultiByteSupport() - { - if (!function_exists('mb_strlen') || (false === $encoding = mb_detect_encoding('■'))) { - $this->markTestSkipped('The mbstring extension is needed for multi-byte support'); - } - - $bar = new ProgressBar($output = $this->getOutputStream()); - $bar->start(); - $bar->setBarCharacter('■'); - $bar->advance(3); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0 [>---------------------------]'). - $this->generateOutput(' 3 [■■■>------------------------]'), - stream_get_contents($output->getStream()) - ); - } - - public function testClear() - { - $bar = new ProgressBar($output = $this->getOutputStream(), 50); - $bar->start(); - $bar->setProgress(25); - $bar->clear(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0/50 [>---------------------------] 0%'). - $this->generateOutput(' 25/50 [==============>-------------] 50%'). - $this->generateOutput(' '), - stream_get_contents($output->getStream()) - ); - } - - public function testPercentNotHundredBeforeComplete() - { - $bar = new ProgressBar($output = $this->getOutputStream(), 200); - $bar->start(); - $bar->display(); - $bar->advance(199); - $bar->advance(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0/200 [>---------------------------] 0%'). - $this->generateOutput(' 0/200 [>---------------------------] 0%'). - $this->generateOutput(' 199/200 [===========================>] 99%'). - $this->generateOutput(' 200/200 [============================] 100%'), - stream_get_contents($output->getStream()) - ); - } - - public function testNonDecoratedOutput() - { - $bar = new ProgressBar($output = $this->getOutputStream(false), 200); - $bar->start(); - - for ($i = 0; $i < 200; $i++) { - $bar->advance(); - } - - $bar->finish(); - - rewind($output->getStream()); - $this->assertEquals( - " 0/200 [>---------------------------] 0%\n". - " 20/200 [==>-------------------------] 10%\n". - " 40/200 [=====>----------------------] 20%\n". - " 60/200 [========>-------------------] 30%\n". - " 80/200 [===========>----------------] 40%\n". - " 100/200 [==============>-------------] 50%\n". - " 120/200 [================>-----------] 60%\n". - " 140/200 [===================>--------] 70%\n". - " 160/200 [======================>-----] 80%\n". - " 180/200 [=========================>--] 90%\n". - " 200/200 [============================] 100%", - stream_get_contents($output->getStream()) - ); - } - - public function testNonDecoratedOutputWithClear() - { - $bar = new ProgressBar($output = $this->getOutputStream(false), 50); - $bar->start(); - $bar->setProgress(25); - $bar->clear(); - $bar->setProgress(50); - $bar->finish(); - - rewind($output->getStream()); - $this->assertEquals( - " 0/50 [>---------------------------] 0%\n". - " 25/50 [==============>-------------] 50%\n". - " 50/50 [============================] 100%", - stream_get_contents($output->getStream()) - ); - } - - public function testNonDecoratedOutputWithoutMax() - { - $bar = new ProgressBar($output = $this->getOutputStream(false)); - $bar->start(); - $bar->advance(); - - rewind($output->getStream()); - $this->assertEquals( - " 0 [>---------------------------]\n". - " 1 [->--------------------------]", - stream_get_contents($output->getStream()) - ); - } - - public function testParallelBars() - { - $output = $this->getOutputStream(); - $bar1 = new ProgressBar($output, 2); - $bar2 = new ProgressBar($output, 3); - $bar2->setProgressCharacter('#'); - $bar3 = new ProgressBar($output); - - $bar1->start(); - $output->write("\n"); - $bar2->start(); - $output->write("\n"); - $bar3->start(); - - for ($i = 1; $i <= 3; $i++) { - // up two lines - $output->write("\033[2A"); - if ($i <= 2) { - $bar1->advance(); - } - $output->write("\n"); - $bar2->advance(); - $output->write("\n"); - $bar3->advance(); - } - $output->write("\033[2A"); - $output->write("\n"); - $output->write("\n"); - $bar3->finish(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0/2 [>---------------------------] 0%')."\n". - $this->generateOutput(' 0/3 [#---------------------------] 0%')."\n". - rtrim($this->generateOutput(' 0 [>---------------------------]')). - - "\033[2A". - $this->generateOutput(' 1/2 [==============>-------------] 50%')."\n". - $this->generateOutput(' 1/3 [=========#------------------] 33%')."\n". - rtrim($this->generateOutput(' 1 [->--------------------------]')). - - "\033[2A". - $this->generateOutput(' 2/2 [============================] 100%')."\n". - $this->generateOutput(' 2/3 [==================#---------] 66%')."\n". - rtrim($this->generateOutput(' 2 [-->-------------------------]')). - - "\033[2A". - "\n". - $this->generateOutput(' 3/3 [============================] 100%')."\n". - rtrim($this->generateOutput(' 3 [--->------------------------]')). - - "\033[2A". - "\n". - "\n". - rtrim($this->generateOutput(' 3 [============================]')), - stream_get_contents($output->getStream()) - ); - } - - public function testWithoutMax() - { - $output = $this->getOutputStream(); - - $bar = new ProgressBar($output); - $bar->start(); - $bar->advance(); - $bar->advance(); - $bar->advance(); - $bar->finish(); - - rewind($output->getStream()); - $this->assertEquals( - rtrim($this->generateOutput(' 0 [>---------------------------]')). - rtrim($this->generateOutput(' 1 [->--------------------------]')). - rtrim($this->generateOutput(' 2 [-->-------------------------]')). - rtrim($this->generateOutput(' 3 [--->------------------------]')). - rtrim($this->generateOutput(' 3 [============================]')), - stream_get_contents($output->getStream()) - ); - } - - public function testAddingPlaceholderFormatter() - { - ProgressBar::setPlaceholderFormatterDefinition('remaining_steps', function (ProgressBar $bar) { - return $bar->getMaxSteps() - $bar->getProgress(); - }); - $bar = new ProgressBar($output = $this->getOutputStream(), 3); - $bar->setFormat(' %remaining_steps% [%bar%]'); - - $bar->start(); - $bar->advance(); - $bar->finish(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 3 [>---------------------------]'). - $this->generateOutput(' 2 [=========>------------------]'). - $this->generateOutput(' 0 [============================]'), - stream_get_contents($output->getStream()) - ); - } - - public function testMultilineFormat() - { - $bar = new ProgressBar($output = $this->getOutputStream(), 3); - $bar->setFormat("%bar%\nfoobar"); - - $bar->start(); - $bar->advance(); - $bar->clear(); - $bar->finish(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(">---------------------------\nfoobar"). - $this->generateOutput("=========>------------------\nfoobar "). - $this->generateOutput(" \n "). - $this->generateOutput("============================\nfoobar "), - stream_get_contents($output->getStream()) - ); - } - - public function testAnsiColorsAndEmojis() - { - $bar = new ProgressBar($output = $this->getOutputStream(), 15); - ProgressBar::setPlaceholderFormatterDefinition('memory', function (ProgressBar $bar) { - static $i = 0; - $mem = 100000 * $i; - $colors = $i++ ? '41;37' : '44;37'; - - return "\033[".$colors."m ".Helper::formatMemory($mem)." \033[0m"; - }); - $bar->setFormat(" \033[44;37m %title:-37s% \033[0m\n %current%/%max% %bar% %percent:3s%%\n 🏁 %remaining:-10s% %memory:37s%"); - $bar->setBarCharacter($done = "\033[32m●\033[0m"); - $bar->setEmptyBarCharacter($empty = "\033[31m●\033[0m"); - $bar->setProgressCharacter($progress = "\033[32m➤ \033[0m"); - - $bar->setMessage('Starting the demo... fingers crossed', 'title'); - $bar->start(); - $bar->setMessage('Looks good to me...', 'title'); - $bar->advance(4); - $bar->setMessage('Thanks, bye', 'title'); - $bar->finish(); - - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput( - " \033[44;37m Starting the demo... fingers crossed \033[0m\n". - " 0/15 ".$progress.str_repeat($empty, 26)." 0%\n". - " \xf0\x9f\x8f\x81 1 sec \033[44;37m 0 B \033[0m" - ). - $this->generateOutput( - " \033[44;37m Looks good to me... \033[0m\n". - " 4/15 ".str_repeat($done, 7).$progress.str_repeat($empty, 19)." 26%\n". - " \xf0\x9f\x8f\x81 1 sec \033[41;37m 97 KiB \033[0m" - ). - $this->generateOutput( - " \033[44;37m Thanks, bye \033[0m\n". - " 15/15 ".str_repeat($done, 28)." 100%\n". - " \xf0\x9f\x8f\x81 1 sec \033[41;37m 195 KiB \033[0m" - ), - stream_get_contents($output->getStream()) - ); - } - - public function testSetFormat() - { - $bar = new ProgressBar($output = $this->getOutputStream()); - $bar->setFormat('normal'); - $bar->start(); - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0 [>---------------------------]'), - stream_get_contents($output->getStream()) - ); - - $bar = new ProgressBar($output = $this->getOutputStream(), 10); - $bar->setFormat('normal'); - $bar->start(); - rewind($output->getStream()); - $this->assertEquals( - $this->generateOutput(' 0/10 [>---------------------------] 0%'), - stream_get_contents($output->getStream()) - ); - } - - /** - * @dataProvider provideFormat - */ - public function testFormatsWithoutMax($format) - { - $bar = new ProgressBar($output = $this->getOutputStream()); - $bar->setFormat($format); - $bar->start(); - - rewind($output->getStream()); - $this->assertNotEmpty(stream_get_contents($output->getStream())); - } - - /** - * Provides each defined format - * - * @return array - */ - public function provideFormat() - { - return array( - array('normal'), - array('verbose'), - array('very_verbose'), - array('debug'), - ); - } - - protected function getOutputStream($decorated = true, $verbosity = StreamOutput::VERBOSITY_NORMAL) - { - return new StreamOutput(fopen('php://memory', 'r+', false), $verbosity, $decorated); - } - - protected function generateOutput($expected) - { - $count = substr_count($expected, "\n"); - - return "\x0D".($count ? sprintf("\033[%dA", $count) : '').$expected; - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php deleted file mode 100644 index 8ae907a..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php +++ /dev/null @@ -1,238 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Helper; - -use Symfony\Component\Console\Helper\QuestionHelper; -use Symfony\Component\Console\Helper\HelperSet; -use Symfony\Component\Console\Helper\FormatterHelper; -use Symfony\Component\Console\Output\StreamOutput; -use Symfony\Component\Console\Question\ChoiceQuestion; -use Symfony\Component\Console\Question\ConfirmationQuestion; -use Symfony\Component\Console\Question\Question; - -/** - * @group tty - */ -class QuestionHelperTest extends \PHPUnit_Framework_TestCase -{ - public function testAskChoice() - { - $questionHelper = new QuestionHelper(); - - $helperSet = new HelperSet(array(new FormatterHelper())); - $questionHelper->setHelperSet($helperSet); - - $heroes = array('Superman', 'Batman', 'Spiderman'); - - $questionHelper->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n")); - - $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '2'); - // first answer is an empty answer, we're supposed to receive the default value - $this->assertEquals('Spiderman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - - $question = new ChoiceQuestion('What is your favorite superhero?', $heroes); - $this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - - $question = new ChoiceQuestion('What is your favorite superhero?', $heroes); - $question->setErrorMessage('Input "%s" is not a superhero!'); - $this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question)); - - rewind($output->getStream()); - $stream = stream_get_contents($output->getStream()); - $this->assertContains('Input "Fabien" is not a superhero!', $stream); - - try { - $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '1'); - $question->setMaxAttempts(1); - $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question); - $this->fail(); - } catch (\InvalidArgumentException $e) { - $this->assertEquals('Value "Fabien" is invalid', $e->getMessage()); - } - - $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null); - $question->setMultiselect(true); - - $this->assertEquals(array('Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - - $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0,1'); - $question->setMultiselect(true); - - $this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - - $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, ' 0 , 1 '); - $question->setMultiselect(true); - - $this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - } - - public function testAsk() - { - $dialog = new QuestionHelper(); - - $dialog->setInputStream($this->getInputStream("\n8AM\n")); - - $question = new Question('What time is it?', '2PM'); - $this->assertEquals('2PM', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - - $question = new Question('What time is it?', '2PM'); - $this->assertEquals('8AM', $dialog->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question)); - - rewind($output->getStream()); - $this->assertEquals('What time is it?', stream_get_contents($output->getStream())); - } - - public function testAskWithAutocomplete() - { - if (!$this->hasSttyAvailable()) { - $this->markTestSkipped('`stty` is required to test autocomplete functionality'); - } - - // Acm - // AcsTest - // - // - // Test - // - // S - // F00oo - $inputStream = $this->getInputStream("Acm\nAc\177\177s\tTest\n\n\033[A\033[A\n\033[A\033[A\033[A\033[A\033[A\tTest\n\033[B\nS\177\177\033[B\033[B\nF00\177\177oo\t\n"); - - $dialog = new QuestionHelper(); - $dialog->setInputStream($inputStream); - $helperSet = new HelperSet(array(new FormatterHelper())); - $dialog->setHelperSet($helperSet); - - $question = new Question('Please select a bundle', 'FrameworkBundle'); - $question->setAutocompleterValues(array('AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle')); - - $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $this->assertEquals('AsseticBundleTest', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $this->assertEquals('FrameworkBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $this->assertEquals('SecurityBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $this->assertEquals('FooBundleTest', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $this->assertEquals('AsseticBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $this->assertEquals('FooBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - } - - public function testAskHiddenResponse() - { - if ('\\' === DIRECTORY_SEPARATOR) { - $this->markTestSkipped('This test is not supported on Windows'); - } - - $dialog = new QuestionHelper(); - $dialog->setInputStream($this->getInputStream("8AM\n")); - - $question = new Question('What time is it?'); - $question->setHidden(true); - - $this->assertEquals('8AM', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - } - - public function testAskConfirmation() - { - $dialog = new QuestionHelper(); - - $dialog->setInputStream($this->getInputStream("\n\n")); - $question = new ConfirmationQuestion('Do you like French fries?'); - $this->assertTrue($dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $question = new ConfirmationQuestion('Do you like French fries?', false); - $this->assertFalse($dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - - $dialog->setInputStream($this->getInputStream("y\nyes\n")); - $question = new ConfirmationQuestion('Do you like French fries?', false); - $this->assertTrue($dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $question = new ConfirmationQuestion('Do you like French fries?', false); - $this->assertTrue($dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - - $dialog->setInputStream($this->getInputStream("n\nno\n")); - $question = new ConfirmationQuestion('Do you like French fries?', true); - $this->assertFalse($dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $question = new ConfirmationQuestion('Do you like French fries?', true); - $this->assertFalse($dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - } - - public function testAskAndValidate() - { - $dialog = new QuestionHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); - $dialog->setHelperSet($helperSet); - - $error = 'This is not a color!'; - $validator = function ($color) use ($error) { - if (!in_array($color, array('white', 'black'))) { - throw new \InvalidArgumentException($error); - } - - return $color; - }; - - $question = new Question('What color was the white horse of Henry IV?', 'white'); - $question->setValidator($validator); - $question->setMaxAttempts(2); - - $dialog->setInputStream($this->getInputStream("\nblack\n")); - $this->assertEquals('white', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $this->assertEquals('black', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - - $dialog->setInputStream($this->getInputStream("green\nyellow\norange\n")); - try { - $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question); - $this->fail(); - } catch (\InvalidArgumentException $e) { - $this->assertEquals($error, $e->getMessage()); - } - } - - public function testNoInteraction() - { - $dialog = new QuestionHelper(); - $question = new Question('Do you have a job?', 'not yet'); - $this->assertEquals('not yet', $dialog->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question)); - } - - protected function getInputStream($input) - { - $stream = fopen('php://memory', 'r+', false); - fwrite($stream, $input); - rewind($stream); - - return $stream; - } - - protected function createOutputInterface() - { - return new StreamOutput(fopen('php://memory', 'r+', false)); - } - - protected function createInputInterfaceMock($interactive = true) - { - $mock = $this->getMock('Symfony\Component\Console\Input\InputInterface'); - $mock->expects($this->any()) - ->method('isInteractive') - ->will($this->returnValue($interactive)); - - return $mock; - } - - private function hasSttyAvailable() - { - exec('stty 2>&1', $output, $exitcode); - - return $exitcode === 0; - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/TableTest.php b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/TableTest.php deleted file mode 100644 index 230e8ed..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/TableTest.php +++ /dev/null @@ -1,359 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Helper; - -use Symfony\Component\Console\Helper\Table; -use Symfony\Component\Console\Helper\TableStyle; -use Symfony\Component\Console\Helper\TableSeparator; -use Symfony\Component\Console\Output\StreamOutput; - -class TableTest extends \PHPUnit_Framework_TestCase -{ - protected $stream; - - protected function setUp() - { - $this->stream = fopen('php://memory', 'r+'); - } - - protected function tearDown() - { - fclose($this->stream); - $this->stream = null; - } - - /** - * @dataProvider testRenderProvider - */ - public function testRender($headers, $rows, $style, $expected) - { - $table = new Table($output = $this->getOutputStream()); - $table - ->setHeaders($headers) - ->setRows($rows) - ->setStyle($style) - ; - $table->render(); - - $this->assertEquals($expected, $this->getOutputContent($output)); - } - - /** - * @dataProvider testRenderProvider - */ - public function testRenderAddRows($headers, $rows, $style, $expected) - { - $table = new Table($output = $this->getOutputStream()); - $table - ->setHeaders($headers) - ->addRows($rows) - ->setStyle($style) - ; - $table->render(); - - $this->assertEquals($expected, $this->getOutputContent($output)); - } - - /** - * @dataProvider testRenderProvider - */ - public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected) - { - $table = new Table($output = $this->getOutputStream()); - $table - ->setHeaders($headers) - ->setStyle($style) - ; - foreach ($rows as $row) { - $table->addRow($row); - } - $table->render(); - - $this->assertEquals($expected, $this->getOutputContent($output)); - } - - public function testRenderProvider() - { - $books = array( - array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), - array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), - array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'), - array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), - ); - - return array( - array( - array('ISBN', 'Title', 'Author'), - $books, - 'default', -<< array( - array('ISBN', 'Title', 'Author'), - array( - array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), - array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), - ), - 'default', -<<
    array( - array('ISBN', 'Title', 'Author'), - array( - array('99921-58-10-700', 'Divine Com', 'Dante Alighieri'), - array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), - ), - 'default', -<<
    99921-58-10-700 | Divine Com | Dante Alighieri | -| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | -+----------------------------------+----------------------+-----------------+ - -TABLE - ), - ); - } - - public function testRenderMultiByte() - { - if (!function_exists('mb_strlen')) { - $this->markTestSkipped('The "mbstring" extension is not available'); - } - - $table = new Table($output = $this->getOutputStream()); - $table - ->setHeaders(array('■■')) - ->setRows(array(array(1234))) - ->setStyle('default') - ; - $table->render(); - - $expected = -<<
    assertEquals($expected, $this->getOutputContent($output)); - } - - public function testStyle() - { - $style = new TableStyle(); - $style - ->setHorizontalBorderChar('.') - ->setVerticalBorderChar('.') - ->setCrossingChar('.') - ; - - Table::setStyleDefinition('dotfull', $style); - $table = new Table($output = $this->getOutputStream()); - $table - ->setHeaders(array('Foo')) - ->setRows(array(array('Bar'))) - ->setStyle('dotfull'); - $table->render(); - - $expected = -<<
    assertEquals($expected, $this->getOutputContent($output)); - } - - public function testRowSeparator() - { - $table = new Table($output = $this->getOutputStream()); - $table - ->setHeaders(array('Foo')) - ->setRows(array( - array('Bar1'), - new TableSeparator(), - array('Bar2'), - new TableSeparator(), - array('Bar3'), - )); - $table->render(); - - $expected = -<<
    assertEquals($expected, $this->getOutputContent($output)); - - $this->assertEquals($table, $table->addRow(new TableSeparator()), 'fluent interface on addRow() with a single TableSeparator() works'); - } - - protected function getOutputStream() - { - return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, false); - } - - protected function getOutputContent(StreamOutput $output) - { - rewind($output->getStream()); - - return str_replace(PHP_EOL, "\n", stream_get_contents($output->getStream())); - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/ArgvInputTest.php b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/ArgvInputTest.php deleted file mode 100644 index d2c540e..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/ArgvInputTest.php +++ /dev/null @@ -1,317 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Input; - -use Symfony\Component\Console\Input\ArgvInput; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputOption; - -class ArgvInputTest extends \PHPUnit_Framework_TestCase -{ - public function testConstructor() - { - $_SERVER['argv'] = array('cli.php', 'foo'); - $input = new ArgvInput(); - $r = new \ReflectionObject($input); - $p = $r->getProperty('tokens'); - $p->setAccessible(true); - - $this->assertEquals(array('foo'), $p->getValue($input), '__construct() automatically get its input from the argv server variable'); - } - - public function testParseArguments() - { - $input = new ArgvInput(array('cli.php', 'foo')); - $input->bind(new InputDefinition(array(new InputArgument('name')))); - $this->assertEquals(array('name' => 'foo'), $input->getArguments(), '->parse() parses required arguments'); - - $input->bind(new InputDefinition(array(new InputArgument('name')))); - $this->assertEquals(array('name' => 'foo'), $input->getArguments(), '->parse() is stateless'); - } - - /** - * @dataProvider provideOptions - */ - public function testParseOptions($input, $options, $expectedOptions, $message) - { - $input = new ArgvInput($input); - $input->bind(new InputDefinition($options)); - - $this->assertEquals($expectedOptions, $input->getOptions(), $message); - } - - public function provideOptions() - { - return array( - array( - array('cli.php', '--foo'), - array(new InputOption('foo')), - array('foo' => true), - '->parse() parses long options without a value', - ), - array( - array('cli.php', '--foo=bar'), - array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), - array('foo' => 'bar'), - '->parse() parses long options with a required value (with a = separator)', - ), - array( - array('cli.php', '--foo', 'bar'), - array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), - array('foo' => 'bar'), - '->parse() parses long options with a required value (with a space separator)', - ), - array( - array('cli.php', '-f'), - array(new InputOption('foo', 'f')), - array('foo' => true), - '->parse() parses short options without a value', - ), - array( - array('cli.php', '-fbar'), - array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), - array('foo' => 'bar'), - '->parse() parses short options with a required value (with no separator)', - ), - array( - array('cli.php', '-f', 'bar'), - array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), - array('foo' => 'bar'), - '->parse() parses short options with a required value (with a space separator)', - ), - array( - array('cli.php', '-f', ''), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)), - array('foo' => ''), - '->parse() parses short options with an optional empty value', - ), - array( - array('cli.php', '-f', '', 'foo'), - array(new InputArgument('name'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)), - array('foo' => ''), - '->parse() parses short options with an optional empty value followed by an argument', - ), - array( - array('cli.php', '-f', '', '-b'), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b')), - array('foo' => '', 'bar' => true), - '->parse() parses short options with an optional empty value followed by an option', - ), - array( - array('cli.php', '-f', '-b', 'foo'), - array(new InputArgument('name'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b')), - array('foo' => null, 'bar' => true), - '->parse() parses short options with an optional value which is not present', - ), - array( - array('cli.php', '-fb'), - array(new InputOption('foo', 'f'), new InputOption('bar', 'b')), - array('foo' => true, 'bar' => true), - '->parse() parses short options when they are aggregated as a single one', - ), - array( - array('cli.php', '-fb', 'bar'), - array(new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_REQUIRED)), - array('foo' => true, 'bar' => 'bar'), - '->parse() parses short options when they are aggregated as a single one and the last one has a required value', - ), - array( - array('cli.php', '-fb', 'bar'), - array(new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)), - array('foo' => true, 'bar' => 'bar'), - '->parse() parses short options when they are aggregated as a single one and the last one has an optional value', - ), - array( - array('cli.php', '-fbbar'), - array(new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)), - array('foo' => true, 'bar' => 'bar'), - '->parse() parses short options when they are aggregated as a single one and the last one has an optional value with no separator', - ), - array( - array('cli.php', '-fbbar'), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)), - array('foo' => 'bbar', 'bar' => null), - '->parse() parses short options when they are aggregated as a single one and one of them takes a value', - ), - ); - } - - /** - * @dataProvider provideInvalidInput - */ - public function testInvalidInput($argv, $definition, $expectedExceptionMessage) - { - $this->setExpectedException('RuntimeException', $expectedExceptionMessage); - - $input = new ArgvInput($argv); - $input->bind($definition); - } - - public function provideInvalidInput() - { - return array( - array( - array('cli.php', '--foo'), - new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))), - 'The "--foo" option requires a value.', - ), - array( - array('cli.php', '-f'), - new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))), - 'The "--foo" option requires a value.', - ), - array( - array('cli.php', '-ffoo'), - new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_NONE))), - 'The "-o" option does not exist.', - ), - array( - array('cli.php', '--foo=bar'), - new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_NONE))), - 'The "--foo" option does not accept a value.', - ), - array( - array('cli.php', 'foo', 'bar'), - new InputDefinition(), - 'Too many arguments.', - ), - array( - array('cli.php', '--foo'), - new InputDefinition(), - 'The "--foo" option does not exist.', - ), - array( - array('cli.php', '-f'), - new InputDefinition(), - 'The "-f" option does not exist.', - ), - array( - array('cli.php', '-1'), - new InputDefinition(array(new InputArgument('number'))), - 'The "-1" option does not exist.', - ), - ); - } - - public function testParseArrayArgument() - { - $input = new ArgvInput(array('cli.php', 'foo', 'bar', 'baz', 'bat')); - $input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::IS_ARRAY)))); - - $this->assertEquals(array('name' => array('foo', 'bar', 'baz', 'bat')), $input->getArguments(), '->parse() parses array arguments'); - } - - public function testParseArrayOption() - { - $input = new ArgvInput(array('cli.php', '--name=foo', '--name=bar', '--name=baz')); - $input->bind(new InputDefinition(array(new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); - - $this->assertEquals(array('name' => array('foo', 'bar', 'baz')), $input->getOptions(), '->parse() parses array options ("--option=value" syntax)'); - - $input = new ArgvInput(array('cli.php', '--name', 'foo', '--name', 'bar', '--name', 'baz')); - $input->bind(new InputDefinition(array(new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); - $this->assertEquals(array('name' => array('foo', 'bar', 'baz')), $input->getOptions(), '->parse() parses array options ("--option value" syntax)'); - - $input = new ArgvInput(array('cli.php', '--name=foo', '--name=bar', '--name=')); - $input->bind(new InputDefinition(array(new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); - $this->assertSame(array('name' => array('foo', 'bar', null)), $input->getOptions(), '->parse() parses empty array options as null ("--option=value" syntax)'); - - $input = new ArgvInput(array('cli.php', '--name', 'foo', '--name', 'bar', '--name', '--anotherOption')); - $input->bind(new InputDefinition(array( - new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY), - new InputOption('anotherOption', null, InputOption::VALUE_NONE), - ))); - $this->assertSame(array('name' => array('foo', 'bar', null), 'anotherOption' => true), $input->getOptions(), '->parse() parses empty array options as null ("--option value" syntax)'); - } - - public function testParseNegativeNumberAfterDoubleDash() - { - $input = new ArgvInput(array('cli.php', '--', '-1')); - $input->bind(new InputDefinition(array(new InputArgument('number')))); - $this->assertEquals(array('number' => '-1'), $input->getArguments(), '->parse() parses arguments with leading dashes as arguments after having encountered a double-dash sequence'); - - $input = new ArgvInput(array('cli.php', '-f', 'bar', '--', '-1')); - $input->bind(new InputDefinition(array(new InputArgument('number'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)))); - $this->assertEquals(array('foo' => 'bar'), $input->getOptions(), '->parse() parses arguments with leading dashes as options before having encountered a double-dash sequence'); - $this->assertEquals(array('number' => '-1'), $input->getArguments(), '->parse() parses arguments with leading dashes as arguments after having encountered a double-dash sequence'); - } - - public function testParseEmptyStringArgument() - { - $input = new ArgvInput(array('cli.php', '-f', 'bar', '')); - $input->bind(new InputDefinition(array(new InputArgument('empty'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)))); - - $this->assertEquals(array('empty' => ''), $input->getArguments(), '->parse() parses empty string arguments'); - } - - public function testGetFirstArgument() - { - $input = new ArgvInput(array('cli.php', '-fbbar')); - $this->assertNull($input->getFirstArgument(), '->getFirstArgument() returns null when there is no arguments'); - - $input = new ArgvInput(array('cli.php', '-fbbar', 'foo')); - $this->assertEquals('foo', $input->getFirstArgument(), '->getFirstArgument() returns the first argument from the raw input'); - } - - public function testHasParameterOption() - { - $input = new ArgvInput(array('cli.php', '-f', 'foo')); - $this->assertTrue($input->hasParameterOption('-f'), '->hasParameterOption() returns true if the given short option is in the raw input'); - - $input = new ArgvInput(array('cli.php', '--foo', 'foo')); - $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input'); - - $input = new ArgvInput(array('cli.php', 'foo')); - $this->assertFalse($input->hasParameterOption('--foo'), '->hasParameterOption() returns false if the given short option is not in the raw input'); - - $input = new ArgvInput(array('cli.php', '--foo=bar')); - $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given option with provided value is in the raw input'); - } - - public function testToString() - { - $input = new ArgvInput(array('cli.php', '-f', 'foo')); - $this->assertEquals('-f foo', (string) $input); - - $input = new ArgvInput(array('cli.php', '-f', '--bar=foo', 'a b c d', "A\nB'C")); - $this->assertEquals('-f --bar=foo '.escapeshellarg('a b c d').' '.escapeshellarg("A\nB'C"), (string) $input); - } - - /** - * @dataProvider provideGetParameterOptionValues - */ - public function testGetParameterOptionEqualSign($argv, $key, $expected) - { - $input = new ArgvInput($argv); - $this->assertEquals($expected, $input->getParameterOption($key), '->getParameterOption() returns the expected value'); - } - - public function provideGetParameterOptionValues() - { - return array( - array(array('app/console', 'foo:bar', '-e', 'dev'), '-e', 'dev'), - array(array('app/console', 'foo:bar', '--env=dev'), '--env', 'dev'), - array(array('app/console', 'foo:bar', '-e', 'dev'), array('-e', '--env'), 'dev'), - array(array('app/console', 'foo:bar', '--env=dev'), array('-e', '--env'), 'dev'), - array(array('app/console', 'foo:bar', '--env=dev', '--en=1'), array('--en'), '1'), - array(array('app/console', 'foo:bar', '--env=dev', '', '--en=1'), array('--en'), '1'), - ); - } - - public function testParseSingleDashAsArgument() - { - $input = new ArgvInput(array('cli.php', '-')); - $input->bind(new InputDefinition(array(new InputArgument('file')))); - $this->assertEquals(array('file' => '-'), $input->getArguments(), '->parse() parses single dash as an argument'); - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php deleted file mode 100644 index 1abc363..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Logger; - -use Psr\Log\Test\LoggerInterfaceTest; -use Psr\Log\LogLevel; -use Symfony\Component\Console\Logger\ConsoleLogger; -use Symfony\Component\Console\Tests\Fixtures\DummyOutput; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Console logger test - * - * @author Kévin Dunglas - */ -class ConsoleLoggerTest extends LoggerInterfaceTest -{ - /** - * @var DummyOutput - */ - protected $output; - - /** - * {@inheritdoc} - */ - public function getLogger() - { - $this->output = new DummyOutput(OutputInterface::VERBOSITY_VERBOSE); - - return new ConsoleLogger($this->output, array( - LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL, - LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL, - LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL, - LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL, - LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL, - LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL, - LogLevel::INFO => OutputInterface::VERBOSITY_NORMAL, - LogLevel::DEBUG => OutputInterface::VERBOSITY_NORMAL, - )); - } - - /** - * {@inheritdoc} - */ - public function getLogs() - { - return $this->output->getLogs(); - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Output/ConsoleOutputTest.php b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Output/ConsoleOutputTest.php deleted file mode 100644 index 1afbbb6..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Output/ConsoleOutputTest.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Output; - -use Symfony\Component\Console\Output\ConsoleOutput; -use Symfony\Component\Console\Output\Output; - -class ConsoleOutputTest extends \PHPUnit_Framework_TestCase -{ - public function testConstructor() - { - $output = new ConsoleOutput(Output::VERBOSITY_QUIET, true); - $this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity(), '__construct() takes the verbosity as its first argument'); - $this->assertSame($output->getFormatter(), $output->getErrorOutput()->getFormatter(), '__construct() takes a formatter or null as the third argument'); - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Output/NullOutputTest.php b/application/vendor/symfony/console/Symfony/Component/Console/Tests/Output/NullOutputTest.php deleted file mode 100644 index b20ae4e..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Output/NullOutputTest.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tests\Output; - -use Symfony\Component\Console\Output\NullOutput; -use Symfony\Component\Console\Output\OutputInterface; - -class NullOutputTest extends \PHPUnit_Framework_TestCase -{ - public function testConstructor() - { - $output = new NullOutput(); - - ob_start(); - $output->write('foo'); - $buffer = ob_get_clean(); - - $this->assertSame('', $buffer, '->write() does nothing (at least nothing is printed)'); - $this->assertFalse($output->isDecorated(), '->isDecorated() returns false'); - } - - public function testVerbosity() - { - $output = new NullOutput(); - $this->assertSame(OutputInterface::VERBOSITY_QUIET, $output->getVerbosity(), '->getVerbosity() returns VERBOSITY_QUIET for NullOutput by default'); - - $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); - $this->assertSame(OutputInterface::VERBOSITY_QUIET, $output->getVerbosity(), '->getVerbosity() always returns VERBOSITY_QUIET for NullOutput'); - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/composer.json b/application/vendor/symfony/console/Symfony/Component/Console/composer.json deleted file mode 100644 index 2efbd2c..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/composer.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "symfony/console", - "type": "library", - "description": "Symfony Console Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7", - "symfony/event-dispatcher": "~2.1", - "symfony/process": "~2.1", - "psr/log": "~1.0" - }, - "suggest": { - "symfony/event-dispatcher": "", - "symfony/process": "", - "psr/log": "For using the console logger" - }, - "autoload": { - "psr-0": { "Symfony\\Component\\Console\\": "" } - }, - "target-dir": "Symfony/Component/Console", - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - } -} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/phpunit.xml.dist b/application/vendor/symfony/console/Symfony/Component/Console/phpunit.xml.dist deleted file mode 100644 index 729c433..0000000 --- a/application/vendor/symfony/console/Symfony/Component/Console/phpunit.xml.dist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Resources - ./Tests - ./vendor - - - - diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tester/ApplicationTester.php b/application/vendor/symfony/console/Tester/ApplicationTester.php similarity index 96% rename from application/vendor/symfony/console/Symfony/Component/Console/Tester/ApplicationTester.php rename to application/vendor/symfony/console/Tester/ApplicationTester.php index da8a19c..dc12164 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tester/ApplicationTester.php +++ b/application/vendor/symfony/console/Tester/ApplicationTester.php @@ -34,11 +34,6 @@ class ApplicationTester private $output; private $statusCode; - /** - * Constructor. - * - * @param Application $application An Application instance to test. - */ public function __construct(Application $application) { $this->application = $application; diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tester/CommandTester.php b/application/vendor/symfony/console/Tester/CommandTester.php similarity index 93% rename from application/vendor/symfony/console/Symfony/Component/Console/Tester/CommandTester.php rename to application/vendor/symfony/console/Tester/CommandTester.php index 8d6486e..a194949 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tester/CommandTester.php +++ b/application/vendor/symfony/console/Tester/CommandTester.php @@ -29,11 +29,6 @@ class CommandTester private $output; private $statusCode; - /** - * Constructor. - * - * @param Command $command A Command instance to test. - */ public function __construct(Command $command) { $this->command = $command; @@ -70,9 +65,7 @@ public function execute(array $input, array $options = array()) } $this->output = new StreamOutput(fopen('php://memory', 'w', false)); - if (isset($options['decorated'])) { - $this->output->setDecorated($options['decorated']); - } + $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false); if (isset($options['verbosity'])) { $this->output->setVerbosity($options['verbosity']); } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/ApplicationTest.php b/application/vendor/symfony/console/Tests/ApplicationTest.php similarity index 80% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/ApplicationTest.php rename to application/vendor/symfony/console/Tests/ApplicationTest.php index 1fa6c64..5ab3b0a 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/application/vendor/symfony/console/Tests/ApplicationTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Console\Tests; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\FormatterHelper; @@ -30,7 +31,7 @@ use Symfony\Component\Console\Event\ConsoleTerminateEvent; use Symfony\Component\EventDispatcher\EventDispatcher; -class ApplicationTest extends \PHPUnit_Framework_TestCase +class ApplicationTest extends TestCase { protected static $fixturesPath; @@ -38,6 +39,7 @@ public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/Fixtures/'); require_once self::$fixturesPath.'/FooCommand.php'; + require_once self::$fixturesPath.'/FooOptCommand.php'; require_once self::$fixturesPath.'/Foo1Command.php'; require_once self::$fixturesPath.'/Foo2Command.php'; require_once self::$fixturesPath.'/Foo3Command.php'; @@ -47,6 +49,8 @@ public static function setUpBeforeClass() require_once self::$fixturesPath.'/BarBucCommand.php'; require_once self::$fixturesPath.'/FooSubnamespaced1Command.php'; require_once self::$fixturesPath.'/FooSubnamespaced2Command.php'; + require_once self::$fixturesPath.'/TestTiti.php'; + require_once self::$fixturesPath.'/TestToto.php'; } protected function normalizeLineBreaks($text) @@ -224,6 +228,14 @@ public function testFindAmbiguousNamespace() $application->findNamespace('f'); } + public function testFindNonAmbiguous() + { + $application = new Application(); + $application->add(new \TestTiti()); + $application->add(new \TestToto()); + $this->assertEquals('test-toto', $application->find('test')->getName()); + } + /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage There are no commands defined in the "bar" namespace. @@ -265,7 +277,12 @@ public function testFind() */ public function testFindWithAmbiguousAbbreviations($abbreviation, $expectedExceptionMessage) { - $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage); + if (method_exists($this, 'expectException')) { + $this->expectException('InvalidArgumentException'); + $this->expectExceptionMessage($expectedExceptionMessage); + } else { + $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage); + } $application = new Application(); $application->add(new \FooCommand()); @@ -423,7 +440,7 @@ public function testFindAlternativeNamespace() $application->add(new \FooCommand()); $application->add(new \Foo1Command()); $application->add(new \Foo2Command()); - $application->add(new \foo3Command()); + $application->add(new \Foo3Command()); try { $application->find('Unknown-namespace:Unknown-command'); @@ -447,7 +464,7 @@ public function testFindAlternativeNamespace() public function testFindNamespaceDoesNotFailOnDeepSimilarNamespaces() { - $application = $this->getMock('Symfony\Component\Console\Application', array('getNamespaces')); + $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getNamespaces'))->getMock(); $application->expects($this->once()) ->method('getNamespaces') ->will($this->returnValue(array('foo:sublong', 'bar:sub'))); @@ -469,7 +486,7 @@ public function testFindWithDoubleColonInNameThrowsException() public function testSetCatchExceptions() { - $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth')); + $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock(); $application->setAutoExit(false); $application->expects($this->any()) ->method('getTerminalWidth') @@ -495,8 +512,6 @@ public function testSetCatchExceptions() */ public function testLegacyAsText() { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - $application = new Application(); $application->add(new \FooCommand()); $this->ensureStaticCommandHelp($application); @@ -509,8 +524,6 @@ public function testLegacyAsText() */ public function testLegacyAsXml() { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - $application = new Application(); $application->add(new \FooCommand()); $this->ensureStaticCommandHelp($application); @@ -520,7 +533,7 @@ public function testLegacyAsXml() public function testRenderException() { - $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth')); + $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock(); $application->setAutoExit(false); $application->expects($this->any()) ->method('getTerminalWidth') @@ -544,7 +557,7 @@ public function testRenderException() $tester->run(array('command' => 'foo3:bar'), array('decorated' => true)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3decorated.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); - $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth')); + $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock(); $application->setAutoExit(false); $application->expects($this->any()) ->method('getTerminalWidth') @@ -555,9 +568,12 @@ public function testRenderException() $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception4.txt', $tester->getDisplay(true), '->renderException() wraps messages when they are bigger than the terminal'); } + /** + * @requires extension mbstring + */ public function testRenderExceptionWithDoubleWidthCharacters() { - $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth')); + $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock(); $application->setAutoExit(false); $application->expects($this->any()) ->method('getTerminalWidth') @@ -573,7 +589,7 @@ public function testRenderExceptionWithDoubleWidthCharacters() $tester->run(array('command' => 'foo'), array('decorated' => true)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_doublewidth1decorated.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); - $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth')); + $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock(); $application->setAutoExit(false); $application->expects($this->any()) ->method('getTerminalWidth') @@ -586,6 +602,38 @@ public function testRenderExceptionWithDoubleWidthCharacters() $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_doublewidth2.txt', $tester->getDisplay(true), '->renderException() wraps messages when they are bigger than the terminal'); } + public function testRenderExceptionEscapesLines() + { + $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock(); + $application->setAutoExit(false); + $application->expects($this->any()) + ->method('getTerminalWidth') + ->will($this->returnValue(22)); + $application->register('foo')->setCode(function () { + throw new \Exception('dont break here !'); + }); + $tester = new ApplicationTester($application); + + $tester->run(array('command' => 'foo'), array('decorated' => false)); + $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_escapeslines.txt', $tester->getDisplay(true), '->renderException() escapes lines containing formatting'); + } + + public function testRenderExceptionLineBreaks() + { + $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock(); + $application->setAutoExit(false); + $application->expects($this->any()) + ->method('getTerminalWidth') + ->will($this->returnValue(120)); + $application->register('foo')->setCode(function () { + throw new \InvalidArgumentException("\n\nline 1 with extra spaces \nline 2\n\nline 4\n"); + }); + $tester = new ApplicationTester($application); + + $tester->run(array('command' => 'foo'), array('decorated' => false)); + $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception_linebreaks.txt', $tester->getDisplay(true), '->renderException() keep multiple line breaks'); + } + public function testRun() { $application = new Application(); @@ -637,9 +685,11 @@ public function testRun() $tester->run(array('command' => 'list', '--quiet' => true)); $this->assertSame('', $tester->getDisplay(), '->run() removes all output if --quiet is passed'); + $this->assertFalse($tester->getInput()->isInteractive(), '->run() sets off the interactive mode if --quiet is passed'); $tester->run(array('command' => 'list', '-q' => true)); $this->assertSame('', $tester->getDisplay(), '->run() removes all output if -q is passed'); + $this->assertFalse($tester->getInput()->isInteractive(), '->run() sets off the interactive mode if -q is passed'); $tester->run(array('command' => 'list', '--verbose' => true)); $this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if --verbose is passed'); @@ -679,7 +729,7 @@ public function testRun() } /** - * Issue #9285 + * Issue #9285. * * If the "verbose" option is just before an argument in ArgvInput, * an argument value should not be treated as verbosity value. @@ -697,19 +747,23 @@ public function testVerboseValueNotBreakArguments() $input = new ArgvInput(array('cli.php', '-v', 'foo:bar')); $application->run($input, $output); + $this->addToAssertionCount(1); + $input = new ArgvInput(array('cli.php', '--verbose', 'foo:bar')); $application->run($input, $output); + + $this->addToAssertionCount(1); } public function testRunReturnsIntegerExitCode() { $exception = new \Exception('', 4); - $application = $this->getMock('Symfony\Component\Console\Application', array('doRun')); + $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('doRun'))->getMock(); $application->setAutoExit(false); $application->expects($this->once()) - ->method('doRun') - ->will($this->throwException($exception)); + ->method('doRun') + ->will($this->throwException($exception)); $exitCode = $application->run(new ArrayInput(array()), new NullOutput()); @@ -720,17 +774,44 @@ public function testRunReturnsExitCodeOneForExceptionCodeZero() { $exception = new \Exception('', 0); - $application = $this->getMock('Symfony\Component\Console\Application', array('doRun')); + $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('doRun'))->getMock(); $application->setAutoExit(false); $application->expects($this->once()) - ->method('doRun') - ->will($this->throwException($exception)); + ->method('doRun') + ->will($this->throwException($exception)); $exitCode = $application->run(new ArrayInput(array()), new NullOutput()); $this->assertSame(1, $exitCode, '->run() returns exit code 1 when exception code is 0'); } + /** + * @expectedException \LogicException + * @expectedExceptionMessage An option with shortcut "e" already exists. + */ + public function testAddingOptionWithDuplicateShortcut() + { + $dispatcher = new EventDispatcher(); + $application = new Application(); + $application->setAutoExit(false); + $application->setCatchExceptions(false); + $application->setDispatcher($dispatcher); + + $application->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'Environment')); + + $application + ->register('foo') + ->setAliases(array('f')) + ->setDefinition(array(new InputOption('survey', 'e', InputOption::VALUE_REQUIRED, 'My option with a shortcut.'))) + ->setCode(function (InputInterface $input, OutputInterface $output) {}) + ; + + $input = new ArrayInput(array('command' => 'foo')); + $output = new NullOutput(); + + $application->run($input, $output); + } + /** * @expectedException \LogicException * @dataProvider getAddingAlreadySetDefinitionElementData @@ -884,7 +965,7 @@ public function testRunWithDispatcher() $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo')); - $this->assertEquals('before.foo.after.', $tester->getDisplay()); + $this->assertEquals('before.foo.after.'.PHP_EOL, $tester->getDisplay()); } /** @@ -920,7 +1001,105 @@ public function testRunDispatchesAllEventsWithException() $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo')); - $this->assertContains('before.foo.after.caught.', $tester->getDisplay()); + $this->assertContains('before.foo.caught.after.', $tester->getDisplay()); + } + + public function testRunDispatchesAllEventsWithExceptionInListener() + { + $dispatcher = $this->getDispatcher(); + $dispatcher->addListener('console.command', function () { + throw new \RuntimeException('foo'); + }); + + $application = new Application(); + $application->setDispatcher($dispatcher); + $application->setAutoExit(false); + + $application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) { + $output->write('foo.'); + }); + + $tester = new ApplicationTester($application); + $tester->run(array('command' => 'foo')); + $this->assertContains('before.caught.after.', $tester->getDisplay()); + } + + public function testRunWithError() + { + $application = new Application(); + $application->setAutoExit(false); + $application->setCatchExceptions(false); + + $application->register('dym')->setCode(function (InputInterface $input, OutputInterface $output) { + $output->write('dym.'); + + throw new \Error('dymerr'); + }); + + $tester = new ApplicationTester($application); + + try { + $tester->run(array('command' => 'dym')); + $this->fail('Error expected.'); + } catch (\Error $e) { + $this->assertSame('dymerr', $e->getMessage()); + } + } + + /** + * @expectedException \LogicException + * @expectedExceptionMessage caught + */ + public function testRunWithErrorAndDispatcher() + { + $application = new Application(); + $application->setDispatcher($this->getDispatcher()); + $application->setAutoExit(false); + $application->setCatchExceptions(false); + + $application->register('dym')->setCode(function (InputInterface $input, OutputInterface $output) { + $output->write('dym.'); + + throw new \Error('dymerr'); + }); + + $tester = new ApplicationTester($application); + $tester->run(array('command' => 'dym')); + $this->assertContains('before.dym.caught.after.', $tester->getDisplay(), 'The PHP Error did not dispached events'); + } + + public function testRunDispatchesAllEventsWithError() + { + $application = new Application(); + $application->setDispatcher($this->getDispatcher()); + $application->setAutoExit(false); + + $application->register('dym')->setCode(function (InputInterface $input, OutputInterface $output) { + $output->write('dym.'); + + throw new \Error('dymerr'); + }); + + $tester = new ApplicationTester($application); + $tester->run(array('command' => 'dym')); + $this->assertContains('before.dym.caught.after.', $tester->getDisplay(), 'The PHP Error did not dispached events'); + } + + public function testRunWithErrorFailingStatusCode() + { + $application = new Application(); + $application->setDispatcher($this->getDispatcher()); + $application->setAutoExit(false); + + $application->register('dus')->setCode(function (InputInterface $input, OutputInterface $output) { + $output->write('dus.'); + + throw new \Error('duserr'); + }); + + $tester = new ApplicationTester($application); + $tester->run(array('command' => 'dus')); + $this->assertSame(1, $tester->getStatusCode(), 'Status code should be 1'); } public function testRunWithDispatcherSkippingCommand() @@ -954,6 +1133,60 @@ public function testTerminalDimensions() $this->assertSame(array($width, 80), $application->getTerminalDimensions()); } + public function testSetRunCustomDefaultCommand() + { + $command = new \FooCommand(); + + $application = new Application(); + $application->setAutoExit(false); + $application->add($command); + $application->setDefaultCommand($command->getName()); + + $tester = new ApplicationTester($application); + $tester->run(array(), array('interactive' => false)); + $this->assertEquals('called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); + + $application = new CustomDefaultCommandApplication(); + $application->setAutoExit(false); + + $tester = new ApplicationTester($application); + $tester->run(array(), array('interactive' => false)); + + $this->assertEquals('called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); + } + + public function testSetRunCustomDefaultCommandWithOption() + { + $command = new \FooOptCommand(); + + $application = new Application(); + $application->setAutoExit(false); + $application->add($command); + $application->setDefaultCommand($command->getName()); + + $tester = new ApplicationTester($application); + $tester->run(array('--fooopt' => 'opt'), array('interactive' => false)); + + $this->assertEquals('called'.PHP_EOL.'opt'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); + } + + /** + * @requires function posix_isatty + */ + public function testCanCheckIfTerminalIsInteractive() + { + $application = new CustomDefaultCommandApplication(); + $application->setAutoExit(false); + + $tester = new ApplicationTester($application); + $tester->run(array('command' => 'help')); + + $this->assertFalse($tester->getInput()->hasParameterOption(array('--no-interaction', '-n'))); + + $inputStream = $application->getHelperSet()->get('question')->getInputStream(); + $this->assertEquals($tester->getInput()->isInteractive(), @posix_isatty($inputStream)); + } + protected function getDispatcher($skipCommand = false) { $dispatcher = new EventDispatcher(); @@ -965,14 +1198,14 @@ protected function getDispatcher($skipCommand = false) } }); $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use ($skipCommand) { - $event->getOutput()->write('after.'); + $event->getOutput()->writeln('after.'); if (!$skipCommand) { - $event->setExitCode(113); + $event->setExitCode(ConsoleCommandEvent::RETURN_CODE_DISABLED); } }); $dispatcher->addListener('console.exception', function (ConsoleExceptionEvent $event) { - $event->getOutput()->writeln('caught.'); + $event->getOutput()->write('caught.'); $event->setException(new \LogicException('caught.', $event->getExitCode(), $event->getException())); }); @@ -980,44 +1213,27 @@ protected function getDispatcher($skipCommand = false) return $dispatcher; } - public function testSetRunCustomDefaultCommand() + /** + * @requires PHP 7 + */ + public function testErrorIsRethrownIfNotHandledByConsoleErrorEventWithCatchingEnabled() { - $command = new \FooCommand(); - $application = new Application(); $application->setAutoExit(false); - $application->add($command); - $application->setDefaultCommand($command->getName()); + $application->setDispatcher(new EventDispatcher()); - $tester = new ApplicationTester($application); - $tester->run(array()); - $this->assertEquals('interact called'.PHP_EOL.'called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); - - $application = new CustomDefaultCommandApplication(); - $application->setAutoExit(false); + $application->register('dym')->setCode(function (InputInterface $input, OutputInterface $output) { + new \UnknownClass(); + }); $tester = new ApplicationTester($application); - $tester->run(array()); - - $this->assertEquals('interact called'.PHP_EOL.'called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); - } - public function testCanCheckIfTerminalIsInteractive() - { - if (!function_exists('posix_isatty')) { - $this->markTestSkipped('posix_isatty function is required'); + try { + $tester->run(array('command' => 'dym')); + $this->fail('->run() should rethrow PHP errors if not handled via ConsoleErrorEvent.'); + } catch (\Error $e) { + $this->assertSame($e->getMessage(), 'Class \'UnknownClass\' not found'); } - - $application = new CustomDefaultCommandApplication(); - $application->setAutoExit(false); - - $tester = new ApplicationTester($application); - $tester->run(array('command' => 'help')); - - $this->assertFalse($tester->getInput()->hasParameterOption(array('--no-interaction', '-n'))); - - $inputStream = $application->getHelperSet()->get('question')->getInputStream(); - $this->assertEquals($tester->getInput()->isInteractive(), @posix_isatty($inputStream)); } } diff --git a/application/vendor/symfony/console/Tests/Command/CommandTest.php b/application/vendor/symfony/console/Tests/Command/CommandTest.php new file mode 100644 index 0000000..e129029 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Command/CommandTest.php @@ -0,0 +1,404 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Command; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Helper\FormatterHelper; +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Input\InputDefinition; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\StringInput; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Output\NullOutput; +use Symfony\Component\Console\Tester\CommandTester; + +class CommandTest extends TestCase +{ + protected static $fixturesPath; + + public static function setUpBeforeClass() + { + self::$fixturesPath = __DIR__.'/../Fixtures/'; + require_once self::$fixturesPath.'/TestCommand.php'; + } + + public function testConstructor() + { + $command = new Command('foo:bar'); + $this->assertEquals('foo:bar', $command->getName(), '__construct() takes the command name as its first argument'); + } + + /** + * @expectedException \LogicException + * @expectedExceptionMessage The command defined in "Symfony\Component\Console\Command\Command" cannot have an empty name. + */ + public function testCommandNameCannotBeEmpty() + { + new Command(); + } + + public function testSetApplication() + { + $application = new Application(); + $command = new \TestCommand(); + $command->setApplication($application); + $this->assertEquals($application, $command->getApplication(), '->setApplication() sets the current application'); + $this->assertEquals($application->getHelperSet(), $command->getHelperSet()); + } + + public function testSetApplicationNull() + { + $command = new \TestCommand(); + $command->setApplication(null); + $this->assertNull($command->getHelperSet()); + } + + public function testSetGetDefinition() + { + $command = new \TestCommand(); + $ret = $command->setDefinition($definition = new InputDefinition()); + $this->assertEquals($command, $ret, '->setDefinition() implements a fluent interface'); + $this->assertEquals($definition, $command->getDefinition(), '->setDefinition() sets the current InputDefinition instance'); + $command->setDefinition(array(new InputArgument('foo'), new InputOption('bar'))); + $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->setDefinition() also takes an array of InputArguments and InputOptions as an argument'); + $this->assertTrue($command->getDefinition()->hasOption('bar'), '->setDefinition() also takes an array of InputArguments and InputOptions as an argument'); + $command->setDefinition(new InputDefinition()); + } + + public function testAddArgument() + { + $command = new \TestCommand(); + $ret = $command->addArgument('foo'); + $this->assertEquals($command, $ret, '->addArgument() implements a fluent interface'); + $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->addArgument() adds an argument to the command'); + } + + public function testAddOption() + { + $command = new \TestCommand(); + $ret = $command->addOption('foo'); + $this->assertEquals($command, $ret, '->addOption() implements a fluent interface'); + $this->assertTrue($command->getDefinition()->hasOption('foo'), '->addOption() adds an option to the command'); + } + + public function testGetNamespaceGetNameSetName() + { + $command = new \TestCommand(); + $this->assertEquals('namespace:name', $command->getName(), '->getName() returns the command name'); + $command->setName('foo'); + $this->assertEquals('foo', $command->getName(), '->setName() sets the command name'); + + $ret = $command->setName('foobar:bar'); + $this->assertEquals($command, $ret, '->setName() implements a fluent interface'); + $this->assertEquals('foobar:bar', $command->getName(), '->setName() sets the command name'); + } + + /** + * @dataProvider provideInvalidCommandNames + */ + public function testInvalidCommandNames($name) + { + if (method_exists($this, 'expectException')) { + $this->expectException('InvalidArgumentException'); + $this->expectExceptionMessage(sprintf('Command name "%s" is invalid.', $name)); + } else { + $this->setExpectedException('InvalidArgumentException', sprintf('Command name "%s" is invalid.', $name)); + } + + $command = new \TestCommand(); + $command->setName($name); + } + + public function provideInvalidCommandNames() + { + return array( + array(''), + array('foo:'), + ); + } + + public function testGetSetDescription() + { + $command = new \TestCommand(); + $this->assertEquals('description', $command->getDescription(), '->getDescription() returns the description'); + $ret = $command->setDescription('description1'); + $this->assertEquals($command, $ret, '->setDescription() implements a fluent interface'); + $this->assertEquals('description1', $command->getDescription(), '->setDescription() sets the description'); + } + + public function testGetSetHelp() + { + $command = new \TestCommand(); + $this->assertEquals('help', $command->getHelp(), '->getHelp() returns the help'); + $ret = $command->setHelp('help1'); + $this->assertEquals($command, $ret, '->setHelp() implements a fluent interface'); + $this->assertEquals('help1', $command->getHelp(), '->setHelp() sets the help'); + $command->setHelp(''); + $this->assertEquals('', $command->getHelp(), '->getHelp() does not fall back to the description'); + } + + public function testGetProcessedHelp() + { + $command = new \TestCommand(); + $command->setHelp('The %command.name% command does... Example: php %command.full_name%.'); + $this->assertContains('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly'); + $this->assertNotContains('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name%'); + + $command = new \TestCommand(); + $command->setHelp(''); + $this->assertContains('description', $command->getProcessedHelp(), '->getProcessedHelp() falls back to the description'); + } + + public function testGetSetAliases() + { + $command = new \TestCommand(); + $this->assertEquals(array('name'), $command->getAliases(), '->getAliases() returns the aliases'); + $ret = $command->setAliases(array('name1')); + $this->assertEquals($command, $ret, '->setAliases() implements a fluent interface'); + $this->assertEquals(array('name1'), $command->getAliases(), '->setAliases() sets the aliases'); + } + + public function testSetAliasesNull() + { + $command = new \TestCommand(); + $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException'); + $command->setAliases(null); + } + + public function testGetSynopsis() + { + $command = new \TestCommand(); + $command->addOption('foo'); + $command->addArgument('bar'); + $this->assertEquals('namespace:name [--foo] [--] []', $command->getSynopsis(), '->getSynopsis() returns the synopsis'); + } + + public function testAddGetUsages() + { + $command = new \TestCommand(); + $command->addUsage('foo1'); + $command->addUsage('foo2'); + $this->assertContains('namespace:name foo1', $command->getUsages()); + $this->assertContains('namespace:name foo2', $command->getUsages()); + } + + public function testGetHelper() + { + $application = new Application(); + $command = new \TestCommand(); + $command->setApplication($application); + $formatterHelper = new FormatterHelper(); + $this->assertEquals($formatterHelper->getName(), $command->getHelper('formatter')->getName(), '->getHelper() returns the correct helper'); + } + + /** + * @expectedException \LogicException + * @expectedExceptionMessage Cannot retrieve helper "formatter" because there is no HelperSet defined. + */ + public function testGetHelperWithoutHelperSet() + { + $command = new \TestCommand(); + $command->getHelper('formatter'); + } + + public function testMergeApplicationDefinition() + { + $application1 = new Application(); + $application1->getDefinition()->addArguments(array(new InputArgument('foo'))); + $application1->getDefinition()->addOptions(array(new InputOption('bar'))); + $command = new \TestCommand(); + $command->setApplication($application1); + $command->setDefinition($definition = new InputDefinition(array(new InputArgument('bar'), new InputOption('foo')))); + + $r = new \ReflectionObject($command); + $m = $r->getMethod('mergeApplicationDefinition'); + $m->setAccessible(true); + $m->invoke($command); + $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition() merges the application arguments and the command arguments'); + $this->assertTrue($command->getDefinition()->hasArgument('bar'), '->mergeApplicationDefinition() merges the application arguments and the command arguments'); + $this->assertTrue($command->getDefinition()->hasOption('foo'), '->mergeApplicationDefinition() merges the application options and the command options'); + $this->assertTrue($command->getDefinition()->hasOption('bar'), '->mergeApplicationDefinition() merges the application options and the command options'); + + $m->invoke($command); + $this->assertEquals(3, $command->getDefinition()->getArgumentCount(), '->mergeApplicationDefinition() does not try to merge twice the application arguments and options'); + } + + public function testMergeApplicationDefinitionWithoutArgsThenWithArgsAddsArgs() + { + $application1 = new Application(); + $application1->getDefinition()->addArguments(array(new InputArgument('foo'))); + $application1->getDefinition()->addOptions(array(new InputOption('bar'))); + $command = new \TestCommand(); + $command->setApplication($application1); + $command->setDefinition($definition = new InputDefinition(array())); + + $r = new \ReflectionObject($command); + $m = $r->getMethod('mergeApplicationDefinition'); + $m->setAccessible(true); + $m->invoke($command, false); + $this->assertTrue($command->getDefinition()->hasOption('bar'), '->mergeApplicationDefinition(false) merges the application and the command options'); + $this->assertFalse($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition(false) does not merge the application arguments'); + + $m->invoke($command, true); + $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition(true) merges the application arguments and the command arguments'); + + $m->invoke($command); + $this->assertEquals(2, $command->getDefinition()->getArgumentCount(), '->mergeApplicationDefinition() does not try to merge twice the application arguments'); + } + + public function testRunInteractive() + { + $tester = new CommandTester(new \TestCommand()); + + $tester->execute(array(), array('interactive' => true)); + + $this->assertEquals('interact called'.PHP_EOL.'execute called'.PHP_EOL, $tester->getDisplay(), '->run() calls the interact() method if the input is interactive'); + } + + public function testRunNonInteractive() + { + $tester = new CommandTester(new \TestCommand()); + + $tester->execute(array(), array('interactive' => false)); + + $this->assertEquals('execute called'.PHP_EOL, $tester->getDisplay(), '->run() does not call the interact() method if the input is not interactive'); + } + + /** + * @expectedException \LogicException + * @expectedExceptionMessage You must override the execute() method in the concrete command class. + */ + public function testExecuteMethodNeedsToBeOverridden() + { + $command = new Command('foo'); + $command->run(new StringInput(''), new NullOutput()); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage The "--bar" option does not exist. + */ + public function testRunWithInvalidOption() + { + $command = new \TestCommand(); + $tester = new CommandTester($command); + $tester->execute(array('--bar' => true)); + } + + public function testRunReturnsIntegerExitCode() + { + $command = new \TestCommand(); + $exitCode = $command->run(new StringInput(''), new NullOutput()); + $this->assertSame(0, $exitCode, '->run() returns integer exit code (treats null as 0)'); + + $command = $this->getMockBuilder('TestCommand')->setMethods(array('execute'))->getMock(); + $command->expects($this->once()) + ->method('execute') + ->will($this->returnValue('2.3')); + $exitCode = $command->run(new StringInput(''), new NullOutput()); + $this->assertSame(2, $exitCode, '->run() returns integer exit code (casts numeric to int)'); + } + + public function testRunWithApplication() + { + $command = new \TestCommand(); + $command->setApplication(new Application()); + $exitCode = $command->run(new StringInput(''), new NullOutput()); + + $this->assertSame(0, $exitCode, '->run() returns an integer exit code'); + } + + public function testRunReturnsAlwaysInteger() + { + $command = new \TestCommand(); + + $this->assertSame(0, $command->run(new StringInput(''), new NullOutput())); + } + + public function testRunWithProcessTitle() + { + $command = new \TestCommand(); + $command->setApplication(new Application()); + $command->setProcessTitle('foo'); + $this->assertSame(0, $command->run(new StringInput(''), new NullOutput())); + if (function_exists('cli_set_process_title')) { + if (null === @cli_get_process_title() && 'Darwin' === PHP_OS) { + $this->markTestSkipped('Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.'); + } + $this->assertEquals('foo', cli_get_process_title()); + } + } + + public function testSetCode() + { + $command = new \TestCommand(); + $ret = $command->setCode(function (InputInterface $input, OutputInterface $output) { + $output->writeln('from the code...'); + }); + $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); + $tester = new CommandTester($command); + $tester->execute(array()); + $this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay()); + } + + public function testSetCodeWithNonClosureCallable() + { + $command = new \TestCommand(); + $ret = $command->setCode(array($this, 'callableMethodCommand')); + $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); + $tester = new CommandTester($command); + $tester->execute(array()); + $this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay()); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Invalid callable provided to Command::setCode. + */ + public function testSetCodeWithNonCallable() + { + $command = new \TestCommand(); + $command->setCode(array($this, 'nonExistentMethod')); + } + + public function callableMethodCommand(InputInterface $input, OutputInterface $output) + { + $output->writeln('from the code...'); + } + + /** + * @group legacy + */ + public function testLegacyAsText() + { + $command = new \TestCommand(); + $command->setApplication(new Application()); + $tester = new CommandTester($command); + $tester->execute(array('command' => $command->getName())); + $this->assertStringEqualsFile(self::$fixturesPath.'/command_astext.txt', $command->asText(), '->asText() returns a text representation of the command'); + } + + /** + * @group legacy + */ + public function testLegacyAsXml() + { + $command = new \TestCommand(); + $command->setApplication(new Application()); + $tester = new CommandTester($command); + $tester->execute(array('command' => $command->getName())); + $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/command_asxml.txt', $command->asXml(), '->asXml() returns an XML representation of the command'); + } +} diff --git a/application/vendor/symfony/console/Tests/Command/HelpCommandTest.php b/application/vendor/symfony/console/Tests/Command/HelpCommandTest.php new file mode 100644 index 0000000..a4e032a --- /dev/null +++ b/application/vendor/symfony/console/Tests/Command/HelpCommandTest.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Command; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Tester\CommandTester; +use Symfony\Component\Console\Command\HelpCommand; +use Symfony\Component\Console\Command\ListCommand; +use Symfony\Component\Console\Application; + +class HelpCommandTest extends TestCase +{ + public function testExecuteForCommandAlias() + { + $command = new HelpCommand(); + $command->setApplication(new Application()); + $commandTester = new CommandTester($command); + $commandTester->execute(array('command_name' => 'li'), array('decorated' => false)); + $this->assertContains('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias'); + $this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias'); + $this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias'); + } + + public function testExecuteForCommand() + { + $command = new HelpCommand(); + $commandTester = new CommandTester($command); + $command->setCommand(new ListCommand()); + $commandTester->execute(array(), array('decorated' => false)); + $this->assertContains('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); + $this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); + $this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); + } + + public function testExecuteForCommandWithXmlOption() + { + $command = new HelpCommand(); + $commandTester = new CommandTester($command); + $command->setCommand(new ListCommand()); + $commandTester->execute(array('--format' => 'xml')); + $this->assertContains('getDisplay(), '->execute() returns an XML help text if --xml is passed'); + } + + public function testExecuteForApplicationCommand() + { + $application = new Application(); + $commandTester = new CommandTester($application->get('help')); + $commandTester->execute(array('command_name' => 'list')); + $this->assertContains('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); + $this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); + $this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); + } + + public function testExecuteForApplicationCommandWithXmlOption() + { + $application = new Application(); + $commandTester = new CommandTester($application->get('help')); + $commandTester->execute(array('command_name' => 'list', '--format' => 'xml')); + $this->assertContains('list [--xml] [--raw] [--format FORMAT] [--] [<namespace>]', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); + $this->assertContains('getDisplay(), '->execute() returns an XML help text if --format=xml is passed'); + } +} diff --git a/application/vendor/symfony/console/Tests/Command/ListCommandTest.php b/application/vendor/symfony/console/Tests/Command/ListCommandTest.php new file mode 100644 index 0000000..fb6ee3b --- /dev/null +++ b/application/vendor/symfony/console/Tests/Command/ListCommandTest.php @@ -0,0 +1,113 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Command; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Tester\CommandTester; +use Symfony\Component\Console\Application; + +class ListCommandTest extends TestCase +{ + public function testExecuteListsCommands() + { + $application = new Application(); + $commandTester = new CommandTester($command = $application->get('list')); + $commandTester->execute(array('command' => $command->getName()), array('decorated' => false)); + + $this->assertRegExp('/help\s{2,}Displays help for a command/', $commandTester->getDisplay(), '->execute() returns a list of available commands'); + } + + public function testExecuteListsCommandsWithXmlOption() + { + $application = new Application(); + $commandTester = new CommandTester($command = $application->get('list')); + $commandTester->execute(array('command' => $command->getName(), '--format' => 'xml')); + $this->assertRegExp('//', $commandTester->getDisplay(), '->execute() returns a list of available commands in XML if --xml is passed'); + } + + public function testExecuteListsCommandsWithRawOption() + { + $application = new Application(); + $commandTester = new CommandTester($command = $application->get('list')); + $commandTester->execute(array('command' => $command->getName(), '--raw' => true)); + $output = <<<'EOF' +help Displays help for a command +list Lists commands + +EOF; + + $this->assertEquals($output, $commandTester->getDisplay(true)); + } + + public function testExecuteListsCommandsWithNamespaceArgument() + { + require_once realpath(__DIR__.'/../Fixtures/FooCommand.php'); + $application = new Application(); + $application->add(new \FooCommand()); + $commandTester = new CommandTester($command = $application->get('list')); + $commandTester->execute(array('command' => $command->getName(), 'namespace' => 'foo', '--raw' => true)); + $output = <<<'EOF' +foo:bar The foo:bar command + +EOF; + + $this->assertEquals($output, $commandTester->getDisplay(true)); + } + + public function testExecuteListsCommandsOrder() + { + require_once realpath(__DIR__.'/../Fixtures/Foo6Command.php'); + $application = new Application(); + $application->add(new \Foo6Command()); + $commandTester = new CommandTester($command = $application->get('list')); + $commandTester->execute(array('command' => $command->getName()), array('decorated' => false)); + $output = <<<'EOF' +Console Tool + +Usage: + command [options] [arguments] + +Options: + -h, --help Display this help message + -q, --quiet Do not output any message + -V, --version Display this application version + --ansi Force ANSI output + --no-ansi Disable ANSI output + -n, --no-interaction Do not ask any interactive question + -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug + +Available commands: + help Displays help for a command + list Lists commands + 0foo + 0foo:bar 0foo:bar command +EOF; + + $this->assertEquals($output, trim($commandTester->getDisplay(true))); + } + + public function testExecuteListsCommandsOrderRaw() + { + require_once realpath(__DIR__.'/../Fixtures/Foo6Command.php'); + $application = new Application(); + $application->add(new \Foo6Command()); + $commandTester = new CommandTester($command = $application->get('list')); + $commandTester->execute(array('command' => $command->getName(), '--raw' => true)); + $output = <<<'EOF' +help Displays help for a command +list Lists commands +0foo:bar 0foo:bar command +EOF; + + $this->assertEquals($output, trim($commandTester->getDisplay(true))); + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/AbstractDescriptorTest.php b/application/vendor/symfony/console/Tests/Descriptor/AbstractDescriptorTest.php similarity index 93% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/AbstractDescriptorTest.php rename to application/vendor/symfony/console/Tests/Descriptor/AbstractDescriptorTest.php index 406c659..fcbb719 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/AbstractDescriptorTest.php +++ b/application/vendor/symfony/console/Tests/Descriptor/AbstractDescriptorTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Console\Tests\Descriptor; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; @@ -18,7 +19,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\BufferedOutput; -abstract class AbstractDescriptorTest extends \PHPUnit_Framework_TestCase +abstract class AbstractDescriptorTest extends TestCase { /** @dataProvider getDescribeInputArgumentTestData */ public function testDescribeInputArgument(InputArgument $argument, $expectedDescription) @@ -83,9 +84,10 @@ public function getDescribeApplicationTestData() } abstract protected function getDescriptor(); + abstract protected function getFormat(); - private function getDescriptionTestData(array $objects) + protected function getDescriptionTestData(array $objects) { $data = array(); foreach ($objects as $name => $object) { @@ -96,7 +98,7 @@ private function getDescriptionTestData(array $objects) return $data; } - private function assertDescription($expectedDescription, $describedObject) + protected function assertDescription($expectedDescription, $describedObject) { $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true); $this->getDescriptor()->describe($output, $describedObject, array('raw_output' => true)); diff --git a/application/vendor/symfony/console/Tests/Descriptor/JsonDescriptorTest.php b/application/vendor/symfony/console/Tests/Descriptor/JsonDescriptorTest.php new file mode 100644 index 0000000..f9a1561 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Descriptor/JsonDescriptorTest.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Descriptor; + +use Symfony\Component\Console\Descriptor\JsonDescriptor; +use Symfony\Component\Console\Output\BufferedOutput; + +class JsonDescriptorTest extends AbstractDescriptorTest +{ + protected function getDescriptor() + { + return new JsonDescriptor(); + } + + protected function getFormat() + { + return 'json'; + } + + protected function assertDescription($expectedDescription, $describedObject) + { + $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true); + $this->getDescriptor()->describe($output, $describedObject, array('raw_output' => true)); + $this->assertEquals(json_decode(trim($expectedDescription), true), json_decode(trim(str_replace(PHP_EOL, "\n", $output->fetch())), true)); + } +} diff --git a/application/vendor/symfony/console/Tests/Descriptor/MarkdownDescriptorTest.php b/application/vendor/symfony/console/Tests/Descriptor/MarkdownDescriptorTest.php new file mode 100644 index 0000000..eb80f58 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Descriptor/MarkdownDescriptorTest.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Descriptor; + +use Symfony\Component\Console\Descriptor\MarkdownDescriptor; +use Symfony\Component\Console\Tests\Fixtures\DescriptorApplicationMbString; +use Symfony\Component\Console\Tests\Fixtures\DescriptorCommandMbString; + +class MarkdownDescriptorTest extends AbstractDescriptorTest +{ + public function getDescribeCommandTestData() + { + return $this->getDescriptionTestData(array_merge( + ObjectsProvider::getCommands(), + array('command_mbstring' => new DescriptorCommandMbString()) + )); + } + + public function getDescribeApplicationTestData() + { + return $this->getDescriptionTestData(array_merge( + ObjectsProvider::getApplications(), + array('application_mbstring' => new DescriptorApplicationMbString()) + )); + } + + protected function getDescriptor() + { + return new MarkdownDescriptor(); + } + + protected function getFormat() + { + return 'md'; + } +} diff --git a/application/vendor/symfony/console/Tests/Descriptor/ObjectsProvider.php b/application/vendor/symfony/console/Tests/Descriptor/ObjectsProvider.php new file mode 100644 index 0000000..b4f34ad --- /dev/null +++ b/application/vendor/symfony/console/Tests/Descriptor/ObjectsProvider.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Descriptor; + +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputDefinition; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Tests\Fixtures\DescriptorApplication1; +use Symfony\Component\Console\Tests\Fixtures\DescriptorApplication2; +use Symfony\Component\Console\Tests\Fixtures\DescriptorCommand1; +use Symfony\Component\Console\Tests\Fixtures\DescriptorCommand2; + +/** + * @author Jean-François Simon + */ +class ObjectsProvider +{ + public static function getInputArguments() + { + return array( + 'input_argument_1' => new InputArgument('argument_name', InputArgument::REQUIRED), + 'input_argument_2' => new InputArgument('argument_name', InputArgument::IS_ARRAY, 'argument description'), + 'input_argument_3' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'default_value'), + 'input_argument_4' => new InputArgument('argument_name', InputArgument::REQUIRED, "multiline\nargument description"), + 'input_argument_with_style' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'style'), + 'input_argument_with_default_inf_value' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', INF), + ); + } + + public static function getInputOptions() + { + return array( + 'input_option_1' => new InputOption('option_name', 'o', InputOption::VALUE_NONE), + 'input_option_2' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', 'default_value'), + 'input_option_3' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description'), + 'input_option_4' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'option description', array()), + 'input_option_5' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, "multiline\noption description"), + 'input_option_6' => new InputOption('option_name', array('o', 'O'), InputOption::VALUE_REQUIRED, 'option with multiple shortcuts'), + 'input_option_with_style' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description', 'style'), + 'input_option_with_style_array' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'option description', array('Hello', 'world')), + 'input_option_with_default_inf_value' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', INF), + ); + } + + public static function getInputDefinitions() + { + return array( + 'input_definition_1' => new InputDefinition(), + 'input_definition_2' => new InputDefinition(array(new InputArgument('argument_name', InputArgument::REQUIRED))), + 'input_definition_3' => new InputDefinition(array(new InputOption('option_name', 'o', InputOption::VALUE_NONE))), + 'input_definition_4' => new InputDefinition(array( + new InputArgument('argument_name', InputArgument::REQUIRED), + new InputOption('option_name', 'o', InputOption::VALUE_NONE), + )), + ); + } + + public static function getCommands() + { + return array( + 'command_1' => new DescriptorCommand1(), + 'command_2' => new DescriptorCommand2(), + ); + } + + public static function getApplications() + { + return array( + 'application_1' => new DescriptorApplication1(), + 'application_2' => new DescriptorApplication2(), + ); + } +} diff --git a/application/vendor/symfony/console/Tests/Descriptor/TextDescriptorTest.php b/application/vendor/symfony/console/Tests/Descriptor/TextDescriptorTest.php new file mode 100644 index 0000000..364e29c --- /dev/null +++ b/application/vendor/symfony/console/Tests/Descriptor/TextDescriptorTest.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Descriptor; + +use Symfony\Component\Console\Descriptor\TextDescriptor; +use Symfony\Component\Console\Tests\Fixtures\DescriptorApplicationMbString; +use Symfony\Component\Console\Tests\Fixtures\DescriptorCommandMbString; + +class TextDescriptorTest extends AbstractDescriptorTest +{ + public function getDescribeCommandTestData() + { + return $this->getDescriptionTestData(array_merge( + ObjectsProvider::getCommands(), + array('command_mbstring' => new DescriptorCommandMbString()) + )); + } + + public function getDescribeApplicationTestData() + { + return $this->getDescriptionTestData(array_merge( + ObjectsProvider::getApplications(), + array('application_mbstring' => new DescriptorApplicationMbString()) + )); + } + + protected function getDescriptor() + { + return new TextDescriptor(); + } + + protected function getFormat() + { + return 'txt'; + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/XmlDescriptorTest.php b/application/vendor/symfony/console/Tests/Descriptor/XmlDescriptorTest.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Descriptor/XmlDescriptorTest.php rename to application/vendor/symfony/console/Tests/Descriptor/XmlDescriptorTest.php diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/BarBucCommand.php b/application/vendor/symfony/console/Tests/Fixtures/BarBucCommand.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/BarBucCommand.php rename to application/vendor/symfony/console/Tests/Fixtures/BarBucCommand.php diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorApplication1.php b/application/vendor/symfony/console/Tests/Fixtures/DescriptorApplication1.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorApplication1.php rename to application/vendor/symfony/console/Tests/Fixtures/DescriptorApplication1.php diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorApplication2.php b/application/vendor/symfony/console/Tests/Fixtures/DescriptorApplication2.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorApplication2.php rename to application/vendor/symfony/console/Tests/Fixtures/DescriptorApplication2.php diff --git a/application/vendor/symfony/console/Tests/Fixtures/DescriptorApplicationMbString.php b/application/vendor/symfony/console/Tests/Fixtures/DescriptorApplicationMbString.php new file mode 100644 index 0000000..bf170c4 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/DescriptorApplicationMbString.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Fixtures; + +use Symfony\Component\Console\Application; + +class DescriptorApplicationMbString extends Application +{ + public function __construct() + { + parent::__construct('MbString åpplicätion'); + + $this->add(new DescriptorCommandMbString()); + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorCommand1.php b/application/vendor/symfony/console/Tests/Fixtures/DescriptorCommand1.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorCommand1.php rename to application/vendor/symfony/console/Tests/Fixtures/DescriptorCommand1.php diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorCommand2.php b/application/vendor/symfony/console/Tests/Fixtures/DescriptorCommand2.php similarity index 89% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorCommand2.php rename to application/vendor/symfony/console/Tests/Fixtures/DescriptorCommand2.php index bc04ca9..51106b9 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DescriptorCommand2.php +++ b/application/vendor/symfony/console/Tests/Fixtures/DescriptorCommand2.php @@ -23,6 +23,8 @@ protected function configure() ->setName('descriptor:command2') ->setDescription('command 2 description') ->setHelp('command 2 help') + ->addUsage('-o|--option_name ') + ->addUsage('') ->addArgument('argument_name', InputArgument::REQUIRED) ->addOption('option_name', 'o', InputOption::VALUE_NONE) ; diff --git a/application/vendor/symfony/console/Tests/Fixtures/DescriptorCommandMbString.php b/application/vendor/symfony/console/Tests/Fixtures/DescriptorCommandMbString.php new file mode 100644 index 0000000..66de917 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/DescriptorCommandMbString.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Fixtures; + +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; + +class DescriptorCommandMbString extends Command +{ + protected function configure() + { + $this + ->setName('descriptor:åèä') + ->setDescription('command åèä description') + ->setHelp('command åèä help') + ->addUsage('-o|--option_name ') + ->addUsage('') + ->addArgument('argument_åèä', InputArgument::REQUIRED) + ->addOption('option_åèä', 'o', InputOption::VALUE_NONE) + ; + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DummyOutput.php b/application/vendor/symfony/console/Tests/Fixtures/DummyOutput.php similarity index 89% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DummyOutput.php rename to application/vendor/symfony/console/Tests/Fixtures/DummyOutput.php index aef6d22..866e214 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/DummyOutput.php +++ b/application/vendor/symfony/console/Tests/Fixtures/DummyOutput.php @@ -14,7 +14,7 @@ use Symfony\Component\Console\Output\BufferedOutput; /** - * Dummy output + * Dummy output. * * @author Kévin Dunglas */ @@ -26,7 +26,7 @@ class DummyOutput extends BufferedOutput public function getLogs() { $logs = array(); - foreach (explode("\n", trim($this->fetch())) as $message) { + foreach (explode(PHP_EOL, trim($this->fetch())) as $message) { preg_match('/^\[(.*)\] (.*)/', $message, $matches); $logs[] = sprintf('%s %s', $matches[1], $matches[2]); } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/Foo1Command.php b/application/vendor/symfony/console/Tests/Fixtures/Foo1Command.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/Foo1Command.php rename to application/vendor/symfony/console/Tests/Fixtures/Foo1Command.php diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/Foo2Command.php b/application/vendor/symfony/console/Tests/Fixtures/Foo2Command.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/Foo2Command.php rename to application/vendor/symfony/console/Tests/Fixtures/Foo2Command.php diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php b/application/vendor/symfony/console/Tests/Fixtures/Foo3Command.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php rename to application/vendor/symfony/console/Tests/Fixtures/Foo3Command.php diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/Foo4Command.php b/application/vendor/symfony/console/Tests/Fixtures/Foo4Command.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/Foo4Command.php rename to application/vendor/symfony/console/Tests/Fixtures/Foo4Command.php diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/Foo5Command.php b/application/vendor/symfony/console/Tests/Fixtures/Foo5Command.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/Foo5Command.php rename to application/vendor/symfony/console/Tests/Fixtures/Foo5Command.php diff --git a/application/vendor/symfony/console/Tests/Fixtures/Foo6Command.php b/application/vendor/symfony/console/Tests/Fixtures/Foo6Command.php new file mode 100644 index 0000000..6ae987e --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Foo6Command.php @@ -0,0 +1,12 @@ +setName('0foo:bar')->setDescription('0foo:bar command'); + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/FooCommand.php b/application/vendor/symfony/console/Tests/Fixtures/FooCommand.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/FooCommand.php rename to application/vendor/symfony/console/Tests/Fixtures/FooCommand.php diff --git a/application/vendor/symfony/console/Tests/Fixtures/FooOptCommand.php b/application/vendor/symfony/console/Tests/Fixtures/FooOptCommand.php new file mode 100644 index 0000000..9043aa4 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/FooOptCommand.php @@ -0,0 +1,36 @@ +setName('foo:bar') + ->setDescription('The foo:bar command') + ->setAliases(array('afoobar')) + ->addOption('fooopt', 'fo', InputOption::VALUE_OPTIONAL, 'fooopt description') + ; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $output->writeln('interact called'); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->input = $input; + $this->output = $output; + + $output->writeln('called'); + $output->writeln($this->input->getOption('fooopt')); + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/FooSubnamespaced1Command.php b/application/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced1Command.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/FooSubnamespaced1Command.php rename to application/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced1Command.php diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/FooSubnamespaced2Command.php b/application/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced2Command.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/FooSubnamespaced2Command.php rename to application/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced2Command.php diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/FoobarCommand.php b/application/vendor/symfony/console/Tests/Fixtures/FoobarCommand.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/FoobarCommand.php rename to application/vendor/symfony/console/Tests/Fixtures/FoobarCommand.php diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_0.php b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_0.php new file mode 100644 index 0000000..996fafb --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_0.php @@ -0,0 +1,11 @@ +caution('Lorem ipsum dolor sit amet'); +}; diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_1.php b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_1.php new file mode 100644 index 0000000..6634cd5 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_1.php @@ -0,0 +1,13 @@ +title('Title'); + $output->warning('Lorem ipsum dolor sit amet'); + $output->title('Title'); +}; diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_10.php b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_10.php new file mode 100644 index 0000000..4120df9 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_10.php @@ -0,0 +1,17 @@ +block( + 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum', + 'CUSTOM', + 'fg=white;bg=green', + 'X ', + true + ); +}; diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_11.php b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_11.php new file mode 100644 index 0000000..a4ef74e --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_11.php @@ -0,0 +1,12 @@ +block($word, 'CUSTOM', 'fg=white;bg=blue', ' § ', false); +}; diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_12.php b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_12.php new file mode 100644 index 0000000..e6a1355 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_12.php @@ -0,0 +1,13 @@ +title('Title ending with \\'); + $output->section('Section ending with \\'); +}; diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_2.php b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_2.php new file mode 100644 index 0000000..6004e3d --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_2.php @@ -0,0 +1,16 @@ +warning('Warning'); + $output->caution('Caution'); + $output->error('Error'); + $output->success('Success'); + $output->note('Note'); + $output->block('Custom block', 'CUSTOM', 'fg=white;bg=green', 'X ', true); +}; diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_3.php b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_3.php new file mode 100644 index 0000000..c7a08f1 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_3.php @@ -0,0 +1,12 @@ +title('First title'); + $output->title('Second title'); +}; diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_4.php b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_4.php new file mode 100644 index 0000000..afea70c --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_4.php @@ -0,0 +1,34 @@ +write('Lorem ipsum dolor sit amet'); + $output->title('First title'); + + $output->writeln('Lorem ipsum dolor sit amet'); + $output->title('Second title'); + + $output->write('Lorem ipsum dolor sit amet'); + $output->write(''); + $output->title('Third title'); + + //Ensure edge case by appending empty strings to history: + $output->write('Lorem ipsum dolor sit amet'); + $output->write(array('', '', '')); + $output->title('Fourth title'); + + //Ensure have manual control over number of blank lines: + $output->writeln('Lorem ipsum dolor sit amet'); + $output->writeln(array('', '')); //Should append an extra blank line + $output->title('Fifth title'); + + $output->writeln('Lorem ipsum dolor sit amet'); + $output->newLine(2); //Should append an extra blank line + $output->title('Fifth title'); +}; diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php new file mode 100644 index 0000000..2cc2ca0 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php @@ -0,0 +1,29 @@ +writeln('Lorem ipsum dolor sit amet'); + $output->listing(array( + 'Lorem ipsum dolor sit amet', + 'consectetur adipiscing elit', + )); + + //Even using write: + $output->write('Lorem ipsum dolor sit amet'); + $output->listing(array( + 'Lorem ipsum dolor sit amet', + 'consectetur adipiscing elit', + )); + + $output->write('Lorem ipsum dolor sit amet'); + $output->text(array( + 'Lorem ipsum dolor sit amet', + 'consectetur adipiscing elit', + )); +}; diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_6.php b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_6.php new file mode 100644 index 0000000..f1d7990 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_6.php @@ -0,0 +1,16 @@ +listing(array( + 'Lorem ipsum dolor sit amet', + 'consectetur adipiscing elit', + )); + $output->success('Lorem ipsum dolor sit amet'); +}; diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_7.php b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_7.php new file mode 100644 index 0000000..cbfea73 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_7.php @@ -0,0 +1,15 @@ +title('Title'); + $output->askHidden('Hidden question'); + $output->choice('Choice question with default', array('choice1', 'choice2'), 'choice1'); + $output->confirm('Confirmation with yes default', true); + $output->text('Duis aute irure dolor in reprehenderit in voluptate velit esse'); +}; diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_8.php b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_8.php new file mode 100644 index 0000000..0244fd2 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_8.php @@ -0,0 +1,26 @@ + 3))), + array('ISBN', 'Title', 'Author'), + ); + + $rows = array( + array( + '978-0521567817', + 'De Monarchia', + new TableCell("Dante Alighieri\nspans multiple rows", array('rowspan' => 2)), + ), + array('978-0804169127', 'Divine Comedy'), + ); + + $output = new SymfonyStyleWithForcedLineLength($input, $output); + $output->table($headers, $rows); +}; diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php new file mode 100644 index 0000000..6420730 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php @@ -0,0 +1,11 @@ +block(array('Custom block', 'Second custom block line'), 'CUSTOM', 'fg=white;bg=green', 'X ', true); +}; diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_0.txt b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_0.txt new file mode 100644 index 0000000..a42e0f7 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_0.txt @@ -0,0 +1,3 @@ + + ! [CAUTION] Lorem ipsum dolor sit amet + diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_1.txt b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_1.txt new file mode 100644 index 0000000..334875f --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_1.txt @@ -0,0 +1,9 @@ + +Title +===== + + [WARNING] Lorem ipsum dolor sit amet + +Title +===== + diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_10.txt b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_10.txt new file mode 100644 index 0000000..385c6a2 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_10.txt @@ -0,0 +1,7 @@ + +X [CUSTOM] Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et +X dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea +X commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat +X nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit +X anim id est laborum + diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_11.txt b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_11.txt new file mode 100644 index 0000000..190d784 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_11.txt @@ -0,0 +1,4 @@ + + § [CUSTOM] Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophatto + § peristeralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygon + diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_12.txt b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_12.txt new file mode 100644 index 0000000..59d00e0 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_12.txt @@ -0,0 +1,7 @@ + +Title ending with \ +=================== + +Section ending with \ +--------------------- + diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_2.txt b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_2.txt new file mode 100644 index 0000000..ca60976 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_2.txt @@ -0,0 +1,13 @@ + + [WARNING] Warning + + ! [CAUTION] Caution + + [ERROR] Error + + [OK] Success + + ! [NOTE] Note + +X [CUSTOM] Custom block + diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_3.txt b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_3.txt new file mode 100644 index 0000000..f4b6d58 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_3.txt @@ -0,0 +1,7 @@ + +First title +=========== + +Second title +============ + diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_4.txt b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_4.txt new file mode 100644 index 0000000..2646d85 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_4.txt @@ -0,0 +1,32 @@ +Lorem ipsum dolor sit amet + +First title +=========== + +Lorem ipsum dolor sit amet + +Second title +============ + +Lorem ipsum dolor sit amet + +Third title +=========== + +Lorem ipsum dolor sit amet + +Fourth title +============ + +Lorem ipsum dolor sit amet + + +Fifth title +=========== + +Lorem ipsum dolor sit amet + + +Fifth title +=========== + diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_5.txt b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_5.txt new file mode 100644 index 0000000..910240f --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_5.txt @@ -0,0 +1,11 @@ +Lorem ipsum dolor sit amet + * Lorem ipsum dolor sit amet + * consectetur adipiscing elit + +Lorem ipsum dolor sit amet + * Lorem ipsum dolor sit amet + * consectetur adipiscing elit + +Lorem ipsum dolor sit amet + // Lorem ipsum dolor sit amet + // consectetur adipiscing elit diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_6.txt b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_6.txt new file mode 100644 index 0000000..5f2d33c --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_6.txt @@ -0,0 +1,6 @@ + + * Lorem ipsum dolor sit amet + * consectetur adipiscing elit + + [OK] Lorem ipsum dolor sit amet + diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_7.txt b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_7.txt new file mode 100644 index 0000000..ab18e5d --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_7.txt @@ -0,0 +1,5 @@ + +Title +===== + + // Duis aute irure dolor in reprehenderit in voluptate velit esse diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_8.txt b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_8.txt new file mode 100644 index 0000000..005b846 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_8.txt @@ -0,0 +1,9 @@ + ---------------- --------------- --------------------- + Main table title + ---------------- --------------- --------------------- + ISBN Title Author + ---------------- --------------- --------------------- + 978-0521567817 De Monarchia Dante Alighieri + 978-0804169127 Divine Comedy spans multiple rows + ---------------- --------------- --------------------- + diff --git a/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_9.txt b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_9.txt new file mode 100644 index 0000000..069c0d5 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_9.txt @@ -0,0 +1,5 @@ + +X [CUSTOM] Custom block +X +X Second custom block line + diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/TestCommand.php b/application/vendor/symfony/console/Tests/Fixtures/TestCommand.php similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/TestCommand.php rename to application/vendor/symfony/console/Tests/Fixtures/TestCommand.php diff --git a/application/vendor/symfony/console/Tests/Fixtures/TestTiti.php b/application/vendor/symfony/console/Tests/Fixtures/TestTiti.php new file mode 100644 index 0000000..72e29d2 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/TestTiti.php @@ -0,0 +1,21 @@ +setName('test-titi') + ->setDescription('The test:titi command') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $output->write('test-titi'); + } +} diff --git a/application/vendor/symfony/console/Tests/Fixtures/TestToto.php b/application/vendor/symfony/console/Tests/Fixtures/TestToto.php new file mode 100644 index 0000000..f14805d --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/TestToto.php @@ -0,0 +1,22 @@ +setName('test-toto') + ->setDescription('The test-toto command') + ->setAliases(array('test')) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $output->write('test-toto'); + } +} diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_1.json b/application/vendor/symfony/console/Tests/Fixtures/application_1.json new file mode 100644 index 0000000..ea695a7 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_1.json @@ -0,0 +1,172 @@ +{ + "commands": [ + { + "name": "help", + "usage": [ + "help [--xml] [--format FORMAT] [--raw] [--] []" + ], + "description": "Displays help for a command", + "help": "The help<\/info> command displays help for a given command:\n\n php app\/console help list<\/info>\n\nYou can also output the help in other formats by using the --format<\/comment> option:\n\n php app\/console help --format=xml list<\/info>\n\nTo display the list of available commands, please use the list<\/info> command.", + "definition": { + "arguments": { + "command_name": { + "name": "command_name", + "is_required": false, + "is_array": false, + "description": "The command name", + "default": "help" + } + }, + "options": { + "xml": { + "name": "--xml", + "shortcut": "", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "To output help as XML", + "default": false + }, + "format": { + "name": "--format", + "shortcut": "", + "accept_value": true, + "is_value_required": true, + "is_multiple": false, + "description": "The output format (txt, xml, json, or md)", + "default": "txt" + }, + "raw": { + "name": "--raw", + "shortcut": "", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "To output raw command help", + "default": false + }, + "help": { + "name": "--help", + "shortcut": "-h", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "Display this help message", + "default": false + }, + "quiet": { + "name": "--quiet", + "shortcut": "-q", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "Do not output any message", + "default": false + }, + "verbose": { + "name": "--verbose", + "shortcut": "-v|-vv|-vvv", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug", + "default": false + }, + "version": { + "name": "--version", + "shortcut": "-V", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "Display this application version", + "default": false + }, + "ansi": { + "name": "--ansi", + "shortcut": "", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "Force ANSI output", + "default": false + }, + "no-ansi": { + "name": "--no-ansi", + "shortcut": "", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "Disable ANSI output", + "default": false + }, + "no-interaction": { + "name": "--no-interaction", + "shortcut": "-n", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "Do not ask any interactive question", + "default": false + } + } + } + }, + { + "name": "list", + "usage": [ + "list [--xml] [--raw] [--format FORMAT] [--] []" + ], + "description": "Lists commands", + "help": "The list<\/info> command lists all commands:\n\n php app\/console list<\/info>\n\nYou can also display the commands for a specific namespace:\n\n php app\/console list test<\/info>\n\nYou can also output the information in other formats by using the --format<\/comment> option:\n\n php app\/console list --format=xml<\/info>\n\nIt's also possible to get raw list of commands (useful for embedding command runner):\n\n php app\/console list --raw<\/info>", + "definition": { + "arguments": { + "namespace": { + "name": "namespace", + "is_required": false, + "is_array": false, + "description": "The namespace name", + "default": null + } + }, + "options": { + "xml": { + "name": "--xml", + "shortcut": "", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "To output list as XML", + "default": false + }, + "raw": { + "name": "--raw", + "shortcut": "", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "To output raw command list", + "default": false + }, + "format": { + "name": "--format", + "shortcut": "", + "accept_value": true, + "is_value_required": true, + "is_multiple": false, + "description": "The output format (txt, xml, json, or md)", + "default": "txt" + } + } + } + } + ], + "namespaces": [ + { + "id": "_global", + "commands": [ + "help", + "list" + ] + } + ] +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.md b/application/vendor/symfony/console/Tests/Fixtures/application_1.md similarity index 92% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.md rename to application/vendor/symfony/console/Tests/Fixtures/application_1.md index e380416..82a605d 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.md +++ b/application/vendor/symfony/console/Tests/Fixtures/application_1.md @@ -8,8 +8,9 @@ help ---- * Description: Displays help for a command -* Usage: `help [--xml] [--format="..."] [--raw] [command_name]` -* Aliases: +* Usage: + + * `help [--xml] [--format FORMAT] [--raw] [--] []` The help command displays help for a given command: @@ -50,7 +51,7 @@ To display the list of available commands, please use the list comm * Accept value: yes * Is value required: yes * Is multiple: no -* Description: To output help in other formats +* Description: The output format (txt, xml, json, or md) * Default: `'txt'` **raw:** @@ -137,8 +138,9 @@ list ---- * Description: Lists commands -* Usage: `list [--xml] [--raw] [--format="..."] [namespace]` -* Aliases: +* Usage: + + * `list [--xml] [--raw] [--format FORMAT] [--] []` The list command lists all commands: @@ -195,5 +197,5 @@ It's also possible to get raw list of commands (useful for embedding command run * Accept value: yes * Is value required: yes * Is multiple: no -* Description: To output list in other formats +* Description: The output format (txt, xml, json, or md) * Default: `'txt'` diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_1.txt b/application/vendor/symfony/console/Tests/Fixtures/application_1.txt new file mode 100644 index 0000000..c4cf8f2 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_1.txt @@ -0,0 +1,17 @@ +Console Tool + +Usage: + command [options] [arguments] + +Options: + -h, --help Display this help message + -q, --quiet Do not output any message + -V, --version Display this application version + --ansi Force ANSI output + --no-ansi Disable ANSI output + -n, --no-interaction Do not ask any interactive question + -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug + +Available commands: + help Displays help for a command + list Lists commands diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.xml b/application/vendor/symfony/console/Tests/Fixtures/application_1.xml similarity index 91% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.xml rename to application/vendor/symfony/console/Tests/Fixtures/application_1.xml index 1763108..35d1db4 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_1.xml +++ b/application/vendor/symfony/console/Tests/Fixtures/application_1.xml @@ -2,7 +2,9 @@ - help [--xml] [--format="..."] [--raw] [command_name] + + help [--xml] [--format FORMAT] [--raw] [--] [<command_name>] + Displays help for a command The <info>help</info> command displays help for a given command: @@ -13,7 +15,6 @@ <info>php app/console help --format=xml list</info> To display the list of available commands, please use the <info>list</info> command. - The command name @@ -27,7 +28,7 @@ To output help as XML - list [--xml] [--raw] [--format="..."] [namespace] + + list [--xml] [--raw] [--format FORMAT] [--] [<namespace>] + Lists commands The <info>list</info> command lists all commands: @@ -76,7 +79,6 @@ It's also possible to get raw list of commands (useful for embedding command runner): <info>php app/console list --raw</info> - The namespace name @@ -91,7 +93,7 @@ To output raw command list - list [--xml] [--raw] [--format="..."] [namespace] + + list [--xml] [--raw] [--format FORMAT] [--] [<namespace>] + Lists commands The <info>list</info> command lists all commands: @@ -76,7 +79,6 @@ It's also possible to get raw list of commands (useful for embedding command runner): <info>php app/console list --raw</info> - The namespace name @@ -91,7 +93,7 @@ To output raw command list - descriptor:command1 + + descriptor:command1 + alias1 + alias2 + command 1 description command 1 help - - alias1 - alias2 - - descriptor:command2 [-o|--option_name] argument_name + + descriptor:command2 [-o|--option_name] [--] <argument_name> + descriptor:command2 -o|--option_name <argument_name> + descriptor:command2 <argument_name> + command 2 description command 2 help - diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_astext1.txt b/application/vendor/symfony/console/Tests/Fixtures/application_astext1.txt new file mode 100644 index 0000000..19dacb2 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_astext1.txt @@ -0,0 +1,20 @@ +Console Tool + +Usage: + command [options] [arguments] + +Options: + -h, --help Display this help message + -q, --quiet Do not output any message + -V, --version Display this application version + --ansi Force ANSI output + --no-ansi Disable ANSI output + -n, --no-interaction Do not ask any interactive question + -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug + +Available commands: + afoobar The foo:bar command + help Displays help for a command + list Lists commands + foo + foo:bar The foo:bar command diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_astext2.txt b/application/vendor/symfony/console/Tests/Fixtures/application_astext2.txt new file mode 100644 index 0000000..c99ccdd --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_astext2.txt @@ -0,0 +1,16 @@ +Console Tool + +Usage: + command [options] [arguments] + +Options: + -h, --help Display this help message + -q, --quiet Do not output any message + -V, --version Display this application version + --ansi Force ANSI output + --no-ansi Disable ANSI output + -n, --no-interaction Do not ask any interactive question + -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug + +Available commands for the "foo" namespace: + foo:bar The foo:bar command diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_asxml1.txt b/application/vendor/symfony/console/Tests/Fixtures/application_asxml1.txt new file mode 100644 index 0000000..8277d9e --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_asxml1.txt @@ -0,0 +1,146 @@ + + + + + + help [--xml] [--format FORMAT] [--raw] [--] [<command_name>] + + Displays help for a command + The <info>help</info> command displays help for a given command: + + <info>php app/console help list</info> + + You can also output the help in other formats by using the <comment>--format</comment> option: + + <info>php app/console help --format=xml list</info> + + To display the list of available commands, please use the <info>list</info> command. + + + The command name + + help + + + + + + + + + + + + + + + + + + + list [--xml] [--raw] [--format FORMAT] [--] [<namespace>] + + Lists commands + The <info>list</info> command lists all commands: + + <info>php app/console list</info> + + You can also display the commands for a specific namespace: + + <info>php app/console list test</info> + + You can also output the information in other formats by using the <comment>--format</comment> option: + + <info>php app/console list --format=xml</info> + + It's also possible to get raw list of commands (useful for embedding command runner): + + <info>php app/console list --raw</info> + + + The namespace name + + + + + + + + + + + + foo:bar + afoobar + + The foo:bar command + The foo:bar command + + + + + + + + + + + + + + + afoobar + help + list + + + foo:bar + + + diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_asxml2.txt b/application/vendor/symfony/console/Tests/Fixtures/application_asxml2.txt new file mode 100644 index 0000000..93d6d4e --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_asxml2.txt @@ -0,0 +1,37 @@ + + + + + + foo:bar + afoobar + + The foo:bar command + The foo:bar command + + + + + + + + + + + + + diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_gethelp.txt b/application/vendor/symfony/console/Tests/Fixtures/application_gethelp.txt similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_gethelp.txt rename to application/vendor/symfony/console/Tests/Fixtures/application_gethelp.txt diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_mbstring.md b/application/vendor/symfony/console/Tests/Fixtures/application_mbstring.md new file mode 100644 index 0000000..ef81f86 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_mbstring.md @@ -0,0 +1,309 @@ +MbString åpplicätion +==================== + +* help +* list + +**descriptor:** + +* descriptor:åèä + +help +---- + +* Description: Displays help for a command +* Usage: + + * `help [--xml] [--format FORMAT] [--raw] [--] []` + +The help command displays help for a given command: + + php app/console help list + +You can also output the help in other formats by using the --format option: + + php app/console help --format=xml list + +To display the list of available commands, please use the list command. + +### Arguments: + +**command_name:** + +* Name: command_name +* Is required: no +* Is array: no +* Description: The command name +* Default: `'help'` + +### Options: + +**xml:** + +* Name: `--xml` +* Shortcut: +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: To output help as XML +* Default: `false` + +**format:** + +* Name: `--format` +* Shortcut: +* Accept value: yes +* Is value required: yes +* Is multiple: no +* Description: The output format (txt, xml, json, or md) +* Default: `'txt'` + +**raw:** + +* Name: `--raw` +* Shortcut: +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: To output raw command help +* Default: `false` + +**help:** + +* Name: `--help` +* Shortcut: `-h` +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: Display this help message +* Default: `false` + +**quiet:** + +* Name: `--quiet` +* Shortcut: `-q` +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: Do not output any message +* Default: `false` + +**verbose:** + +* Name: `--verbose` +* Shortcut: `-v|-vv|-vvv` +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug +* Default: `false` + +**version:** + +* Name: `--version` +* Shortcut: `-V` +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: Display this application version +* Default: `false` + +**ansi:** + +* Name: `--ansi` +* Shortcut: +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: Force ANSI output +* Default: `false` + +**no-ansi:** + +* Name: `--no-ansi` +* Shortcut: +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: Disable ANSI output +* Default: `false` + +**no-interaction:** + +* Name: `--no-interaction` +* Shortcut: `-n` +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: Do not ask any interactive question +* Default: `false` + +list +---- + +* Description: Lists commands +* Usage: + + * `list [--xml] [--raw] [--format FORMAT] [--] []` + +The list command lists all commands: + + php app/console list + +You can also display the commands for a specific namespace: + + php app/console list test + +You can also output the information in other formats by using the --format option: + + php app/console list --format=xml + +It's also possible to get raw list of commands (useful for embedding command runner): + + php app/console list --raw + +### Arguments: + +**namespace:** + +* Name: namespace +* Is required: no +* Is array: no +* Description: The namespace name +* Default: `NULL` + +### Options: + +**xml:** + +* Name: `--xml` +* Shortcut: +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: To output list as XML +* Default: `false` + +**raw:** + +* Name: `--raw` +* Shortcut: +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: To output raw command list +* Default: `false` + +**format:** + +* Name: `--format` +* Shortcut: +* Accept value: yes +* Is value required: yes +* Is multiple: no +* Description: The output format (txt, xml, json, or md) +* Default: `'txt'` + +descriptor:åèä +-------------- + +* Description: command åèä description +* Usage: + + * `descriptor:åèä [-o|--option_åèä] [--] ` + * `descriptor:åèä -o|--option_name ` + * `descriptor:åèä ` + +command åèä help + +### Arguments: + +**argument_åèä:** + +* Name: argument_åèä +* Is required: yes +* Is array: no +* Description: +* Default: `NULL` + +### Options: + +**option_åèä:** + +* Name: `--option_åèä` +* Shortcut: `-o` +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: +* Default: `false` + +**help:** + +* Name: `--help` +* Shortcut: `-h` +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: Display this help message +* Default: `false` + +**quiet:** + +* Name: `--quiet` +* Shortcut: `-q` +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: Do not output any message +* Default: `false` + +**verbose:** + +* Name: `--verbose` +* Shortcut: `-v|-vv|-vvv` +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug +* Default: `false` + +**version:** + +* Name: `--version` +* Shortcut: `-V` +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: Display this application version +* Default: `false` + +**ansi:** + +* Name: `--ansi` +* Shortcut: +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: Force ANSI output +* Default: `false` + +**no-ansi:** + +* Name: `--no-ansi` +* Shortcut: +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: Disable ANSI output +* Default: `false` + +**no-interaction:** + +* Name: `--no-interaction` +* Shortcut: `-n` +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: Do not ask any interactive question +* Default: `false` diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_mbstring.txt b/application/vendor/symfony/console/Tests/Fixtures/application_mbstring.txt new file mode 100644 index 0000000..9d21f82 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_mbstring.txt @@ -0,0 +1,19 @@ +MbString åpplicätion + +Usage: + command [options] [arguments] + +Options: + -h, --help Display this help message + -q, --quiet Do not output any message + -V, --version Display this application version + --ansi Force ANSI output + --no-ansi Disable ANSI output + -n, --no-interaction Do not ask any interactive question + -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug + +Available commands: + help Displays help for a command + list Lists commands + descriptor + descriptor:åèä command åèä description diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception1.txt b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception1.txt similarity index 98% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception1.txt rename to application/vendor/symfony/console/Tests/Fixtures/application_renderexception1.txt index 4629345..c56f4b6 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception1.txt +++ b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception1.txt @@ -1,8 +1,6 @@ - [InvalidArgumentException] Command "foo" is not defined. - diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_renderexception2.txt b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception2.txt new file mode 100644 index 0000000..58cd420 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception2.txt @@ -0,0 +1,8 @@ + + + [InvalidArgumentException] + The "--foo" option does not exist. + + +list [--xml] [--raw] [--format FORMAT] [--] [] + diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_renderexception3.txt b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception3.txt new file mode 100644 index 0000000..f41925f --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception3.txt @@ -0,0 +1,18 @@ + + + [Exception] + Third exception comment + + + + [Exception] + Second exception comment + + + + [Exception] + First exception

    this is html

    + + +foo3:bar + diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_renderexception3decorated.txt b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception3decorated.txt new file mode 100644 index 0000000..5adccdd --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception3decorated.txt @@ -0,0 +1,18 @@ + +  + [Exception]  + Third exception comment  +  + +  + [Exception]  + Second exception comment  +  + +  + [Exception]  + First exception

    this is html

     +  + +foo3:bar + diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception4.txt b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception4.txt similarity index 98% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception4.txt rename to application/vendor/symfony/console/Tests/Fixtures/application_renderexception4.txt index 19f893b..9d881e7 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception4.txt +++ b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception4.txt @@ -1,9 +1,7 @@ - [InvalidArgumentException] Command "foo" is not define d. - diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth1.txt b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception_doublewidth1.txt similarity index 97% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth1.txt rename to application/vendor/symfony/console/Tests/Fixtures/application_renderexception_doublewidth1.txt index 6a98660..1ba5f8f 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth1.txt +++ b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception_doublewidth1.txt @@ -1,11 +1,8 @@ - [Exception] エラーメッセージ - foo - diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth1decorated.txt b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception_doublewidth1decorated.txt similarity index 98% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth1decorated.txt rename to application/vendor/symfony/console/Tests/Fixtures/application_renderexception_doublewidth1decorated.txt index 8c8801b..2064425 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth1decorated.txt +++ b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception_doublewidth1decorated.txt @@ -1,11 +1,8 @@ -    [Exception]   エラーメッセージ    - foo - diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth2.txt b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception_doublewidth2.txt similarity index 98% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth2.txt rename to application/vendor/symfony/console/Tests/Fixtures/application_renderexception_doublewidth2.txt index 545cd7b..e41fcfc 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_renderexception_doublewidth2.txt +++ b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception_doublewidth2.txt @@ -1,12 +1,9 @@ - [Exception] コマンドの実行中にエラーが 発生しました。 - foo - diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_renderexception_escapeslines.txt b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception_escapeslines.txt new file mode 100644 index 0000000..cf79b37 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception_escapeslines.txt @@ -0,0 +1,9 @@ + + + [Exception] + dont break here < + info>!
    + + +foo + diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_renderexception_linebreaks.txt b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception_linebreaks.txt new file mode 100644 index 0000000..e9a9518 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_renderexception_linebreaks.txt @@ -0,0 +1,11 @@ + + + [InvalidArgumentException] + line 1 with extra spaces + line 2 + + line 4 + + +foo + diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_run1.txt b/application/vendor/symfony/console/Tests/Fixtures/application_run1.txt new file mode 100644 index 0000000..0dc2730 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_run1.txt @@ -0,0 +1,17 @@ +Console Tool + +Usage: + command [options] [arguments] + +Options: + -h, --help Display this help message + -q, --quiet Do not output any message + -V, --version Display this application version + --ansi Force ANSI output + --no-ansi Disable ANSI output + -n, --no-interaction Do not ask any interactive question + -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug + +Available commands: + help Displays help for a command + list Lists commands diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_run2.txt b/application/vendor/symfony/console/Tests/Fixtures/application_run2.txt new file mode 100644 index 0000000..06ad09a --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_run2.txt @@ -0,0 +1,29 @@ +Usage: + help [options] [--] [] + +Arguments: + command The command to execute [default: "list"] + command_name The command name [default: "help"] + +Options: + --xml To output help as XML + --format=FORMAT The output format (txt, xml, json, or md) [default: "txt"] + --raw To output raw command help + -h, --help Display this help message + -q, --quiet Do not output any message + -V, --version Display this application version + --ansi Force ANSI output + --no-ansi Disable ANSI output + -n, --no-interaction Do not ask any interactive question + -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug + +Help: + The help command displays help for a given command: + + php app/console help list + + You can also output the help in other formats by using the --format option: + + php app/console help --format=xml list + + To display the list of available commands, please use the list command. diff --git a/application/vendor/symfony/console/Tests/Fixtures/application_run3.txt b/application/vendor/symfony/console/Tests/Fixtures/application_run3.txt new file mode 100644 index 0000000..2e8d92e --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/application_run3.txt @@ -0,0 +1,27 @@ +Usage: + list [options] [--] [] + +Arguments: + namespace The namespace name + +Options: + --xml To output list as XML + --raw To output raw command list + --format=FORMAT The output format (txt, xml, json, or md) [default: "txt"] + +Help: + The list command lists all commands: + + php app/console list + + You can also display the commands for a specific namespace: + + php app/console list test + + You can also output the information in other formats by using the --format option: + + php app/console list --format=xml + + It's also possible to get raw list of commands (useful for embedding command runner): + + php app/console list --raw diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_run4.txt b/application/vendor/symfony/console/Tests/Fixtures/application_run4.txt similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/application_run4.txt rename to application/vendor/symfony/console/Tests/Fixtures/application_run4.txt diff --git a/application/vendor/symfony/console/Tests/Fixtures/command_1.json b/application/vendor/symfony/console/Tests/Fixtures/command_1.json new file mode 100644 index 0000000..4cd37ee --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/command_1.json @@ -0,0 +1,14 @@ +{ + "name": "descriptor:command1", + "usage": [ + "descriptor:command1", + "alias1", + "alias2" + ], + "description": "command 1 description", + "help": "command 1 help", + "definition": { + "arguments": [], + "options": [] + } +} diff --git a/application/vendor/symfony/console/Tests/Fixtures/command_1.md b/application/vendor/symfony/console/Tests/Fixtures/command_1.md new file mode 100644 index 0000000..34ed3ea --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/command_1.md @@ -0,0 +1,11 @@ +descriptor:command1 +------------------- + +* Description: command 1 description +* Usage: + + * `descriptor:command1` + * `alias1` + * `alias2` + +command 1 help diff --git a/application/vendor/symfony/console/Tests/Fixtures/command_1.txt b/application/vendor/symfony/console/Tests/Fixtures/command_1.txt new file mode 100644 index 0000000..e5e93ee --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/command_1.txt @@ -0,0 +1,7 @@ +Usage: + descriptor:command1 + alias1 + alias2 + +Help: + command 1 help diff --git a/application/vendor/symfony/console/Tests/Fixtures/command_1.xml b/application/vendor/symfony/console/Tests/Fixtures/command_1.xml new file mode 100644 index 0000000..838b9bd --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/command_1.xml @@ -0,0 +1,12 @@ + + + + descriptor:command1 + alias1 + alias2 + + command 1 description + command 1 help + + + diff --git a/application/vendor/symfony/console/Tests/Fixtures/command_2.json b/application/vendor/symfony/console/Tests/Fixtures/command_2.json new file mode 100644 index 0000000..74c1f12 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/command_2.json @@ -0,0 +1,32 @@ +{ + "name": "descriptor:command2", + "usage": [ + "descriptor:command2 [-o|--option_name] [--] ", + "descriptor:command2 -o|--option_name ", + "descriptor:command2 " + ], + "description": "command 2 description", + "help": "command 2 help", + "definition": { + "arguments": { + "argument_name": { + "name": "argument_name", + "is_required": true, + "is_array": false, + "description": "", + "default": null + } + }, + "options": { + "option_name": { + "name": "--option_name", + "shortcut": "-o", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "", + "default": false + } + } + } +} diff --git a/application/vendor/symfony/console/Tests/Fixtures/command_2.md b/application/vendor/symfony/console/Tests/Fixtures/command_2.md new file mode 100644 index 0000000..6f538b6 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/command_2.md @@ -0,0 +1,33 @@ +descriptor:command2 +------------------- + +* Description: command 2 description +* Usage: + + * `descriptor:command2 [-o|--option_name] [--] ` + * `descriptor:command2 -o|--option_name ` + * `descriptor:command2 ` + +command 2 help + +### Arguments: + +**argument_name:** + +* Name: argument_name +* Is required: yes +* Is array: no +* Description: +* Default: `NULL` + +### Options: + +**option_name:** + +* Name: `--option_name` +* Shortcut: `-o` +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: +* Default: `false` diff --git a/application/vendor/symfony/console/Tests/Fixtures/command_2.txt b/application/vendor/symfony/console/Tests/Fixtures/command_2.txt new file mode 100644 index 0000000..2864c7b --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/command_2.txt @@ -0,0 +1,13 @@ +Usage: + descriptor:command2 [options] [--] \ + descriptor:command2 -o|--option_name \ + descriptor:command2 \ + +Arguments: + argument_name + +Options: + -o, --option_name + +Help: + command 2 help diff --git a/application/vendor/symfony/console/Tests/Fixtures/command_2.xml b/application/vendor/symfony/console/Tests/Fixtures/command_2.xml new file mode 100644 index 0000000..67364ca --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/command_2.xml @@ -0,0 +1,21 @@ + + + + descriptor:command2 [-o|--option_name] [--] <argument_name> + descriptor:command2 -o|--option_name <argument_name> + descriptor:command2 <argument_name> + + command 2 description + command 2 help + + + + + + + + + + diff --git a/application/vendor/symfony/console/Tests/Fixtures/command_astext.txt b/application/vendor/symfony/console/Tests/Fixtures/command_astext.txt new file mode 100644 index 0000000..4d9055d --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/command_astext.txt @@ -0,0 +1,18 @@ +Usage: + namespace:name + name + +Arguments: + command The command to execute + +Options: + -h, --help Display this help message + -q, --quiet Do not output any message + -V, --version Display this application version + --ansi Force ANSI output + --no-ansi Disable ANSI output + -n, --no-interaction Do not ask any interactive question + -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug + +Help: + help diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_asxml.txt b/application/vendor/symfony/console/Tests/Fixtures/command_asxml.txt similarity index 95% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_asxml.txt rename to application/vendor/symfony/console/Tests/Fixtures/command_asxml.txt index 57542fa..5e77623 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/command_asxml.txt +++ b/application/vendor/symfony/console/Tests/Fixtures/command_asxml.txt @@ -1,11 +1,11 @@ - namespace:name + + namespace:name + name + description help - - name - The command to execute diff --git a/application/vendor/symfony/console/Tests/Fixtures/command_mbstring.md b/application/vendor/symfony/console/Tests/Fixtures/command_mbstring.md new file mode 100644 index 0000000..2adac53 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/command_mbstring.md @@ -0,0 +1,33 @@ +descriptor:åèä +-------------- + +* Description: command åèä description +* Usage: + + * `descriptor:åèä [-o|--option_åèä] [--] ` + * `descriptor:åèä -o|--option_name ` + * `descriptor:åèä ` + +command åèä help + +### Arguments: + +**argument_åèä:** + +* Name: argument_åèä +* Is required: yes +* Is array: no +* Description: +* Default: `NULL` + +### Options: + +**option_åèä:** + +* Name: `--option_åèä` +* Shortcut: `-o` +* Accept value: no +* Is value required: no +* Is multiple: no +* Description: +* Default: `false` diff --git a/application/vendor/symfony/console/Tests/Fixtures/command_mbstring.txt b/application/vendor/symfony/console/Tests/Fixtures/command_mbstring.txt new file mode 100644 index 0000000..cde457d --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/command_mbstring.txt @@ -0,0 +1,13 @@ +Usage: + descriptor:åèä [options] [--] \ + descriptor:åèä -o|--option_name \ + descriptor:åèä \ + +Arguments: + argument_åèä + +Options: + -o, --option_åèä + +Help: + command åèä help diff --git a/application/vendor/symfony/console/Tests/Fixtures/definition_astext.txt b/application/vendor/symfony/console/Tests/Fixtures/definition_astext.txt new file mode 100644 index 0000000..0431c07 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/definition_astext.txt @@ -0,0 +1,11 @@ +Arguments: + foo The foo argument + baz The baz argument [default: true] + bar The bar argument [default: ["http://foo.com/"]] + +Options: + -f, --foo=FOO The foo option + --baz[=BAZ] The baz option [default: false] + -b, --bar[=BAR] The bar option [default: "bar"] + --qux[=QUX] The qux option [default: ["http://foo.com/","bar"]] (multiple values allowed) + --qux2[=QUX2] The qux2 option [default: {"foo":"bar"}] (multiple values allowed) \ No newline at end of file diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/definition_asxml.txt b/application/vendor/symfony/console/Tests/Fixtures/definition_asxml.txt similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/definition_asxml.txt rename to application/vendor/symfony/console/Tests/Fixtures/definition_asxml.txt diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_1.json b/application/vendor/symfony/console/Tests/Fixtures/input_argument_1.json new file mode 100644 index 0000000..0ab9329 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_1.json @@ -0,0 +1,7 @@ +{ + "name": "argument_name", + "is_required": true, + "is_array": false, + "description": "", + "default": null +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_1.md b/application/vendor/symfony/console/Tests/Fixtures/input_argument_1.md similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_1.md rename to application/vendor/symfony/console/Tests/Fixtures/input_argument_1.md diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_1.txt b/application/vendor/symfony/console/Tests/Fixtures/input_argument_1.txt new file mode 100644 index 0000000..5503518 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_1.txt @@ -0,0 +1 @@ + argument_name diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_1.xml b/application/vendor/symfony/console/Tests/Fixtures/input_argument_1.xml similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_1.xml rename to application/vendor/symfony/console/Tests/Fixtures/input_argument_1.xml diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_2.json b/application/vendor/symfony/console/Tests/Fixtures/input_argument_2.json new file mode 100644 index 0000000..7450016 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_2.json @@ -0,0 +1,7 @@ +{ + "name": "argument_name", + "is_required": false, + "is_array": true, + "description": "argument description", + "default": [] +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_2.md b/application/vendor/symfony/console/Tests/Fixtures/input_argument_2.md similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_2.md rename to application/vendor/symfony/console/Tests/Fixtures/input_argument_2.md diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_2.txt b/application/vendor/symfony/console/Tests/Fixtures/input_argument_2.txt new file mode 100644 index 0000000..e713660 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_2.txt @@ -0,0 +1 @@ + argument_name argument description diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_2.xml b/application/vendor/symfony/console/Tests/Fixtures/input_argument_2.xml similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_2.xml rename to application/vendor/symfony/console/Tests/Fixtures/input_argument_2.xml diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_3.json b/application/vendor/symfony/console/Tests/Fixtures/input_argument_3.json new file mode 100644 index 0000000..9a83c5a --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_3.json @@ -0,0 +1,7 @@ +{ + "name": "argument_name", + "is_required": false, + "is_array": false, + "description": "argument description", + "default": "default_value" +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_3.md b/application/vendor/symfony/console/Tests/Fixtures/input_argument_3.md similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_3.md rename to application/vendor/symfony/console/Tests/Fixtures/input_argument_3.md diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_3.txt b/application/vendor/symfony/console/Tests/Fixtures/input_argument_3.txt new file mode 100644 index 0000000..6b76639 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_3.txt @@ -0,0 +1 @@ + argument_name argument description [default: "default_value"] diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_3.xml b/application/vendor/symfony/console/Tests/Fixtures/input_argument_3.xml similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_argument_3.xml rename to application/vendor/symfony/console/Tests/Fixtures/input_argument_3.xml diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_4.json b/application/vendor/symfony/console/Tests/Fixtures/input_argument_4.json new file mode 100644 index 0000000..cbcb19b --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_4.json @@ -0,0 +1,7 @@ +{ + "name": "argument_name", + "is_required": true, + "is_array": false, + "description": "multiline argument description", + "default": null +} diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_4.md b/application/vendor/symfony/console/Tests/Fixtures/input_argument_4.md new file mode 100644 index 0000000..f026ab3 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_4.md @@ -0,0 +1,8 @@ +**argument_name:** + +* Name: argument_name +* Is required: yes +* Is array: no +* Description: multiline + argument description +* Default: `NULL` diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_4.txt b/application/vendor/symfony/console/Tests/Fixtures/input_argument_4.txt new file mode 100644 index 0000000..fc7d669 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_4.txt @@ -0,0 +1,2 @@ + argument_name multiline + argument description diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_4.xml b/application/vendor/symfony/console/Tests/Fixtures/input_argument_4.xml new file mode 100644 index 0000000..5ca135e --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_4.xml @@ -0,0 +1,6 @@ + + + multiline +argument description + + diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.json b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.json new file mode 100644 index 0000000..b61ecf7 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.json @@ -0,0 +1,7 @@ +{ + "name": "argument_name", + "is_required": false, + "is_array": false, + "description": "argument description", + "default": "INF" +} diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.md b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.md new file mode 100644 index 0000000..293d816 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.md @@ -0,0 +1,7 @@ +**argument_name:** + +* Name: argument_name +* Is required: no +* Is array: no +* Description: argument description +* Default: `INF` diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.txt b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.txt new file mode 100644 index 0000000..c32d768 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.txt @@ -0,0 +1 @@ + argument_name argument description [default: INF] diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.xml b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.xml new file mode 100644 index 0000000..d457260 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.xml @@ -0,0 +1,7 @@ + + + argument description + + INF + + diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_style.json b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_style.json new file mode 100644 index 0000000..9334235 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_style.json @@ -0,0 +1,7 @@ +{ + "name": "argument_name", + "is_required": false, + "is_array": false, + "description": "argument description", + "default": "style" +} diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_style.md b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_style.md new file mode 100644 index 0000000..45adf2f --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_style.md @@ -0,0 +1,7 @@ +**argument_name:** + +* Name: argument_name +* Is required: no +* Is array: no +* Description: argument description +* Default: `'style'` diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_style.txt b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_style.txt new file mode 100644 index 0000000..35384a6 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_style.txt @@ -0,0 +1 @@ + argument_name argument description [default: "\style\"] diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_style.xml b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_style.xml new file mode 100644 index 0000000..73332c7 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_argument_with_style.xml @@ -0,0 +1,7 @@ + + + argument description + + <comment>style</> + + diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_definition_1.json b/application/vendor/symfony/console/Tests/Fixtures/input_definition_1.json new file mode 100644 index 0000000..44aa2c2 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_definition_1.json @@ -0,0 +1,4 @@ +{ + "arguments": [], + "options": [] +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_1.md b/application/vendor/symfony/console/Tests/Fixtures/input_definition_1.md similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_1.md rename to application/vendor/symfony/console/Tests/Fixtures/input_definition_1.md diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_1.txt b/application/vendor/symfony/console/Tests/Fixtures/input_definition_1.txt similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_1.txt rename to application/vendor/symfony/console/Tests/Fixtures/input_definition_1.txt diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_1.xml b/application/vendor/symfony/console/Tests/Fixtures/input_definition_1.xml similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_1.xml rename to application/vendor/symfony/console/Tests/Fixtures/input_definition_1.xml diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_definition_2.json b/application/vendor/symfony/console/Tests/Fixtures/input_definition_2.json new file mode 100644 index 0000000..7cfd57e --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_definition_2.json @@ -0,0 +1,12 @@ +{ + "arguments": { + "argument_name": { + "name": "argument_name", + "is_required": true, + "is_array": false, + "description": "", + "default": null + } + }, + "options": [] +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_2.md b/application/vendor/symfony/console/Tests/Fixtures/input_definition_2.md similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_2.md rename to application/vendor/symfony/console/Tests/Fixtures/input_definition_2.md diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_definition_2.txt b/application/vendor/symfony/console/Tests/Fixtures/input_definition_2.txt new file mode 100644 index 0000000..73b0f30 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_definition_2.txt @@ -0,0 +1,2 @@ +Arguments: + argument_name diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_2.xml b/application/vendor/symfony/console/Tests/Fixtures/input_definition_2.xml similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_2.xml rename to application/vendor/symfony/console/Tests/Fixtures/input_definition_2.xml diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_definition_3.json b/application/vendor/symfony/console/Tests/Fixtures/input_definition_3.json new file mode 100644 index 0000000..3b3cf73 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_definition_3.json @@ -0,0 +1,14 @@ +{ + "arguments": [], + "options": { + "option_name": { + "name": "--option_name", + "shortcut": "-o", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "", + "default": false + } + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_3.md b/application/vendor/symfony/console/Tests/Fixtures/input_definition_3.md similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_3.md rename to application/vendor/symfony/console/Tests/Fixtures/input_definition_3.md diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_definition_3.txt b/application/vendor/symfony/console/Tests/Fixtures/input_definition_3.txt new file mode 100644 index 0000000..c02766f --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_definition_3.txt @@ -0,0 +1,2 @@ +Options: + -o, --option_name diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_3.xml b/application/vendor/symfony/console/Tests/Fixtures/input_definition_3.xml similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_3.xml rename to application/vendor/symfony/console/Tests/Fixtures/input_definition_3.xml diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_definition_4.json b/application/vendor/symfony/console/Tests/Fixtures/input_definition_4.json new file mode 100644 index 0000000..d4a51e8 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_definition_4.json @@ -0,0 +1,22 @@ +{ + "arguments": { + "argument_name": { + "name": "argument_name", + "is_required": true, + "is_array": false, + "description": "", + "default": null + } + }, + "options": { + "option_name": { + "name": "--option_name", + "shortcut": "-o", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "", + "default": false + } + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_4.md b/application/vendor/symfony/console/Tests/Fixtures/input_definition_4.md similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_4.md rename to application/vendor/symfony/console/Tests/Fixtures/input_definition_4.md diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_definition_4.txt b/application/vendor/symfony/console/Tests/Fixtures/input_definition_4.txt new file mode 100644 index 0000000..63aa81d --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_definition_4.txt @@ -0,0 +1,5 @@ +Arguments: + argument_name + +Options: + -o, --option_name diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_4.xml b/application/vendor/symfony/console/Tests/Fixtures/input_definition_4.xml similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_definition_4.xml rename to application/vendor/symfony/console/Tests/Fixtures/input_definition_4.xml diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_1.json b/application/vendor/symfony/console/Tests/Fixtures/input_option_1.json new file mode 100644 index 0000000..f86bf96 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_1.json @@ -0,0 +1,9 @@ +{ + "name": "--option_name", + "shortcut": "-o", + "accept_value": false, + "is_value_required": false, + "is_multiple": false, + "description": "", + "default": false +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_1.md b/application/vendor/symfony/console/Tests/Fixtures/input_option_1.md similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_1.md rename to application/vendor/symfony/console/Tests/Fixtures/input_option_1.md diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_1.txt b/application/vendor/symfony/console/Tests/Fixtures/input_option_1.txt new file mode 100644 index 0000000..3a5e4ee --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_1.txt @@ -0,0 +1 @@ + -o, --option_name diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_1.xml b/application/vendor/symfony/console/Tests/Fixtures/input_option_1.xml similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_1.xml rename to application/vendor/symfony/console/Tests/Fixtures/input_option_1.xml diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_2.json b/application/vendor/symfony/console/Tests/Fixtures/input_option_2.json new file mode 100644 index 0000000..32dbab2 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_2.json @@ -0,0 +1,9 @@ +{ + "name": "--option_name", + "shortcut": "-o", + "accept_value": true, + "is_value_required": false, + "is_multiple": false, + "description": "option description", + "default": "default_value" +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_2.md b/application/vendor/symfony/console/Tests/Fixtures/input_option_2.md similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_2.md rename to application/vendor/symfony/console/Tests/Fixtures/input_option_2.md diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_2.txt b/application/vendor/symfony/console/Tests/Fixtures/input_option_2.txt new file mode 100644 index 0000000..1009eff --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_2.txt @@ -0,0 +1 @@ + -o, --option_name[=OPTION_NAME] option description [default: "default_value"] diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_2.xml b/application/vendor/symfony/console/Tests/Fixtures/input_option_2.xml similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_2.xml rename to application/vendor/symfony/console/Tests/Fixtures/input_option_2.xml diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_3.json b/application/vendor/symfony/console/Tests/Fixtures/input_option_3.json new file mode 100644 index 0000000..6d55a6e --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_3.json @@ -0,0 +1,9 @@ +{ + "name": "--option_name", + "shortcut": "-o", + "accept_value": true, + "is_value_required": true, + "is_multiple": false, + "description": "option description", + "default": null +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_3.md b/application/vendor/symfony/console/Tests/Fixtures/input_option_3.md similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_3.md rename to application/vendor/symfony/console/Tests/Fixtures/input_option_3.md diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_3.txt b/application/vendor/symfony/console/Tests/Fixtures/input_option_3.txt new file mode 100644 index 0000000..947bb65 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_3.txt @@ -0,0 +1 @@ + -o, --option_name=OPTION_NAME option description diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_3.xml b/application/vendor/symfony/console/Tests/Fixtures/input_option_3.xml similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_3.xml rename to application/vendor/symfony/console/Tests/Fixtures/input_option_3.xml diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_4.json b/application/vendor/symfony/console/Tests/Fixtures/input_option_4.json new file mode 100644 index 0000000..788a8ed --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_4.json @@ -0,0 +1,9 @@ +{ + "name": "--option_name", + "shortcut": "-o", + "accept_value": true, + "is_value_required": false, + "is_multiple": true, + "description": "option description", + "default": [] +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_4.md b/application/vendor/symfony/console/Tests/Fixtures/input_option_4.md similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_4.md rename to application/vendor/symfony/console/Tests/Fixtures/input_option_4.md diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_4.txt b/application/vendor/symfony/console/Tests/Fixtures/input_option_4.txt new file mode 100644 index 0000000..27edf77 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_4.txt @@ -0,0 +1 @@ + -o, --option_name[=OPTION_NAME] option description (multiple values allowed) diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_4.xml b/application/vendor/symfony/console/Tests/Fixtures/input_option_4.xml similarity index 100% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Fixtures/input_option_4.xml rename to application/vendor/symfony/console/Tests/Fixtures/input_option_4.xml diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_5.json b/application/vendor/symfony/console/Tests/Fixtures/input_option_5.json new file mode 100644 index 0000000..9f34d83 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_5.json @@ -0,0 +1,9 @@ +{ + "name": "--option_name", + "shortcut": "-o", + "accept_value": true, + "is_value_required": true, + "is_multiple": false, + "description": "multiline option description", + "default": null +} diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_5.md b/application/vendor/symfony/console/Tests/Fixtures/input_option_5.md new file mode 100644 index 0000000..82f51ca --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_5.md @@ -0,0 +1,10 @@ +**option_name:** + +* Name: `--option_name` +* Shortcut: `-o` +* Accept value: yes +* Is value required: yes +* Is multiple: no +* Description: multiline + option description +* Default: `NULL` diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_5.txt b/application/vendor/symfony/console/Tests/Fixtures/input_option_5.txt new file mode 100644 index 0000000..9563b4c --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_5.txt @@ -0,0 +1,2 @@ + -o, --option_name=OPTION_NAME multiline + option description diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_5.xml b/application/vendor/symfony/console/Tests/Fixtures/input_option_5.xml new file mode 100644 index 0000000..90040cc --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_5.xml @@ -0,0 +1,6 @@ + + diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_6.json b/application/vendor/symfony/console/Tests/Fixtures/input_option_6.json new file mode 100644 index 0000000..0638de0 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_6.json @@ -0,0 +1,9 @@ +{ + "name": "--option_name", + "shortcut": "-o|-O", + "accept_value": true, + "is_value_required": true, + "is_multiple": false, + "description": "option with multiple shortcuts", + "default": null +} diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_6.md b/application/vendor/symfony/console/Tests/Fixtures/input_option_6.md new file mode 100644 index 0000000..ed1ea1c --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_6.md @@ -0,0 +1,9 @@ +**option_name:** + +* Name: `--option_name` +* Shortcut: `-o|-O` +* Accept value: yes +* Is value required: yes +* Is multiple: no +* Description: option with multiple shortcuts +* Default: `NULL` diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_6.txt b/application/vendor/symfony/console/Tests/Fixtures/input_option_6.txt new file mode 100644 index 0000000..0e6c975 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_6.txt @@ -0,0 +1 @@ + -o|O, --option_name=OPTION_NAME option with multiple shortcuts diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_6.xml b/application/vendor/symfony/console/Tests/Fixtures/input_option_6.xml new file mode 100644 index 0000000..06126a2 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_6.xml @@ -0,0 +1,5 @@ + + diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.json b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.json new file mode 100644 index 0000000..7c96ad3 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.json @@ -0,0 +1,9 @@ +{ + "name": "--option_name", + "shortcut": "-o", + "accept_value": true, + "is_value_required": false, + "is_multiple": false, + "description": "option description", + "default": "INF" +} diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.md b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.md new file mode 100644 index 0000000..b57bd04 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.md @@ -0,0 +1,9 @@ +**option_name:** + +* Name: `--option_name` +* Shortcut: `-o` +* Accept value: yes +* Is value required: no +* Is multiple: no +* Description: option description +* Default: `INF` diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.txt b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.txt new file mode 100644 index 0000000..d467dcf --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.txt @@ -0,0 +1 @@ + -o, --option_name[=OPTION_NAME] option description [default: INF] diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.xml b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.xml new file mode 100644 index 0000000..5d1d217 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.xml @@ -0,0 +1,7 @@ + + diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style.json b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style.json new file mode 100644 index 0000000..df328bf --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style.json @@ -0,0 +1,9 @@ +{ + "name": "--option_name", + "shortcut": "-o", + "accept_value": true, + "is_value_required": true, + "is_multiple": false, + "description": "option description", + "default": "style" +} diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style.md b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style.md new file mode 100644 index 0000000..3f6dd23 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style.md @@ -0,0 +1,9 @@ +**option_name:** + +* Name: `--option_name` +* Shortcut: `-o` +* Accept value: yes +* Is value required: yes +* Is multiple: no +* Description: option description +* Default: `'style'` diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style.txt b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style.txt new file mode 100644 index 0000000..880a535 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style.txt @@ -0,0 +1 @@ + -o, --option_name=OPTION_NAME option description [default: "\style\"] diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style.xml b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style.xml new file mode 100644 index 0000000..764b9e6 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style.xml @@ -0,0 +1,7 @@ + + diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.json b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.json new file mode 100644 index 0000000..b175455 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.json @@ -0,0 +1,12 @@ +{ + "name": "--option_name", + "shortcut": "-o", + "accept_value": true, + "is_value_required": true, + "is_multiple": true, + "description": "option description", + "default": [ + "Hello", + "world" + ] +} diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.md b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.md new file mode 100644 index 0000000..24e58b5 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.md @@ -0,0 +1,9 @@ +**option_name:** + +* Name: `--option_name` +* Shortcut: `-o` +* Accept value: yes +* Is value required: yes +* Is multiple: yes +* Description: option description +* Default: `array ( 0 => 'Hello', 1 => 'world',)` diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.txt b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.txt new file mode 100644 index 0000000..265c18c --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.txt @@ -0,0 +1 @@ + -o, --option_name=OPTION_NAME option description [default: ["\Hello\","\world\"]] (multiple values allowed) diff --git a/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.xml b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.xml new file mode 100644 index 0000000..09dc865 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.xml @@ -0,0 +1,8 @@ + + diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.php b/application/vendor/symfony/console/Tests/Formatter/OutputFormatterStyleStackTest.php similarity index 96% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.php rename to application/vendor/symfony/console/Tests/Formatter/OutputFormatterStyleStackTest.php index 774df26..6cd7c82 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleStackTest.php +++ b/application/vendor/symfony/console/Tests/Formatter/OutputFormatterStyleStackTest.php @@ -11,10 +11,11 @@ namespace Symfony\Component\Console\Tests\Formatter; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Formatter\OutputFormatterStyleStack; use Symfony\Component\Console\Formatter\OutputFormatterStyle; -class OutputFormatterStyleStackTest extends \PHPUnit_Framework_TestCase +class OutputFormatterStyleStackTest extends TestCase { public function testPush() { diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php b/application/vendor/symfony/console/Tests/Formatter/OutputFormatterStyleTest.php similarity index 92% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php rename to application/vendor/symfony/console/Tests/Formatter/OutputFormatterStyleTest.php index 0abfb3c..ddf7790 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php +++ b/application/vendor/symfony/console/Tests/Formatter/OutputFormatterStyleTest.php @@ -11,9 +11,10 @@ namespace Symfony\Component\Console\Tests\Formatter; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Formatter\OutputFormatterStyle; -class OutputFormatterStyleTest extends \PHPUnit_Framework_TestCase +class OutputFormatterStyleTest extends TestCase { public function testConstructor() { @@ -40,7 +41,7 @@ public function testForeground() $style->setForeground('default'); $this->assertEquals("\033[39mfoo\033[39m", $style->apply('foo')); - $this->setExpectedException('InvalidArgumentException'); + $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException'); $style->setForeground('undefined-color'); } @@ -57,7 +58,7 @@ public function testBackground() $style->setBackground('default'); $this->assertEquals("\033[49mfoo\033[49m", $style->apply('foo')); - $this->setExpectedException('InvalidArgumentException'); + $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException'); $style->setBackground('undefined-color'); } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php b/application/vendor/symfony/console/Tests/Formatter/OutputFormatterTest.php similarity index 89% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php rename to application/vendor/symfony/console/Tests/Formatter/OutputFormatterTest.php index 510a4e7..00e5231 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php +++ b/application/vendor/symfony/console/Tests/Formatter/OutputFormatterTest.php @@ -11,10 +11,11 @@ namespace Symfony\Component\Console\Tests\Formatter; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Formatter\OutputFormatterStyle; -class OutputFormatterTest extends \PHPUnit_Framework_TestCase +class OutputFormatterTest extends TestCase { public function testEmptyTag() { @@ -27,6 +28,9 @@ public function testLGCharEscaping() $formatter = new OutputFormatter(true); $this->assertEquals('fooformat('foo\\assertEquals('foo << bar', $formatter->format('foo << bar')); + $this->assertEquals('foo << bar \\', $formatter->format('foo << bar \\')); + $this->assertEquals("foo << \033[32mbar \\ baz\033[39m \\", $formatter->format('foo << bar \\ baz \\')); $this->assertEquals('some info', $formatter->format('\\some info\\')); $this->assertEquals('\\some info\\', OutputFormatter::escape('some info')); @@ -98,8 +102,8 @@ public function testStyleEscaping() $formatter = new OutputFormatter(true); $this->assertEquals( - "(\033[32mz>=2.0,format('('.$formatter->escape('z>=2.0,)') + "(\033[32mz>=2.0,<<format('('.$formatter->escape('z>=2.0,<\\<)') ); $this->assertEquals( @@ -195,6 +199,9 @@ public function testNotDecoratedFormatter() $this->assertEquals( 'some question', $formatter->format('some question') ); + $this->assertEquals( + 'some text with inline style', $formatter->format('some text with inline style') + ); $formatter->setDecorated(true); @@ -210,6 +217,9 @@ public function testNotDecoratedFormatter() $this->assertEquals( "\033[30;46msome question\033[39;49m", $formatter->format('some question') ); + $this->assertEquals( + "\033[31msome text with inline style\033[39m", $formatter->format('some text with inline style') + ); } public function testContentWithLineBreaks() @@ -220,7 +230,7 @@ public function testContentWithLineBreaks() \033[32m some text\033[39m EOF - , $formatter->format(<<format(<<<'EOF' some text EOF @@ -230,7 +240,7 @@ public function testContentWithLineBreaks() \033[32msome text \033[39m EOF - , $formatter->format(<<format(<<<'EOF' some text EOF @@ -241,7 +251,7 @@ public function testContentWithLineBreaks() some text \033[39m EOF - , $formatter->format(<<format(<<<'EOF' some text @@ -254,7 +264,7 @@ public function testContentWithLineBreaks() more text \033[39m EOF - , $formatter->format(<<format(<<<'EOF' some text more text diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/FormatterHelperTest.php b/application/vendor/symfony/console/Tests/Helper/FormatterHelperTest.php similarity index 90% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/FormatterHelperTest.php rename to application/vendor/symfony/console/Tests/Helper/FormatterHelperTest.php index e332774..746c2b4 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/FormatterHelperTest.php +++ b/application/vendor/symfony/console/Tests/Helper/FormatterHelperTest.php @@ -11,9 +11,10 @@ namespace Symfony\Component\Console\Tests\Helper; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Helper\FormatterHelper; -class FormatterHelperTest extends \PHPUnit_Framework_TestCase +class FormatterHelperTest extends TestCase { public function testFormatSection() { @@ -52,12 +53,11 @@ public function testFormatBlock() ); } + /** + * @requires extension mbstring + */ public function testFormatBlockWithDiacriticLetters() { - if (!function_exists('mb_detect_encoding')) { - $this->markTestSkipped('This test requires mbstring to work.'); - } - $formatter = new FormatterHelper(); $this->assertEquals( @@ -69,11 +69,11 @@ public function testFormatBlockWithDiacriticLetters() ); } + /** + * @requires extension mbstring + */ public function testFormatBlockWithDoubleWidthDiacriticLetters() { - if (!extension_loaded('mbstring')) { - $this->markTestSkipped('This test requires mbstring to work.'); - } $formatter = new FormatterHelper(); $this->assertEquals( ' '."\n". diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/HelperSetTest.php b/application/vendor/symfony/console/Tests/Helper/HelperSetTest.php similarity index 83% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/HelperSetTest.php rename to application/vendor/symfony/console/Tests/Helper/HelperSetTest.php index bf58a45..8f42cf9 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/HelperSetTest.php +++ b/application/vendor/symfony/console/Tests/Helper/HelperSetTest.php @@ -11,14 +11,12 @@ namespace Symfony\Component\Console\Tests\Helper; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Command\Command; -class HelperSetTest extends \PHPUnit_Framework_TestCase +class HelperSetTest extends TestCase { - /** - * @covers \Symfony\Component\Console\Helper\HelperSet::__construct - */ public function testConstructor() { $mock_helper = $this->getGenericMockHelper('fake_helper'); @@ -28,9 +26,6 @@ public function testConstructor() $this->assertTrue($helperset->has('fake_helper_alias'), '__construct sets helper alias for given helper'); } - /** - * @covers \Symfony\Component\Console\Helper\HelperSet::set - */ public function testSet() { $helperset = new HelperSet(); @@ -49,9 +44,6 @@ public function testSet() $this->assertTrue($helperset->has('fake_helper_alias'), '->set() adds helper alias when set'); } - /** - * @covers \Symfony\Component\Console\Helper\HelperSet::has - */ public function testHas() { $helperset = new HelperSet(array('fake_helper_alias' => $this->getGenericMockHelper('fake_helper'))); @@ -59,9 +51,6 @@ public function testHas() $this->assertTrue($helperset->has('fake_helper_alias'), '->has() finds set helper by alias'); } - /** - * @covers \Symfony\Component\Console\Helper\HelperSet::get - */ public function testGet() { $helper_01 = $this->getGenericMockHelper('fake_helper_01'); @@ -82,9 +71,6 @@ public function testGet() } } - /** - * @covers \Symfony\Component\Console\Helper\HelperSet::setCommand - */ public function testSetCommand() { $cmd_01 = new Command('foo'); @@ -100,9 +86,6 @@ public function testSetCommand() $this->assertEquals($cmd_02, $helperset->getCommand(), '->setCommand() overwrites stored command with consecutive calls'); } - /** - * @covers \Symfony\Component\Console\Helper\HelperSet::getCommand - */ public function testGetCommand() { $cmd = new Command('foo'); @@ -111,9 +94,6 @@ public function testGetCommand() $this->assertEquals($cmd, $helperset->getCommand(), '->getCommand() retrieves stored command'); } - /** - * @covers \Symfony\Component\Console\Helper\HelperSet::getIterator - */ public function testIteration() { $helperset = new HelperSet(); @@ -128,16 +108,9 @@ public function testIteration() } } - /** - * Create a generic mock for the helper interface. Optionally check for a call to setHelperSet with a specific - * helperset instance. - * - * @param string $name - * @param HelperSet $helperset allows a mock to verify a particular helperset set is being added to the Helper - */ private function getGenericMockHelper($name, HelperSet $helperset = null) { - $mock_helper = $this->getMock('\Symfony\Component\Console\Helper\HelperInterface'); + $mock_helper = $this->getMockBuilder('\Symfony\Component\Console\Helper\HelperInterface')->getMock(); $mock_helper->expects($this->any()) ->method('getName') ->will($this->returnValue($name)); diff --git a/application/vendor/symfony/console/Tests/Helper/HelperTest.php b/application/vendor/symfony/console/Tests/Helper/HelperTest.php new file mode 100644 index 0000000..1847582 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Helper/HelperTest.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Helper; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Helper\Helper; + +class HelperTest extends TestCase +{ + public function formatTimeProvider() + { + return array( + array(0, '< 1 sec'), + array(1, '1 sec'), + array(2, '2 secs'), + array(59, '59 secs'), + array(60, '1 min'), + array(61, '1 min'), + array(119, '1 min'), + array(120, '2 mins'), + array(121, '2 mins'), + array(3599, '59 mins'), + array(3600, '1 hr'), + array(7199, '1 hr'), + array(7200, '2 hrs'), + array(7201, '2 hrs'), + array(86399, '23 hrs'), + array(86400, '1 day'), + array(86401, '1 day'), + array(172799, '1 day'), + array(172800, '2 days'), + array(172801, '2 days'), + ); + } + + /** + * @dataProvider formatTimeProvider + * + * @param int $secs + * @param string $expectedFormat + */ + public function testFormatTime($secs, $expectedFormat) + { + $this->assertEquals($expectedFormat, Helper::formatTime($secs)); + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/LegacyDialogHelperTest.php b/application/vendor/symfony/console/Tests/Helper/LegacyDialogHelperTest.php similarity index 76% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/LegacyDialogHelperTest.php rename to application/vendor/symfony/console/Tests/Helper/LegacyDialogHelperTest.php index cf07793..b7d1b5c 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/LegacyDialogHelperTest.php +++ b/application/vendor/symfony/console/Tests/Helper/LegacyDialogHelperTest.php @@ -11,22 +11,19 @@ namespace Symfony\Component\Console\Tests\Helper; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Helper\DialogHelper; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\FormatterHelper; +use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Output\StreamOutput; /** * @group legacy */ -class LegacyDialogHelperTest extends \PHPUnit_Framework_TestCase +class LegacyDialogHelperTest extends TestCase { - protected function setUp() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - } - public function testSelect() { $dialog = new DialogHelper(); @@ -59,6 +56,22 @@ public function testSelect() $this->assertEquals(array('0', '1'), $dialog->select($this->getOutputStream(), 'What is your favorite superhero?', $heroes, ' 0 , 1 ', false, 'Input "%s" is not a superhero!', true)); } + public function testSelectOnErrorOutput() + { + $dialog = new DialogHelper(); + + $helperSet = new HelperSet(array(new FormatterHelper())); + $dialog->setHelperSet($helperSet); + + $heroes = array('Superman', 'Batman', 'Spiderman'); + + $dialog->setInputStream($this->getInputStream("Stdout\n1\n")); + $this->assertEquals('1', $dialog->select($output = $this->getConsoleOutput($this->getOutputStream()), 'What is your favorite superhero?', $heroes, null, false, 'Input "%s" is not a superhero!', false)); + + rewind($output->getErrorOutput()->getStream()); + $this->assertContains('Input "Stdout" is not a superhero!', stream_get_contents($output->getErrorOutput()->getStream())); + } + public function testAsk() { $dialog = new DialogHelper(); @@ -72,6 +85,22 @@ public function testAsk() $this->assertEquals('What time is it?', stream_get_contents($output->getStream())); } + public function testAskOnErrorOutput() + { + if (!$this->hasSttyAvailable()) { + $this->markTestSkipped('`stderr` is required to test stderr output functionality'); + } + + $dialog = new DialogHelper(); + + $dialog->setInputStream($this->getInputStream("not stdout\n")); + + $this->assertEquals('not stdout', $dialog->ask($output = $this->getConsoleOutput($this->getOutputStream()), 'Where should output go?', 'stderr')); + + rewind($output->getErrorOutput()->getStream()); + $this->assertEquals('Where should output go?', stream_get_contents($output->getErrorOutput()->getStream())); + } + public function testAskWithAutocomplete() { if (!$this->hasSttyAvailable()) { @@ -119,6 +148,25 @@ public function testAskHiddenResponse() $this->assertEquals('8AM', $dialog->askHiddenResponse($this->getOutputStream(), 'What time is it?')); } + /** + * @group tty + */ + public function testAskHiddenResponseOnErrorOutput() + { + if ('\\' === DIRECTORY_SEPARATOR) { + $this->markTestSkipped('This test is not supported on Windows'); + } + + $dialog = new DialogHelper(); + + $dialog->setInputStream($this->getInputStream("8AM\n")); + + $this->assertEquals('8AM', $dialog->askHiddenResponse($output = $this->getConsoleOutput($this->getOutputStream()), 'What time is it?')); + + rewind($output->getErrorOutput()->getStream()); + $this->assertContains('What time is it?', stream_get_contents($output->getErrorOutput()->getStream())); + } + public function testAskConfirmation() { $dialog = new DialogHelper(); @@ -158,10 +206,12 @@ public function testAskAndValidate() $dialog->setInputStream($this->getInputStream("green\nyellow\norange\n")); try { - $this->assertEquals('white', $dialog->askAndValidate($this->getOutputStream(), $question, $validator, 2, 'white')); + $this->assertEquals('white', $dialog->askAndValidate($output = $this->getConsoleOutput($this->getOutputStream()), $question, $validator, 2, 'white')); $this->fail(); } catch (\InvalidArgumentException $e) { $this->assertEquals($error, $e->getMessage()); + rewind($output->getErrorOutput()->getStream()); + $this->assertContains('What color was the white horse of Henry IV?', stream_get_contents($output->getErrorOutput()->getStream())); } } @@ -191,10 +241,18 @@ protected function getOutputStream() return new StreamOutput(fopen('php://memory', 'r+', false)); } + protected function getConsoleOutput($stderr) + { + $output = new ConsoleOutput(); + $output->setErrorOutput($stderr); + + return $output; + } + private function hasSttyAvailable() { exec('stty 2>&1', $output, $exitcode); - return $exitcode === 0; + return 0 === $exitcode; } } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/LegacyProgressHelperTest.php b/application/vendor/symfony/console/Tests/Helper/LegacyProgressHelperTest.php similarity index 93% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/LegacyProgressHelperTest.php rename to application/vendor/symfony/console/Tests/Helper/LegacyProgressHelperTest.php index e93057a..76d003e 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/LegacyProgressHelperTest.php +++ b/application/vendor/symfony/console/Tests/Helper/LegacyProgressHelperTest.php @@ -11,19 +11,16 @@ namespace Symfony\Component\Console\Tests\Helper; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Helper\ProgressHelper; use Symfony\Component\Console\Output\StreamOutput; /** * @group legacy + * @group time-sensitive */ -class LegacyProgressHelperTest extends \PHPUnit_Framework_TestCase +class LegacyProgressHelperTest extends TestCase { - protected function setUp() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - } - public function testAdvance() { $progress = new ProgressHelper(); @@ -146,7 +143,7 @@ public function testRegressProgress() public function testRedrawFrequency() { - $progress = $this->getMock('Symfony\Component\Console\Helper\ProgressHelper', array('display')); + $progress = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressHelper')->setMethods(array('display'))->getMock(); $progress->expects($this->exactly(4)) ->method('display'); @@ -159,12 +156,11 @@ public function testRedrawFrequency() $progress->advance(1); } + /** + * @requires extension mbstring + */ public function testMultiByteSupport() { - if (!function_exists('mb_strlen') || (false === $encoding = mb_detect_encoding('■'))) { - $this->markTestSkipped('The mbstring extension is needed for multi-byte support'); - } - $progress = new ProgressHelper(); $progress->start($output = $this->getOutputStream()); $progress->setBarCharacter('■'); @@ -221,7 +217,7 @@ protected function generateOutput($expected) { $expectedout = $expected; - if ($this->lastMessagesLength !== null) { + if (null !== $this->lastMessagesLength) { $expectedout = str_pad($expected, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT); } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/LegacyTableHelperTest.php b/application/vendor/symfony/console/Tests/Helper/LegacyTableHelperTest.php similarity index 93% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/LegacyTableHelperTest.php rename to application/vendor/symfony/console/Tests/Helper/LegacyTableHelperTest.php index b7e3159..9fdc1fb 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Helper/LegacyTableHelperTest.php +++ b/application/vendor/symfony/console/Tests/Helper/LegacyTableHelperTest.php @@ -11,19 +11,19 @@ namespace Symfony\Component\Console\Tests\Helper; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Helper\TableHelper; use Symfony\Component\Console\Output\StreamOutput; /** * @group legacy */ -class LegacyTableHelperTest extends \PHPUnit_Framework_TestCase +class LegacyTableHelperTest extends TestCase { protected $stream; protected function setUp() { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); $this->stream = fopen('php://memory', 'r+'); } @@ -34,7 +34,7 @@ protected function tearDown() } /** - * @dataProvider testRenderProvider + * @dataProvider renderProvider */ public function testRender($headers, $rows, $layout, $expected) { @@ -50,7 +50,7 @@ public function testRender($headers, $rows, $layout, $expected) } /** - * @dataProvider testRenderProvider + * @dataProvider renderProvider */ public function testRenderAddRows($headers, $rows, $layout, $expected) { @@ -66,7 +66,7 @@ public function testRenderAddRows($headers, $rows, $layout, $expected) } /** - * @dataProvider testRenderProvider + * @dataProvider renderProvider */ public function testRenderAddRowsOneByOne($headers, $rows, $layout, $expected) { @@ -83,7 +83,7 @@ public function testRenderAddRowsOneByOne($headers, $rows, $layout, $expected) $this->assertEquals($expected, $this->getOutputContent($output)); } - public function testRenderProvider() + public function renderProvider() { $books = array( array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), @@ -97,7 +97,7 @@ public function testRenderProvider() array('ISBN', 'Title', 'Author'), $books, TableHelper::LAYOUT_DEFAULT, -<<
    Charles Dickens'), ), TableHelper::LAYOUT_DEFAULT, -<<
    markTestSkipped('The "mbstring" extension is not available'); - } - $table = new TableHelper(); $table ->setHeaders(array('■■')) @@ -272,7 +271,7 @@ public function testRenderMultiByte() $table->render($output = $this->getOutputStream()); $expected = -<<
    assertEquals($expected, $this->getOutputContent($output)); } + /** + * @requires extension mbstring + */ public function testRenderFullWidthCharacters() { - if (!function_exists('mb_strwidth')) { - $this->markTestSkipped('The "mbstring" extension is not available'); - } - $table = new TableHelper(); $table ->setHeaders(array('あいうえお')) @@ -299,7 +297,7 @@ public function testRenderFullWidthCharacters() $table->render($output = $this->getOutputStream()); $expected = - <<
    42\";" + $successOutputDebugWithTags = <<<'EOT' + RUN php -r "echo '42';" OUT 42 RES Command ran successfully EOT; - $successOutputProcessDebug = <<getProcess()->getCommandLine(); + $successOutputProcessDebug = str_replace("'php' '-r' 'echo 42;'", $args, $successOutputProcessDebug); return array( array('', 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERBOSE, null), array($successOutputVerbose, 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERY_VERBOSE, null), array($successOutputDebug, 'php -r "echo 42;"', StreamOutput::VERBOSITY_DEBUG, null), - array($successOutputDebugWithTags, 'php -r "echo \"42\";"', StreamOutput::VERBOSITY_DEBUG, null), + array($successOutputDebugWithTags, 'php -r "echo \'42\';"', StreamOutput::VERBOSITY_DEBUG, null), array('', 'php -r "syntax error"', StreamOutput::VERBOSITY_VERBOSE, null), array($syntaxErrorOutputVerbose, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, null), - array($syntaxErrorOutputDebug, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, null), + array($syntaxErrorOutputDebug, 'php -r "fwrite(STDERR, \'error message\');usleep(500000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, null), array($errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERBOSE, $errorMessage), array($syntaxErrorOutputVerbose.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, $errorMessage), - array($syntaxErrorOutputDebug.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, $errorMessage), + array($syntaxErrorOutputDebug.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(500000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, $errorMessage), array($successOutputProcessDebug, array('php', '-r', 'echo 42;'), StreamOutput::VERBOSITY_DEBUG, null), array($successOutputDebug, new Process('php -r "echo 42;"'), StreamOutput::VERBOSITY_DEBUG, null), ); diff --git a/application/vendor/symfony/console/Tests/Helper/ProgressBarTest.php b/application/vendor/symfony/console/Tests/Helper/ProgressBarTest.php new file mode 100644 index 0000000..d1616d1 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Helper/ProgressBarTest.php @@ -0,0 +1,668 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Helper; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Helper\ProgressBar; +use Symfony\Component\Console\Helper\Helper; +use Symfony\Component\Console\Output\StreamOutput; + +/** + * @group time-sensitive + */ +class ProgressBarTest extends TestCase +{ + public function testMultipleStart() + { + $bar = new ProgressBar($output = $this->getOutputStream()); + $bar->start(); + $bar->advance(); + $bar->start(); + + rewind($output->getStream()); + $this->assertEquals( + ' 0 [>---------------------------]'. + $this->generateOutput(' 1 [->--------------------------]'). + $this->generateOutput(' 0 [>---------------------------]'), + stream_get_contents($output->getStream()) + ); + } + + public function testAdvance() + { + $bar = new ProgressBar($output = $this->getOutputStream()); + $bar->start(); + $bar->advance(); + + rewind($output->getStream()); + $this->assertEquals( + ' 0 [>---------------------------]'. + $this->generateOutput(' 1 [->--------------------------]'), + stream_get_contents($output->getStream()) + ); + } + + public function testAdvanceWithStep() + { + $bar = new ProgressBar($output = $this->getOutputStream()); + $bar->start(); + $bar->advance(5); + + rewind($output->getStream()); + $this->assertEquals( + ' 0 [>---------------------------]'. + $this->generateOutput(' 5 [----->----------------------]'), + stream_get_contents($output->getStream()) + ); + } + + public function testAdvanceMultipleTimes() + { + $bar = new ProgressBar($output = $this->getOutputStream()); + $bar->start(); + $bar->advance(3); + $bar->advance(2); + + rewind($output->getStream()); + $this->assertEquals( + ' 0 [>---------------------------]'. + $this->generateOutput(' 3 [--->------------------------]'). + $this->generateOutput(' 5 [----->----------------------]'), + stream_get_contents($output->getStream()) + ); + } + + public function testAdvanceOverMax() + { + $bar = new ProgressBar($output = $this->getOutputStream(), 10); + $bar->setProgress(9); + $bar->advance(); + $bar->advance(); + + rewind($output->getStream()); + $this->assertEquals( + ' 9/10 [=========================>--] 90%'. + $this->generateOutput(' 10/10 [============================] 100%'). + $this->generateOutput(' 11/11 [============================] 100%'), + stream_get_contents($output->getStream()) + ); + } + + public function testFormat() + { + $expected = + ' 0/10 [>---------------------------] 0%'. + $this->generateOutput(' 10/10 [============================] 100%'). + $this->generateOutput(' 10/10 [============================] 100%') + ; + + // max in construct, no format + $bar = new ProgressBar($output = $this->getOutputStream(), 10); + $bar->start(); + $bar->advance(10); + $bar->finish(); + + rewind($output->getStream()); + $this->assertEquals($expected, stream_get_contents($output->getStream())); + + // max in start, no format + $bar = new ProgressBar($output = $this->getOutputStream()); + $bar->start(10); + $bar->advance(10); + $bar->finish(); + + rewind($output->getStream()); + $this->assertEquals($expected, stream_get_contents($output->getStream())); + + // max in construct, explicit format before + $bar = new ProgressBar($output = $this->getOutputStream(), 10); + $bar->setFormat('normal'); + $bar->start(); + $bar->advance(10); + $bar->finish(); + + rewind($output->getStream()); + $this->assertEquals($expected, stream_get_contents($output->getStream())); + + // max in start, explicit format before + $bar = new ProgressBar($output = $this->getOutputStream()); + $bar->setFormat('normal'); + $bar->start(10); + $bar->advance(10); + $bar->finish(); + + rewind($output->getStream()); + $this->assertEquals($expected, stream_get_contents($output->getStream())); + } + + public function testCustomizations() + { + $bar = new ProgressBar($output = $this->getOutputStream(), 10); + $bar->setBarWidth(10); + $bar->setBarCharacter('_'); + $bar->setEmptyBarCharacter(' '); + $bar->setProgressCharacter('/'); + $bar->setFormat(' %current%/%max% [%bar%] %percent:3s%%'); + $bar->start(); + $bar->advance(); + + rewind($output->getStream()); + $this->assertEquals( + ' 0/10 [/ ] 0%'. + $this->generateOutput(' 1/10 [_/ ] 10%'), + stream_get_contents($output->getStream()) + ); + } + + public function testDisplayWithoutStart() + { + $bar = new ProgressBar($output = $this->getOutputStream(), 50); + $bar->display(); + + rewind($output->getStream()); + $this->assertEquals( + ' 0/50 [>---------------------------] 0%', + stream_get_contents($output->getStream()) + ); + } + + public function testDisplayWithQuietVerbosity() + { + $bar = new ProgressBar($output = $this->getOutputStream(true, StreamOutput::VERBOSITY_QUIET), 50); + $bar->display(); + + rewind($output->getStream()); + $this->assertEquals( + '', + stream_get_contents($output->getStream()) + ); + } + + public function testFinishWithoutStart() + { + $bar = new ProgressBar($output = $this->getOutputStream(), 50); + $bar->finish(); + + rewind($output->getStream()); + $this->assertEquals( + ' 50/50 [============================] 100%', + stream_get_contents($output->getStream()) + ); + } + + public function testPercent() + { + $bar = new ProgressBar($output = $this->getOutputStream(), 50); + $bar->start(); + $bar->display(); + $bar->advance(); + $bar->advance(); + + rewind($output->getStream()); + $this->assertEquals( + ' 0/50 [>---------------------------] 0%'. + $this->generateOutput(' 0/50 [>---------------------------] 0%'). + $this->generateOutput(' 1/50 [>---------------------------] 2%'). + $this->generateOutput(' 2/50 [=>--------------------------] 4%'), + stream_get_contents($output->getStream()) + ); + } + + public function testOverwriteWithShorterLine() + { + $bar = new ProgressBar($output = $this->getOutputStream(), 50); + $bar->setFormat(' %current%/%max% [%bar%] %percent:3s%%'); + $bar->start(); + $bar->display(); + $bar->advance(); + + // set shorter format + $bar->setFormat(' %current%/%max% [%bar%]'); + $bar->advance(); + + rewind($output->getStream()); + $this->assertEquals( + ' 0/50 [>---------------------------] 0%'. + $this->generateOutput(' 0/50 [>---------------------------] 0%'). + $this->generateOutput(' 1/50 [>---------------------------] 2%'). + $this->generateOutput(' 2/50 [=>--------------------------]'), + stream_get_contents($output->getStream()) + ); + } + + public function testStartWithMax() + { + $bar = new ProgressBar($output = $this->getOutputStream()); + $bar->setFormat('%current%/%max% [%bar%]'); + $bar->start(50); + $bar->advance(); + + rewind($output->getStream()); + $this->assertEquals( + ' 0/50 [>---------------------------]'. + $this->generateOutput(' 1/50 [>---------------------------]'), + stream_get_contents($output->getStream()) + ); + } + + public function testSetCurrentProgress() + { + $bar = new ProgressBar($output = $this->getOutputStream(), 50); + $bar->start(); + $bar->display(); + $bar->advance(); + $bar->setProgress(15); + $bar->setProgress(25); + + rewind($output->getStream()); + $this->assertEquals( + ' 0/50 [>---------------------------] 0%'. + $this->generateOutput(' 0/50 [>---------------------------] 0%'). + $this->generateOutput(' 1/50 [>---------------------------] 2%'). + $this->generateOutput(' 15/50 [========>-------------------] 30%'). + $this->generateOutput(' 25/50 [==============>-------------] 50%'), + stream_get_contents($output->getStream()) + ); + } + + public function testSetCurrentBeforeStarting() + { + $bar = new ProgressBar($this->getOutputStream()); + $bar->setProgress(15); + $this->assertNotNull($bar->getStartTime()); + } + + /** + * @expectedException \LogicException + * @expectedExceptionMessage You can't regress the progress bar + */ + public function testRegressProgress() + { + $bar = new ProgressBar($output = $this->getOutputStream(), 50); + $bar->start(); + $bar->setProgress(15); + $bar->setProgress(10); + } + + public function testRedrawFrequency() + { + $bar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar')->setMethods(array('display'))->setConstructorArgs(array($this->getOutputStream(), 6))->getMock(); + $bar->expects($this->exactly(4))->method('display'); + + $bar->setRedrawFrequency(2); + $bar->start(); + $bar->setProgress(1); + $bar->advance(2); + $bar->advance(2); + $bar->advance(1); + } + + public function testRedrawFrequencyIsAtLeastOneIfZeroGiven() + { + $bar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar')->setMethods(array('display'))->setConstructorArgs(array($this->getOutputStream()))->getMock(); + + $bar->expects($this->exactly(2))->method('display'); + $bar->setRedrawFrequency(0); + $bar->start(); + $bar->advance(); + } + + public function testRedrawFrequencyIsAtLeastOneIfSmallerOneGiven() + { + $bar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar')->setMethods(array('display'))->setConstructorArgs(array($this->getOutputStream()))->getMock(); + + $bar->expects($this->exactly(2))->method('display'); + $bar->setRedrawFrequency(0.9); + $bar->start(); + $bar->advance(); + } + + /** + * @requires extension mbstring + */ + public function testMultiByteSupport() + { + $bar = new ProgressBar($output = $this->getOutputStream()); + $bar->start(); + $bar->setBarCharacter('■'); + $bar->advance(3); + + rewind($output->getStream()); + $this->assertEquals( + ' 0 [>---------------------------]'. + $this->generateOutput(' 3 [■■■>------------------------]'), + stream_get_contents($output->getStream()) + ); + } + + public function testClear() + { + $bar = new ProgressBar($output = $this->getOutputStream(), 50); + $bar->start(); + $bar->setProgress(25); + $bar->clear(); + + rewind($output->getStream()); + $this->assertEquals( + ' 0/50 [>---------------------------] 0%'. + $this->generateOutput(' 25/50 [==============>-------------] 50%'). + $this->generateOutput(''), + stream_get_contents($output->getStream()) + ); + } + + public function testPercentNotHundredBeforeComplete() + { + $bar = new ProgressBar($output = $this->getOutputStream(), 200); + $bar->start(); + $bar->display(); + $bar->advance(199); + $bar->advance(); + + rewind($output->getStream()); + $this->assertEquals( + ' 0/200 [>---------------------------] 0%'. + $this->generateOutput(' 0/200 [>---------------------------] 0%'). + $this->generateOutput(' 199/200 [===========================>] 99%'). + $this->generateOutput(' 200/200 [============================] 100%'), + stream_get_contents($output->getStream()) + ); + } + + public function testNonDecoratedOutput() + { + $bar = new ProgressBar($output = $this->getOutputStream(false), 200); + $bar->start(); + + for ($i = 0; $i < 200; ++$i) { + $bar->advance(); + } + + $bar->finish(); + + rewind($output->getStream()); + $this->assertEquals( + ' 0/200 [>---------------------------] 0%'.PHP_EOL. + ' 20/200 [==>-------------------------] 10%'.PHP_EOL. + ' 40/200 [=====>----------------------] 20%'.PHP_EOL. + ' 60/200 [========>-------------------] 30%'.PHP_EOL. + ' 80/200 [===========>----------------] 40%'.PHP_EOL. + ' 100/200 [==============>-------------] 50%'.PHP_EOL. + ' 120/200 [================>-----------] 60%'.PHP_EOL. + ' 140/200 [===================>--------] 70%'.PHP_EOL. + ' 160/200 [======================>-----] 80%'.PHP_EOL. + ' 180/200 [=========================>--] 90%'.PHP_EOL. + ' 200/200 [============================] 100%', + stream_get_contents($output->getStream()) + ); + } + + public function testNonDecoratedOutputWithClear() + { + $bar = new ProgressBar($output = $this->getOutputStream(false), 50); + $bar->start(); + $bar->setProgress(25); + $bar->clear(); + $bar->setProgress(50); + $bar->finish(); + + rewind($output->getStream()); + $this->assertEquals( + ' 0/50 [>---------------------------] 0%'.PHP_EOL. + ' 25/50 [==============>-------------] 50%'.PHP_EOL. + ' 50/50 [============================] 100%', + stream_get_contents($output->getStream()) + ); + } + + public function testNonDecoratedOutputWithoutMax() + { + $bar = new ProgressBar($output = $this->getOutputStream(false)); + $bar->start(); + $bar->advance(); + + rewind($output->getStream()); + $this->assertEquals( + ' 0 [>---------------------------]'.PHP_EOL. + ' 1 [->--------------------------]', + stream_get_contents($output->getStream()) + ); + } + + public function testParallelBars() + { + $output = $this->getOutputStream(); + $bar1 = new ProgressBar($output, 2); + $bar2 = new ProgressBar($output, 3); + $bar2->setProgressCharacter('#'); + $bar3 = new ProgressBar($output); + + $bar1->start(); + $output->write("\n"); + $bar2->start(); + $output->write("\n"); + $bar3->start(); + + for ($i = 1; $i <= 3; ++$i) { + // up two lines + $output->write("\033[2A"); + if ($i <= 2) { + $bar1->advance(); + } + $output->write("\n"); + $bar2->advance(); + $output->write("\n"); + $bar3->advance(); + } + $output->write("\033[2A"); + $output->write("\n"); + $output->write("\n"); + $bar3->finish(); + + rewind($output->getStream()); + $this->assertEquals( + ' 0/2 [>---------------------------] 0%'."\n". + ' 0/3 [#---------------------------] 0%'."\n". + rtrim(' 0 [>---------------------------]'). + + "\033[2A". + $this->generateOutput(' 1/2 [==============>-------------] 50%')."\n". + $this->generateOutput(' 1/3 [=========#------------------] 33%')."\n". + rtrim($this->generateOutput(' 1 [->--------------------------]')). + + "\033[2A". + $this->generateOutput(' 2/2 [============================] 100%')."\n". + $this->generateOutput(' 2/3 [==================#---------] 66%')."\n". + rtrim($this->generateOutput(' 2 [-->-------------------------]')). + + "\033[2A". + "\n". + $this->generateOutput(' 3/3 [============================] 100%')."\n". + rtrim($this->generateOutput(' 3 [--->------------------------]')). + + "\033[2A". + "\n". + "\n". + rtrim($this->generateOutput(' 3 [============================]')), + stream_get_contents($output->getStream()) + ); + } + + public function testWithoutMax() + { + $output = $this->getOutputStream(); + + $bar = new ProgressBar($output); + $bar->start(); + $bar->advance(); + $bar->advance(); + $bar->advance(); + $bar->finish(); + + rewind($output->getStream()); + $this->assertEquals( + rtrim(' 0 [>---------------------------]'). + rtrim($this->generateOutput(' 1 [->--------------------------]')). + rtrim($this->generateOutput(' 2 [-->-------------------------]')). + rtrim($this->generateOutput(' 3 [--->------------------------]')). + rtrim($this->generateOutput(' 3 [============================]')), + stream_get_contents($output->getStream()) + ); + } + + public function testAddingPlaceholderFormatter() + { + ProgressBar::setPlaceholderFormatterDefinition('remaining_steps', function (ProgressBar $bar) { + return $bar->getMaxSteps() - $bar->getProgress(); + }); + $bar = new ProgressBar($output = $this->getOutputStream(), 3); + $bar->setFormat(' %remaining_steps% [%bar%]'); + + $bar->start(); + $bar->advance(); + $bar->finish(); + + rewind($output->getStream()); + $this->assertEquals( + ' 3 [>---------------------------]'. + $this->generateOutput(' 2 [=========>------------------]'). + $this->generateOutput(' 0 [============================]'), + stream_get_contents($output->getStream()) + ); + } + + public function testMultilineFormat() + { + $bar = new ProgressBar($output = $this->getOutputStream(), 3); + $bar->setFormat("%bar%\nfoobar"); + + $bar->start(); + $bar->advance(); + $bar->clear(); + $bar->finish(); + + rewind($output->getStream()); + $this->assertEquals( + ">---------------------------\nfoobar". + $this->generateOutput("=========>------------------\nfoobar"). + "\x0D\x1B[2K\x1B[1A\x1B[2K". + $this->generateOutput("============================\nfoobar"), + stream_get_contents($output->getStream()) + ); + } + + /** + * @requires extension mbstring + */ + public function testAnsiColorsAndEmojis() + { + $bar = new ProgressBar($output = $this->getOutputStream(), 15); + ProgressBar::setPlaceholderFormatterDefinition('memory', function (ProgressBar $bar) { + static $i = 0; + $mem = 100000 * $i; + $colors = $i++ ? '41;37' : '44;37'; + + return "\033[".$colors.'m '.Helper::formatMemory($mem)." \033[0m"; + }); + $bar->setFormat(" \033[44;37m %title:-37s% \033[0m\n %current%/%max% %bar% %percent:3s%%\n 🏁 %remaining:-10s% %memory:37s%"); + $bar->setBarCharacter($done = "\033[32m●\033[0m"); + $bar->setEmptyBarCharacter($empty = "\033[31m●\033[0m"); + $bar->setProgressCharacter($progress = "\033[32m➤ \033[0m"); + + $bar->setMessage('Starting the demo... fingers crossed', 'title'); + $bar->start(); + $bar->setMessage('Looks good to me...', 'title'); + $bar->advance(4); + $bar->setMessage('Thanks, bye', 'title'); + $bar->finish(); + + rewind($output->getStream()); + $this->assertEquals( + " \033[44;37m Starting the demo... fingers crossed \033[0m\n". + ' 0/15 '.$progress.str_repeat($empty, 26)." 0%\n". + " \xf0\x9f\x8f\x81 < 1 sec \033[44;37m 0 B \033[0m" + . + $this->generateOutput( + " \033[44;37m Looks good to me... \033[0m\n". + ' 4/15 '.str_repeat($done, 7).$progress.str_repeat($empty, 19)." 26%\n". + " \xf0\x9f\x8f\x81 < 1 sec \033[41;37m 97 KiB \033[0m" + ). + $this->generateOutput( + " \033[44;37m Thanks, bye \033[0m\n". + ' 15/15 '.str_repeat($done, 28)." 100%\n". + " \xf0\x9f\x8f\x81 < 1 sec \033[41;37m 195 KiB \033[0m" + ), + stream_get_contents($output->getStream()) + ); + } + + public function testSetFormat() + { + $bar = new ProgressBar($output = $this->getOutputStream()); + $bar->setFormat('normal'); + $bar->start(); + rewind($output->getStream()); + $this->assertEquals( + ' 0 [>---------------------------]', + stream_get_contents($output->getStream()) + ); + + $bar = new ProgressBar($output = $this->getOutputStream(), 10); + $bar->setFormat('normal'); + $bar->start(); + rewind($output->getStream()); + $this->assertEquals( + ' 0/10 [>---------------------------] 0%', + stream_get_contents($output->getStream()) + ); + } + + /** + * @dataProvider provideFormat + */ + public function testFormatsWithoutMax($format) + { + $bar = new ProgressBar($output = $this->getOutputStream()); + $bar->setFormat($format); + $bar->start(); + + rewind($output->getStream()); + $this->assertNotEmpty(stream_get_contents($output->getStream())); + } + + /** + * Provides each defined format. + * + * @return array + */ + public function provideFormat() + { + return array( + array('normal'), + array('verbose'), + array('very_verbose'), + array('debug'), + ); + } + + protected function getOutputStream($decorated = true, $verbosity = StreamOutput::VERBOSITY_NORMAL) + { + return new StreamOutput(fopen('php://memory', 'r+', false), $verbosity, $decorated); + } + + protected function generateOutput($expected) + { + $count = substr_count($expected, "\n"); + + return "\x0D\x1B[2K".($count ? str_repeat("\x1B[1A\x1B[2K", $count) : '').$expected; + } +} diff --git a/application/vendor/symfony/console/Tests/Helper/QuestionHelperTest.php b/application/vendor/symfony/console/Tests/Helper/QuestionHelperTest.php new file mode 100644 index 0000000..9f837d0 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Helper/QuestionHelperTest.php @@ -0,0 +1,624 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Helper; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Helper\QuestionHelper; +use Symfony\Component\Console\Helper\HelperSet; +use Symfony\Component\Console\Helper\FormatterHelper; +use Symfony\Component\Console\Output\StreamOutput; +use Symfony\Component\Console\Question\ChoiceQuestion; +use Symfony\Component\Console\Question\ConfirmationQuestion; +use Symfony\Component\Console\Question\Question; + +/** + * @group tty + */ +class QuestionHelperTest extends TestCase +{ + public function testAskChoice() + { + $questionHelper = new QuestionHelper(); + + $helperSet = new HelperSet(array(new FormatterHelper())); + $questionHelper->setHelperSet($helperSet); + + $heroes = array('Superman', 'Batman', 'Spiderman'); + + $questionHelper->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n")); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '2'); + $question->setMaxAttempts(1); + // first answer is an empty answer, we're supposed to receive the default value + $this->assertEquals('Spiderman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes); + $question->setMaxAttempts(1); + $this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes); + $question->setErrorMessage('Input "%s" is not a superhero!'); + $question->setMaxAttempts(2); + $this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question)); + + rewind($output->getStream()); + $stream = stream_get_contents($output->getStream()); + $this->assertContains('Input "Fabien" is not a superhero!', $stream); + + try { + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '1'); + $question->setMaxAttempts(1); + $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question); + $this->fail(); + } catch (\InvalidArgumentException $e) { + $this->assertEquals('Value "Fabien" is invalid', $e->getMessage()); + } + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null); + $question->setMaxAttempts(1); + $question->setMultiselect(true); + + $this->assertEquals(array('Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0,1'); + $question->setMaxAttempts(1); + $question->setMultiselect(true); + + $this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, ' 0 , 1 '); + $question->setMaxAttempts(1); + $question->setMultiselect(true); + + $this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, 0); + // We are supposed to get the default value since we are not in interactive mode + $this->assertEquals('Superman', $questionHelper->ask($this->createInputInterfaceMock(true), $this->createOutputInterface(), $question)); + } + + public function testAsk() + { + $dialog = new QuestionHelper(); + + $dialog->setInputStream($this->getInputStream("\n8AM\n")); + + $question = new Question('What time is it?', '2PM'); + $this->assertEquals('2PM', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + + $question = new Question('What time is it?', '2PM'); + $this->assertEquals('8AM', $dialog->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question)); + + rewind($output->getStream()); + $this->assertEquals('What time is it?', stream_get_contents($output->getStream())); + } + + public function testAskWithAutocomplete() + { + if (!$this->hasSttyAvailable()) { + $this->markTestSkipped('`stty` is required to test autocomplete functionality'); + } + + // Acm + // AcsTest + // + // + // Test + // + // S + // F00oo + $inputStream = $this->getInputStream("Acm\nAc\177\177s\tTest\n\n\033[A\033[A\n\033[A\033[A\033[A\033[A\033[A\tTest\n\033[B\nS\177\177\033[B\033[B\nF00\177\177oo\t\n"); + + $dialog = new QuestionHelper(); + $dialog->setInputStream($inputStream); + $helperSet = new HelperSet(array(new FormatterHelper())); + $dialog->setHelperSet($helperSet); + + $question = new Question('Please select a bundle', 'FrameworkBundle'); + $question->setAutocompleterValues(array('AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle')); + + $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('AsseticBundleTest', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('FrameworkBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('SecurityBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('FooBundleTest', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('AsseticBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('FooBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + } + + public function testAskWithAutocompleteWithNonSequentialKeys() + { + if (!$this->hasSttyAvailable()) { + $this->markTestSkipped('`stty` is required to test autocomplete functionality'); + } + + // + $inputStream = $this->getInputStream("\033[A\033[A\n\033[B\033[B\n"); + + $dialog = new QuestionHelper(); + $dialog->setInputStream($inputStream); + $dialog->setHelperSet(new HelperSet(array(new FormatterHelper()))); + + $question = new ChoiceQuestion('Please select a bundle', array(1 => 'AcmeDemoBundle', 4 => 'AsseticBundle')); + $question->setMaxAttempts(1); + + $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('AsseticBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + } + + public function testAskWithAutocompleteWithExactMatch() + { + if (!$this->hasSttyAvailable()) { + $this->markTestSkipped('`stty` is required to test autocomplete functionality'); + } + + $inputStream = $this->getInputStream("b\n"); + + $possibleChoices = array( + 'a' => 'berlin', + 'b' => 'copenhagen', + 'c' => 'amsterdam', + ); + + $dialog = new QuestionHelper(); + $dialog->setInputStream($inputStream); + $dialog->setHelperSet(new HelperSet(array(new FormatterHelper()))); + + $question = new ChoiceQuestion('Please select a city', $possibleChoices); + $question->setMaxAttempts(1); + + $this->assertSame('b', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + } + + public function testAutocompleteWithTrailingBackslash() + { + if (!$this->hasSttyAvailable()) { + $this->markTestSkipped('`stty` is required to test autocomplete functionality'); + } + + $inputStream = $this->getInputStream('E'); + + $dialog = new QuestionHelper(); + $dialog->setInputStream($inputStream); + $helperSet = new HelperSet(array(new FormatterHelper())); + $dialog->setHelperSet($helperSet); + + $question = new Question(''); + $expectedCompletion = 'ExampleNamespace\\'; + $question->setAutocompleterValues(array($expectedCompletion)); + + $output = $this->createOutputInterface(); + $dialog->ask($this->createInputInterfaceMock(), $output, $question); + + $outputStream = $output->getStream(); + rewind($outputStream); + $actualOutput = stream_get_contents($outputStream); + + // Shell control (esc) sequences are not so important: we only care that + // tag is interpreted correctly and replaced + $irrelevantEscSequences = array( + "\0337" => '', // Save cursor position + "\0338" => '', // Restore cursor position + "\033[K" => '', // Clear line from cursor till the end + ); + + $importantActualOutput = strtr($actualOutput, $irrelevantEscSequences); + + // Remove colors (e.g. "\033[30m", "\033[31;41m") + $importantActualOutput = preg_replace('/\033\[\d+(;\d+)?m/', '', $importantActualOutput); + + $this->assertEquals($expectedCompletion, $importantActualOutput); + } + + public function testAskHiddenResponse() + { + if ('\\' === DIRECTORY_SEPARATOR) { + $this->markTestSkipped('This test is not supported on Windows'); + } + + $dialog = new QuestionHelper(); + $dialog->setInputStream($this->getInputStream("8AM\n")); + + $question = new Question('What time is it?'); + $question->setHidden(true); + + $this->assertEquals('8AM', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + } + + /** + * @dataProvider getAskConfirmationData + */ + public function testAskConfirmation($question, $expected, $default = true) + { + $dialog = new QuestionHelper(); + + $dialog->setInputStream($this->getInputStream($question."\n")); + $question = new ConfirmationQuestion('Do you like French fries?', $default); + $this->assertEquals($expected, $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question), 'confirmation question should '.($expected ? 'pass' : 'cancel')); + } + + public function getAskConfirmationData() + { + return array( + array('', true), + array('', false, false), + array('y', true), + array('yes', true), + array('n', false), + array('no', false), + ); + } + + public function testAskConfirmationWithCustomTrueAnswer() + { + $dialog = new QuestionHelper(); + + $dialog->setInputStream($this->getInputStream("j\ny\n")); + $question = new ConfirmationQuestion('Do you like French fries?', false, '/^(j|y)/i'); + $this->assertTrue($dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $question = new ConfirmationQuestion('Do you like French fries?', false, '/^(j|y)/i'); + $this->assertTrue($dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + } + + public function testAskAndValidate() + { + $dialog = new QuestionHelper(); + $helperSet = new HelperSet(array(new FormatterHelper())); + $dialog->setHelperSet($helperSet); + + $error = 'This is not a color!'; + $validator = function ($color) use ($error) { + if (!in_array($color, array('white', 'black'))) { + throw new \InvalidArgumentException($error); + } + + return $color; + }; + + $question = new Question('What color was the white horse of Henry IV?', 'white'); + $question->setValidator($validator); + $question->setMaxAttempts(2); + + $dialog->setInputStream($this->getInputStream("\nblack\n")); + $this->assertEquals('white', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('black', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + + $dialog->setInputStream($this->getInputStream("green\nyellow\norange\n")); + try { + $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question); + $this->fail(); + } catch (\InvalidArgumentException $e) { + $this->assertEquals($error, $e->getMessage()); + } + } + + /** + * @dataProvider simpleAnswerProvider + */ + public function testSelectChoiceFromSimpleChoices($providedAnswer, $expectedValue) + { + $possibleChoices = array( + 'My environment 1', + 'My environment 2', + 'My environment 3', + ); + + $dialog = new QuestionHelper(); + $dialog->setInputStream($this->getInputStream($providedAnswer."\n")); + $helperSet = new HelperSet(array(new FormatterHelper())); + $dialog->setHelperSet($helperSet); + + $question = new ChoiceQuestion('Please select the environment to load', $possibleChoices); + $question->setMaxAttempts(1); + $answer = $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question); + + $this->assertSame($expectedValue, $answer); + } + + public function simpleAnswerProvider() + { + return array( + array(0, 'My environment 1'), + array(1, 'My environment 2'), + array(2, 'My environment 3'), + array('My environment 1', 'My environment 1'), + array('My environment 2', 'My environment 2'), + array('My environment 3', 'My environment 3'), + ); + } + + /** + * @dataProvider specialCharacterInMultipleChoice + */ + public function testSpecialCharacterChoiceFromMultipleChoiceList($providedAnswer, $expectedValue) + { + $possibleChoices = array( + '.', + 'src', + ); + + $dialog = new QuestionHelper(); + $dialog->setInputStream($this->getInputStream($providedAnswer."\n")); + $helperSet = new HelperSet(array(new FormatterHelper())); + $dialog->setHelperSet($helperSet); + + $question = new ChoiceQuestion('Please select the directory', $possibleChoices); + $question->setMaxAttempts(1); + $question->setMultiselect(true); + $answer = $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question); + + $this->assertSame($expectedValue, $answer); + } + + public function specialCharacterInMultipleChoice() + { + return array( + array('.', array('.')), + array('., src', array('.', 'src')), + ); + } + + /** + * @dataProvider mixedKeysChoiceListAnswerProvider + */ + public function testChoiceFromChoicelistWithMixedKeys($providedAnswer, $expectedValue) + { + $possibleChoices = array( + '0' => 'No environment', + '1' => 'My environment 1', + 'env_2' => 'My environment 2', + 3 => 'My environment 3', + ); + + $dialog = new QuestionHelper(); + $dialog->setInputStream($this->getInputStream($providedAnswer."\n")); + $helperSet = new HelperSet(array(new FormatterHelper())); + $dialog->setHelperSet($helperSet); + + $question = new ChoiceQuestion('Please select the environment to load', $possibleChoices); + $question->setMaxAttempts(1); + $answer = $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question); + + $this->assertSame($expectedValue, $answer); + } + + public function mixedKeysChoiceListAnswerProvider() + { + return array( + array('0', '0'), + array('No environment', '0'), + array('1', '1'), + array('env_2', 'env_2'), + array(3, '3'), + array('My environment 1', '1'), + ); + } + + /** + * @dataProvider answerProvider + */ + public function testSelectChoiceFromChoiceList($providedAnswer, $expectedValue) + { + $possibleChoices = array( + 'env_1' => 'My environment 1', + 'env_2' => 'My environment', + 'env_3' => 'My environment', + ); + + $dialog = new QuestionHelper(); + $dialog->setInputStream($this->getInputStream($providedAnswer."\n")); + $helperSet = new HelperSet(array(new FormatterHelper())); + $dialog->setHelperSet($helperSet); + + $question = new ChoiceQuestion('Please select the environment to load', $possibleChoices); + $question->setMaxAttempts(1); + $answer = $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question); + + $this->assertSame($expectedValue, $answer); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage The provided answer is ambiguous. Value should be one of env_2 or env_3. + */ + public function testAmbiguousChoiceFromChoicelist() + { + $possibleChoices = array( + 'env_1' => 'My first environment', + 'env_2' => 'My environment', + 'env_3' => 'My environment', + ); + + $dialog = new QuestionHelper(); + $dialog->setInputStream($this->getInputStream("My environment\n")); + $helperSet = new HelperSet(array(new FormatterHelper())); + $dialog->setHelperSet($helperSet); + + $question = new ChoiceQuestion('Please select the environment to load', $possibleChoices); + $question->setMaxAttempts(1); + + $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question); + } + + public function answerProvider() + { + return array( + array('env_1', 'env_1'), + array('env_2', 'env_2'), + array('env_3', 'env_3'), + array('My environment 1', 'env_1'), + ); + } + + public function testNoInteraction() + { + $dialog = new QuestionHelper(); + $question = new Question('Do you have a job?', 'not yet'); + $this->assertEquals('not yet', $dialog->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question)); + } + + /** + * @requires function mb_strwidth + */ + public function testChoiceOutputFormattingQuestionForUtf8Keys() + { + $question = 'Lorem ipsum?'; + $possibleChoices = array( + 'foo' => 'foo', + 'żółw' => 'bar', + 'łabądź' => 'baz', + ); + $outputShown = array( + $question, + ' [foo ] foo', + ' [żółw ] bar', + ' [łabądź] baz', + ); + $output = $this->getMockBuilder('\Symfony\Component\Console\Output\OutputInterface')->getMock(); + $output->method('getFormatter')->willReturn(new OutputFormatter()); + + $dialog = new QuestionHelper(); + $dialog->setInputStream($this->getInputStream("\n")); + $helperSet = new HelperSet(array(new FormatterHelper())); + $dialog->setHelperSet($helperSet); + + $output->expects($this->once())->method('writeln')->with($this->equalTo($outputShown)); + + $question = new ChoiceQuestion($question, $possibleChoices, 'foo'); + $dialog->ask($this->createInputInterfaceMock(), $output, $question); + } + + /** + * @expectedException \Symfony\Component\Console\Exception\RuntimeException + * @expectedExceptionMessage Aborted + */ + public function testAskThrowsExceptionOnMissingInput() + { + $dialog = new QuestionHelper(); + $dialog->setInputStream($this->getInputStream('')); + + $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), new Question('What\'s your name?')); + } + + /** + * @expectedException \Symfony\Component\Console\Exception\RuntimeException + * @expectedExceptionMessage Aborted + */ + public function testAskThrowsExceptionOnMissingInputWithValidator() + { + $dialog = new QuestionHelper(); + $dialog->setInputStream($this->getInputStream('')); + + $question = new Question('What\'s your name?'); + $question->setValidator(function () { + if (!$value) { + throw new \Exception('A value is required.'); + } + }); + + $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question); + } + + /** + * @expectedException \LogicException + * @expectedExceptionMessage Choice question must have at least 1 choice available. + */ + public function testEmptyChoices() + { + new ChoiceQuestion('Question', array(), 'irrelevant'); + } + + public function testTraversableAutocomplete() + { + if (!$this->hasSttyAvailable()) { + $this->markTestSkipped('`stty` is required to test autocomplete functionality'); + } + + // Acm + // AcsTest + // + // + // Test + // + // S + // F00oo + $inputStream = $this->getInputStream("Acm\nAc\177\177s\tTest\n\n\033[A\033[A\n\033[A\033[A\033[A\033[A\033[A\tTest\n\033[B\nS\177\177\033[B\033[B\nF00\177\177oo\t\n"); + + $dialog = new QuestionHelper(); + $dialog->setInputStream($inputStream); + $helperSet = new HelperSet(array(new FormatterHelper())); + $dialog->setHelperSet($helperSet); + + $question = new Question('Please select a bundle', 'FrameworkBundle'); + $question->setAutocompleterValues(new AutocompleteValues(array('irrelevant' => 'AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle'))); + + $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('AsseticBundleTest', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('FrameworkBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('SecurityBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('FooBundleTest', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('AsseticBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('FooBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + } + + protected function getInputStream($input) + { + $stream = fopen('php://memory', 'r+', false); + fwrite($stream, $input); + rewind($stream); + + return $stream; + } + + protected function createOutputInterface() + { + return new StreamOutput(fopen('php://memory', 'r+', false)); + } + + protected function createInputInterfaceMock($interactive = true) + { + $mock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); + $mock->expects($this->any()) + ->method('isInteractive') + ->will($this->returnValue($interactive)); + + return $mock; + } + + private function hasSttyAvailable() + { + exec('stty 2>&1', $output, $exitcode); + + return 0 === $exitcode; + } +} + +class AutocompleteValues implements \IteratorAggregate +{ + private $values; + + public function __construct(array $values) + { + $this->values = $values; + } + + public function getIterator() + { + return new \ArrayIterator($this->values); + } +} diff --git a/application/vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php b/application/vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php new file mode 100644 index 0000000..1a2d1b8 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php @@ -0,0 +1,159 @@ +setHelperSet($helperSet); + + $heroes = array('Superman', 'Batman', 'Spiderman'); + + $questionHelper->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n")); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '2'); + $question->setMaxAttempts(1); + // first answer is an empty answer, we're supposed to receive the default value + $this->assertEquals('Spiderman', $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question)); + $this->assertOutputContains('What is your favorite superhero? [Spiderman]', $output); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes); + $question->setMaxAttempts(1); + $this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes); + $question->setErrorMessage('Input "%s" is not a superhero!'); + $question->setMaxAttempts(2); + $this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question)); + $this->assertOutputContains('Input "Fabien" is not a superhero!', $output); + + try { + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '1'); + $question->setMaxAttempts(1); + $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question); + $this->fail(); + } catch (\InvalidArgumentException $e) { + $this->assertEquals('Value "Fabien" is invalid', $e->getMessage()); + } + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null); + $question->setMaxAttempts(1); + $question->setMultiselect(true); + + $this->assertEquals(array('Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0,1'); + $question->setMaxAttempts(1); + $question->setMultiselect(true); + + $this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question)); + $this->assertOutputContains('What is your favorite superhero? [Superman, Batman]', $output); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, ' 0 , 1 '); + $question->setMaxAttempts(1); + $question->setMultiselect(true); + + $this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question)); + $this->assertOutputContains('What is your favorite superhero? [Superman, Batman]', $output); + } + + public function testAskReturnsNullIfValidatorAllowsIt() + { + $questionHelper = new SymfonyQuestionHelper(); + $questionHelper->setInputStream($this->getInputStream("\n")); + $question = new Question('What is your favorite superhero?'); + $question->setValidator(function ($value) { return $value; }); + $this->assertNull($questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + } + + public function testAskEscapeDefaultValue() + { + $helper = new SymfonyQuestionHelper(); + $helper->setInputStream($this->getInputStream('\\')); + $helper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), new Question('Can I have a backslash?', '\\')); + + $this->assertOutputContains('Can I have a backslash? [\]', $output); + } + + public function testAskEscapeAndFormatLabel() + { + $helper = new SymfonyQuestionHelper(); + $helper->setInputStream($this->getInputStream('Foo\\Bar')); + $helper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), new Question('Do you want to use Foo\\Bar or Foo\\Baz\\?', 'Foo\\Baz')); + + $this->assertOutputContains('Do you want to use Foo\\Bar or Foo\\Baz\\? [Foo\\Baz]:', $output); + } + + public function testLabelTrailingBackslash() + { + $helper = new SymfonyQuestionHelper(); + $helper->setInputStream($this->getInputStream('sure')); + $helper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), new Question('Question with a trailing \\')); + + $this->assertOutputContains('Question with a trailing \\', $output); + } + + /** + * @expectedException \Symfony\Component\Console\Exception\RuntimeException + * @expectedExceptionMessage Aborted + */ + public function testAskThrowsExceptionOnMissingInput() + { + $dialog = new SymfonyQuestionHelper(); + + $dialog->setInputStream($this->getInputStream('')); + $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), new Question('What\'s your name?')); + } + + protected function getInputStream($input) + { + $stream = fopen('php://memory', 'r+', false); + fwrite($stream, $input); + rewind($stream); + + return $stream; + } + + protected function createOutputInterface() + { + $output = new StreamOutput(fopen('php://memory', 'r+', false)); + $output->setDecorated(false); + + return $output; + } + + protected function createInputInterfaceMock($interactive = true) + { + $mock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); + $mock->expects($this->any()) + ->method('isInteractive') + ->will($this->returnValue($interactive)); + + return $mock; + } + + private function assertOutputContains($expected, StreamOutput $output) + { + rewind($output->getStream()); + $stream = stream_get_contents($output->getStream()); + $this->assertContains($expected, $stream); + } +} diff --git a/application/vendor/symfony/console/Tests/Helper/TableStyleTest.php b/application/vendor/symfony/console/Tests/Helper/TableStyleTest.php new file mode 100644 index 0000000..13e918b --- /dev/null +++ b/application/vendor/symfony/console/Tests/Helper/TableStyleTest.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Helper; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Helper\TableStyle; + +class TableStyleTest extends TestCase +{ + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH). + */ + public function testSetPadTypeWithInvalidType() + { + $style = new TableStyle(); + $style->setPadType('TEST'); + } +} diff --git a/application/vendor/symfony/console/Tests/Helper/TableTest.php b/application/vendor/symfony/console/Tests/Helper/TableTest.php new file mode 100644 index 0000000..0e98432 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Helper/TableTest.php @@ -0,0 +1,705 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Helper; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Helper\Table; +use Symfony\Component\Console\Helper\TableStyle; +use Symfony\Component\Console\Helper\TableSeparator; +use Symfony\Component\Console\Helper\TableCell; +use Symfony\Component\Console\Output\StreamOutput; + +class TableTest extends TestCase +{ + protected $stream; + + protected function setUp() + { + $this->stream = fopen('php://memory', 'r+'); + } + + protected function tearDown() + { + fclose($this->stream); + $this->stream = null; + } + + /** + * @dataProvider renderProvider + */ + public function testRender($headers, $rows, $style, $expected, $decorated = false) + { + $table = new Table($output = $this->getOutputStream($decorated)); + $table + ->setHeaders($headers) + ->setRows($rows) + ->setStyle($style) + ; + $table->render(); + + $this->assertEquals($expected, $this->getOutputContent($output)); + } + + /** + * @dataProvider renderProvider + */ + public function testRenderAddRows($headers, $rows, $style, $expected, $decorated = false) + { + $table = new Table($output = $this->getOutputStream($decorated)); + $table + ->setHeaders($headers) + ->addRows($rows) + ->setStyle($style) + ; + $table->render(); + + $this->assertEquals($expected, $this->getOutputContent($output)); + } + + /** + * @dataProvider renderProvider + */ + public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected, $decorated = false) + { + $table = new Table($output = $this->getOutputStream($decorated)); + $table + ->setHeaders($headers) + ->setStyle($style) + ; + foreach ($rows as $row) { + $table->addRow($row); + } + $table->render(); + + $this->assertEquals($expected, $this->getOutputContent($output)); + } + + public function renderProvider() + { + $books = array( + array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), + array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), + array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'), + array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), + ); + + return array( + array( + array('ISBN', 'Title', 'Author'), + $books, + 'default', +<<<'TABLE' ++---------------+--------------------------+------------------+ +| ISBN | Title | Author | ++---------------+--------------------------+------------------+ +| 99921-58-10-7 | Divine Comedy | Dante Alighieri | +| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | +| 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | +| 80-902734-1-6 | And Then There Were None | Agatha Christie | ++---------------+--------------------------+------------------+ + +TABLE + ), + array( + array('ISBN', 'Title', 'Author'), + $books, + 'compact', +<<<'TABLE' + ISBN Title Author + 99921-58-10-7 Divine Comedy Dante Alighieri + 9971-5-0210-0 A Tale of Two Cities Charles Dickens + 960-425-059-0 The Lord of the Rings J. R. R. Tolkien + 80-902734-1-6 And Then There Were None Agatha Christie + +TABLE + ), + array( + array('ISBN', 'Title', 'Author'), + $books, + 'borderless', +<<<'TABLE' + =============== ========================== ================== + ISBN Title Author + =============== ========================== ================== + 99921-58-10-7 Divine Comedy Dante Alighieri + 9971-5-0210-0 A Tale of Two Cities Charles Dickens + 960-425-059-0 The Lord of the Rings J. R. R. Tolkien + 80-902734-1-6 And Then There Were None Agatha Christie + =============== ========================== ================== + +TABLE + ), + array( + array('ISBN', 'Title'), + array( + array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), + array('9971-5-0210-0'), + array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'), + array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), + ), + 'default', +<<<'TABLE' ++---------------+--------------------------+------------------+ +| ISBN | Title | | ++---------------+--------------------------+------------------+ +| 99921-58-10-7 | Divine Comedy | Dante Alighieri | +| 9971-5-0210-0 | | | +| 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | +| 80-902734-1-6 | And Then There Were None | Agatha Christie | ++---------------+--------------------------+------------------+ + +TABLE + ), + array( + array(), + array( + array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), + array('9971-5-0210-0'), + array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'), + array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), + ), + 'default', +<<<'TABLE' ++---------------+--------------------------+------------------+ +| 99921-58-10-7 | Divine Comedy | Dante Alighieri | +| 9971-5-0210-0 | | | +| 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | +| 80-902734-1-6 | And Then There Were None | Agatha Christie | ++---------------+--------------------------+------------------+ + +TABLE + ), + array( + array('ISBN', 'Title', 'Author'), + array( + array('99921-58-10-7', "Divine\nComedy", 'Dante Alighieri'), + array('9971-5-0210-2', "Harry Potter\nand the Chamber of Secrets", "Rowling\nJoanne K."), + array('9971-5-0210-2', "Harry Potter\nand the Chamber of Secrets", "Rowling\nJoanne K."), + array('960-425-059-0', 'The Lord of the Rings', "J. R. R.\nTolkien"), + ), + 'default', +<<<'TABLE' ++---------------+----------------------------+-----------------+ +| ISBN | Title | Author | ++---------------+----------------------------+-----------------+ +| 99921-58-10-7 | Divine | Dante Alighieri | +| | Comedy | | +| 9971-5-0210-2 | Harry Potter | Rowling | +| | and the Chamber of Secrets | Joanne K. | +| 9971-5-0210-2 | Harry Potter | Rowling | +| | and the Chamber of Secrets | Joanne K. | +| 960-425-059-0 | The Lord of the Rings | J. R. R. | +| | | Tolkien | ++---------------+----------------------------+-----------------+ + +TABLE + ), + array( + array('ISBN', 'Title'), + array(), + 'default', +<<<'TABLE' ++------+-------+ +| ISBN | Title | ++------+-------+ + +TABLE + ), + array( + array(), + array(), + 'default', + '', + ), + 'Cell text with tags used for Output styling' => array( + array('ISBN', 'Title', 'Author'), + array( + array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), + array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), + ), + 'default', +<<<'TABLE' ++---------------+----------------------+-----------------+ +| ISBN | Title | Author | ++---------------+----------------------+-----------------+ +| 99921-58-10-7 | Divine Comedy | Dante Alighieri | +| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | ++---------------+----------------------+-----------------+ + +TABLE + ), + 'Cell text with tags not used for Output styling' => array( + array('ISBN', 'Title', 'Author'), + array( + array('99921-58-10-700', 'Divine Com', 'Dante Alighieri'), + array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), + ), + 'default', +<<<'TABLE' ++----------------------------------+----------------------+-----------------+ +| ISBN | Title | Author | ++----------------------------------+----------------------+-----------------+ +| 99921-58-10-700 | Divine Com | Dante Alighieri | +| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | ++----------------------------------+----------------------+-----------------+ + +TABLE + ), + 'Cell with colspan' => array( + array('ISBN', 'Title', 'Author'), + array( + array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), + new TableSeparator(), + array(new TableCell('Divine Comedy(Dante Alighieri)', array('colspan' => 3))), + new TableSeparator(), + array( + new TableCell('Arduino: A Quick-Start Guide', array('colspan' => 2)), + 'Mark Schmidt', + ), + new TableSeparator(), + array( + '9971-5-0210-0', + new TableCell("A Tale of \nTwo Cities", array('colspan' => 2)), + ), + new TableSeparator(), + array( + new TableCell('Cupiditate dicta atque porro, tempora exercitationem modi animi nulla nemo vel nihil!', array('colspan' => 3)), + ), + ), + 'default', +<<<'TABLE' ++-------------------------------+-------------------------------+-----------------------------+ +| ISBN | Title | Author | ++-------------------------------+-------------------------------+-----------------------------+ +| 99921-58-10-7 | Divine Comedy | Dante Alighieri | ++-------------------------------+-------------------------------+-----------------------------+ +| Divine Comedy(Dante Alighieri) | ++-------------------------------+-------------------------------+-----------------------------+ +| Arduino: A Quick-Start Guide | Mark Schmidt | ++-------------------------------+-------------------------------+-----------------------------+ +| 9971-5-0210-0 | A Tale of | +| | Two Cities | ++-------------------------------+-------------------------------+-----------------------------+ +| Cupiditate dicta atque porro, tempora exercitationem modi animi nulla nemo vel nihil! | ++-------------------------------+-------------------------------+-----------------------------+ + +TABLE + ), + 'Cell with rowspan' => array( + array('ISBN', 'Title', 'Author'), + array( + array( + new TableCell('9971-5-0210-0', array('rowspan' => 3)), + new TableCell('Divine Comedy', array('rowspan' => 2)), + 'Dante Alighieri', + ), + array(), + array("The Lord of \nthe Rings", "J. R. \nR. Tolkien"), + new TableSeparator(), + array('80-902734-1-6', new TableCell("And Then \nThere \nWere None", array('rowspan' => 3)), 'Agatha Christie'), + array('80-902734-1-7', 'Test'), + ), + 'default', +<<<'TABLE' ++---------------+---------------+-----------------+ +| ISBN | Title | Author | ++---------------+---------------+-----------------+ +| 9971-5-0210-0 | Divine Comedy | Dante Alighieri | +| | | | +| | The Lord of | J. R. | +| | the Rings | R. Tolkien | ++---------------+---------------+-----------------+ +| 80-902734-1-6 | And Then | Agatha Christie | +| 80-902734-1-7 | There | Test | +| | Were None | | ++---------------+---------------+-----------------+ + +TABLE + ), + 'Cell with rowspan and colspan' => array( + array('ISBN', 'Title', 'Author'), + array( + array( + new TableCell('9971-5-0210-0', array('rowspan' => 2, 'colspan' => 2)), + 'Dante Alighieri', + ), + array('Charles Dickens'), + new TableSeparator(), + array( + 'Dante Alighieri', + new TableCell('9971-5-0210-0', array('rowspan' => 3, 'colspan' => 2)), + ), + array('J. R. R. Tolkien'), + array('J. R. R'), + ), + 'default', +<<<'TABLE' ++------------------+---------+-----------------+ +| ISBN | Title | Author | ++------------------+---------+-----------------+ +| 9971-5-0210-0 | Dante Alighieri | +| | Charles Dickens | ++------------------+---------+-----------------+ +| Dante Alighieri | 9971-5-0210-0 | +| J. R. R. Tolkien | | +| J. R. R | | ++------------------+---------+-----------------+ + +TABLE + ), + 'Cell with rowspan and colspan contains new line break' => array( + array('ISBN', 'Title', 'Author'), + array( + array( + new TableCell("9971\n-5-\n021\n0-0", array('rowspan' => 2, 'colspan' => 2)), + 'Dante Alighieri', + ), + array('Charles Dickens'), + new TableSeparator(), + array( + 'Dante Alighieri', + new TableCell("9971\n-5-\n021\n0-0", array('rowspan' => 2, 'colspan' => 2)), + ), + array('Charles Dickens'), + new TableSeparator(), + array( + new TableCell("9971\n-5-\n021\n0-0", array('rowspan' => 2, 'colspan' => 2)), + new TableCell("Dante \nAlighieri", array('rowspan' => 2, 'colspan' => 1)), + ), + ), + 'default', +<<<'TABLE' ++-----------------+-------+-----------------+ +| ISBN | Title | Author | ++-----------------+-------+-----------------+ +| 9971 | Dante Alighieri | +| -5- | Charles Dickens | +| 021 | | +| 0-0 | | ++-----------------+-------+-----------------+ +| Dante Alighieri | 9971 | +| Charles Dickens | -5- | +| | 021 | +| | 0-0 | ++-----------------+-------+-----------------+ +| 9971 | Dante | +| -5- | Alighieri | +| 021 | | +| 0-0 | | ++-----------------+-------+-----------------+ + +TABLE + ), + 'Cell with rowspan and colspan without using TableSeparator' => array( + array('ISBN', 'Title', 'Author'), + array( + array( + new TableCell("9971\n-5-\n021\n0-0", array('rowspan' => 2, 'colspan' => 2)), + 'Dante Alighieri', + ), + array('Charles Dickens'), + array( + 'Dante Alighieri', + new TableCell("9971\n-5-\n021\n0-0", array('rowspan' => 2, 'colspan' => 2)), + ), + array('Charles Dickens'), + ), + 'default', +<<<'TABLE' ++-----------------+-------+-----------------+ +| ISBN | Title | Author | ++-----------------+-------+-----------------+ +| 9971 | Dante Alighieri | +| -5- | Charles Dickens | +| 021 | | +| 0-0 | | +| Dante Alighieri | 9971 | +| Charles Dickens | -5- | +| | 021 | +| | 0-0 | ++-----------------+-------+-----------------+ + +TABLE + ), + 'Cell with rowspan and colspan with separator inside a rowspan' => array( + array('ISBN', 'Author'), + array( + array( + new TableCell('9971-5-0210-0', array('rowspan' => 3, 'colspan' => 1)), + 'Dante Alighieri', + ), + array(new TableSeparator()), + array('Charles Dickens'), + ), + 'default', +<<<'TABLE' ++---------------+-----------------+ +| ISBN | Author | ++---------------+-----------------+ +| 9971-5-0210-0 | Dante Alighieri | +| |-----------------| +| | Charles Dickens | ++---------------+-----------------+ + +TABLE + ), + 'Multiple header lines' => array( + array( + array(new TableCell('Main title', array('colspan' => 3))), + array('ISBN', 'Title', 'Author'), + ), + array(), + 'default', +<<<'TABLE' ++------+-------+--------+ +| Main title | ++------+-------+--------+ +| ISBN | Title | Author | ++------+-------+--------+ + +TABLE + ), + 'Row with multiple cells' => array( + array(), + array( + array( + new TableCell('1', array('colspan' => 3)), + new TableCell('2', array('colspan' => 2)), + new TableCell('3', array('colspan' => 2)), + new TableCell('4', array('colspan' => 2)), + ), + ), + 'default', +<<<'TABLE' ++---+--+--+---+--+---+--+---+--+ +| 1 | 2 | 3 | 4 | ++---+--+--+---+--+---+--+---+--+ + +TABLE + ), + 'Coslpan and table cells with comment style' => array( + array( + new TableCell('Long Title', array('colspan' => 3)), + ), + array( + array( + new TableCell('9971-5-0210-0', array('colspan' => 3)), + ), + new TableSeparator(), + array( + 'Dante Alighieri', + 'J. R. R. Tolkien', + 'J. R. R', + ), + ), + 'default', + <<
    array( + array(), + array( + array( + new TableCell('Dont break'."\n".'here', array('colspan' => 2)), + ), + new TableSeparator(), + array( + 'foo', + new TableCell('Dont break'."\n".'here', array('rowspan' => 2)), + ), + array( + 'bar', + ), + ), + 'default', + <<<'TABLE' ++-------+------------+ +| Dont break | +| here | ++-------+------------+ +| foo | Dont break | +| bar | here | ++-------+------------+ + +TABLE + , + true, + ), + ); + } + + /** + * @requires extension mbstring + */ + public function testRenderMultiByte() + { + $table = new Table($output = $this->getOutputStream()); + $table + ->setHeaders(array('■■')) + ->setRows(array(array(1234))) + ->setStyle('default') + ; + $table->render(); + + $expected = +<<<'TABLE' ++------+ +| ■■ | ++------+ +| 1234 | ++------+ + +TABLE; + + $this->assertEquals($expected, $this->getOutputContent($output)); + } + + public function testTableCellWithNumericIntValue() + { + $table = new Table($output = $this->getOutputStream()); + + $table->setRows(array(array(new TableCell(12345)))); + $table->render(); + + $expected = +<<<'TABLE' ++-------+ +| 12345 | ++-------+ + +TABLE; + + $this->assertEquals($expected, $this->getOutputContent($output)); + } + + public function testTableCellWithNumericFloatValue() + { + $table = new Table($output = $this->getOutputStream()); + + $table->setRows(array(array(new TableCell(12345.01)))); + $table->render(); + + $expected = +<<<'TABLE' ++----------+ +| 12345.01 | ++----------+ + +TABLE; + + $this->assertEquals($expected, $this->getOutputContent($output)); + } + + public function testStyle() + { + $style = new TableStyle(); + $style + ->setHorizontalBorderChar('.') + ->setVerticalBorderChar('.') + ->setCrossingChar('.') + ; + + Table::setStyleDefinition('dotfull', $style); + $table = new Table($output = $this->getOutputStream()); + $table + ->setHeaders(array('Foo')) + ->setRows(array(array('Bar'))) + ->setStyle('dotfull'); + $table->render(); + + $expected = +<<<'TABLE' +....... +. Foo . +....... +. Bar . +....... + +TABLE; + + $this->assertEquals($expected, $this->getOutputContent($output)); + } + + public function testRowSeparator() + { + $table = new Table($output = $this->getOutputStream()); + $table + ->setHeaders(array('Foo')) + ->setRows(array( + array('Bar1'), + new TableSeparator(), + array('Bar2'), + new TableSeparator(), + array('Bar3'), + )); + $table->render(); + + $expected = +<<<'TABLE' ++------+ +| Foo | ++------+ +| Bar1 | ++------+ +| Bar2 | ++------+ +| Bar3 | ++------+ + +TABLE; + + $this->assertEquals($expected, $this->getOutputContent($output)); + + $this->assertEquals($table, $table->addRow(new TableSeparator()), 'fluent interface on addRow() with a single TableSeparator() works'); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Style "absent" is not defined. + */ + public function testIsNotDefinedStyleException() + { + $table = new Table($this->getOutputStream()); + $table->setStyle('absent'); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Style "absent" is not defined. + */ + public function testGetStyleDefinition() + { + Table::getStyleDefinition('absent'); + } + + protected function getOutputStream($decorated = false) + { + return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, $decorated); + } + + protected function getOutputContent(StreamOutput $output) + { + rewind($output->getStream()); + + return str_replace(PHP_EOL, "\n", stream_get_contents($output->getStream())); + } +} diff --git a/application/vendor/symfony/console/Tests/Input/ArgvInputTest.php b/application/vendor/symfony/console/Tests/Input/ArgvInputTest.php new file mode 100644 index 0000000..5f813ee --- /dev/null +++ b/application/vendor/symfony/console/Tests/Input/ArgvInputTest.php @@ -0,0 +1,416 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Input; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Input\ArgvInput; +use Symfony\Component\Console\Input\InputDefinition; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; + +class ArgvInputTest extends TestCase +{ + public function testConstructor() + { + $_SERVER['argv'] = array('cli.php', 'foo'); + $input = new ArgvInput(); + $r = new \ReflectionObject($input); + $p = $r->getProperty('tokens'); + $p->setAccessible(true); + + $this->assertEquals(array('foo'), $p->getValue($input), '__construct() automatically get its input from the argv server variable'); + } + + public function testParseArguments() + { + $input = new ArgvInput(array('cli.php', 'foo')); + $input->bind(new InputDefinition(array(new InputArgument('name')))); + $this->assertEquals(array('name' => 'foo'), $input->getArguments(), '->parse() parses required arguments'); + + $input->bind(new InputDefinition(array(new InputArgument('name')))); + $this->assertEquals(array('name' => 'foo'), $input->getArguments(), '->parse() is stateless'); + } + + /** + * @dataProvider provideOptions + */ + public function testParseOptions($input, $options, $expectedOptions, $message) + { + $input = new ArgvInput($input); + $input->bind(new InputDefinition($options)); + + $this->assertEquals($expectedOptions, $input->getOptions(), $message); + } + + public function provideOptions() + { + return array( + array( + array('cli.php', '--foo'), + array(new InputOption('foo')), + array('foo' => true), + '->parse() parses long options without a value', + ), + array( + array('cli.php', '--foo=bar'), + array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), + array('foo' => 'bar'), + '->parse() parses long options with a required value (with a = separator)', + ), + array( + array('cli.php', '--foo', 'bar'), + array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), + array('foo' => 'bar'), + '->parse() parses long options with a required value (with a space separator)', + ), + array( + array('cli.php', '--foo='), + array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)), + array('foo' => null), + '->parse() parses long options with optional value which is empty (with a = separator) as null', + ), + array( + array('cli.php', '--foo=', 'bar'), + array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)), + array('foo' => null), + '->parse() parses long options with optional value which is empty (with a = separator) followed by an argument', + ), + array( + array('cli.php', '-f'), + array(new InputOption('foo', 'f')), + array('foo' => true), + '->parse() parses short options without a value', + ), + array( + array('cli.php', '-fbar'), + array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), + array('foo' => 'bar'), + '->parse() parses short options with a required value (with no separator)', + ), + array( + array('cli.php', '-f', 'bar'), + array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), + array('foo' => 'bar'), + '->parse() parses short options with a required value (with a space separator)', + ), + array( + array('cli.php', '-f', ''), + array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)), + array('foo' => ''), + '->parse() parses short options with an optional empty value', + ), + array( + array('cli.php', '-f', '', 'foo'), + array(new InputArgument('name'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)), + array('foo' => ''), + '->parse() parses short options with an optional empty value followed by an argument', + ), + array( + array('cli.php', '-f', '', '-b'), + array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b')), + array('foo' => '', 'bar' => true), + '->parse() parses short options with an optional empty value followed by an option', + ), + array( + array('cli.php', '-f', '-b', 'foo'), + array(new InputArgument('name'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b')), + array('foo' => null, 'bar' => true), + '->parse() parses short options with an optional value which is not present', + ), + array( + array('cli.php', '-fb'), + array(new InputOption('foo', 'f'), new InputOption('bar', 'b')), + array('foo' => true, 'bar' => true), + '->parse() parses short options when they are aggregated as a single one', + ), + array( + array('cli.php', '-fb', 'bar'), + array(new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_REQUIRED)), + array('foo' => true, 'bar' => 'bar'), + '->parse() parses short options when they are aggregated as a single one and the last one has a required value', + ), + array( + array('cli.php', '-fb', 'bar'), + array(new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)), + array('foo' => true, 'bar' => 'bar'), + '->parse() parses short options when they are aggregated as a single one and the last one has an optional value', + ), + array( + array('cli.php', '-fbbar'), + array(new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)), + array('foo' => true, 'bar' => 'bar'), + '->parse() parses short options when they are aggregated as a single one and the last one has an optional value with no separator', + ), + array( + array('cli.php', '-fbbar'), + array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)), + array('foo' => 'bbar', 'bar' => null), + '->parse() parses short options when they are aggregated as a single one and one of them takes a value', + ), + ); + } + + /** + * @dataProvider provideInvalidInput + */ + public function testInvalidInput($argv, $definition, $expectedExceptionMessage) + { + if (method_exists($this, 'expectException')) { + $this->expectException('RuntimeException'); + $this->expectExceptionMessage($expectedExceptionMessage); + } else { + $this->setExpectedException('RuntimeException', $expectedExceptionMessage); + } + + $input = new ArgvInput($argv); + $input->bind($definition); + } + + public function provideInvalidInput() + { + return array( + array( + array('cli.php', '--foo'), + new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))), + 'The "--foo" option requires a value.', + ), + array( + array('cli.php', '-f'), + new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))), + 'The "--foo" option requires a value.', + ), + array( + array('cli.php', '-ffoo'), + new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_NONE))), + 'The "-o" option does not exist.', + ), + array( + array('cli.php', '--foo=bar'), + new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_NONE))), + 'The "--foo" option does not accept a value.', + ), + array( + array('cli.php', 'foo', 'bar'), + new InputDefinition(), + 'No arguments expected, got "foo".', + ), + array( + array('cli.php', 'foo', 'bar'), + new InputDefinition(array(new InputArgument('number'))), + 'Too many arguments, expected arguments "number".', + ), + array( + array('cli.php', 'foo', 'bar', 'zzz'), + new InputDefinition(array(new InputArgument('number'), new InputArgument('county'))), + 'Too many arguments, expected arguments "number" "county".', + ), + array( + array('cli.php', '--foo'), + new InputDefinition(), + 'The "--foo" option does not exist.', + ), + array( + array('cli.php', '-f'), + new InputDefinition(), + 'The "-f" option does not exist.', + ), + array( + array('cli.php', '-1'), + new InputDefinition(array(new InputArgument('number'))), + 'The "-1" option does not exist.', + ), + ); + } + + public function testParseArrayArgument() + { + $input = new ArgvInput(array('cli.php', 'foo', 'bar', 'baz', 'bat')); + $input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::IS_ARRAY)))); + + $this->assertEquals(array('name' => array('foo', 'bar', 'baz', 'bat')), $input->getArguments(), '->parse() parses array arguments'); + } + + public function testParseArrayOption() + { + $input = new ArgvInput(array('cli.php', '--name=foo', '--name=bar', '--name=baz')); + $input->bind(new InputDefinition(array(new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); + + $this->assertEquals(array('name' => array('foo', 'bar', 'baz')), $input->getOptions(), '->parse() parses array options ("--option=value" syntax)'); + + $input = new ArgvInput(array('cli.php', '--name', 'foo', '--name', 'bar', '--name', 'baz')); + $input->bind(new InputDefinition(array(new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); + $this->assertEquals(array('name' => array('foo', 'bar', 'baz')), $input->getOptions(), '->parse() parses array options ("--option value" syntax)'); + + $input = new ArgvInput(array('cli.php', '--name=foo', '--name=bar', '--name=')); + $input->bind(new InputDefinition(array(new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); + $this->assertSame(array('name' => array('foo', 'bar', null)), $input->getOptions(), '->parse() parses empty array options as null ("--option=value" syntax)'); + + $input = new ArgvInput(array('cli.php', '--name', 'foo', '--name', 'bar', '--name', '--anotherOption')); + $input->bind(new InputDefinition(array( + new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY), + new InputOption('anotherOption', null, InputOption::VALUE_NONE), + ))); + $this->assertSame(array('name' => array('foo', 'bar', null), 'anotherOption' => true), $input->getOptions(), '->parse() parses empty array options as null ("--option value" syntax)'); + } + + public function testParseNegativeNumberAfterDoubleDash() + { + $input = new ArgvInput(array('cli.php', '--', '-1')); + $input->bind(new InputDefinition(array(new InputArgument('number')))); + $this->assertEquals(array('number' => '-1'), $input->getArguments(), '->parse() parses arguments with leading dashes as arguments after having encountered a double-dash sequence'); + + $input = new ArgvInput(array('cli.php', '-f', 'bar', '--', '-1')); + $input->bind(new InputDefinition(array(new InputArgument('number'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)))); + $this->assertEquals(array('foo' => 'bar'), $input->getOptions(), '->parse() parses arguments with leading dashes as options before having encountered a double-dash sequence'); + $this->assertEquals(array('number' => '-1'), $input->getArguments(), '->parse() parses arguments with leading dashes as arguments after having encountered a double-dash sequence'); + } + + public function testParseEmptyStringArgument() + { + $input = new ArgvInput(array('cli.php', '-f', 'bar', '')); + $input->bind(new InputDefinition(array(new InputArgument('empty'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)))); + + $this->assertEquals(array('empty' => ''), $input->getArguments(), '->parse() parses empty string arguments'); + } + + public function testGetFirstArgument() + { + $input = new ArgvInput(array('cli.php', '-fbbar')); + $this->assertNull($input->getFirstArgument(), '->getFirstArgument() returns null when there is no arguments'); + + $input = new ArgvInput(array('cli.php', '-fbbar', 'foo')); + $this->assertEquals('foo', $input->getFirstArgument(), '->getFirstArgument() returns the first argument from the raw input'); + } + + public function testHasParameterOption() + { + $input = new ArgvInput(array('cli.php', '-f', 'foo')); + $this->assertTrue($input->hasParameterOption('-f'), '->hasParameterOption() returns true if the given short option is in the raw input'); + + $input = new ArgvInput(array('cli.php', '-etest')); + $this->assertTrue($input->hasParameterOption('-e'), '->hasParameterOption() returns true if the given short option is in the raw input'); + $this->assertFalse($input->hasParameterOption('-s'), '->hasParameterOption() returns true if the given short option is in the raw input'); + + $input = new ArgvInput(array('cli.php', '--foo', 'foo')); + $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input'); + + $input = new ArgvInput(array('cli.php', 'foo')); + $this->assertFalse($input->hasParameterOption('--foo'), '->hasParameterOption() returns false if the given short option is not in the raw input'); + + $input = new ArgvInput(array('cli.php', '--foo=bar')); + $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given option with provided value is in the raw input'); + } + + public function testHasParameterOptionEdgeCasesAndLimitations() + { + $input = new ArgvInput(array('cli.php', '-fh')); + // hasParameterOption does not know if the previous short option, -f, + // takes a value or not. If -f takes a value, then -fh does NOT include + // -h; Otherwise it does. Since we do not know which short options take + // values, hasParameterOption does not support this use-case. + $this->assertFalse($input->hasParameterOption('-h'), '->hasParameterOption() returns true if the given short option is in the raw input'); + // hasParameterOption does detect that `-fh` contains `-f`, since + // `-f` is the first short option in the set. + $this->assertTrue($input->hasParameterOption('-f'), '->hasParameterOption() returns true if the given short option is in the raw input'); + // The test below happens to pass, although it might make more sense + // to disallow it, and require the use of + // $input->hasParameterOption('-f') && $input->hasParameterOption('-h') + // instead. + $this->assertTrue($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input'); + // In theory, if -fh is supported, then -hf should also work. + // However, this is not supported. + $this->assertFalse($input->hasParameterOption('-hf'), '->hasParameterOption() returns true if the given short option is in the raw input'); + + $input = new ArgvInput(array('cli.php', '-f', '-h')); + // If hasParameterOption('-fh') is supported for 'cli.php -fh', then + // one might also expect that it should also be supported for + // 'cli.php -f -h'. However, this is not supported. + $this->assertFalse($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input'); + } + + public function testNoWarningOnInvalidParameterOption() + { + $input = new ArgvInput(array('cli.php', '-edev')); + + $this->assertTrue($input->hasParameterOption(array('-e', ''))); + // No warning thrown + $this->assertFalse($input->hasParameterOption(array('-m', ''))); + + $this->assertEquals('dev', $input->getParameterOption(array('-e', ''))); + // No warning thrown + $this->assertFalse($input->getParameterOption(array('-m', ''))); + } + + public function testToString() + { + $input = new ArgvInput(array('cli.php', '-f', 'foo')); + $this->assertEquals('-f foo', (string) $input); + + $input = new ArgvInput(array('cli.php', '-f', '--bar=foo', 'a b c d', "A\nB'C")); + $this->assertEquals('-f --bar=foo '.escapeshellarg('a b c d').' '.escapeshellarg("A\nB'C"), (string) $input); + } + + /** + * @dataProvider provideGetParameterOptionValues + */ + public function testGetParameterOptionEqualSign($argv, $key, $expected) + { + $input = new ArgvInput($argv); + $this->assertEquals($expected, $input->getParameterOption($key), '->getParameterOption() returns the expected value'); + } + + public function provideGetParameterOptionValues() + { + return array( + array(array('app/console', 'foo:bar', '-edev'), '-e', 'dev'), + array(array('app/console', 'foo:bar', '-e', 'dev'), '-e', 'dev'), + array(array('app/console', 'foo:bar', '--env=dev'), '--env', 'dev'), + array(array('app/console', 'foo:bar', '-e', 'dev'), array('-e', '--env'), 'dev'), + array(array('app/console', 'foo:bar', '--env=dev'), array('-e', '--env'), 'dev'), + array(array('app/console', 'foo:bar', '--env=dev', '--en=1'), array('--en'), '1'), + array(array('app/console', 'foo:bar', '--env=dev', '', '--en=1'), array('--en'), '1'), + ); + } + + public function testParseSingleDashAsArgument() + { + $input = new ArgvInput(array('cli.php', '-')); + $input->bind(new InputDefinition(array(new InputArgument('file')))); + $this->assertEquals(array('file' => '-'), $input->getArguments(), '->parse() parses single dash as an argument'); + } + + public function testParseOptionWithValueOptionalGivenEmptyAndRequiredArgument() + { + $input = new ArgvInput(array('cli.php', '--foo=', 'bar')); + $input->bind(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)))); + $this->assertEquals(array('foo' => null), $input->getOptions(), '->parse() parses optional options with empty value as null'); + $this->assertEquals(array('name' => 'bar'), $input->getArguments(), '->parse() parses required arguments'); + + $input = new ArgvInput(array('cli.php', '--foo=0', 'bar')); + $input->bind(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)))); + $this->assertEquals(array('foo' => '0'), $input->getOptions(), '->parse() parses optional options with empty value as null'); + $this->assertEquals(array('name' => 'bar'), $input->getArguments(), '->parse() parses required arguments'); + } + + public function testParseOptionWithValueOptionalGivenEmptyAndOptionalArgument() + { + $input = new ArgvInput(array('cli.php', '--foo=', 'bar')); + $input->bind(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::OPTIONAL)))); + $this->assertEquals(array('foo' => null), $input->getOptions(), '->parse() parses optional options with empty value as null'); + $this->assertEquals(array('name' => 'bar'), $input->getArguments(), '->parse() parses optional arguments'); + + $input = new ArgvInput(array('cli.php', '--foo=0', 'bar')); + $input->bind(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::OPTIONAL)))); + $this->assertEquals(array('foo' => '0'), $input->getOptions(), '->parse() parses optional options with empty value as null'); + $this->assertEquals(array('name' => 'bar'), $input->getArguments(), '->parse() parses optional arguments'); + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/ArrayInputTest.php b/application/vendor/symfony/console/Tests/Input/ArrayInputTest.php similarity index 87% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/ArrayInputTest.php rename to application/vendor/symfony/console/Tests/Input/ArrayInputTest.php index cc89083..b998172 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/ArrayInputTest.php +++ b/application/vendor/symfony/console/Tests/Input/ArrayInputTest.php @@ -11,12 +11,13 @@ namespace Symfony\Component\Console\Tests\Input; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; -class ArrayInputTest extends \PHPUnit_Framework_TestCase +class ArrayInputTest extends TestCase { public function testGetFirstArgument() { @@ -99,7 +100,12 @@ public function provideOptions() */ public function testParseInvalidInput($parameters, $definition, $expectedExceptionMessage) { - $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage); + if (method_exists($this, 'expectException')) { + $this->expectException('InvalidArgumentException'); + $this->expectExceptionMessage($expectedExceptionMessage); + } else { + $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage); + } new ArrayInput($parameters, $definition); } @@ -134,5 +140,11 @@ public function testToString() { $input = new ArrayInput(array('-f' => null, '-b' => 'bar', '--foo' => 'b a z', '--lala' => null, 'test' => 'Foo', 'test2' => "A\nB'C")); $this->assertEquals('-f -b=bar --foo='.escapeshellarg('b a z').' --lala Foo '.escapeshellarg("A\nB'C"), (string) $input); + + $input = new ArrayInput(array('-b' => array('bval_1', 'bval_2'), '--f' => array('fval_1', 'fval_2'))); + $this->assertSame('-b=bval_1 -b=bval_2 --f=fval_1 --f=fval_2', (string) $input); + + $input = new ArrayInput(array('array_arg' => array('val_1', 'val_2'))); + $this->assertSame('val_1 val_2', (string) $input); } } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/InputArgumentTest.php b/application/vendor/symfony/console/Tests/Input/InputArgumentTest.php similarity index 90% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/InputArgumentTest.php rename to application/vendor/symfony/console/Tests/Input/InputArgumentTest.php index cfb37cd..66af98b 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/InputArgumentTest.php +++ b/application/vendor/symfony/console/Tests/Input/InputArgumentTest.php @@ -11,9 +11,10 @@ namespace Symfony\Component\Console\Tests\Input; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\InputArgument; -class InputArgumentTest extends \PHPUnit_Framework_TestCase +class InputArgumentTest extends TestCase { public function testConstructor() { @@ -41,7 +42,12 @@ public function testModes() */ public function testInvalidModes($mode) { - $this->setExpectedException('InvalidArgumentException', sprintf('Argument mode "%s" is not valid.', $mode)); + if (method_exists($this, 'expectException')) { + $this->expectException('InvalidArgumentException'); + $this->expectExceptionMessage(sprintf('Argument mode "%s" is not valid.', $mode)); + } else { + $this->setExpectedException('InvalidArgumentException', sprintf('Argument mode "%s" is not valid.', $mode)); + } new InputArgument('foo', $mode); } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php b/application/vendor/symfony/console/Tests/Input/InputDefinitionTest.php similarity index 88% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php rename to application/vendor/symfony/console/Tests/Input/InputDefinitionTest.php index ce0654d..b19708e 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php +++ b/application/vendor/symfony/console/Tests/Input/InputDefinitionTest.php @@ -11,15 +11,19 @@ namespace Symfony\Component\Console\Tests\Input; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; -class InputDefinitionTest extends \PHPUnit_Framework_TestCase +class InputDefinitionTest extends TestCase { protected static $fixtures; - protected $foo, $bar, $foo1, $foo2; + protected $foo; + protected $bar; + protected $foo1; + protected $foo2; public static function setUpBeforeClass() { @@ -352,25 +356,35 @@ public function testGetOptionDefaults() $this->assertSame($defaults, $definition->getOptionDefaults(), '->getOptionDefaults() returns the default values for all options'); } - public function testGetSynopsis() + /** + * @dataProvider getGetSynopsisData + */ + public function testGetSynopsis(InputDefinition $definition, $expectedSynopsis, $message = null) { - $definition = new InputDefinition(array(new InputOption('foo'))); - $this->assertEquals('[--foo]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); - $definition = new InputDefinition(array(new InputOption('foo', 'f'))); - $this->assertEquals('[-f|--foo]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); - $definition = new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))); - $this->assertEquals('[-f|--foo="..."]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); - $definition = new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL))); - $this->assertEquals('[-f|--foo[="..."]]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); + $this->assertEquals($expectedSynopsis, $definition->getSynopsis(), $message ? '->getSynopsis() '.$message : ''); + } - $definition = new InputDefinition(array(new InputArgument('foo'))); - $this->assertEquals('[foo]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); - $definition = new InputDefinition(array(new InputArgument('foo', InputArgument::REQUIRED))); - $this->assertEquals('foo', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); - $definition = new InputDefinition(array(new InputArgument('foo', InputArgument::IS_ARRAY))); - $this->assertEquals('[foo1] ... [fooN]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); - $definition = new InputDefinition(array(new InputArgument('foo', InputArgument::REQUIRED | InputArgument::IS_ARRAY))); - $this->assertEquals('foo1 ... [fooN]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options'); + public function getGetSynopsisData() + { + return array( + array(new InputDefinition(array(new InputOption('foo'))), '[--foo]', 'puts optional options in square brackets'), + array(new InputDefinition(array(new InputOption('foo', 'f'))), '[-f|--foo]', 'separates shortcut with a pipe'), + array(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))), '[-f|--foo FOO]', 'uses shortcut as value placeholder'), + array(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL))), '[-f|--foo [FOO]]', 'puts optional values in square brackets'), + + array(new InputDefinition(array(new InputArgument('foo', InputArgument::REQUIRED))), '', 'puts arguments in angle brackets'), + array(new InputDefinition(array(new InputArgument('foo'))), '[]', 'puts optional arguments in square brackets'), + array(new InputDefinition(array(new InputArgument('foo', InputArgument::IS_ARRAY))), '[]...', 'uses an ellipsis for array arguments'), + array(new InputDefinition(array(new InputArgument('foo', InputArgument::REQUIRED | InputArgument::IS_ARRAY))), ' ()...', 'uses parenthesis and ellipsis for required array arguments'), + + array(new InputDefinition(array(new InputOption('foo'), new InputArgument('foo', InputArgument::REQUIRED))), '[--foo] [--] ', 'puts [--] between options and arguments'), + ); + } + + public function testGetShortSynopsis() + { + $definition = new InputDefinition(array(new InputOption('foo'), new InputOption('bar'), new InputArgument('cat'))); + $this->assertEquals('[options] [--] []', $definition->getSynopsis(true), '->getSynopsis(true) groups options in [options]'); } /** @@ -378,8 +392,6 @@ public function testGetSynopsis() */ public function testLegacyAsText() { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - $definition = new InputDefinition(array( new InputArgument('foo', InputArgument::OPTIONAL, 'The foo argument'), new InputArgument('baz', InputArgument::OPTIONAL, 'The baz argument', true), @@ -390,6 +402,7 @@ public function testLegacyAsText() new InputOption('qux', '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The qux option', array('http://foo.com/', 'bar')), new InputOption('qux2', '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The qux2 option', array('foo' => 'bar')), )); + $this->assertStringEqualsFile(self::$fixtures.'/definition_astext.txt', $definition->asText(), '->asText() returns a textual representation of the InputDefinition'); } @@ -398,8 +411,6 @@ public function testLegacyAsText() */ public function testLegacyAsXml() { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - $definition = new InputDefinition(array( new InputArgument('foo', InputArgument::OPTIONAL, 'The foo argument'), new InputArgument('baz', InputArgument::OPTIONAL, 'The baz argument', true), diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/InputOptionTest.php b/application/vendor/symfony/console/Tests/Input/InputOptionTest.php similarity index 95% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/InputOptionTest.php rename to application/vendor/symfony/console/Tests/Input/InputOptionTest.php index 53ce1df..943bf60 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/InputOptionTest.php +++ b/application/vendor/symfony/console/Tests/Input/InputOptionTest.php @@ -11,9 +11,10 @@ namespace Symfony\Component\Console\Tests\Input; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\InputOption; -class InputOptionTest extends \PHPUnit_Framework_TestCase +class InputOptionTest extends TestCase { public function testConstructor() { @@ -77,7 +78,12 @@ public function testModes() */ public function testInvalidModes($mode) { - $this->setExpectedException('InvalidArgumentException', sprintf('Option mode "%s" is not valid.', $mode)); + if (method_exists($this, 'expectException')) { + $this->expectException('InvalidArgumentException'); + $this->expectExceptionMessage(sprintf('Option mode "%s" is not valid.', $mode)); + } else { + $this->setExpectedException('InvalidArgumentException', sprintf('Option mode "%s" is not valid.', $mode)); + } new InputOption('foo', 'f', $mode); } diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/InputTest.php b/application/vendor/symfony/console/Tests/Input/InputTest.php similarity index 90% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/InputTest.php rename to application/vendor/symfony/console/Tests/Input/InputTest.php index 0b3e38f..42abd82 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/InputTest.php +++ b/application/vendor/symfony/console/Tests/Input/InputTest.php @@ -11,12 +11,13 @@ namespace Symfony\Component\Console\Tests\Input; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; -class InputTest extends \PHPUnit_Framework_TestCase +class InputTest extends TestCase { public function testConstructor() { @@ -94,7 +95,7 @@ public function testGetInvalidArgument() /** * @expectedException \RuntimeException - * @expectedExceptionMessage Not enough arguments. + * @expectedExceptionMessage Not enough arguments (missing: "name"). */ public function testValidateWithMissingArguments() { @@ -103,6 +104,17 @@ public function testValidateWithMissingArguments() $input->validate(); } + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage Not enough arguments (missing: "name"). + */ + public function testValidateWithMissingRequiredArguments() + { + $input = new ArrayInput(array('bar' => 'baz')); + $input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::REQUIRED), new InputArgument('bar', InputArgument::OPTIONAL)))); + $input->validate(); + } + public function testValidate() { $input = new ArrayInput(array('name' => 'foo')); diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/StringInputTest.php b/application/vendor/symfony/console/Tests/Input/StringInputTest.php similarity index 94% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/StringInputTest.php rename to application/vendor/symfony/console/Tests/Input/StringInputTest.php index 575d527..839af73 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Input/StringInputTest.php +++ b/application/vendor/symfony/console/Tests/Input/StringInputTest.php @@ -11,11 +11,12 @@ namespace Symfony\Component\Console\Tests\Input; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\StringInput; -class StringInputTest extends \PHPUnit_Framework_TestCase +class StringInputTest extends TestCase { /** * @dataProvider getTokenizeData @@ -46,8 +47,6 @@ public function testInputOptionWithGivenString() */ public function testLegacyInputOptionDefinitionInConstructor() { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - $definition = new InputDefinition( array(new InputOption('foo', null, InputOption::VALUE_REQUIRED)) ); @@ -65,7 +64,7 @@ public function getTokenizeData() array('"quoted"', array('quoted'), '->tokenize() parses quoted arguments'), array("'quoted'", array('quoted'), '->tokenize() parses quoted arguments'), array("'a\rb\nc\td'", array("a\rb\nc\td"), '->tokenize() parses whitespace chars in strings'), - array("'a'\r'b'\n'c'\t'd'", array('a','b','c','d'), '->tokenize() parses whitespace chars between args as spaces'), + array("'a'\r'b'\n'c'\t'd'", array('a', 'b', 'c', 'd'), '->tokenize() parses whitespace chars between args as spaces'), array('\"quoted\"', array('"quoted"'), '->tokenize() parses escaped-quoted arguments'), array("\'quoted\'", array('\'quoted\''), '->tokenize() parses escaped-quoted arguments'), array('-a', array('-a'), '->tokenize() parses short options'), diff --git a/application/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php b/application/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php new file mode 100644 index 0000000..dac911b --- /dev/null +++ b/application/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php @@ -0,0 +1,171 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Logger; + +use PHPUnit\Framework\TestCase; +use Psr\Log\LoggerInterface; +use Psr\Log\LogLevel; +use Symfony\Component\Console\Logger\ConsoleLogger; +use Symfony\Component\Console\Tests\Fixtures\DummyOutput; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Console logger test. + * + * @author Kévin Dunglas + * @author Jordi Boggiano + */ +class ConsoleLoggerTest extends TestCase +{ + /** + * @var DummyOutput + */ + protected $output; + + /** + * @return LoggerInterface + */ + public function getLogger() + { + $this->output = new DummyOutput(OutputInterface::VERBOSITY_VERBOSE); + + return new ConsoleLogger($this->output, array( + LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL, + LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL, + LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL, + LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL, + LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL, + LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL, + LogLevel::INFO => OutputInterface::VERBOSITY_NORMAL, + LogLevel::DEBUG => OutputInterface::VERBOSITY_NORMAL, + )); + } + + /** + * Return the log messages in order. + * + * @return string[] + */ + public function getLogs() + { + return $this->output->getLogs(); + } + + public function testImplements() + { + $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger()); + } + + /** + * @dataProvider provideLevelsAndMessages + */ + public function testLogsAtAllLevels($level, $message) + { + $logger = $this->getLogger(); + $logger->{$level}($message, array('user' => 'Bob')); + $logger->log($level, $message, array('user' => 'Bob')); + + $expected = array( + $level.' message of level '.$level.' with context: Bob', + $level.' message of level '.$level.' with context: Bob', + ); + $this->assertEquals($expected, $this->getLogs()); + } + + public function provideLevelsAndMessages() + { + return array( + LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), + LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), + LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), + LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), + LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), + LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), + LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), + LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), + ); + } + + /** + * @expectedException \Psr\Log\InvalidArgumentException + */ + public function testThrowsOnInvalidLevel() + { + $logger = $this->getLogger(); + $logger->log('invalid level', 'Foo'); + } + + public function testContextReplacement() + { + $logger = $this->getLogger(); + $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); + + $expected = array('info {Message {nothing} Bob Bar a}'); + $this->assertEquals($expected, $this->getLogs()); + } + + public function testObjectCastToString() + { + if (method_exists($this, 'createPartialMock')) { + $dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', array('__toString')); + } else { + $dummy = $this->getMock('Symfony\Component\Console\Tests\Logger\DummyTest', array('__toString')); + } + $dummy->expects($this->once()) + ->method('__toString') + ->will($this->returnValue('DUMMY')); + + $this->getLogger()->warning($dummy); + + $expected = array('warning DUMMY'); + $this->assertEquals($expected, $this->getLogs()); + } + + public function testContextCanContainAnything() + { + $context = array( + 'bool' => true, + 'null' => null, + 'string' => 'Foo', + 'int' => 0, + 'float' => 0.5, + 'nested' => array('with object' => new DummyTest()), + 'object' => new \DateTime(), + 'resource' => fopen('php://memory', 'r'), + ); + + $this->getLogger()->warning('Crazy context data', $context); + + $expected = array('warning Crazy context data'); + $this->assertEquals($expected, $this->getLogs()); + } + + public function testContextExceptionKeyCanBeExceptionOrOtherValues() + { + $logger = $this->getLogger(); + $logger->warning('Random message', array('exception' => 'oops')); + $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); + + $expected = array( + 'warning Random message', + 'critical Uncaught Exception!', + ); + $this->assertEquals($expected, $this->getLogs()); + } +} + +class DummyTest +{ + public function __toString() + { + } +} diff --git a/application/vendor/symfony/console/Tests/Output/ConsoleOutputTest.php b/application/vendor/symfony/console/Tests/Output/ConsoleOutputTest.php new file mode 100644 index 0000000..db39a02 --- /dev/null +++ b/application/vendor/symfony/console/Tests/Output/ConsoleOutputTest.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Output; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\Console\Output\Output; + +class ConsoleOutputTest extends TestCase +{ + public function testConstructor() + { + $output = new ConsoleOutput(Output::VERBOSITY_QUIET, true); + $this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity(), '__construct() takes the verbosity as its first argument'); + $this->assertSame($output->getFormatter(), $output->getErrorOutput()->getFormatter(), '__construct() takes a formatter or null as the third argument'); + } + + public function testSetFormatter() + { + $output = new ConsoleOutput(); + $outputFormatter = new OutputFormatter(); + $output->setFormatter($outputFormatter); + $this->assertSame($outputFormatter, $output->getFormatter()); + } + + public function testSetVerbosity() + { + $output = new ConsoleOutput(); + $output->setVerbosity(Output::VERBOSITY_VERBOSE); + $this->assertSame(Output::VERBOSITY_VERBOSE, $output->getVerbosity()); + } +} diff --git a/application/vendor/symfony/console/Tests/Output/NullOutputTest.php b/application/vendor/symfony/console/Tests/Output/NullOutputTest.php new file mode 100644 index 0000000..b7ff4be --- /dev/null +++ b/application/vendor/symfony/console/Tests/Output/NullOutputTest.php @@ -0,0 +1,88 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Output; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Output\NullOutput; +use Symfony\Component\Console\Output\Output; +use Symfony\Component\Console\Output\OutputInterface; + +class NullOutputTest extends TestCase +{ + public function testConstructor() + { + $output = new NullOutput(); + + ob_start(); + $output->write('foo'); + $buffer = ob_get_clean(); + + $this->assertSame('', $buffer, '->write() does nothing (at least nothing is printed)'); + $this->assertFalse($output->isDecorated(), '->isDecorated() returns false'); + } + + public function testVerbosity() + { + $output = new NullOutput(); + $this->assertSame(OutputInterface::VERBOSITY_QUIET, $output->getVerbosity(), '->getVerbosity() returns VERBOSITY_QUIET for NullOutput by default'); + + $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); + $this->assertSame(OutputInterface::VERBOSITY_QUIET, $output->getVerbosity(), '->getVerbosity() always returns VERBOSITY_QUIET for NullOutput'); + } + + public function testSetFormatter() + { + $output = new NullOutput(); + $outputFormatter = new OutputFormatter(); + $output->setFormatter($outputFormatter); + $this->assertNotSame($outputFormatter, $output->getFormatter()); + } + + public function testSetVerbosity() + { + $output = new NullOutput(); + $output->setVerbosity(Output::VERBOSITY_NORMAL); + $this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity()); + } + + public function testSetDecorated() + { + $output = new NullOutput(); + $output->setDecorated(true); + $this->assertFalse($output->isDecorated()); + } + + public function testIsQuiet() + { + $output = new NullOutput(); + $this->assertTrue($output->isQuiet()); + } + + public function testIsVerbose() + { + $output = new NullOutput(); + $this->assertFalse($output->isVerbose()); + } + + public function testIsVeryVerbose() + { + $output = new NullOutput(); + $this->assertFalse($output->isVeryVerbose()); + } + + public function testIsDebug() + { + $output = new NullOutput(); + $this->assertFalse($output->isDebug()); + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Output/OutputTest.php b/application/vendor/symfony/console/Tests/Output/OutputTest.php similarity index 98% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Output/OutputTest.php rename to application/vendor/symfony/console/Tests/Output/OutputTest.php index cfb4afe..f122c07 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Output/OutputTest.php +++ b/application/vendor/symfony/console/Tests/Output/OutputTest.php @@ -11,10 +11,11 @@ namespace Symfony\Component\Console\Tests\Output; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Output\Output; use Symfony\Component\Console\Formatter\OutputFormatterStyle; -class OutputTest extends \PHPUnit_Framework_TestCase +class OutputTest extends TestCase { public function testConstructor() { diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Output/StreamOutputTest.php b/application/vendor/symfony/console/Tests/Output/StreamOutputTest.php similarity index 96% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Output/StreamOutputTest.php rename to application/vendor/symfony/console/Tests/Output/StreamOutputTest.php index 2fd4f61..780b568 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Output/StreamOutputTest.php +++ b/application/vendor/symfony/console/Tests/Output/StreamOutputTest.php @@ -11,10 +11,11 @@ namespace Symfony\Component\Console\Tests\Output; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Output\Output; use Symfony\Component\Console\Output\StreamOutput; -class StreamOutputTest extends \PHPUnit_Framework_TestCase +class StreamOutputTest extends TestCase { protected $stream; diff --git a/application/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php b/application/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php new file mode 100644 index 0000000..ee9b09f --- /dev/null +++ b/application/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Style; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Console\Tester\CommandTester; + +class SymfonyStyleTest extends TestCase +{ + /** @var Command */ + protected $command; + /** @var CommandTester */ + protected $tester; + + protected function setUp() + { + $this->command = new Command('sfstyle'); + $this->tester = new CommandTester($this->command); + } + + protected function tearDown() + { + $this->command = null; + $this->tester = null; + } + + /** + * @dataProvider inputCommandToOutputFilesProvider + */ + public function testOutputs($inputCommandFilepath, $outputFilepath) + { + $code = require $inputCommandFilepath; + $this->command->setCode($code); + $this->tester->execute(array(), array('interactive' => false, 'decorated' => false)); + $this->assertStringEqualsFile($outputFilepath, $this->tester->getDisplay(true)); + } + + public function inputCommandToOutputFilesProvider() + { + $baseDir = __DIR__.'/../Fixtures/Style/SymfonyStyle'; + + return array_map(null, glob($baseDir.'/command/command_*.php'), glob($baseDir.'/output/output_*.txt')); + } +} + +/** + * Use this class in tests to force the line length + * and ensure a consistent output for expectations. + */ +class SymfonyStyleWithForcedLineLength extends SymfonyStyle +{ + public function __construct(InputInterface $input, OutputInterface $output) + { + parent::__construct($input, $output); + + $ref = new \ReflectionProperty(get_parent_class($this), 'lineLength'); + $ref->setAccessible(true); + $ref->setValue($this, 120); + } +} diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php b/application/vendor/symfony/console/Tests/Tester/ApplicationTesterTest.php similarity index 96% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php rename to application/vendor/symfony/console/Tests/Tester/ApplicationTesterTest.php index a8389dd..57e7136 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php +++ b/application/vendor/symfony/console/Tests/Tester/ApplicationTesterTest.php @@ -11,11 +11,12 @@ namespace Symfony\Component\Console\Tests\Tester; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application; use Symfony\Component\Console\Output\Output; use Symfony\Component\Console\Tester\ApplicationTester; -class ApplicationTesterTest extends \PHPUnit_Framework_TestCase +class ApplicationTesterTest extends TestCase { protected $application; protected $tester; diff --git a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php b/application/vendor/symfony/console/Tests/Tester/CommandTesterTest.php similarity index 97% rename from application/vendor/symfony/console/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php rename to application/vendor/symfony/console/Tests/Tester/CommandTesterTest.php index b54c00e..8d4e05a 100644 --- a/application/vendor/symfony/console/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php +++ b/application/vendor/symfony/console/Tests/Tester/CommandTesterTest.php @@ -11,12 +11,13 @@ namespace Symfony\Component\Console\Tests\Tester; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Output\Output; use Symfony\Component\Console\Tester\CommandTester; -class CommandTesterTest extends \PHPUnit_Framework_TestCase +class CommandTesterTest extends TestCase { protected $command; protected $tester; diff --git a/application/vendor/symfony/console/composer.json b/application/vendor/symfony/console/composer.json new file mode 100644 index 0000000..9f63559 --- /dev/null +++ b/application/vendor/symfony/console/composer.json @@ -0,0 +1,44 @@ +{ + "name": "symfony/console", + "type": "library", + "description": "Symfony Console Component", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=5.3.9", + "symfony/debug": "^2.7.2" + }, + "require-dev": { + "symfony/event-dispatcher": "~2.1", + "symfony/process": "~2.1", + "psr/log": "~1.0" + }, + "suggest": { + "symfony/event-dispatcher": "", + "symfony/process": "", + "psr/log-implementation": "For using the console logger" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\Console\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + } +} diff --git a/application/vendor/symfony/console/phpunit.xml.dist b/application/vendor/symfony/console/phpunit.xml.dist new file mode 100644 index 0000000..7e7ff5b --- /dev/null +++ b/application/vendor/symfony/console/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + + + + + ./Tests/ + + + + + + ./ + + ./Resources + ./Tests + ./vendor + + + + diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/.gitignore b/application/vendor/symfony/css-selector/.gitignore similarity index 100% rename from application/vendor/symfony/debug/Symfony/Component/Debug/.gitignore rename to application/vendor/symfony/css-selector/.gitignore diff --git a/application/vendor/symfony/css-selector/CHANGELOG.md b/application/vendor/symfony/css-selector/CHANGELOG.md new file mode 100644 index 0000000..4061ff2 --- /dev/null +++ b/application/vendor/symfony/css-selector/CHANGELOG.md @@ -0,0 +1,13 @@ +CHANGELOG +========= + +2.8.0 +----- + + * Added the `CssSelectorConverter` class as a non-static API for the component. + * Deprecated the `CssSelector` static API of the component. + +2.1.0 +----- + + * none diff --git a/application/vendor/symfony/css-selector/CssSelector.php b/application/vendor/symfony/css-selector/CssSelector.php new file mode 100644 index 0000000..c1f8c88 --- /dev/null +++ b/application/vendor/symfony/css-selector/CssSelector.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector; + +@trigger_error('The '.__NAMESPACE__.'\CssSelector class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the \Symfony\Component\CssSelector\CssSelectorConverter class instead.', E_USER_DEPRECATED); + +/** + * CssSelector is the main entry point of the component and can convert CSS + * selectors to XPath expressions. + * + * $xpath = CssSelector::toXpath('h1.foo'); + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * Copyright (c) 2007-2012 Ian Bicking and contributors. See AUTHORS + * for more details. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. Neither the name of Ian Bicking nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IAN BICKING OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * @author Fabien Potencier + * + * @deprecated as of 2.8, will be removed in 3.0. Use the \Symfony\Component\CssSelector\CssSelectorConverter class instead. + */ +class CssSelector +{ + private static $html = true; + + /** + * Translates a CSS expression to its XPath equivalent. + * Optionally, a prefix can be added to the resulting XPath + * expression with the $prefix parameter. + * + * @param mixed $cssExpr The CSS expression + * @param string $prefix An optional prefix for the XPath expression + * + * @return string + */ + public static function toXPath($cssExpr, $prefix = 'descendant-or-self::') + { + $converter = new CssSelectorConverter(self::$html); + + return $converter->toXPath($cssExpr, $prefix); + } + + /** + * Enables the HTML extension. + */ + public static function enableHtmlExtension() + { + self::$html = true; + } + + /** + * Disables the HTML extension. + */ + public static function disableHtmlExtension() + { + self::$html = false; + } +} diff --git a/application/vendor/symfony/css-selector/CssSelectorConverter.php b/application/vendor/symfony/css-selector/CssSelectorConverter.php new file mode 100644 index 0000000..8d66dbd --- /dev/null +++ b/application/vendor/symfony/css-selector/CssSelectorConverter.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector; + +use Symfony\Component\CssSelector\Parser\Shortcut\ClassParser; +use Symfony\Component\CssSelector\Parser\Shortcut\ElementParser; +use Symfony\Component\CssSelector\Parser\Shortcut\EmptyStringParser; +use Symfony\Component\CssSelector\Parser\Shortcut\HashParser; +use Symfony\Component\CssSelector\XPath\Extension\HtmlExtension; +use Symfony\Component\CssSelector\XPath\Translator; + +/** + * CssSelectorConverter is the main entry point of the component and can convert CSS + * selectors to XPath expressions. + * + * @author Christophe Coevoet + */ +class CssSelectorConverter +{ + private $translator; + + /** + * @param bool $html Whether HTML support should be enabled. Disable it for XML documents + */ + public function __construct($html = true) + { + $this->translator = new Translator(); + + if ($html) { + $this->translator->registerExtension(new HtmlExtension($this->translator)); + } + + $this->translator + ->registerParserShortcut(new EmptyStringParser()) + ->registerParserShortcut(new ElementParser()) + ->registerParserShortcut(new ClassParser()) + ->registerParserShortcut(new HashParser()) + ; + } + + /** + * Translates a CSS expression to its XPath equivalent. + * + * Optionally, a prefix can be added to the resulting XPath + * expression with the $prefix parameter. + * + * @param string $cssExpr The CSS expression + * @param string $prefix An optional prefix for the XPath expression + * + * @return string + */ + public function toXPath($cssExpr, $prefix = 'descendant-or-self::') + { + return $this->translator->cssToXPath($cssExpr, $prefix); + } +} diff --git a/application/vendor/symfony/css-selector/Exception/ExceptionInterface.php b/application/vendor/symfony/css-selector/Exception/ExceptionInterface.php new file mode 100644 index 0000000..e4c5ae1 --- /dev/null +++ b/application/vendor/symfony/css-selector/Exception/ExceptionInterface.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Exception; + +/** + * Interface for exceptions. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + */ +interface ExceptionInterface +{ +} diff --git a/application/vendor/symfony/css-selector/Exception/ExpressionErrorException.php b/application/vendor/symfony/css-selector/Exception/ExpressionErrorException.php new file mode 100644 index 0000000..fd5deea --- /dev/null +++ b/application/vendor/symfony/css-selector/Exception/ExpressionErrorException.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Exception; + +/** + * ParseException is thrown when a CSS selector syntax is not valid. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + */ +class ExpressionErrorException extends ParseException +{ +} diff --git a/application/vendor/symfony/css-selector/Exception/InternalErrorException.php b/application/vendor/symfony/css-selector/Exception/InternalErrorException.php new file mode 100644 index 0000000..e60e5ed --- /dev/null +++ b/application/vendor/symfony/css-selector/Exception/InternalErrorException.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Exception; + +/** + * ParseException is thrown when a CSS selector syntax is not valid. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + */ +class InternalErrorException extends ParseException +{ +} diff --git a/application/vendor/symfony/css-selector/Exception/ParseException.php b/application/vendor/symfony/css-selector/Exception/ParseException.php new file mode 100644 index 0000000..3b0b0ee --- /dev/null +++ b/application/vendor/symfony/css-selector/Exception/ParseException.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Exception; + +/** + * ParseException is thrown when a CSS selector syntax is not valid. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Fabien Potencier + */ +class ParseException extends \Exception implements ExceptionInterface +{ +} diff --git a/application/vendor/symfony/css-selector/Exception/SyntaxErrorException.php b/application/vendor/symfony/css-selector/Exception/SyntaxErrorException.php new file mode 100644 index 0000000..cb3158a --- /dev/null +++ b/application/vendor/symfony/css-selector/Exception/SyntaxErrorException.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Exception; + +use Symfony\Component\CssSelector\Parser\Token; + +/** + * ParseException is thrown when a CSS selector syntax is not valid. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + */ +class SyntaxErrorException extends ParseException +{ + /** + * @param string $expectedValue + * @param Token $foundToken + * + * @return self + */ + public static function unexpectedToken($expectedValue, Token $foundToken) + { + return new self(sprintf('Expected %s, but %s found.', $expectedValue, $foundToken)); + } + + /** + * @param string $pseudoElement + * @param string $unexpectedLocation + * + * @return self + */ + public static function pseudoElementFound($pseudoElement, $unexpectedLocation) + { + return new self(sprintf('Unexpected pseudo-element "::%s" found %s.', $pseudoElement, $unexpectedLocation)); + } + + /** + * @param int $position + * + * @return self + */ + public static function unclosedString($position) + { + return new self(sprintf('Unclosed/invalid string at %s.', $position)); + } + + /** + * @return self + */ + public static function nestedNot() + { + return new self('Got nested ::not().'); + } + + /** + * @return self + */ + public static function stringAsFunctionArgument() + { + return new self('String not allowed as function argument.'); + } +} diff --git a/application/vendor/symfony/css-selector/LICENSE b/application/vendor/symfony/css-selector/LICENSE new file mode 100644 index 0000000..21d7fb9 --- /dev/null +++ b/application/vendor/symfony/css-selector/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2018 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/application/vendor/symfony/css-selector/Node/AbstractNode.php b/application/vendor/symfony/css-selector/Node/AbstractNode.php new file mode 100644 index 0000000..1d5d8ff --- /dev/null +++ b/application/vendor/symfony/css-selector/Node/AbstractNode.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Node; + +/** + * Abstract base node class. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +abstract class AbstractNode implements NodeInterface +{ + /** + * @var string + */ + private $nodeName; + + /** + * @return string + */ + public function getNodeName() + { + if (null === $this->nodeName) { + $this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', \get_called_class()); + } + + return $this->nodeName; + } +} diff --git a/application/vendor/symfony/css-selector/Node/AttributeNode.php b/application/vendor/symfony/css-selector/Node/AttributeNode.php new file mode 100644 index 0000000..1caccb6 --- /dev/null +++ b/application/vendor/symfony/css-selector/Node/AttributeNode.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Node; + +/** + * Represents a "[| ]" node. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class AttributeNode extends AbstractNode +{ + private $selector; + private $namespace; + private $attribute; + private $operator; + private $value; + + /** + * @param NodeInterface $selector + * @param string $namespace + * @param string $attribute + * @param string $operator + * @param string $value + */ + public function __construct(NodeInterface $selector, $namespace, $attribute, $operator, $value) + { + $this->selector = $selector; + $this->namespace = $namespace; + $this->attribute = $attribute; + $this->operator = $operator; + $this->value = $value; + } + + /** + * @return NodeInterface + */ + public function getSelector() + { + return $this->selector; + } + + /** + * @return string + */ + public function getNamespace() + { + return $this->namespace; + } + + /** + * @return string + */ + public function getAttribute() + { + return $this->attribute; + } + + /** + * @return string + */ + public function getOperator() + { + return $this->operator; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * {@inheritdoc} + */ + public function getSpecificity() + { + return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0)); + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + $attribute = $this->namespace ? $this->namespace.'|'.$this->attribute : $this->attribute; + + return 'exists' === $this->operator + ? sprintf('%s[%s[%s]]', $this->getNodeName(), $this->selector, $attribute) + : sprintf("%s[%s[%s %s '%s']]", $this->getNodeName(), $this->selector, $attribute, $this->operator, $this->value); + } +} diff --git a/application/vendor/symfony/css-selector/Node/ClassNode.php b/application/vendor/symfony/css-selector/Node/ClassNode.php new file mode 100644 index 0000000..69462e8 --- /dev/null +++ b/application/vendor/symfony/css-selector/Node/ClassNode.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Node; + +/** + * Represents a "." node. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class ClassNode extends AbstractNode +{ + private $selector; + private $name; + + /** + * @param NodeInterface $selector + * @param string $name + */ + public function __construct(NodeInterface $selector, $name) + { + $this->selector = $selector; + $this->name = $name; + } + + /** + * @return NodeInterface + */ + public function getSelector() + { + return $this->selector; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * {@inheritdoc} + */ + public function getSpecificity() + { + return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0)); + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return sprintf('%s[%s.%s]', $this->getNodeName(), $this->selector, $this->name); + } +} diff --git a/application/vendor/symfony/css-selector/Node/CombinedSelectorNode.php b/application/vendor/symfony/css-selector/Node/CombinedSelectorNode.php new file mode 100644 index 0000000..2aa583a --- /dev/null +++ b/application/vendor/symfony/css-selector/Node/CombinedSelectorNode.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Node; + +/** + * Represents a combined node. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class CombinedSelectorNode extends AbstractNode +{ + private $selector; + private $combinator; + private $subSelector; + + /** + * @param NodeInterface $selector + * @param string $combinator + * @param NodeInterface $subSelector + */ + public function __construct(NodeInterface $selector, $combinator, NodeInterface $subSelector) + { + $this->selector = $selector; + $this->combinator = $combinator; + $this->subSelector = $subSelector; + } + + /** + * @return NodeInterface + */ + public function getSelector() + { + return $this->selector; + } + + /** + * @return string + */ + public function getCombinator() + { + return $this->combinator; + } + + /** + * @return NodeInterface + */ + public function getSubSelector() + { + return $this->subSelector; + } + + /** + * {@inheritdoc} + */ + public function getSpecificity() + { + return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity()); + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + $combinator = ' ' === $this->combinator ? '' : $this->combinator; + + return sprintf('%s[%s %s %s]', $this->getNodeName(), $this->selector, $combinator, $this->subSelector); + } +} diff --git a/application/vendor/symfony/css-selector/Node/ElementNode.php b/application/vendor/symfony/css-selector/Node/ElementNode.php new file mode 100644 index 0000000..54869af --- /dev/null +++ b/application/vendor/symfony/css-selector/Node/ElementNode.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Node; + +/** + * Represents a "|" node. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class ElementNode extends AbstractNode +{ + private $namespace; + private $element; + + /** + * @param string|null $namespace + * @param string|null $element + */ + public function __construct($namespace = null, $element = null) + { + $this->namespace = $namespace; + $this->element = $element; + } + + /** + * @return string|null + */ + public function getNamespace() + { + return $this->namespace; + } + + /** + * @return string|null + */ + public function getElement() + { + return $this->element; + } + + /** + * {@inheritdoc} + */ + public function getSpecificity() + { + return new Specificity(0, 0, $this->element ? 1 : 0); + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + $element = $this->element ?: '*'; + + return sprintf('%s[%s]', $this->getNodeName(), $this->namespace ? $this->namespace.'|'.$element : $element); + } +} diff --git a/application/vendor/symfony/css-selector/Node/FunctionNode.php b/application/vendor/symfony/css-selector/Node/FunctionNode.php new file mode 100644 index 0000000..5026825 --- /dev/null +++ b/application/vendor/symfony/css-selector/Node/FunctionNode.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Node; + +use Symfony\Component\CssSelector\Parser\Token; + +/** + * Represents a ":()" node. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class FunctionNode extends AbstractNode +{ + private $selector; + private $name; + private $arguments; + + /** + * @param NodeInterface $selector + * @param string $name + * @param Token[] $arguments + */ + public function __construct(NodeInterface $selector, $name, array $arguments = array()) + { + $this->selector = $selector; + $this->name = strtolower($name); + $this->arguments = $arguments; + } + + /** + * @return NodeInterface + */ + public function getSelector() + { + return $this->selector; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @return Token[] + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * {@inheritdoc} + */ + public function getSpecificity() + { + return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0)); + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + $arguments = implode(', ', array_map(function (Token $token) { + return "'".$token->getValue()."'"; + }, $this->arguments)); + + return sprintf('%s[%s:%s(%s)]', $this->getNodeName(), $this->selector, $this->name, $arguments ? '['.$arguments.']' : ''); + } +} diff --git a/application/vendor/symfony/css-selector/Node/HashNode.php b/application/vendor/symfony/css-selector/Node/HashNode.php new file mode 100644 index 0000000..ebf9a98 --- /dev/null +++ b/application/vendor/symfony/css-selector/Node/HashNode.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Node; + +/** + * Represents a "#" node. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class HashNode extends AbstractNode +{ + private $selector; + private $id; + + /** + * @param NodeInterface $selector + * @param string $id + */ + public function __construct(NodeInterface $selector, $id) + { + $this->selector = $selector; + $this->id = $id; + } + + /** + * @return NodeInterface + */ + public function getSelector() + { + return $this->selector; + } + + /** + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * {@inheritdoc} + */ + public function getSpecificity() + { + return $this->selector->getSpecificity()->plus(new Specificity(1, 0, 0)); + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return sprintf('%s[%s#%s]', $this->getNodeName(), $this->selector, $this->id); + } +} diff --git a/application/vendor/symfony/css-selector/Node/NegationNode.php b/application/vendor/symfony/css-selector/Node/NegationNode.php new file mode 100644 index 0000000..bf97cae --- /dev/null +++ b/application/vendor/symfony/css-selector/Node/NegationNode.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Node; + +/** + * Represents a ":not()" node. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class NegationNode extends AbstractNode +{ + private $selector; + private $subSelector; + + public function __construct(NodeInterface $selector, NodeInterface $subSelector) + { + $this->selector = $selector; + $this->subSelector = $subSelector; + } + + /** + * @return NodeInterface + */ + public function getSelector() + { + return $this->selector; + } + + /** + * @return NodeInterface + */ + public function getSubSelector() + { + return $this->subSelector; + } + + /** + * {@inheritdoc} + */ + public function getSpecificity() + { + return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity()); + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return sprintf('%s[%s:not(%s)]', $this->getNodeName(), $this->selector, $this->subSelector); + } +} diff --git a/application/vendor/symfony/css-selector/Node/NodeInterface.php b/application/vendor/symfony/css-selector/Node/NodeInterface.php new file mode 100644 index 0000000..d919e20 --- /dev/null +++ b/application/vendor/symfony/css-selector/Node/NodeInterface.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Node; + +/** + * Interface for nodes. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +interface NodeInterface +{ + /** + * Returns node's name. + * + * @return string + */ + public function getNodeName(); + + /** + * Returns node's specificity. + * + * @return Specificity + */ + public function getSpecificity(); + + /** + * Returns node's string representation. + * + * @return string + */ + public function __toString(); +} diff --git a/application/vendor/symfony/css-selector/Node/PseudoNode.php b/application/vendor/symfony/css-selector/Node/PseudoNode.php new file mode 100644 index 0000000..3842c69 --- /dev/null +++ b/application/vendor/symfony/css-selector/Node/PseudoNode.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Node; + +/** + * Represents a ":" node. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class PseudoNode extends AbstractNode +{ + private $selector; + private $identifier; + + /** + * @param NodeInterface $selector + * @param string $identifier + */ + public function __construct(NodeInterface $selector, $identifier) + { + $this->selector = $selector; + $this->identifier = strtolower($identifier); + } + + /** + * @return NodeInterface + */ + public function getSelector() + { + return $this->selector; + } + + /** + * @return string + */ + public function getIdentifier() + { + return $this->identifier; + } + + /** + * {@inheritdoc} + */ + public function getSpecificity() + { + return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0)); + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return sprintf('%s[%s:%s]', $this->getNodeName(), $this->selector, $this->identifier); + } +} diff --git a/application/vendor/symfony/css-selector/Node/SelectorNode.php b/application/vendor/symfony/css-selector/Node/SelectorNode.php new file mode 100644 index 0000000..057107f --- /dev/null +++ b/application/vendor/symfony/css-selector/Node/SelectorNode.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Node; + +/** + * Represents a "(::|:)" node. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class SelectorNode extends AbstractNode +{ + private $tree; + private $pseudoElement; + + /** + * @param NodeInterface $tree + * @param string|null $pseudoElement + */ + public function __construct(NodeInterface $tree, $pseudoElement = null) + { + $this->tree = $tree; + $this->pseudoElement = $pseudoElement ? strtolower($pseudoElement) : null; + } + + /** + * @return NodeInterface + */ + public function getTree() + { + return $this->tree; + } + + /** + * @return string|null + */ + public function getPseudoElement() + { + return $this->pseudoElement; + } + + /** + * {@inheritdoc} + */ + public function getSpecificity() + { + return $this->tree->getSpecificity()->plus(new Specificity(0, 0, $this->pseudoElement ? 1 : 0)); + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return sprintf('%s[%s%s]', $this->getNodeName(), $this->tree, $this->pseudoElement ? '::'.$this->pseudoElement : ''); + } +} diff --git a/application/vendor/symfony/css-selector/Node/Specificity.php b/application/vendor/symfony/css-selector/Node/Specificity.php new file mode 100644 index 0000000..6aa70d7 --- /dev/null +++ b/application/vendor/symfony/css-selector/Node/Specificity.php @@ -0,0 +1,88 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Node; + +/** + * Represents a node specificity. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @see http://www.w3.org/TR/selectors/#specificity + * + * @author Jean-François Simon + * + * @internal + */ +class Specificity +{ + const A_FACTOR = 100; + const B_FACTOR = 10; + const C_FACTOR = 1; + + private $a; + private $b; + private $c; + + /** + * @param int $a + * @param int $b + * @param int $c + */ + public function __construct($a, $b, $c) + { + $this->a = $a; + $this->b = $b; + $this->c = $c; + } + + /** + * @return self + */ + public function plus(Specificity $specificity) + { + return new self($this->a + $specificity->a, $this->b + $specificity->b, $this->c + $specificity->c); + } + + /** + * Returns global specificity value. + * + * @return int + */ + public function getValue() + { + return $this->a * self::A_FACTOR + $this->b * self::B_FACTOR + $this->c * self::C_FACTOR; + } + + /** + * Returns -1 if the object specificity is lower than the argument, + * 0 if they are equal, and 1 if the argument is lower. + * + * @return int + */ + public function compareTo(Specificity $specificity) + { + if ($this->a !== $specificity->a) { + return $this->a > $specificity->a ? 1 : -1; + } + + if ($this->b !== $specificity->b) { + return $this->b > $specificity->b ? 1 : -1; + } + + if ($this->c !== $specificity->c) { + return $this->c > $specificity->c ? 1 : -1; + } + + return 0; + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Handler/CommentHandler.php b/application/vendor/symfony/css-selector/Parser/Handler/CommentHandler.php new file mode 100644 index 0000000..a29775c --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Handler/CommentHandler.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser\Handler; + +use Symfony\Component\CssSelector\Parser\Reader; +use Symfony\Component\CssSelector\Parser\TokenStream; + +/** + * CSS selector comment handler. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class CommentHandler implements HandlerInterface +{ + /** + * {@inheritdoc} + */ + public function handle(Reader $reader, TokenStream $stream) + { + if ('/*' !== $reader->getSubstring(2)) { + return false; + } + + $offset = $reader->getOffset('*/'); + + if (false === $offset) { + $reader->moveToEnd(); + } else { + $reader->moveForward($offset + 2); + } + + return true; + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Handler/HandlerInterface.php b/application/vendor/symfony/css-selector/Parser/Handler/HandlerInterface.php new file mode 100644 index 0000000..de931f6 --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Handler/HandlerInterface.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser\Handler; + +use Symfony\Component\CssSelector\Parser\Reader; +use Symfony\Component\CssSelector\Parser\TokenStream; + +/** + * CSS selector handler interface. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +interface HandlerInterface +{ + /** + * @return bool + */ + public function handle(Reader $reader, TokenStream $stream); +} diff --git a/application/vendor/symfony/css-selector/Parser/Handler/HashHandler.php b/application/vendor/symfony/css-selector/Parser/Handler/HashHandler.php new file mode 100644 index 0000000..e451328 --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Handler/HashHandler.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser\Handler; + +use Symfony\Component\CssSelector\Parser\Reader; +use Symfony\Component\CssSelector\Parser\Token; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; +use Symfony\Component\CssSelector\Parser\TokenStream; + +/** + * CSS selector comment handler. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class HashHandler implements HandlerInterface +{ + private $patterns; + private $escaping; + + public function __construct(TokenizerPatterns $patterns, TokenizerEscaping $escaping) + { + $this->patterns = $patterns; + $this->escaping = $escaping; + } + + /** + * {@inheritdoc} + */ + public function handle(Reader $reader, TokenStream $stream) + { + $match = $reader->findPattern($this->patterns->getHashPattern()); + + if (!$match) { + return false; + } + + $value = $this->escaping->escapeUnicode($match[1]); + $stream->push(new Token(Token::TYPE_HASH, $value, $reader->getPosition())); + $reader->moveForward(\strlen($match[0])); + + return true; + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Handler/IdentifierHandler.php b/application/vendor/symfony/css-selector/Parser/Handler/IdentifierHandler.php new file mode 100644 index 0000000..1591fcb --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Handler/IdentifierHandler.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser\Handler; + +use Symfony\Component\CssSelector\Parser\Reader; +use Symfony\Component\CssSelector\Parser\Token; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; +use Symfony\Component\CssSelector\Parser\TokenStream; + +/** + * CSS selector comment handler. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class IdentifierHandler implements HandlerInterface +{ + private $patterns; + private $escaping; + + public function __construct(TokenizerPatterns $patterns, TokenizerEscaping $escaping) + { + $this->patterns = $patterns; + $this->escaping = $escaping; + } + + /** + * {@inheritdoc} + */ + public function handle(Reader $reader, TokenStream $stream) + { + $match = $reader->findPattern($this->patterns->getIdentifierPattern()); + + if (!$match) { + return false; + } + + $value = $this->escaping->escapeUnicode($match[0]); + $stream->push(new Token(Token::TYPE_IDENTIFIER, $value, $reader->getPosition())); + $reader->moveForward(\strlen($match[0])); + + return true; + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Handler/NumberHandler.php b/application/vendor/symfony/css-selector/Parser/Handler/NumberHandler.php new file mode 100644 index 0000000..5955903 --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Handler/NumberHandler.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser\Handler; + +use Symfony\Component\CssSelector\Parser\Reader; +use Symfony\Component\CssSelector\Parser\Token; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; +use Symfony\Component\CssSelector\Parser\TokenStream; + +/** + * CSS selector comment handler. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class NumberHandler implements HandlerInterface +{ + private $patterns; + + public function __construct(TokenizerPatterns $patterns) + { + $this->patterns = $patterns; + } + + /** + * {@inheritdoc} + */ + public function handle(Reader $reader, TokenStream $stream) + { + $match = $reader->findPattern($this->patterns->getNumberPattern()); + + if (!$match) { + return false; + } + + $stream->push(new Token(Token::TYPE_NUMBER, $match[0], $reader->getPosition())); + $reader->moveForward(\strlen($match[0])); + + return true; + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Handler/StringHandler.php b/application/vendor/symfony/css-selector/Parser/Handler/StringHandler.php new file mode 100644 index 0000000..00155b0 --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Handler/StringHandler.php @@ -0,0 +1,77 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser\Handler; + +use Symfony\Component\CssSelector\Exception\InternalErrorException; +use Symfony\Component\CssSelector\Exception\SyntaxErrorException; +use Symfony\Component\CssSelector\Parser\Reader; +use Symfony\Component\CssSelector\Parser\Token; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; +use Symfony\Component\CssSelector\Parser\TokenStream; + +/** + * CSS selector comment handler. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class StringHandler implements HandlerInterface +{ + private $patterns; + private $escaping; + + public function __construct(TokenizerPatterns $patterns, TokenizerEscaping $escaping) + { + $this->patterns = $patterns; + $this->escaping = $escaping; + } + + /** + * {@inheritdoc} + */ + public function handle(Reader $reader, TokenStream $stream) + { + $quote = $reader->getSubstring(1); + + if (!\in_array($quote, array("'", '"'))) { + return false; + } + + $reader->moveForward(1); + $match = $reader->findPattern($this->patterns->getQuotedStringPattern($quote)); + + if (!$match) { + throw new InternalErrorException(sprintf('Should have found at least an empty match at %s.', $reader->getPosition())); + } + + // check unclosed strings + if (\strlen($match[0]) === $reader->getRemainingLength()) { + throw SyntaxErrorException::unclosedString($reader->getPosition() - 1); + } + + // check quotes pairs validity + if ($quote !== $reader->getSubstring(1, \strlen($match[0]))) { + throw SyntaxErrorException::unclosedString($reader->getPosition() - 1); + } + + $string = $this->escaping->escapeUnicodeAndNewLine($match[0]); + $stream->push(new Token(Token::TYPE_STRING, $string, $reader->getPosition())); + $reader->moveForward(\strlen($match[0]) + 1); + + return true; + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php b/application/vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php new file mode 100644 index 0000000..396467a --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser\Handler; + +use Symfony\Component\CssSelector\Parser\Reader; +use Symfony\Component\CssSelector\Parser\Token; +use Symfony\Component\CssSelector\Parser\TokenStream; + +/** + * CSS selector whitespace handler. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class WhitespaceHandler implements HandlerInterface +{ + /** + * {@inheritdoc} + */ + public function handle(Reader $reader, TokenStream $stream) + { + $match = $reader->findPattern('~^[ \t\r\n\f]+~'); + + if (false === $match) { + return false; + } + + $stream->push(new Token(Token::TYPE_WHITESPACE, $match[0], $reader->getPosition())); + $reader->moveForward(\strlen($match[0])); + + return true; + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Parser.php b/application/vendor/symfony/css-selector/Parser/Parser.php new file mode 100644 index 0000000..87c05a7 --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Parser.php @@ -0,0 +1,384 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser; + +use Symfony\Component\CssSelector\Exception\SyntaxErrorException; +use Symfony\Component\CssSelector\Node; +use Symfony\Component\CssSelector\Parser\Tokenizer\Tokenizer; + +/** + * CSS selector parser. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class Parser implements ParserInterface +{ + private $tokenizer; + + public function __construct(Tokenizer $tokenizer = null) + { + $this->tokenizer = $tokenizer ?: new Tokenizer(); + } + + /** + * {@inheritdoc} + */ + public function parse($source) + { + $reader = new Reader($source); + $stream = $this->tokenizer->tokenize($reader); + + return $this->parseSelectorList($stream); + } + + /** + * Parses the arguments for ":nth-child()" and friends. + * + * @param Token[] $tokens + * + * @return array + * + * @throws SyntaxErrorException + */ + public static function parseSeries(array $tokens) + { + foreach ($tokens as $token) { + if ($token->isString()) { + throw SyntaxErrorException::stringAsFunctionArgument(); + } + } + + $joined = trim(implode('', array_map(function (Token $token) { + return $token->getValue(); + }, $tokens))); + + $int = function ($string) { + if (!is_numeric($string)) { + throw SyntaxErrorException::stringAsFunctionArgument(); + } + + return (int) $string; + }; + + switch (true) { + case 'odd' === $joined: + return array(2, 1); + case 'even' === $joined: + return array(2, 0); + case 'n' === $joined: + return array(1, 0); + case false === strpos($joined, 'n'): + return array(0, $int($joined)); + } + + $split = explode('n', $joined); + $first = isset($split[0]) ? $split[0] : null; + + return array( + $first ? ('-' === $first || '+' === $first ? $int($first.'1') : $int($first)) : 1, + isset($split[1]) && $split[1] ? $int($split[1]) : 0, + ); + } + + /** + * Parses selector nodes. + * + * @return array + */ + private function parseSelectorList(TokenStream $stream) + { + $stream->skipWhitespace(); + $selectors = array(); + + while (true) { + $selectors[] = $this->parserSelectorNode($stream); + + if ($stream->getPeek()->isDelimiter(array(','))) { + $stream->getNext(); + $stream->skipWhitespace(); + } else { + break; + } + } + + return $selectors; + } + + /** + * Parses next selector or combined node. + * + * @return Node\SelectorNode + * + * @throws SyntaxErrorException + */ + private function parserSelectorNode(TokenStream $stream) + { + list($result, $pseudoElement) = $this->parseSimpleSelector($stream); + + while (true) { + $stream->skipWhitespace(); + $peek = $stream->getPeek(); + + if ($peek->isFileEnd() || $peek->isDelimiter(array(','))) { + break; + } + + if (null !== $pseudoElement) { + throw SyntaxErrorException::pseudoElementFound($pseudoElement, 'not at the end of a selector'); + } + + if ($peek->isDelimiter(array('+', '>', '~'))) { + $combinator = $stream->getNext()->getValue(); + $stream->skipWhitespace(); + } else { + $combinator = ' '; + } + + list($nextSelector, $pseudoElement) = $this->parseSimpleSelector($stream); + $result = new Node\CombinedSelectorNode($result, $combinator, $nextSelector); + } + + return new Node\SelectorNode($result, $pseudoElement); + } + + /** + * Parses next simple node (hash, class, pseudo, negation). + * + * @param TokenStream $stream + * @param bool $insideNegation + * + * @return array + * + * @throws SyntaxErrorException + */ + private function parseSimpleSelector(TokenStream $stream, $insideNegation = false) + { + $stream->skipWhitespace(); + + $selectorStart = \count($stream->getUsed()); + $result = $this->parseElementNode($stream); + $pseudoElement = null; + + while (true) { + $peek = $stream->getPeek(); + if ($peek->isWhitespace() + || $peek->isFileEnd() + || $peek->isDelimiter(array(',', '+', '>', '~')) + || ($insideNegation && $peek->isDelimiter(array(')'))) + ) { + break; + } + + if (null !== $pseudoElement) { + throw SyntaxErrorException::pseudoElementFound($pseudoElement, 'not at the end of a selector'); + } + + if ($peek->isHash()) { + $result = new Node\HashNode($result, $stream->getNext()->getValue()); + } elseif ($peek->isDelimiter(array('.'))) { + $stream->getNext(); + $result = new Node\ClassNode($result, $stream->getNextIdentifier()); + } elseif ($peek->isDelimiter(array('['))) { + $stream->getNext(); + $result = $this->parseAttributeNode($result, $stream); + } elseif ($peek->isDelimiter(array(':'))) { + $stream->getNext(); + + if ($stream->getPeek()->isDelimiter(array(':'))) { + $stream->getNext(); + $pseudoElement = $stream->getNextIdentifier(); + + continue; + } + + $identifier = $stream->getNextIdentifier(); + if (\in_array(strtolower($identifier), array('first-line', 'first-letter', 'before', 'after'))) { + // Special case: CSS 2.1 pseudo-elements can have a single ':'. + // Any new pseudo-element must have two. + $pseudoElement = $identifier; + + continue; + } + + if (!$stream->getPeek()->isDelimiter(array('('))) { + $result = new Node\PseudoNode($result, $identifier); + + continue; + } + + $stream->getNext(); + $stream->skipWhitespace(); + + if ('not' === strtolower($identifier)) { + if ($insideNegation) { + throw SyntaxErrorException::nestedNot(); + } + + list($argument, $argumentPseudoElement) = $this->parseSimpleSelector($stream, true); + $next = $stream->getNext(); + + if (null !== $argumentPseudoElement) { + throw SyntaxErrorException::pseudoElementFound($argumentPseudoElement, 'inside ::not()'); + } + + if (!$next->isDelimiter(array(')'))) { + throw SyntaxErrorException::unexpectedToken('")"', $next); + } + + $result = new Node\NegationNode($result, $argument); + } else { + $arguments = array(); + $next = null; + + while (true) { + $stream->skipWhitespace(); + $next = $stream->getNext(); + + if ($next->isIdentifier() + || $next->isString() + || $next->isNumber() + || $next->isDelimiter(array('+', '-')) + ) { + $arguments[] = $next; + } elseif ($next->isDelimiter(array(')'))) { + break; + } else { + throw SyntaxErrorException::unexpectedToken('an argument', $next); + } + } + + if (empty($arguments)) { + throw SyntaxErrorException::unexpectedToken('at least one argument', $next); + } + + $result = new Node\FunctionNode($result, $identifier, $arguments); + } + } else { + throw SyntaxErrorException::unexpectedToken('selector', $peek); + } + } + + if (\count($stream->getUsed()) === $selectorStart) { + throw SyntaxErrorException::unexpectedToken('selector', $stream->getPeek()); + } + + return array($result, $pseudoElement); + } + + /** + * Parses next element node. + * + * @return Node\ElementNode + */ + private function parseElementNode(TokenStream $stream) + { + $peek = $stream->getPeek(); + + if ($peek->isIdentifier() || $peek->isDelimiter(array('*'))) { + if ($peek->isIdentifier()) { + $namespace = $stream->getNext()->getValue(); + } else { + $stream->getNext(); + $namespace = null; + } + + if ($stream->getPeek()->isDelimiter(array('|'))) { + $stream->getNext(); + $element = $stream->getNextIdentifierOrStar(); + } else { + $element = $namespace; + $namespace = null; + } + } else { + $element = $namespace = null; + } + + return new Node\ElementNode($namespace, $element); + } + + /** + * Parses next attribute node. + * + * @return Node\AttributeNode + * + * @throws SyntaxErrorException + */ + private function parseAttributeNode(Node\NodeInterface $selector, TokenStream $stream) + { + $stream->skipWhitespace(); + $attribute = $stream->getNextIdentifierOrStar(); + + if (null === $attribute && !$stream->getPeek()->isDelimiter(array('|'))) { + throw SyntaxErrorException::unexpectedToken('"|"', $stream->getPeek()); + } + + if ($stream->getPeek()->isDelimiter(array('|'))) { + $stream->getNext(); + + if ($stream->getPeek()->isDelimiter(array('='))) { + $namespace = null; + $stream->getNext(); + $operator = '|='; + } else { + $namespace = $attribute; + $attribute = $stream->getNextIdentifier(); + $operator = null; + } + } else { + $namespace = $operator = null; + } + + if (null === $operator) { + $stream->skipWhitespace(); + $next = $stream->getNext(); + + if ($next->isDelimiter(array(']'))) { + return new Node\AttributeNode($selector, $namespace, $attribute, 'exists', null); + } elseif ($next->isDelimiter(array('='))) { + $operator = '='; + } elseif ($next->isDelimiter(array('^', '$', '*', '~', '|', '!')) + && $stream->getPeek()->isDelimiter(array('=')) + ) { + $operator = $next->getValue().'='; + $stream->getNext(); + } else { + throw SyntaxErrorException::unexpectedToken('operator', $next); + } + } + + $stream->skipWhitespace(); + $value = $stream->getNext(); + + if ($value->isNumber()) { + // if the value is a number, it's casted into a string + $value = new Token(Token::TYPE_STRING, (string) $value->getValue(), $value->getPosition()); + } + + if (!($value->isIdentifier() || $value->isString())) { + throw SyntaxErrorException::unexpectedToken('string or identifier', $value); + } + + $stream->skipWhitespace(); + $next = $stream->getNext(); + + if (!$next->isDelimiter(array(']'))) { + throw SyntaxErrorException::unexpectedToken('"]"', $next); + } + + return new Node\AttributeNode($selector, $namespace, $attribute, $operator, $value->getValue()); + } +} diff --git a/application/vendor/symfony/css-selector/Parser/ParserInterface.php b/application/vendor/symfony/css-selector/Parser/ParserInterface.php new file mode 100644 index 0000000..c5af203 --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/ParserInterface.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser; + +use Symfony\Component\CssSelector\Node\SelectorNode; + +/** + * CSS selector parser interface. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +interface ParserInterface +{ + /** + * Parses given selector source into an array of tokens. + * + * @param string $source + * + * @return SelectorNode[] + */ + public function parse($source); +} diff --git a/application/vendor/symfony/css-selector/Parser/Reader.php b/application/vendor/symfony/css-selector/Parser/Reader.php new file mode 100644 index 0000000..076cb71 --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Reader.php @@ -0,0 +1,114 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser; + +/** + * CSS selector reader. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class Reader +{ + private $source; + private $length; + private $position = 0; + + /** + * @param string $source + */ + public function __construct($source) + { + $this->source = $source; + $this->length = \strlen($source); + } + + /** + * @return bool + */ + public function isEOF() + { + return $this->position >= $this->length; + } + + /** + * @return int + */ + public function getPosition() + { + return $this->position; + } + + /** + * @return int + */ + public function getRemainingLength() + { + return $this->length - $this->position; + } + + /** + * @param int $length + * @param int $offset + * + * @return string + */ + public function getSubstring($length, $offset = 0) + { + return substr($this->source, $this->position + $offset, $length); + } + + /** + * @param string $string + * + * @return int + */ + public function getOffset($string) + { + $position = strpos($this->source, $string, $this->position); + + return false === $position ? false : $position - $this->position; + } + + /** + * @param string $pattern + * + * @return array|false + */ + public function findPattern($pattern) + { + $source = substr($this->source, $this->position); + + if (preg_match($pattern, $source, $matches)) { + return $matches; + } + + return false; + } + + /** + * @param int $length + */ + public function moveForward($length) + { + $this->position += $length; + } + + public function moveToEnd() + { + $this->position = $this->length; + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php b/application/vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php new file mode 100644 index 0000000..c513de5 --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser\Shortcut; + +use Symfony\Component\CssSelector\Node\ClassNode; +use Symfony\Component\CssSelector\Node\ElementNode; +use Symfony\Component\CssSelector\Node\SelectorNode; +use Symfony\Component\CssSelector\Parser\ParserInterface; + +/** + * CSS selector class parser shortcut. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class ClassParser implements ParserInterface +{ + /** + * {@inheritdoc} + */ + public function parse($source) + { + // Matches an optional namespace, optional element, and required class + // $source = 'test|input.ab6bd_field'; + // $matches = array (size=4) + // 0 => string 'test|input.ab6bd_field' (length=22) + // 1 => string 'test' (length=4) + // 2 => string 'input' (length=5) + // 3 => string 'ab6bd_field' (length=11) + if (preg_match('/^(?:([a-z]++)\|)?+([\w-]++|\*)?+\.([\w-]++)$/i', trim($source), $matches)) { + return array( + new SelectorNode(new ClassNode(new ElementNode($matches[1] ?: null, $matches[2] ?: null), $matches[3])), + ); + } + + return array(); + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Shortcut/ElementParser.php b/application/vendor/symfony/css-selector/Parser/Shortcut/ElementParser.php new file mode 100644 index 0000000..c29f5e4 --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Shortcut/ElementParser.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser\Shortcut; + +use Symfony\Component\CssSelector\Node\ElementNode; +use Symfony\Component\CssSelector\Node\SelectorNode; +use Symfony\Component\CssSelector\Parser\ParserInterface; + +/** + * CSS selector element parser shortcut. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class ElementParser implements ParserInterface +{ + /** + * {@inheritdoc} + */ + public function parse($source) + { + // Matches an optional namespace, required element or `*` + // $source = 'testns|testel'; + // $matches = array (size=3) + // 0 => string 'testns|testel' (length=13) + // 1 => string 'testns' (length=6) + // 2 => string 'testel' (length=6) + if (preg_match('/^(?:([a-z]++)\|)?([\w-]++|\*)$/i', trim($source), $matches)) { + return array(new SelectorNode(new ElementNode($matches[1] ?: null, $matches[2]))); + } + + return array(); + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php b/application/vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php new file mode 100644 index 0000000..16d374a --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser\Shortcut; + +use Symfony\Component\CssSelector\Node\ElementNode; +use Symfony\Component\CssSelector\Node\SelectorNode; +use Symfony\Component\CssSelector\Parser\ParserInterface; + +/** + * CSS selector class parser shortcut. + * + * This shortcut ensure compatibility with previous version. + * - The parser fails to parse an empty string. + * - In the previous version, an empty string matches each tags. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class EmptyStringParser implements ParserInterface +{ + /** + * {@inheritdoc} + */ + public function parse($source) + { + // Matches an empty string + if ('' == $source) { + return array(new SelectorNode(new ElementNode(null, '*'))); + } + + return array(); + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Shortcut/HashParser.php b/application/vendor/symfony/css-selector/Parser/Shortcut/HashParser.php new file mode 100644 index 0000000..3f3883b --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Shortcut/HashParser.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser\Shortcut; + +use Symfony\Component\CssSelector\Node\ElementNode; +use Symfony\Component\CssSelector\Node\HashNode; +use Symfony\Component\CssSelector\Node\SelectorNode; +use Symfony\Component\CssSelector\Parser\ParserInterface; + +/** + * CSS selector hash parser shortcut. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class HashParser implements ParserInterface +{ + /** + * {@inheritdoc} + */ + public function parse($source) + { + // Matches an optional namespace, optional element, and required id + // $source = 'test|input#ab6bd_field'; + // $matches = array (size=4) + // 0 => string 'test|input#ab6bd_field' (length=22) + // 1 => string 'test' (length=4) + // 2 => string 'input' (length=5) + // 3 => string 'ab6bd_field' (length=11) + if (preg_match('/^(?:([a-z]++)\|)?+([\w-]++|\*)?+#([\w-]++)$/i', trim($source), $matches)) { + return array( + new SelectorNode(new HashNode(new ElementNode($matches[1] ?: null, $matches[2] ?: null), $matches[3])), + ); + } + + return array(); + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Token.php b/application/vendor/symfony/css-selector/Parser/Token.php new file mode 100644 index 0000000..72baae7 --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Token.php @@ -0,0 +1,149 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser; + +/** + * CSS selector token. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class Token +{ + const TYPE_FILE_END = 'eof'; + const TYPE_DELIMITER = 'delimiter'; + const TYPE_WHITESPACE = 'whitespace'; + const TYPE_IDENTIFIER = 'identifier'; + const TYPE_HASH = 'hash'; + const TYPE_NUMBER = 'number'; + const TYPE_STRING = 'string'; + + private $type; + private $value; + private $position; + + /** + * @param int $type + * @param string $value + * @param int $position + */ + public function __construct($type, $value, $position) + { + $this->type = $type; + $this->value = $value; + $this->position = $position; + } + + /** + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @return int + */ + public function getPosition() + { + return $this->position; + } + + /** + * @return bool + */ + public function isFileEnd() + { + return self::TYPE_FILE_END === $this->type; + } + + /** + * @return bool + */ + public function isDelimiter(array $values = array()) + { + if (self::TYPE_DELIMITER !== $this->type) { + return false; + } + + if (empty($values)) { + return true; + } + + return \in_array($this->value, $values); + } + + /** + * @return bool + */ + public function isWhitespace() + { + return self::TYPE_WHITESPACE === $this->type; + } + + /** + * @return bool + */ + public function isIdentifier() + { + return self::TYPE_IDENTIFIER === $this->type; + } + + /** + * @return bool + */ + public function isHash() + { + return self::TYPE_HASH === $this->type; + } + + /** + * @return bool + */ + public function isNumber() + { + return self::TYPE_NUMBER === $this->type; + } + + /** + * @return bool + */ + public function isString() + { + return self::TYPE_STRING === $this->type; + } + + /** + * @return string + */ + public function __toString() + { + if ($this->value) { + return sprintf('<%s "%s" at %s>', $this->type, $this->value, $this->position); + } + + return sprintf('<%s at %s>', $this->type, $this->position); + } +} diff --git a/application/vendor/symfony/css-selector/Parser/TokenStream.php b/application/vendor/symfony/css-selector/Parser/TokenStream.php new file mode 100644 index 0000000..d2aee54 --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/TokenStream.php @@ -0,0 +1,175 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser; + +use Symfony\Component\CssSelector\Exception\InternalErrorException; +use Symfony\Component\CssSelector\Exception\SyntaxErrorException; + +/** + * CSS selector token stream. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class TokenStream +{ + /** + * @var Token[] + */ + private $tokens = array(); + + /** + * @var Token[] + */ + private $used = array(); + + /** + * @var int + */ + private $cursor = 0; + + /** + * @var Token|null + */ + private $peeked; + + /** + * @var bool + */ + private $peeking = false; + + /** + * Pushes a token. + * + * @return $this + */ + public function push(Token $token) + { + $this->tokens[] = $token; + + return $this; + } + + /** + * Freezes stream. + * + * @return $this + */ + public function freeze() + { + return $this; + } + + /** + * Returns next token. + * + * @return Token + * + * @throws InternalErrorException If there is no more token + */ + public function getNext() + { + if ($this->peeking) { + $this->peeking = false; + $this->used[] = $this->peeked; + + return $this->peeked; + } + + if (!isset($this->tokens[$this->cursor])) { + throw new InternalErrorException('Unexpected token stream end.'); + } + + return $this->tokens[$this->cursor++]; + } + + /** + * Returns peeked token. + * + * @return Token + */ + public function getPeek() + { + if (!$this->peeking) { + $this->peeked = $this->getNext(); + $this->peeking = true; + } + + return $this->peeked; + } + + /** + * Returns used tokens. + * + * @return Token[] + */ + public function getUsed() + { + return $this->used; + } + + /** + * Returns nex identifier token. + * + * @return string The identifier token value + * + * @throws SyntaxErrorException If next token is not an identifier + */ + public function getNextIdentifier() + { + $next = $this->getNext(); + + if (!$next->isIdentifier()) { + throw SyntaxErrorException::unexpectedToken('identifier', $next); + } + + return $next->getValue(); + } + + /** + * Returns nex identifier or star delimiter token. + * + * @return string|null The identifier token value or null if star found + * + * @throws SyntaxErrorException If next token is not an identifier or a star delimiter + */ + public function getNextIdentifierOrStar() + { + $next = $this->getNext(); + + if ($next->isIdentifier()) { + return $next->getValue(); + } + + if ($next->isDelimiter(array('*'))) { + return; + } + + throw SyntaxErrorException::unexpectedToken('identifier or "*"', $next); + } + + /** + * Skips next whitespace if any. + */ + public function skipWhitespace() + { + $peek = $this->getPeek(); + + if ($peek->isWhitespace()) { + $this->getNext(); + } + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Tokenizer/Tokenizer.php b/application/vendor/symfony/css-selector/Parser/Tokenizer/Tokenizer.php new file mode 100644 index 0000000..e32b4d2 --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Tokenizer/Tokenizer.php @@ -0,0 +1,75 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser\Tokenizer; + +use Symfony\Component\CssSelector\Parser\Handler; +use Symfony\Component\CssSelector\Parser\Reader; +use Symfony\Component\CssSelector\Parser\Token; +use Symfony\Component\CssSelector\Parser\TokenStream; + +/** + * CSS selector tokenizer. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class Tokenizer +{ + /** + * @var Handler\HandlerInterface[] + */ + private $handlers; + + public function __construct() + { + $patterns = new TokenizerPatterns(); + $escaping = new TokenizerEscaping($patterns); + + $this->handlers = array( + new Handler\WhitespaceHandler(), + new Handler\IdentifierHandler($patterns, $escaping), + new Handler\HashHandler($patterns, $escaping), + new Handler\StringHandler($patterns, $escaping), + new Handler\NumberHandler($patterns), + new Handler\CommentHandler(), + ); + } + + /** + * Tokenize selector source code. + * + * @return TokenStream + */ + public function tokenize(Reader $reader) + { + $stream = new TokenStream(); + + while (!$reader->isEOF()) { + foreach ($this->handlers as $handler) { + if ($handler->handle($reader, $stream)) { + continue 2; + } + } + + $stream->push(new Token(Token::TYPE_DELIMITER, $reader->getSubstring(1), $reader->getPosition())); + $reader->moveForward(1); + } + + return $stream + ->push(new Token(Token::TYPE_FILE_END, null, $reader->getPosition())) + ->freeze(); + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php b/application/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php new file mode 100644 index 0000000..55ea421 --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php @@ -0,0 +1,78 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser\Tokenizer; + +/** + * CSS selector tokenizer escaping applier. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class TokenizerEscaping +{ + private $patterns; + + public function __construct(TokenizerPatterns $patterns) + { + $this->patterns = $patterns; + } + + /** + * @param string $value + * + * @return string + */ + public function escapeUnicode($value) + { + $value = $this->replaceUnicodeSequences($value); + + return preg_replace($this->patterns->getSimpleEscapePattern(), '$1', $value); + } + + /** + * @param string $value + * + * @return string + */ + public function escapeUnicodeAndNewLine($value) + { + $value = preg_replace($this->patterns->getNewLineEscapePattern(), '', $value); + + return $this->escapeUnicode($value); + } + + /** + * @param string $value + * + * @return string + */ + private function replaceUnicodeSequences($value) + { + return preg_replace_callback($this->patterns->getUnicodeEscapePattern(), function ($match) { + $c = hexdec($match[1]); + + if (0x80 > $c %= 0x200000) { + return \chr($c); + } + if (0x800 > $c) { + return \chr(0xC0 | $c >> 6).\chr(0x80 | $c & 0x3F); + } + if (0x10000 > $c) { + return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); + } + }, $value); + } +} diff --git a/application/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php b/application/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php new file mode 100644 index 0000000..bc6130d --- /dev/null +++ b/application/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Parser\Tokenizer; + +/** + * CSS selector tokenizer patterns builder. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class TokenizerPatterns +{ + private $unicodeEscapePattern; + private $simpleEscapePattern; + private $newLineEscapePattern; + private $escapePattern; + private $stringEscapePattern; + private $nonAsciiPattern; + private $nmCharPattern; + private $nmStartPattern; + private $identifierPattern; + private $hashPattern; + private $numberPattern; + private $quotedStringPattern; + + public function __construct() + { + $this->unicodeEscapePattern = '\\\\([0-9a-f]{1,6})(?:\r\n|[ \n\r\t\f])?'; + $this->simpleEscapePattern = '\\\\(.)'; + $this->newLineEscapePattern = '\\\\(?:\n|\r\n|\r|\f)'; + $this->escapePattern = $this->unicodeEscapePattern.'|\\\\[^\n\r\f0-9a-f]'; + $this->stringEscapePattern = $this->newLineEscapePattern.'|'.$this->escapePattern; + $this->nonAsciiPattern = '[^\x00-\x7F]'; + $this->nmCharPattern = '[_a-z0-9-]|'.$this->escapePattern.'|'.$this->nonAsciiPattern; + $this->nmStartPattern = '[_a-z]|'.$this->escapePattern.'|'.$this->nonAsciiPattern; + $this->identifierPattern = '-?(?:'.$this->nmStartPattern.')(?:'.$this->nmCharPattern.')*'; + $this->hashPattern = '#((?:'.$this->nmCharPattern.')+)'; + $this->numberPattern = '[+-]?(?:[0-9]*\.[0-9]+|[0-9]+)'; + $this->quotedStringPattern = '([^\n\r\f%s]|'.$this->stringEscapePattern.')*'; + } + + /** + * @return string + */ + public function getNewLineEscapePattern() + { + return '~^'.$this->newLineEscapePattern.'~'; + } + + /** + * @return string + */ + public function getSimpleEscapePattern() + { + return '~^'.$this->simpleEscapePattern.'~'; + } + + /** + * @return string + */ + public function getUnicodeEscapePattern() + { + return '~^'.$this->unicodeEscapePattern.'~i'; + } + + /** + * @return string + */ + public function getIdentifierPattern() + { + return '~^'.$this->identifierPattern.'~i'; + } + + /** + * @return string + */ + public function getHashPattern() + { + return '~^'.$this->hashPattern.'~i'; + } + + /** + * @return string + */ + public function getNumberPattern() + { + return '~^'.$this->numberPattern.'~'; + } + + /** + * @param string $quote + * + * @return string + */ + public function getQuotedStringPattern($quote) + { + return '~^'.sprintf($this->quotedStringPattern, $quote).'~i'; + } +} diff --git a/application/vendor/symfony/css-selector/README.md b/application/vendor/symfony/css-selector/README.md new file mode 100644 index 0000000..7c4c411 --- /dev/null +++ b/application/vendor/symfony/css-selector/README.md @@ -0,0 +1,20 @@ +CssSelector Component +===================== + +The CssSelector component converts CSS selectors to XPath expressions. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/css_selector.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) + +Credits +------- + +This component is a port of the Python cssselect library +[v0.7.1](https://github.com/SimonSapin/cssselect/releases/tag/v0.7.1), +which is distributed under the BSD license. diff --git a/application/vendor/symfony/css-selector/Tests/CssSelectorConverterTest.php b/application/vendor/symfony/css-selector/Tests/CssSelectorConverterTest.php new file mode 100644 index 0000000..a3eea7a --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/CssSelectorConverterTest.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\CssSelector\CssSelectorConverter; + +class CssSelectorConverterTest extends TestCase +{ + public function testCssToXPath() + { + $converter = new CssSelectorConverter(); + + $this->assertEquals('descendant-or-self::*', $converter->toXPath('')); + $this->assertEquals('descendant-or-self::h1', $converter->toXPath('h1')); + $this->assertEquals("descendant-or-self::h1[@id = 'foo']", $converter->toXPath('h1#foo')); + $this->assertEquals("descendant-or-self::h1[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]", $converter->toXPath('h1.foo')); + $this->assertEquals('descendant-or-self::foo:h1', $converter->toXPath('foo|h1')); + $this->assertEquals('descendant-or-self::h1', $converter->toXPath('H1')); + } + + public function testCssToXPathXml() + { + $converter = new CssSelectorConverter(false); + + $this->assertEquals('descendant-or-self::H1', $converter->toXPath('H1')); + } + + /** + * @expectedException \Symfony\Component\CssSelector\Exception\ParseException + * @expectedExceptionMessage Expected identifier, but found. + */ + public function testParseExceptions() + { + $converter = new CssSelectorConverter(); + $converter->toXPath('h1:'); + } + + /** @dataProvider getCssToXPathWithoutPrefixTestData */ + public function testCssToXPathWithoutPrefix($css, $xpath) + { + $converter = new CssSelectorConverter(); + + $this->assertEquals($xpath, $converter->toXPath($css, ''), '->parse() parses an input string and returns a node'); + } + + public function getCssToXPathWithoutPrefixTestData() + { + return array( + array('h1', 'h1'), + array('foo|h1', 'foo:h1'), + array('h1, h2, h3', 'h1 | h2 | h3'), + array('h1:nth-child(3n+1)', "*/*[(name() = 'h1') and (position() - 1 >= 0 and (position() - 1) mod 3 = 0)]"), + array('h1 > p', 'h1/p'), + array('h1#foo', "h1[@id = 'foo']"), + array('h1.foo', "h1[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"), + array('h1[class*="foo bar"]', "h1[@class and contains(@class, 'foo bar')]"), + array('h1[foo|class*="foo bar"]', "h1[@foo:class and contains(@foo:class, 'foo bar')]"), + array('h1[class]', 'h1[@class]'), + array('h1 .foo', "h1/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"), + array('h1 #foo', "h1/descendant-or-self::*/*[@id = 'foo']"), + array('h1 [class*=foo]', "h1/descendant-or-self::*/*[@class and contains(@class, 'foo')]"), + array('div>.foo', "div/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"), + array('div > .foo', "div/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/CssSelectorTest.php b/application/vendor/symfony/css-selector/Tests/CssSelectorTest.php new file mode 100644 index 0000000..f8ba536 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/CssSelectorTest.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\CssSelector\CssSelector; + +/** + * @group legacy + */ +class CssSelectorTest extends TestCase +{ + public function testCssToXPath() + { + $this->assertEquals('descendant-or-self::*', CssSelector::toXPath('')); + $this->assertEquals('descendant-or-self::h1', CssSelector::toXPath('h1')); + $this->assertEquals("descendant-or-self::h1[@id = 'foo']", CssSelector::toXPath('h1#foo')); + $this->assertEquals("descendant-or-self::h1[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]", CssSelector::toXPath('h1.foo')); + $this->assertEquals('descendant-or-self::foo:h1', CssSelector::toXPath('foo|h1')); + } + + /** @dataProvider getCssToXPathWithoutPrefixTestData */ + public function testCssToXPathWithoutPrefix($css, $xpath) + { + $this->assertEquals($xpath, CssSelector::toXPath($css, ''), '->parse() parses an input string and returns a node'); + } + + public function testParseExceptions() + { + try { + CssSelector::toXPath('h1:'); + $this->fail('->parse() throws an Exception if the css selector is not valid'); + } catch (\Exception $e) { + $this->assertInstanceOf('\Symfony\Component\CssSelector\Exception\ParseException', $e, '->parse() throws an Exception if the css selector is not valid'); + $this->assertEquals('Expected identifier, but found.', $e->getMessage(), '->parse() throws an Exception if the css selector is not valid'); + } + } + + public function getCssToXPathWithoutPrefixTestData() + { + return array( + array('h1', 'h1'), + array('foo|h1', 'foo:h1'), + array('h1, h2, h3', 'h1 | h2 | h3'), + array('h1:nth-child(3n+1)', "*/*[(name() = 'h1') and (position() - 1 >= 0 and (position() - 1) mod 3 = 0)]"), + array('h1 > p', 'h1/p'), + array('h1#foo', "h1[@id = 'foo']"), + array('h1.foo', "h1[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"), + array('h1[class*="foo bar"]', "h1[@class and contains(@class, 'foo bar')]"), + array('h1[foo|class*="foo bar"]', "h1[@foo:class and contains(@foo:class, 'foo bar')]"), + array('h1[class]', 'h1[@class]'), + array('h1 .foo', "h1/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"), + array('h1 #foo', "h1/descendant-or-self::*/*[@id = 'foo']"), + array('h1 [class*=foo]', "h1/descendant-or-self::*/*[@class and contains(@class, 'foo')]"), + array('div>.foo', "div/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"), + array('div > .foo', "div/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Node/AbstractNodeTest.php b/application/vendor/symfony/css-selector/Tests/Node/AbstractNodeTest.php new file mode 100644 index 0000000..5955513 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Node/AbstractNodeTest.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Node; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\CssSelector\Node\NodeInterface; + +abstract class AbstractNodeTest extends TestCase +{ + /** @dataProvider getToStringConversionTestData */ + public function testToStringConversion(NodeInterface $node, $representation) + { + $this->assertEquals($representation, (string) $node); + } + + /** @dataProvider getSpecificityValueTestData */ + public function testSpecificityValue(NodeInterface $node, $value) + { + $this->assertEquals($value, $node->getSpecificity()->getValue()); + } + + abstract public function getToStringConversionTestData(); + + abstract public function getSpecificityValueTestData(); +} diff --git a/application/vendor/symfony/css-selector/Tests/Node/AttributeNodeTest.php b/application/vendor/symfony/css-selector/Tests/Node/AttributeNodeTest.php new file mode 100644 index 0000000..1fd090f --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Node/AttributeNodeTest.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Node; + +use Symfony\Component\CssSelector\Node\AttributeNode; +use Symfony\Component\CssSelector\Node\ElementNode; + +class AttributeNodeTest extends AbstractNodeTest +{ + public function getToStringConversionTestData() + { + return array( + array(new AttributeNode(new ElementNode(), null, 'attribute', 'exists', null), 'Attribute[Element[*][attribute]]'), + array(new AttributeNode(new ElementNode(), null, 'attribute', '$=', 'value'), "Attribute[Element[*][attribute $= 'value']]"), + array(new AttributeNode(new ElementNode(), 'namespace', 'attribute', '$=', 'value'), "Attribute[Element[*][namespace|attribute $= 'value']]"), + ); + } + + public function getSpecificityValueTestData() + { + return array( + array(new AttributeNode(new ElementNode(), null, 'attribute', 'exists', null), 10), + array(new AttributeNode(new ElementNode(null, 'element'), null, 'attribute', 'exists', null), 11), + array(new AttributeNode(new ElementNode(), null, 'attribute', '$=', 'value'), 10), + array(new AttributeNode(new ElementNode(), 'namespace', 'attribute', '$=', 'value'), 10), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Node/ClassNodeTest.php b/application/vendor/symfony/css-selector/Tests/Node/ClassNodeTest.php new file mode 100644 index 0000000..e0ab45a --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Node/ClassNodeTest.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Node; + +use Symfony\Component\CssSelector\Node\ClassNode; +use Symfony\Component\CssSelector\Node\ElementNode; + +class ClassNodeTest extends AbstractNodeTest +{ + public function getToStringConversionTestData() + { + return array( + array(new ClassNode(new ElementNode(), 'class'), 'Class[Element[*].class]'), + ); + } + + public function getSpecificityValueTestData() + { + return array( + array(new ClassNode(new ElementNode(), 'class'), 10), + array(new ClassNode(new ElementNode(null, 'element'), 'class'), 11), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Node/CombinedSelectorNodeTest.php b/application/vendor/symfony/css-selector/Tests/Node/CombinedSelectorNodeTest.php new file mode 100644 index 0000000..9547298 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Node/CombinedSelectorNodeTest.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Node; + +use Symfony\Component\CssSelector\Node\CombinedSelectorNode; +use Symfony\Component\CssSelector\Node\ElementNode; + +class CombinedSelectorNodeTest extends AbstractNodeTest +{ + public function getToStringConversionTestData() + { + return array( + array(new CombinedSelectorNode(new ElementNode(), '>', new ElementNode()), 'CombinedSelector[Element[*] > Element[*]]'), + array(new CombinedSelectorNode(new ElementNode(), ' ', new ElementNode()), 'CombinedSelector[Element[*] Element[*]]'), + ); + } + + public function getSpecificityValueTestData() + { + return array( + array(new CombinedSelectorNode(new ElementNode(), '>', new ElementNode()), 0), + array(new CombinedSelectorNode(new ElementNode(null, 'element'), '>', new ElementNode()), 1), + array(new CombinedSelectorNode(new ElementNode(null, 'element'), '>', new ElementNode(null, 'element')), 2), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Node/ElementNodeTest.php b/application/vendor/symfony/css-selector/Tests/Node/ElementNodeTest.php new file mode 100644 index 0000000..6d24789 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Node/ElementNodeTest.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Node; + +use Symfony\Component\CssSelector\Node\ElementNode; + +class ElementNodeTest extends AbstractNodeTest +{ + public function getToStringConversionTestData() + { + return array( + array(new ElementNode(), 'Element[*]'), + array(new ElementNode(null, 'element'), 'Element[element]'), + array(new ElementNode('namespace', 'element'), 'Element[namespace|element]'), + ); + } + + public function getSpecificityValueTestData() + { + return array( + array(new ElementNode(), 0), + array(new ElementNode(null, 'element'), 1), + array(new ElementNode('namespace', 'element'), 1), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Node/FunctionNodeTest.php b/application/vendor/symfony/css-selector/Tests/Node/FunctionNodeTest.php new file mode 100644 index 0000000..ee3ce51 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Node/FunctionNodeTest.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Node; + +use Symfony\Component\CssSelector\Node\ElementNode; +use Symfony\Component\CssSelector\Node\FunctionNode; +use Symfony\Component\CssSelector\Parser\Token; + +class FunctionNodeTest extends AbstractNodeTest +{ + public function getToStringConversionTestData() + { + return array( + array(new FunctionNode(new ElementNode(), 'function'), 'Function[Element[*]:function()]'), + array(new FunctionNode(new ElementNode(), 'function', array( + new Token(Token::TYPE_IDENTIFIER, 'value', 0), + )), "Function[Element[*]:function(['value'])]"), + array(new FunctionNode(new ElementNode(), 'function', array( + new Token(Token::TYPE_STRING, 'value1', 0), + new Token(Token::TYPE_NUMBER, 'value2', 0), + )), "Function[Element[*]:function(['value1', 'value2'])]"), + ); + } + + public function getSpecificityValueTestData() + { + return array( + array(new FunctionNode(new ElementNode(), 'function'), 10), + array(new FunctionNode(new ElementNode(), 'function', array( + new Token(Token::TYPE_IDENTIFIER, 'value', 0), + )), 10), + array(new FunctionNode(new ElementNode(), 'function', array( + new Token(Token::TYPE_STRING, 'value1', 0), + new Token(Token::TYPE_NUMBER, 'value2', 0), + )), 10), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Node/HashNodeTest.php b/application/vendor/symfony/css-selector/Tests/Node/HashNodeTest.php new file mode 100644 index 0000000..3bc74da --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Node/HashNodeTest.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Node; + +use Symfony\Component\CssSelector\Node\ElementNode; +use Symfony\Component\CssSelector\Node\HashNode; + +class HashNodeTest extends AbstractNodeTest +{ + public function getToStringConversionTestData() + { + return array( + array(new HashNode(new ElementNode(), 'id'), 'Hash[Element[*]#id]'), + ); + } + + public function getSpecificityValueTestData() + { + return array( + array(new HashNode(new ElementNode(), 'id'), 100), + array(new HashNode(new ElementNode(null, 'id'), 'class'), 101), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Node/NegationNodeTest.php b/application/vendor/symfony/css-selector/Tests/Node/NegationNodeTest.php new file mode 100644 index 0000000..ed4d248 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Node/NegationNodeTest.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Node; + +use Symfony\Component\CssSelector\Node\ClassNode; +use Symfony\Component\CssSelector\Node\ElementNode; +use Symfony\Component\CssSelector\Node\NegationNode; + +class NegationNodeTest extends AbstractNodeTest +{ + public function getToStringConversionTestData() + { + return array( + array(new NegationNode(new ElementNode(), new ClassNode(new ElementNode(), 'class')), 'Negation[Element[*]:not(Class[Element[*].class])]'), + ); + } + + public function getSpecificityValueTestData() + { + return array( + array(new NegationNode(new ElementNode(), new ClassNode(new ElementNode(), 'class')), 10), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Node/PseudoNodeTest.php b/application/vendor/symfony/css-selector/Tests/Node/PseudoNodeTest.php new file mode 100644 index 0000000..bc57813 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Node/PseudoNodeTest.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Node; + +use Symfony\Component\CssSelector\Node\ElementNode; +use Symfony\Component\CssSelector\Node\PseudoNode; + +class PseudoNodeTest extends AbstractNodeTest +{ + public function getToStringConversionTestData() + { + return array( + array(new PseudoNode(new ElementNode(), 'pseudo'), 'Pseudo[Element[*]:pseudo]'), + ); + } + + public function getSpecificityValueTestData() + { + return array( + array(new PseudoNode(new ElementNode(), 'pseudo'), 10), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Node/SelectorNodeTest.php b/application/vendor/symfony/css-selector/Tests/Node/SelectorNodeTest.php new file mode 100644 index 0000000..5badf71 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Node/SelectorNodeTest.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Node; + +use Symfony\Component\CssSelector\Node\ElementNode; +use Symfony\Component\CssSelector\Node\SelectorNode; + +class SelectorNodeTest extends AbstractNodeTest +{ + public function getToStringConversionTestData() + { + return array( + array(new SelectorNode(new ElementNode()), 'Selector[Element[*]]'), + array(new SelectorNode(new ElementNode(), 'pseudo'), 'Selector[Element[*]::pseudo]'), + ); + } + + public function getSpecificityValueTestData() + { + return array( + array(new SelectorNode(new ElementNode()), 0), + array(new SelectorNode(new ElementNode(), 'pseudo'), 1), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Node/SpecificityTest.php b/application/vendor/symfony/css-selector/Tests/Node/SpecificityTest.php new file mode 100644 index 0000000..b58eb89 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Node/SpecificityTest.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Node; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\CssSelector\Node\Specificity; + +class SpecificityTest extends TestCase +{ + /** @dataProvider getValueTestData */ + public function testValue(Specificity $specificity, $value) + { + $this->assertEquals($value, $specificity->getValue()); + } + + /** @dataProvider getValueTestData */ + public function testPlusValue(Specificity $specificity, $value) + { + $this->assertEquals($value + 123, $specificity->plus(new Specificity(1, 2, 3))->getValue()); + } + + public function getValueTestData() + { + return array( + array(new Specificity(0, 0, 0), 0), + array(new Specificity(0, 0, 2), 2), + array(new Specificity(0, 3, 0), 30), + array(new Specificity(4, 0, 0), 400), + array(new Specificity(4, 3, 2), 432), + ); + } + + /** @dataProvider getCompareTestData */ + public function testCompareTo(Specificity $a, Specificity $b, $result) + { + $this->assertEquals($result, $a->compareTo($b)); + } + + public function getCompareTestData() + { + return array( + array(new Specificity(0, 0, 0), new Specificity(0, 0, 0), 0), + array(new Specificity(0, 0, 1), new Specificity(0, 0, 1), 0), + array(new Specificity(0, 0, 2), new Specificity(0, 0, 1), 1), + array(new Specificity(0, 0, 2), new Specificity(0, 0, 3), -1), + array(new Specificity(0, 4, 0), new Specificity(0, 4, 0), 0), + array(new Specificity(0, 6, 0), new Specificity(0, 5, 11), 1), + array(new Specificity(0, 7, 0), new Specificity(0, 8, 0), -1), + array(new Specificity(9, 0, 0), new Specificity(9, 0, 0), 0), + array(new Specificity(11, 0, 0), new Specificity(10, 11, 0), 1), + array(new Specificity(12, 11, 0), new Specificity(13, 0, 0), -1), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Parser/Handler/AbstractHandlerTest.php b/application/vendor/symfony/css-selector/Tests/Parser/Handler/AbstractHandlerTest.php new file mode 100644 index 0000000..f5c9dc8 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Parser/Handler/AbstractHandlerTest.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Parser\Handler; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\CssSelector\Parser\Reader; +use Symfony\Component\CssSelector\Parser\Token; +use Symfony\Component\CssSelector\Parser\TokenStream; + +/** + * @author Jean-François Simon + */ +abstract class AbstractHandlerTest extends TestCase +{ + /** @dataProvider getHandleValueTestData */ + public function testHandleValue($value, Token $expectedToken, $remainingContent) + { + $reader = new Reader($value); + $stream = new TokenStream(); + + $this->assertTrue($this->generateHandler()->handle($reader, $stream)); + $this->assertEquals($expectedToken, $stream->getNext()); + $this->assertRemainingContent($reader, $remainingContent); + } + + /** @dataProvider getDontHandleValueTestData */ + public function testDontHandleValue($value) + { + $reader = new Reader($value); + $stream = new TokenStream(); + + $this->assertFalse($this->generateHandler()->handle($reader, $stream)); + $this->assertStreamEmpty($stream); + $this->assertRemainingContent($reader, $value); + } + + abstract public function getHandleValueTestData(); + + abstract public function getDontHandleValueTestData(); + + abstract protected function generateHandler(); + + protected function assertStreamEmpty(TokenStream $stream) + { + $property = new \ReflectionProperty($stream, 'tokens'); + $property->setAccessible(true); + + $this->assertEquals(array(), $property->getValue($stream)); + } + + protected function assertRemainingContent(Reader $reader, $remainingContent) + { + if ('' === $remainingContent) { + $this->assertEquals(0, $reader->getRemainingLength()); + $this->assertTrue($reader->isEOF()); + } else { + $this->assertEquals(\strlen($remainingContent), $reader->getRemainingLength()); + $this->assertEquals(0, $reader->getOffset($remainingContent)); + } + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Parser/Handler/CommentHandlerTest.php b/application/vendor/symfony/css-selector/Tests/Parser/Handler/CommentHandlerTest.php new file mode 100644 index 0000000..3961bf7 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Parser/Handler/CommentHandlerTest.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Parser\Handler; + +use Symfony\Component\CssSelector\Parser\Handler\CommentHandler; +use Symfony\Component\CssSelector\Parser\Reader; +use Symfony\Component\CssSelector\Parser\Token; +use Symfony\Component\CssSelector\Parser\TokenStream; + +class CommentHandlerTest extends AbstractHandlerTest +{ + /** @dataProvider getHandleValueTestData */ + public function testHandleValue($value, Token $unusedArgument, $remainingContent) + { + $reader = new Reader($value); + $stream = new TokenStream(); + + $this->assertTrue($this->generateHandler()->handle($reader, $stream)); + // comments are ignored (not pushed as token in stream) + $this->assertStreamEmpty($stream); + $this->assertRemainingContent($reader, $remainingContent); + } + + public function getHandleValueTestData() + { + return array( + // 2nd argument only exists for inherited method compatibility + array('/* comment */', new Token(null, null, null), ''), + array('/* comment */foo', new Token(null, null, null), 'foo'), + ); + } + + public function getDontHandleValueTestData() + { + return array( + array('>'), + array('+'), + array(' '), + ); + } + + protected function generateHandler() + { + return new CommentHandler(); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Parser/Handler/HashHandlerTest.php b/application/vendor/symfony/css-selector/Tests/Parser/Handler/HashHandlerTest.php new file mode 100644 index 0000000..5730120 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Parser/Handler/HashHandlerTest.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Parser\Handler; + +use Symfony\Component\CssSelector\Parser\Handler\HashHandler; +use Symfony\Component\CssSelector\Parser\Token; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; + +class HashHandlerTest extends AbstractHandlerTest +{ + public function getHandleValueTestData() + { + return array( + array('#id', new Token(Token::TYPE_HASH, 'id', 0), ''), + array('#123', new Token(Token::TYPE_HASH, '123', 0), ''), + + array('#id.class', new Token(Token::TYPE_HASH, 'id', 0), '.class'), + array('#id element', new Token(Token::TYPE_HASH, 'id', 0), ' element'), + ); + } + + public function getDontHandleValueTestData() + { + return array( + array('id'), + array('123'), + array('<'), + array('<'), + array('#'), + ); + } + + protected function generateHandler() + { + $patterns = new TokenizerPatterns(); + + return new HashHandler($patterns, new TokenizerEscaping($patterns)); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Parser/Handler/IdentifierHandlerTest.php b/application/vendor/symfony/css-selector/Tests/Parser/Handler/IdentifierHandlerTest.php new file mode 100644 index 0000000..f56430c --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Parser/Handler/IdentifierHandlerTest.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Parser\Handler; + +use Symfony\Component\CssSelector\Parser\Handler\IdentifierHandler; +use Symfony\Component\CssSelector\Parser\Token; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; + +class IdentifierHandlerTest extends AbstractHandlerTest +{ + public function getHandleValueTestData() + { + return array( + array('foo', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), ''), + array('foo|bar', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '|bar'), + array('foo.class', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '.class'), + array('foo[attr]', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '[attr]'), + array('foo bar', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), ' bar'), + ); + } + + public function getDontHandleValueTestData() + { + return array( + array('>'), + array('+'), + array(' '), + array('*|foo'), + array('/* comment */'), + ); + } + + protected function generateHandler() + { + $patterns = new TokenizerPatterns(); + + return new IdentifierHandler($patterns, new TokenizerEscaping($patterns)); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Parser/Handler/NumberHandlerTest.php b/application/vendor/symfony/css-selector/Tests/Parser/Handler/NumberHandlerTest.php new file mode 100644 index 0000000..675fd05 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Parser/Handler/NumberHandlerTest.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Parser\Handler; + +use Symfony\Component\CssSelector\Parser\Handler\NumberHandler; +use Symfony\Component\CssSelector\Parser\Token; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; + +class NumberHandlerTest extends AbstractHandlerTest +{ + public function getHandleValueTestData() + { + return array( + array('12', new Token(Token::TYPE_NUMBER, '12', 0), ''), + array('12.34', new Token(Token::TYPE_NUMBER, '12.34', 0), ''), + array('+12.34', new Token(Token::TYPE_NUMBER, '+12.34', 0), ''), + array('-12.34', new Token(Token::TYPE_NUMBER, '-12.34', 0), ''), + + array('12 arg', new Token(Token::TYPE_NUMBER, '12', 0), ' arg'), + array('12]', new Token(Token::TYPE_NUMBER, '12', 0), ']'), + ); + } + + public function getDontHandleValueTestData() + { + return array( + array('hello'), + array('>'), + array('+'), + array(' '), + array('/* comment */'), + ); + } + + protected function generateHandler() + { + $patterns = new TokenizerPatterns(); + + return new NumberHandler($patterns); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Parser/Handler/StringHandlerTest.php b/application/vendor/symfony/css-selector/Tests/Parser/Handler/StringHandlerTest.php new file mode 100644 index 0000000..8ea5d4d --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Parser/Handler/StringHandlerTest.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Parser\Handler; + +use Symfony\Component\CssSelector\Parser\Handler\StringHandler; +use Symfony\Component\CssSelector\Parser\Token; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; + +class StringHandlerTest extends AbstractHandlerTest +{ + public function getHandleValueTestData() + { + return array( + array('"hello"', new Token(Token::TYPE_STRING, 'hello', 1), ''), + array('"1"', new Token(Token::TYPE_STRING, '1', 1), ''), + array('" "', new Token(Token::TYPE_STRING, ' ', 1), ''), + array('""', new Token(Token::TYPE_STRING, '', 1), ''), + array("'hello'", new Token(Token::TYPE_STRING, 'hello', 1), ''), + + array("'foo'bar", new Token(Token::TYPE_STRING, 'foo', 1), 'bar'), + ); + } + + public function getDontHandleValueTestData() + { + return array( + array('hello'), + array('>'), + array('1'), + array(' '), + ); + } + + protected function generateHandler() + { + $patterns = new TokenizerPatterns(); + + return new StringHandler($patterns, new TokenizerEscaping($patterns)); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Parser/Handler/WhitespaceHandlerTest.php b/application/vendor/symfony/css-selector/Tests/Parser/Handler/WhitespaceHandlerTest.php new file mode 100644 index 0000000..f5f9e71 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Parser/Handler/WhitespaceHandlerTest.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Parser\Handler; + +use Symfony\Component\CssSelector\Parser\Handler\WhitespaceHandler; +use Symfony\Component\CssSelector\Parser\Token; + +class WhitespaceHandlerTest extends AbstractHandlerTest +{ + public function getHandleValueTestData() + { + return array( + array(' ', new Token(Token::TYPE_WHITESPACE, ' ', 0), ''), + array("\n", new Token(Token::TYPE_WHITESPACE, "\n", 0), ''), + array("\t", new Token(Token::TYPE_WHITESPACE, "\t", 0), ''), + + array(' foo', new Token(Token::TYPE_WHITESPACE, ' ', 0), 'foo'), + array(' .foo', new Token(Token::TYPE_WHITESPACE, ' ', 0), '.foo'), + ); + } + + public function getDontHandleValueTestData() + { + return array( + array('>'), + array('1'), + array('a'), + ); + } + + protected function generateHandler() + { + return new WhitespaceHandler(); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Parser/ParserTest.php b/application/vendor/symfony/css-selector/Tests/Parser/ParserTest.php new file mode 100644 index 0000000..53b35a9 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Parser/ParserTest.php @@ -0,0 +1,250 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Parser; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\CssSelector\Exception\SyntaxErrorException; +use Symfony\Component\CssSelector\Node\FunctionNode; +use Symfony\Component\CssSelector\Node\SelectorNode; +use Symfony\Component\CssSelector\Parser\Parser; +use Symfony\Component\CssSelector\Parser\Token; + +class ParserTest extends TestCase +{ + /** @dataProvider getParserTestData */ + public function testParser($source, $representation) + { + $parser = new Parser(); + + $this->assertEquals($representation, array_map(function (SelectorNode $node) { + return (string) $node->getTree(); + }, $parser->parse($source))); + } + + /** @dataProvider getParserExceptionTestData */ + public function testParserException($source, $message) + { + $parser = new Parser(); + + try { + $parser->parse($source); + $this->fail('Parser should throw a SyntaxErrorException.'); + } catch (SyntaxErrorException $e) { + $this->assertEquals($message, $e->getMessage()); + } + } + + /** @dataProvider getPseudoElementsTestData */ + public function testPseudoElements($source, $element, $pseudo) + { + $parser = new Parser(); + $selectors = $parser->parse($source); + $this->assertCount(1, $selectors); + + /** @var SelectorNode $selector */ + $selector = $selectors[0]; + $this->assertEquals($element, (string) $selector->getTree()); + $this->assertEquals($pseudo, (string) $selector->getPseudoElement()); + } + + /** @dataProvider getSpecificityTestData */ + public function testSpecificity($source, $value) + { + $parser = new Parser(); + $selectors = $parser->parse($source); + $this->assertCount(1, $selectors); + + /** @var SelectorNode $selector */ + $selector = $selectors[0]; + $this->assertEquals($value, $selector->getSpecificity()->getValue()); + } + + /** @dataProvider getParseSeriesTestData */ + public function testParseSeries($series, $a, $b) + { + $parser = new Parser(); + $selectors = $parser->parse(sprintf(':nth-child(%s)', $series)); + $this->assertCount(1, $selectors); + + /** @var FunctionNode $function */ + $function = $selectors[0]->getTree(); + $this->assertEquals(array($a, $b), Parser::parseSeries($function->getArguments())); + } + + /** @dataProvider getParseSeriesExceptionTestData */ + public function testParseSeriesException($series) + { + $parser = new Parser(); + $selectors = $parser->parse(sprintf(':nth-child(%s)', $series)); + $this->assertCount(1, $selectors); + + /** @var FunctionNode $function */ + $function = $selectors[0]->getTree(); + $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException'); + Parser::parseSeries($function->getArguments()); + } + + public function getParserTestData() + { + return array( + array('*', array('Element[*]')), + array('*|*', array('Element[*]')), + array('*|foo', array('Element[foo]')), + array('foo|*', array('Element[foo|*]')), + array('foo|bar', array('Element[foo|bar]')), + array('#foo#bar', array('Hash[Hash[Element[*]#foo]#bar]')), + array('div>.foo', array('CombinedSelector[Element[div] > Class[Element[*].foo]]')), + array('div> .foo', array('CombinedSelector[Element[div] > Class[Element[*].foo]]')), + array('div >.foo', array('CombinedSelector[Element[div] > Class[Element[*].foo]]')), + array('div > .foo', array('CombinedSelector[Element[div] > Class[Element[*].foo]]')), + array("div \n> \t \t .foo", array('CombinedSelector[Element[div] > Class[Element[*].foo]]')), + array('td.foo,.bar', array('Class[Element[td].foo]', 'Class[Element[*].bar]')), + array('td.foo, .bar', array('Class[Element[td].foo]', 'Class[Element[*].bar]')), + array("td.foo\t\r\n\f ,\t\r\n\f .bar", array('Class[Element[td].foo]', 'Class[Element[*].bar]')), + array('td.foo,.bar', array('Class[Element[td].foo]', 'Class[Element[*].bar]')), + array('td.foo, .bar', array('Class[Element[td].foo]', 'Class[Element[*].bar]')), + array("td.foo\t\r\n\f ,\t\r\n\f .bar", array('Class[Element[td].foo]', 'Class[Element[*].bar]')), + array('div, td.foo, div.bar span', array('Element[div]', 'Class[Element[td].foo]', 'CombinedSelector[Class[Element[div].bar] Element[span]]')), + array('div > p', array('CombinedSelector[Element[div] > Element[p]]')), + array('td:first', array('Pseudo[Element[td]:first]')), + array('td :first', array('CombinedSelector[Element[td] Pseudo[Element[*]:first]]')), + array('a[name]', array('Attribute[Element[a][name]]')), + array("a[ name\t]", array('Attribute[Element[a][name]]')), + array('a [name]', array('CombinedSelector[Element[a] Attribute[Element[*][name]]]')), + array('a[rel="include"]', array("Attribute[Element[a][rel = 'include']]")), + array('a[rel = include]', array("Attribute[Element[a][rel = 'include']]")), + array("a[hreflang |= 'en']", array("Attribute[Element[a][hreflang |= 'en']]")), + array('a[hreflang|=en]', array("Attribute[Element[a][hreflang |= 'en']]")), + array('div:nth-child(10)', array("Function[Element[div]:nth-child(['10'])]")), + array(':nth-child(2n+2)', array("Function[Element[*]:nth-child(['2', 'n', '+2'])]")), + array('div:nth-of-type(10)', array("Function[Element[div]:nth-of-type(['10'])]")), + array('div div:nth-of-type(10) .aclass', array("CombinedSelector[CombinedSelector[Element[div] Function[Element[div]:nth-of-type(['10'])]] Class[Element[*].aclass]]")), + array('label:only', array('Pseudo[Element[label]:only]')), + array('a:lang(fr)', array("Function[Element[a]:lang(['fr'])]")), + array('div:contains("foo")', array("Function[Element[div]:contains(['foo'])]")), + array('div#foobar', array('Hash[Element[div]#foobar]')), + array('div:not(div.foo)', array('Negation[Element[div]:not(Class[Element[div].foo])]')), + array('td ~ th', array('CombinedSelector[Element[td] ~ Element[th]]')), + array('.foo[data-bar][data-baz=0]', array("Attribute[Attribute[Class[Element[*].foo][data-bar]][data-baz = '0']]")), + ); + } + + public function getParserExceptionTestData() + { + return array( + array('attributes(href)/html/body/a', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '(', 10))->getMessage()), + array('attributes(href)', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '(', 10))->getMessage()), + array('html/body/a', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '/', 4))->getMessage()), + array(' ', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_FILE_END, '', 1))->getMessage()), + array('div, ', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_FILE_END, '', 5))->getMessage()), + array(' , div', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, ',', 1))->getMessage()), + array('p, , div', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, ',', 3))->getMessage()), + array('div > ', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_FILE_END, '', 6))->getMessage()), + array(' > div', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '>', 2))->getMessage()), + array('foo|#bar', SyntaxErrorException::unexpectedToken('identifier or "*"', new Token(Token::TYPE_HASH, 'bar', 4))->getMessage()), + array('#.foo', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '#', 0))->getMessage()), + array('.#foo', SyntaxErrorException::unexpectedToken('identifier', new Token(Token::TYPE_HASH, 'foo', 1))->getMessage()), + array(':#foo', SyntaxErrorException::unexpectedToken('identifier', new Token(Token::TYPE_HASH, 'foo', 1))->getMessage()), + array('[*]', SyntaxErrorException::unexpectedToken('"|"', new Token(Token::TYPE_DELIMITER, ']', 2))->getMessage()), + array('[foo|]', SyntaxErrorException::unexpectedToken('identifier', new Token(Token::TYPE_DELIMITER, ']', 5))->getMessage()), + array('[#]', SyntaxErrorException::unexpectedToken('identifier or "*"', new Token(Token::TYPE_DELIMITER, '#', 1))->getMessage()), + array('[foo=#]', SyntaxErrorException::unexpectedToken('string or identifier', new Token(Token::TYPE_DELIMITER, '#', 5))->getMessage()), + array(':nth-child()', SyntaxErrorException::unexpectedToken('at least one argument', new Token(Token::TYPE_DELIMITER, ')', 11))->getMessage()), + array('[href]a', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_IDENTIFIER, 'a', 6))->getMessage()), + array('[rel:stylesheet]', SyntaxErrorException::unexpectedToken('operator', new Token(Token::TYPE_DELIMITER, ':', 4))->getMessage()), + array('[rel=stylesheet', SyntaxErrorException::unexpectedToken('"]"', new Token(Token::TYPE_FILE_END, '', 15))->getMessage()), + array(':lang(fr', SyntaxErrorException::unexpectedToken('an argument', new Token(Token::TYPE_FILE_END, '', 8))->getMessage()), + array(':contains("foo', SyntaxErrorException::unclosedString(10)->getMessage()), + array('foo!', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '!', 3))->getMessage()), + ); + } + + public function getPseudoElementsTestData() + { + return array( + array('foo', 'Element[foo]', ''), + array('*', 'Element[*]', ''), + array(':empty', 'Pseudo[Element[*]:empty]', ''), + array(':BEfore', 'Element[*]', 'before'), + array(':aftER', 'Element[*]', 'after'), + array(':First-Line', 'Element[*]', 'first-line'), + array(':First-Letter', 'Element[*]', 'first-letter'), + array('::befoRE', 'Element[*]', 'before'), + array('::AFter', 'Element[*]', 'after'), + array('::firsT-linE', 'Element[*]', 'first-line'), + array('::firsT-letteR', 'Element[*]', 'first-letter'), + array('::Selection', 'Element[*]', 'selection'), + array('foo:after', 'Element[foo]', 'after'), + array('foo::selection', 'Element[foo]', 'selection'), + array('lorem#ipsum ~ a#b.c[href]:empty::selection', 'CombinedSelector[Hash[Element[lorem]#ipsum] ~ Pseudo[Attribute[Class[Hash[Element[a]#b].c][href]]:empty]]', 'selection'), + array('video::-webkit-media-controls', 'Element[video]', '-webkit-media-controls'), + ); + } + + public function getSpecificityTestData() + { + return array( + array('*', 0), + array(' foo', 1), + array(':empty ', 10), + array(':before', 1), + array('*:before', 1), + array(':nth-child(2)', 10), + array('.bar', 10), + array('[baz]', 10), + array('[baz="4"]', 10), + array('[baz^="4"]', 10), + array('#lipsum', 100), + array(':not(*)', 0), + array(':not(foo)', 1), + array(':not(.foo)', 10), + array(':not([foo])', 10), + array(':not(:empty)', 10), + array(':not(#foo)', 100), + array('foo:empty', 11), + array('foo:before', 2), + array('foo::before', 2), + array('foo:empty::before', 12), + array('#lorem + foo#ipsum:first-child > bar:first-line', 213), + ); + } + + public function getParseSeriesTestData() + { + return array( + array('1n+3', 1, 3), + array('1n +3', 1, 3), + array('1n + 3', 1, 3), + array('1n+ 3', 1, 3), + array('1n-3', 1, -3), + array('1n -3', 1, -3), + array('1n - 3', 1, -3), + array('1n- 3', 1, -3), + array('n-5', 1, -5), + array('odd', 2, 1), + array('even', 2, 0), + array('3n', 3, 0), + array('n', 1, 0), + array('+n', 1, 0), + array('-n', -1, 0), + array('5', 0, 5), + ); + } + + public function getParseSeriesExceptionTestData() + { + return array( + array('foo'), + array('n+'), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Parser/ReaderTest.php b/application/vendor/symfony/css-selector/Tests/Parser/ReaderTest.php new file mode 100644 index 0000000..21eb608 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Parser/ReaderTest.php @@ -0,0 +1,102 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Parser; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\CssSelector\Parser\Reader; + +class ReaderTest extends TestCase +{ + public function testIsEOF() + { + $reader = new Reader(''); + $this->assertTrue($reader->isEOF()); + + $reader = new Reader('hello'); + $this->assertFalse($reader->isEOF()); + + $this->assignPosition($reader, 2); + $this->assertFalse($reader->isEOF()); + + $this->assignPosition($reader, 5); + $this->assertTrue($reader->isEOF()); + } + + public function testGetRemainingLength() + { + $reader = new Reader('hello'); + $this->assertEquals(5, $reader->getRemainingLength()); + + $this->assignPosition($reader, 2); + $this->assertEquals(3, $reader->getRemainingLength()); + + $this->assignPosition($reader, 5); + $this->assertEquals(0, $reader->getRemainingLength()); + } + + public function testGetSubstring() + { + $reader = new Reader('hello'); + $this->assertEquals('he', $reader->getSubstring(2)); + $this->assertEquals('el', $reader->getSubstring(2, 1)); + + $this->assignPosition($reader, 2); + $this->assertEquals('ll', $reader->getSubstring(2)); + $this->assertEquals('lo', $reader->getSubstring(2, 1)); + } + + public function testGetOffset() + { + $reader = new Reader('hello'); + $this->assertEquals(2, $reader->getOffset('ll')); + $this->assertFalse($reader->getOffset('w')); + + $this->assignPosition($reader, 2); + $this->assertEquals(0, $reader->getOffset('ll')); + $this->assertFalse($reader->getOffset('he')); + } + + public function testFindPattern() + { + $reader = new Reader('hello'); + + $this->assertFalse($reader->findPattern('/world/')); + $this->assertEquals(array('hello', 'h'), $reader->findPattern('/^([a-z]).*/')); + + $this->assignPosition($reader, 2); + $this->assertFalse($reader->findPattern('/^h.*/')); + $this->assertEquals(array('llo'), $reader->findPattern('/^llo$/')); + } + + public function testMoveForward() + { + $reader = new Reader('hello'); + $this->assertEquals(0, $reader->getPosition()); + + $reader->moveForward(2); + $this->assertEquals(2, $reader->getPosition()); + } + + public function testToEnd() + { + $reader = new Reader('hello'); + $reader->moveToEnd(); + $this->assertTrue($reader->isEOF()); + } + + private function assignPosition(Reader $reader, $value) + { + $position = new \ReflectionProperty($reader, 'position'); + $position->setAccessible(true); + $position->setValue($reader, $value); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Parser/Shortcut/ClassParserTest.php b/application/vendor/symfony/css-selector/Tests/Parser/Shortcut/ClassParserTest.php new file mode 100644 index 0000000..7e92f5b --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Parser/Shortcut/ClassParserTest.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Parser\Shortcut; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\CssSelector\Node\SelectorNode; +use Symfony\Component\CssSelector\Parser\Shortcut\ClassParser; + +/** + * @author Jean-François Simon + */ +class ClassParserTest extends TestCase +{ + /** @dataProvider getParseTestData */ + public function testParse($source, $representation) + { + $parser = new ClassParser(); + $selectors = $parser->parse($source); + $this->assertCount(1, $selectors); + + /** @var SelectorNode $selector */ + $selector = $selectors[0]; + $this->assertEquals($representation, (string) $selector->getTree()); + } + + public function getParseTestData() + { + return array( + array('.testclass', 'Class[Element[*].testclass]'), + array('testel.testclass', 'Class[Element[testel].testclass]'), + array('testns|.testclass', 'Class[Element[testns|*].testclass]'), + array('testns|*.testclass', 'Class[Element[testns|*].testclass]'), + array('testns|testel.testclass', 'Class[Element[testns|testel].testclass]'), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Parser/Shortcut/ElementParserTest.php b/application/vendor/symfony/css-selector/Tests/Parser/Shortcut/ElementParserTest.php new file mode 100644 index 0000000..05a730f --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Parser/Shortcut/ElementParserTest.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Parser\Shortcut; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\CssSelector\Node\SelectorNode; +use Symfony\Component\CssSelector\Parser\Shortcut\ElementParser; + +/** + * @author Jean-François Simon + */ +class ElementParserTest extends TestCase +{ + /** @dataProvider getParseTestData */ + public function testParse($source, $representation) + { + $parser = new ElementParser(); + $selectors = $parser->parse($source); + $this->assertCount(1, $selectors); + + /** @var SelectorNode $selector */ + $selector = $selectors[0]; + $this->assertEquals($representation, (string) $selector->getTree()); + } + + public function getParseTestData() + { + return array( + array('*', 'Element[*]'), + array('testel', 'Element[testel]'), + array('testns|*', 'Element[testns|*]'), + array('testns|testel', 'Element[testns|testel]'), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Parser/Shortcut/EmptyStringParserTest.php b/application/vendor/symfony/css-selector/Tests/Parser/Shortcut/EmptyStringParserTest.php new file mode 100644 index 0000000..1cf742c --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Parser/Shortcut/EmptyStringParserTest.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Parser\Shortcut; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\CssSelector\Node\SelectorNode; +use Symfony\Component\CssSelector\Parser\Shortcut\EmptyStringParser; + +/** + * @author Jean-François Simon + */ +class EmptyStringParserTest extends TestCase +{ + public function testParse() + { + $parser = new EmptyStringParser(); + $selectors = $parser->parse(''); + $this->assertCount(1, $selectors); + + /** @var SelectorNode $selector */ + $selector = $selectors[0]; + $this->assertEquals('Element[*]', (string) $selector->getTree()); + + $selectors = $parser->parse('this will produce an empty array'); + $this->assertCount(0, $selectors); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Parser/Shortcut/HashParserTest.php b/application/vendor/symfony/css-selector/Tests/Parser/Shortcut/HashParserTest.php new file mode 100644 index 0000000..82f555d --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Parser/Shortcut/HashParserTest.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Parser\Shortcut; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\CssSelector\Node\SelectorNode; +use Symfony\Component\CssSelector\Parser\Shortcut\HashParser; + +/** + * @author Jean-François Simon + */ +class HashParserTest extends TestCase +{ + /** @dataProvider getParseTestData */ + public function testParse($source, $representation) + { + $parser = new HashParser(); + $selectors = $parser->parse($source); + $this->assertCount(1, $selectors); + + /** @var SelectorNode $selector */ + $selector = $selectors[0]; + $this->assertEquals($representation, (string) $selector->getTree()); + } + + public function getParseTestData() + { + return array( + array('#testid', 'Hash[Element[*]#testid]'), + array('testel#testid', 'Hash[Element[testel]#testid]'), + array('testns|#testid', 'Hash[Element[testns|*]#testid]'), + array('testns|*#testid', 'Hash[Element[testns|*]#testid]'), + array('testns|testel#testid', 'Hash[Element[testns|testel]#testid]'), + ); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/Parser/TokenStreamTest.php b/application/vendor/symfony/css-selector/Tests/Parser/TokenStreamTest.php new file mode 100644 index 0000000..44c751a --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/Parser/TokenStreamTest.php @@ -0,0 +1,96 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\Parser; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\CssSelector\Parser\Token; +use Symfony\Component\CssSelector\Parser\TokenStream; + +class TokenStreamTest extends TestCase +{ + public function testGetNext() + { + $stream = new TokenStream(); + $stream->push($t1 = new Token(Token::TYPE_IDENTIFIER, 'h1', 0)); + $stream->push($t2 = new Token(Token::TYPE_DELIMITER, '.', 2)); + $stream->push($t3 = new Token(Token::TYPE_IDENTIFIER, 'title', 3)); + + $this->assertSame($t1, $stream->getNext()); + $this->assertSame($t2, $stream->getNext()); + $this->assertSame($t3, $stream->getNext()); + } + + public function testGetPeek() + { + $stream = new TokenStream(); + $stream->push($t1 = new Token(Token::TYPE_IDENTIFIER, 'h1', 0)); + $stream->push($t2 = new Token(Token::TYPE_DELIMITER, '.', 2)); + $stream->push($t3 = new Token(Token::TYPE_IDENTIFIER, 'title', 3)); + + $this->assertSame($t1, $stream->getPeek()); + $this->assertSame($t1, $stream->getNext()); + $this->assertSame($t2, $stream->getPeek()); + $this->assertSame($t2, $stream->getPeek()); + $this->assertSame($t2, $stream->getNext()); + } + + public function testGetNextIdentifier() + { + $stream = new TokenStream(); + $stream->push(new Token(Token::TYPE_IDENTIFIER, 'h1', 0)); + + $this->assertEquals('h1', $stream->getNextIdentifier()); + } + + public function testFailToGetNextIdentifier() + { + $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException'); + + $stream = new TokenStream(); + $stream->push(new Token(Token::TYPE_DELIMITER, '.', 2)); + $stream->getNextIdentifier(); + } + + public function testGetNextIdentifierOrStar() + { + $stream = new TokenStream(); + + $stream->push(new Token(Token::TYPE_IDENTIFIER, 'h1', 0)); + $this->assertEquals('h1', $stream->getNextIdentifierOrStar()); + + $stream->push(new Token(Token::TYPE_DELIMITER, '*', 0)); + $this->assertNull($stream->getNextIdentifierOrStar()); + } + + public function testFailToGetNextIdentifierOrStar() + { + $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException'); + + $stream = new TokenStream(); + $stream->push(new Token(Token::TYPE_DELIMITER, '.', 2)); + $stream->getNextIdentifierOrStar(); + } + + public function testSkipWhitespace() + { + $stream = new TokenStream(); + $stream->push($t1 = new Token(Token::TYPE_IDENTIFIER, 'h1', 0)); + $stream->push($t2 = new Token(Token::TYPE_WHITESPACE, ' ', 2)); + $stream->push($t3 = new Token(Token::TYPE_IDENTIFIER, 'h1', 3)); + + $stream->skipWhitespace(); + $this->assertSame($t1, $stream->getNext()); + + $stream->skipWhitespace(); + $this->assertSame($t3, $stream->getNext()); + } +} diff --git a/application/vendor/symfony/css-selector/Tests/XPath/Fixtures/ids.html b/application/vendor/symfony/css-selector/Tests/XPath/Fixtures/ids.html new file mode 100644 index 0000000..5799fad --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/XPath/Fixtures/ids.html @@ -0,0 +1,48 @@ + + + + +
    + + + + link +
      +
    1. content
    2. +
    3. +
      +
      +
    4. +
    5. +
    6. +
    7. +
    8. +
    9. +
    +

    + hi there + guy + + + + + + + +

    + + +
    +

    +
      +
    + + + + +
    +
    + diff --git a/application/vendor/symfony/css-selector/Tests/XPath/Fixtures/lang.xml b/application/vendor/symfony/css-selector/Tests/XPath/Fixtures/lang.xml new file mode 100644 index 0000000..14f8dbe --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/XPath/Fixtures/lang.xml @@ -0,0 +1,11 @@ + + a + b + c + d + e + f + + + + diff --git a/application/vendor/symfony/css-selector/Tests/XPath/Fixtures/shakespear.html b/application/vendor/symfony/css-selector/Tests/XPath/Fixtures/shakespear.html new file mode 100644 index 0000000..15d1ad3 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/XPath/Fixtures/shakespear.html @@ -0,0 +1,308 @@ + + + + + + +
    +
    +

    As You Like It

    +
    + by William Shakespeare +
    +
    +

    ACT I, SCENE III. A room in the palace.

    +
    +
    Enter CELIA and ROSALIND
    +
    +
    CELIA
    +
    +
    Why, cousin! why, Rosalind! Cupid have mercy! not a word?
    +
    +
    ROSALIND
    +
    +
    Not one to throw at a dog.
    +
    +
    CELIA
    +
    +
    No, thy words are too precious to be cast away upon
    +
    curs; throw some of them at me; come, lame me with reasons.
    +
    +
    ROSALIND
    +
    CELIA
    +
    +
    But is all this for your father?
    +
    +
    +
    Then there were two cousins laid up; when the one
    +
    should be lamed with reasons and the other mad
    +
    without any.
    +
    +
    ROSALIND
    +
    +
    No, some of it is for my child's father. O, how
    +
    full of briers is this working-day world!
    +
    +
    CELIA
    +
    +
    They are but burs, cousin, thrown upon thee in
    +
    holiday foolery: if we walk not in the trodden
    +
    paths our very petticoats will catch them.
    +
    +
    ROSALIND
    +
    +
    I could shake them off my coat: these burs are in my heart.
    +
    +
    CELIA
    +
    +
    Hem them away.
    +
    +
    ROSALIND
    +
    +
    I would try, if I could cry 'hem' and have him.
    +
    +
    CELIA
    +
    +
    Come, come, wrestle with thy affections.
    +
    +
    ROSALIND
    +
    +
    O, they take the part of a better wrestler than myself!
    +
    +
    CELIA
    +
    +
    O, a good wish upon you! you will try in time, in
    +
    despite of a fall. But, turning these jests out of
    +
    service, let us talk in good earnest: is it
    +
    possible, on such a sudden, you should fall into so
    +
    strong a liking with old Sir Rowland's youngest son?
    +
    +
    ROSALIND
    +
    +
    The duke my father loved his father dearly.
    +
    +
    CELIA
    +
    +
    Doth it therefore ensue that you should love his son
    +
    dearly? By this kind of chase, I should hate him,
    +
    for my father hated his father dearly; yet I hate
    +
    not Orlando.
    +
    +
    ROSALIND
    +
    +
    No, faith, hate him not, for my sake.
    +
    +
    CELIA
    +
    +
    Why should I not? doth he not deserve well?
    +
    +
    ROSALIND
    +
    +
    Let me love him for that, and do you love him
    +
    because I do. Look, here comes the duke.
    +
    +
    CELIA
    +
    +
    With his eyes full of anger.
    +
    Enter DUKE FREDERICK, with Lords
    +
    +
    DUKE FREDERICK
    +
    +
    Mistress, dispatch you with your safest haste
    +
    And get you from our court.
    +
    +
    ROSALIND
    +
    +
    Me, uncle?
    +
    +
    DUKE FREDERICK
    +
    +
    You, cousin
    +
    Within these ten days if that thou be'st found
    +
    So near our public court as twenty miles,
    +
    Thou diest for it.
    +
    +
    ROSALIND
    +
    +
    I do beseech your grace,
    +
    Let me the knowledge of my fault bear with me:
    +
    If with myself I hold intelligence
    +
    Or have acquaintance with mine own desires,
    +
    If that I do not dream or be not frantic,--
    +
    As I do trust I am not--then, dear uncle,
    +
    Never so much as in a thought unborn
    +
    Did I offend your highness.
    +
    +
    DUKE FREDERICK
    +
    +
    Thus do all traitors:
    +
    If their purgation did consist in words,
    +
    They are as innocent as grace itself:
    +
    Let it suffice thee that I trust thee not.
    +
    +
    ROSALIND
    +
    +
    Yet your mistrust cannot make me a traitor:
    +
    Tell me whereon the likelihood depends.
    +
    +
    DUKE FREDERICK
    +
    +
    Thou art thy father's daughter; there's enough.
    +
    +
    ROSALIND
    +
    +
    So was I when your highness took his dukedom;
    +
    So was I when your highness banish'd him:
    +
    Treason is not inherited, my lord;
    +
    Or, if we did derive it from our friends,
    +
    What's that to me? my father was no traitor:
    +
    Then, good my liege, mistake me not so much
    +
    To think my poverty is treacherous.
    +
    +
    CELIA
    +
    +
    Dear sovereign, hear me speak.
    +
    +
    DUKE FREDERICK
    +
    +
    Ay, Celia; we stay'd her for your sake,
    +
    Else had she with her father ranged along.
    +
    +
    CELIA
    +
    +
    I did not then entreat to have her stay;
    +
    It was your pleasure and your own remorse:
    +
    I was too young that time to value her;
    +
    But now I know her: if she be a traitor,
    +
    Why so am I; we still have slept together,
    +
    Rose at an instant, learn'd, play'd, eat together,
    +
    And wheresoever we went, like Juno's swans,
    +
    Still we went coupled and inseparable.
    +
    +
    DUKE FREDERICK
    +
    +
    She is too subtle for thee; and her smoothness,
    +
    Her very silence and her patience
    +
    Speak to the people, and they pity her.
    +
    Thou art a fool: she robs thee of thy name;
    +
    And thou wilt show more bright and seem more virtuous
    +
    When she is gone. Then open not thy lips:
    +
    Firm and irrevocable is my doom
    +
    Which I have pass'd upon her; she is banish'd.
    +
    +
    CELIA
    +
    +
    Pronounce that sentence then on me, my liege:
    +
    I cannot live out of her company.
    +
    +
    DUKE FREDERICK
    +
    +
    You are a fool. You, niece, provide yourself:
    +
    If you outstay the time, upon mine honour,
    +
    And in the greatness of my word, you die.
    +
    Exeunt DUKE FREDERICK and Lords
    +
    +
    CELIA
    +
    +
    O my poor Rosalind, whither wilt thou go?
    +
    Wilt thou change fathers? I will give thee mine.
    +
    I charge thee, be not thou more grieved than I am.
    +
    +
    ROSALIND
    +
    +
    I have more cause.
    +
    +
    CELIA
    +
    +
    Thou hast not, cousin;
    +
    Prithee be cheerful: know'st thou not, the duke
    +
    Hath banish'd me, his daughter?
    +
    +
    ROSALIND
    +
    +
    That he hath not.
    +
    +
    CELIA
    +
    +
    No, hath not? Rosalind lacks then the love
    +
    Which teacheth thee that thou and I am one:
    +
    Shall we be sunder'd? shall we part, sweet girl?
    +
    No: let my father seek another heir.
    +
    Therefore devise with me how we may fly,
    +
    Whither to go and what to bear with us;
    +
    And do not seek to take your change upon you,
    +
    To bear your griefs yourself and leave me out;
    +
    For, by this heaven, now at our sorrows pale,
    +
    Say what thou canst, I'll go along with thee.
    +
    +
    ROSALIND
    +
    +
    Why, whither shall we go?
    +
    +
    CELIA
    +
    +
    To seek my uncle in the forest of Arden.
    +
    +
    ROSALIND
    +
    +
    Alas, what danger will it be to us,
    +
    Maids as we are, to travel forth so far!
    +
    Beauty provoketh thieves sooner than gold.
    +
    +
    CELIA
    +
    +
    I'll put myself in poor and mean attire
    +
    And with a kind of umber smirch my face;
    +
    The like do you: so shall we pass along
    +
    And never stir assailants.
    +
    +
    ROSALIND
    +
    +
    Were it not better,
    +
    Because that I am more than common tall,
    +
    That I did suit me all points like a man?
    +
    A gallant curtle-axe upon my thigh,
    +
    A boar-spear in my hand; and--in my heart
    +
    Lie there what hidden woman's fear there will--
    +
    We'll have a swashing and a martial outside,
    +
    As many other mannish cowards have
    +
    That do outface it with their semblances.
    +
    +
    CELIA
    +
    +
    What shall I call thee when thou art a man?
    +
    +
    ROSALIND
    +
    +
    I'll have no worse a name than Jove's own page;
    +
    And therefore look you call me Ganymede.
    +
    But what will you be call'd?
    +
    +
    CELIA
    +
    +
    Something that hath a reference to my state
    +
    No longer Celia, but Aliena.
    +
    +
    ROSALIND
    +
    +
    But, cousin, what if we assay'd to steal
    +
    The clownish fool out of your father's court?
    +
    Would he not be a comfort to our travel?
    +
    +
    CELIA
    +
    +
    He'll go along o'er the wide world with me;
    +
    Leave me alone to woo him. Let's away,
    +
    And get our jewels and our wealth together,
    +
    Devise the fittest time and safest way
    +
    To hide us from pursuit that will be made
    +
    After my flight. Now go we in content
    +
    To liberty and not to banishment.
    +
    Exeunt
    +
    +
    +
    +
    + + diff --git a/application/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php b/application/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php new file mode 100644 index 0000000..6104582 --- /dev/null +++ b/application/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php @@ -0,0 +1,327 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\Tests\XPath; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\CssSelector\XPath\Extension\HtmlExtension; +use Symfony\Component\CssSelector\XPath\Translator; + +class TranslatorTest extends TestCase +{ + /** @dataProvider getXpathLiteralTestData */ + public function testXpathLiteral($value, $literal) + { + $this->assertEquals($literal, Translator::getXpathLiteral($value)); + } + + /** @dataProvider getCssToXPathTestData */ + public function testCssToXPath($css, $xpath) + { + $translator = new Translator(); + $translator->registerExtension(new HtmlExtension($translator)); + $this->assertEquals($xpath, $translator->cssToXPath($css, '')); + } + + /** @dataProvider getXmlLangTestData */ + public function testXmlLang($css, array $elementsId) + { + $translator = new Translator(); + $document = new \SimpleXMLElement(file_get_contents(__DIR__.'/Fixtures/lang.xml')); + $elements = $document->xpath($translator->cssToXPath($css)); + $this->assertCount(\count($elementsId), $elements); + foreach ($elements as $element) { + $this->assertTrue(\in_array($element->attributes()->id, $elementsId)); + } + } + + /** @dataProvider getHtmlIdsTestData */ + public function testHtmlIds($css, array $elementsId) + { + $translator = new Translator(); + $translator->registerExtension(new HtmlExtension($translator)); + $document = new \DOMDocument(); + $document->strictErrorChecking = false; + $internalErrors = libxml_use_internal_errors(true); + $document->loadHTMLFile(__DIR__.'/Fixtures/ids.html'); + $document = simplexml_import_dom($document); + $elements = $document->xpath($translator->cssToXPath($css)); + $this->assertCount(\count($elementsId), $elementsId); + foreach ($elements as $element) { + if (null !== $element->attributes()->id) { + $this->assertTrue(\in_array($element->attributes()->id, $elementsId)); + } + } + libxml_clear_errors(); + libxml_use_internal_errors($internalErrors); + } + + /** @dataProvider getHtmlShakespearTestData */ + public function testHtmlShakespear($css, $count) + { + $translator = new Translator(); + $translator->registerExtension(new HtmlExtension($translator)); + $document = new \DOMDocument(); + $document->strictErrorChecking = false; + $document->loadHTMLFile(__DIR__.'/Fixtures/shakespear.html'); + $document = simplexml_import_dom($document); + $bodies = $document->xpath('//body'); + $elements = $bodies[0]->xpath($translator->cssToXPath($css)); + $this->assertCount($count, $elements); + } + + public function getXpathLiteralTestData() + { + return array( + array('foo', "'foo'"), + array("foo's bar", '"foo\'s bar"'), + array("foo's \"middle\" bar", 'concat(\'foo\', "\'", \'s "middle" bar\')'), + array("foo's 'middle' \"bar\"", 'concat(\'foo\', "\'", \'s \', "\'", \'middle\', "\'", \' "bar"\')'), + ); + } + + public function getCssToXPathTestData() + { + return array( + array('*', '*'), + array('e', 'e'), + array('*|e', 'e'), + array('e|f', 'e:f'), + array('e[foo]', 'e[@foo]'), + array('e[foo|bar]', 'e[@foo:bar]'), + array('e[foo="bar"]', "e[@foo = 'bar']"), + array('e[foo~="bar"]', "e[@foo and contains(concat(' ', normalize-space(@foo), ' '), ' bar ')]"), + array('e[foo^="bar"]', "e[@foo and starts-with(@foo, 'bar')]"), + array('e[foo$="bar"]', "e[@foo and substring(@foo, string-length(@foo)-2) = 'bar']"), + array('e[foo*="bar"]', "e[@foo and contains(@foo, 'bar')]"), + array('e[foo!="bar"]', "e[not(@foo) or @foo != 'bar']"), + array('e[foo!="bar"][foo!="baz"]', "e[(not(@foo) or @foo != 'bar') and (not(@foo) or @foo != 'baz')]"), + array('e[hreflang|="en"]', "e[@hreflang and (@hreflang = 'en' or starts-with(@hreflang, 'en-'))]"), + array('e:nth-child(1)', "*/*[(name() = 'e') and (position() = 1)]"), + array('e:nth-last-child(1)', "*/*[(name() = 'e') and (position() = last() - 0)]"), + array('e:nth-last-child(2n+2)', "*/*[(name() = 'e') and (last() - position() - 1 >= 0 and (last() - position() - 1) mod 2 = 0)]"), + array('e:nth-of-type(1)', '*/e[position() = 1]'), + array('e:nth-last-of-type(1)', '*/e[position() = last() - 0]'), + array('div e:nth-last-of-type(1) .aclass', "div/descendant-or-self::*/e[position() = last() - 0]/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' aclass ')]"), + array('e:first-child', "*/*[(name() = 'e') and (position() = 1)]"), + array('e:last-child', "*/*[(name() = 'e') and (position() = last())]"), + array('e:first-of-type', '*/e[position() = 1]'), + array('e:last-of-type', '*/e[position() = last()]'), + array('e:only-child', "*/*[(name() = 'e') and (last() = 1)]"), + array('e:only-of-type', 'e[last() = 1]'), + array('e:empty', 'e[not(*) and not(string-length())]'), + array('e:EmPTY', 'e[not(*) and not(string-length())]'), + array('e:root', 'e[not(parent::*)]'), + array('e:hover', 'e[0]'), + array('e:contains("foo")', "e[contains(string(.), 'foo')]"), + array('e:ConTains(foo)', "e[contains(string(.), 'foo')]"), + array('e.warning', "e[@class and contains(concat(' ', normalize-space(@class), ' '), ' warning ')]"), + array('e#myid', "e[@id = 'myid']"), + array('e:not(:nth-child(odd))', 'e[not(position() - 1 >= 0 and (position() - 1) mod 2 = 0)]'), + array('e:nOT(*)', 'e[0]'), + array('e f', 'e/descendant-or-self::*/f'), + array('e > f', 'e/f'), + array('e + f', "e/following-sibling::*[(name() = 'f') and (position() = 1)]"), + array('e ~ f', 'e/following-sibling::f'), + array('div#container p', "div[@id = 'container']/descendant-or-self::*/p"), + ); + } + + public function getXmlLangTestData() + { + return array( + array(':lang("EN")', array('first', 'second', 'third', 'fourth')), + array(':lang("en-us")', array('second', 'fourth')), + array(':lang(en-nz)', array('third')), + array(':lang(fr)', array('fifth')), + array(':lang(ru)', array('sixth')), + array(":lang('ZH')", array('eighth')), + array(':lang(de) :lang(zh)', array('eighth')), + array(':lang(en), :lang(zh)', array('first', 'second', 'third', 'fourth', 'eighth')), + array(':lang(es)', array()), + ); + } + + public function getHtmlIdsTestData() + { + return array( + array('div', array('outer-div', 'li-div', 'foobar-div')), + array('DIV', array('outer-div', 'li-div', 'foobar-div')), // case-insensitive in HTML + array('div div', array('li-div')), + array('div, div div', array('outer-div', 'li-div', 'foobar-div')), + array('a[name]', array('name-anchor')), + array('a[NAme]', array('name-anchor')), // case-insensitive in HTML: + array('a[rel]', array('tag-anchor', 'nofollow-anchor')), + array('a[rel="tag"]', array('tag-anchor')), + array('a[href*="localhost"]', array('tag-anchor')), + array('a[href*=""]', array()), + array('a[href^="http"]', array('tag-anchor', 'nofollow-anchor')), + array('a[href^="http:"]', array('tag-anchor')), + array('a[href^=""]', array()), + array('a[href$="org"]', array('nofollow-anchor')), + array('a[href$=""]', array()), + array('div[foobar~="bc"]', array('foobar-div')), + array('div[foobar~="cde"]', array('foobar-div')), + array('[foobar~="ab bc"]', array('foobar-div')), + array('[foobar~=""]', array()), + array('[foobar~=" \t"]', array()), + array('div[foobar~="cd"]', array()), + array('*[lang|="En"]', array('second-li')), + array('[lang|="En-us"]', array('second-li')), + // Attribute values are case sensitive + array('*[lang|="en"]', array()), + array('[lang|="en-US"]', array()), + array('*[lang|="e"]', array()), + // ... :lang() is not. + array(':lang("EN")', array('second-li', 'li-div')), + array('*:lang(en-US)', array('second-li', 'li-div')), + array(':lang("e")', array()), + array('li:nth-child(3)', array('third-li')), + array('li:nth-child(10)', array()), + array('li:nth-child(2n)', array('second-li', 'fourth-li', 'sixth-li')), + array('li:nth-child(even)', array('second-li', 'fourth-li', 'sixth-li')), + array('li:nth-child(2n+0)', array('second-li', 'fourth-li', 'sixth-li')), + array('li:nth-child(+2n+1)', array('first-li', 'third-li', 'fifth-li', 'seventh-li')), + array('li:nth-child(odd)', array('first-li', 'third-li', 'fifth-li', 'seventh-li')), + array('li:nth-child(2n+4)', array('fourth-li', 'sixth-li')), + array('li:nth-child(3n+1)', array('first-li', 'fourth-li', 'seventh-li')), + array('li:nth-child(n)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), + array('li:nth-child(n-1)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), + array('li:nth-child(n+1)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), + array('li:nth-child(n+3)', array('third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), + array('li:nth-child(-n)', array()), + array('li:nth-child(-n-1)', array()), + array('li:nth-child(-n+1)', array('first-li')), + array('li:nth-child(-n+3)', array('first-li', 'second-li', 'third-li')), + array('li:nth-last-child(0)', array()), + array('li:nth-last-child(2n)', array('second-li', 'fourth-li', 'sixth-li')), + array('li:nth-last-child(even)', array('second-li', 'fourth-li', 'sixth-li')), + array('li:nth-last-child(2n+2)', array('second-li', 'fourth-li', 'sixth-li')), + array('li:nth-last-child(n)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), + array('li:nth-last-child(n-1)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), + array('li:nth-last-child(n-3)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), + array('li:nth-last-child(n+1)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')), + array('li:nth-last-child(n+3)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li')), + array('li:nth-last-child(-n)', array()), + array('li:nth-last-child(-n-1)', array()), + array('li:nth-last-child(-n+1)', array('seventh-li')), + array('li:nth-last-child(-n+3)', array('fifth-li', 'sixth-li', 'seventh-li')), + array('ol:first-of-type', array('first-ol')), + array('ol:nth-child(1)', array('first-ol')), + array('ol:nth-of-type(2)', array('second-ol')), + array('ol:nth-last-of-type(1)', array('second-ol')), + array('span:only-child', array('foobar-span')), + array('li div:only-child', array('li-div')), + array('div *:only-child', array('li-div', 'foobar-span')), + array('p:only-of-type', array('paragraph')), + array('a:empty', array('name-anchor')), + array('a:EMpty', array('name-anchor')), + array('li:empty', array('third-li', 'fourth-li', 'fifth-li', 'sixth-li')), + array(':root', array('html')), + array('html:root', array('html')), + array('li:root', array()), + array('* :root', array()), + array('*:contains("link")', array('html', 'outer-div', 'tag-anchor', 'nofollow-anchor')), + array(':CONtains("link")', array('html', 'outer-div', 'tag-anchor', 'nofollow-anchor')), + array('*:contains("LInk")', array()), // case sensitive + array('*:contains("e")', array('html', 'nil', 'outer-div', 'first-ol', 'first-li', 'paragraph', 'p-em')), + array('*:contains("E")', array()), // case-sensitive + array('.a', array('first-ol')), + array('.b', array('first-ol')), + array('*.a', array('first-ol')), + array('ol.a', array('first-ol')), + array('.c', array('first-ol', 'third-li', 'fourth-li')), + array('*.c', array('first-ol', 'third-li', 'fourth-li')), + array('ol *.c', array('third-li', 'fourth-li')), + array('ol li.c', array('third-li', 'fourth-li')), + array('li ~ li.c', array('third-li', 'fourth-li')), + array('ol > li.c', array('third-li', 'fourth-li')), + array('#first-li', array('first-li')), + array('li#first-li', array('first-li')), + array('*#first-li', array('first-li')), + array('li div', array('li-div')), + array('li > div', array('li-div')), + array('div div', array('li-div')), + array('div > div', array()), + array('div>.c', array('first-ol')), + array('div > .c', array('first-ol')), + array('div + div', array('foobar-div')), + array('a ~ a', array('tag-anchor', 'nofollow-anchor')), + array('a[rel="tag"] ~ a', array('nofollow-anchor')), + array('ol#first-ol li:last-child', array('seventh-li')), + array('ol#first-ol *:last-child', array('li-div', 'seventh-li')), + array('#outer-div:first-child', array('outer-div')), + array('#outer-div :first-child', array('name-anchor', 'first-li', 'li-div', 'p-b', 'checkbox-fieldset-disabled', 'area-href')), + array('a[href]', array('tag-anchor', 'nofollow-anchor')), + array(':not(*)', array()), + array('a:not([href])', array('name-anchor')), + array('ol :Not(li[class])', array('first-li', 'second-li', 'li-div', 'fifth-li', 'sixth-li', 'seventh-li')), + // HTML-specific + array(':link', array('link-href', 'tag-anchor', 'nofollow-anchor', 'area-href')), + array(':visited', array()), + array(':enabled', array('link-href', 'tag-anchor', 'nofollow-anchor', 'checkbox-unchecked', 'text-checked', 'checkbox-checked', 'area-href')), + array(':disabled', array('checkbox-disabled', 'checkbox-disabled-checked', 'fieldset', 'checkbox-fieldset-disabled')), + array(':checked', array('checkbox-checked', 'checkbox-disabled-checked')), + ); + } + + public function getHtmlShakespearTestData() + { + return array( + array('*', 246), + array('div:contains(CELIA)', 26), + array('div:only-child', 22), // ? + array('div:nth-child(even)', 106), + array('div:nth-child(2n)', 106), + array('div:nth-child(odd)', 137), + array('div:nth-child(2n+1)', 137), + array('div:nth-child(n)', 243), + array('div:last-child', 53), + array('div:first-child', 51), + array('div > div', 242), + array('div + div', 190), + array('div ~ div', 190), + array('body', 1), + array('body div', 243), + array('div', 243), + array('div div', 242), + array('div div div', 241), + array('div, div, div', 243), + array('div, a, span', 243), + array('.dialog', 51), + array('div.dialog', 51), + array('div .dialog', 51), + array('div.character, div.dialog', 99), + array('div.direction.dialog', 0), + array('div.dialog.direction', 0), + array('div.dialog.scene', 1), + array('div.scene.scene', 1), + array('div.scene .scene', 0), + array('div.direction .dialog ', 0), + array('div .dialog .direction', 4), + array('div.dialog .dialog .direction', 4), + array('#speech5', 1), + array('div#speech5', 1), + array('div #speech5', 1), + array('div.scene div.dialog', 49), + array('div#scene1 div.dialog div', 142), + array('#scene1 #speech1', 1), + array('div[class]', 103), + array('div[class=dialog]', 50), + array('div[class^=dia]', 51), + array('div[class$=log]', 50), + array('div[class*=sce]', 1), + array('div[class|=dialog]', 50), // ? Seems right + array('div[class!=madeup]', 243), // ? Seems right + array('div[class~=dialog]', 51), // ? Seems right + ); + } +} diff --git a/application/vendor/symfony/css-selector/XPath/Extension/AbstractExtension.php b/application/vendor/symfony/css-selector/XPath/Extension/AbstractExtension.php new file mode 100644 index 0000000..026ac06 --- /dev/null +++ b/application/vendor/symfony/css-selector/XPath/Extension/AbstractExtension.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\XPath\Extension; + +/** + * XPath expression translator abstract extension. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +abstract class AbstractExtension implements ExtensionInterface +{ + /** + * {@inheritdoc} + */ + public function getNodeTranslators() + { + return array(); + } + + /** + * {@inheritdoc} + */ + public function getCombinationTranslators() + { + return array(); + } + + /** + * {@inheritdoc} + */ + public function getFunctionTranslators() + { + return array(); + } + + /** + * {@inheritdoc} + */ + public function getPseudoClassTranslators() + { + return array(); + } + + /** + * {@inheritdoc} + */ + public function getAttributeMatchingTranslators() + { + return array(); + } +} diff --git a/application/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php b/application/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php new file mode 100644 index 0000000..2078dca --- /dev/null +++ b/application/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php @@ -0,0 +1,175 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\XPath\Extension; + +use Symfony\Component\CssSelector\XPath\Translator; +use Symfony\Component\CssSelector\XPath\XPathExpr; + +/** + * XPath expression translator attribute extension. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class AttributeMatchingExtension extends AbstractExtension +{ + /** + * {@inheritdoc} + */ + public function getAttributeMatchingTranslators() + { + return array( + 'exists' => array($this, 'translateExists'), + '=' => array($this, 'translateEquals'), + '~=' => array($this, 'translateIncludes'), + '|=' => array($this, 'translateDashMatch'), + '^=' => array($this, 'translatePrefixMatch'), + '$=' => array($this, 'translateSuffixMatch'), + '*=' => array($this, 'translateSubstringMatch'), + '!=' => array($this, 'translateDifferent'), + ); + } + + /** + * @param XPathExpr $xpath + * @param string $attribute + * @param string $value + * + * @return XPathExpr + */ + public function translateExists(XPathExpr $xpath, $attribute, $value) + { + return $xpath->addCondition($attribute); + } + + /** + * @param XPathExpr $xpath + * @param string $attribute + * @param string $value + * + * @return XPathExpr + */ + public function translateEquals(XPathExpr $xpath, $attribute, $value) + { + return $xpath->addCondition(sprintf('%s = %s', $attribute, Translator::getXpathLiteral($value))); + } + + /** + * @param XPathExpr $xpath + * @param string $attribute + * @param string $value + * + * @return XPathExpr + */ + public function translateIncludes(XPathExpr $xpath, $attribute, $value) + { + return $xpath->addCondition($value ? sprintf( + '%1$s and contains(concat(\' \', normalize-space(%1$s), \' \'), %2$s)', + $attribute, + Translator::getXpathLiteral(' '.$value.' ') + ) : '0'); + } + + /** + * @param XPathExpr $xpath + * @param string $attribute + * @param string $value + * + * @return XPathExpr + */ + public function translateDashMatch(XPathExpr $xpath, $attribute, $value) + { + return $xpath->addCondition(sprintf( + '%1$s and (%1$s = %2$s or starts-with(%1$s, %3$s))', + $attribute, + Translator::getXpathLiteral($value), + Translator::getXpathLiteral($value.'-') + )); + } + + /** + * @param XPathExpr $xpath + * @param string $attribute + * @param string $value + * + * @return XPathExpr + */ + public function translatePrefixMatch(XPathExpr $xpath, $attribute, $value) + { + return $xpath->addCondition($value ? sprintf( + '%1$s and starts-with(%1$s, %2$s)', + $attribute, + Translator::getXpathLiteral($value) + ) : '0'); + } + + /** + * @param XPathExpr $xpath + * @param string $attribute + * @param string $value + * + * @return XPathExpr + */ + public function translateSuffixMatch(XPathExpr $xpath, $attribute, $value) + { + return $xpath->addCondition($value ? sprintf( + '%1$s and substring(%1$s, string-length(%1$s)-%2$s) = %3$s', + $attribute, + \strlen($value) - 1, + Translator::getXpathLiteral($value) + ) : '0'); + } + + /** + * @param XPathExpr $xpath + * @param string $attribute + * @param string $value + * + * @return XPathExpr + */ + public function translateSubstringMatch(XPathExpr $xpath, $attribute, $value) + { + return $xpath->addCondition($value ? sprintf( + '%1$s and contains(%1$s, %2$s)', + $attribute, + Translator::getXpathLiteral($value) + ) : '0'); + } + + /** + * @param XPathExpr $xpath + * @param string $attribute + * @param string $value + * + * @return XPathExpr + */ + public function translateDifferent(XPathExpr $xpath, $attribute, $value) + { + return $xpath->addCondition(sprintf( + $value ? 'not(%1$s) or %1$s != %2$s' : '%s != %s', + $attribute, + Translator::getXpathLiteral($value) + )); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'attribute-matching'; + } +} diff --git a/application/vendor/symfony/css-selector/XPath/Extension/CombinationExtension.php b/application/vendor/symfony/css-selector/XPath/Extension/CombinationExtension.php new file mode 100644 index 0000000..0c9cc03 --- /dev/null +++ b/application/vendor/symfony/css-selector/XPath/Extension/CombinationExtension.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\XPath\Extension; + +use Symfony\Component\CssSelector\XPath\XPathExpr; + +/** + * XPath expression translator combination extension. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class CombinationExtension extends AbstractExtension +{ + /** + * {@inheritdoc} + */ + public function getCombinationTranslators() + { + return array( + ' ' => array($this, 'translateDescendant'), + '>' => array($this, 'translateChild'), + '+' => array($this, 'translateDirectAdjacent'), + '~' => array($this, 'translateIndirectAdjacent'), + ); + } + + /** + * @return XPathExpr + */ + public function translateDescendant(XPathExpr $xpath, XPathExpr $combinedXpath) + { + return $xpath->join('/descendant-or-self::*/', $combinedXpath); + } + + /** + * @return XPathExpr + */ + public function translateChild(XPathExpr $xpath, XPathExpr $combinedXpath) + { + return $xpath->join('/', $combinedXpath); + } + + /** + * @return XPathExpr + */ + public function translateDirectAdjacent(XPathExpr $xpath, XPathExpr $combinedXpath) + { + return $xpath + ->join('/following-sibling::', $combinedXpath) + ->addNameTest() + ->addCondition('position() = 1'); + } + + /** + * @return XPathExpr + */ + public function translateIndirectAdjacent(XPathExpr $xpath, XPathExpr $combinedXpath) + { + return $xpath->join('/following-sibling::', $combinedXpath); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'combination'; + } +} diff --git a/application/vendor/symfony/css-selector/XPath/Extension/ExtensionInterface.php b/application/vendor/symfony/css-selector/XPath/Extension/ExtensionInterface.php new file mode 100644 index 0000000..3607022 --- /dev/null +++ b/application/vendor/symfony/css-selector/XPath/Extension/ExtensionInterface.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\XPath\Extension; + +/** + * XPath expression translator extension interface. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +interface ExtensionInterface +{ + /** + * Returns node translators. + * + * These callables will receive the node as first argument and the translator as second argument. + * + * @return callable[] + */ + public function getNodeTranslators(); + + /** + * Returns combination translators. + * + * @return callable[] + */ + public function getCombinationTranslators(); + + /** + * Returns function translators. + * + * @return callable[] + */ + public function getFunctionTranslators(); + + /** + * Returns pseudo-class translators. + * + * @return callable[] + */ + public function getPseudoClassTranslators(); + + /** + * Returns attribute operation translators. + * + * @return callable[] + */ + public function getAttributeMatchingTranslators(); + + /** + * Returns extension name. + * + * @return string + */ + public function getName(); +} diff --git a/application/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php b/application/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php new file mode 100644 index 0000000..4d34d0e --- /dev/null +++ b/application/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php @@ -0,0 +1,190 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\XPath\Extension; + +use Symfony\Component\CssSelector\Exception\ExpressionErrorException; +use Symfony\Component\CssSelector\Exception\SyntaxErrorException; +use Symfony\Component\CssSelector\Node\FunctionNode; +use Symfony\Component\CssSelector\Parser\Parser; +use Symfony\Component\CssSelector\XPath\Translator; +use Symfony\Component\CssSelector\XPath\XPathExpr; + +/** + * XPath expression translator function extension. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class FunctionExtension extends AbstractExtension +{ + /** + * {@inheritdoc} + */ + public function getFunctionTranslators() + { + return array( + 'nth-child' => array($this, 'translateNthChild'), + 'nth-last-child' => array($this, 'translateNthLastChild'), + 'nth-of-type' => array($this, 'translateNthOfType'), + 'nth-last-of-type' => array($this, 'translateNthLastOfType'), + 'contains' => array($this, 'translateContains'), + 'lang' => array($this, 'translateLang'), + ); + } + + /** + * @param XPathExpr $xpath + * @param FunctionNode $function + * @param bool $last + * @param bool $addNameTest + * + * @return XPathExpr + * + * @throws ExpressionErrorException + */ + public function translateNthChild(XPathExpr $xpath, FunctionNode $function, $last = false, $addNameTest = true) + { + try { + list($a, $b) = Parser::parseSeries($function->getArguments()); + } catch (SyntaxErrorException $e) { + throw new ExpressionErrorException(sprintf('Invalid series: %s', implode(', ', $function->getArguments())), 0, $e); + } + + $xpath->addStarPrefix(); + if ($addNameTest) { + $xpath->addNameTest(); + } + + if (0 === $a) { + return $xpath->addCondition('position() = '.($last ? 'last() - '.($b - 1) : $b)); + } + + if ($a < 0) { + if ($b < 1) { + return $xpath->addCondition('false()'); + } + + $sign = '<='; + } else { + $sign = '>='; + } + + $expr = 'position()'; + + if ($last) { + $expr = 'last() - '.$expr; + --$b; + } + + if (0 !== $b) { + $expr .= ' - '.$b; + } + + $conditions = array(sprintf('%s %s 0', $expr, $sign)); + + if (1 !== $a && -1 !== $a) { + $conditions[] = sprintf('(%s) mod %d = 0', $expr, $a); + } + + return $xpath->addCondition(implode(' and ', $conditions)); + + // todo: handle an+b, odd, even + // an+b means every-a, plus b, e.g., 2n+1 means odd + // 0n+b means b + // n+0 means a=1, i.e., all elements + // an means every a elements, i.e., 2n means even + // -n means -1n + // -1n+6 means elements 6 and previous + } + + /** + * @return XPathExpr + */ + public function translateNthLastChild(XPathExpr $xpath, FunctionNode $function) + { + return $this->translateNthChild($xpath, $function, true); + } + + /** + * @return XPathExpr + */ + public function translateNthOfType(XPathExpr $xpath, FunctionNode $function) + { + return $this->translateNthChild($xpath, $function, false, false); + } + + /** + * @return XPathExpr + * + * @throws ExpressionErrorException + */ + public function translateNthLastOfType(XPathExpr $xpath, FunctionNode $function) + { + if ('*' === $xpath->getElement()) { + throw new ExpressionErrorException('"*:nth-of-type()" is not implemented.'); + } + + return $this->translateNthChild($xpath, $function, true, false); + } + + /** + * @return XPathExpr + * + * @throws ExpressionErrorException + */ + public function translateContains(XPathExpr $xpath, FunctionNode $function) + { + $arguments = $function->getArguments(); + foreach ($arguments as $token) { + if (!($token->isString() || $token->isIdentifier())) { + throw new ExpressionErrorException('Expected a single string or identifier for :contains(), got '.implode(', ', $arguments)); + } + } + + return $xpath->addCondition(sprintf( + 'contains(string(.), %s)', + Translator::getXpathLiteral($arguments[0]->getValue()) + )); + } + + /** + * @return XPathExpr + * + * @throws ExpressionErrorException + */ + public function translateLang(XPathExpr $xpath, FunctionNode $function) + { + $arguments = $function->getArguments(); + foreach ($arguments as $token) { + if (!($token->isString() || $token->isIdentifier())) { + throw new ExpressionErrorException('Expected a single string or identifier for :lang(), got '.implode(', ', $arguments)); + } + } + + return $xpath->addCondition(sprintf( + 'lang(%s)', + Translator::getXpathLiteral($arguments[0]->getValue()) + )); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'function'; + } +} diff --git a/application/vendor/symfony/css-selector/XPath/Extension/HtmlExtension.php b/application/vendor/symfony/css-selector/XPath/Extension/HtmlExtension.php new file mode 100644 index 0000000..cd8e0d5 --- /dev/null +++ b/application/vendor/symfony/css-selector/XPath/Extension/HtmlExtension.php @@ -0,0 +1,213 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\XPath\Extension; + +use Symfony\Component\CssSelector\Exception\ExpressionErrorException; +use Symfony\Component\CssSelector\Node\FunctionNode; +use Symfony\Component\CssSelector\XPath\Translator; +use Symfony\Component\CssSelector\XPath\XPathExpr; + +/** + * XPath expression translator HTML extension. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class HtmlExtension extends AbstractExtension +{ + public function __construct(Translator $translator) + { + $translator + ->getExtension('node') + ->setFlag(NodeExtension::ELEMENT_NAME_IN_LOWER_CASE, true) + ->setFlag(NodeExtension::ATTRIBUTE_NAME_IN_LOWER_CASE, true); + } + + /** + * {@inheritdoc} + */ + public function getPseudoClassTranslators() + { + return array( + 'checked' => array($this, 'translateChecked'), + 'link' => array($this, 'translateLink'), + 'disabled' => array($this, 'translateDisabled'), + 'enabled' => array($this, 'translateEnabled'), + 'selected' => array($this, 'translateSelected'), + 'invalid' => array($this, 'translateInvalid'), + 'hover' => array($this, 'translateHover'), + 'visited' => array($this, 'translateVisited'), + ); + } + + /** + * {@inheritdoc} + */ + public function getFunctionTranslators() + { + return array( + 'lang' => array($this, 'translateLang'), + ); + } + + /** + * @return XPathExpr + */ + public function translateChecked(XPathExpr $xpath) + { + return $xpath->addCondition( + '(@checked ' + ."and (name(.) = 'input' or name(.) = 'command')" + ."and (@type = 'checkbox' or @type = 'radio'))" + ); + } + + /** + * @return XPathExpr + */ + public function translateLink(XPathExpr $xpath) + { + return $xpath->addCondition("@href and (name(.) = 'a' or name(.) = 'link' or name(.) = 'area')"); + } + + /** + * @return XPathExpr + */ + public function translateDisabled(XPathExpr $xpath) + { + return $xpath->addCondition( + '(' + .'@disabled and' + .'(' + ."(name(.) = 'input' and @type != 'hidden')" + ." or name(.) = 'button'" + ." or name(.) = 'select'" + ." or name(.) = 'textarea'" + ." or name(.) = 'command'" + ." or name(.) = 'fieldset'" + ." or name(.) = 'optgroup'" + ." or name(.) = 'option'" + .')' + .') or (' + ."(name(.) = 'input' and @type != 'hidden')" + ." or name(.) = 'button'" + ." or name(.) = 'select'" + ." or name(.) = 'textarea'" + .')' + .' and ancestor::fieldset[@disabled]' + ); + // todo: in the second half, add "and is not a descendant of that fieldset element's first legend element child, if any." + } + + /** + * @return XPathExpr + */ + public function translateEnabled(XPathExpr $xpath) + { + return $xpath->addCondition( + '(' + .'@href and (' + ."name(.) = 'a'" + ." or name(.) = 'link'" + ." or name(.) = 'area'" + .')' + .') or (' + .'(' + ."name(.) = 'command'" + ." or name(.) = 'fieldset'" + ." or name(.) = 'optgroup'" + .')' + .' and not(@disabled)' + .') or (' + .'(' + ."(name(.) = 'input' and @type != 'hidden')" + ." or name(.) = 'button'" + ." or name(.) = 'select'" + ." or name(.) = 'textarea'" + ." or name(.) = 'keygen'" + .')' + .' and not (@disabled or ancestor::fieldset[@disabled])' + .') or (' + ."name(.) = 'option' and not(" + .'@disabled or ancestor::optgroup[@disabled]' + .')' + .')' + ); + } + + /** + * @return XPathExpr + * + * @throws ExpressionErrorException + */ + public function translateLang(XPathExpr $xpath, FunctionNode $function) + { + $arguments = $function->getArguments(); + foreach ($arguments as $token) { + if (!($token->isString() || $token->isIdentifier())) { + throw new ExpressionErrorException('Expected a single string or identifier for :lang(), got '.implode(', ', $arguments)); + } + } + + return $xpath->addCondition(sprintf( + 'ancestor-or-self::*[@lang][1][starts-with(concat(' + ."translate(@%s, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), '-')" + .', %s)]', + 'lang', + Translator::getXpathLiteral(strtolower($arguments[0]->getValue()).'-') + )); + } + + /** + * @return XPathExpr + */ + public function translateSelected(XPathExpr $xpath) + { + return $xpath->addCondition("(@selected and name(.) = 'option')"); + } + + /** + * @return XPathExpr + */ + public function translateInvalid(XPathExpr $xpath) + { + return $xpath->addCondition('0'); + } + + /** + * @return XPathExpr + */ + public function translateHover(XPathExpr $xpath) + { + return $xpath->addCondition('0'); + } + + /** + * @return XPathExpr + */ + public function translateVisited(XPathExpr $xpath) + { + return $xpath->addCondition('0'); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'html'; + } +} diff --git a/application/vendor/symfony/css-selector/XPath/Extension/NodeExtension.php b/application/vendor/symfony/css-selector/XPath/Extension/NodeExtension.php new file mode 100644 index 0000000..715d961 --- /dev/null +++ b/application/vendor/symfony/css-selector/XPath/Extension/NodeExtension.php @@ -0,0 +1,242 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\XPath\Extension; + +use Symfony\Component\CssSelector\Node; +use Symfony\Component\CssSelector\XPath\Translator; +use Symfony\Component\CssSelector\XPath\XPathExpr; + +/** + * XPath expression translator node extension. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class NodeExtension extends AbstractExtension +{ + const ELEMENT_NAME_IN_LOWER_CASE = 1; + const ATTRIBUTE_NAME_IN_LOWER_CASE = 2; + const ATTRIBUTE_VALUE_IN_LOWER_CASE = 4; + + private $flags; + + /** + * @param int $flags + */ + public function __construct($flags = 0) + { + $this->flags = $flags; + } + + /** + * @param int $flag + * @param bool $on + * + * @return $this + */ + public function setFlag($flag, $on) + { + if ($on && !$this->hasFlag($flag)) { + $this->flags += $flag; + } + + if (!$on && $this->hasFlag($flag)) { + $this->flags -= $flag; + } + + return $this; + } + + /** + * @param int $flag + * + * @return bool + */ + public function hasFlag($flag) + { + return (bool) ($this->flags & $flag); + } + + /** + * {@inheritdoc} + */ + public function getNodeTranslators() + { + return array( + 'Selector' => array($this, 'translateSelector'), + 'CombinedSelector' => array($this, 'translateCombinedSelector'), + 'Negation' => array($this, 'translateNegation'), + 'Function' => array($this, 'translateFunction'), + 'Pseudo' => array($this, 'translatePseudo'), + 'Attribute' => array($this, 'translateAttribute'), + 'Class' => array($this, 'translateClass'), + 'Hash' => array($this, 'translateHash'), + 'Element' => array($this, 'translateElement'), + ); + } + + /** + * @return XPathExpr + */ + public function translateSelector(Node\SelectorNode $node, Translator $translator) + { + return $translator->nodeToXPath($node->getTree()); + } + + /** + * @return XPathExpr + */ + public function translateCombinedSelector(Node\CombinedSelectorNode $node, Translator $translator) + { + return $translator->addCombination($node->getCombinator(), $node->getSelector(), $node->getSubSelector()); + } + + /** + * @return XPathExpr + */ + public function translateNegation(Node\NegationNode $node, Translator $translator) + { + $xpath = $translator->nodeToXPath($node->getSelector()); + $subXpath = $translator->nodeToXPath($node->getSubSelector()); + $subXpath->addNameTest(); + + if ($subXpath->getCondition()) { + return $xpath->addCondition(sprintf('not(%s)', $subXpath->getCondition())); + } + + return $xpath->addCondition('0'); + } + + /** + * @return XPathExpr + */ + public function translateFunction(Node\FunctionNode $node, Translator $translator) + { + $xpath = $translator->nodeToXPath($node->getSelector()); + + return $translator->addFunction($xpath, $node); + } + + /** + * @return XPathExpr + */ + public function translatePseudo(Node\PseudoNode $node, Translator $translator) + { + $xpath = $translator->nodeToXPath($node->getSelector()); + + return $translator->addPseudoClass($xpath, $node->getIdentifier()); + } + + /** + * @return XPathExpr + */ + public function translateAttribute(Node\AttributeNode $node, Translator $translator) + { + $name = $node->getAttribute(); + $safe = $this->isSafeName($name); + + if ($this->hasFlag(self::ATTRIBUTE_NAME_IN_LOWER_CASE)) { + $name = strtolower($name); + } + + if ($node->getNamespace()) { + $name = sprintf('%s:%s', $node->getNamespace(), $name); + $safe = $safe && $this->isSafeName($node->getNamespace()); + } + + $attribute = $safe ? '@'.$name : sprintf('attribute::*[name() = %s]', Translator::getXpathLiteral($name)); + $value = $node->getValue(); + $xpath = $translator->nodeToXPath($node->getSelector()); + + if ($this->hasFlag(self::ATTRIBUTE_VALUE_IN_LOWER_CASE)) { + $value = strtolower($value); + } + + return $translator->addAttributeMatching($xpath, $node->getOperator(), $attribute, $value); + } + + /** + * @return XPathExpr + */ + public function translateClass(Node\ClassNode $node, Translator $translator) + { + $xpath = $translator->nodeToXPath($node->getSelector()); + + return $translator->addAttributeMatching($xpath, '~=', '@class', $node->getName()); + } + + /** + * @return XPathExpr + */ + public function translateHash(Node\HashNode $node, Translator $translator) + { + $xpath = $translator->nodeToXPath($node->getSelector()); + + return $translator->addAttributeMatching($xpath, '=', '@id', $node->getId()); + } + + /** + * @return XPathExpr + */ + public function translateElement(Node\ElementNode $node) + { + $element = $node->getElement(); + + if ($this->hasFlag(self::ELEMENT_NAME_IN_LOWER_CASE)) { + $element = strtolower($element); + } + + if ($element) { + $safe = $this->isSafeName($element); + } else { + $element = '*'; + $safe = true; + } + + if ($node->getNamespace()) { + $element = sprintf('%s:%s', $node->getNamespace(), $element); + $safe = $safe && $this->isSafeName($node->getNamespace()); + } + + $xpath = new XPathExpr('', $element); + + if (!$safe) { + $xpath->addNameTest(); + } + + return $xpath; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'node'; + } + + /** + * Tests if given name is safe. + * + * @param string $name + * + * @return bool + */ + private function isSafeName($name) + { + return 0 < preg_match('~^[a-zA-Z_][a-zA-Z0-9_.-]*$~', $name); + } +} diff --git a/application/vendor/symfony/css-selector/XPath/Extension/PseudoClassExtension.php b/application/vendor/symfony/css-selector/XPath/Extension/PseudoClassExtension.php new file mode 100644 index 0000000..378dfb7 --- /dev/null +++ b/application/vendor/symfony/css-selector/XPath/Extension/PseudoClassExtension.php @@ -0,0 +1,148 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\XPath\Extension; + +use Symfony\Component\CssSelector\Exception\ExpressionErrorException; +use Symfony\Component\CssSelector\XPath\XPathExpr; + +/** + * XPath expression translator pseudo-class extension. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class PseudoClassExtension extends AbstractExtension +{ + /** + * {@inheritdoc} + */ + public function getPseudoClassTranslators() + { + return array( + 'root' => array($this, 'translateRoot'), + 'first-child' => array($this, 'translateFirstChild'), + 'last-child' => array($this, 'translateLastChild'), + 'first-of-type' => array($this, 'translateFirstOfType'), + 'last-of-type' => array($this, 'translateLastOfType'), + 'only-child' => array($this, 'translateOnlyChild'), + 'only-of-type' => array($this, 'translateOnlyOfType'), + 'empty' => array($this, 'translateEmpty'), + ); + } + + /** + * @return XPathExpr + */ + public function translateRoot(XPathExpr $xpath) + { + return $xpath->addCondition('not(parent::*)'); + } + + /** + * @return XPathExpr + */ + public function translateFirstChild(XPathExpr $xpath) + { + return $xpath + ->addStarPrefix() + ->addNameTest() + ->addCondition('position() = 1'); + } + + /** + * @return XPathExpr + */ + public function translateLastChild(XPathExpr $xpath) + { + return $xpath + ->addStarPrefix() + ->addNameTest() + ->addCondition('position() = last()'); + } + + /** + * @return XPathExpr + * + * @throws ExpressionErrorException + */ + public function translateFirstOfType(XPathExpr $xpath) + { + if ('*' === $xpath->getElement()) { + throw new ExpressionErrorException('"*:first-of-type" is not implemented.'); + } + + return $xpath + ->addStarPrefix() + ->addCondition('position() = 1'); + } + + /** + * @return XPathExpr + * + * @throws ExpressionErrorException + */ + public function translateLastOfType(XPathExpr $xpath) + { + if ('*' === $xpath->getElement()) { + throw new ExpressionErrorException('"*:last-of-type" is not implemented.'); + } + + return $xpath + ->addStarPrefix() + ->addCondition('position() = last()'); + } + + /** + * @return XPathExpr + */ + public function translateOnlyChild(XPathExpr $xpath) + { + return $xpath + ->addStarPrefix() + ->addNameTest() + ->addCondition('last() = 1'); + } + + /** + * @return XPathExpr + * + * @throws ExpressionErrorException + */ + public function translateOnlyOfType(XPathExpr $xpath) + { + if ('*' === $xpath->getElement()) { + throw new ExpressionErrorException('"*:only-of-type" is not implemented.'); + } + + return $xpath->addCondition('last() = 1'); + } + + /** + * @return XPathExpr + */ + public function translateEmpty(XPathExpr $xpath) + { + return $xpath->addCondition('not(*) and not(string-length())'); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'pseudo-class'; + } +} diff --git a/application/vendor/symfony/css-selector/XPath/Translator.php b/application/vendor/symfony/css-selector/XPath/Translator.php new file mode 100644 index 0000000..f8585a0 --- /dev/null +++ b/application/vendor/symfony/css-selector/XPath/Translator.php @@ -0,0 +1,267 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\XPath; + +use Symfony\Component\CssSelector\Exception\ExpressionErrorException; +use Symfony\Component\CssSelector\Node\FunctionNode; +use Symfony\Component\CssSelector\Node\NodeInterface; +use Symfony\Component\CssSelector\Node\SelectorNode; +use Symfony\Component\CssSelector\Parser\Parser; +use Symfony\Component\CssSelector\Parser\ParserInterface; + +/** + * XPath expression translator interface. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class Translator implements TranslatorInterface +{ + private $mainParser; + + /** + * @var ParserInterface[] + */ + private $shortcutParsers = array(); + + /** + * @var Extension\ExtensionInterface[] + */ + private $extensions = array(); + + private $nodeTranslators = array(); + private $combinationTranslators = array(); + private $functionTranslators = array(); + private $pseudoClassTranslators = array(); + private $attributeMatchingTranslators = array(); + + public function __construct(ParserInterface $parser = null) + { + $this->mainParser = $parser ?: new Parser(); + + $this + ->registerExtension(new Extension\NodeExtension()) + ->registerExtension(new Extension\CombinationExtension()) + ->registerExtension(new Extension\FunctionExtension()) + ->registerExtension(new Extension\PseudoClassExtension()) + ->registerExtension(new Extension\AttributeMatchingExtension()) + ; + } + + /** + * @param string $element + * + * @return string + */ + public static function getXpathLiteral($element) + { + if (false === strpos($element, "'")) { + return "'".$element."'"; + } + + if (false === strpos($element, '"')) { + return '"'.$element.'"'; + } + + $string = $element; + $parts = array(); + while (true) { + if (false !== $pos = strpos($string, "'")) { + $parts[] = sprintf("'%s'", substr($string, 0, $pos)); + $parts[] = "\"'\""; + $string = substr($string, $pos + 1); + } else { + $parts[] = "'$string'"; + break; + } + } + + return sprintf('concat(%s)', implode(', ', $parts)); + } + + /** + * {@inheritdoc} + */ + public function cssToXPath($cssExpr, $prefix = 'descendant-or-self::') + { + $selectors = $this->parseSelectors($cssExpr); + + /** @var SelectorNode $selector */ + foreach ($selectors as $index => $selector) { + if (null !== $selector->getPseudoElement()) { + throw new ExpressionErrorException('Pseudo-elements are not supported.'); + } + + $selectors[$index] = $this->selectorToXPath($selector, $prefix); + } + + return implode(' | ', $selectors); + } + + /** + * {@inheritdoc} + */ + public function selectorToXPath(SelectorNode $selector, $prefix = 'descendant-or-self::') + { + return ($prefix ?: '').$this->nodeToXPath($selector); + } + + /** + * Registers an extension. + * + * @return $this + */ + public function registerExtension(Extension\ExtensionInterface $extension) + { + $this->extensions[$extension->getName()] = $extension; + + $this->nodeTranslators = array_merge($this->nodeTranslators, $extension->getNodeTranslators()); + $this->combinationTranslators = array_merge($this->combinationTranslators, $extension->getCombinationTranslators()); + $this->functionTranslators = array_merge($this->functionTranslators, $extension->getFunctionTranslators()); + $this->pseudoClassTranslators = array_merge($this->pseudoClassTranslators, $extension->getPseudoClassTranslators()); + $this->attributeMatchingTranslators = array_merge($this->attributeMatchingTranslators, $extension->getAttributeMatchingTranslators()); + + return $this; + } + + /** + * @param string $name + * + * @return Extension\ExtensionInterface + * + * @throws ExpressionErrorException + */ + public function getExtension($name) + { + if (!isset($this->extensions[$name])) { + throw new ExpressionErrorException(sprintf('Extension "%s" not registered.', $name)); + } + + return $this->extensions[$name]; + } + + /** + * Registers a shortcut parser. + * + * @return $this + */ + public function registerParserShortcut(ParserInterface $shortcut) + { + $this->shortcutParsers[] = $shortcut; + + return $this; + } + + /** + * @return XPathExpr + * + * @throws ExpressionErrorException + */ + public function nodeToXPath(NodeInterface $node) + { + if (!isset($this->nodeTranslators[$node->getNodeName()])) { + throw new ExpressionErrorException(sprintf('Node "%s" not supported.', $node->getNodeName())); + } + + return \call_user_func($this->nodeTranslators[$node->getNodeName()], $node, $this); + } + + /** + * @param string $combiner + * @param NodeInterface $xpath + * @param NodeInterface $combinedXpath + * + * @return XPathExpr + * + * @throws ExpressionErrorException + */ + public function addCombination($combiner, NodeInterface $xpath, NodeInterface $combinedXpath) + { + if (!isset($this->combinationTranslators[$combiner])) { + throw new ExpressionErrorException(sprintf('Combiner "%s" not supported.', $combiner)); + } + + return \call_user_func($this->combinationTranslators[$combiner], $this->nodeToXPath($xpath), $this->nodeToXPath($combinedXpath)); + } + + /** + * @return XPathExpr + * + * @throws ExpressionErrorException + */ + public function addFunction(XPathExpr $xpath, FunctionNode $function) + { + if (!isset($this->functionTranslators[$function->getName()])) { + throw new ExpressionErrorException(sprintf('Function "%s" not supported.', $function->getName())); + } + + return \call_user_func($this->functionTranslators[$function->getName()], $xpath, $function); + } + + /** + * @param XPathExpr $xpath + * @param string $pseudoClass + * + * @return XPathExpr + * + * @throws ExpressionErrorException + */ + public function addPseudoClass(XPathExpr $xpath, $pseudoClass) + { + if (!isset($this->pseudoClassTranslators[$pseudoClass])) { + throw new ExpressionErrorException(sprintf('Pseudo-class "%s" not supported.', $pseudoClass)); + } + + return \call_user_func($this->pseudoClassTranslators[$pseudoClass], $xpath); + } + + /** + * @param XPathExpr $xpath + * @param string $operator + * @param string $attribute + * @param string $value + * + * @return XPathExpr + * + * @throws ExpressionErrorException + */ + public function addAttributeMatching(XPathExpr $xpath, $operator, $attribute, $value) + { + if (!isset($this->attributeMatchingTranslators[$operator])) { + throw new ExpressionErrorException(sprintf('Attribute matcher operator "%s" not supported.', $operator)); + } + + return \call_user_func($this->attributeMatchingTranslators[$operator], $xpath, $attribute, $value); + } + + /** + * @param string $css + * + * @return SelectorNode[] + */ + private function parseSelectors($css) + { + foreach ($this->shortcutParsers as $shortcut) { + $tokens = $shortcut->parse($css); + + if (!empty($tokens)) { + return $tokens; + } + } + + return $this->mainParser->parse($css); + } +} diff --git a/application/vendor/symfony/css-selector/XPath/TranslatorInterface.php b/application/vendor/symfony/css-selector/XPath/TranslatorInterface.php new file mode 100644 index 0000000..0b5de83 --- /dev/null +++ b/application/vendor/symfony/css-selector/XPath/TranslatorInterface.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\XPath; + +use Symfony\Component\CssSelector\Node\SelectorNode; + +/** + * XPath expression translator interface. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +interface TranslatorInterface +{ + /** + * Translates a CSS selector to an XPath expression. + * + * @param string $cssExpr + * @param string $prefix + * + * @return string + */ + public function cssToXPath($cssExpr, $prefix = 'descendant-or-self::'); + + /** + * Translates a parsed selector node to an XPath expression. + * + * @param SelectorNode $selector + * @param string $prefix + * + * @return string + */ + public function selectorToXPath(SelectorNode $selector, $prefix = 'descendant-or-self::'); +} diff --git a/application/vendor/symfony/css-selector/XPath/XPathExpr.php b/application/vendor/symfony/css-selector/XPath/XPathExpr.php new file mode 100644 index 0000000..63e3ac3 --- /dev/null +++ b/application/vendor/symfony/css-selector/XPath/XPathExpr.php @@ -0,0 +1,131 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\CssSelector\XPath; + +/** + * XPath expression translator interface. + * + * This component is a port of the Python cssselect library, + * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. + * + * @author Jean-François Simon + * + * @internal + */ +class XPathExpr +{ + private $path; + private $element; + private $condition; + + /** + * @param string $path + * @param string $element + * @param string $condition + * @param bool $starPrefix + */ + public function __construct($path = '', $element = '*', $condition = '', $starPrefix = false) + { + $this->path = $path; + $this->element = $element; + $this->condition = $condition; + + if ($starPrefix) { + $this->addStarPrefix(); + } + } + + /** + * @return string + */ + public function getElement() + { + return $this->element; + } + + /** + * @param $condition + * + * @return $this + */ + public function addCondition($condition) + { + $this->condition = $this->condition ? sprintf('(%s) and (%s)', $this->condition, $condition) : $condition; + + return $this; + } + + /** + * @return string + */ + public function getCondition() + { + return $this->condition; + } + + /** + * @return $this + */ + public function addNameTest() + { + if ('*' !== $this->element) { + $this->addCondition('name() = '.Translator::getXpathLiteral($this->element)); + $this->element = '*'; + } + + return $this; + } + + /** + * @return $this + */ + public function addStarPrefix() + { + $this->path .= '*/'; + + return $this; + } + + /** + * Joins another XPathExpr with a combiner. + * + * @param string $combiner + * @param XPathExpr $expr + * + * @return $this + */ + public function join($combiner, self $expr) + { + $path = $this->__toString().$combiner; + + if ('*/' !== $expr->path) { + $path .= $expr->path; + } + + $this->path = $path; + $this->element = $expr->element; + $this->condition = $expr->condition; + + return $this; + } + + /** + * @return string + */ + public function __toString() + { + $path = $this->path.$this->element; + $condition = null === $this->condition || '' === $this->condition ? '' : '['.$this->condition.']'; + + return $path.$condition; + } +} diff --git a/application/vendor/symfony/css-selector/composer.json b/application/vendor/symfony/css-selector/composer.json new file mode 100644 index 0000000..e5bbdcc --- /dev/null +++ b/application/vendor/symfony/css-selector/composer.json @@ -0,0 +1,37 @@ +{ + "name": "symfony/css-selector", + "type": "library", + "description": "Symfony CssSelector Component", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=5.3.9" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\CssSelector\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + } +} diff --git a/application/vendor/symfony/css-selector/phpunit.xml.dist b/application/vendor/symfony/css-selector/phpunit.xml.dist new file mode 100644 index 0000000..a8e537e --- /dev/null +++ b/application/vendor/symfony/css-selector/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + + + + + ./Tests/ + + + + + + ./ + + ./Resources + ./Tests + ./vendor + + + + diff --git a/application/vendor/symfony/filesystem/.gitignore b/application/vendor/symfony/debug/.gitignore similarity index 100% rename from application/vendor/symfony/filesystem/.gitignore rename to application/vendor/symfony/debug/.gitignore diff --git a/application/vendor/symfony/debug/CHANGELOG.md b/application/vendor/symfony/debug/CHANGELOG.md new file mode 100644 index 0000000..31f0de9 --- /dev/null +++ b/application/vendor/symfony/debug/CHANGELOG.md @@ -0,0 +1,35 @@ +CHANGELOG +========= + +2.7.0 +----- + +* added deprecations checking for parent interfaces/classes to DebugClassLoader +* added ZTS support to symfony_debug extension +* added symfony_debug_backtrace() to symfony_debug extension + to track the backtrace of fatal errors + +2.6.0 +----- + +* generalized ErrorHandler and ExceptionHandler, + with some new methods and others deprecated +* enhanced error messages for uncaught exceptions + +2.5.0 +----- + +* added ExceptionHandler::setHandler() +* added UndefinedMethodFatalErrorHandler +* deprecated DummyException + +2.4.0 +----- + + * added a DebugClassLoader able to wrap any autoloader providing a findFile method + * improved error messages for not found classes and functions + +2.3.0 +----- + + * added the component diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Debug.php b/application/vendor/symfony/debug/Debug.php similarity index 96% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Debug.php rename to application/vendor/symfony/debug/Debug.php index 08b35f4..9ae3496 100644 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Debug.php +++ b/application/vendor/symfony/debug/Debug.php @@ -45,7 +45,7 @@ public static function enable($errorReportingLevel = null, $displayErrors = true error_reporting(-1); } - if ('cli' !== php_sapi_name()) { + if (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true)) { ini_set('display_errors', 0); ExceptionHandler::register(); } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) { diff --git a/application/vendor/symfony/debug/DebugClassLoader.php b/application/vendor/symfony/debug/DebugClassLoader.php new file mode 100644 index 0000000..c34605c --- /dev/null +++ b/application/vendor/symfony/debug/DebugClassLoader.php @@ -0,0 +1,325 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Debug; + +/** + * Autoloader checking if the class is really defined in the file found. + * + * The ClassLoader will wrap all registered autoloaders + * and will throw an exception if a file is found but does + * not declare the class. + * + * @author Fabien Potencier + * @author Christophe Coevoet + * @author Nicolas Grekas + */ +class DebugClassLoader +{ + private $classLoader; + private $isFinder; + private $loaded = array(); + private $wasFinder; + private static $caseCheck; + private static $deprecated = array(); + private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null'); + private static $darwinCache = array('/' => array('/', array())); + + /** + * @param callable|object $classLoader Passing an object is @deprecated since version 2.5 and support for it will be removed in 3.0 + */ + public function __construct($classLoader) + { + $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile'); + + if ($this->wasFinder) { + @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED); + $this->classLoader = array($classLoader, 'loadClass'); + $this->isFinder = true; + } else { + $this->classLoader = $classLoader; + $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile'); + } + + if (!isset(self::$caseCheck)) { + $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR); + $i = strrpos($file, DIRECTORY_SEPARATOR); + $dir = substr($file, 0, 1 + $i); + $file = substr($file, 1 + $i); + $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file); + $test = realpath($dir.$test); + + if (false === $test || false === $i) { + // filesystem is case sensitive + self::$caseCheck = 0; + } elseif (substr($test, -strlen($file)) === $file) { + // filesystem is case insensitive and realpath() normalizes the case of characters + self::$caseCheck = 1; + } elseif (false !== stripos(PHP_OS, 'darwin')) { + // on MacOSX, HFS+ is case insensitive but realpath() doesn't normalize the case of characters + self::$caseCheck = 2; + } else { + // filesystem case checks failed, fallback to disabling them + self::$caseCheck = 0; + } + } + } + + /** + * Gets the wrapped class loader. + * + * @return callable|object A class loader. Since version 2.5, returning an object is @deprecated and support for it will be removed in 3.0 + */ + public function getClassLoader() + { + return $this->wasFinder ? $this->classLoader[0] : $this->classLoader; + } + + /** + * Wraps all autoloaders. + */ + public static function enable() + { + // Ensures we don't hit https://bugs.php.net/42098 + class_exists('Symfony\Component\Debug\ErrorHandler'); + class_exists('Psr\Log\LogLevel'); + + if (!is_array($functions = spl_autoload_functions())) { + return; + } + + foreach ($functions as $function) { + spl_autoload_unregister($function); + } + + foreach ($functions as $function) { + if (!is_array($function) || !$function[0] instanceof self) { + $function = array(new static($function), 'loadClass'); + } + + spl_autoload_register($function); + } + } + + /** + * Disables the wrapping. + */ + public static function disable() + { + if (!is_array($functions = spl_autoload_functions())) { + return; + } + + foreach ($functions as $function) { + spl_autoload_unregister($function); + } + + foreach ($functions as $function) { + if (is_array($function) && $function[0] instanceof self) { + $function = $function[0]->getClassLoader(); + } + + spl_autoload_register($function); + } + } + + /** + * Finds a file by class name. + * + * @param string $class A class name to resolve to file + * + * @return string|null + * + * @deprecated since version 2.5, to be removed in 3.0. + */ + public function findFile($class) + { + @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + + if ($this->wasFinder) { + return $this->classLoader[0]->findFile($class); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * + * @return bool|null True, if loaded + * + * @throws \RuntimeException + */ + public function loadClass($class) + { + ErrorHandler::stackErrors(); + + try { + if ($this->isFinder && !isset($this->loaded[$class])) { + $this->loaded[$class] = true; + if ($file = $this->classLoader[0]->findFile($class)) { + require $file; + } + } else { + call_user_func($this->classLoader, $class); + $file = false; + } + } catch (\Exception $e) { + ErrorHandler::unstackErrors(); + + throw $e; + } catch (\Throwable $e) { + ErrorHandler::unstackErrors(); + + throw $e; + } + + ErrorHandler::unstackErrors(); + + $exists = class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false)); + + if ($class && '\\' === $class[0]) { + $class = substr($class, 1); + } + + if ($exists) { + $refl = new \ReflectionClass($class); + $name = $refl->getName(); + + if ($name !== $class && 0 === strcasecmp($name, $class)) { + throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name)); + } + + if (in_array(strtolower($refl->getShortName()), self::$php7Reserved)) { + @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED); + } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) { + self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]); + } else { + if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) { + $len = 0; + $ns = ''; + } else { + $ns = substr($name, 0, $len); + } + $parent = get_parent_class($class); + + if (!$parent || strncmp($ns, $parent, $len)) { + if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) { + @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED); + } + + foreach (class_implements($class) as $interface) { + if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len) && !is_subclass_of($parent, $interface)) { + @trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, interface_exists($class) ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED); + } + } + } + } + } + + if ($file) { + if (!$exists) { + if (false !== strpos($class, '/')) { + throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class)); + } + + throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file)); + } + if (self::$caseCheck) { + $real = explode('\\', $class.strrchr($file, '.')); + $tail = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR, $file)); + + $i = count($tail) - 1; + $j = count($real) - 1; + + while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) { + --$i; + --$j; + } + + array_splice($tail, 0, $i + 1); + } + if (self::$caseCheck && $tail) { + $tail = DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $tail); + $tailLen = strlen($tail); + $real = $refl->getFileName(); + + if (2 === self::$caseCheck) { + // realpath() on MacOSX doesn't normalize the case of characters + + $i = 1 + strrpos($real, '/'); + $file = substr($real, $i); + $real = substr($real, 0, $i); + + if (isset(self::$darwinCache[$real])) { + $kDir = $real; + } else { + $kDir = strtolower($real); + + if (isset(self::$darwinCache[$kDir])) { + $real = self::$darwinCache[$kDir][0]; + } else { + $dir = getcwd(); + chdir($real); + $real = getcwd().'/'; + chdir($dir); + + $dir = $real; + $k = $kDir; + $i = strlen($dir) - 1; + while (!isset(self::$darwinCache[$k])) { + self::$darwinCache[$k] = array($dir, array()); + self::$darwinCache[$dir] = &self::$darwinCache[$k]; + + while ('/' !== $dir[--$i]) { + } + $k = substr($k, 0, ++$i); + $dir = substr($dir, 0, $i--); + } + } + } + + $dirFiles = self::$darwinCache[$kDir][1]; + + if (isset($dirFiles[$file])) { + $kFile = $file; + } else { + $kFile = strtolower($file); + + if (!isset($dirFiles[$kFile])) { + foreach (scandir($real, 2) as $f) { + if ('.' !== $f[0]) { + $dirFiles[$f] = $f; + if ($f === $file) { + $kFile = $k = $file; + } elseif ($f !== $k = strtolower($f)) { + $dirFiles[$k] = $f; + } + } + } + self::$darwinCache[$kDir][1] = $dirFiles; + } + } + + $real .= $dirFiles[$kFile]; + } + + if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true) + && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false) + ) { + throw new \RuntimeException(sprintf('Case mismatch between class and real file names: %s vs %s in %s', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1))); + } + } + + return true; + } + } +} diff --git a/application/vendor/symfony/debug/ErrorHandler.php b/application/vendor/symfony/debug/ErrorHandler.php new file mode 100644 index 0000000..4671b85 --- /dev/null +++ b/application/vendor/symfony/debug/ErrorHandler.php @@ -0,0 +1,824 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Debug; + +use Psr\Log\LogLevel; +use Psr\Log\LoggerInterface; +use Symfony\Component\Debug\Exception\ContextErrorException; +use Symfony\Component\Debug\Exception\FatalErrorException; +use Symfony\Component\Debug\Exception\FatalThrowableError; +use Symfony\Component\Debug\Exception\OutOfMemoryException; +use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler; +use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler; +use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler; +use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface; + +/** + * A generic ErrorHandler for the PHP engine. + * + * Provides five bit fields that control how errors are handled: + * - thrownErrors: errors thrown as \ErrorException + * - loggedErrors: logged errors, when not @-silenced + * - scopedErrors: errors thrown or logged with their local context + * - tracedErrors: errors logged with their stack trace, only once for repeated errors + * - screamedErrors: never @-silenced errors + * + * Each error level can be logged by a dedicated PSR-3 logger object. + * Screaming only applies to logging. + * Throwing takes precedence over logging. + * Uncaught exceptions are logged as E_ERROR. + * E_DEPRECATED and E_USER_DEPRECATED levels never throw. + * E_RECOVERABLE_ERROR and E_USER_ERROR levels always throw. + * Non catchable errors that can be detected at shutdown time are logged when the scream bit field allows so. + * As errors have a performance cost, repeated errors are all logged, so that the developer + * can see them and weight them as more important to fix than others of the same level. + * + * @author Nicolas Grekas + */ +class ErrorHandler +{ + /** + * @deprecated since version 2.6, to be removed in 3.0. + */ + const TYPE_DEPRECATION = -100; + + private $levels = array( + E_DEPRECATED => 'Deprecated', + E_USER_DEPRECATED => 'User Deprecated', + E_NOTICE => 'Notice', + E_USER_NOTICE => 'User Notice', + E_STRICT => 'Runtime Notice', + E_WARNING => 'Warning', + E_USER_WARNING => 'User Warning', + E_COMPILE_WARNING => 'Compile Warning', + E_CORE_WARNING => 'Core Warning', + E_USER_ERROR => 'User Error', + E_RECOVERABLE_ERROR => 'Catchable Fatal Error', + E_COMPILE_ERROR => 'Compile Error', + E_PARSE => 'Parse Error', + E_ERROR => 'Error', + E_CORE_ERROR => 'Core Error', + ); + + private $loggers = array( + E_DEPRECATED => array(null, LogLevel::INFO), + E_USER_DEPRECATED => array(null, LogLevel::INFO), + E_NOTICE => array(null, LogLevel::WARNING), + E_USER_NOTICE => array(null, LogLevel::WARNING), + E_STRICT => array(null, LogLevel::WARNING), + E_WARNING => array(null, LogLevel::WARNING), + E_USER_WARNING => array(null, LogLevel::WARNING), + E_COMPILE_WARNING => array(null, LogLevel::WARNING), + E_CORE_WARNING => array(null, LogLevel::WARNING), + E_USER_ERROR => array(null, LogLevel::CRITICAL), + E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL), + E_COMPILE_ERROR => array(null, LogLevel::CRITICAL), + E_PARSE => array(null, LogLevel::CRITICAL), + E_ERROR => array(null, LogLevel::CRITICAL), + E_CORE_ERROR => array(null, LogLevel::CRITICAL), + ); + + private $thrownErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED + private $scopedErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED + private $tracedErrors = 0x77FB; // E_ALL - E_STRICT - E_PARSE + private $screamedErrors = 0x55; // E_ERROR + E_CORE_ERROR + E_COMPILE_ERROR + E_PARSE + private $loggedErrors = 0; + + private $loggedTraces = array(); + private $isRecursive = 0; + private $isRoot = false; + private $exceptionHandler; + + private static $reservedMemory; + private static $stackedErrors = array(); + private static $stackedErrorLevels = array(); + private static $exitCode = 0; + + /** + * Same init value as thrownErrors. + * + * @deprecated since version 2.6, to be removed in 3.0. + */ + private $displayErrors = 0x1FFF; + + /** + * Registers the error handler. + * + * @param self|null|int $handler The handler to register, or @deprecated (since version 2.6, to be removed in 3.0) bit field of thrown levels + * @param bool $replace Whether to replace or not any existing handler + * + * @return self The registered error handler + */ + public static function register($handler = null, $replace = true) + { + if (null === self::$reservedMemory) { + self::$reservedMemory = str_repeat('x', 10240); + register_shutdown_function(__CLASS__.'::handleFatalError'); + } + + $levels = -1; + + if ($handlerIsNew = !$handler instanceof self) { + // @deprecated polymorphism, to be removed in 3.0 + if (null !== $handler) { + $levels = $replace ? $handler : 0; + $replace = true; + } + $handler = new static(); + } + + if (null === $prev = set_error_handler(array($handler, 'handleError'))) { + restore_error_handler(); + // Specifying the error types earlier would expose us to https://bugs.php.net/63206 + set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors); + $handler->isRoot = true; + } + + if ($handlerIsNew && is_array($prev) && $prev[0] instanceof self) { + $handler = $prev[0]; + $replace = false; + } + if (!$replace && $prev) { + restore_error_handler(); + $handlerIsRegistered = is_array($prev) && $handler === $prev[0]; + } else { + $handlerIsRegistered = true; + } + if (is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) { + restore_exception_handler(); + if (!$handlerIsRegistered) { + $handler = $prev[0]; + } elseif ($handler !== $prev[0] && $replace) { + set_exception_handler(array($handler, 'handleException')); + $p = $prev[0]->setExceptionHandler(null); + $handler->setExceptionHandler($p); + $prev[0]->setExceptionHandler($p); + } + } else { + $handler->setExceptionHandler($prev); + } + + $handler->throwAt($levels & $handler->thrownErrors, true); + + return $handler; + } + + /** + * Sets a logger to non assigned errors levels. + * + * @param LoggerInterface $logger A PSR-3 logger to put as default for the given levels + * @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants + * @param bool $replace Whether to replace or not any existing logger + */ + public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false) + { + $loggers = array(); + + if (is_array($levels)) { + foreach ($levels as $type => $logLevel) { + if (empty($this->loggers[$type][0]) || $replace) { + $loggers[$type] = array($logger, $logLevel); + } + } + } else { + if (null === $levels) { + $levels = E_ALL | E_STRICT; + } + foreach ($this->loggers as $type => $log) { + if (($type & $levels) && (empty($log[0]) || $replace)) { + $log[0] = $logger; + $loggers[$type] = $log; + } + } + } + + $this->setLoggers($loggers); + } + + /** + * Sets a logger for each error level. + * + * @param array $loggers Error levels to [LoggerInterface|null, LogLevel::*] map + * + * @return array The previous map + * + * @throws \InvalidArgumentException + */ + public function setLoggers(array $loggers) + { + $prevLogged = $this->loggedErrors; + $prev = $this->loggers; + + foreach ($loggers as $type => $log) { + if (!isset($prev[$type])) { + throw new \InvalidArgumentException('Unknown error type: '.$type); + } + if (!is_array($log)) { + $log = array($log); + } elseif (!array_key_exists(0, $log)) { + throw new \InvalidArgumentException('No logger provided'); + } + if (null === $log[0]) { + $this->loggedErrors &= ~$type; + } elseif ($log[0] instanceof LoggerInterface) { + $this->loggedErrors |= $type; + } else { + throw new \InvalidArgumentException('Invalid logger provided'); + } + $this->loggers[$type] = $log + $prev[$type]; + } + $this->reRegister($prevLogged | $this->thrownErrors); + + return $prev; + } + + /** + * Sets a user exception handler. + * + * @param callable $handler A handler that will be called on Exception + * + * @return callable|null The previous exception handler + * + * @throws \InvalidArgumentException + */ + public function setExceptionHandler($handler) + { + if (null !== $handler && !is_callable($handler)) { + throw new \LogicException('The exception handler must be a valid PHP callable.'); + } + $prev = $this->exceptionHandler; + $this->exceptionHandler = $handler; + + return $prev; + } + + /** + * Sets the PHP error levels that throw an exception when a PHP error occurs. + * + * @param int $levels A bit field of E_* constants for thrown errors + * @param bool $replace Replace or amend the previous value + * + * @return int The previous value + */ + public function throwAt($levels, $replace = false) + { + $prev = $this->thrownErrors; + $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED; + if (!$replace) { + $this->thrownErrors |= $prev; + } + $this->reRegister($prev | $this->loggedErrors); + + // $this->displayErrors is @deprecated since version 2.6 + $this->displayErrors = $this->thrownErrors; + + return $prev; + } + + /** + * Sets the PHP error levels for which local variables are preserved. + * + * @param int $levels A bit field of E_* constants for scoped errors + * @param bool $replace Replace or amend the previous value + * + * @return int The previous value + */ + public function scopeAt($levels, $replace = false) + { + $prev = $this->scopedErrors; + $this->scopedErrors = (int) $levels; + if (!$replace) { + $this->scopedErrors |= $prev; + } + + return $prev; + } + + /** + * Sets the PHP error levels for which the stack trace is preserved. + * + * @param int $levels A bit field of E_* constants for traced errors + * @param bool $replace Replace or amend the previous value + * + * @return int The previous value + */ + public function traceAt($levels, $replace = false) + { + $prev = $this->tracedErrors; + $this->tracedErrors = (int) $levels; + if (!$replace) { + $this->tracedErrors |= $prev; + } + + return $prev; + } + + /** + * Sets the error levels where the @-operator is ignored. + * + * @param int $levels A bit field of E_* constants for screamed errors + * @param bool $replace Replace or amend the previous value + * + * @return int The previous value + */ + public function screamAt($levels, $replace = false) + { + $prev = $this->screamedErrors; + $this->screamedErrors = (int) $levels; + if (!$replace) { + $this->screamedErrors |= $prev; + } + + return $prev; + } + + /** + * Re-registers as a PHP error handler if levels changed. + */ + private function reRegister($prev) + { + if ($prev !== $this->thrownErrors | $this->loggedErrors) { + $handler = set_error_handler('var_dump'); + $handler = is_array($handler) ? $handler[0] : null; + restore_error_handler(); + if ($handler === $this) { + restore_error_handler(); + if ($this->isRoot) { + set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors); + } else { + set_error_handler(array($this, 'handleError')); + } + } + } + } + + /** + * Handles errors by filtering then logging them according to the configured bit fields. + * + * @param int $type One of the E_* constants + * @param string $message + * @param string $file + * @param int $line + * + * @return bool Returns false when no handling happens so that the PHP engine can handle the error itself + * + * @throws \ErrorException When $this->thrownErrors requests so + * + * @internal + */ + public function handleError($type, $message, $file, $line) + { + $level = error_reporting(); + $silenced = 0 === ($level & $type); + $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED; + $log = $this->loggedErrors & $type; + $throw = $this->thrownErrors & $type & $level; + $type &= $level | $this->screamedErrors; + + if (!$type || (!$log && !$throw)) { + return !$silenced && $type && $log; + } + $scope = $this->scopedErrors & $type; + + if (4 < $numArgs = func_num_args()) { + $context = $scope ? (func_get_arg(4) ?: array()) : array(); + $backtrace = 5 < $numArgs ? func_get_arg(5) : null; // defined on HHVM + } else { + $context = array(); + $backtrace = null; + } + + if (isset($context['GLOBALS']) && $scope) { + $e = $context; // Whatever the signature of the method, + unset($e['GLOBALS'], $context); // $context is always a reference in 5.3 + $context = $e; + } + + if (null !== $backtrace && $type & E_ERROR) { + // E_ERROR fatal errors are triggered on HHVM when + // hhvm.error_handling.call_user_handler_on_fatals=1 + // which is the way to get their backtrace. + $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace')); + + return true; + } + + if ($throw) { + if ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) { + // Checking for class existence is a work around for https://bugs.php.net/42098 + $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context); + } else { + $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line); + } + + if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) { + // Exceptions thrown from error handlers are sometimes not caught by the exception + // handler and shutdown handlers are bypassed before 5.4.8/5.3.18. + // We temporarily re-enable display_errors to prevent any blank page related to this bug. + + $throw->errorHandlerCanary = new ErrorHandlerCanary(); + } + + throw $throw; + } + + // For duplicated errors, log the trace only once + $e = md5("{$type}/{$line}/{$file}\x00{$message}", true); + $trace = true; + + if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) { + $trace = false; + } else { + $this->loggedTraces[$e] = 1; + } + + $e = compact('type', 'file', 'line', 'level'); + + if ($type & $level) { + if ($scope) { + $e['scope_vars'] = $context; + if ($trace) { + $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT); + } + } elseif ($trace) { + if (null === $backtrace) { + $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + } else { + foreach ($backtrace as &$frame) { + unset($frame['args'], $frame); + } + $e['stack'] = $backtrace; + } + } + } + + if ($this->isRecursive) { + $log = 0; + } elseif (self::$stackedErrorLevels) { + self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e); + } else { + try { + $this->isRecursive = true; + $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e); + $this->isRecursive = false; + } catch (\Exception $e) { + $this->isRecursive = false; + + throw $e; + } catch (\Throwable $e) { + $this->isRecursive = false; + + throw $e; + } + } + + return !$silenced && $type && $log; + } + + /** + * Handles an exception by logging then forwarding it to another handler. + * + * @param \Exception|\Throwable $exception An exception to handle + * @param array $error An array as returned by error_get_last() + * + * @internal + */ + public function handleException($exception, array $error = null) + { + if (null === $error) { + self::$exitCode = 255; + } + if (!$exception instanceof \Exception) { + $exception = new FatalThrowableError($exception); + } + $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR; + $handlerException = null; + + if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) { + $e = array( + 'type' => $type, + 'file' => $exception->getFile(), + 'line' => $exception->getLine(), + 'level' => error_reporting(), + 'stack' => $exception->getTrace(), + ); + if ($exception instanceof FatalErrorException) { + if ($exception instanceof FatalThrowableError) { + $error = array( + 'type' => $type, + 'message' => $message = $exception->getMessage(), + 'file' => $e['file'], + 'line' => $e['line'], + ); + } else { + $message = 'Fatal '.$exception->getMessage(); + } + } elseif ($exception instanceof \ErrorException) { + $message = 'Uncaught '.$exception->getMessage(); + if ($exception instanceof ContextErrorException) { + $e['context'] = $exception->getContext(); + } + } else { + $message = 'Uncaught Exception: '.$exception->getMessage(); + } + } + if ($this->loggedErrors & $type) { + try { + $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e); + } catch (\Exception $handlerException) { + } catch (\Throwable $handlerException) { + } + } + if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) { + foreach ($this->getFatalErrorHandlers() as $handler) { + if ($e = $handler->handleError($error, $exception)) { + $exception = $e; + break; + } + } + } + $exceptionHandler = $this->exceptionHandler; + $this->exceptionHandler = null; + try { + if (null !== $exceptionHandler) { + return \call_user_func($exceptionHandler, $exception); + } + $handlerException = $handlerException ?: $exception; + } catch (\Exception $handlerException) { + } catch (\Throwable $handlerException) { + } + if ($exception === $handlerException) { + self::$reservedMemory = null; // Disable the fatal error handler + throw $exception; // Give back $exception to the native handler + } + $this->handleException($handlerException); + } + + /** + * Shutdown registered function for handling PHP fatal errors. + * + * @param array $error An array as returned by error_get_last() + * + * @internal + */ + public static function handleFatalError(array $error = null) + { + if (null === self::$reservedMemory) { + return; + } + + $handler = self::$reservedMemory = null; + $handlers = array(); + $previousHandler = null; + $sameHandlerLimit = 10; + + while (!is_array($handler) || !$handler[0] instanceof self) { + $handler = set_exception_handler('var_dump'); + restore_exception_handler(); + + if (!$handler) { + break; + } + restore_exception_handler(); + + if ($handler !== $previousHandler) { + array_unshift($handlers, $handler); + $previousHandler = $handler; + } elseif (0 === --$sameHandlerLimit) { + $handler = null; + break; + } + } + foreach ($handlers as $h) { + set_exception_handler($h); + } + if (!$handler) { + return; + } + if ($handler !== $h) { + $handler[0]->setExceptionHandler($h); + } + $handler = $handler[0]; + $handlers = array(); + + if ($exit = null === $error) { + $error = error_get_last(); + } + + try { + while (self::$stackedErrorLevels) { + static::unstackErrors(); + } + } catch (\Exception $exception) { + // Handled below + } catch (\Throwable $exception) { + // Handled below + } + + if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) { + // Let's not throw anymore but keep logging + $handler->throwAt(0, true); + $trace = isset($error['backtrace']) ? $error['backtrace'] : null; + + if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) { + $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace); + } else { + $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace); + } + } + + try { + if (isset($exception)) { + self::$exitCode = 255; + $handler->handleException($exception, $error); + } + } catch (FatalErrorException $e) { + // Ignore this re-throw + } + + if ($exit && self::$exitCode) { + $exitCode = self::$exitCode; + register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); }); + } + } + + /** + * Configures the error handler for delayed handling. + * Ensures also that non-catchable fatal errors are never silenced. + * + * As shown by http://bugs.php.net/42098 and http://bugs.php.net/60724 + * PHP has a compile stage where it behaves unusually. To workaround it, + * we plug an error handler that only stacks errors for later. + * + * The most important feature of this is to prevent + * autoloading until unstackErrors() is called. + */ + public static function stackErrors() + { + self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR); + } + + /** + * Unstacks stacked errors and forwards to the logger. + */ + public static function unstackErrors() + { + $level = array_pop(self::$stackedErrorLevels); + + if (null !== $level) { + $e = error_reporting($level); + if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) { + // If the user changed the error level, do not overwrite it + error_reporting($e); + } + } + + if (empty(self::$stackedErrorLevels)) { + $errors = self::$stackedErrors; + self::$stackedErrors = array(); + + foreach ($errors as $e) { + $e[0]->log($e[1], $e[2], $e[3]); + } + } + } + + /** + * Gets the fatal error handlers. + * + * Override this method if you want to define more fatal error handlers. + * + * @return FatalErrorHandlerInterface[] An array of FatalErrorHandlerInterface + */ + protected function getFatalErrorHandlers() + { + return array( + new UndefinedFunctionFatalErrorHandler(), + new UndefinedMethodFatalErrorHandler(), + new ClassNotFoundFatalErrorHandler(), + ); + } + + /** + * Sets the level at which the conversion to Exception is done. + * + * @param int|null $level The level (null to use the error_reporting() value and 0 to disable) + * + * @deprecated since version 2.6, to be removed in 3.0. Use throwAt() instead. + */ + public function setLevel($level) + { + @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED); + + $level = null === $level ? error_reporting() : $level; + $this->throwAt($level, true); + } + + /** + * Sets the display_errors flag value. + * + * @param int $displayErrors The display_errors flag value + * + * @deprecated since version 2.6, to be removed in 3.0. Use throwAt() instead. + */ + public function setDisplayErrors($displayErrors) + { + @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED); + + if ($displayErrors) { + $this->throwAt($this->displayErrors, true); + } else { + $displayErrors = $this->displayErrors; + $this->throwAt(0, true); + $this->displayErrors = $displayErrors; + } + } + + /** + * Sets a logger for the given channel. + * + * @param LoggerInterface $logger A logger interface + * @param string $channel The channel associated with the logger (deprecation, emergency or scream) + * + * @deprecated since version 2.6, to be removed in 3.0. Use setLoggers() or setDefaultLogger() instead. + */ + public static function setLogger(LoggerInterface $logger, $channel = 'deprecation') + { + @trigger_error('The '.__METHOD__.' static method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED); + + $handler = set_error_handler('var_dump'); + $handler = is_array($handler) ? $handler[0] : null; + restore_error_handler(); + if (!$handler instanceof self) { + return; + } + if ('deprecation' === $channel) { + $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true); + $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED); + } elseif ('scream' === $channel) { + $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false); + $handler->screamAt(E_ALL | E_STRICT); + } elseif ('emergency' === $channel) { + $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true); + $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR); + } + } + + /** + * @deprecated since version 2.6, to be removed in 3.0. Use handleError() instead. + */ + public function handle($level, $message, $file = 'unknown', $line = 0, $context = array()) + { + $this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array()); + + return $this->handleError($level, $message, $file, $line, (array) $context); + } + + /** + * Handles PHP fatal errors. + * + * @deprecated since version 2.6, to be removed in 3.0. Use handleFatalError() instead. + */ + public function handleFatal() + { + @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED); + + static::handleFatalError(); + } +} + +/** + * Private class used to work around https://bugs.php.net/54275. + * + * @author Nicolas Grekas + * + * @internal + */ +class ErrorHandlerCanary +{ + private static $displayErrors = null; + + public function __construct() + { + if (null === self::$displayErrors) { + self::$displayErrors = ini_set('display_errors', 1); + } + } + + public function __destruct() + { + if (null !== self::$displayErrors) { + ini_set('display_errors', self::$displayErrors); + self::$displayErrors = null; + } + } +} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/ClassNotFoundException.php b/application/vendor/symfony/debug/Exception/ClassNotFoundException.php similarity index 100% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Exception/ClassNotFoundException.php rename to application/vendor/symfony/debug/Exception/ClassNotFoundException.php diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/ContextErrorException.php b/application/vendor/symfony/debug/Exception/ContextErrorException.php similarity index 100% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Exception/ContextErrorException.php rename to application/vendor/symfony/debug/Exception/ContextErrorException.php diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/DummyException.php b/application/vendor/symfony/debug/Exception/DummyException.php similarity index 75% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Exception/DummyException.php rename to application/vendor/symfony/debug/Exception/DummyException.php index 967e033..1b9082b 100644 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/DummyException.php +++ b/application/vendor/symfony/debug/Exception/DummyException.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Debug\Exception; +@trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + /** * @author Fabien Potencier * diff --git a/application/vendor/symfony/debug/Exception/FatalErrorException.php b/application/vendor/symfony/debug/Exception/FatalErrorException.php new file mode 100644 index 0000000..db2fb43 --- /dev/null +++ b/application/vendor/symfony/debug/Exception/FatalErrorException.php @@ -0,0 +1,99 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Exception; + +/** + * Fatal Error Exception. + * + * @author Fabien Potencier + * @author Konstanton Myakshin + * @author Nicolas Grekas + * + * @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead. + */ +class FatalErrorException extends \ErrorException +{ +} + +namespace Symfony\Component\Debug\Exception; + +use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException; + +/** + * Fatal Error Exception. + * + * @author Konstanton Myakshin + */ +class FatalErrorException extends LegacyFatalErrorException +{ + public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null) + { + parent::__construct($message, $code, $severity, $filename, $lineno); + + if (null !== $trace) { + if (!$traceArgs) { + foreach ($trace as &$frame) { + unset($frame['args'], $frame['this'], $frame); + } + } + + $this->setTrace($trace); + } elseif (null !== $traceOffset) { + if (function_exists('xdebug_get_function_stack')) { + $trace = xdebug_get_function_stack(); + if (0 < $traceOffset) { + array_splice($trace, -$traceOffset); + } + + foreach ($trace as &$frame) { + if (!isset($frame['type'])) { + // XDebug pre 2.1.1 doesn't currently set the call type key http://bugs.xdebug.org/view.php?id=695 + if (isset($frame['class'])) { + $frame['type'] = '::'; + } + } elseif ('dynamic' === $frame['type']) { + $frame['type'] = '->'; + } elseif ('static' === $frame['type']) { + $frame['type'] = '::'; + } + + // XDebug also has a different name for the parameters array + if (!$traceArgs) { + unset($frame['params'], $frame['args']); + } elseif (isset($frame['params']) && !isset($frame['args'])) { + $frame['args'] = $frame['params']; + unset($frame['params']); + } + } + + unset($frame); + $trace = array_reverse($trace); + } elseif (function_exists('symfony_debug_backtrace')) { + $trace = symfony_debug_backtrace(); + if (0 < $traceOffset) { + array_splice($trace, 0, $traceOffset); + } + } else { + $trace = array(); + } + + $this->setTrace($trace); + } + } + + protected function setTrace($trace) + { + $traceReflector = new \ReflectionProperty('Exception', 'trace'); + $traceReflector->setAccessible(true); + $traceReflector->setValue($this, $trace); + } +} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/FatalThrowableError.php b/application/vendor/symfony/debug/Exception/FatalThrowableError.php similarity index 91% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Exception/FatalThrowableError.php rename to application/vendor/symfony/debug/Exception/FatalThrowableError.php index 6ff5ecd..fafc922 100644 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/FatalThrowableError.php +++ b/application/vendor/symfony/debug/Exception/FatalThrowableError.php @@ -27,7 +27,7 @@ public function __construct(\Throwable $e) $message = 'Type error: '.$e->getMessage(); $severity = E_RECOVERABLE_ERROR; } else { - $message = 'Fatal error: '.$e->getMessage(); + $message = $e->getMessage(); $severity = E_ERROR; } @@ -36,7 +36,8 @@ public function __construct(\Throwable $e) $e->getCode(), $severity, $e->getFile(), - $e->getLine() + $e->getLine(), + $e->getPrevious() ); $this->setTrace($e->getTrace()); diff --git a/application/vendor/symfony/debug/Exception/FlattenException.php b/application/vendor/symfony/debug/Exception/FlattenException.php new file mode 100644 index 0000000..b3a98ac --- /dev/null +++ b/application/vendor/symfony/debug/Exception/FlattenException.php @@ -0,0 +1,297 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Exception; + +use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException; + +/** + * FlattenException wraps a PHP Exception to be able to serialize it. + * + * Basically, this class removes all objects from the trace. + * + * @author Fabien Potencier + * + * @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead. + */ +class FlattenException +{ + private $handler; + + public static function __callStatic($method, $args) + { + if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) { + throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_called_class(), $method)); + } + + return call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args); + } + + public function __call($method, $args) + { + if (!isset($this->handler)) { + $this->handler = new DebugFlattenException(); + } + + if (!method_exists($this->handler, $method)) { + throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method)); + } + + return call_user_func_array(array($this->handler, $method), $args); + } +} + +namespace Symfony\Component\Debug\Exception; + +use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException; +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; + +/** + * FlattenException wraps a PHP Exception to be able to serialize it. + * + * Basically, this class removes all objects from the trace. + * + * @author Fabien Potencier + */ +class FlattenException extends LegacyFlattenException +{ + private $message; + private $code; + private $previous; + private $trace; + private $class; + private $statusCode; + private $headers; + private $file; + private $line; + + public static function create(\Exception $exception, $statusCode = null, array $headers = array()) + { + $e = new static(); + $e->setMessage($exception->getMessage()); + $e->setCode($exception->getCode()); + + if ($exception instanceof HttpExceptionInterface) { + $statusCode = $exception->getStatusCode(); + $headers = array_merge($headers, $exception->getHeaders()); + } + + if (null === $statusCode) { + $statusCode = 500; + } + + $e->setStatusCode($statusCode); + $e->setHeaders($headers); + $e->setTraceFromException($exception); + $e->setClass(get_class($exception)); + $e->setFile($exception->getFile()); + $e->setLine($exception->getLine()); + + $previous = $exception->getPrevious(); + + if ($previous instanceof \Exception) { + $e->setPrevious(static::create($previous)); + } elseif ($previous instanceof \Throwable) { + $e->setPrevious(static::create(new FatalThrowableError($previous))); + } + + return $e; + } + + public function toArray() + { + $exceptions = array(); + foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) { + $exceptions[] = array( + 'message' => $exception->getMessage(), + 'class' => $exception->getClass(), + 'trace' => $exception->getTrace(), + ); + } + + return $exceptions; + } + + public function getStatusCode() + { + return $this->statusCode; + } + + public function setStatusCode($code) + { + $this->statusCode = $code; + } + + public function getHeaders() + { + return $this->headers; + } + + public function setHeaders(array $headers) + { + $this->headers = $headers; + } + + public function getClass() + { + return $this->class; + } + + public function setClass($class) + { + $this->class = $class; + } + + public function getFile() + { + return $this->file; + } + + public function setFile($file) + { + $this->file = $file; + } + + public function getLine() + { + return $this->line; + } + + public function setLine($line) + { + $this->line = $line; + } + + public function getMessage() + { + return $this->message; + } + + public function setMessage($message) + { + $this->message = $message; + } + + public function getCode() + { + return $this->code; + } + + public function setCode($code) + { + $this->code = $code; + } + + public function getPrevious() + { + return $this->previous; + } + + public function setPrevious(FlattenException $previous) + { + $this->previous = $previous; + } + + public function getAllPrevious() + { + $exceptions = array(); + $e = $this; + while ($e = $e->getPrevious()) { + $exceptions[] = $e; + } + + return $exceptions; + } + + public function getTrace() + { + return $this->trace; + } + + public function setTraceFromException(\Exception $exception) + { + $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine()); + } + + public function setTrace($trace, $file, $line) + { + $this->trace = array(); + $this->trace[] = array( + 'namespace' => '', + 'short_class' => '', + 'class' => '', + 'type' => '', + 'function' => '', + 'file' => $file, + 'line' => $line, + 'args' => array(), + ); + foreach ($trace as $entry) { + $class = ''; + $namespace = ''; + if (isset($entry['class'])) { + $parts = explode('\\', $entry['class']); + $class = array_pop($parts); + $namespace = implode('\\', $parts); + } + + $this->trace[] = array( + 'namespace' => $namespace, + 'short_class' => $class, + 'class' => isset($entry['class']) ? $entry['class'] : '', + 'type' => isset($entry['type']) ? $entry['type'] : '', + 'function' => isset($entry['function']) ? $entry['function'] : null, + 'file' => isset($entry['file']) ? $entry['file'] : null, + 'line' => isset($entry['line']) ? $entry['line'] : null, + 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(), + ); + } + } + + private function flattenArgs($args, $level = 0, &$count = 0) + { + $result = array(); + foreach ($args as $key => $value) { + if (++$count > 1e4) { + return array('array', '*SKIPPED over 10000 entries*'); + } + if ($value instanceof \__PHP_Incomplete_Class) { + // is_object() returns false on PHP<=7.1 + $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value)); + } elseif (is_object($value)) { + $result[$key] = array('object', get_class($value)); + } elseif (is_array($value)) { + if ($level > 10) { + $result[$key] = array('array', '*DEEP NESTED ARRAY*'); + } else { + $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count)); + } + } elseif (null === $value) { + $result[$key] = array('null', null); + } elseif (is_bool($value)) { + $result[$key] = array('boolean', $value); + } elseif (is_resource($value)) { + $result[$key] = array('resource', get_resource_type($value)); + } else { + $result[$key] = array('string', (string) $value); + } + } + + return $result; + } + + private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value) + { + $array = new \ArrayObject($value); + + return $array['__PHP_Incomplete_Class_Name']; + } +} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/OutOfMemoryException.php b/application/vendor/symfony/debug/Exception/OutOfMemoryException.php similarity index 100% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Exception/OutOfMemoryException.php rename to application/vendor/symfony/debug/Exception/OutOfMemoryException.php diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/UndefinedFunctionException.php b/application/vendor/symfony/debug/Exception/UndefinedFunctionException.php similarity index 100% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Exception/UndefinedFunctionException.php rename to application/vendor/symfony/debug/Exception/UndefinedFunctionException.php diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/UndefinedMethodException.php b/application/vendor/symfony/debug/Exception/UndefinedMethodException.php similarity index 100% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Exception/UndefinedMethodException.php rename to application/vendor/symfony/debug/Exception/UndefinedMethodException.php diff --git a/application/vendor/symfony/debug/ExceptionHandler.php b/application/vendor/symfony/debug/ExceptionHandler.php new file mode 100644 index 0000000..472073c --- /dev/null +++ b/application/vendor/symfony/debug/ExceptionHandler.php @@ -0,0 +1,467 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Debug; + +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Debug\Exception\FlattenException; +use Symfony\Component\Debug\Exception\OutOfMemoryException; + +/** + * ExceptionHandler converts an exception to a Response object. + * + * It is mostly useful in debug mode to replace the default PHP/XDebug + * output with something prettier and more useful. + * + * As this class is mainly used during Kernel boot, where nothing is yet + * available, the Response content is always HTML. + * + * @author Fabien Potencier + * @author Nicolas Grekas + */ +class ExceptionHandler +{ + private $debug; + private $charset; + private $handler; + private $caughtBuffer; + private $caughtLength; + private $fileLinkFormat; + + public function __construct($debug = true, $charset = null, $fileLinkFormat = null) + { + if (false !== strpos($charset, '%')) { + // Swap $charset and $fileLinkFormat for BC reasons + $pivot = $fileLinkFormat; + $fileLinkFormat = $charset; + $charset = $pivot; + } + $this->debug = $debug; + $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8'; + $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); + } + + /** + * Registers the exception handler. + * + * @param bool $debug Enable/disable debug mode, where the stack trace is displayed + * @param string|null $charset The charset used by exception messages + * @param string|null $fileLinkFormat The IDE link template + * + * @return static + */ + public static function register($debug = true, $charset = null, $fileLinkFormat = null) + { + $handler = new static($debug, $charset, $fileLinkFormat); + + $prev = set_exception_handler(array($handler, 'handle')); + if (is_array($prev) && $prev[0] instanceof ErrorHandler) { + restore_exception_handler(); + $prev[0]->setExceptionHandler(array($handler, 'handle')); + } + + return $handler; + } + + /** + * Sets a user exception handler. + * + * @param callable $handler An handler that will be called on Exception + * + * @return callable|null The previous exception handler if any + */ + public function setHandler($handler) + { + if (null !== $handler && !is_callable($handler)) { + throw new \LogicException('The exception handler must be a valid PHP callable.'); + } + $old = $this->handler; + $this->handler = $handler; + + return $old; + } + + /** + * Sets the format for links to source files. + * + * @param string $format The format for links to source files + * + * @return string The previous file link format + */ + public function setFileLinkFormat($format) + { + $old = $this->fileLinkFormat; + $this->fileLinkFormat = $format; + + return $old; + } + + /** + * Sends a response for the given Exception. + * + * To be as fail-safe as possible, the exception is first handled + * by our simple exception handler, then by the user exception handler. + * The latter takes precedence and any output from the former is cancelled, + * if and only if nothing bad happens in this handling path. + */ + public function handle(\Exception $exception) + { + if (null === $this->handler || $exception instanceof OutOfMemoryException) { + $this->failSafeHandle($exception); + + return; + } + + $caughtLength = $this->caughtLength = 0; + + ob_start(array($this, 'catchOutput')); + $this->failSafeHandle($exception); + while (null === $this->caughtBuffer && ob_end_flush()) { + // Empty loop, everything is in the condition + } + if (isset($this->caughtBuffer[0])) { + ob_start(array($this, 'cleanOutput')); + echo $this->caughtBuffer; + $caughtLength = ob_get_length(); + } + $this->caughtBuffer = null; + + try { + call_user_func($this->handler, $exception); + $this->caughtLength = $caughtLength; + } catch (\Exception $e) { + if (!$caughtLength) { + // All handlers failed. Let PHP handle that now. + throw $exception; + } + } + } + + /** + * Sends a response for the given Exception. + * + * If you have the Symfony HttpFoundation component installed, + * this method will use it to create and send the response. If not, + * it will fallback to plain PHP functions. + */ + private function failSafeHandle(\Exception $exception) + { + if (class_exists('Symfony\Component\HttpFoundation\Response', false) + && __CLASS__ !== get_class($this) + && ($reflector = new \ReflectionMethod($this, 'createResponse')) + && __CLASS__ !== $reflector->class + ) { + $response = $this->createResponse($exception); + $response->sendHeaders(); + $response->sendContent(); + + return; + } + + $this->sendPhpResponse($exception); + } + + /** + * Sends the error associated with the given Exception as a plain PHP response. + * + * This method uses plain PHP functions like header() and echo to output + * the response. + * + * @param \Exception|FlattenException $exception An \Exception instance + */ + public function sendPhpResponse($exception) + { + if (!$exception instanceof FlattenException) { + $exception = FlattenException::create($exception); + } + + if (!headers_sent()) { + header(sprintf('HTTP/1.0 %s', $exception->getStatusCode())); + foreach ($exception->getHeaders() as $name => $value) { + header($name.': '.$value, false); + } + header('Content-Type: text/html; charset='.$this->charset); + } + + echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception)); + } + + /** + * Creates the error Response associated with the given Exception. + * + * @param \Exception|FlattenException $exception An \Exception instance + * + * @return Response A Response instance + */ + public function createResponse($exception) + { + if (!$exception instanceof FlattenException) { + $exception = FlattenException::create($exception); + } + + return Response::create($this->decorate($this->getContent($exception), $this->getStylesheet($exception)), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset); + } + + /** + * Gets the HTML content associated with the given exception. + * + * @return string The content as a string + */ + public function getContent(FlattenException $exception) + { + switch ($exception->getStatusCode()) { + case 404: + $title = 'Sorry, the page you are looking for could not be found.'; + break; + default: + $title = 'Whoops, looks like something went wrong.'; + } + + $content = ''; + if ($this->debug) { + try { + $count = count($exception->getAllPrevious()); + $total = $count + 1; + foreach ($exception->toArray() as $position => $e) { + $ind = $count - $position + 1; + $class = $this->formatClass($e['class']); + $message = nl2br($this->escapeHtml($e['message'])); + $content .= sprintf(<<<'EOF' +

    + %d/%d + %s%s: + %s +

    +
    +
      + +EOF + , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message); + foreach ($e['trace'] as $trace) { + $content .= '
    1. '; + if ($trace['function']) { + $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args'])); + } + if (isset($trace['file']) && isset($trace['line'])) { + $content .= $this->formatPath($trace['file'], $trace['line']); + } + $content .= "
    2. \n"; + } + + $content .= "
    \n
    \n"; + } + } catch (\Exception $e) { + // something nasty happened and we cannot throw an exception anymore + if ($this->debug) { + $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage())); + } else { + $title = 'Whoops, looks like something went wrong.'; + } + } + } + + return << +

    $title

    + $content + +EOF; + } + + /** + * Gets the stylesheet associated with the given exception. + * + * @return string The stylesheet as a string + */ + public function getStylesheet(FlattenException $exception) + { + return <<<'EOF' + .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 } + .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; } + .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; } + .sf-reset .clear_fix { display:inline-block; } + .sf-reset * html .clear_fix { height:1%; } + .sf-reset .clear_fix { display:block; } + .sf-reset, .sf-reset .block { margin: auto } + .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; } + .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px } + .sf-reset strong { font-weight:bold; } + .sf-reset a { color:#6c6159; cursor: default; } + .sf-reset a img { border:none; } + .sf-reset a:hover { text-decoration:underline; } + .sf-reset em { font-style:italic; } + .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif } + .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; } + .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; } + .sf-reset .exception_message { margin-left: 3em; display: block; } + .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; } + .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px; + -webkit-border-bottom-right-radius: 16px; + -webkit-border-bottom-left-radius: 16px; + -moz-border-radius-bottomright: 16px; + -moz-border-radius-bottomleft: 16px; + border-bottom-right-radius: 16px; + border-bottom-left-radius: 16px; + border-bottom:1px solid #ccc; + border-right:1px solid #ccc; + border-left:1px solid #ccc; + word-wrap: break-word; + } + .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px; + -webkit-border-top-left-radius: 16px; + -webkit-border-top-right-radius: 16px; + -moz-border-radius-topleft: 16px; + -moz-border-radius-topright: 16px; + border-top-left-radius: 16px; + border-top-right-radius: 16px; + border-top:1px solid #ccc; + border-right:1px solid #ccc; + border-left:1px solid #ccc; + overflow: hidden; + word-wrap: break-word; + } + .sf-reset a { background:none; color:#868686; text-decoration:none; } + .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; } + .sf-reset ol { padding: 10px 0; } + .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + border: 1px solid #ccc; + } +EOF; + } + + private function decorate($content, $css) + { + return << + + + + + + + + $content + + +EOF; + } + + private function formatClass($class) + { + $parts = explode('\\', $class); + + return sprintf('%s', $class, array_pop($parts)); + } + + private function formatPath($path, $line) + { + $path = $this->escapeHtml($path); + $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path; + + if ($linkFormat = $this->fileLinkFormat) { + $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line)); + + return sprintf(' in %s line %d', $link, $file, $line); + } + + return sprintf(' in %s line %d', $path, $file, $line); + } + + /** + * Formats an array as a string. + * + * @param array $args The argument array + * + * @return string + */ + private function formatArgs(array $args) + { + $result = array(); + foreach ($args as $key => $item) { + if ('object' === $item[0]) { + $formattedValue = sprintf('object(%s)', $this->formatClass($item[1])); + } elseif ('array' === $item[0]) { + $formattedValue = sprintf('array(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); + } elseif ('string' === $item[0]) { + $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1])); + } elseif ('null' === $item[0]) { + $formattedValue = 'null'; + } elseif ('boolean' === $item[0]) { + $formattedValue = ''.strtolower(var_export($item[1], true)).''; + } elseif ('resource' === $item[0]) { + $formattedValue = 'resource'; + } else { + $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true)); + } + + $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue); + } + + return implode(', ', $result); + } + + /** + * Returns an UTF-8 and HTML encoded string. + * + * @deprecated since version 2.7, to be removed in 3.0. + */ + protected static function utf8Htmlize($str) + { + @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0.', E_USER_DEPRECATED); + + return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8'); + } + + /** + * HTML-encodes a string. + */ + private function escapeHtml($str) + { + return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset); + } + + /** + * @internal + */ + public function catchOutput($buffer) + { + $this->caughtBuffer = $buffer; + + return ''; + } + + /** + * @internal + */ + public function cleanOutput($buffer) + { + if ($this->caughtLength) { + // use substr_replace() instead of substr() for mbstring overloading resistance + $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength); + if (isset($cleanBuffer[0])) { + $buffer = $cleanBuffer; + } + } + + return $buffer; + } +} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php b/application/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php similarity index 99% rename from application/vendor/symfony/debug/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php rename to application/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php index abfe90d..612bfca 100644 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php +++ b/application/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php @@ -179,7 +179,7 @@ private function convertFileToClass($path, $file, $prefix) ); if ($prefix) { - $candidates = array_filter($candidates, function ($candidate) use ($prefix) {return 0 === strpos($candidate, $prefix);}); + $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); }); } // We cannot use the autoloader here as most of them use require; but if the class diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/FatalErrorHandler/FatalErrorHandlerInterface.php b/application/vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php similarity index 100% rename from application/vendor/symfony/debug/Symfony/Component/Debug/FatalErrorHandler/FatalErrorHandlerInterface.php rename to application/vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php b/application/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php similarity index 100% rename from application/vendor/symfony/debug/Symfony/Component/Debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php rename to application/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php b/application/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php similarity index 77% rename from application/vendor/symfony/debug/Symfony/Component/Debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php rename to application/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php index 917794c..6fa62b6 100644 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php +++ b/application/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php @@ -34,10 +34,15 @@ public function handleError(array $error, FatalErrorException $exception) $className = $matches[1]; $methodName = $matches[2]; - $message = sprintf('Attempted to call method "%s" on class "%s".', $methodName, $className); + $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className); + + if (!class_exists($className) || null === $methods = get_class_methods($className)) { + // failed to get the class or its methods on which an unknown method was called (for example on an anonymous class) + return new UndefinedMethodException($message, $exception); + } $candidates = array(); - foreach (get_class_methods($className) as $definedMethodName) { + foreach ($methods as $definedMethodName) { $lev = levenshtein($methodName, $definedMethodName); if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) { $candidates[] = $definedMethodName; @@ -52,6 +57,7 @@ public function handleError(array $error, FatalErrorException $exception) } else { $candidates = '"'.$last; } + $message .= "\nDid you mean to call ".$candidates; } diff --git a/application/vendor/symfony/debug/LICENSE b/application/vendor/symfony/debug/LICENSE new file mode 100644 index 0000000..21d7fb9 --- /dev/null +++ b/application/vendor/symfony/debug/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2018 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/application/vendor/symfony/debug/README.md b/application/vendor/symfony/debug/README.md new file mode 100644 index 0000000..a1d1617 --- /dev/null +++ b/application/vendor/symfony/debug/README.md @@ -0,0 +1,13 @@ +Debug Component +=============== + +The Debug component provides tools to ease debugging PHP code. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/debug/index.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/application/vendor/symfony/debug/Resources/ext/README.md b/application/vendor/symfony/debug/Resources/ext/README.md new file mode 100644 index 0000000..25dccf0 --- /dev/null +++ b/application/vendor/symfony/debug/Resources/ext/README.md @@ -0,0 +1,134 @@ +Symfony Debug Extension for PHP 5 +================================= + +This extension publishes several functions to help building powerful debugging tools. +It is compatible with PHP 5.3, 5.4, 5.5 and 5.6; with ZTS and non-ZTS modes. +It is not required thus not provided for PHP 7. + +symfony_zval_info() +------------------- + +- exposes zval_hash/refcounts, allowing e.g. efficient exploration of arbitrary structures in PHP, +- does work with references, preventing memory copying. + +Its behavior is about the same as: + +```php + gettype($array[$key]), + 'zval_hash' => /* hashed memory address of $array[$key] */, + 'zval_refcount' => /* internal zval refcount of $array[$key] */, + 'zval_isref' => /* is_ref status of $array[$key] */, + ); + + switch ($info['type']) { + case 'object': + $info += array( + 'object_class' => get_class($array[$key]), + 'object_refcount' => /* internal object refcount of $array[$key] */, + 'object_hash' => spl_object_hash($array[$key]), + 'object_handle' => /* internal object handle $array[$key] */, + ); + break; + + case 'resource': + $info += array( + 'resource_handle' => (int) $array[$key], + 'resource_type' => get_resource_type($array[$key]), + 'resource_refcount' => /* internal resource refcount of $array[$key] */, + ); + break; + + case 'array': + $info += array( + 'array_count' => count($array[$key]), + ); + break; + + case 'string': + $info += array( + 'strlen' => strlen($array[$key]), + ); + break; + } + + return $info; +} +``` + +symfony_debug_backtrace() +------------------------- + +This function works like debug_backtrace(), except that it can fetch the full backtrace in case of fatal errors: + +```php +function foo() { fatal(); } +function bar() { foo(); } + +function sd() { var_dump(symfony_debug_backtrace()); } + +register_shutdown_function('sd'); + +bar(); + +/* Will output +Fatal error: Call to undefined function fatal() in foo.php on line 42 +array(3) { + [0]=> + array(2) { + ["function"]=> + string(2) "sd" + ["args"]=> + array(0) { + } + } + [1]=> + array(4) { + ["file"]=> + string(7) "foo.php" + ["line"]=> + int(1) + ["function"]=> + string(3) "foo" + ["args"]=> + array(0) { + } + } + [2]=> + array(4) { + ["file"]=> + string(102) "foo.php" + ["line"]=> + int(2) + ["function"]=> + string(3) "bar" + ["args"]=> + array(0) { + } + } +} +*/ +``` + +Usage +----- + +To enable the extension from source, run: + +``` + phpize + ./configure + make + sudo make install +``` diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/config.m4 b/application/vendor/symfony/debug/Resources/ext/config.m4 similarity index 100% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/config.m4 rename to application/vendor/symfony/debug/Resources/ext/config.m4 diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/config.w32 b/application/vendor/symfony/debug/Resources/ext/config.w32 similarity index 100% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/config.w32 rename to application/vendor/symfony/debug/Resources/ext/config.w32 diff --git a/application/vendor/symfony/debug/Resources/ext/php_symfony_debug.h b/application/vendor/symfony/debug/Resources/ext/php_symfony_debug.h new file mode 100644 index 0000000..26d0e8c --- /dev/null +++ b/application/vendor/symfony/debug/Resources/ext/php_symfony_debug.h @@ -0,0 +1,60 @@ +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#ifndef PHP_SYMFONY_DEBUG_H +#define PHP_SYMFONY_DEBUG_H + +extern zend_module_entry symfony_debug_module_entry; +#define phpext_symfony_debug_ptr &symfony_debug_module_entry + +#define PHP_SYMFONY_DEBUG_VERSION "2.7" + +#ifdef PHP_WIN32 +# define PHP_SYMFONY_DEBUG_API __declspec(dllexport) +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define PHP_SYMFONY_DEBUG_API __attribute__ ((visibility("default"))) +#else +# define PHP_SYMFONY_DEBUG_API +#endif + +#ifdef ZTS +#include "TSRM.h" +#endif + +ZEND_BEGIN_MODULE_GLOBALS(symfony_debug) + intptr_t req_rand_init; + void (*old_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); + zval *debug_bt; +ZEND_END_MODULE_GLOBALS(symfony_debug) + +PHP_MINIT_FUNCTION(symfony_debug); +PHP_MSHUTDOWN_FUNCTION(symfony_debug); +PHP_RINIT_FUNCTION(symfony_debug); +PHP_RSHUTDOWN_FUNCTION(symfony_debug); +PHP_MINFO_FUNCTION(symfony_debug); +PHP_GINIT_FUNCTION(symfony_debug); +PHP_GSHUTDOWN_FUNCTION(symfony_debug); + +PHP_FUNCTION(symfony_zval_info); +PHP_FUNCTION(symfony_debug_backtrace); + +static char *_symfony_debug_memory_address_hash(void * TSRMLS_DC); +static const char *_symfony_debug_zval_type(zval *); +static const char* _symfony_debug_get_resource_type(long TSRMLS_DC); +static int _symfony_debug_get_resource_refcount(long TSRMLS_DC); + +void symfony_debug_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); + +#ifdef ZTS +#define SYMFONY_DEBUG_G(v) TSRMG(symfony_debug_globals_id, zend_symfony_debug_globals *, v) +#else +#define SYMFONY_DEBUG_G(v) (symfony_debug_globals.v) +#endif + +#endif /* PHP_SYMFONY_DEBUG_H */ diff --git a/application/vendor/symfony/debug/Resources/ext/symfony_debug.c b/application/vendor/symfony/debug/Resources/ext/symfony_debug.c new file mode 100644 index 0000000..0d7cb60 --- /dev/null +++ b/application/vendor/symfony/debug/Resources/ext/symfony_debug.c @@ -0,0 +1,283 @@ +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "php.h" +#ifdef ZTS +#include "TSRM.h" +#endif +#include "php_ini.h" +#include "ext/standard/info.h" +#include "php_symfony_debug.h" +#include "ext/standard/php_rand.h" +#include "ext/standard/php_lcg.h" +#include "ext/spl/php_spl.h" +#include "Zend/zend_gc.h" +#include "Zend/zend_builtin_functions.h" +#include "Zend/zend_extensions.h" /* for ZEND_EXTENSION_API_NO */ +#include "ext/standard/php_array.h" +#include "Zend/zend_interfaces.h" +#include "SAPI.h" + +#define IS_PHP_53 ZEND_EXTENSION_API_NO == 220090626 + +ZEND_DECLARE_MODULE_GLOBALS(symfony_debug) + +ZEND_BEGIN_ARG_INFO_EX(symfony_zval_arginfo, 0, 0, 2) + ZEND_ARG_INFO(0, key) + ZEND_ARG_ARRAY_INFO(0, array, 0) + ZEND_ARG_INFO(0, options) +ZEND_END_ARG_INFO() + +const zend_function_entry symfony_debug_functions[] = { + PHP_FE(symfony_zval_info, symfony_zval_arginfo) + PHP_FE(symfony_debug_backtrace, NULL) + PHP_FE_END +}; + +PHP_FUNCTION(symfony_debug_backtrace) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } +#if IS_PHP_53 + zend_fetch_debug_backtrace(return_value, 1, 0 TSRMLS_CC); +#else + zend_fetch_debug_backtrace(return_value, 1, 0, 0 TSRMLS_CC); +#endif + + if (!SYMFONY_DEBUG_G(debug_bt)) { + return; + } + + php_array_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_P(SYMFONY_DEBUG_G(debug_bt)), 0 TSRMLS_CC); +} + +PHP_FUNCTION(symfony_zval_info) +{ + zval *key = NULL, *arg = NULL; + zval **data = NULL; + HashTable *array = NULL; + long options = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zh|l", &key, &array, &options) == FAILURE) { + return; + } + + switch (Z_TYPE_P(key)) { + case IS_STRING: + if (zend_symtable_find(array, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&data) == FAILURE) { + return; + } + break; + case IS_LONG: + if (zend_hash_index_find(array, Z_LVAL_P(key), (void **)&data)) { + return; + } + break; + } + + arg = *data; + + array_init(return_value); + + add_assoc_string(return_value, "type", (char *)_symfony_debug_zval_type(arg), 1); + add_assoc_stringl(return_value, "zval_hash", _symfony_debug_memory_address_hash((void *)arg TSRMLS_CC), 16, 0); + add_assoc_long(return_value, "zval_refcount", Z_REFCOUNT_P(arg)); + add_assoc_bool(return_value, "zval_isref", (zend_bool)Z_ISREF_P(arg)); + + if (Z_TYPE_P(arg) == IS_OBJECT) { + char hash[33] = {0}; + + php_spl_object_hash(arg, (char *)hash TSRMLS_CC); + add_assoc_stringl(return_value, "object_class", (char *)Z_OBJCE_P(arg)->name, Z_OBJCE_P(arg)->name_length, 1); + add_assoc_long(return_value, "object_refcount", EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(arg)].bucket.obj.refcount); + add_assoc_string(return_value, "object_hash", hash, 1); + add_assoc_long(return_value, "object_handle", Z_OBJ_HANDLE_P(arg)); + } else if (Z_TYPE_P(arg) == IS_ARRAY) { + add_assoc_long(return_value, "array_count", zend_hash_num_elements(Z_ARRVAL_P(arg))); + } else if(Z_TYPE_P(arg) == IS_RESOURCE) { + add_assoc_long(return_value, "resource_handle", Z_LVAL_P(arg)); + add_assoc_string(return_value, "resource_type", (char *)_symfony_debug_get_resource_type(Z_LVAL_P(arg) TSRMLS_CC), 1); + add_assoc_long(return_value, "resource_refcount", _symfony_debug_get_resource_refcount(Z_LVAL_P(arg) TSRMLS_CC)); + } else if (Z_TYPE_P(arg) == IS_STRING) { + add_assoc_long(return_value, "strlen", Z_STRLEN_P(arg)); + } +} + +void symfony_debug_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) +{ + TSRMLS_FETCH(); + zval *retval; + + switch (type) { + case E_ERROR: + case E_PARSE: + case E_CORE_ERROR: + case E_CORE_WARNING: + case E_COMPILE_ERROR: + case E_COMPILE_WARNING: + ALLOC_INIT_ZVAL(retval); +#if IS_PHP_53 + zend_fetch_debug_backtrace(retval, 1, 0 TSRMLS_CC); +#else + zend_fetch_debug_backtrace(retval, 1, 0, 0 TSRMLS_CC); +#endif + SYMFONY_DEBUG_G(debug_bt) = retval; + } + + SYMFONY_DEBUG_G(old_error_cb)(type, error_filename, error_lineno, format, args); +} + +static const char* _symfony_debug_get_resource_type(long rsid TSRMLS_DC) +{ + const char *res_type; + res_type = zend_rsrc_list_get_rsrc_type(rsid TSRMLS_CC); + + if (!res_type) { + return "Unknown"; + } + + return res_type; +} + +static int _symfony_debug_get_resource_refcount(long rsid TSRMLS_DC) +{ + zend_rsrc_list_entry *le; + + if (zend_hash_index_find(&EG(regular_list), rsid, (void **) &le)==SUCCESS) { + return le->refcount; + } + + return 0; +} + +static char *_symfony_debug_memory_address_hash(void *address TSRMLS_DC) +{ + char *result = NULL; + intptr_t address_rand; + + if (!SYMFONY_DEBUG_G(req_rand_init)) { + if (!BG(mt_rand_is_seeded)) { + php_mt_srand(GENERATE_SEED() TSRMLS_CC); + } + SYMFONY_DEBUG_G(req_rand_init) = (intptr_t)php_mt_rand(TSRMLS_C); + } + + address_rand = (intptr_t)address ^ SYMFONY_DEBUG_G(req_rand_init); + + spprintf(&result, 17, "%016zx", address_rand); + + return result; +} + +static const char *_symfony_debug_zval_type(zval *zv) +{ + switch (Z_TYPE_P(zv)) { + case IS_NULL: + return "NULL"; + break; + + case IS_BOOL: + return "boolean"; + break; + + case IS_LONG: + return "integer"; + break; + + case IS_DOUBLE: + return "double"; + break; + + case IS_STRING: + return "string"; + break; + + case IS_ARRAY: + return "array"; + break; + + case IS_OBJECT: + return "object"; + + case IS_RESOURCE: + return "resource"; + + default: + return "unknown type"; + } +} + +zend_module_entry symfony_debug_module_entry = { + STANDARD_MODULE_HEADER, + "symfony_debug", + symfony_debug_functions, + PHP_MINIT(symfony_debug), + PHP_MSHUTDOWN(symfony_debug), + PHP_RINIT(symfony_debug), + PHP_RSHUTDOWN(symfony_debug), + PHP_MINFO(symfony_debug), + PHP_SYMFONY_DEBUG_VERSION, + PHP_MODULE_GLOBALS(symfony_debug), + PHP_GINIT(symfony_debug), + PHP_GSHUTDOWN(symfony_debug), + NULL, + STANDARD_MODULE_PROPERTIES_EX +}; + +#ifdef COMPILE_DL_SYMFONY_DEBUG +ZEND_GET_MODULE(symfony_debug) +#endif + +PHP_GINIT_FUNCTION(symfony_debug) +{ + memset(symfony_debug_globals, 0 , sizeof(*symfony_debug_globals)); +} + +PHP_GSHUTDOWN_FUNCTION(symfony_debug) +{ + +} + +PHP_MINIT_FUNCTION(symfony_debug) +{ + SYMFONY_DEBUG_G(old_error_cb) = zend_error_cb; + zend_error_cb = symfony_debug_error_cb; + + return SUCCESS; +} + +PHP_MSHUTDOWN_FUNCTION(symfony_debug) +{ + zend_error_cb = SYMFONY_DEBUG_G(old_error_cb); + + return SUCCESS; +} + +PHP_RINIT_FUNCTION(symfony_debug) +{ + return SUCCESS; +} + +PHP_RSHUTDOWN_FUNCTION(symfony_debug) +{ + return SUCCESS; +} + +PHP_MINFO_FUNCTION(symfony_debug) +{ + php_info_print_table_start(); + php_info_print_table_header(2, "Symfony Debug support", "enabled"); + php_info_print_table_header(2, "Symfony Debug version", PHP_SYMFONY_DEBUG_VERSION); + php_info_print_table_end(); +} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/tests/001.phpt b/application/vendor/symfony/debug/Resources/ext/tests/001.phpt similarity index 86% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/tests/001.phpt rename to application/vendor/symfony/debug/Resources/ext/tests/001.phpt index 30b25a2..4a87cd3 100644 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/tests/001.phpt +++ b/application/vendor/symfony/debug/Resources/ext/tests/001.phpt @@ -1,14 +1,16 @@ --TEST-- Test symfony_zval_info API --SKIPIF-- - + --FILE-- - $int, - 'float' => $float, - 'str' => $str, - 'object' => $object, - 'array' => $array, - 'resource' => $resource, - 'null' => $null, - 'bool' => $bool, - 'refcount' => &$refcount2); +$var = array( + 'int' => $int, + 'float' => $float, + 'str' => $str, + 'object' => $object, + 'array' => $array, + 'resource' => $resource, + 'null' => $null, + 'bool' => $bool, + 'refcount' => &$refcount2, +); var_dump(symfony_zval_info('int', $var)); var_dump(symfony_zval_info('float', $var)); @@ -88,7 +92,7 @@ array(8) { ["object_hash"]=> string(32) "%s" ["object_handle"]=> - int(1) + int(%d) } array(5) { ["type"]=> @@ -112,7 +116,7 @@ array(7) { ["zval_isref"]=> bool(false) ["resource_handle"]=> - int(4) + int(%d) ["resource_type"]=> string(6) "stream" ["resource_refcount"]=> diff --git a/application/vendor/symfony/debug/Resources/ext/tests/002.phpt b/application/vendor/symfony/debug/Resources/ext/tests/002.phpt new file mode 100644 index 0000000..afc7bb4 --- /dev/null +++ b/application/vendor/symfony/debug/Resources/ext/tests/002.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test symfony_debug_backtrace in case of fatal error +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Call to undefined function notexist() in %s on line %d +Array +( + [0] => Array + ( + [function] => bt + [args] => Array + ( + ) + + ) + + [1] => Array + ( + [file] => %s + [line] => %d + [function] => foo + [args] => Array + ( + ) + + ) + + [2] => Array + ( + [file] => %s + [line] => %d + [function] => bar + [args] => Array + ( + ) + + ) + +) diff --git a/application/vendor/symfony/debug/Resources/ext/tests/002_1.phpt b/application/vendor/symfony/debug/Resources/ext/tests/002_1.phpt new file mode 100644 index 0000000..86de3e1 --- /dev/null +++ b/application/vendor/symfony/debug/Resources/ext/tests/002_1.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test symfony_debug_backtrace in case of non fatal error +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Array +( + [0] => Array + ( + [file] => %s + [line] => %d + [function] => bt + [args] => Array + ( + ) + + ) + + [1] => Array + ( + [file] => %s + [line] => %d + [function] => bar + [args] => Array + ( + ) + + ) + +) diff --git a/application/vendor/symfony/debug/Resources/ext/tests/003.phpt b/application/vendor/symfony/debug/Resources/ext/tests/003.phpt new file mode 100644 index 0000000..ce3c4e0 --- /dev/null +++ b/application/vendor/symfony/debug/Resources/ext/tests/003.phpt @@ -0,0 +1,87 @@ +--TEST-- +Test ErrorHandler in case of fatal error +--SKIPIF-- + +--FILE-- +setExceptionHandler('print_r'); + +if (function_exists('xdebug_disable')) { + xdebug_disable(); +} + +bar(); +?> +--EXPECTF-- +Fatal error: Call to undefined function Symfony\Component\Debug\notexist() in %s on line %d +Symfony\Component\Debug\Exception\UndefinedFunctionException Object +( + [message:protected] => Attempted to call function "notexist" from namespace "Symfony\Component\Debug". + [string:Exception:private] => + [code:protected] => 0 + [file:protected] => %s + [line:protected] => %d + [trace:Exception:private] => Array + ( + [0] => Array + ( +%A [function] => Symfony\Component\Debug\foo +%A [args] => Array + ( + ) + + ) + + [1] => Array + ( +%A [function] => Symfony\Component\Debug\bar +%A [args] => Array + ( + ) + + ) +%A + ) + + [previous:Exception:private] => + [severity:protected] => 1 +) diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/CHANGELOG.md b/application/vendor/symfony/debug/Symfony/Component/Debug/CHANGELOG.md deleted file mode 100644 index ff7c6af..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/CHANGELOG.md +++ /dev/null @@ -1,27 +0,0 @@ -CHANGELOG -========= - -2.6.0 ------ - -* generalized ErrorHandler and ExceptionHandler, - with some new methods and others deprecated -* enhanced error messages for uncaught exceptions - -2.5.0 ------ - -* added ExceptionHandler::setHandler() -* added UndefinedMethodFatalErrorHandler -* deprecated DummyException - -2.4.0 ------ - - * added a DebugClassLoader able to wrap any autoloader providing a findFile method - * improved error messages for not found classes and functions - -2.3.0 ------ - - * added the component diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/DebugClassLoader.php b/application/vendor/symfony/debug/Symfony/Component/Debug/DebugClassLoader.php deleted file mode 100644 index a82f101..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/DebugClassLoader.php +++ /dev/null @@ -1,224 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug; - -/** - * Autoloader checking if the class is really defined in the file found. - * - * The ClassLoader will wrap all registered autoloaders - * and will throw an exception if a file is found but does - * not declare the class. - * - * @author Fabien Potencier - * @author Christophe Coevoet - * @author Nicolas Grekas - * - * @api - */ -class DebugClassLoader -{ - private $classLoader; - private $isFinder; - private $wasFinder; - private static $caseCheck; - - /** - * Constructor. - * - * @param callable|object $classLoader - * - * @api - * - * @deprecated since 2.5, passing an object is deprecated and support for it will be removed in 3.0 - */ - public function __construct($classLoader) - { - $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile'); - - if ($this->wasFinder) { - $this->classLoader = array($classLoader, 'loadClass'); - $this->isFinder = true; - } else { - $this->classLoader = $classLoader; - $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile'); - } - - if (!isset(self::$caseCheck)) { - self::$caseCheck = false !== stripos(PHP_OS, 'win') ? (false !== stripos(PHP_OS, 'darwin') ? 2 : 1) : 0; - } - } - - /** - * Gets the wrapped class loader. - * - * @return callable|object a class loader - * - * @deprecated since 2.5, returning an object is deprecated and support for it will be removed in 3.0 - */ - public function getClassLoader() - { - return $this->wasFinder ? $this->classLoader[0] : $this->classLoader; - } - - /** - * Wraps all autoloaders. - */ - public static function enable() - { - // Ensures we don't hit https://bugs.php.net/42098 - class_exists('Symfony\Component\Debug\ErrorHandler'); - class_exists('Psr\Log\LogLevel'); - - if (!is_array($functions = spl_autoload_functions())) { - return; - } - - foreach ($functions as $function) { - spl_autoload_unregister($function); - } - - foreach ($functions as $function) { - if (!is_array($function) || !$function[0] instanceof self) { - $function = array(new static($function), 'loadClass'); - } - - spl_autoload_register($function); - } - } - - /** - * Disables the wrapping. - */ - public static function disable() - { - if (!is_array($functions = spl_autoload_functions())) { - return; - } - - foreach ($functions as $function) { - spl_autoload_unregister($function); - } - - foreach ($functions as $function) { - if (is_array($function) && $function[0] instanceof self) { - $function = $function[0]->getClassLoader(); - } - - spl_autoload_register($function); - } - } - - /** - * Finds a file by class name. - * - * @param string $class A class name to resolve to file - * - * @return string|null - * - * @deprecated Deprecated since 2.5, to be removed in 3.0. - */ - public function findFile($class) - { - if ($this->wasFinder) { - return $this->classLoader[0]->findFile($class); - } - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * - * @return bool|null True, if loaded - * - * @throws \RuntimeException - */ - public function loadClass($class) - { - ErrorHandler::stackErrors(); - - try { - if ($this->isFinder) { - if ($file = $this->classLoader[0]->findFile($class)) { - require $file; - } - } else { - call_user_func($this->classLoader, $class); - $file = false; - } - } catch (\Exception $e) { - ErrorHandler::unstackErrors(); - - throw $e; - } - - ErrorHandler::unstackErrors(); - - $exists = class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false)); - - if ('\\' === $class[0]) { - $class = substr($class, 1); - } - - if ($exists) { - $refl = new \ReflectionClass($class); - $name = $refl->getName(); - - if ($name !== $class && 0 === strcasecmp($name, $class)) { - throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name)); - } - } - - if ($file) { - if (!$exists) { - if (false !== strpos($class, '/')) { - throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class)); - } - - throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file)); - } - if (self::$caseCheck && preg_match('#([/\\\\][a-zA-Z_\x7F-\xFF][a-zA-Z0-9_\x7F-\xFF]*)+\.(php|hh)$#D', $file, $tail)) { - $tail = $tail[0]; - $real = $refl->getFileName(); - - if (2 === self::$caseCheck) { - // realpath() on MacOSX doesn't normalize the case of characters - $cwd = getcwd(); - $basename = strrpos($real, '/'); - chdir(substr($real, 0, $basename)); - $basename = substr($real, $basename + 1); - // glob() patterns are case-sensitive even if the underlying fs is not - if (!in_array($basename, glob($basename.'*', GLOB_NOSORT), true)) { - $real = getcwd().'/'; - $h = opendir('.'); - while (false !== $f = readdir($h)) { - if (0 === strcasecmp($f, $basename)) { - $real .= $f; - break; - } - } - closedir($h); - } - chdir($cwd); - } - - if (0 === substr_compare($real, $tail, -strlen($tail), strlen($tail), true) - && 0 !== substr_compare($real, $tail, -strlen($tail), strlen($tail), false) - ) { - throw new \RuntimeException(sprintf('Case mismatch between class and source file names: %s vs %s', $class, $real)); - } - } - - return true; - } - } -} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/ErrorHandler.php b/application/vendor/symfony/debug/Symfony/Component/Debug/ErrorHandler.php deleted file mode 100644 index f315a53..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/ErrorHandler.php +++ /dev/null @@ -1,731 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug; - -use Psr\Log\LogLevel; -use Psr\Log\LoggerInterface; -use Symfony\Component\Debug\Exception\ContextErrorException; -use Symfony\Component\Debug\Exception\FatalErrorException; -use Symfony\Component\Debug\Exception\FatalThrowableError; -use Symfony\Component\Debug\Exception\OutOfMemoryException; -use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler; -use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler; -use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler; -use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface; - -/** - * A generic ErrorHandler for the PHP engine. - * - * Provides five bit fields that control how errors are handled: - * - thrownErrors: errors thrown as \ErrorException - * - loggedErrors: logged errors, when not @-silenced - * - scopedErrors: errors thrown or logged with their local context - * - tracedErrors: errors logged with their stack trace, only once for repeated errors - * - screamedErrors: never @-silenced errors - * - * Each error level can be logged by a dedicated PSR-3 logger object. - * Screaming only applies to logging. - * Throwing takes precedence over logging. - * Uncaught exceptions are logged as E_ERROR. - * E_DEPRECATED and E_USER_DEPRECATED levels never throw. - * E_RECOVERABLE_ERROR and E_USER_ERROR levels always throw. - * Non catchable errors that can be detected at shutdown time are logged when the scream bit field allows so. - * As errors have a performance cost, repeated errors are all logged, so that the developer - * can see them and weight them as more important to fix than others of the same level. - * - * @author Nicolas Grekas - */ -class ErrorHandler -{ - /** - * @deprecated since 2.6, to be removed in 3.0. - */ - const TYPE_DEPRECATION = -100; - - private $levels = array( - E_DEPRECATED => 'Deprecated', - E_USER_DEPRECATED => 'User Deprecated', - E_NOTICE => 'Notice', - E_USER_NOTICE => 'User Notice', - E_STRICT => 'Runtime Notice', - E_WARNING => 'Warning', - E_USER_WARNING => 'User Warning', - E_COMPILE_WARNING => 'Compile Warning', - E_CORE_WARNING => 'Core Warning', - E_USER_ERROR => 'User Error', - E_RECOVERABLE_ERROR => 'Catchable Fatal Error', - E_COMPILE_ERROR => 'Compile Error', - E_PARSE => 'Parse Error', - E_ERROR => 'Error', - E_CORE_ERROR => 'Core Error', - ); - - private $loggers = array( - E_DEPRECATED => array(null, LogLevel::INFO), - E_USER_DEPRECATED => array(null, LogLevel::INFO), - E_NOTICE => array(null, LogLevel::NOTICE), - E_USER_NOTICE => array(null, LogLevel::NOTICE), - E_STRICT => array(null, LogLevel::NOTICE), - E_WARNING => array(null, LogLevel::WARNING), - E_USER_WARNING => array(null, LogLevel::WARNING), - E_COMPILE_WARNING => array(null, LogLevel::WARNING), - E_CORE_WARNING => array(null, LogLevel::WARNING), - E_USER_ERROR => array(null, LogLevel::ERROR), - E_RECOVERABLE_ERROR => array(null, LogLevel::ERROR), - E_COMPILE_ERROR => array(null, LogLevel::EMERGENCY), - E_PARSE => array(null, LogLevel::EMERGENCY), - E_ERROR => array(null, LogLevel::EMERGENCY), - E_CORE_ERROR => array(null, LogLevel::EMERGENCY), - ); - - private $thrownErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED - private $scopedErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED - private $tracedErrors = 0x77FB; // E_ALL - E_STRICT - E_PARSE - private $screamedErrors = 0x55; // E_ERROR + E_CORE_ERROR + E_COMPILE_ERROR + E_PARSE - private $loggedErrors = 0; - - private $loggedTraces = array(); - private $isRecursive = 0; - private $exceptionHandler; - - private static $reservedMemory; - private static $stackedErrors = array(); - private static $stackedErrorLevels = array(); - - /** - * Same init value as thrownErrors. - * - * @deprecated since 2.6, to be removed in 3.0. - */ - private $displayErrors = 0x1FFF; - - /** - * Registers the error handler. - * - * @param self|null|int $handler The handler to register, or @deprecated (since 2.6, to be removed in 3.0) bit field of thrown levels - * @param bool $replace Whether to replace or not any existing handler - * - * @return self The registered error handler - */ - public static function register($handler = null, $replace = true) - { - if (null === self::$reservedMemory) { - self::$reservedMemory = str_repeat('x', 10240); - register_shutdown_function(__CLASS__.'::handleFatalError'); - } - - $levels = -1; - - if ($handlerIsNew = !$handler instanceof self) { - // @deprecated polymorphism, to be removed in 3.0 - if (null !== $handler) { - $levels = $replace ? $handler : 0; - $replace = true; - } - $handler = new static(); - } - - $prev = set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors); - - if ($handlerIsNew && is_array($prev) && $prev[0] instanceof self) { - $handler = $prev[0]; - $replace = false; - } - if ($replace || !$prev) { - $handler->setExceptionHandler(set_exception_handler(array($handler, 'handleException'))); - } else { - restore_error_handler(); - } - - $handler->throwAt($levels & $handler->thrownErrors, true); - - return $handler; - } - - /** - * Sets a logger to non assigned errors levels. - * - * @param LoggerInterface $logger A PSR-3 logger to put as default for the given levels - * @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants - * @param bool $replace Whether to replace or not any existing logger - */ - public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false) - { - $loggers = array(); - - if (is_array($levels)) { - foreach ($levels as $type => $logLevel) { - if (empty($this->loggers[$type][0]) || $replace) { - $loggers[$type] = array($logger, $logLevel); - } - } - } else { - if (null === $levels) { - $levels = E_ALL | E_STRICT; - } - foreach ($this->loggers as $type => $log) { - if (($type & $levels) && (empty($log[0]) || $replace)) { - $log[0] = $logger; - $loggers[$type] = $log; - } - } - } - - $this->setLoggers($loggers); - } - - /** - * Sets a logger for each error level. - * - * @param array $loggers Error levels to [LoggerInterface|null, LogLevel::*] map - * - * @return array The previous map - * - * @throws \InvalidArgumentException - */ - public function setLoggers(array $loggers) - { - $prevLogged = $this->loggedErrors; - $prev = $this->loggers; - - foreach ($loggers as $type => $log) { - if (!isset($prev[$type])) { - throw new \InvalidArgumentException('Unknown error type: '.$type); - } - if (!is_array($log)) { - $log = array($log); - } elseif (!array_key_exists(0, $log)) { - throw new \InvalidArgumentException('No logger provided'); - } - if (null === $log[0]) { - $this->loggedErrors &= ~$type; - } elseif ($log[0] instanceof LoggerInterface) { - $this->loggedErrors |= $type; - } else { - throw new \InvalidArgumentException('Invalid logger provided'); - } - $this->loggers[$type] = $log + $prev[$type]; - } - $this->reRegister($prevLogged | $this->thrownErrors); - - return $prev; - } - - /** - * Sets a user exception handler. - * - * @param callable $handler A handler that will be called on Exception - * - * @return callable|null The previous exception handler - * - * @throws \InvalidArgumentException - */ - public function setExceptionHandler($handler) - { - if (null !== $handler && !is_callable($handler)) { - throw new \LogicException('The exception handler must be a valid PHP callable.'); - } - $prev = $this->exceptionHandler; - $this->exceptionHandler = $handler; - - return $prev; - } - - /** - * Sets the PHP error levels that throw an exception when a PHP error occurs. - * - * @param int $levels A bit field of E_* constants for thrown errors - * @param bool $replace Replace or amend the previous value - * - * @return int The previous value - */ - public function throwAt($levels, $replace = false) - { - $prev = $this->thrownErrors; - $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED; - if (!$replace) { - $this->thrownErrors |= $prev; - } - $this->reRegister($prev | $this->loggedErrors); - - // $this->displayErrors is @deprecated since 2.6 - $this->displayErrors = $this->thrownErrors; - - return $prev; - } - - /** - * Sets the PHP error levels for which local variables are preserved. - * - * @param int $levels A bit field of E_* constants for scoped errors - * @param bool $replace Replace or amend the previous value - * - * @return int The previous value - */ - public function scopeAt($levels, $replace = false) - { - $prev = $this->scopedErrors; - $this->scopedErrors = (int) $levels; - if (!$replace) { - $this->scopedErrors |= $prev; - } - - return $prev; - } - - /** - * Sets the PHP error levels for which the stack trace is preserved. - * - * @param int $levels A bit field of E_* constants for traced errors - * @param bool $replace Replace or amend the previous value - * - * @return int The previous value - */ - public function traceAt($levels, $replace = false) - { - $prev = $this->tracedErrors; - $this->tracedErrors = (int) $levels; - if (!$replace) { - $this->tracedErrors |= $prev; - } - - return $prev; - } - - /** - * Sets the error levels where the @-operator is ignored. - * - * @param int $levels A bit field of E_* constants for screamed errors - * @param bool $replace Replace or amend the previous value - * - * @return int The previous value - */ - public function screamAt($levels, $replace = false) - { - $prev = $this->screamedErrors; - $this->screamedErrors = (int) $levels; - if (!$replace) { - $this->screamedErrors |= $prev; - } - - return $prev; - } - - /** - * Re-registers as a PHP error handler if levels changed. - */ - private function reRegister($prev) - { - if ($prev !== $this->thrownErrors | $this->loggedErrors) { - $handler = set_error_handler('var_dump', 0); - $handler = is_array($handler) ? $handler[0] : null; - restore_error_handler(); - if ($handler === $this) { - restore_error_handler(); - set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors); - } - } - } - - /** - * Handles errors by filtering then logging them according to the configured bit fields. - * - * @param int $type One of the E_* constants - * @param string $file - * @param int $line - * @param array $context - * - * @return bool Returns false when no handling happens so that the PHP engine can handle the error itself. - * - * @throws \ErrorException When $this->thrownErrors requests so - * - * @internal - */ - public function handleError($type, $message, $file, $line, array $context, array $backtrace = null) - { - $level = error_reporting() | E_RECOVERABLE_ERROR | E_USER_ERROR; - $log = $this->loggedErrors & $type; - $throw = $this->thrownErrors & $type & $level; - $type &= $level | $this->screamedErrors; - - if (!$type || (!$log && !$throw)) { - return $type && $log; - } - - if (PHP_VERSION_ID < 50400 && isset($context['GLOBALS']) && ($this->scopedErrors & $type)) { - $e = $context; // Whatever the signature of the method, - unset($e['GLOBALS'], $context); // $context is always a reference in 5.3 - $context = $e; - } - - if (null !== $backtrace && $type & E_ERROR) { - // E_ERROR fatal errors are triggered on HHVM when - // hhvm.error_handling.call_user_handler_on_fatals=1 - // which is the way to get their backtrace. - $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace')); - - return true; - } - - if ($throw) { - if (($this->scopedErrors & $type) && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) { - // Checking for class existence is a work around for https://bugs.php.net/42098 - $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context); - } else { - $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line); - } - - if (PHP_VERSION_ID <= 50407 && (PHP_VERSION_ID >= 50400 || PHP_VERSION_ID <= 50317)) { - // Exceptions thrown from error handlers are sometimes not caught by the exception - // handler and shutdown handlers are bypassed before 5.4.8/5.3.18. - // We temporarily re-enable display_errors to prevent any blank page related to this bug. - - $throw->errorHandlerCanary = new ErrorHandlerCanary(); - } - - throw $throw; - } - - // For duplicated errors, log the trace only once - $e = md5("{$type}/{$line}/{$file}\x00{$message}", true); - $trace = true; - - if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) { - $trace = false; - } else { - $this->loggedTraces[$e] = 1; - } - - $e = compact('type', 'file', 'line', 'level'); - - if ($type & $level) { - if ($this->scopedErrors & $type) { - $e['scope_vars'] = $context; - if ($trace) { - $e['stack'] = $backtrace ?: debug_backtrace(true); // Provide object - } - } elseif ($trace) { - if (null === $backtrace) { - $e['stack'] = debug_backtrace(PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false); - } else { - foreach ($backtrace as &$frame) { - unset($frame['args'], $frame); - } - $e['stack'] = $backtrace; - } - } - } - - if ($this->isRecursive) { - $log = 0; - } elseif (self::$stackedErrorLevels) { - self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e); - } else { - try { - $this->isRecursive = true; - $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e); - $this->isRecursive = false; - } catch (\Exception $e) { - $this->isRecursive = false; - - throw $e; - } - } - - return $type && $log; - } - - /** - * Handles an exception by logging then forwarding it to an other handler. - * - * @param \Exception|\Throwable $exception An exception to handle - * @param array $error An array as returned by error_get_last() - * - * @internal - */ - public function handleException($exception, array $error = null) - { - if (!$exception instanceof \Exception) { - $exception = new FatalThrowableError($exception); - } - $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR; - - if ($this->loggedErrors & $type) { - $e = array( - 'type' => $type, - 'file' => $exception->getFile(), - 'line' => $exception->getLine(), - 'level' => error_reporting(), - 'stack' => $exception->getTrace(), - ); - if ($exception instanceof FatalErrorException) { - if ($exception instanceof FatalThrowableError) { - $error = array( - 'type' => $type, - 'message' => $message = $exception->getMessage(), - 'file' => $e['file'], - 'line' => $e['line'], - ); - } else { - $message = 'Fatal '.$exception->getMessage(); - } - } elseif ($exception instanceof \ErrorException) { - $message = 'Uncaught '.$exception->getMessage(); - if ($exception instanceof ContextErrorException) { - $e['context'] = $exception->getContext(); - } - } else { - $message = 'Uncaught Exception: '.$exception->getMessage(); - } - if ($this->loggedErrors & $e['type']) { - $this->loggers[$e['type']][0]->log($this->loggers[$e['type']][1], $message, $e); - } - } - if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) { - foreach ($this->getFatalErrorHandlers() as $handler) { - if ($e = $handler->handleError($error, $exception)) { - $exception = $e; - break; - } - } - } - if (empty($this->exceptionHandler)) { - throw $exception; // Give back $exception to the native handler - } - try { - call_user_func($this->exceptionHandler, $exception); - } catch (\Exception $handlerException) { - } catch (\Throwable $handlerException) { - } - if (isset($handlerException)) { - $this->exceptionHandler = null; - $this->handleException($handlerException); - } - } - - /** - * Shutdown registered function for handling PHP fatal errors. - * - * @param array $error An array as returned by error_get_last() - * - * @internal - */ - public static function handleFatalError(array $error = null) - { - if (null === self::$reservedMemory) { - return; - } - - self::$reservedMemory = null; - - $handler = set_error_handler('var_dump', 0); - $handler = is_array($handler) ? $handler[0] : null; - restore_error_handler(); - - if (!$handler instanceof self) { - return; - } - - if (null === $error) { - $error = error_get_last(); - } - - try { - while (self::$stackedErrorLevels) { - static::unstackErrors(); - } - } catch (\Exception $exception) { - // Handled below - } - - if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) { - // Let's not throw anymore but keep logging - $handler->throwAt(0, true); - $trace = isset($error['backtrace']) ? $error['backtrace'] : null; - - if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) { - $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace); - } else { - $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace); - } - } elseif (!isset($exception)) { - return; - } - - try { - $handler->handleException($exception, $error); - } catch (FatalErrorException $e) { - // Ignore this re-throw - } - } - - /** - * Configures the error handler for delayed handling. - * Ensures also that non-catchable fatal errors are never silenced. - * - * As shown by http://bugs.php.net/42098 and http://bugs.php.net/60724 - * PHP has a compile stage where it behaves unusually. To workaround it, - * we plug an error handler that only stacks errors for later. - * - * The most important feature of this is to prevent - * autoloading until unstackErrors() is called. - */ - public static function stackErrors() - { - self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR); - } - - /** - * Unstacks stacked errors and forwards to the logger. - */ - public static function unstackErrors() - { - $level = array_pop(self::$stackedErrorLevels); - - if (null !== $level) { - $e = error_reporting($level); - if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) { - // If the user changed the error level, do not overwrite it - error_reporting($e); - } - } - - if (empty(self::$stackedErrorLevels)) { - $errors = self::$stackedErrors; - self::$stackedErrors = array(); - - foreach ($errors as $e) { - $e[0]->log($e[1], $e[2], $e[3]); - } - } - } - - /** - * Gets the fatal error handlers. - * - * Override this method if you want to define more fatal error handlers. - * - * @return FatalErrorHandlerInterface[] An array of FatalErrorHandlerInterface - */ - protected function getFatalErrorHandlers() - { - return array( - new UndefinedFunctionFatalErrorHandler(), - new UndefinedMethodFatalErrorHandler(), - new ClassNotFoundFatalErrorHandler(), - ); - } - - /** - * Sets the level at which the conversion to Exception is done. - * - * @param int|null $level The level (null to use the error_reporting() value and 0 to disable) - * - * @deprecated since 2.6, to be removed in 3.0. Use throwAt() instead. - */ - public function setLevel($level) - { - $level = null === $level ? error_reporting() : $level; - $this->throwAt($level, true); - } - - /** - * Sets the display_errors flag value. - * - * @param int $displayErrors The display_errors flag value - * - * @deprecated since 2.6, to be removed in 3.0. Use throwAt() instead. - */ - public function setDisplayErrors($displayErrors) - { - if ($displayErrors) { - $this->throwAt($this->displayErrors, true); - } else { - $displayErrors = $this->displayErrors; - $this->throwAt(0, true); - $this->displayErrors = $displayErrors; - } - } - - /** - * Sets a logger for the given channel. - * - * @param LoggerInterface $logger A logger interface - * @param string $channel The channel associated with the logger (deprecation, emergency or scream) - * - * @deprecated since 2.6, to be removed in 3.0. Use setLoggers() or setDefaultLogger() instead. - */ - public static function setLogger(LoggerInterface $logger, $channel = 'deprecation') - { - $handler = set_error_handler('var_dump', 0); - $handler = is_array($handler) ? $handler[0] : null; - restore_error_handler(); - if (!$handler instanceof self) { - return; - } - if ('deprecation' === $channel) { - $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true); - $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED); - } elseif ('scream' === $channel) { - $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false); - $handler->screamAt(E_ALL | E_STRICT); - } elseif ('emergency' === $channel) { - $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true); - $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR); - } - } - - /** - * @deprecated since 2.6, to be removed in 3.0. Use handleError() instead. - */ - public function handle($level, $message, $file = 'unknown', $line = 0, $context = array()) - { - return $this->handleError($level, $message, $file, $line, (array) $context); - } - - /** - * Handles PHP fatal errors. - * - * @deprecated since 2.6, to be removed in 3.0. Use handleFatalError() instead. - */ - public function handleFatal() - { - static::handleFatalError(); - } -} - -/** - * Private class used to work around https://bugs.php.net/54275. - * - * @author Nicolas Grekas - * - * @internal - */ -class ErrorHandlerCanary -{ - private static $displayErrors = null; - - public function __construct() - { - if (null === self::$displayErrors) { - self::$displayErrors = ini_set('display_errors', 1); - } - } - - public function __destruct() - { - if (null !== self::$displayErrors) { - ini_set('display_errors', self::$displayErrors); - self::$displayErrors = null; - } - } -} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/FatalErrorException.php b/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/FatalErrorException.php deleted file mode 100644 index f46e208..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/FatalErrorException.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * Fatal Error Exception. - * - * @author Fabien Potencier - * @author Konstanton Myakshin - * @author Nicolas Grekas - * - * @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead. - */ -class FatalErrorException extends \ErrorException -{ -} - -namespace Symfony\Component\Debug\Exception; - -use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException; - -/** - * Fatal Error Exception. - * - * @author Konstanton Myakshin - */ -class FatalErrorException extends LegacyFatalErrorException -{ - public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null) - { - parent::__construct($message, $code, $severity, $filename, $lineno); - - if (null !== $trace) { - if (!$traceArgs) { - foreach ($trace as &$frame) { - unset($frame['args'], $frame['this'], $frame); - } - } - - $this->setTrace($trace); - } elseif (null !== $traceOffset) { - if (function_exists('xdebug_get_function_stack')) { - $trace = xdebug_get_function_stack(); - if (0 < $traceOffset) { - array_splice($trace, -$traceOffset); - } - - foreach ($trace as &$frame) { - if (!isset($frame['type'])) { - // XDebug pre 2.1.1 doesn't currently set the call type key http://bugs.xdebug.org/view.php?id=695 - if (isset($frame['class'])) { - $frame['type'] = '::'; - } - } elseif ('dynamic' === $frame['type']) { - $frame['type'] = '->'; - } elseif ('static' === $frame['type']) { - $frame['type'] = '::'; - } - - // XDebug also has a different name for the parameters array - if (!$traceArgs) { - unset($frame['params'], $frame['args']); - } elseif (isset($frame['params']) && !isset($frame['args'])) { - $frame['args'] = $frame['params']; - unset($frame['params']); - } - } - - unset($frame); - $trace = array_reverse($trace); - } else { - $trace = array(); - } - - $this->setTrace($trace); - } - } - - protected function setTrace($trace) - { - $traceReflector = new \ReflectionProperty('Exception', 'trace'); - $traceReflector->setAccessible(true); - $traceReflector->setValue($this, $trace); - } -} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/FlattenException.php b/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/FlattenException.php deleted file mode 100644 index d8d5c5b..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Exception/FlattenException.php +++ /dev/null @@ -1,292 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException; - -/** - * FlattenException wraps a PHP Exception to be able to serialize it. - * - * Basically, this class removes all objects from the trace. - * - * @author Fabien Potencier - * - * @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead. - */ -class FlattenException -{ - private $handler; - - public static function __callStatic($method, $args) - { - if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) { - throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_called_class(), $method)); - } - - return call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args); - } - - public function __call($method, $args) - { - if (!isset($this->handler)) { - $this->handler = new DebugFlattenException(); - } - - if (!method_exists($this->handler, $method)) { - throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method)); - } - - return call_user_func_array(array($this->handler, $method), $args); - } -} - -namespace Symfony\Component\Debug\Exception; - -use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; - -/** - * FlattenException wraps a PHP Exception to be able to serialize it. - * - * Basically, this class removes all objects from the trace. - * - * @author Fabien Potencier - */ -class FlattenException extends LegacyFlattenException -{ - private $message; - private $code; - private $previous; - private $trace; - private $class; - private $statusCode; - private $headers; - private $file; - private $line; - - public static function create(\Exception $exception, $statusCode = null, array $headers = array()) - { - $e = new static(); - $e->setMessage($exception->getMessage()); - $e->setCode($exception->getCode()); - - if ($exception instanceof HttpExceptionInterface) { - $statusCode = $exception->getStatusCode(); - $headers = array_merge($headers, $exception->getHeaders()); - } - - if (null === $statusCode) { - $statusCode = 500; - } - - $e->setStatusCode($statusCode); - $e->setHeaders($headers); - $e->setTraceFromException($exception); - $e->setClass(get_class($exception)); - $e->setFile($exception->getFile()); - $e->setLine($exception->getLine()); - if ($exception->getPrevious()) { - $e->setPrevious(static::create($exception->getPrevious())); - } - - return $e; - } - - public function toArray() - { - $exceptions = array(); - foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) { - $exceptions[] = array( - 'message' => $exception->getMessage(), - 'class' => $exception->getClass(), - 'trace' => $exception->getTrace(), - ); - } - - return $exceptions; - } - - public function getStatusCode() - { - return $this->statusCode; - } - - public function setStatusCode($code) - { - $this->statusCode = $code; - } - - public function getHeaders() - { - return $this->headers; - } - - public function setHeaders(array $headers) - { - $this->headers = $headers; - } - - public function getClass() - { - return $this->class; - } - - public function setClass($class) - { - $this->class = $class; - } - - public function getFile() - { - return $this->file; - } - - public function setFile($file) - { - $this->file = $file; - } - - public function getLine() - { - return $this->line; - } - - public function setLine($line) - { - $this->line = $line; - } - - public function getMessage() - { - return $this->message; - } - - public function setMessage($message) - { - $this->message = $message; - } - - public function getCode() - { - return $this->code; - } - - public function setCode($code) - { - $this->code = $code; - } - - public function getPrevious() - { - return $this->previous; - } - - public function setPrevious(FlattenException $previous) - { - $this->previous = $previous; - } - - public function getAllPrevious() - { - $exceptions = array(); - $e = $this; - while ($e = $e->getPrevious()) { - $exceptions[] = $e; - } - - return $exceptions; - } - - public function getTrace() - { - return $this->trace; - } - - public function setTraceFromException(\Exception $exception) - { - $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine()); - } - - public function setTrace($trace, $file, $line) - { - $this->trace = array(); - $this->trace[] = array( - 'namespace' => '', - 'short_class' => '', - 'class' => '', - 'type' => '', - 'function' => '', - 'file' => $file, - 'line' => $line, - 'args' => array(), - ); - foreach ($trace as $entry) { - $class = ''; - $namespace = ''; - if (isset($entry['class'])) { - $parts = explode('\\', $entry['class']); - $class = array_pop($parts); - $namespace = implode('\\', $parts); - } - - $this->trace[] = array( - 'namespace' => $namespace, - 'short_class' => $class, - 'class' => isset($entry['class']) ? $entry['class'] : '', - 'type' => isset($entry['type']) ? $entry['type'] : '', - 'function' => isset($entry['function']) ? $entry['function'] : null, - 'file' => isset($entry['file']) ? $entry['file'] : null, - 'line' => isset($entry['line']) ? $entry['line'] : null, - 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(), - ); - } - } - - private function flattenArgs($args, $level = 0, &$count = 0) - { - $result = array(); - foreach ($args as $key => $value) { - if (++$count > 1e4) { - return array('array', '*SKIPPED over 10000 entries*'); - } - if (is_object($value)) { - $result[$key] = array('object', get_class($value)); - } elseif (is_array($value)) { - if ($level > 10) { - $result[$key] = array('array', '*DEEP NESTED ARRAY*'); - } else { - $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count)); - } - } elseif (null === $value) { - $result[$key] = array('null', null); - } elseif (is_bool($value)) { - $result[$key] = array('boolean', $value); - } elseif (is_resource($value)) { - $result[$key] = array('resource', get_resource_type($value)); - } elseif ($value instanceof \__PHP_Incomplete_Class) { - // Special case of object, is_object will return false - $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value)); - } else { - $result[$key] = array('string', (string) $value); - } - } - - return $result; - } - - private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value) - { - $array = new \ArrayObject($value); - - return $array['__PHP_Incomplete_Class_Name']; - } -} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/ExceptionHandler.php b/application/vendor/symfony/debug/Symfony/Component/Debug/ExceptionHandler.php deleted file mode 100644 index bc66741..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/ExceptionHandler.php +++ /dev/null @@ -1,476 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug; - -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Debug\Exception\FlattenException; -use Symfony\Component\Debug\Exception\OutOfMemoryException; - -/** - * ExceptionHandler converts an exception to a Response object. - * - * It is mostly useful in debug mode to replace the default PHP/XDebug - * output with something prettier and more useful. - * - * As this class is mainly used during Kernel boot, where nothing is yet - * available, the Response content is always HTML. - * - * @author Fabien Potencier - * @author Nicolas Grekas - */ -class ExceptionHandler -{ - private $debug; - private $charset; - private $handler; - private $caughtBuffer; - private $caughtLength; - private $fileLinkFormat; - - public function __construct($debug = true, $charset = null, $fileLinkFormat = null) - { - if (false !== strpos($charset, '%') xor false === strpos($fileLinkFormat, '%')) { - // Swap $charset and $fileLinkFormat for BC reasons - $pivot = $fileLinkFormat; - $fileLinkFormat = $charset; - $charset = $pivot; - } - $this->debug = $debug; - $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8'; - $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); - } - - /** - * Registers the exception handler. - * - * @param bool $debug Enable/disable debug mode, where the stack trace is displayed - * @param string|null $charset The charset used by exception messages - * @param string|null $fileLinkFormat The IDE link template - * - * @return ExceptionHandler The registered exception handler - */ - public static function register($debug = true, $charset = null, $fileLinkFormat = null) - { - $handler = new static($debug, $charset, $fileLinkFormat); - - $prev = set_exception_handler(array($handler, 'handle')); - if (is_array($prev) && $prev[0] instanceof ErrorHandler) { - restore_exception_handler(); - $prev[0]->setExceptionHandler(array($handler, 'handle')); - } - - return $handler; - } - - /** - * Sets a user exception handler. - * - * @param callable $handler An handler that will be called on Exception - * - * @return callable|null The previous exception handler if any - */ - public function setHandler($handler) - { - if (null !== $handler && !is_callable($handler)) { - throw new \LogicException('The exception handler must be a valid PHP callable.'); - } - $old = $this->handler; - $this->handler = $handler; - - return $old; - } - - /** - * Sets the format for links to source files. - * - * @param string $format The format for links to source files - * - * @return string The previous file link format. - */ - public function setFileLinkFormat($format) - { - $old = $this->fileLinkFormat; - $this->fileLinkFormat = $format; - - return $old; - } - - /** - * Sends a response for the given Exception. - * - * To be as fail-safe as possible, the exception is first handled - * by our simple exception handler, then by the user exception handler. - * The latter takes precedence and any output from the former is cancelled, - * if and only if nothing bad happens in this handling path. - */ - public function handle(\Exception $exception) - { - if (null === $this->handler || $exception instanceof OutOfMemoryException) { - $this->failSafeHandle($exception); - - return; - } - - $caughtLength = $this->caughtLength = 0; - - ob_start(array($this, 'catchOutput')); - $this->failSafeHandle($exception); - while (null === $this->caughtBuffer && ob_end_flush()) { - // Empty loop, everything is in the condition - } - if (isset($this->caughtBuffer[0])) { - ob_start(array($this, 'cleanOutput')); - echo $this->caughtBuffer; - $caughtLength = ob_get_length(); - } - $this->caughtBuffer = null; - - try { - call_user_func($this->handler, $exception); - $this->caughtLength = $caughtLength; - } catch (\Exception $e) { - if (!$caughtLength) { - // All handlers failed. Let PHP handle that now. - throw $exception; - } - } - } - - /** - * Sends a response for the given Exception. - * - * If you have the Symfony HttpFoundation component installed, - * this method will use it to create and send the response. If not, - * it will fallback to plain PHP functions. - * - * @param \Exception $exception An \Exception instance - * - * @see sendPhpResponse() - * @see createResponse() - */ - private function failSafeHandle(\Exception $exception) - { - if (class_exists('Symfony\Component\HttpFoundation\Response', false)) { - $response = $this->createResponse($exception); - $response->sendHeaders(); - $response->sendContent(); - } else { - $this->sendPhpResponse($exception); - } - } - - /** - * Sends the error associated with the given Exception as a plain PHP response. - * - * This method uses plain PHP functions like header() and echo to output - * the response. - * - * @param \Exception|FlattenException $exception An \Exception instance - */ - public function sendPhpResponse($exception) - { - if (!$exception instanceof FlattenException) { - $exception = FlattenException::create($exception); - } - - if (!headers_sent()) { - header(sprintf('HTTP/1.0 %s', $exception->getStatusCode())); - foreach ($exception->getHeaders() as $name => $value) { - header($name.': '.$value, false); - } - header('Content-Type: text/html; charset='.$this->charset); - } - - echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception)); - } - - /** - * Creates the error Response associated with the given Exception. - * - * @param \Exception|FlattenException $exception An \Exception instance - * - * @return Response A Response instance - */ - public function createResponse($exception) - { - if (!$exception instanceof FlattenException) { - $exception = FlattenException::create($exception); - } - - return Response::create($this->decorate($this->getContent($exception), $this->getStylesheet($exception)), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset); - } - - /** - * Gets the HTML content associated with the given exception. - * - * @param FlattenException $exception A FlattenException instance - * - * @return string The content as a string - */ - public function getContent(FlattenException $exception) - { - switch ($exception->getStatusCode()) { - case 404: - $title = 'Sorry, the page you are looking for could not be found.'; - break; - default: - $title = 'Whoops, looks like something went wrong.'; - } - - $content = ''; - if ($this->debug) { - try { - $count = count($exception->getAllPrevious()); - $total = $count + 1; - foreach ($exception->toArray() as $position => $e) { - $ind = $count - $position + 1; - $class = $this->formatClass($e['class']); - $message = nl2br($this->escapeHtml($e['message'])); - $content .= sprintf(<< - %d/%d - %s%s: - %s - -
    -
      - -EOF - , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message); - foreach ($e['trace'] as $trace) { - $content .= '
    1. '; - if ($trace['function']) { - $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args'])); - } - if (isset($trace['file']) && isset($trace['line'])) { - $content .= $this->formatPath($trace['file'], $trace['line']); - } - $content .= "
    2. \n"; - } - - $content .= "
    \n
    \n"; - } - } catch (\Exception $e) { - // something nasty happened and we cannot throw an exception anymore - if ($this->debug) { - $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage())); - } else { - $title = 'Whoops, looks like something went wrong.'; - } - } - } - - return << -

    $title

    - $content - -EOF; - } - - /** - * Gets the stylesheet associated with the given exception. - * - * @param FlattenException $exception A FlattenException instance - * - * @return string The stylesheet as a string - */ - public function getStylesheet(FlattenException $exception) - { - return << - - - - - - - - $content - - -EOF; - } - - private function formatClass($class) - { - $parts = explode('\\', $class); - - return sprintf('%s', $class, array_pop($parts)); - } - - private function formatPath($path, $line) - { - $path = $this->escapeHtml($path); - $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path; - - if ($linkFormat = $this->fileLinkFormat) { - $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line)); - - return sprintf(' in %s line %d', $link, $file, $line); - } - - return sprintf(' in %s line %d', $path, $file, $line); - } - - /** - * Formats an array as a string. - * - * @param array $args The argument array - * - * @return string - */ - private function formatArgs(array $args) - { - $result = array(); - foreach ($args as $key => $item) { - if ('object' === $item[0]) { - $formattedValue = sprintf('object(%s)', $this->formatClass($item[1])); - } elseif ('array' === $item[0]) { - $formattedValue = sprintf('array(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); - } elseif ('string' === $item[0]) { - $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1])); - } elseif ('null' === $item[0]) { - $formattedValue = 'null'; - } elseif ('boolean' === $item[0]) { - $formattedValue = ''.strtolower(var_export($item[1], true)).''; - } elseif ('resource' === $item[0]) { - $formattedValue = 'resource'; - } else { - $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true)); - } - - $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue); - } - - return implode(', ', $result); - } - - /** - * Returns an UTF-8 and HTML encoded string. - */ - protected static function utf8Htmlize($str) - { - if (!preg_match('//u', $str) && function_exists('iconv')) { - set_error_handler('var_dump', 0); - $charset = ini_get('default_charset'); - if ('UTF-8' === $charset || $str !== @iconv($charset, $charset, $str)) { - $charset = 'CP1252'; - } - restore_error_handler(); - - $str = iconv($charset, 'UTF-8', $str); - } - - return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8'); - } - - /** - * HTML-encodes a string. - */ - private function escapeHtml($str) - { - return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset); - } - - /** - * @internal - */ - public function catchOutput($buffer) - { - $this->caughtBuffer = $buffer; - - return ''; - } - - /** - * @internal - */ - public function cleanOutput($buffer) - { - if ($this->caughtLength) { - // use substr_replace() instead of substr() for mbstring overloading resistance - $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength); - if (isset($cleanBuffer[0])) { - $buffer = $cleanBuffer; - } - } - - return $buffer; - } -} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/LICENSE b/application/vendor/symfony/debug/Symfony/Component/Debug/LICENSE deleted file mode 100644 index 43028bc..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/README.md b/application/vendor/symfony/debug/Symfony/Component/Debug/README.md deleted file mode 100644 index 67e6d6c..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/README.md +++ /dev/null @@ -1,43 +0,0 @@ -Debug Component -=============== - -Debug provides tools to make debugging easier. - -Enabling all debug tools is as easy as calling the `enable()` method on the -main `Debug` class: - -```php -use Symfony\Component\Debug\Debug; - -Debug::enable(); -``` - -You can also use the tools individually: - -```php -use Symfony\Component\Debug\ErrorHandler; -use Symfony\Component\Debug\ExceptionHandler; - -if ('cli' !== php_sapi_name()) { - ini_set('display_errors', 0); - ExceptionHandler::register(); -} elseif (!ini_get('log_errors') || ini_get('error_log')) { - ini_set('display_errors', 1); -} -ErrorHandler::register(); -``` - -Note that the `Debug::enable()` call also registers the debug class loader -from the Symfony ClassLoader component when available. - -This component can optionally take advantage of the features of the HttpKernel -and HttpFoundation components. - -Resources ---------- - -You can run the unit tests with the following command: - - $ cd path/to/Symfony/Component/Debug/ - $ composer install - $ phpunit diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/README.rst b/application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/README.rst deleted file mode 100644 index b0d1c58..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/README.rst +++ /dev/null @@ -1,72 +0,0 @@ -Symfony Debug Extension -======================= - -This extension adds a ``symfony_zval_info($key, $array, $options = 0)`` function that: - -- exposes zval_hash/refcounts, allowing e.g. efficient exploration of arbitrary structures in PHP, -- does work with references, preventing memory copying. - -Its behavior is about the same as: - -.. code-block:: php - - gettype($array[$key]), - 'zval_hash' => /* hashed memory address of $array[$key] */, - 'zval_refcount' => /* internal zval refcount of $array[$key] */, - 'zval_isref' => /* is_ref status of $array[$key] */, - ); - - switch ($info['type']) { - case 'object': - $info += array( - 'object_class' => get_class($array[$key]), - 'object_refcount' => /* internal object refcount of $array[$key] */, - 'object_hash' => spl_object_hash($array[$key]), - 'object_handle' => /* internal object handle $array[$key] */, - ); - break; - - case 'resource': - $info += array( - 'resource_handle' => (int) $array[$key], - 'resource_type' => get_resource_type($array[$key]), - 'resource_refcount' => /* internal resource refcount of $array[$key] */, - ); - break; - - case 'array': - $info += array( - 'array_count' => count($array[$key]), - ); - break; - - case 'string': - $info += array( - 'strlen' => strlen($array[$key]), - ); - break; - } - - return $info; - } - -To enable the extension from source, run: - -.. code-block:: sh - - phpize - ./configure - make - sudo make install - diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/php_symfony_debug.h b/application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/php_symfony_debug.h deleted file mode 100644 index c935f67..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/php_symfony_debug.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#ifndef PHP_SYMFONY_DEBUG_H -#define PHP_SYMFONY_DEBUG_H - -extern zend_module_entry symfony_debug_module_entry; -#define phpext_symfony_debug_ptr &symfony_debug_module_entry - -#define PHP_SYMFONY_DEBUG_VERSION "1.0" - -#ifdef PHP_WIN32 -# define PHP_SYMFONY_DEBUG_API __declspec(dllexport) -#elif defined(__GNUC__) && __GNUC__ >= 4 -# define PHP_SYMFONY_DEBUG_API __attribute__ ((visibility("default"))) -#else -# define PHP_SYMFONY_DEBUG_API -#endif - -#ifdef ZTS -#include "TSRM.h" -#endif - -ZEND_BEGIN_MODULE_GLOBALS(symfony_debug) - intptr_t req_rand_init; -ZEND_END_MODULE_GLOBALS(symfony_debug) - -PHP_MINIT_FUNCTION(symfony_debug); -PHP_MSHUTDOWN_FUNCTION(symfony_debug); -PHP_RINIT_FUNCTION(symfony_debug); -PHP_RSHUTDOWN_FUNCTION(symfony_debug); -PHP_MINFO_FUNCTION(symfony_debug); -PHP_GINIT_FUNCTION(symfony_debug); -PHP_GSHUTDOWN_FUNCTION(symfony_debug); - -PHP_FUNCTION(symfony_zval_info); - -static char *_symfony_debug_memory_address_hash(void *); -static const char *_symfony_debug_zval_type(zval *); -static const char* _symfony_debug_get_resource_type(long); -static int _symfony_debug_get_resource_refcount(long); - -#ifdef ZTS -#define SYMFONY_DEBUG_G(v) TSRMG(symfony_debug_globals_id, zend_symfony_debug_globals *, v) -#else -#define SYMFONY_DEBUG_G(v) (symfony_debug_globals.v) -#endif - -#endif /* PHP_SYMFONY_DEBUG_H */ diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/symfony_debug.c b/application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/symfony_debug.c deleted file mode 100644 index 8dc5d43..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Resources/ext/symfony_debug.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "php_symfony_debug.h" -#include "ext/standard/php_rand.h" -#include "ext/standard/php_lcg.h" -#include "ext/spl/php_spl.h" -#include "Zend/zend_gc.h" - -ZEND_DECLARE_MODULE_GLOBALS(symfony_debug) - -ZEND_BEGIN_ARG_INFO_EX(symfony_zval_arginfo, 0, 0, 2) - ZEND_ARG_INFO(0, key) - ZEND_ARG_ARRAY_INFO(0, array, 0) - ZEND_ARG_INFO(0, options) -ZEND_END_ARG_INFO() - -const zend_function_entry symfony_debug_functions[] = { - PHP_FE(symfony_zval_info, symfony_zval_arginfo) - PHP_FE_END -}; - -PHP_FUNCTION(symfony_zval_info) -{ - zval *key = NULL, *arg = NULL; - zval **data = NULL; - HashTable *array = NULL; - long options = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "zh|l", &key, &array, &options) == FAILURE) { - return; - } - - switch (Z_TYPE_P(key)) { - case IS_STRING: - if (zend_symtable_find(array, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&data) == FAILURE) { - return; - } - break; - case IS_LONG: - if (zend_hash_index_find(array, Z_LVAL_P(key), (void **)&data)) { - return; - } - break; - } - - arg = *data; - - array_init(return_value); - - add_assoc_string(return_value, "type", (char *)_symfony_debug_zval_type(arg), 1); - add_assoc_stringl(return_value, "zval_hash", _symfony_debug_memory_address_hash((void *)arg), 16, 1); - add_assoc_long(return_value, "zval_refcount", Z_REFCOUNT_P(arg)); - add_assoc_bool(return_value, "zval_isref", (zend_bool)Z_ISREF_P(arg)); - - if (Z_TYPE_P(arg) == IS_OBJECT) { - static char hash[33] = {0}; - php_spl_object_hash(arg, (char *)hash); - add_assoc_stringl(return_value, "object_class", (char *)Z_OBJCE_P(arg)->name, Z_OBJCE_P(arg)->name_length, 1); - add_assoc_long(return_value, "object_refcount", EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(arg)].bucket.obj.refcount); - add_assoc_string(return_value, "object_hash", hash, 1); - add_assoc_long(return_value, "object_handle", Z_OBJ_HANDLE_P(arg)); - } else if (Z_TYPE_P(arg) == IS_ARRAY) { - add_assoc_long(return_value, "array_count", zend_hash_num_elements(Z_ARRVAL_P(arg))); - } else if(Z_TYPE_P(arg) == IS_RESOURCE) { - add_assoc_long(return_value, "resource_handle", Z_LVAL_P(arg)); - add_assoc_string(return_value, "resource_type", (char *)_symfony_debug_get_resource_type(Z_LVAL_P(arg)), 1); - add_assoc_long(return_value, "resource_refcount", _symfony_debug_get_resource_refcount(Z_LVAL_P(arg))); - } else if (Z_TYPE_P(arg) == IS_STRING) { - add_assoc_long(return_value, "strlen", Z_STRLEN_P(arg)); - } -} - -static const char* _symfony_debug_get_resource_type(long rsid) -{ - const char *res_type; - res_type = zend_rsrc_list_get_rsrc_type(rsid); - - if (!res_type) { - return "Unknown"; - } - - return res_type; -} - -static int _symfony_debug_get_resource_refcount(long rsid) -{ - zend_rsrc_list_entry *le; - - if (zend_hash_index_find(&EG(regular_list), rsid, (void **) &le)==SUCCESS) { - return le->refcount; - } - - return 0; -} - -static char *_symfony_debug_memory_address_hash(void *address) -{ - static char result[17] = {0}; - intptr_t address_rand; - - if (!SYMFONY_DEBUG_G(req_rand_init)) { - if (!BG(mt_rand_is_seeded)) { - php_mt_srand(GENERATE_SEED() TSRMLS_CC); - } - SYMFONY_DEBUG_G(req_rand_init) = (intptr_t)php_mt_rand(); - } - - address_rand = (intptr_t)address ^ SYMFONY_DEBUG_G(req_rand_init); - - snprintf(result, 17, "%016zx", address_rand); - - return result; -} - -static const char *_symfony_debug_zval_type(zval *zv) -{ - switch (Z_TYPE_P(zv)) { - case IS_NULL: - return "NULL"; - break; - - case IS_BOOL: - return "boolean"; - break; - - case IS_LONG: - return "integer"; - break; - - case IS_DOUBLE: - return "double"; - break; - - case IS_STRING: - return "string"; - break; - - case IS_ARRAY: - return "array"; - break; - - case IS_OBJECT: - return "object"; - - case IS_RESOURCE: - return "resource"; - - default: - return "unknown type"; - } -} - -zend_module_entry symfony_debug_module_entry = { - STANDARD_MODULE_HEADER, - "symfony_debug", - symfony_debug_functions, - PHP_MINIT(symfony_debug), - PHP_MSHUTDOWN(symfony_debug), - PHP_RINIT(symfony_debug), - PHP_RSHUTDOWN(symfony_debug), - PHP_MINFO(symfony_debug), - PHP_SYMFONY_DEBUG_VERSION, - PHP_MODULE_GLOBALS(symfony_debug), - PHP_GINIT(symfony_debug), - PHP_GSHUTDOWN(symfony_debug), - NULL, - STANDARD_MODULE_PROPERTIES_EX -}; - -#ifdef COMPILE_DL_SYMFONY_DEBUG -ZEND_GET_MODULE(symfony_debug) -#endif - -PHP_GINIT_FUNCTION(symfony_debug) -{ - symfony_debug_globals->req_rand_init = 0; -} - -PHP_GSHUTDOWN_FUNCTION(symfony_debug) -{ - -} - -PHP_MINIT_FUNCTION(symfony_debug) -{ - return SUCCESS; -} - -PHP_MSHUTDOWN_FUNCTION(symfony_debug) -{ - return SUCCESS; -} - -PHP_RINIT_FUNCTION(symfony_debug) -{ - return SUCCESS; -} - -PHP_RSHUTDOWN_FUNCTION(symfony_debug) -{ - return SUCCESS; -} - -PHP_MINFO_FUNCTION(symfony_debug) -{ - php_info_print_table_start(); - php_info_print_table_header(2, "Symfony Debug support", "enabled"); - php_info_print_table_header(2, "Symfony Debug version", PHP_SYMFONY_DEBUG_VERSION); - php_info_print_table_end(); -} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php b/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php deleted file mode 100644 index 9c4e23a..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php +++ /dev/null @@ -1,205 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Tests; - -use Symfony\Component\Debug\DebugClassLoader; -use Symfony\Component\Debug\ErrorHandler; -use Symfony\Component\Debug\Exception\ContextErrorException; - -class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var int Error reporting level before running tests. - */ - private $errorReporting; - - private $loader; - - protected function setUp() - { - $this->errorReporting = error_reporting(E_ALL | E_STRICT); - $this->loader = new ClassLoader(); - spl_autoload_register(array($this->loader, 'loadClass'), true, true); - DebugClassLoader::enable(); - } - - protected function tearDown() - { - DebugClassLoader::disable(); - spl_autoload_unregister(array($this->loader, 'loadClass')); - error_reporting($this->errorReporting); - } - - public function testIdempotence() - { - DebugClassLoader::enable(); - - $functions = spl_autoload_functions(); - foreach ($functions as $function) { - if (is_array($function) && $function[0] instanceof DebugClassLoader) { - $reflClass = new \ReflectionClass($function[0]); - $reflProp = $reflClass->getProperty('classLoader'); - $reflProp->setAccessible(true); - - $this->assertNotInstanceOf('Symfony\Component\Debug\DebugClassLoader', $reflProp->getValue($function[0])); - - return; - } - } - - $this->fail('DebugClassLoader did not register'); - } - - public function testUnsilencing() - { - if (PHP_VERSION_ID >= 70000) { - $this->markTestSkipped('PHP7 throws exceptions, unsilencing is not required anymore.'); - } - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('HHVM is not handled in this test case.'); - } - - ob_start(); - - $this->iniSet('log_errors', 0); - $this->iniSet('display_errors', 1); - - // See below: this will fail with parse error - // but this should not be @-silenced. - @class_exists(__NAMESPACE__.'\TestingUnsilencing', true); - - $output = ob_get_clean(); - - $this->assertStringMatchesFormat('%aParse error%a', $output); - } - - public function testStacking() - { - // the ContextErrorException must not be loaded to test the workaround - // for https://bugs.php.net/65322. - if (class_exists('Symfony\Component\Debug\Exception\ContextErrorException', false)) { - $this->markTestSkipped('The ContextErrorException class is already loaded.'); - } - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('HHVM is not handled in this test case.'); - } - - ErrorHandler::register(); - - try { - // Trigger autoloading + E_STRICT at compile time - // which in turn triggers $errorHandler->handle() - // that again triggers autoloading for ContextErrorException. - // Error stacking works around the bug above and everything is fine. - - eval(' - namespace '.__NAMESPACE__.'; - class ChildTestingStacking extends TestingStacking { function foo($bar) {} } - '); - $this->fail('ContextErrorException expected'); - } catch (\ErrorException $exception) { - // if an exception is thrown, the test passed - restore_error_handler(); - restore_exception_handler(); - $this->assertStringStartsWith(__FILE__, $exception->getFile()); - if (PHP_VERSION_ID < 70000) { - $this->assertRegExp('/^Runtime Notice: Declaration/', $exception->getMessage()); - $this->assertEquals(E_STRICT, $exception->getSeverity()); - } else { - $this->assertRegExp('/^Warning: Declaration/', $exception->getMessage()); - $this->assertEquals(E_WARNING, $exception->getSeverity()); - } - } catch (\Exception $exception) { - restore_error_handler(); - restore_exception_handler(); - - throw $exception; - } - } - - /** - * @expectedException \RuntimeException - */ - public function testNameCaseMismatch() - { - class_exists(__NAMESPACE__.'\TestingCaseMismatch', true); - } - - /** - * @expectedException \RuntimeException - * @expectedExceptionMessage Case mismatch between class and source file names - */ - public function testFileCaseMismatch() - { - if (!file_exists(__DIR__.'/Fixtures/CaseMismatch.php')) { - $this->markTestSkipped('Can only be run on case insensitive filesystems'); - } - - class_exists(__NAMESPACE__.'\Fixtures\CaseMismatch', true); - } - - /** - * @expectedException \RuntimeException - */ - public function testPsr4CaseMismatch() - { - class_exists(__NAMESPACE__.'\Fixtures\Psr4CaseMismatch', true); - } - - public function testNotPsr0() - { - $this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\NotPSR0', true)); - } - - public function testNotPsr0Bis() - { - $this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\NotPSR0bis', true)); - } - - public function testClassAlias() - { - $this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\ClassAlias', true)); - } -} - -class ClassLoader -{ - public function loadClass($class) - { - } - - public function getClassMap() - { - return array(__NAMESPACE__.'\Fixtures\NotPSR0bis' => __DIR__.'/Fixtures/notPsr0Bis.php'); - } - - public function findFile($class) - { - $fixtureDir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR; - - if (__NAMESPACE__.'\TestingUnsilencing' === $class) { - eval('-- parse error --'); - } elseif (__NAMESPACE__.'\TestingStacking' === $class) { - eval('namespace '.__NAMESPACE__.'; class TestingStacking { function foo() {} }'); - } elseif (__NAMESPACE__.'\TestingCaseMismatch' === $class) { - eval('namespace '.__NAMESPACE__.'; class TestingCaseMisMatch {}'); - } elseif (__NAMESPACE__.'\Fixtures\CaseMismatch' === $class) { - return $fixtureDir.'CaseMismatch.php'; - } elseif (__NAMESPACE__.'\Fixtures\Psr4CaseMismatch' === $class) { - return $fixtureDir.'psr4'.DIRECTORY_SEPARATOR.'Psr4CaseMismatch.php'; - } elseif (__NAMESPACE__.'\Fixtures\NotPSR0' === $class) { - return $fixtureDir.'reallyNotPsr0.php'; - } elseif (__NAMESPACE__.'\Fixtures\NotPSR0bis' === $class) { - return $fixtureDir.'notPsr0Bis.php'; - } - } -} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/ErrorHandlerTest.php deleted file mode 100644 index 3b0cc7b..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ /dev/null @@ -1,485 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Tests; - -use Psr\Log\LogLevel; -use Symfony\Component\Debug\ErrorHandler; -use Symfony\Component\Debug\Exception\ContextErrorException; - -/** - * ErrorHandlerTest. - * - * @author Robert Schönthal - * @author Nicolas Grekas - */ -class ErrorHandlerTest extends \PHPUnit_Framework_TestCase -{ - public function testRegister() - { - $handler = ErrorHandler::register(); - - try { - $this->assertInstanceOf('Symfony\Component\Debug\ErrorHandler', $handler); - $this->assertSame($handler, ErrorHandler::register()); - - $newHandler = new ErrorHandler(); - - $this->assertSame($newHandler, ErrorHandler::register($newHandler, false)); - $h = set_error_handler('var_dump'); - restore_error_handler(); - $this->assertSame(array($handler, 'handleError'), $h); - - try { - $this->assertSame($newHandler, ErrorHandler::register($newHandler, true)); - $h = set_error_handler('var_dump'); - restore_error_handler(); - $this->assertSame(array($newHandler, 'handleError'), $h); - } catch (\Exception $e) { - } - - restore_error_handler(); - restore_exception_handler(); - - if (isset($e)) { - throw $e; - } - } catch (\Exception $e) { - } - - restore_error_handler(); - restore_exception_handler(); - - if (isset($e)) { - throw $e; - } - } - - public function testNotice() - { - ErrorHandler::register(); - - try { - self::triggerNotice($this); - $this->fail('ContextErrorException expected'); - } catch (ContextErrorException $exception) { - // if an exception is thrown, the test passed - restore_error_handler(); - restore_exception_handler(); - - $this->assertEquals(E_NOTICE, $exception->getSeverity()); - $this->assertEquals(__FILE__, $exception->getFile()); - $this->assertRegExp('/^Notice: Undefined variable: (foo|bar)/', $exception->getMessage()); - $this->assertArrayHasKey('foobar', $exception->getContext()); - - $trace = $exception->getTrace(); - $this->assertEquals(__FILE__, $trace[0]['file']); - $this->assertEquals('Symfony\Component\Debug\ErrorHandler', $trace[0]['class']); - $this->assertEquals('handleError', $trace[0]['function']); - $this->assertEquals('->', $trace[0]['type']); - - $this->assertEquals(__FILE__, $trace[1]['file']); - $this->assertEquals(__CLASS__, $trace[1]['class']); - $this->assertEquals('triggerNotice', $trace[1]['function']); - $this->assertEquals('::', $trace[1]['type']); - - $this->assertEquals(__FILE__, $trace[1]['file']); - $this->assertEquals(__CLASS__, $trace[2]['class']); - $this->assertEquals(__FUNCTION__, $trace[2]['function']); - $this->assertEquals('->', $trace[2]['type']); - } catch (\Exception $e) { - restore_error_handler(); - restore_exception_handler(); - - throw $e; - } - } - - // dummy function to test trace in error handler. - private static function triggerNotice($that) - { - // dummy variable to check for in error handler. - $foobar = 123; - $that->assertSame('', $foo.$foo.$bar); - } - - public function testConstruct() - { - try { - $handler = ErrorHandler::register(); - $handler->throwAt(3, true); - $this->assertEquals(3 | E_RECOVERABLE_ERROR | E_USER_ERROR, $handler->throwAt(0)); - - restore_error_handler(); - restore_exception_handler(); - } catch (\Exception $e) { - restore_error_handler(); - restore_exception_handler(); - - throw $e; - } - } - - public function testDefaultLogger() - { - try { - $handler = ErrorHandler::register(); - - $logger = $this->getMock('Psr\Log\LoggerInterface'); - - $handler->setDefaultLogger($logger, E_NOTICE); - $handler->setDefaultLogger($logger, array(E_USER_NOTICE => LogLevel::CRITICAL)); - - $loggers = array( - E_DEPRECATED => array(null, LogLevel::INFO), - E_USER_DEPRECATED => array(null, LogLevel::INFO), - E_NOTICE => array($logger, LogLevel::NOTICE), - E_USER_NOTICE => array($logger, LogLevel::CRITICAL), - E_STRICT => array(null, LogLevel::NOTICE), - E_WARNING => array(null, LogLevel::WARNING), - E_USER_WARNING => array(null, LogLevel::WARNING), - E_COMPILE_WARNING => array(null, LogLevel::WARNING), - E_CORE_WARNING => array(null, LogLevel::WARNING), - E_USER_ERROR => array(null, LogLevel::ERROR), - E_RECOVERABLE_ERROR => array(null, LogLevel::ERROR), - E_COMPILE_ERROR => array(null, LogLevel::EMERGENCY), - E_PARSE => array(null, LogLevel::EMERGENCY), - E_ERROR => array(null, LogLevel::EMERGENCY), - E_CORE_ERROR => array(null, LogLevel::EMERGENCY), - ); - $this->assertSame($loggers, $handler->setLoggers(array())); - - restore_error_handler(); - restore_exception_handler(); - } catch (\Exception $e) { - restore_error_handler(); - restore_exception_handler(); - - throw $e; - } - } - - public function testHandleError() - { - $this->iniSet('error_reporting', -1); - - try { - $handler = ErrorHandler::register(); - $handler->throwAt(0, true); - $this->assertFalse($handler->handleError(0, 'foo', 'foo.php', 12, array())); - - restore_error_handler(); - restore_exception_handler(); - - $handler = ErrorHandler::register(); - $handler->throwAt(3, true); - $this->assertFalse($handler->handleError(4, 'foo', 'foo.php', 12, array())); - - restore_error_handler(); - restore_exception_handler(); - - $handler = ErrorHandler::register(); - $handler->throwAt(3, true); - try { - $handler->handleError(4, 'foo', 'foo.php', 12, array()); - } catch (\ErrorException $e) { - $this->assertSame('Parse Error: foo', $e->getMessage()); - $this->assertSame(4, $e->getSeverity()); - $this->assertSame('foo.php', $e->getFile()); - $this->assertSame(12, $e->getLine()); - } - - restore_error_handler(); - restore_exception_handler(); - - $handler = ErrorHandler::register(); - $handler->throwAt(E_USER_DEPRECATED, true); - $this->assertFalse($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, array())); - - restore_error_handler(); - restore_exception_handler(); - - $handler = ErrorHandler::register(); - $handler->throwAt(E_DEPRECATED, true); - $this->assertFalse($handler->handleError(E_DEPRECATED, 'foo', 'foo.php', 12, array())); - - restore_error_handler(); - restore_exception_handler(); - - $logger = $this->getMock('Psr\Log\LoggerInterface'); - - $that = $this; - $warnArgCheck = function ($logLevel, $message, $context) use ($that) { - $that->assertEquals('info', $logLevel); - $that->assertEquals('foo', $message); - $that->assertArrayHasKey('type', $context); - $that->assertEquals($context['type'], E_USER_DEPRECATED); - $that->assertArrayHasKey('stack', $context); - $that->assertInternalType('array', $context['stack']); - }; - - $logger - ->expects($this->once()) - ->method('log') - ->will($this->returnCallback($warnArgCheck)) - ; - - $handler = ErrorHandler::register(); - $handler->setDefaultLogger($logger, E_USER_DEPRECATED); - $this->assertTrue($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, array())); - - restore_error_handler(); - restore_exception_handler(); - - $logger = $this->getMock('Psr\Log\LoggerInterface'); - - $that = $this; - $logArgCheck = function ($level, $message, $context) use ($that) { - $that->assertEquals('Undefined variable: undefVar', $message); - $that->assertArrayHasKey('type', $context); - $that->assertEquals($context['type'], E_NOTICE); - }; - - $logger - ->expects($this->once()) - ->method('log') - ->will($this->returnCallback($logArgCheck)) - ; - - $handler = ErrorHandler::register(); - $handler->setDefaultLogger($logger, E_NOTICE); - $handler->screamAt(E_NOTICE); - unset($undefVar); - @$undefVar++; - - restore_error_handler(); - restore_exception_handler(); - } catch (\Exception $e) { - restore_error_handler(); - restore_exception_handler(); - - throw $e; - } - } - - public function testHandleException() - { - try { - $handler = ErrorHandler::register(); - - $exception = new \Exception('foo'); - - $logger = $this->getMock('Psr\Log\LoggerInterface'); - - $that = $this; - $logArgCheck = function ($level, $message, $context) use ($that) { - $that->assertEquals('Uncaught Exception: foo', $message); - $that->assertArrayHasKey('type', $context); - $that->assertEquals($context['type'], E_ERROR); - }; - - $logger - ->expects($this->exactly(2)) - ->method('log') - ->will($this->returnCallback($logArgCheck)) - ; - - $handler->setDefaultLogger($logger, E_ERROR); - - try { - $handler->handleException($exception); - $this->fail('Exception expected'); - } catch (\Exception $e) { - $this->assertSame($exception, $e); - } - - $that = $this; - $handler->setExceptionHandler(function ($e) use ($exception, $that) { - $that->assertSame($exception, $e); - }); - - $handler->handleException($exception); - - restore_error_handler(); - restore_exception_handler(); - } catch (\Exception $e) { - restore_error_handler(); - restore_exception_handler(); - - throw $e; - } - } - - public function testErrorStacking() - { - try { - $handler = ErrorHandler::register(); - $handler->screamAt(E_USER_WARNING); - - $logger = $this->getMock('Psr\Log\LoggerInterface'); - - $logger - ->expects($this->exactly(2)) - ->method('log') - ->withConsecutive( - array($this->equalTo(LogLevel::WARNING), $this->equalTo('Dummy log')), - array($this->equalTo(LogLevel::DEBUG), $this->equalTo('Silenced warning')) - ) - ; - - $handler->setDefaultLogger($logger, array(E_USER_WARNING => LogLevel::WARNING)); - - ErrorHandler::stackErrors(); - @trigger_error('Silenced warning', E_USER_WARNING); - $logger->log(LogLevel::WARNING, 'Dummy log'); - ErrorHandler::unstackErrors(); - - restore_error_handler(); - restore_exception_handler(); - } catch (\Exception $e) { - restore_error_handler(); - restore_exception_handler(); - - throw $e; - } - } - - public function testHandleFatalError() - { - try { - $handler = ErrorHandler::register(); - - $error = array( - 'type' => E_PARSE, - 'message' => 'foo', - 'file' => 'bar', - 'line' => 123, - ); - - $logger = $this->getMock('Psr\Log\LoggerInterface'); - - $that = $this; - $logArgCheck = function ($level, $message, $context) use ($that) { - $that->assertEquals('Fatal Parse Error: foo', $message); - $that->assertArrayHasKey('type', $context); - $that->assertEquals($context['type'], E_PARSE); - }; - - $logger - ->expects($this->once()) - ->method('log') - ->will($this->returnCallback($logArgCheck)) - ; - - $handler->setDefaultLogger($logger, E_PARSE); - - $handler->handleFatalError($error); - - restore_error_handler(); - restore_exception_handler(); - } catch (\Exception $e) { - restore_error_handler(); - restore_exception_handler(); - - throw $e; - } - } - - public function testHandleFatalErrorOnHHVM() - { - try { - $handler = ErrorHandler::register(); - - $logger = $this->getMock('Psr\Log\LoggerInterface'); - $logger - ->expects($this->once()) - ->method('log') - ->with( - $this->equalTo(LogLevel::EMERGENCY), - $this->equalTo('Fatal Error: foo'), - $this->equalTo(array( - 'type' => 1, - 'file' => 'bar', - 'line' => 123, - 'level' => -1, - 'stack' => array(456), - )) - ) - ; - - $handler->setDefaultLogger($logger, E_ERROR); - - $error = array( - 'type' => E_ERROR + 0x1000000, // This error level is used by HHVM for fatal errors - 'message' => 'foo', - 'file' => 'bar', - 'line' => 123, - 'context' => array(123), - 'backtrace' => array(456), - ); - - call_user_func_array(array($handler, 'handleError'), $error); - $handler->handleFatalError($error); - - restore_error_handler(); - restore_exception_handler(); - } catch (\Exception $e) { - restore_error_handler(); - restore_exception_handler(); - - throw $e; - } - } - - /** - * @group legacy - */ - public function testLegacyInterface() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - try { - $handler = ErrorHandler::register(0); - $this->assertFalse($handler->handle(0, 'foo', 'foo.php', 12, array())); - - restore_error_handler(); - restore_exception_handler(); - - $logger = $this->getMock('Psr\Log\LoggerInterface'); - - $that = $this; - $logArgCheck = function ($level, $message, $context) use ($that) { - $that->assertEquals('Undefined variable: undefVar', $message); - $that->assertArrayHasKey('type', $context); - $that->assertEquals($context['type'], E_NOTICE); - }; - - $logger - ->expects($this->once()) - ->method('log') - ->will($this->returnCallback($logArgCheck)) - ; - - $handler = ErrorHandler::register(E_NOTICE); - $handler->setLogger($logger, 'scream'); - unset($undefVar); - @$undefVar++; - - restore_error_handler(); - restore_exception_handler(); - } catch (\Exception $e) { - restore_error_handler(); - restore_exception_handler(); - - throw $e; - } - } -} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php b/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php deleted file mode 100644 index 26f8892..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Tests; - -use Symfony\Component\Debug\ExceptionHandler; -use Symfony\Component\Debug\Exception\OutOfMemoryException; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; - -class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase -{ - public function testDebug() - { - $handler = new ExceptionHandler(false); - $response = $handler->createResponse(new \RuntimeException('Foo')); - - $this->assertContains('

    Whoops, looks like something went wrong.

    ', $response->getContent()); - $this->assertNotContains('

    ', $response->getContent()); - - $handler = new ExceptionHandler(true); - $response = $handler->createResponse(new \RuntimeException('Foo')); - - $this->assertContains('

    Whoops, looks like something went wrong.

    ', $response->getContent()); - $this->assertContains('

    ', $response->getContent()); - } - - public function testStatusCode() - { - $handler = new ExceptionHandler(false); - - $response = $handler->createResponse(new \RuntimeException('Foo')); - $this->assertEquals('500', $response->getStatusCode()); - $this->assertContains('Whoops, looks like something went wrong.', $response->getContent()); - - $response = $handler->createResponse(new NotFoundHttpException('Foo')); - $this->assertEquals('404', $response->getStatusCode()); - $this->assertContains('Sorry, the page you are looking for could not be found.', $response->getContent()); - } - - public function testHeaders() - { - $handler = new ExceptionHandler(false); - - $response = $handler->createResponse(new MethodNotAllowedHttpException(array('POST'))); - $this->assertEquals('405', $response->getStatusCode()); - $this->assertEquals('POST', $response->headers->get('Allow')); - } - - public function testNestedExceptions() - { - $handler = new ExceptionHandler(true); - $response = $handler->createResponse(new \RuntimeException('Foo', 0, new \RuntimeException('Bar'))); - } - - public function testHandle() - { - $exception = new \Exception('foo'); - - if (class_exists('Symfony\Component\HttpFoundation\Response')) { - $handler = $this->getMock('Symfony\Component\Debug\ExceptionHandler', array('createResponse')); - $handler - ->expects($this->exactly(2)) - ->method('createResponse') - ->will($this->returnValue(new Response())); - } else { - $handler = $this->getMock('Symfony\Component\Debug\ExceptionHandler', array('sendPhpResponse')); - $handler - ->expects($this->exactly(2)) - ->method('sendPhpResponse'); - } - - $handler->handle($exception); - - $that = $this; - $handler->setHandler(function ($e) use ($exception, $that) { - $that->assertSame($exception, $e); - }); - - $handler->handle($exception); - } - - public function testHandleOutOfMemoryException() - { - $exception = new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, __LINE__); - - if (class_exists('Symfony\Component\HttpFoundation\Response')) { - $handler = $this->getMock('Symfony\Component\Debug\ExceptionHandler', array('createResponse')); - $handler - ->expects($this->once()) - ->method('createResponse') - ->will($this->returnValue(new Response())); - } else { - $handler = $this->getMock('Symfony\Component\Debug\ExceptionHandler', array('sendPhpResponse')); - $handler - ->expects($this->once()) - ->method('sendPhpResponse'); - } - - $that = $this; - $handler->setHandler(function ($e) use ($that) { - $that->fail('OutOfMemoryException should bypass the handler'); - }); - - $handler->handle($exception); - } -} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php b/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php deleted file mode 100644 index 794bf4c..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Tests\FatalErrorHandler; - -use Symfony\Component\Debug\Exception\FatalErrorException; -use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler; - -class UndefinedMethodFatalErrorHandlerTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider provideUndefinedMethodData - */ - public function testUndefinedMethod($error, $translatedMessage) - { - $handler = new UndefinedMethodFatalErrorHandler(); - $exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line'])); - - $this->assertInstanceOf('Symfony\Component\Debug\Exception\UndefinedMethodException', $exception); - $this->assertSame($translatedMessage, $exception->getMessage()); - $this->assertSame($error['type'], $exception->getSeverity()); - $this->assertSame($error['file'], $exception->getFile()); - $this->assertSame($error['line'], $exception->getLine()); - } - - public function provideUndefinedMethodData() - { - return array( - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Call to undefined method SplObjectStorage::what()', - ), - 'Attempted to call method "what" on class "SplObjectStorage".', - ), - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Call to undefined method SplObjectStorage::walid()', - ), - "Attempted to call method \"walid\" on class \"SplObjectStorage\".\nDid you mean to call \"valid\"?", - ), - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Call to undefined method SplObjectStorage::offsetFet()', - ), - "Attempted to call method \"offsetFet\" on class \"SplObjectStorage\".\nDid you mean to call e.g. \"offsetGet\", \"offsetSet\" or \"offsetUnset\"?", - ), - ); - } -} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/composer.json b/application/vendor/symfony/debug/Symfony/Component/Debug/composer.json deleted file mode 100644 index 2d10181..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/composer.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "symfony/debug", - "type": "library", - "description": "Symfony Debug Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.3", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7", - "symfony/class-loader": "~2.2", - "symfony/http-kernel": "~2.3.24|~2.5.9|~2.6,>=2.6.2", - "symfony/http-foundation": "~2.1" - }, - "suggest": { - "symfony/http-foundation": "", - "symfony/http-kernel": "" - }, - "autoload": { - "psr-0": { "Symfony\\Component\\Debug\\": "" } - }, - "target-dir": "Symfony/Component/Debug", - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - } -} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/phpunit.xml.dist b/application/vendor/symfony/debug/Symfony/Component/Debug/phpunit.xml.dist deleted file mode 100644 index e917660..0000000 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/phpunit.xml.dist +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Tests - ./vendor - - - - diff --git a/application/vendor/symfony/debug/Tests/DebugClassLoaderTest.php b/application/vendor/symfony/debug/Tests/DebugClassLoaderTest.php new file mode 100644 index 0000000..437f1e2 --- /dev/null +++ b/application/vendor/symfony/debug/Tests/DebugClassLoaderTest.php @@ -0,0 +1,315 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Debug\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Debug\DebugClassLoader; +use Symfony\Component\Debug\ErrorHandler; + +class DebugClassLoaderTest extends TestCase +{ + /** + * @var int Error reporting level before running tests + */ + private $errorReporting; + + private $loader; + + protected function setUp() + { + $this->errorReporting = error_reporting(E_ALL | E_STRICT); + $this->loader = new ClassLoader(); + spl_autoload_register(array($this->loader, 'loadClass'), true, true); + DebugClassLoader::enable(); + } + + protected function tearDown() + { + DebugClassLoader::disable(); + spl_autoload_unregister(array($this->loader, 'loadClass')); + error_reporting($this->errorReporting); + } + + public function testIdempotence() + { + DebugClassLoader::enable(); + + $functions = spl_autoload_functions(); + foreach ($functions as $function) { + if (is_array($function) && $function[0] instanceof DebugClassLoader) { + $reflClass = new \ReflectionClass($function[0]); + $reflProp = $reflClass->getProperty('classLoader'); + $reflProp->setAccessible(true); + + $this->assertNotInstanceOf('Symfony\Component\Debug\DebugClassLoader', $reflProp->getValue($function[0])); + + return; + } + } + + $this->fail('DebugClassLoader did not register'); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage boo + */ + public function testThrowingClass() + { + try { + class_exists(__NAMESPACE__.'\Fixtures\Throwing'); + $this->fail('Exception expected'); + } catch (\Exception $e) { + $this->assertSame('boo', $e->getMessage()); + } + + // the second call also should throw + class_exists(__NAMESPACE__.'\Fixtures\Throwing'); + } + + public function testUnsilencing() + { + if (\PHP_VERSION_ID >= 70000) { + $this->markTestSkipped('PHP7 throws exceptions, unsilencing is not required anymore.'); + } + if (defined('HHVM_VERSION')) { + $this->markTestSkipped('HHVM is not handled in this test case.'); + } + + ob_start(); + + $this->iniSet('log_errors', 0); + $this->iniSet('display_errors', 1); + + // See below: this will fail with parse error + // but this should not be @-silenced. + @class_exists(__NAMESPACE__.'\TestingUnsilencing', true); + + $output = ob_get_clean(); + + $this->assertStringMatchesFormat('%aParse error%a', $output); + } + + public function testStacking() + { + // the ContextErrorException must not be loaded to test the workaround + // for https://bugs.php.net/65322. + if (class_exists('Symfony\Component\Debug\Exception\ContextErrorException', false)) { + $this->markTestSkipped('The ContextErrorException class is already loaded.'); + } + if (defined('HHVM_VERSION')) { + $this->markTestSkipped('HHVM is not handled in this test case.'); + } + + ErrorHandler::register(); + + try { + // Trigger autoloading + E_STRICT at compile time + // which in turn triggers $errorHandler->handle() + // that again triggers autoloading for ContextErrorException. + // Error stacking works around the bug above and everything is fine. + + eval(' + namespace '.__NAMESPACE__.'; + class ChildTestingStacking extends TestingStacking { function foo($bar) {} } + '); + $this->fail('ContextErrorException expected'); + } catch (\ErrorException $exception) { + // if an exception is thrown, the test passed + restore_error_handler(); + restore_exception_handler(); + $this->assertStringStartsWith(__FILE__, $exception->getFile()); + if (\PHP_VERSION_ID < 70000) { + $this->assertRegExp('/^Runtime Notice: Declaration/', $exception->getMessage()); + $this->assertEquals(E_STRICT, $exception->getSeverity()); + } else { + $this->assertRegExp('/^Warning: Declaration/', $exception->getMessage()); + $this->assertEquals(E_WARNING, $exception->getSeverity()); + } + } catch (\Exception $exception) { + restore_error_handler(); + restore_exception_handler(); + + throw $exception; + } + } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage Case mismatch between loaded and declared class names + */ + public function testNameCaseMismatch() + { + class_exists(__NAMESPACE__.'\TestingCaseMismatch', true); + } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage Case mismatch between class and real file names + */ + public function testFileCaseMismatch() + { + if (!file_exists(__DIR__.'/Fixtures/CaseMismatch.php')) { + $this->markTestSkipped('Can only be run on case insensitive filesystems'); + } + + class_exists(__NAMESPACE__.'\Fixtures\CaseMismatch', true); + } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage Case mismatch between loaded and declared class names + */ + public function testPsr4CaseMismatch() + { + class_exists(__NAMESPACE__.'\Fixtures\Psr4CaseMismatch', true); + } + + public function testNotPsr0() + { + $this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\NotPSR0', true)); + } + + public function testNotPsr0Bis() + { + $this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\NotPSR0bis', true)); + } + + public function testClassAlias() + { + $this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\ClassAlias', true)); + } + + /** + * @dataProvider provideDeprecatedSuper + */ + public function testDeprecatedSuper($class, $super, $type) + { + set_error_handler(function () { return false; }); + $e = error_reporting(0); + trigger_error('', E_USER_DEPRECATED); + + class_exists('Test\\'.__NAMESPACE__.'\\'.$class, true); + + error_reporting($e); + restore_error_handler(); + + $lastError = error_get_last(); + unset($lastError['file'], $lastError['line']); + + $xError = array( + 'type' => E_USER_DEPRECATED, + 'message' => 'The Test\Symfony\Component\Debug\Tests\\'.$class.' class '.$type.' Symfony\Component\Debug\Tests\Fixtures\\'.$super.' that is deprecated but this is a test deprecation notice', + ); + + $this->assertSame($xError, $lastError); + } + + public function provideDeprecatedSuper() + { + return array( + array('DeprecatedInterfaceClass', 'DeprecatedInterface', 'implements'), + array('DeprecatedParentClass', 'DeprecatedClass', 'extends'), + ); + } + + public function testDeprecatedSuperInSameNamespace() + { + set_error_handler(function () { return false; }); + $e = error_reporting(0); + trigger_error('', E_USER_NOTICE); + + class_exists('Symfony\Bridge\Debug\Tests\Fixtures\ExtendsDeprecatedParent', true); + + error_reporting($e); + restore_error_handler(); + + $lastError = error_get_last(); + unset($lastError['file'], $lastError['line']); + + $xError = array( + 'type' => E_USER_NOTICE, + 'message' => '', + ); + + $this->assertSame($xError, $lastError); + } + + public function testReservedForPhp7() + { + if (\PHP_VERSION_ID >= 70000) { + $this->markTestSkipped('PHP7 already prevents using reserved names.'); + } + + set_error_handler(function () { return false; }); + $e = error_reporting(0); + trigger_error('', E_USER_NOTICE); + + class_exists('Test\\'.__NAMESPACE__.'\\Float', true); + + error_reporting($e); + restore_error_handler(); + + $lastError = error_get_last(); + unset($lastError['file'], $lastError['line']); + + $xError = array( + 'type' => E_USER_DEPRECATED, + 'message' => 'Test\Symfony\Component\Debug\Tests\Float uses a reserved class name (Float) that will break on PHP 7 and higher', + ); + + $this->assertSame($xError, $lastError); + } +} + +class ClassLoader +{ + public function loadClass($class) + { + } + + public function getClassMap() + { + return array(__NAMESPACE__.'\Fixtures\NotPSR0bis' => __DIR__.'/Fixtures/notPsr0Bis.php'); + } + + public function findFile($class) + { + $fixtureDir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR; + + if (__NAMESPACE__.'\TestingUnsilencing' === $class) { + eval('-- parse error --'); + } elseif (__NAMESPACE__.'\TestingStacking' === $class) { + eval('namespace '.__NAMESPACE__.'; class TestingStacking { function foo() {} }'); + } elseif (__NAMESPACE__.'\TestingCaseMismatch' === $class) { + eval('namespace '.__NAMESPACE__.'; class TestingCaseMisMatch {}'); + } elseif (__NAMESPACE__.'\Fixtures\CaseMismatch' === $class) { + return $fixtureDir.'CaseMismatch.php'; + } elseif (__NAMESPACE__.'\Fixtures\Psr4CaseMismatch' === $class) { + return $fixtureDir.'psr4'.DIRECTORY_SEPARATOR.'Psr4CaseMismatch.php'; + } elseif (__NAMESPACE__.'\Fixtures\NotPSR0' === $class) { + return $fixtureDir.'reallyNotPsr0.php'; + } elseif (__NAMESPACE__.'\Fixtures\NotPSR0bis' === $class) { + return $fixtureDir.'notPsr0Bis.php'; + } elseif (__NAMESPACE__.'\Fixtures\DeprecatedInterface' === $class) { + return $fixtureDir.'DeprecatedInterface.php'; + } elseif ('Symfony\Bridge\Debug\Tests\Fixtures\ExtendsDeprecatedParent' === $class) { + eval('namespace Symfony\Bridge\Debug\Tests\Fixtures; class ExtendsDeprecatedParent extends \\'.__NAMESPACE__.'\Fixtures\DeprecatedClass {}'); + } elseif ('Test\\'.__NAMESPACE__.'\DeprecatedParentClass' === $class) { + eval('namespace Test\\'.__NAMESPACE__.'; class DeprecatedParentClass extends \\'.__NAMESPACE__.'\Fixtures\DeprecatedClass {}'); + } elseif ('Test\\'.__NAMESPACE__.'\DeprecatedInterfaceClass' === $class) { + eval('namespace Test\\'.__NAMESPACE__.'; class DeprecatedInterfaceClass implements \\'.__NAMESPACE__.'\Fixtures\DeprecatedInterface {}'); + } elseif ('Test\\'.__NAMESPACE__.'\Float' === $class) { + eval('namespace Test\\'.__NAMESPACE__.'; class Float {}'); + } + } +} diff --git a/application/vendor/symfony/debug/Tests/ErrorHandlerTest.php b/application/vendor/symfony/debug/Tests/ErrorHandlerTest.php new file mode 100644 index 0000000..d8f4a74 --- /dev/null +++ b/application/vendor/symfony/debug/Tests/ErrorHandlerTest.php @@ -0,0 +1,571 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Debug\Tests; + +use PHPUnit\Framework\TestCase; +use Psr\Log\LogLevel; +use Symfony\Component\Debug\ErrorHandler; +use Symfony\Component\Debug\Exception\ContextErrorException; + +/** + * ErrorHandlerTest. + * + * @author Robert Schönthal + * @author Nicolas Grekas + */ +class ErrorHandlerTest extends TestCase +{ + public function testRegister() + { + $handler = ErrorHandler::register(); + + try { + $this->assertInstanceOf('Symfony\Component\Debug\ErrorHandler', $handler); + $this->assertSame($handler, ErrorHandler::register()); + + $newHandler = new ErrorHandler(); + + $this->assertSame($handler, ErrorHandler::register($newHandler, false)); + $h = set_error_handler('var_dump'); + restore_error_handler(); + $this->assertSame(array($handler, 'handleError'), $h); + + try { + $this->assertSame($newHandler, ErrorHandler::register($newHandler, true)); + $h = set_error_handler('var_dump'); + restore_error_handler(); + $this->assertSame(array($newHandler, 'handleError'), $h); + } catch (\Exception $e) { + } + + restore_error_handler(); + restore_exception_handler(); + + if (isset($e)) { + throw $e; + } + } catch (\Exception $e) { + } + + restore_error_handler(); + restore_exception_handler(); + + if (isset($e)) { + throw $e; + } + } + + public function testErrorGetLast() + { + $handler = ErrorHandler::register(); + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + $handler->setDefaultLogger($logger); + $handler->screamAt(E_ALL); + + try { + @trigger_error('Hello', E_USER_WARNING); + $expected = array( + 'type' => E_USER_WARNING, + 'message' => 'Hello', + 'file' => __FILE__, + 'line' => __LINE__ - 5, + ); + $this->assertSame($expected, error_get_last()); + } catch (\Exception $e) { + restore_error_handler(); + restore_exception_handler(); + + throw $e; + } + } + + public function testNotice() + { + ErrorHandler::register(); + + try { + self::triggerNotice($this); + $this->fail('ContextErrorException expected'); + } catch (ContextErrorException $exception) { + // if an exception is thrown, the test passed + restore_error_handler(); + restore_exception_handler(); + + $this->assertEquals(E_NOTICE, $exception->getSeverity()); + $this->assertEquals(__FILE__, $exception->getFile()); + $this->assertRegExp('/^Notice: Undefined variable: (foo|bar)/', $exception->getMessage()); + if (\PHP_VERSION_ID < 70200) { + $this->assertArrayHasKey('foobar', $exception->getContext()); + } + + $trace = $exception->getTrace(); + $this->assertEquals(__FILE__, $trace[0]['file']); + $this->assertEquals('Symfony\Component\Debug\ErrorHandler', $trace[0]['class']); + $this->assertEquals('handleError', $trace[0]['function']); + $this->assertEquals('->', $trace[0]['type']); + + $this->assertEquals(__FILE__, $trace[1]['file']); + $this->assertEquals(__CLASS__, $trace[1]['class']); + $this->assertEquals('triggerNotice', $trace[1]['function']); + $this->assertEquals('::', $trace[1]['type']); + + $this->assertEquals(__FILE__, $trace[1]['file']); + $this->assertEquals(__CLASS__, $trace[2]['class']); + $this->assertEquals(__FUNCTION__, $trace[2]['function']); + $this->assertEquals('->', $trace[2]['type']); + } catch (\Exception $e) { + restore_error_handler(); + restore_exception_handler(); + + throw $e; + } + } + + // dummy function to test trace in error handler. + private static function triggerNotice($that) + { + // dummy variable to check for in error handler. + $foobar = 123; + $that->assertSame('', $foo.$foo.$bar); + } + + public function testConstruct() + { + try { + $handler = ErrorHandler::register(); + $handler->throwAt(3, true); + $this->assertEquals(3 | E_RECOVERABLE_ERROR | E_USER_ERROR, $handler->throwAt(0)); + + restore_error_handler(); + restore_exception_handler(); + } catch (\Exception $e) { + restore_error_handler(); + restore_exception_handler(); + + throw $e; + } + } + + public function testDefaultLogger() + { + try { + $handler = ErrorHandler::register(); + + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + + $handler->setDefaultLogger($logger, E_NOTICE); + $handler->setDefaultLogger($logger, array(E_USER_NOTICE => LogLevel::CRITICAL)); + + $loggers = array( + E_DEPRECATED => array(null, LogLevel::INFO), + E_USER_DEPRECATED => array(null, LogLevel::INFO), + E_NOTICE => array($logger, LogLevel::WARNING), + E_USER_NOTICE => array($logger, LogLevel::CRITICAL), + E_STRICT => array(null, LogLevel::WARNING), + E_WARNING => array(null, LogLevel::WARNING), + E_USER_WARNING => array(null, LogLevel::WARNING), + E_COMPILE_WARNING => array(null, LogLevel::WARNING), + E_CORE_WARNING => array(null, LogLevel::WARNING), + E_USER_ERROR => array(null, LogLevel::CRITICAL), + E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL), + E_COMPILE_ERROR => array(null, LogLevel::CRITICAL), + E_PARSE => array(null, LogLevel::CRITICAL), + E_ERROR => array(null, LogLevel::CRITICAL), + E_CORE_ERROR => array(null, LogLevel::CRITICAL), + ); + $this->assertSame($loggers, $handler->setLoggers(array())); + + restore_error_handler(); + restore_exception_handler(); + } catch (\Exception $e) { + restore_error_handler(); + restore_exception_handler(); + + throw $e; + } + } + + public function testHandleError() + { + try { + $handler = ErrorHandler::register(); + $handler->throwAt(0, true); + $this->assertFalse($handler->handleError(0, 'foo', 'foo.php', 12, array())); + + restore_error_handler(); + restore_exception_handler(); + + $handler = ErrorHandler::register(); + $handler->throwAt(3, true); + $this->assertFalse($handler->handleError(4, 'foo', 'foo.php', 12, array())); + + restore_error_handler(); + restore_exception_handler(); + + $handler = ErrorHandler::register(); + $handler->throwAt(3, true); + try { + $handler->handleError(4, 'foo', 'foo.php', 12, array()); + } catch (\ErrorException $e) { + $this->assertSame('Parse Error: foo', $e->getMessage()); + $this->assertSame(4, $e->getSeverity()); + $this->assertSame('foo.php', $e->getFile()); + $this->assertSame(12, $e->getLine()); + } + + restore_error_handler(); + restore_exception_handler(); + + $handler = ErrorHandler::register(); + $handler->throwAt(E_USER_DEPRECATED, true); + $this->assertFalse($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, array())); + + restore_error_handler(); + restore_exception_handler(); + + $handler = ErrorHandler::register(); + $handler->throwAt(E_DEPRECATED, true); + $this->assertFalse($handler->handleError(E_DEPRECATED, 'foo', 'foo.php', 12, array())); + + restore_error_handler(); + restore_exception_handler(); + + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + + $that = $this; + $warnArgCheck = function ($logLevel, $message, $context) use ($that) { + $that->assertEquals('info', $logLevel); + $that->assertEquals('foo', $message); + $that->assertArrayHasKey('type', $context); + $that->assertEquals($context['type'], E_USER_DEPRECATED); + $that->assertArrayHasKey('stack', $context); + $that->assertInternalType('array', $context['stack']); + }; + + $logger + ->expects($this->once()) + ->method('log') + ->will($this->returnCallback($warnArgCheck)) + ; + + $handler = ErrorHandler::register(); + $handler->setDefaultLogger($logger, E_USER_DEPRECATED); + $this->assertTrue($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, array())); + + restore_error_handler(); + restore_exception_handler(); + + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + + $that = $this; + $logArgCheck = function ($level, $message, $context) use ($that) { + $that->assertEquals('Undefined variable: undefVar', $message); + $that->assertArrayHasKey('type', $context); + $that->assertEquals($context['type'], E_NOTICE); + }; + + $logger + ->expects($this->once()) + ->method('log') + ->will($this->returnCallback($logArgCheck)) + ; + + $handler = ErrorHandler::register(); + $handler->setDefaultLogger($logger, E_NOTICE); + $handler->screamAt(E_NOTICE); + unset($undefVar); + @$undefVar++; + + restore_error_handler(); + restore_exception_handler(); + } catch (\Exception $e) { + restore_error_handler(); + restore_exception_handler(); + + throw $e; + } + } + + public function testHandleDeprecation() + { + $that = $this; + $logArgCheck = function ($level, $message, $context) use ($that) { + $that->assertEquals(LogLevel::INFO, $level); + $that->assertArrayHasKey('level', $context); + $that->assertEquals(E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED, $context['level']); + $that->assertArrayHasKey('stack', $context); + }; + + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + $logger + ->expects($this->once()) + ->method('log') + ->will($this->returnCallback($logArgCheck)) + ; + + $handler = new ErrorHandler(); + $handler->setDefaultLogger($logger); + @$handler->handleError(E_USER_DEPRECATED, 'Foo deprecation', __FILE__, __LINE__, array()); + } + + /** + * @group no-hhvm + */ + public function testHandleException() + { + try { + $handler = ErrorHandler::register(); + + $exception = new \Exception('foo'); + + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + + $that = $this; + $logArgCheck = function ($level, $message, $context) use ($that) { + $that->assertEquals('Uncaught Exception: foo', $message); + $that->assertArrayHasKey('type', $context); + $that->assertEquals($context['type'], E_ERROR); + }; + + $logger + ->expects($this->exactly(2)) + ->method('log') + ->will($this->returnCallback($logArgCheck)) + ; + + $handler->setDefaultLogger($logger, E_ERROR); + + try { + $handler->handleException($exception); + $this->fail('Exception expected'); + } catch (\Exception $e) { + $this->assertSame($exception, $e); + } + + $that = $this; + $handler->setExceptionHandler(function ($e) use ($exception, $that) { + $that->assertSame($exception, $e); + }); + + $handler->handleException($exception); + + restore_error_handler(); + restore_exception_handler(); + } catch (\Exception $e) { + restore_error_handler(); + restore_exception_handler(); + + throw $e; + } + } + + public function testErrorStacking() + { + try { + $handler = ErrorHandler::register(); + $handler->screamAt(E_USER_WARNING); + + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + + $logger + ->expects($this->exactly(2)) + ->method('log') + ->withConsecutive( + array($this->equalTo(LogLevel::WARNING), $this->equalTo('Dummy log')), + array($this->equalTo(LogLevel::DEBUG), $this->equalTo('Silenced warning')) + ) + ; + + $handler->setDefaultLogger($logger, array(E_USER_WARNING => LogLevel::WARNING)); + + ErrorHandler::stackErrors(); + @trigger_error('Silenced warning', E_USER_WARNING); + $logger->log(LogLevel::WARNING, 'Dummy log'); + ErrorHandler::unstackErrors(); + + restore_error_handler(); + restore_exception_handler(); + } catch (\Exception $e) { + restore_error_handler(); + restore_exception_handler(); + + throw $e; + } + } + + /** + * @group no-hhvm + */ + public function testHandleFatalError() + { + try { + $handler = ErrorHandler::register(); + + $error = array( + 'type' => E_PARSE, + 'message' => 'foo', + 'file' => 'bar', + 'line' => 123, + ); + + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + + $that = $this; + $logArgCheck = function ($level, $message, $context) use ($that) { + $that->assertEquals('Fatal Parse Error: foo', $message); + $that->assertArrayHasKey('type', $context); + $that->assertEquals($context['type'], E_PARSE); + }; + + $logger + ->expects($this->once()) + ->method('log') + ->will($this->returnCallback($logArgCheck)) + ; + + $handler->setDefaultLogger($logger, E_PARSE); + + $handler->handleFatalError($error); + + restore_error_handler(); + restore_exception_handler(); + } catch (\Exception $e) { + restore_error_handler(); + restore_exception_handler(); + + throw $e; + } + } + + /** + * @requires PHP 7 + */ + public function testHandleErrorException() + { + $exception = new \Error("Class 'Foo' not found"); + + $handler = new ErrorHandler(); + $handler->setExceptionHandler(function () use (&$args) { + $args = func_get_args(); + }); + + $handler->handleException($exception); + + $this->assertInstanceOf('Symfony\Component\Debug\Exception\ClassNotFoundException', $args[0]); + $this->assertStringStartsWith("Attempted to load class \"Foo\" from the global namespace.\nDid you forget a \"use\" statement", $args[0]->getMessage()); + } + + /** + * @group no-hhvm + */ + public function testHandleFatalErrorOnHHVM() + { + try { + $handler = ErrorHandler::register(); + + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + $logger + ->expects($this->once()) + ->method('log') + ->with( + $this->equalTo(LogLevel::CRITICAL), + $this->equalTo('Fatal Error: foo'), + $this->equalTo(array( + 'type' => 1, + 'file' => 'bar', + 'line' => 123, + 'level' => -1, + 'stack' => array(456), + )) + ) + ; + + $handler->setDefaultLogger($logger, E_ERROR); + + $error = array( + 'type' => E_ERROR + 0x1000000, // This error level is used by HHVM for fatal errors + 'message' => 'foo', + 'file' => 'bar', + 'line' => 123, + 'context' => array(123), + 'backtrace' => array(456), + ); + + call_user_func_array(array($handler, 'handleError'), $error); + $handler->handleFatalError($error); + + restore_error_handler(); + restore_exception_handler(); + } catch (\Exception $e) { + restore_error_handler(); + restore_exception_handler(); + + throw $e; + } + } + + /** + * @group legacy + */ + public function testLegacyInterface() + { + try { + $handler = ErrorHandler::register(0); + $this->assertFalse($handler->handle(0, 'foo', 'foo.php', 12, array())); + + restore_error_handler(); + restore_exception_handler(); + + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + + $that = $this; + $logArgCheck = function ($level, $message, $context) use ($that) { + $that->assertEquals('Undefined variable: undefVar', $message); + $that->assertArrayHasKey('type', $context); + $that->assertEquals($context['type'], E_NOTICE); + }; + + $logger + ->expects($this->once()) + ->method('log') + ->will($this->returnCallback($logArgCheck)) + ; + + $handler = ErrorHandler::register(E_NOTICE); + @$handler->setLogger($logger, 'scream'); + unset($undefVar); + @$undefVar++; + + restore_error_handler(); + restore_exception_handler(); + } catch (\Exception $e) { + restore_error_handler(); + restore_exception_handler(); + + throw $e; + } + } + + /** + * @expectedException \Exception + * @group no-hhvm + */ + public function testCustomExceptionHandler() + { + $handler = new ErrorHandler(); + $handler->setExceptionHandler(function ($e) use ($handler) { + $handler->handleException($e); + }); + + $handler->handleException(new \Exception()); + } +} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php b/application/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php similarity index 91% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php rename to application/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php index 99eaf49..269abf0 100644 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php +++ b/application/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Debug\Tests\Exception; +use PHPUnit\Framework\TestCase; use Symfony\Component\Debug\Exception\FlattenException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; @@ -27,7 +28,7 @@ use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException; use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException; -class FlattenExceptionTest extends \PHPUnit_Framework_TestCase +class FlattenExceptionTest extends TestCase { public function testStatusCode() { @@ -104,7 +105,7 @@ public function testHeadersForHttpException() /** * @dataProvider flattenDataProvider */ - public function testFlattenHttpException(\Exception $exception, $statusCode) + public function testFlattenHttpException(\Exception $exception) { $flattened = FlattenException::create($exception); $flattened2 = FlattenException::create($exception); @@ -119,7 +120,7 @@ public function testFlattenHttpException(\Exception $exception, $statusCode) /** * @dataProvider flattenDataProvider */ - public function testPrevious(\Exception $exception, $statusCode) + public function testPrevious(\Exception $exception) { $flattened = FlattenException::create($exception); $flattened2 = FlattenException::create($exception); @@ -131,6 +132,20 @@ public function testPrevious(\Exception $exception, $statusCode) $this->assertSame(array($flattened2), $flattened->getAllPrevious()); } + /** + * @requires PHP 7.0 + */ + public function testPreviousError() + { + $exception = new \Exception('test', 123, new \ParseError('Oh noes!', 42)); + + $flattened = FlattenException::create($exception)->getPrevious(); + + $this->assertEquals($flattened->getMessage(), 'Parse error: Oh noes!', 'The message is copied from the original exception.'); + $this->assertEquals($flattened->getCode(), 42, 'The code is copied from the original exception.'); + $this->assertEquals($flattened->getClass(), 'Symfony\Component\Debug\Exception\FatalThrowableError', 'The class is set to the class of the original exception'); + } + /** * @dataProvider flattenDataProvider */ @@ -152,7 +167,7 @@ public function testFile(\Exception $exception) /** * @dataProvider flattenDataProvider */ - public function testToArray(\Exception $exception, $statusCode) + public function testToArray(\Exception $exception) { $flattened = FlattenException::create($exception); $flattened->setTrace(array(), 'foo.php', 123); @@ -172,12 +187,13 @@ public function testToArray(\Exception $exception, $statusCode) public function flattenDataProvider() { return array( - array(new \Exception('test', 123), 500), + array(new \Exception('test', 123)), ); } public function testRecursionInArguments() { + $a = null; $a = array('foo', array(2, &$a)); $exception = $this->createException($a); diff --git a/application/vendor/symfony/debug/Tests/ExceptionHandlerTest.php b/application/vendor/symfony/debug/Tests/ExceptionHandlerTest.php new file mode 100644 index 0000000..77cc0b5 --- /dev/null +++ b/application/vendor/symfony/debug/Tests/ExceptionHandlerTest.php @@ -0,0 +1,135 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Debug\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Debug\ExceptionHandler; +use Symfony\Component\Debug\Exception\OutOfMemoryException; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; + +require_once __DIR__.'/HeaderMock.php'; + +class ExceptionHandlerTest extends TestCase +{ + protected function setUp() + { + testHeader(); + } + + protected function tearDown() + { + testHeader(); + } + + public function testDebug() + { + $handler = new ExceptionHandler(false); + + ob_start(); + $handler->sendPhpResponse(new \RuntimeException('Foo')); + $response = ob_get_clean(); + + $this->assertContains('

    Whoops, looks like something went wrong.

    ', $response); + $this->assertNotContains('

    ', $response); + + $handler = new ExceptionHandler(true); + + ob_start(); + $handler->sendPhpResponse(new \RuntimeException('Foo')); + $response = ob_get_clean(); + + $this->assertContains('

    Whoops, looks like something went wrong.

    ', $response); + $this->assertContains('

    ', $response); + } + + public function testStatusCode() + { + $handler = new ExceptionHandler(false, 'iso8859-1'); + + ob_start(); + $handler->sendPhpResponse(new NotFoundHttpException('Foo')); + $response = ob_get_clean(); + + $this->assertContains('Sorry, the page you are looking for could not be found.', $response); + + $expectedHeaders = array( + array('HTTP/1.0 404', true, null), + array('Content-Type: text/html; charset=iso8859-1', true, null), + ); + + $this->assertSame($expectedHeaders, testHeader()); + } + + public function testHeaders() + { + $handler = new ExceptionHandler(false, 'iso8859-1'); + + ob_start(); + $handler->sendPhpResponse(new MethodNotAllowedHttpException(array('POST'))); + $response = ob_get_clean(); + + $expectedHeaders = array( + array('HTTP/1.0 405', true, null), + array('Allow: POST', false, null), + array('Content-Type: text/html; charset=iso8859-1', true, null), + ); + + $this->assertSame($expectedHeaders, testHeader()); + } + + public function testNestedExceptions() + { + $handler = new ExceptionHandler(true); + ob_start(); + $handler->sendPhpResponse(new \RuntimeException('Foo', 0, new \RuntimeException('Bar'))); + $response = ob_get_clean(); + + $this->assertStringMatchesFormat('%AFoo%ABar%A', $response); + } + + public function testHandle() + { + $exception = new \Exception('foo'); + + $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(array('sendPhpResponse'))->getMock(); + $handler + ->expects($this->exactly(2)) + ->method('sendPhpResponse'); + + $handler->handle($exception); + + $that = $this; + $handler->setHandler(function ($e) use ($exception, $that) { + $that->assertSame($exception, $e); + }); + + $handler->handle($exception); + } + + public function testHandleOutOfMemoryException() + { + $exception = new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, __LINE__); + + $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(array('sendPhpResponse'))->getMock(); + $handler + ->expects($this->once()) + ->method('sendPhpResponse'); + + $that = $this; + $handler->setHandler(function ($e) use ($that) { + $that->fail('OutOfMemoryException should bypass the handler'); + }); + + $handler->handle($exception); + } +} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php b/application/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php similarity index 98% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php rename to application/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php index 26eeede..0611ed9 100644 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php +++ b/application/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Debug\Tests\FatalErrorHandler; +use PHPUnit\Framework\TestCase; use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader; use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader; use Symfony\Component\Debug\Exception\FatalErrorException; @@ -18,7 +19,7 @@ use Symfony\Component\Debug\DebugClassLoader; use Composer\Autoload\ClassLoader as ComposerClassLoader; -class ClassNotFoundFatalErrorHandlerTest extends \PHPUnit_Framework_TestCase +class ClassNotFoundFatalErrorHandlerTest extends TestCase { public static function setUpBeforeClass() { @@ -73,8 +74,6 @@ public function testHandleClassNotFound($error, $translatedMessage, $autoloader */ public function testLegacyHandleClassNotFound() { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - $prefixes = array('Symfony\Component\Debug\Exception\\' => realpath(__DIR__.'/../../Exception')); $symfonyUniversalClassLoader = new SymfonyUniversalClassLoader(); $symfonyUniversalClassLoader->registerPrefixes($prefixes); diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php b/application/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php similarity index 97% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php rename to application/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php index 795b747..1dc2120 100644 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php +++ b/application/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php @@ -11,10 +11,11 @@ namespace Symfony\Component\Debug\Tests\FatalErrorHandler; +use PHPUnit\Framework\TestCase; use Symfony\Component\Debug\Exception\FatalErrorException; use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler; -class UndefinedFunctionFatalErrorHandlerTest extends \PHPUnit_Framework_TestCase +class UndefinedFunctionFatalErrorHandlerTest extends TestCase { /** * @dataProvider provideUndefinedFunctionData diff --git a/application/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php b/application/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php new file mode 100644 index 0000000..739e5b2 --- /dev/null +++ b/application/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Debug\Tests\FatalErrorHandler; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Debug\Exception\FatalErrorException; +use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler; + +class UndefinedMethodFatalErrorHandlerTest extends TestCase +{ + /** + * @dataProvider provideUndefinedMethodData + */ + public function testUndefinedMethod($error, $translatedMessage) + { + $handler = new UndefinedMethodFatalErrorHandler(); + $exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line'])); + + $this->assertInstanceOf('Symfony\Component\Debug\Exception\UndefinedMethodException', $exception); + $this->assertSame($translatedMessage, $exception->getMessage()); + $this->assertSame($error['type'], $exception->getSeverity()); + $this->assertSame($error['file'], $exception->getFile()); + $this->assertSame($error['line'], $exception->getLine()); + } + + public function provideUndefinedMethodData() + { + return array( + array( + array( + 'type' => 1, + 'line' => 12, + 'file' => 'foo.php', + 'message' => 'Call to undefined method SplObjectStorage::what()', + ), + 'Attempted to call an undefined method named "what" of class "SplObjectStorage".', + ), + array( + array( + 'type' => 1, + 'line' => 12, + 'file' => 'foo.php', + 'message' => 'Call to undefined method SplObjectStorage::walid()', + ), + "Attempted to call an undefined method named \"walid\" of class \"SplObjectStorage\".\nDid you mean to call \"valid\"?", + ), + array( + array( + 'type' => 1, + 'line' => 12, + 'file' => 'foo.php', + 'message' => 'Call to undefined method SplObjectStorage::offsetFet()', + ), + "Attempted to call an undefined method named \"offsetFet\" of class \"SplObjectStorage\".\nDid you mean to call e.g. \"offsetGet\", \"offsetSet\" or \"offsetUnset\"?", + ), + array( + array( + 'type' => 1, + 'message' => 'Call to undefined method class@anonymous::test()', + 'file' => '/home/possum/work/symfony/test.php', + 'line' => 11, + ), + 'Attempted to call an undefined method named "test" of class "class@anonymous".', + ), + ); + } +} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/Fixtures/ClassAlias.php b/application/vendor/symfony/debug/Tests/Fixtures/ClassAlias.php similarity index 100% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Tests/Fixtures/ClassAlias.php rename to application/vendor/symfony/debug/Tests/Fixtures/ClassAlias.php diff --git a/application/vendor/symfony/debug/Tests/Fixtures/DeprecatedClass.php b/application/vendor/symfony/debug/Tests/Fixtures/DeprecatedClass.php new file mode 100644 index 0000000..51fde5a --- /dev/null +++ b/application/vendor/symfony/debug/Tests/Fixtures/DeprecatedClass.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Debug; + +function headers_sent() +{ + return false; +} + +function header($str, $replace = true, $status = null) +{ + Tests\testHeader($str, $replace, $status); +} + +namespace Symfony\Component\Debug\Tests; + +function testHeader() +{ + static $headers = array(); + + if (!$h = func_get_args()) { + $h = $headers; + $headers = array(); + + return $h; + } + + $headers[] = func_get_args(); +} diff --git a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/MockExceptionHandler.php b/application/vendor/symfony/debug/Tests/MockExceptionHandler.php similarity index 89% rename from application/vendor/symfony/debug/Symfony/Component/Debug/Tests/MockExceptionHandler.php rename to application/vendor/symfony/debug/Tests/MockExceptionHandler.php index a85d2d1..2d6ce56 100644 --- a/application/vendor/symfony/debug/Symfony/Component/Debug/Tests/MockExceptionHandler.php +++ b/application/vendor/symfony/debug/Tests/MockExceptionHandler.php @@ -13,7 +13,7 @@ use Symfony\Component\Debug\ExceptionHandler; -class MockExceptionHandler extends Exceptionhandler +class MockExceptionHandler extends ExceptionHandler { public $e; diff --git a/application/vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt b/application/vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt new file mode 100644 index 0000000..1de9b29 --- /dev/null +++ b/application/vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test catching fatal errors when handlers are nested +--FILE-- + +--EXPECTF-- +Fatal error: Class 'Symfony\Component\Debug\missing' not found in %s on line %d +object(Symfony\Component\Debug\Exception\ClassNotFoundException)#%d (8) { + ["message":protected]=> + string(131) "Attempted to load class "missing" from namespace "Symfony\Component\Debug". +Did you forget a "use" statement for another namespace?" + ["string":"Exception":private]=> + string(0) "" + ["code":protected]=> + int(0) + ["file":protected]=> + string(%d) "%s" + ["line":protected]=> + int(%d) + ["trace":"Exception":private]=> + array(%d) {%A} + ["previous":"Exception":private]=> + NULL + ["severity":protected]=> + int(1) +} diff --git a/application/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt b/application/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt new file mode 100644 index 0000000..9df0a65 --- /dev/null +++ b/application/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test rethrowing in custom exception handler +--FILE-- +setDefaultLogger(new TestLogger()); +ini_set('display_errors', 1); + +throw new \Exception('foo'); +?> +--EXPECTF-- +Uncaught Exception: foo +123 +Fatal error: Uncaught %s:25 +Stack trace: +%a diff --git a/application/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt b/application/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt new file mode 100644 index 0000000..897be3e --- /dev/null +++ b/application/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test catching fatal errors when handlers are nested +--FILE-- +setExceptionHandler('print_r'); + +if (true) { + class Broken implements \Serializable + { + } +} + +?> +--EXPECTF-- +array(1) { + [0]=> + string(37) "Error and exception handlers do match" +} +object(Symfony\Component\Debug\Exception\FatalErrorException)#%d (8) { + ["message":protected]=> + string(199) "Error: Class Symfony\Component\Debug\Broken contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Serializable::serialize, Serializable::unserialize)" +%a +} diff --git a/application/vendor/symfony/debug/composer.json b/application/vendor/symfony/debug/composer.json new file mode 100644 index 0000000..2ae0685 --- /dev/null +++ b/application/vendor/symfony/debug/composer.json @@ -0,0 +1,41 @@ +{ + "name": "symfony/debug", + "type": "library", + "description": "Symfony Debug Component", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=5.3.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.2", + "symfony/http-kernel": "~2.3.24|~2.5.9|^2.6.2" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\Debug\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + } +} diff --git a/application/vendor/symfony/debug/phpunit.xml.dist b/application/vendor/symfony/debug/phpunit.xml.dist new file mode 100644 index 0000000..12e5861 --- /dev/null +++ b/application/vendor/symfony/debug/phpunit.xml.dist @@ -0,0 +1,33 @@ + + + + + + + + + + ./Tests/ + + + ./Resources/ext/tests/ + + + + + + ./ + + ./Tests + ./vendor + + + + diff --git a/application/vendor/symfony/finder/Symfony/Component/Finder/.gitignore b/application/vendor/symfony/dom-crawler/.gitignore similarity index 100% rename from application/vendor/symfony/finder/Symfony/Component/Finder/.gitignore rename to application/vendor/symfony/dom-crawler/.gitignore diff --git a/application/vendor/symfony/dom-crawler/CHANGELOG.md b/application/vendor/symfony/dom-crawler/CHANGELOG.md new file mode 100644 index 0000000..48fd323 --- /dev/null +++ b/application/vendor/symfony/dom-crawler/CHANGELOG.md @@ -0,0 +1,45 @@ +CHANGELOG +========= + +2.5.0 +----- + +* [BC BREAK] The default value for checkbox and radio inputs without a value attribute have changed + from '1' to 'on' to match the HTML specification. +* [BC BREAK] The typehints on the `Link`, `Form` and `FormField` classes have been changed from + `\DOMNode` to `DOMElement`. Using any other type of `DOMNode` was triggering fatal errors in previous + versions. Code extending these classes will need to update the typehints when overwriting these methods. + +2.4.0 +----- + + * `Crawler::addXmlContent()` removes the default document namespace again if it's an only namespace. + * added support for automatic discovery and explicit registration of document + namespaces for `Crawler::filterXPath()` and `Crawler::filter()` + * improved content type guessing in `Crawler::addContent()` + * [BC BREAK] `Crawler::addXmlContent()` no longer removes the default document + namespace + +2.3.0 +----- + + * added Crawler::html() + * [BC BREAK] Crawler::each() and Crawler::reduce() now return Crawler instances instead of DomElement instances + * added schema relative URL support to links + * added support for HTML5 'form' attribute + +2.2.0 +----- + + * added a way to set raw path to the file in FileFormField - necessary for + simulating HTTP requests + +2.1.0 +----- + + * added support for the HTTP PATCH method + * refactored the Form class internals to support multi-dimensional fields + (the public API is backward compatible) + * added a way to get parsing errors for Crawler::addHtmlContent() and + Crawler::addXmlContent() via libxml functions + * added support for submitting a form without a submit button diff --git a/application/vendor/symfony/dom-crawler/Crawler.php b/application/vendor/symfony/dom-crawler/Crawler.php new file mode 100644 index 0000000..8cfd510 --- /dev/null +++ b/application/vendor/symfony/dom-crawler/Crawler.php @@ -0,0 +1,1044 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DomCrawler; + +use Symfony\Component\CssSelector\CssSelector; + +/** + * Crawler eases navigation of a list of \DOMElement objects. + * + * @author Fabien Potencier + */ +class Crawler extends \SplObjectStorage +{ + protected $uri; + + /** + * @var string The default namespace prefix to be used with XPath and CSS expressions + */ + private $defaultNamespacePrefix = 'default'; + + /** + * @var array A map of manually registered namespaces + */ + private $namespaces = array(); + + /** + * @var string The base href value + */ + private $baseHref; + + /** + * @param mixed $node A Node to use as the base for the crawling + * @param string $uri The current URI + * @param string $baseHref The base href value + */ + public function __construct($node = null, $uri = null, $baseHref = null) + { + $this->uri = $uri; + $this->baseHref = $baseHref ?: $uri; + + $this->add($node); + } + + /** + * Removes all the nodes. + */ + public function clear() + { + $this->removeAll($this); + } + + /** + * Adds a node to the current list of nodes. + * + * This method uses the appropriate specialized add*() method based + * on the type of the argument. + * + * @param \DOMNodeList|\DOMNode|array|string|null $node A node + * + * @throws \InvalidArgumentException when node is not the expected type + */ + public function add($node) + { + if ($node instanceof \DOMNodeList) { + $this->addNodeList($node); + } elseif ($node instanceof \DOMNode) { + $this->addNode($node); + } elseif (is_array($node)) { + $this->addNodes($node); + } elseif (is_string($node)) { + $this->addContent($node); + } elseif (null !== $node) { + throw new \InvalidArgumentException(sprintf('Expecting a DOMNodeList or DOMNode instance, an array, a string, or null, but got "%s".', is_object($node) ? get_class($node) : gettype($node))); + } + } + + /** + * Adds HTML/XML content. + * + * If the charset is not set via the content type, it is assumed + * to be ISO-8859-1, which is the default charset defined by the + * HTTP 1.1 specification. + * + * @param string $content A string to parse as HTML/XML + * @param null|string $type The content type of the string + */ + public function addContent($content, $type = null) + { + if (empty($type)) { + $type = 0 === strpos($content, ']+charset *= *["\']?([a-zA-Z\-0-9_:.]+)/i', $content, $matches)) { + $charset = $matches[1]; + } + + if (null === $charset) { + $charset = 'ISO-8859-1'; + } + + if ('x' === $xmlMatches[1]) { + $this->addXmlContent($content, $charset); + } else { + $this->addHtmlContent($content, $charset); + } + } + + /** + * Adds an HTML content to the list of nodes. + * + * The libxml errors are disabled when the content is parsed. + * + * If you want to get parsing errors, be sure to enable + * internal errors via libxml_use_internal_errors(true) + * and then, get the errors via libxml_get_errors(). Be + * sure to clear errors with libxml_clear_errors() afterward. + * + * @param string $content The HTML content + * @param string $charset The charset + */ + public function addHtmlContent($content, $charset = 'UTF-8') + { + $internalErrors = libxml_use_internal_errors(true); + $disableEntities = libxml_disable_entity_loader(true); + + $dom = new \DOMDocument('1.0', $charset); + $dom->validateOnParse = true; + + set_error_handler(function () { throw new \Exception(); }); + + try { + // Convert charset to HTML-entities to work around bugs in DOMDocument::loadHTML() + + if (function_exists('mb_convert_encoding')) { + $content = mb_convert_encoding($content, 'HTML-ENTITIES', $charset); + } elseif (function_exists('iconv')) { + $content = preg_replace_callback( + '/[\x80-\xFF]+/', + function ($m) { + $m = unpack('C*', $m[0]); + $i = 1; + $entities = ''; + + while (isset($m[$i])) { + if (0xF0 <= $m[$i]) { + $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; + } elseif (0xE0 <= $m[$i]) { + $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; + } else { + $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80; + } + + $entities .= '&#'.$c.';'; + } + + return $entities; + }, + iconv($charset, 'UTF-8', $content) + ); + } + } catch (\Exception $e) { + } + + restore_error_handler(); + + if ('' !== trim($content)) { + @$dom->loadHTML($content); + } + + libxml_use_internal_errors($internalErrors); + libxml_disable_entity_loader($disableEntities); + + $this->addDocument($dom); + + $base = $this->filterRelativeXPath('descendant-or-self::base')->extract(array('href')); + + $baseHref = current($base); + if (count($base) && !empty($baseHref)) { + if ($this->baseHref) { + $linkNode = $dom->createElement('a'); + $linkNode->setAttribute('href', $baseHref); + $link = new Link($linkNode, $this->baseHref); + $this->baseHref = $link->getUri(); + } else { + $this->baseHref = $baseHref; + } + } + } + + /** + * Adds an XML content to the list of nodes. + * + * The libxml errors are disabled when the content is parsed. + * + * If you want to get parsing errors, be sure to enable + * internal errors via libxml_use_internal_errors(true) + * and then, get the errors via libxml_get_errors(). Be + * sure to clear errors with libxml_clear_errors() afterward. + * + * @param string $content The XML content + * @param string $charset The charset + * @param int $options Bitwise OR of the libxml option constants + * LIBXML_PARSEHUGE is dangerous, see + * http://symfony.com/blog/security-release-symfony-2-0-17-released + */ + public function addXmlContent($content, $charset = 'UTF-8', $options = LIBXML_NONET) + { + // remove the default namespace if it's the only namespace to make XPath expressions simpler + if (!preg_match('/xmlns:/', $content)) { + $content = str_replace('xmlns', 'ns', $content); + } + + $internalErrors = libxml_use_internal_errors(true); + $disableEntities = libxml_disable_entity_loader(true); + + $dom = new \DOMDocument('1.0', $charset); + $dom->validateOnParse = true; + + if ('' !== trim($content)) { + @$dom->loadXML($content, $options); + } + + libxml_use_internal_errors($internalErrors); + libxml_disable_entity_loader($disableEntities); + + $this->addDocument($dom); + } + + /** + * Adds a \DOMDocument to the list of nodes. + * + * @param \DOMDocument $dom A \DOMDocument instance + */ + public function addDocument(\DOMDocument $dom) + { + if ($dom->documentElement) { + $this->addNode($dom->documentElement); + } + } + + /** + * Adds a \DOMNodeList to the list of nodes. + * + * @param \DOMNodeList $nodes A \DOMNodeList instance + */ + public function addNodeList(\DOMNodeList $nodes) + { + foreach ($nodes as $node) { + if ($node instanceof \DOMNode) { + $this->addNode($node); + } + } + } + + /** + * Adds an array of \DOMNode instances to the list of nodes. + * + * @param \DOMNode[] $nodes An array of \DOMNode instances + */ + public function addNodes(array $nodes) + { + foreach ($nodes as $node) { + $this->add($node); + } + } + + /** + * Adds a \DOMNode instance to the list of nodes. + * + * @param \DOMNode $node A \DOMNode instance + */ + public function addNode(\DOMNode $node) + { + if ($node instanceof \DOMDocument) { + $this->attach($node->documentElement); + } else { + $this->attach($node); + } + } + + // Serializing and unserializing a crawler creates DOM objects in a corrupted state. DOM elements are not properly serializable. + public function unserialize($serialized) + { + throw new \BadMethodCallException('A Crawler cannot be serialized.'); + } + + public function serialize() + { + throw new \BadMethodCallException('A Crawler cannot be serialized.'); + } + + /** + * Returns a node given its position in the node list. + * + * @param int $position The position + * + * @return self + */ + public function eq($position) + { + foreach ($this as $i => $node) { + if ($i == $position) { + return $this->createSubCrawler($node); + } + } + + return $this->createSubCrawler(null); + } + + /** + * Calls an anonymous function on each node of the list. + * + * The anonymous function receives the position and the node wrapped + * in a Crawler instance as arguments. + * + * Example: + * + * $crawler->filter('h1')->each(function ($node, $i) { + * return $node->text(); + * }); + * + * @param \Closure $closure An anonymous function + * + * @return array An array of values returned by the anonymous function + */ + public function each(\Closure $closure) + { + $data = array(); + foreach ($this as $i => $node) { + $data[] = $closure($this->createSubCrawler($node), $i); + } + + return $data; + } + + /** + * Slices the list of nodes by $offset and $length. + * + * @param int $offset + * @param int $length + * + * @return self + */ + public function slice($offset = 0, $length = -1) + { + return $this->createSubCrawler(iterator_to_array(new \LimitIterator($this, $offset, $length))); + } + + /** + * Reduces the list of nodes by calling an anonymous function. + * + * To remove a node from the list, the anonymous function must return false. + * + * @param \Closure $closure An anonymous function + * + * @return self + */ + public function reduce(\Closure $closure) + { + $nodes = array(); + foreach ($this as $i => $node) { + if (false !== $closure($this->createSubCrawler($node), $i)) { + $nodes[] = $node; + } + } + + return $this->createSubCrawler($nodes); + } + + /** + * Returns the first node of the current selection. + * + * @return self + */ + public function first() + { + return $this->eq(0); + } + + /** + * Returns the last node of the current selection. + * + * @return self + */ + public function last() + { + return $this->eq(count($this) - 1); + } + + /** + * Returns the siblings nodes of the current selection. + * + * @return self + * + * @throws \InvalidArgumentException When current node is empty + */ + public function siblings() + { + if (!count($this)) { + throw new \InvalidArgumentException('The current node list is empty.'); + } + + return $this->createSubCrawler($this->sibling($this->getNode(0)->parentNode->firstChild)); + } + + /** + * Returns the next siblings nodes of the current selection. + * + * @return self + * + * @throws \InvalidArgumentException When current node is empty + */ + public function nextAll() + { + if (!count($this)) { + throw new \InvalidArgumentException('The current node list is empty.'); + } + + return $this->createSubCrawler($this->sibling($this->getNode(0))); + } + + /** + * Returns the previous sibling nodes of the current selection. + * + * @return self + * + * @throws \InvalidArgumentException + */ + public function previousAll() + { + if (!count($this)) { + throw new \InvalidArgumentException('The current node list is empty.'); + } + + return $this->createSubCrawler($this->sibling($this->getNode(0), 'previousSibling')); + } + + /** + * Returns the parents nodes of the current selection. + * + * @return self + * + * @throws \InvalidArgumentException When current node is empty + */ + public function parents() + { + if (!count($this)) { + throw new \InvalidArgumentException('The current node list is empty.'); + } + + $node = $this->getNode(0); + $nodes = array(); + + while ($node = $node->parentNode) { + if (XML_ELEMENT_NODE === $node->nodeType) { + $nodes[] = $node; + } + } + + return $this->createSubCrawler($nodes); + } + + /** + * Returns the children nodes of the current selection. + * + * @return self + * + * @throws \InvalidArgumentException When current node is empty + */ + public function children() + { + if (!count($this)) { + throw new \InvalidArgumentException('The current node list is empty.'); + } + + $node = $this->getNode(0)->firstChild; + + return $this->createSubCrawler($node ? $this->sibling($node) : array()); + } + + /** + * Returns the attribute value of the first node of the list. + * + * @param string $attribute The attribute name + * + * @return string|null The attribute value or null if the attribute does not exist + * + * @throws \InvalidArgumentException When current node is empty + */ + public function attr($attribute) + { + if (!count($this)) { + throw new \InvalidArgumentException('The current node list is empty.'); + } + + $node = $this->getNode(0); + + return $node->hasAttribute($attribute) ? $node->getAttribute($attribute) : null; + } + + /** + * Returns the node name of the first node of the list. + * + * @return string The node name + * + * @throws \InvalidArgumentException When current node is empty + */ + public function nodeName() + { + if (!count($this)) { + throw new \InvalidArgumentException('The current node list is empty.'); + } + + return $this->getNode(0)->nodeName; + } + + /** + * Returns the node value of the first node of the list. + * + * @return string The node value + * + * @throws \InvalidArgumentException When current node is empty + */ + public function text() + { + if (!count($this)) { + throw new \InvalidArgumentException('The current node list is empty.'); + } + + return $this->getNode(0)->nodeValue; + } + + /** + * Returns the first node of the list as HTML. + * + * @return string The node html + * + * @throws \InvalidArgumentException When current node is empty + */ + public function html() + { + if (!count($this)) { + throw new \InvalidArgumentException('The current node list is empty.'); + } + + $html = ''; + foreach ($this->getNode(0)->childNodes as $child) { + $html .= $child->ownerDocument->saveHTML($child); + } + + return $html; + } + + /** + * Extracts information from the list of nodes. + * + * You can extract attributes or/and the node value (_text). + * + * Example: + * + * $crawler->filter('h1 a')->extract(array('_text', 'href')); + * + * @param array $attributes An array of attributes + * + * @return array An array of extracted values + */ + public function extract($attributes) + { + $attributes = (array) $attributes; + $count = count($attributes); + + $data = array(); + foreach ($this as $node) { + $elements = array(); + foreach ($attributes as $attribute) { + if ('_text' === $attribute) { + $elements[] = $node->nodeValue; + } else { + $elements[] = $node->getAttribute($attribute); + } + } + + $data[] = 1 === $count ? $elements[0] : $elements; + } + + return $data; + } + + /** + * Filters the list of nodes with an XPath expression. + * + * The XPath expression is evaluated in the context of the crawler, which + * is considered as a fake parent of the elements inside it. + * This means that a child selector "div" or "./div" will match only + * the div elements of the current crawler, not their children. + * + * @param string $xpath An XPath expression + * + * @return self + */ + public function filterXPath($xpath) + { + $xpath = $this->relativize($xpath); + + // If we dropped all expressions in the XPath while preparing it, there would be no match + if ('' === $xpath) { + return $this->createSubCrawler(null); + } + + return $this->filterRelativeXPath($xpath); + } + + /** + * Filters the list of nodes with a CSS selector. + * + * This method only works if you have installed the CssSelector Symfony Component. + * + * @param string $selector A CSS selector + * + * @return self + * + * @throws \RuntimeException if the CssSelector Component is not available + */ + public function filter($selector) + { + if (!class_exists('Symfony\\Component\\CssSelector\\CssSelector')) { + throw new \RuntimeException('Unable to filter with a CSS selector as the Symfony CssSelector is not installed (you can use filterXPath instead).'); + } + + // The CssSelector already prefixes the selector with descendant-or-self:: + return $this->filterRelativeXPath(CssSelector::toXPath($selector)); + } + + /** + * Selects links by name or alt value for clickable images. + * + * @param string $value The link text + * + * @return self + */ + public function selectLink($value) + { + $xpath = sprintf('descendant-or-self::a[contains(concat(\' \', normalize-space(string(.)), \' \'), %s) ', static::xpathLiteral(' '.$value.' ')). + sprintf('or ./img[contains(concat(\' \', normalize-space(string(@alt)), \' \'), %s)]]', static::xpathLiteral(' '.$value.' ')); + + return $this->filterRelativeXPath($xpath); + } + + /** + * Selects a button by name or alt value for images. + * + * @param string $value The button text + * + * @return self + */ + public function selectButton($value) + { + $translate = 'translate(@type, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")'; + $xpath = sprintf('descendant-or-self::input[((contains(%s, "submit") or contains(%1$s, "button")) and contains(concat(\' \', normalize-space(string(@value)), \' \'), %s)) ', $translate, static::xpathLiteral(' '.$value.' ')). + sprintf('or (contains(%s, "image") and contains(concat(\' \', normalize-space(string(@alt)), \' \'), %s)) or @id=%s or @name=%s] ', $translate, static::xpathLiteral(' '.$value.' '), static::xpathLiteral($value), static::xpathLiteral($value)). + sprintf('| descendant-or-self::button[contains(concat(\' \', normalize-space(string(.)), \' \'), %s) or @id=%s or @name=%s]', static::xpathLiteral(' '.$value.' '), static::xpathLiteral($value), static::xpathLiteral($value)); + + return $this->filterRelativeXPath($xpath); + } + + /** + * Returns a Link object for the first node in the list. + * + * @param string $method The method for the link (get by default) + * + * @return Link A Link instance + * + * @throws \InvalidArgumentException If the current node list is empty + */ + public function link($method = 'get') + { + if (!count($this)) { + throw new \InvalidArgumentException('The current node list is empty.'); + } + + $node = $this->getNode(0); + + return new Link($node, $this->baseHref, $method); + } + + /** + * Returns an array of Link objects for the nodes in the list. + * + * @return Link[] An array of Link instances + */ + public function links() + { + $links = array(); + foreach ($this as $node) { + $links[] = new Link($node, $this->baseHref, 'get'); + } + + return $links; + } + + /** + * Returns a Form object for the first node in the list. + * + * @param array $values An array of values for the form fields + * @param string $method The method for the form + * + * @return Form A Form instance + * + * @throws \InvalidArgumentException If the current node list is empty + */ + public function form(array $values = null, $method = null) + { + if (!count($this)) { + throw new \InvalidArgumentException('The current node list is empty.'); + } + + $form = new Form($this->getNode(0), $this->uri, $method, $this->baseHref); + + if (null !== $values) { + $form->setValues($values); + } + + return $form; + } + + /** + * Overloads a default namespace prefix to be used with XPath and CSS expressions. + * + * @param string $prefix + */ + public function setDefaultNamespacePrefix($prefix) + { + $this->defaultNamespacePrefix = $prefix; + } + + /** + * @param string $prefix + * @param string $namespace + */ + public function registerNamespace($prefix, $namespace) + { + $this->namespaces[$prefix] = $namespace; + } + + /** + * Converts string for XPath expressions. + * + * Escaped characters are: quotes (") and apostrophe ('). + * + * Examples: + * + * echo Crawler::xpathLiteral('foo " bar'); + * //prints 'foo " bar' + * + * echo Crawler::xpathLiteral("foo ' bar"); + * //prints "foo ' bar" + * + * echo Crawler::xpathLiteral('a\'b"c'); + * //prints concat('a', "'", 'b"c') + * + * + * @param string $s String to be escaped + * + * @return string Converted string + */ + public static function xpathLiteral($s) + { + if (false === strpos($s, "'")) { + return sprintf("'%s'", $s); + } + + if (false === strpos($s, '"')) { + return sprintf('"%s"', $s); + } + + $string = $s; + $parts = array(); + while (true) { + if (false !== $pos = strpos($string, "'")) { + $parts[] = sprintf("'%s'", substr($string, 0, $pos)); + $parts[] = "\"'\""; + $string = substr($string, $pos + 1); + } else { + $parts[] = "'$string'"; + break; + } + } + + return sprintf('concat(%s)', implode(', ', $parts)); + } + + /** + * Filters the list of nodes with an XPath expression. + * + * The XPath expression should already be processed to apply it in the context of each node. + * + * @param string $xpath + * + * @return self + */ + private function filterRelativeXPath($xpath) + { + $prefixes = $this->findNamespacePrefixes($xpath); + + $crawler = $this->createSubCrawler(null); + + foreach ($this as $node) { + $domxpath = $this->createDOMXPath($node->ownerDocument, $prefixes); + $crawler->add($domxpath->query($xpath, $node)); + } + + return $crawler; + } + + /** + * Make the XPath relative to the current context. + * + * The returned XPath will match elements matching the XPath inside the current crawler + * when running in the context of a node of the crawler. + * + * @param string $xpath + * + * @return string + */ + private function relativize($xpath) + { + $expressions = array(); + + // An expression which will never match to replace expressions which cannot match in the crawler + // We cannot simply drop + $nonMatchingExpression = 'a[name() = "b"]'; + + $xpathLen = strlen($xpath); + $openedBrackets = 0; + $startPosition = strspn($xpath, " \t\n\r\0\x0B"); + + for ($i = $startPosition; $i <= $xpathLen; ++$i) { + $i += strcspn($xpath, '"\'[]|', $i); + + if ($i < $xpathLen) { + switch ($xpath[$i]) { + case '"': + case "'": + if (false === $i = strpos($xpath, $xpath[$i], $i + 1)) { + return $xpath; // The XPath expression is invalid + } + continue 2; + case '[': + ++$openedBrackets; + continue 2; + case ']': + --$openedBrackets; + continue 2; + } + } + if ($openedBrackets) { + continue; + } + + if ($startPosition < $xpathLen && '(' === $xpath[$startPosition]) { + // If the union is inside some braces, we need to preserve the opening braces and apply + // the change only inside it. + $j = 1 + strspn($xpath, "( \t\n\r\0\x0B", $startPosition + 1); + $parenthesis = substr($xpath, $startPosition, $j); + $startPosition += $j; + } else { + $parenthesis = ''; + } + $expression = rtrim(substr($xpath, $startPosition, $i - $startPosition)); + + // BC for Symfony 2.4 and lower were elements were adding in a fake _root parent + if (0 === strpos($expression, '/_root/')) { + $expression = './'.substr($expression, 7); + } elseif (0 === strpos($expression, 'self::*/')) { + $expression = './'.substr($expression, 8); + } + + // add prefix before absolute element selector + if ('' === $expression) { + $expression = $nonMatchingExpression; + } elseif (0 === strpos($expression, '//')) { + $expression = 'descendant-or-self::'.substr($expression, 2); + } elseif (0 === strpos($expression, './/')) { + $expression = 'descendant-or-self::'.substr($expression, 3); + } elseif (0 === strpos($expression, './')) { + $expression = 'self::'.substr($expression, 2); + } elseif (0 === strpos($expression, 'child::')) { + $expression = 'self::'.substr($expression, 7); + } elseif ('/' === $expression[0] || 0 === strpos($expression, 'self::')) { + // the only direct child in Symfony 2.4 and lower is _root, which is already handled previously + // so let's drop the expression entirely + $expression = $nonMatchingExpression; + } elseif ('.' === $expression[0]) { + // '.' is the fake root element in Symfony 2.4 and lower, which is excluded from results + $expression = $nonMatchingExpression; + } elseif (0 === strpos($expression, 'descendant::')) { + $expression = 'descendant-or-self::'.substr($expression, 12); + } elseif (preg_match('/^(ancestor|ancestor-or-self|attribute|following|following-sibling|namespace|parent|preceding|preceding-sibling)::/', $expression)) { + // the fake root has no parent, preceding or following nodes and also no attributes (even no namespace attributes) + $expression = $nonMatchingExpression; + } elseif (0 !== strpos($expression, 'descendant-or-self::')) { + $expression = 'self::'.$expression; + } + $expressions[] = $parenthesis.$expression; + + if ($i === $xpathLen) { + return implode(' | ', $expressions); + } + + $i += strspn($xpath, " \t\n\r\0\x0B", $i + 1); + $startPosition = $i + 1; + } + + return $xpath; // The XPath expression is invalid + } + + /** + * @param int $position + * + * @return \DOMElement|null + */ + public function getNode($position) + { + foreach ($this as $i => $node) { + if ($i == $position) { + return $node; + } + } + } + + /** + * @param \DOMElement $node + * @param string $siblingDir + * + * @return array + */ + protected function sibling($node, $siblingDir = 'nextSibling') + { + $nodes = array(); + + do { + if ($node !== $this->getNode(0) && 1 === $node->nodeType) { + $nodes[] = $node; + } + } while ($node = $node->$siblingDir); + + return $nodes; + } + + /** + * @param \DOMDocument $document + * @param array $prefixes + * + * @return \DOMXPath + * + * @throws \InvalidArgumentException + */ + private function createDOMXPath(\DOMDocument $document, array $prefixes = array()) + { + $domxpath = new \DOMXPath($document); + + foreach ($prefixes as $prefix) { + $namespace = $this->discoverNamespace($domxpath, $prefix); + if (null !== $namespace) { + $domxpath->registerNamespace($prefix, $namespace); + } + } + + return $domxpath; + } + + /** + * @param \DOMXPath $domxpath + * @param string $prefix + * + * @return string + * + * @throws \InvalidArgumentException + */ + private function discoverNamespace(\DOMXPath $domxpath, $prefix) + { + if (isset($this->namespaces[$prefix])) { + return $this->namespaces[$prefix]; + } + + // ask for one namespace, otherwise we'd get a collection with an item for each node + $namespaces = $domxpath->query(sprintf('(//namespace::*[name()="%s"])[last()]', $this->defaultNamespacePrefix === $prefix ? '' : $prefix)); + + if ($node = $namespaces->item(0)) { + return $node->nodeValue; + } + } + + /** + * @param string $xpath + * + * @return array + */ + private function findNamespacePrefixes($xpath) + { + if (preg_match_all('/(?P[a-z_][a-z_0-9\-\.]*+):[^"\/:]/i', $xpath, $matches)) { + return array_unique($matches['prefix']); + } + + return array(); + } + + /** + * Creates a crawler for some subnodes. + * + * @param \DOMElement|\DOMElement[]|\DOMNodeList|null $nodes + * + * @return static + */ + private function createSubCrawler($nodes) + { + return new static($nodes, $this->uri, $this->baseHref); + } +} diff --git a/application/vendor/symfony/dom-crawler/Field/ChoiceFormField.php b/application/vendor/symfony/dom-crawler/Field/ChoiceFormField.php new file mode 100644 index 0000000..a3539bc --- /dev/null +++ b/application/vendor/symfony/dom-crawler/Field/ChoiceFormField.php @@ -0,0 +1,324 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DomCrawler\Field; + +/** + * ChoiceFormField represents a choice form field. + * + * It is constructed from a HTML select tag, or a HTML checkbox, or radio inputs. + * + * @author Fabien Potencier + */ +class ChoiceFormField extends FormField +{ + /** + * @var string + */ + private $type; + /** + * @var bool + */ + private $multiple; + /** + * @var array + */ + private $options; + /** + * @var bool + */ + private $validationDisabled = false; + + /** + * Returns true if the field should be included in the submitted values. + * + * @return bool true if the field should be included in the submitted values, false otherwise + */ + public function hasValue() + { + // don't send a value for unchecked checkboxes + if (in_array($this->type, array('checkbox', 'radio')) && null === $this->value) { + return false; + } + + return true; + } + + /** + * Check if the current selected option is disabled. + * + * @return bool + */ + public function isDisabled() + { + if (parent::isDisabled() && 'select' === $this->type) { + return true; + } + + foreach ($this->options as $option) { + if ($option['value'] == $this->value && $option['disabled']) { + return true; + } + } + + return false; + } + + /** + * Sets the value of the field. + * + * @param string $value The value of the field + */ + public function select($value) + { + $this->setValue($value); + } + + /** + * Ticks a checkbox. + * + * @throws \LogicException When the type provided is not correct + */ + public function tick() + { + if ('checkbox' !== $this->type) { + throw new \LogicException(sprintf('You cannot tick "%s" as it is not a checkbox (%s).', $this->name, $this->type)); + } + + $this->setValue(true); + } + + /** + * Unticks a checkbox. + * + * @throws \LogicException When the type provided is not correct + */ + public function untick() + { + if ('checkbox' !== $this->type) { + throw new \LogicException(sprintf('You cannot untick "%s" as it is not a checkbox (%s).', $this->name, $this->type)); + } + + $this->setValue(false); + } + + /** + * Sets the value of the field. + * + * @param string|array $value The value of the field + * + * @throws \InvalidArgumentException When value type provided is not correct + */ + public function setValue($value) + { + if ('checkbox' === $this->type && false === $value) { + // uncheck + $this->value = null; + } elseif ('checkbox' === $this->type && true === $value) { + // check + $this->value = $this->options[0]['value']; + } else { + if (is_array($value)) { + if (!$this->multiple) { + throw new \InvalidArgumentException(sprintf('The value for "%s" cannot be an array.', $this->name)); + } + + foreach ($value as $v) { + if (!$this->containsOption($v, $this->options)) { + throw new \InvalidArgumentException(sprintf('Input "%s" cannot take "%s" as a value (possible values: %s).', $this->name, $v, implode(', ', $this->availableOptionValues()))); + } + } + } elseif (!$this->containsOption($value, $this->options)) { + throw new \InvalidArgumentException(sprintf('Input "%s" cannot take "%s" as a value (possible values: %s).', $this->name, $value, implode(', ', $this->availableOptionValues()))); + } + + if ($this->multiple) { + $value = (array) $value; + } + + if (is_array($value)) { + $this->value = $value; + } else { + parent::setValue($value); + } + } + } + + /** + * Adds a choice to the current ones. + * + * @param \DOMElement $node + * + * @throws \LogicException When choice provided is not multiple nor radio + * + * @internal + */ + public function addChoice(\DOMElement $node) + { + if (!$this->multiple && 'radio' !== $this->type) { + throw new \LogicException(sprintf('Unable to add a choice for "%s" as it is not multiple or is not a radio button.', $this->name)); + } + + $option = $this->buildOptionValue($node); + $this->options[] = $option; + + if ($node->hasAttribute('checked')) { + $this->value = $option['value']; + } + } + + /** + * Returns the type of the choice field (radio, select, or checkbox). + * + * @return string The type + */ + public function getType() + { + return $this->type; + } + + /** + * Returns true if the field accepts multiple values. + * + * @return bool true if the field accepts multiple values, false otherwise + */ + public function isMultiple() + { + return $this->multiple; + } + + /** + * Initializes the form field. + * + * @throws \LogicException When node type is incorrect + */ + protected function initialize() + { + if ('input' !== $this->node->nodeName && 'select' !== $this->node->nodeName) { + throw new \LogicException(sprintf('A ChoiceFormField can only be created from an input or select tag (%s given).', $this->node->nodeName)); + } + + if ('input' === $this->node->nodeName && 'checkbox' !== strtolower($this->node->getAttribute('type')) && 'radio' !== strtolower($this->node->getAttribute('type'))) { + throw new \LogicException(sprintf('A ChoiceFormField can only be created from an input tag with a type of checkbox or radio (given type is %s).', $this->node->getAttribute('type'))); + } + + $this->value = null; + $this->options = array(); + $this->multiple = false; + + if ('input' == $this->node->nodeName) { + $this->type = strtolower($this->node->getAttribute('type')); + $optionValue = $this->buildOptionValue($this->node); + $this->options[] = $optionValue; + + if ($this->node->hasAttribute('checked')) { + $this->value = $optionValue['value']; + } + } else { + $this->type = 'select'; + if ($this->node->hasAttribute('multiple')) { + $this->multiple = true; + $this->value = array(); + $this->name = str_replace('[]', '', $this->name); + } + + $found = false; + foreach ($this->xpath->query('descendant::option', $this->node) as $option) { + $optionValue = $this->buildOptionValue($option); + $this->options[] = $optionValue; + + if ($option->hasAttribute('selected')) { + $found = true; + if ($this->multiple) { + $this->value[] = $optionValue['value']; + } else { + $this->value = $optionValue['value']; + } + } + } + + // if no option is selected and if it is a simple select box, take the first option as the value + if (!$found && !$this->multiple && !empty($this->options)) { + $this->value = $this->options[0]['value']; + } + } + } + + /** + * Returns option value with associated disabled flag. + * + * @param \DOMElement $node + * + * @return array + */ + private function buildOptionValue(\DOMElement $node) + { + $option = array(); + + $defaultDefaultValue = 'select' === $this->node->nodeName ? '' : 'on'; + $defaultValue = (isset($node->nodeValue) && !empty($node->nodeValue)) ? $node->nodeValue : $defaultDefaultValue; + $option['value'] = $node->hasAttribute('value') ? $node->getAttribute('value') : $defaultValue; + $option['disabled'] = $node->hasAttribute('disabled'); + + return $option; + } + + /** + * Checks whether given value is in the existing options. + * + * @param string $optionValue + * @param array $options + * + * @return bool + */ + public function containsOption($optionValue, $options) + { + if ($this->validationDisabled) { + return true; + } + + foreach ($options as $option) { + if ($option['value'] == $optionValue) { + return true; + } + } + + return false; + } + + /** + * Returns list of available field options. + * + * @return array + */ + public function availableOptionValues() + { + $values = array(); + + foreach ($this->options as $option) { + $values[] = $option['value']; + } + + return $values; + } + + /** + * Disables the internal validation of the field. + * + * @return self + */ + public function disableValidation() + { + $this->validationDisabled = true; + + return $this; + } +} diff --git a/application/vendor/symfony/dom-crawler/Field/FileFormField.php b/application/vendor/symfony/dom-crawler/Field/FileFormField.php new file mode 100644 index 0000000..0e0f943 --- /dev/null +++ b/application/vendor/symfony/dom-crawler/Field/FileFormField.php @@ -0,0 +1,108 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DomCrawler\Field; + +/** + * FileFormField represents a file form field (an HTML file input tag). + * + * @author Fabien Potencier + */ +class FileFormField extends FormField +{ + /** + * Sets the PHP error code associated with the field. + * + * @param int $error The error code (one of UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, or UPLOAD_ERR_EXTENSION) + * + * @throws \InvalidArgumentException When error code doesn't exist + */ + public function setErrorCode($error) + { + $codes = array(UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION); + if (!in_array($error, $codes)) { + throw new \InvalidArgumentException(sprintf('The error code %s is not valid.', $error)); + } + + $this->value = array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => $error, 'size' => 0); + } + + /** + * Sets the value of the field. + * + * @param string $value The value of the field + */ + public function upload($value) + { + $this->setValue($value); + } + + /** + * Sets the value of the field. + * + * @param string $value The value of the field + */ + public function setValue($value) + { + if (null !== $value && is_readable($value)) { + $error = UPLOAD_ERR_OK; + $size = filesize($value); + $info = pathinfo($value); + $name = $info['basename']; + + // copy to a tmp location + $tmp = sys_get_temp_dir().'/'.sha1(uniqid(mt_rand(), true)); + if (array_key_exists('extension', $info)) { + $tmp .= '.'.$info['extension']; + } + if (is_file($tmp)) { + unlink($tmp); + } + copy($value, $tmp); + $value = $tmp; + } else { + $error = UPLOAD_ERR_NO_FILE; + $size = 0; + $name = ''; + $value = ''; + } + + $this->value = array('name' => $name, 'type' => '', 'tmp_name' => $value, 'error' => $error, 'size' => $size); + } + + /** + * Sets path to the file as string for simulating HTTP request. + * + * @param string $path The path to the file + */ + public function setFilePath($path) + { + parent::setValue($path); + } + + /** + * Initializes the form field. + * + * @throws \LogicException When node type is incorrect + */ + protected function initialize() + { + if ('input' !== $this->node->nodeName) { + throw new \LogicException(sprintf('A FileFormField can only be created from an input tag (%s given).', $this->node->nodeName)); + } + + if ('file' !== strtolower($this->node->getAttribute('type'))) { + throw new \LogicException(sprintf('A FileFormField can only be created from an input tag with a type of file (given type is %s).', $this->node->getAttribute('type'))); + } + + $this->setValue(null); + } +} diff --git a/application/vendor/symfony/dom-crawler/Field/FormField.php b/application/vendor/symfony/dom-crawler/Field/FormField.php new file mode 100644 index 0000000..496d45d --- /dev/null +++ b/application/vendor/symfony/dom-crawler/Field/FormField.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DomCrawler\Field; + +/** + * FormField is the abstract class for all form fields. + * + * @author Fabien Potencier + */ +abstract class FormField +{ + /** + * @var \DOMElement + */ + protected $node; + /** + * @var string + */ + protected $name; + /** + * @var string + */ + protected $value; + /** + * @var \DOMDocument + */ + protected $document; + /** + * @var \DOMXPath + */ + protected $xpath; + /** + * @var bool + */ + protected $disabled; + + /** + * @param \DOMElement $node The node associated with this field + */ + public function __construct(\DOMElement $node) + { + $this->node = $node; + $this->name = $node->getAttribute('name'); + $this->xpath = new \DOMXPath($node->ownerDocument); + + $this->initialize(); + } + + /** + * Returns the name of the field. + * + * @return string The name of the field + */ + public function getName() + { + return $this->name; + } + + /** + * Gets the value of the field. + * + * @return string|array The value of the field + */ + public function getValue() + { + return $this->value; + } + + /** + * Sets the value of the field. + * + * @param string $value The value of the field + */ + public function setValue($value) + { + $this->value = (string) $value; + } + + /** + * Returns true if the field should be included in the submitted values. + * + * @return bool true if the field should be included in the submitted values, false otherwise + */ + public function hasValue() + { + return true; + } + + /** + * Check if the current field is disabled. + * + * @return bool + */ + public function isDisabled() + { + return $this->node->hasAttribute('disabled'); + } + + /** + * Initializes the form field. + */ + abstract protected function initialize(); +} diff --git a/application/vendor/symfony/dom-crawler/Field/InputFormField.php b/application/vendor/symfony/dom-crawler/Field/InputFormField.php new file mode 100644 index 0000000..1c3c84d --- /dev/null +++ b/application/vendor/symfony/dom-crawler/Field/InputFormField.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DomCrawler\Field; + +/** + * InputFormField represents an input form field (an HTML input tag). + * + * For inputs with type of file, checkbox, or radio, there are other more + * specialized classes (cf. FileFormField and ChoiceFormField). + * + * @author Fabien Potencier + */ +class InputFormField extends FormField +{ + /** + * Initializes the form field. + * + * @throws \LogicException When node type is incorrect + */ + protected function initialize() + { + if ('input' !== $this->node->nodeName && 'button' !== $this->node->nodeName) { + throw new \LogicException(sprintf('An InputFormField can only be created from an input or button tag (%s given).', $this->node->nodeName)); + } + + $type = strtolower($this->node->getAttribute('type')); + if ('checkbox' === $type) { + throw new \LogicException('Checkboxes should be instances of ChoiceFormField.'); + } + + if ('file' === $type) { + throw new \LogicException('File inputs should be instances of FileFormField.'); + } + + $this->value = $this->node->getAttribute('value'); + } +} diff --git a/application/vendor/symfony/dom-crawler/Field/TextareaFormField.php b/application/vendor/symfony/dom-crawler/Field/TextareaFormField.php new file mode 100644 index 0000000..15526e1 --- /dev/null +++ b/application/vendor/symfony/dom-crawler/Field/TextareaFormField.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DomCrawler\Field; + +/** + * TextareaFormField represents a textarea form field (an HTML textarea tag). + * + * @author Fabien Potencier + */ +class TextareaFormField extends FormField +{ + /** + * Initializes the form field. + * + * @throws \LogicException When node type is incorrect + */ + protected function initialize() + { + if ('textarea' !== $this->node->nodeName) { + throw new \LogicException(sprintf('A TextareaFormField can only be created from a textarea tag (%s given).', $this->node->nodeName)); + } + + $this->value = ''; + foreach ($this->node->childNodes as $node) { + $this->value .= $node->wholeText; + } + } +} diff --git a/application/vendor/symfony/dom-crawler/Form.php b/application/vendor/symfony/dom-crawler/Form.php new file mode 100644 index 0000000..258be96 --- /dev/null +++ b/application/vendor/symfony/dom-crawler/Form.php @@ -0,0 +1,479 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DomCrawler; + +use Symfony\Component\DomCrawler\Field\ChoiceFormField; +use Symfony\Component\DomCrawler\Field\FormField; + +/** + * Form represents an HTML form. + * + * @author Fabien Potencier + */ +class Form extends Link implements \ArrayAccess +{ + /** + * @var \DOMElement + */ + private $button; + + /** + * @var FormFieldRegistry + */ + private $fields; + + /** + * @var string + */ + private $baseHref; + + /** + * @param \DOMElement $node A \DOMElement instance + * @param string $currentUri The URI of the page where the form is embedded + * @param string $method The method to use for the link (if null, it defaults to the method defined by the form) + * @param string $baseHref The URI of the used for relative links, but not for empty action + * + * @throws \LogicException if the node is not a button inside a form tag + */ + public function __construct(\DOMElement $node, $currentUri, $method = null, $baseHref = null) + { + parent::__construct($node, $currentUri, $method); + $this->baseHref = $baseHref; + + $this->initialize(); + } + + /** + * Gets the form node associated with this form. + * + * @return \DOMElement A \DOMElement instance + */ + public function getFormNode() + { + return $this->node; + } + + /** + * Sets the value of the fields. + * + * @param array $values An array of field values + * + * @return $this + */ + public function setValues(array $values) + { + foreach ($values as $name => $value) { + $this->fields->set($name, $value); + } + + return $this; + } + + /** + * Gets the field values. + * + * The returned array does not include file fields (@see getFiles). + * + * @return array An array of field values + */ + public function getValues() + { + $values = array(); + foreach ($this->fields->all() as $name => $field) { + if ($field->isDisabled()) { + continue; + } + + if (!$field instanceof Field\FileFormField && $field->hasValue()) { + $values[$name] = $field->getValue(); + } + } + + return $values; + } + + /** + * Gets the file field values. + * + * @return array An array of file field values + */ + public function getFiles() + { + if (!in_array($this->getMethod(), array('POST', 'PUT', 'DELETE', 'PATCH'))) { + return array(); + } + + $files = array(); + + foreach ($this->fields->all() as $name => $field) { + if ($field->isDisabled()) { + continue; + } + + if ($field instanceof Field\FileFormField) { + $files[$name] = $field->getValue(); + } + } + + return $files; + } + + /** + * Gets the field values as PHP. + * + * This method converts fields with the array notation + * (like foo[bar] to arrays) like PHP does. + * + * @return array An array of field values + */ + public function getPhpValues() + { + $values = array(); + foreach ($this->getValues() as $name => $value) { + $qs = http_build_query(array($name => $value), '', '&'); + if (!empty($qs)) { + parse_str($qs, $expandedValue); + $varName = substr($name, 0, strlen(key($expandedValue))); + $values = array_replace_recursive($values, array($varName => current($expandedValue))); + } + } + + return $values; + } + + /** + * Gets the file field values as PHP. + * + * This method converts fields with the array notation + * (like foo[bar] to arrays) like PHP does. + * The returned array is consistent with the array for field values + * (@see getPhpValues), rather than uploaded files found in $_FILES. + * For a compound file field foo[bar] it will create foo[bar][name], + * instead of foo[name][bar] which would be found in $_FILES. + * + * @return array An array of file field values + */ + public function getPhpFiles() + { + $values = array(); + foreach ($this->getFiles() as $name => $value) { + $qs = http_build_query(array($name => $value), '', '&'); + if (!empty($qs)) { + parse_str($qs, $expandedValue); + $varName = substr($name, 0, strlen(key($expandedValue))); + + array_walk_recursive( + $expandedValue, + function (&$value, $key) { + if (ctype_digit($value) && ('size' === $key || 'error' === $key)) { + $value = (int) $value; + } + } + ); + + reset($expandedValue); + + $values = array_replace_recursive($values, array($varName => current($expandedValue))); + } + } + + return $values; + } + + /** + * Gets the URI of the form. + * + * The returned URI is not the same as the form "action" attribute. + * This method merges the value if the method is GET to mimics + * browser behavior. + * + * @return string The URI + */ + public function getUri() + { + $uri = parent::getUri(); + + if (!in_array($this->getMethod(), array('POST', 'PUT', 'DELETE', 'PATCH'))) { + $query = parse_url($uri, PHP_URL_QUERY); + $currentParameters = array(); + if ($query) { + parse_str($query, $currentParameters); + } + + $queryString = http_build_query(array_merge($currentParameters, $this->getValues()), '', '&'); + + $pos = strpos($uri, '?'); + $base = false === $pos ? $uri : substr($uri, 0, $pos); + $uri = rtrim($base.'?'.$queryString, '?'); + } + + return $uri; + } + + protected function getRawUri() + { + return $this->node->getAttribute('action'); + } + + /** + * Gets the form method. + * + * If no method is defined in the form, GET is returned. + * + * @return string The method + */ + public function getMethod() + { + if (null !== $this->method) { + return $this->method; + } + + return $this->node->getAttribute('method') ? strtoupper($this->node->getAttribute('method')) : 'GET'; + } + + /** + * Returns true if the named field exists. + * + * @param string $name The field name + * + * @return bool true if the field exists, false otherwise + */ + public function has($name) + { + return $this->fields->has($name); + } + + /** + * Removes a field from the form. + * + * @param string $name The field name + */ + public function remove($name) + { + $this->fields->remove($name); + } + + /** + * Gets a named field. + * + * @param string $name The field name + * + * @return FormField The field instance + * + * @throws \InvalidArgumentException When field is not present in this form + */ + public function get($name) + { + return $this->fields->get($name); + } + + /** + * Sets a named field. + */ + public function set(FormField $field) + { + $this->fields->add($field); + } + + /** + * Gets all fields. + * + * @return FormField[] + */ + public function all() + { + return $this->fields->all(); + } + + /** + * Returns true if the named field exists. + * + * @param string $name The field name + * + * @return bool true if the field exists, false otherwise + */ + public function offsetExists($name) + { + return $this->has($name); + } + + /** + * Gets the value of a field. + * + * @param string $name The field name + * + * @return FormField The associated Field instance + * + * @throws \InvalidArgumentException if the field does not exist + */ + public function offsetGet($name) + { + return $this->fields->get($name); + } + + /** + * Sets the value of a field. + * + * @param string $name The field name + * @param string|array $value The value of the field + * + * @throws \InvalidArgumentException if the field does not exist + */ + public function offsetSet($name, $value) + { + $this->fields->set($name, $value); + } + + /** + * Removes a field from the form. + * + * @param string $name The field name + */ + public function offsetUnset($name) + { + $this->fields->remove($name); + } + + /** + * Disables validation. + * + * @return self + */ + public function disableValidation() + { + foreach ($this->fields->all() as $field) { + if ($field instanceof Field\ChoiceFormField) { + $field->disableValidation(); + } + } + + return $this; + } + + /** + * Sets the node for the form. + * + * Expects a 'submit' button \DOMElement and finds the corresponding form element, or the form element itself. + * + * @throws \LogicException If given node is not a button or input or does not have a form ancestor + */ + protected function setNode(\DOMElement $node) + { + $this->button = $node; + if ('button' === $node->nodeName || ('input' === $node->nodeName && in_array(strtolower($node->getAttribute('type')), array('submit', 'button', 'image')))) { + if ($node->hasAttribute('form')) { + // if the node has the HTML5-compliant 'form' attribute, use it + $formId = $node->getAttribute('form'); + $form = $node->ownerDocument->getElementById($formId); + if (null === $form) { + throw new \LogicException(sprintf('The selected node has an invalid form attribute (%s).', $formId)); + } + $this->node = $form; + + return; + } + // we loop until we find a form ancestor + do { + if (null === $node = $node->parentNode) { + throw new \LogicException('The selected node does not have a form ancestor.'); + } + } while ('form' !== $node->nodeName); + } elseif ('form' !== $node->nodeName) { + throw new \LogicException(sprintf('Unable to submit on a "%s" tag.', $node->nodeName)); + } + + $this->node = $node; + } + + /** + * Adds form elements related to this form. + * + * Creates an internal copy of the submitted 'button' element and + * the form node or the entire document depending on whether we need + * to find non-descendant elements through HTML5 'form' attribute. + */ + private function initialize() + { + $this->fields = new FormFieldRegistry(); + + $xpath = new \DOMXPath($this->node->ownerDocument); + + // add submitted button if it has a valid name + if ('form' !== $this->button->nodeName && $this->button->hasAttribute('name') && $this->button->getAttribute('name')) { + if ('input' == $this->button->nodeName && 'image' == strtolower($this->button->getAttribute('type'))) { + $name = $this->button->getAttribute('name'); + $this->button->setAttribute('value', '0'); + + // temporarily change the name of the input node for the x coordinate + $this->button->setAttribute('name', $name.'.x'); + $this->set(new Field\InputFormField($this->button)); + + // temporarily change the name of the input node for the y coordinate + $this->button->setAttribute('name', $name.'.y'); + $this->set(new Field\InputFormField($this->button)); + + // restore the original name of the input node + $this->button->setAttribute('name', $name); + } else { + $this->set(new Field\InputFormField($this->button)); + } + } + + // find form elements corresponding to the current form + if ($this->node->hasAttribute('id')) { + // corresponding elements are either descendants or have a matching HTML5 form attribute + $formId = Crawler::xpathLiteral($this->node->getAttribute('id')); + + $fieldNodes = $xpath->query(sprintf('descendant::input[@form=%s] | descendant::button[@form=%1$s] | descendant::textarea[@form=%1$s] | descendant::select[@form=%1$s] | //form[@id=%1$s]//input[not(@form)] | //form[@id=%1$s]//button[not(@form)] | //form[@id=%1$s]//textarea[not(@form)] | //form[@id=%1$s]//select[not(@form)]', $formId)); + foreach ($fieldNodes as $node) { + $this->addField($node); + } + } else { + // do the xpath query with $this->node as the context node, to only find descendant elements + // however, descendant elements with form attribute are not part of this form + $fieldNodes = $xpath->query('descendant::input[not(@form)] | descendant::button[not(@form)] | descendant::textarea[not(@form)] | descendant::select[not(@form)]', $this->node); + foreach ($fieldNodes as $node) { + $this->addField($node); + } + } + + if ($this->baseHref && '' !== $this->node->getAttribute('action')) { + $this->currentUri = $this->baseHref; + } + } + + private function addField(\DOMElement $node) + { + if (!$node->hasAttribute('name') || !$node->getAttribute('name')) { + return; + } + + $nodeName = $node->nodeName; + if ('select' == $nodeName || 'input' == $nodeName && 'checkbox' == strtolower($node->getAttribute('type'))) { + $this->set(new Field\ChoiceFormField($node)); + } elseif ('input' == $nodeName && 'radio' == strtolower($node->getAttribute('type'))) { + // there may be other fields with the same name that are no choice + // fields already registered (see https://github.com/symfony/symfony/issues/11689) + if ($this->has($node->getAttribute('name')) && $this->get($node->getAttribute('name')) instanceof ChoiceFormField) { + $this->get($node->getAttribute('name'))->addChoice($node); + } else { + $this->set(new Field\ChoiceFormField($node)); + } + } elseif ('input' == $nodeName && 'file' == strtolower($node->getAttribute('type'))) { + $this->set(new Field\FileFormField($node)); + } elseif ('input' == $nodeName && !in_array(strtolower($node->getAttribute('type')), array('submit', 'button', 'image'))) { + $this->set(new Field\InputFormField($node)); + } elseif ('textarea' == $nodeName) { + $this->set(new Field\TextareaFormField($node)); + } + } +} diff --git a/application/vendor/symfony/dom-crawler/FormFieldRegistry.php b/application/vendor/symfony/dom-crawler/FormFieldRegistry.php new file mode 100644 index 0000000..6ad6d93 --- /dev/null +++ b/application/vendor/symfony/dom-crawler/FormFieldRegistry.php @@ -0,0 +1,215 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DomCrawler; + +use Symfony\Component\DomCrawler\Field\FormField; + +/** + * This is an internal class that must not be used directly. + * + * @internal + */ +class FormFieldRegistry +{ + private $fields = array(); + + private $base; + + /** + * Adds a field to the registry. + */ + public function add(FormField $field) + { + $segments = $this->getSegments($field->getName()); + + $target = &$this->fields; + while ($segments) { + if (!is_array($target)) { + $target = array(); + } + $path = array_shift($segments); + if ('' === $path) { + $target = &$target[]; + } else { + $target = &$target[$path]; + } + } + $target = $field; + } + + /** + * Removes a field and its children from the registry. + * + * @param string $name The fully qualified name of the base field + */ + public function remove($name) + { + $segments = $this->getSegments($name); + $target = &$this->fields; + while (count($segments) > 1) { + $path = array_shift($segments); + if (!array_key_exists($path, $target)) { + return; + } + $target = &$target[$path]; + } + unset($target[array_shift($segments)]); + } + + /** + * Returns the value of the field and its children. + * + * @param string $name The fully qualified name of the field + * + * @return mixed The value of the field + * + * @throws \InvalidArgumentException if the field does not exist + */ + public function &get($name) + { + $segments = $this->getSegments($name); + $target = &$this->fields; + while ($segments) { + $path = array_shift($segments); + if (!array_key_exists($path, $target)) { + throw new \InvalidArgumentException(sprintf('Unreachable field "%s"', $path)); + } + $target = &$target[$path]; + } + + return $target; + } + + /** + * Tests whether the form has the given field. + * + * @param string $name The fully qualified name of the field + * + * @return bool Whether the form has the given field + */ + public function has($name) + { + try { + $this->get($name); + + return true; + } catch (\InvalidArgumentException $e) { + return false; + } + } + + /** + * Set the value of a field and its children. + * + * @param string $name The fully qualified name of the field + * @param mixed $value The value + * + * @throws \InvalidArgumentException if the field does not exist + */ + public function set($name, $value) + { + $target = &$this->get($name); + if ((!is_array($value) && $target instanceof Field\FormField) || $target instanceof Field\ChoiceFormField) { + $target->setValue($value); + } elseif (is_array($value)) { + $fields = self::create($name, $value); + foreach ($fields->all() as $k => $v) { + $this->set($k, $v); + } + } else { + throw new \InvalidArgumentException(sprintf('Cannot set value on a compound field "%s".', $name)); + } + } + + /** + * Returns the list of field with their value. + * + * @return FormField[] The list of fields as array((string) Fully qualified name => (mixed) value) + */ + public function all() + { + return $this->walk($this->fields, $this->base); + } + + /** + * Creates an instance of the class. + * + * This function is made private because it allows overriding the $base and + * the $values properties without any type checking. + * + * @param string $base The fully qualified name of the base field + * @param array $values The values of the fields + * + * @return static + */ + private static function create($base, array $values) + { + $registry = new static(); + $registry->base = $base; + $registry->fields = $values; + + return $registry; + } + + /** + * Transforms a PHP array in a list of fully qualified name / value. + * + * @param array $array The PHP array + * @param string $base The name of the base field + * @param array $output The initial values + * + * @return array The list of fields as array((string) Fully qualified name => (mixed) value) + */ + private function walk(array $array, $base = '', array &$output = array()) + { + foreach ($array as $k => $v) { + $path = empty($base) ? $k : sprintf('%s[%s]', $base, $k); + if (is_array($v)) { + $this->walk($v, $path, $output); + } else { + $output[$path] = $v; + } + } + + return $output; + } + + /** + * Splits a field name into segments as a web browser would do. + * + * + * getSegments('base[foo][3][]') = array('base', 'foo, '3', ''); + * + * + * @param string $name The name of the field + * + * @return string[] The list of segments + */ + private function getSegments($name) + { + if (preg_match('/^(?P[^[]+)(?P(\[.*)|$)/', $name, $m)) { + $segments = array($m['base']); + while (!empty($m['extra'])) { + $extra = $m['extra']; + if (preg_match('/^\[(?P.*?)\](?P.*)$/', $extra, $m)) { + $segments[] = $m['segment']; + } else { + $segments[] = $extra; + } + } + + return $segments; + } + + return array($name); + } +} diff --git a/application/vendor/symfony/dom-crawler/LICENSE b/application/vendor/symfony/dom-crawler/LICENSE new file mode 100644 index 0000000..21d7fb9 --- /dev/null +++ b/application/vendor/symfony/dom-crawler/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2018 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/application/vendor/symfony/dom-crawler/Link.php b/application/vendor/symfony/dom-crawler/Link.php new file mode 100644 index 0000000..b68f246 --- /dev/null +++ b/application/vendor/symfony/dom-crawler/Link.php @@ -0,0 +1,222 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DomCrawler; + +/** + * Link represents an HTML link (an HTML a, area or link tag). + * + * @author Fabien Potencier + */ +class Link +{ + /** + * @var \DOMElement + */ + protected $node; + + /** + * @var string The method to use for the link + */ + protected $method; + + /** + * @var string The URI of the page where the link is embedded (or the base href) + */ + protected $currentUri; + + /** + * @param \DOMElement $node A \DOMElement instance + * @param string $currentUri The URI of the page where the link is embedded (or the base href) + * @param string $method The method to use for the link (get by default) + * + * @throws \InvalidArgumentException if the node is not a link + */ + public function __construct(\DOMElement $node, $currentUri, $method = 'GET') + { + if (!in_array(strtolower(substr($currentUri, 0, 4)), array('http', 'file'))) { + throw new \InvalidArgumentException(sprintf('Current URI must be an absolute URL ("%s").', $currentUri)); + } + + $this->setNode($node); + $this->method = $method ? strtoupper($method) : null; + $this->currentUri = $currentUri; + } + + /** + * Gets the node associated with this link. + * + * @return \DOMElement A \DOMElement instance + */ + public function getNode() + { + return $this->node; + } + + /** + * Gets the method associated with this link. + * + * @return string The method + */ + public function getMethod() + { + return $this->method; + } + + /** + * Gets the URI associated with this link. + * + * @return string The URI + */ + public function getUri() + { + $uri = trim($this->getRawUri()); + + // absolute URL? + if (null !== parse_url($uri, PHP_URL_SCHEME)) { + return $uri; + } + + // empty URI + if (!$uri) { + return $this->currentUri; + } + + // an anchor + if ('#' === $uri[0]) { + return $this->cleanupAnchor($this->currentUri).$uri; + } + + $baseUri = $this->cleanupUri($this->currentUri); + + if ('?' === $uri[0]) { + return $baseUri.$uri; + } + + // absolute URL with relative schema + if (0 === strpos($uri, '//')) { + return preg_replace('#^([^/]*)//.*$#', '$1', $baseUri).$uri; + } + + $baseUri = preg_replace('#^(.*?//[^/]*)(?:\/.*)?$#', '$1', $baseUri); + + // absolute path + if ('/' === $uri[0]) { + return $baseUri.$uri; + } + + // relative path + $path = parse_url(substr($this->currentUri, strlen($baseUri)), PHP_URL_PATH); + $path = $this->canonicalizePath(substr($path, 0, strrpos($path, '/')).'/'.$uri); + + return $baseUri.('' === $path || '/' !== $path[0] ? '/' : '').$path; + } + + /** + * Returns raw URI data. + * + * @return string + */ + protected function getRawUri() + { + return $this->node->getAttribute('href'); + } + + /** + * Returns the canonicalized URI path (see RFC 3986, section 5.2.4). + * + * @param string $path URI path + * + * @return string + */ + protected function canonicalizePath($path) + { + if ('' === $path || '/' === $path) { + return $path; + } + + if ('.' === substr($path, -1)) { + $path .= '/'; + } + + $output = array(); + + foreach (explode('/', $path) as $segment) { + if ('..' === $segment) { + array_pop($output); + } elseif ('.' !== $segment) { + $output[] = $segment; + } + } + + return implode('/', $output); + } + + /** + * Sets current \DOMElement instance. + * + * @param \DOMElement $node A \DOMElement instance + * + * @throws \LogicException If given node is not an anchor + */ + protected function setNode(\DOMElement $node) + { + if ('a' !== $node->nodeName && 'area' !== $node->nodeName && 'link' !== $node->nodeName) { + throw new \LogicException(sprintf('Unable to navigate from a "%s" tag.', $node->nodeName)); + } + + $this->node = $node; + } + + /** + * Removes the query string and the anchor from the given uri. + * + * @param string $uri The uri to clean + * + * @return string + */ + private function cleanupUri($uri) + { + return $this->cleanupQuery($this->cleanupAnchor($uri)); + } + + /** + * Remove the query string from the uri. + * + * @param string $uri + * + * @return string + */ + private function cleanupQuery($uri) + { + if (false !== $pos = strpos($uri, '?')) { + return substr($uri, 0, $pos); + } + + return $uri; + } + + /** + * Remove the anchor from the uri. + * + * @param string $uri + * + * @return string + */ + private function cleanupAnchor($uri) + { + if (false !== $pos = strpos($uri, '#')) { + return substr($uri, 0, $pos); + } + + return $uri; + } +} diff --git a/application/vendor/symfony/dom-crawler/README.md b/application/vendor/symfony/dom-crawler/README.md new file mode 100644 index 0000000..5fad2e2 --- /dev/null +++ b/application/vendor/symfony/dom-crawler/README.md @@ -0,0 +1,13 @@ +DomCrawler Component +==================== + +The DomCrawler component eases DOM navigation for HTML and XML documents. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/dom_crawler.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/application/vendor/symfony/dom-crawler/Tests/CrawlerTest.php b/application/vendor/symfony/dom-crawler/Tests/CrawlerTest.php new file mode 100644 index 0000000..74acfdf --- /dev/null +++ b/application/vendor/symfony/dom-crawler/Tests/CrawlerTest.php @@ -0,0 +1,1050 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DomCrawler\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\CssSelector\CssSelector; +use Symfony\Component\DomCrawler\Crawler; + +class CrawlerTest extends TestCase +{ + public function testConstructor() + { + $crawler = new Crawler(); + $this->assertCount(0, $crawler, '__construct() returns an empty crawler'); + + $crawler = new Crawler(new \DOMNode()); + $this->assertCount(1, $crawler, '__construct() takes a node as a first argument'); + } + + public function testAdd() + { + $crawler = new Crawler(); + $crawler->add($this->createDomDocument()); + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->add() adds nodes from a \DOMDocument'); + + $crawler = new Crawler(); + $crawler->add($this->createNodeList()); + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->add() adds nodes from a \DOMNodeList'); + + foreach ($this->createNodeList() as $node) { + $list[] = $node; + } + $crawler = new Crawler(); + $crawler->add($list); + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->add() adds nodes from an array of nodes'); + + $crawler = new Crawler(); + $crawler->add($this->createNodeList()->item(0)); + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->add() adds nodes from a \DOMElement'); + + $crawler = new Crawler(); + $crawler->add('Foo'); + $this->assertEquals('Foo', $crawler->filterXPath('//body')->text(), '->add() adds nodes from a string'); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testAddInvalidNode() + { + $crawler = new Crawler(); + $crawler->add(1); + } + + public function testAddHtmlContent() + { + $crawler = new Crawler(); + $crawler->addHtmlContent('
    ', 'UTF-8'); + + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addHtmlContent() adds nodes from an HTML string'); + + $crawler->addHtmlContent('', 'UTF-8'); + + $this->assertEquals('http://symfony.com', $crawler->filterXPath('//base')->attr('href'), '->addHtmlContent() adds nodes from an HTML string'); + $this->assertEquals('http://symfony.com/contact', $crawler->filterXPath('//a')->link()->getUri(), '->addHtmlContent() adds nodes from an HTML string'); + } + + /** + * @requires extension mbstring + */ + public function testAddHtmlContentCharset() + { + $crawler = new Crawler(); + $crawler->addHtmlContent('
    Tiếng Việt', 'UTF-8'); + + $this->assertEquals('Tiếng Việt', $crawler->filterXPath('//div')->text()); + } + + public function testAddHtmlContentInvalidBaseTag() + { + $crawler = new Crawler(null, 'http://symfony.com'); + + $crawler->addHtmlContent('', 'UTF-8'); + + $this->assertEquals('http://symfony.com/contact', current($crawler->filterXPath('//a')->links())->getUri(), '->addHtmlContent() correctly handles a non-existent base tag href attribute'); + } + + public function testAddHtmlContentUnsupportedCharset() + { + $crawler = new Crawler(); + $crawler->addHtmlContent(file_get_contents(__DIR__.'/Fixtures/windows-1250.html'), 'Windows-1250'); + + $this->assertEquals('Žťčýů', $crawler->filterXPath('//p')->text()); + } + + /** + * @requires extension mbstring + */ + public function testAddHtmlContentCharsetGbk() + { + $crawler = new Crawler(); + //gbk encode of

    中文

    + $crawler->addHtmlContent(base64_decode('PGh0bWw+PHA+1tDOxDwvcD48L2h0bWw+'), 'gbk'); + + $this->assertEquals('中文', $crawler->filterXPath('//p')->text()); + } + + public function testAddHtmlContentWithErrors() + { + $internalErrors = libxml_use_internal_errors(true); + + $crawler = new Crawler(); + $crawler->addHtmlContent(<<<'EOF' + + + + + + + + +EOF + , 'UTF-8'); + + $errors = libxml_get_errors(); + $this->assertCount(1, $errors); + $this->assertEquals("Tag nav invalid\n", $errors[0]->message); + + libxml_clear_errors(); + libxml_use_internal_errors($internalErrors); + } + + public function testAddXmlContent() + { + $crawler = new Crawler(); + $crawler->addXmlContent('
    ', 'UTF-8'); + + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addXmlContent() adds nodes from an XML string'); + } + + public function testAddXmlContentCharset() + { + $crawler = new Crawler(); + $crawler->addXmlContent('
    Tiếng Việt
    ', 'UTF-8'); + + $this->assertEquals('Tiếng Việt', $crawler->filterXPath('//div')->text()); + } + + public function testAddXmlContentWithErrors() + { + $internalErrors = libxml_use_internal_errors(true); + + $crawler = new Crawler(); + $crawler->addXmlContent(<<<'EOF' + + + + + +
    + + +EOF + , 'UTF-8'); + + $this->assertGreaterThan(1, libxml_get_errors()); + + libxml_clear_errors(); + libxml_use_internal_errors($internalErrors); + } + + public function testAddContent() + { + $crawler = new Crawler(); + $crawler->addContent('
    ', 'text/html; charset=UTF-8'); + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addContent() adds nodes from an HTML string'); + + $crawler = new Crawler(); + $crawler->addContent('
    ', 'text/html; charset=UTF-8; dir=RTL'); + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addContent() adds nodes from an HTML string with extended content type'); + + $crawler = new Crawler(); + $crawler->addContent('
    '); + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addContent() uses text/html as the default type'); + + $crawler = new Crawler(); + $crawler->addContent('
    ', 'text/xml; charset=UTF-8'); + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addContent() adds nodes from an XML string'); + + $crawler = new Crawler(); + $crawler->addContent('
    ', 'text/xml'); + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addContent() adds nodes from an XML string'); + + $crawler = new Crawler(); + $crawler->addContent('foo bar', 'text/plain'); + $this->assertCount(0, $crawler, '->addContent() does nothing if the type is not (x|ht)ml'); + + $crawler = new Crawler(); + $crawler->addContent('中文'); + $this->assertEquals('中文', $crawler->filterXPath('//span')->text(), '->addContent() guess wrong charset'); + } + + /** + * @requires extension iconv + */ + public function testAddContentNonUtf8() + { + $crawler = new Crawler(); + $crawler->addContent(iconv('UTF-8', 'SJIS', '日本語')); + $this->assertEquals('日本語', $crawler->filterXPath('//body')->text(), '->addContent() can recognize "Shift_JIS" in html5 meta charset tag'); + } + + public function testAddDocument() + { + $crawler = new Crawler(); + $crawler->addDocument($this->createDomDocument()); + + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addDocument() adds nodes from a \DOMDocument'); + } + + public function testAddNodeList() + { + $crawler = new Crawler(); + $crawler->addNodeList($this->createNodeList()); + + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addNodeList() adds nodes from a \DOMNodeList'); + } + + public function testAddNodes() + { + foreach ($this->createNodeList() as $node) { + $list[] = $node; + } + + $crawler = new Crawler(); + $crawler->addNodes($list); + + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addNodes() adds nodes from an array of nodes'); + } + + public function testAddNode() + { + $crawler = new Crawler(); + $crawler->addNode($this->createNodeList()->item(0)); + + $this->assertEquals('foo', $crawler->filterXPath('//div')->attr('class'), '->addNode() adds nodes from a \DOMElement'); + } + + public function testClear() + { + $crawler = new Crawler(new \DOMNode()); + $crawler->clear(); + $this->assertCount(0, $crawler, '->clear() removes all the nodes from the crawler'); + } + + public function testEq() + { + $crawler = $this->createTestCrawler()->filterXPath('//li'); + $this->assertNotSame($crawler, $crawler->eq(0), '->eq() returns a new instance of a crawler'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->eq() returns a new instance of a crawler'); + + $this->assertEquals('Two', $crawler->eq(1)->text(), '->eq() returns the nth node of the list'); + $this->assertCount(0, $crawler->eq(100), '->eq() returns an empty crawler if the nth node does not exist'); + } + + public function testEach() + { + $data = $this->createTestCrawler()->filterXPath('//ul[1]/li')->each(function ($node, $i) { + return $i.'-'.$node->text(); + }); + + $this->assertEquals(array('0-One', '1-Two', '2-Three'), $data, '->each() executes an anonymous function on each node of the list'); + } + + public function testSlice() + { + $crawler = $this->createTestCrawler()->filterXPath('//ul[1]/li'); + $this->assertNotSame($crawler->slice(), $crawler, '->slice() returns a new instance of a crawler'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler->slice(), '->slice() returns a new instance of a crawler'); + + $this->assertCount(3, $crawler->slice(), '->slice() does not slice the nodes in the list if any param is entered'); + $this->assertCount(1, $crawler->slice(1, 1), '->slice() slices the nodes in the list'); + } + + public function testReduce() + { + $crawler = $this->createTestCrawler()->filterXPath('//ul[1]/li'); + $nodes = $crawler->reduce(function ($node, $i) { + return 1 !== $i; + }); + $this->assertNotSame($nodes, $crawler, '->reduce() returns a new instance of a crawler'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $nodes, '->reduce() returns a new instance of a crawler'); + + $this->assertCount(2, $nodes, '->reduce() filters the nodes in the list'); + } + + public function testAttr() + { + $this->assertEquals('first', $this->createTestCrawler()->filterXPath('//li')->attr('class'), '->attr() returns the attribute of the first element of the node list'); + + try { + $this->createTestCrawler()->filterXPath('//ol')->attr('class'); + $this->fail('->attr() throws an \InvalidArgumentException if the node list is empty'); + } catch (\InvalidArgumentException $e) { + $this->assertTrue(true, '->attr() throws an \InvalidArgumentException if the node list is empty'); + } + } + + public function testMissingAttrValueIsNull() + { + $crawler = new Crawler(); + $crawler->addContent('
    ', 'text/html; charset=UTF-8'); + $div = $crawler->filterXPath('//div'); + + $this->assertEquals('sample value', $div->attr('non-empty-attr'), '->attr() reads non-empty attributes correctly'); + $this->assertEquals('', $div->attr('empty-attr'), '->attr() reads empty attributes correctly'); + $this->assertNull($div->attr('missing-attr'), '->attr() reads missing attributes correctly'); + } + + public function testNodeName() + { + $this->assertEquals('li', $this->createTestCrawler()->filterXPath('//li')->nodeName(), '->nodeName() returns the node name of the first element of the node list'); + + try { + $this->createTestCrawler()->filterXPath('//ol')->nodeName(); + $this->fail('->nodeName() throws an \InvalidArgumentException if the node list is empty'); + } catch (\InvalidArgumentException $e) { + $this->assertTrue(true, '->nodeName() throws an \InvalidArgumentException if the node list is empty'); + } + } + + public function testText() + { + $this->assertEquals('One', $this->createTestCrawler()->filterXPath('//li')->text(), '->text() returns the node value of the first element of the node list'); + + try { + $this->createTestCrawler()->filterXPath('//ol')->text(); + $this->fail('->text() throws an \InvalidArgumentException if the node list is empty'); + } catch (\InvalidArgumentException $e) { + $this->assertTrue(true, '->text() throws an \InvalidArgumentException if the node list is empty'); + } + } + + public function testHtml() + { + $this->assertEquals('Bar', $this->createTestCrawler()->filterXPath('//a[5]')->html()); + $this->assertEquals('', trim(preg_replace('~>\s+<~', '><', $this->createTestCrawler()->filterXPath('//form[@id="FooFormId"]')->html()))); + + try { + $this->createTestCrawler()->filterXPath('//ol')->html(); + $this->fail('->html() throws an \InvalidArgumentException if the node list is empty'); + } catch (\InvalidArgumentException $e) { + $this->assertTrue(true, '->html() throws an \InvalidArgumentException if the node list is empty'); + } + } + + public function testExtract() + { + $crawler = $this->createTestCrawler()->filterXPath('//ul[1]/li'); + + $this->assertEquals(array('One', 'Two', 'Three'), $crawler->extract('_text'), '->extract() returns an array of extracted data from the node list'); + $this->assertEquals(array(array('One', 'first'), array('Two', ''), array('Three', '')), $crawler->extract(array('_text', 'class')), '->extract() returns an array of extracted data from the node list'); + $this->assertEquals(array(array(), array(), array()), $crawler->extract(array()), '->extract() returns empty arrays if the attribute list is empty'); + + $this->assertEquals(array(), $this->createTestCrawler()->filterXPath('//ol')->extract('_text'), '->extract() returns an empty array if the node list is empty'); + } + + public function testFilterXpathComplexQueries() + { + $crawler = $this->createTestCrawler()->filterXPath('//body'); + + $this->assertCount(0, $crawler->filterXPath('/input')); + $this->assertCount(0, $crawler->filterXPath('/body')); + $this->assertCount(1, $crawler->filterXPath('/_root/body')); + $this->assertCount(1, $crawler->filterXPath('./body')); + $this->assertCount(1, $crawler->filterXPath('.//body')); + $this->assertCount(5, $crawler->filterXPath('.//input')); + $this->assertCount(4, $crawler->filterXPath('//form')->filterXPath('//button | //input')); + $this->assertCount(1, $crawler->filterXPath('body')); + $this->assertCount(6, $crawler->filterXPath('//button | //input')); + $this->assertCount(1, $crawler->filterXPath('//body')); + $this->assertCount(1, $crawler->filterXPath('descendant-or-self::body')); + $this->assertCount(1, $crawler->filterXPath('//div[@id="parent"]')->filterXPath('./div'), 'A child selection finds only the current div'); + $this->assertCount(3, $crawler->filterXPath('//div[@id="parent"]')->filterXPath('descendant::div'), 'A descendant selector matches the current div and its child'); + $this->assertCount(3, $crawler->filterXPath('//div[@id="parent"]')->filterXPath('//div'), 'A descendant selector matches the current div and its child'); + $this->assertCount(5, $crawler->filterXPath('(//a | //div)//img')); + $this->assertCount(7, $crawler->filterXPath('((//a | //div)//img | //ul)')); + $this->assertCount(7, $crawler->filterXPath('( ( //a | //div )//img | //ul )')); + $this->assertCount(1, $crawler->filterXPath("//a[./@href][((./@id = 'Klausi|Claudiu' or normalize-space(string(.)) = 'Klausi|Claudiu' or ./@title = 'Klausi|Claudiu' or ./@rel = 'Klausi|Claudiu') or .//img[./@alt = 'Klausi|Claudiu'])]")); + } + + public function testFilterXPath() + { + $crawler = $this->createTestCrawler(); + $this->assertNotSame($crawler, $crawler->filterXPath('//li'), '->filterXPath() returns a new instance of a crawler'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->filterXPath() returns a new instance of a crawler'); + + $crawler = $this->createTestCrawler()->filterXPath('//ul'); + $this->assertCount(6, $crawler->filterXPath('//li'), '->filterXPath() filters the node list with the XPath expression'); + + $crawler = $this->createTestCrawler(); + $this->assertCount(3, $crawler->filterXPath('//body')->filterXPath('//button')->parents(), '->filterXpath() preserves parents when chained'); + } + + public function testFilterXPathWithDefaultNamespace() + { + $crawler = $this->createTestXmlCrawler()->filterXPath('//default:entry/default:id'); + $this->assertCount(1, $crawler, '->filterXPath() automatically registers a namespace'); + $this->assertSame('tag:youtube.com,2008:video:kgZRZmEc9j4', $crawler->text()); + } + + public function testFilterXPathWithCustomDefaultNamespace() + { + $crawler = $this->createTestXmlCrawler(); + $crawler->setDefaultNamespacePrefix('x'); + $crawler = $crawler->filterXPath('//x:entry/x:id'); + + $this->assertCount(1, $crawler, '->filterXPath() lets to override the default namespace prefix'); + $this->assertSame('tag:youtube.com,2008:video:kgZRZmEc9j4', $crawler->text()); + } + + public function testFilterXPathWithNamespace() + { + $crawler = $this->createTestXmlCrawler()->filterXPath('//yt:accessControl'); + $this->assertCount(2, $crawler, '->filterXPath() automatically registers a namespace'); + } + + public function testFilterXPathWithMultipleNamespaces() + { + $crawler = $this->createTestXmlCrawler()->filterXPath('//media:group/yt:aspectRatio'); + $this->assertCount(1, $crawler, '->filterXPath() automatically registers multiple namespaces'); + $this->assertSame('widescreen', $crawler->text()); + } + + public function testFilterXPathWithManuallyRegisteredNamespace() + { + $crawler = $this->createTestXmlCrawler(); + $crawler->registerNamespace('m', 'http://search.yahoo.com/mrss/'); + + $crawler = $crawler->filterXPath('//m:group/yt:aspectRatio'); + $this->assertCount(1, $crawler, '->filterXPath() uses manually registered namespace'); + $this->assertSame('widescreen', $crawler->text()); + } + + public function testFilterXPathWithAnUrl() + { + $crawler = $this->createTestXmlCrawler(); + + $crawler = $crawler->filterXPath('//media:category[@scheme="http://gdata.youtube.com/schemas/2007/categories.cat"]'); + $this->assertCount(1, $crawler); + $this->assertSame('Music', $crawler->text()); + } + + public function testFilterXPathWithFakeRoot() + { + $crawler = $this->createTestCrawler(); + $this->assertCount(0, $crawler->filterXPath('.'), '->filterXPath() returns an empty result if the XPath references the fake root node'); + $this->assertCount(0, $crawler->filterXPath('/_root'), '->filterXPath() returns an empty result if the XPath references the fake root node'); + $this->assertCount(0, $crawler->filterXPath('self::*'), '->filterXPath() returns an empty result if the XPath references the fake root node'); + $this->assertCount(0, $crawler->filterXPath('self::_root'), '->filterXPath() returns an empty result if the XPath references the fake root node'); + } + + public function testFilterXPathWithAncestorAxis() + { + $crawler = $this->createTestCrawler()->filterXPath('//form'); + + $this->assertCount(0, $crawler->filterXPath('ancestor::*'), 'The fake root node has no ancestor nodes'); + } + + public function testFilterXPathWithAncestorOrSelfAxis() + { + $crawler = $this->createTestCrawler()->filterXPath('//form'); + + $this->assertCount(0, $crawler->filterXPath('ancestor-or-self::*'), 'The fake root node has no ancestor nodes'); + } + + public function testFilterXPathWithAttributeAxis() + { + $crawler = $this->createTestCrawler()->filterXPath('//form'); + + $this->assertCount(0, $crawler->filterXPath('attribute::*'), 'The fake root node has no attribute nodes'); + } + + public function testFilterXPathWithAttributeAxisAfterElementAxis() + { + $this->assertCount(3, $this->createTestCrawler()->filterXPath('//form/button/attribute::*'), '->filterXPath() handles attribute axes properly when they are preceded by an element filtering axis'); + } + + public function testFilterXPathWithChildAxis() + { + $crawler = $this->createTestCrawler()->filterXPath('//div[@id="parent"]'); + + $this->assertCount(1, $crawler->filterXPath('child::div'), 'A child selection finds only the current div'); + } + + public function testFilterXPathWithFollowingAxis() + { + $crawler = $this->createTestCrawler()->filterXPath('//a'); + + $this->assertCount(0, $crawler->filterXPath('following::div'), 'The fake root node has no following nodes'); + } + + public function testFilterXPathWithFollowingSiblingAxis() + { + $crawler = $this->createTestCrawler()->filterXPath('//a'); + + $this->assertCount(0, $crawler->filterXPath('following-sibling::div'), 'The fake root node has no following nodes'); + } + + public function testFilterXPathWithNamespaceAxis() + { + $crawler = $this->createTestCrawler()->filterXPath('//button'); + + $this->assertCount(0, $crawler->filterXPath('namespace::*'), 'The fake root node has no namespace nodes'); + } + + public function testFilterXPathWithNamespaceAxisAfterElementAxis() + { + $crawler = $this->createTestCrawler()->filterXPath('//div[@id="parent"]/namespace::*'); + + $this->assertCount(0, $crawler->filterXPath('namespace::*'), 'Namespace axes cannot be requested'); + } + + public function testFilterXPathWithParentAxis() + { + $crawler = $this->createTestCrawler()->filterXPath('//button'); + + $this->assertCount(0, $crawler->filterXPath('parent::*'), 'The fake root node has no parent nodes'); + } + + public function testFilterXPathWithPrecedingAxis() + { + $crawler = $this->createTestCrawler()->filterXPath('//form'); + + $this->assertCount(0, $crawler->filterXPath('preceding::*'), 'The fake root node has no preceding nodes'); + } + + public function testFilterXPathWithPrecedingSiblingAxis() + { + $crawler = $this->createTestCrawler()->filterXPath('//form'); + + $this->assertCount(0, $crawler->filterXPath('preceding-sibling::*'), 'The fake root node has no preceding nodes'); + } + + public function testFilterXPathWithSelfAxes() + { + $crawler = $this->createTestCrawler()->filterXPath('//a'); + + $this->assertCount(0, $crawler->filterXPath('self::a'), 'The fake root node has no "real" element name'); + $this->assertCount(0, $crawler->filterXPath('self::a/img'), 'The fake root node has no "real" element name'); + $this->assertCount(10, $crawler->filterXPath('self::*/a')); + } + + public function testFilter() + { + $crawler = $this->createTestCrawler(); + $this->assertNotSame($crawler, $crawler->filter('li'), '->filter() returns a new instance of a crawler'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->filter() returns a new instance of a crawler'); + + $crawler = $this->createTestCrawler()->filter('ul'); + + $this->assertCount(6, $crawler->filter('li'), '->filter() filters the node list with the CSS selector'); + } + + public function testFilterWithDefaultNamespace() + { + $crawler = $this->createTestXmlCrawler()->filter('default|entry default|id'); + $this->assertCount(1, $crawler, '->filter() automatically registers namespaces'); + $this->assertSame('tag:youtube.com,2008:video:kgZRZmEc9j4', $crawler->text()); + } + + public function testFilterWithNamespace() + { + CssSelector::disableHtmlExtension(); + + $crawler = $this->createTestXmlCrawler()->filter('yt|accessControl'); + $this->assertCount(2, $crawler, '->filter() automatically registers namespaces'); + } + + public function testFilterWithMultipleNamespaces() + { + CssSelector::disableHtmlExtension(); + + $crawler = $this->createTestXmlCrawler()->filter('media|group yt|aspectRatio'); + $this->assertCount(1, $crawler, '->filter() automatically registers namespaces'); + $this->assertSame('widescreen', $crawler->text()); + } + + public function testFilterWithDefaultNamespaceOnly() + { + $crawler = new Crawler(' + + + http://localhost/foo + weekly + 0.5 + 2012-11-16 + + + http://localhost/bar + weekly + 0.5 + 2012-11-16 + + + '); + + $this->assertEquals(2, $crawler->filter('url')->count()); + } + + public function testSelectLink() + { + $crawler = $this->createTestCrawler(); + $this->assertNotSame($crawler, $crawler->selectLink('Foo'), '->selectLink() returns a new instance of a crawler'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->selectLink() returns a new instance of a crawler'); + + $this->assertCount(1, $crawler->selectLink('Fabien\'s Foo'), '->selectLink() selects links by the node values'); + $this->assertCount(1, $crawler->selectLink('Fabien\'s Bar'), '->selectLink() selects links by the alt attribute of a clickable image'); + + $this->assertCount(2, $crawler->selectLink('Fabien"s Foo'), '->selectLink() selects links by the node values'); + $this->assertCount(2, $crawler->selectLink('Fabien"s Bar'), '->selectLink() selects links by the alt attribute of a clickable image'); + + $this->assertCount(1, $crawler->selectLink('\' Fabien"s Foo'), '->selectLink() selects links by the node values'); + $this->assertCount(1, $crawler->selectLink('\' Fabien"s Bar'), '->selectLink() selects links by the alt attribute of a clickable image'); + + $this->assertCount(4, $crawler->selectLink('Foo'), '->selectLink() selects links by the node values'); + $this->assertCount(4, $crawler->selectLink('Bar'), '->selectLink() selects links by the node values'); + } + + public function testSelectButton() + { + $crawler = $this->createTestCrawler(); + $this->assertNotSame($crawler, $crawler->selectButton('FooValue'), '->selectButton() returns a new instance of a crawler'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->selectButton() returns a new instance of a crawler'); + + $this->assertEquals(1, $crawler->selectButton('FooValue')->count(), '->selectButton() selects buttons'); + $this->assertEquals(1, $crawler->selectButton('FooName')->count(), '->selectButton() selects buttons'); + $this->assertEquals(1, $crawler->selectButton('FooId')->count(), '->selectButton() selects buttons'); + + $this->assertEquals(1, $crawler->selectButton('BarValue')->count(), '->selectButton() selects buttons'); + $this->assertEquals(1, $crawler->selectButton('BarName')->count(), '->selectButton() selects buttons'); + $this->assertEquals(1, $crawler->selectButton('BarId')->count(), '->selectButton() selects buttons'); + + $this->assertEquals(1, $crawler->selectButton('FooBarValue')->count(), '->selectButton() selects buttons with form attribute too'); + $this->assertEquals(1, $crawler->selectButton('FooBarName')->count(), '->selectButton() selects buttons with form attribute too'); + } + + public function testSelectButtonWithSingleQuotesInNameAttribute() + { + $html = <<<'HTML' + + + +
    +
    + + + + +HTML; + + $crawler = new Crawler($html); + + $this->assertCount(1, $crawler->selectButton('Click \'Here\'')); + } + + public function testSelectButtonWithDoubleQuotesInNameAttribute() + { + $html = <<<'HTML' + + + +
    + Login +
    +
    + + + + +HTML; + + $crawler = new Crawler($html); + + $this->assertCount(1, $crawler->selectButton('Click "Here"')); + } + + public function testLink() + { + $crawler = $this->createTestCrawler('http://example.com/bar/')->selectLink('Foo'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Link', $crawler->link(), '->link() returns a Link instance'); + + $this->assertEquals('POST', $crawler->link('post')->getMethod(), '->link() takes a method as its argument'); + + $crawler = $this->createTestCrawler('http://example.com/bar')->selectLink('GetLink'); + $this->assertEquals('http://example.com/bar?get=param', $crawler->link()->getUri(), '->link() returns a Link instance'); + + try { + $this->createTestCrawler()->filterXPath('//ol')->link(); + $this->fail('->link() throws an \InvalidArgumentException if the node list is empty'); + } catch (\InvalidArgumentException $e) { + $this->assertTrue(true, '->link() throws an \InvalidArgumentException if the node list is empty'); + } + } + + public function testSelectLinkAndLinkFiltered() + { + $html = <<<'HTML' + + + +
    + Login +
    +
    + + + + +HTML; + + $crawler = new Crawler($html); + $filtered = $crawler->filterXPath("descendant-or-self::*[@id = 'login-form']"); + + $this->assertCount(0, $filtered->selectLink('Login')); + $this->assertCount(1, $filtered->selectButton('Submit')); + + $filtered = $crawler->filterXPath("descendant-or-self::*[@id = 'action']"); + + $this->assertCount(1, $filtered->selectLink('Login')); + $this->assertCount(0, $filtered->selectButton('Submit')); + + $this->assertCount(1, $crawler->selectLink('Login')->selectLink('Login')); + $this->assertCount(1, $crawler->selectButton('Submit')->selectButton('Submit')); + } + + public function testChaining() + { + $crawler = new Crawler('
    '); + + $this->assertEquals('a', $crawler->filterXPath('//div')->filterXPath('div')->filterXPath('div')->attr('name')); + } + + public function testLinks() + { + $crawler = $this->createTestCrawler('http://example.com/bar/')->selectLink('Foo'); + $this->assertInternalType('array', $crawler->links(), '->links() returns an array'); + + $this->assertCount(4, $crawler->links(), '->links() returns an array'); + $links = $crawler->links(); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Link', $links[0], '->links() returns an array of Link instances'); + + $this->assertEquals(array(), $this->createTestCrawler()->filterXPath('//ol')->links(), '->links() returns an empty array if the node selection is empty'); + } + + public function testForm() + { + $testCrawler = $this->createTestCrawler('http://example.com/bar/'); + $crawler = $testCrawler->selectButton('FooValue'); + $crawler2 = $testCrawler->selectButton('FooBarValue'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Form', $crawler->form(), '->form() returns a Form instance'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Form', $crawler2->form(), '->form() returns a Form instance'); + + $this->assertEquals($crawler->form()->getFormNode()->getAttribute('id'), $crawler2->form()->getFormNode()->getAttribute('id'), '->form() works on elements with form attribute'); + + $this->assertEquals(array('FooName' => 'FooBar', 'TextName' => 'TextValue', 'FooTextName' => 'FooTextValue'), $crawler->form(array('FooName' => 'FooBar'))->getValues(), '->form() takes an array of values to submit as its first argument'); + $this->assertEquals(array('FooName' => 'FooValue', 'TextName' => 'TextValue', 'FooTextName' => 'FooTextValue'), $crawler->form()->getValues(), '->getValues() returns correct form values'); + $this->assertEquals(array('FooBarName' => 'FooBarValue', 'TextName' => 'TextValue', 'FooTextName' => 'FooTextValue'), $crawler2->form()->getValues(), '->getValues() returns correct form values'); + + try { + $this->createTestCrawler()->filterXPath('//ol')->form(); + $this->fail('->form() throws an \InvalidArgumentException if the node list is empty'); + } catch (\InvalidArgumentException $e) { + $this->assertTrue(true, '->form() throws an \InvalidArgumentException if the node list is empty'); + } + } + + public function testLast() + { + $crawler = $this->createTestCrawler()->filterXPath('//ul[1]/li'); + $this->assertNotSame($crawler, $crawler->last(), '->last() returns a new instance of a crawler'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->last() returns a new instance of a crawler'); + + $this->assertEquals('Three', $crawler->last()->text()); + } + + public function testFirst() + { + $crawler = $this->createTestCrawler()->filterXPath('//li'); + $this->assertNotSame($crawler, $crawler->first(), '->first() returns a new instance of a crawler'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->first() returns a new instance of a crawler'); + + $this->assertEquals('One', $crawler->first()->text()); + } + + public function testSiblings() + { + $crawler = $this->createTestCrawler()->filterXPath('//li')->eq(1); + $this->assertNotSame($crawler, $crawler->siblings(), '->siblings() returns a new instance of a crawler'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->siblings() returns a new instance of a crawler'); + + $nodes = $crawler->siblings(); + $this->assertEquals(2, $nodes->count()); + $this->assertEquals('One', $nodes->eq(0)->text()); + $this->assertEquals('Three', $nodes->eq(1)->text()); + + $nodes = $this->createTestCrawler()->filterXPath('//li')->eq(0)->siblings(); + $this->assertEquals(2, $nodes->count()); + $this->assertEquals('Two', $nodes->eq(0)->text()); + $this->assertEquals('Three', $nodes->eq(1)->text()); + + try { + $this->createTestCrawler()->filterXPath('//ol')->siblings(); + $this->fail('->siblings() throws an \InvalidArgumentException if the node list is empty'); + } catch (\InvalidArgumentException $e) { + $this->assertTrue(true, '->siblings() throws an \InvalidArgumentException if the node list is empty'); + } + } + + public function testNextAll() + { + $crawler = $this->createTestCrawler()->filterXPath('//li')->eq(1); + $this->assertNotSame($crawler, $crawler->nextAll(), '->nextAll() returns a new instance of a crawler'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->nextAll() returns a new instance of a crawler'); + + $nodes = $crawler->nextAll(); + $this->assertEquals(1, $nodes->count()); + $this->assertEquals('Three', $nodes->eq(0)->text()); + + try { + $this->createTestCrawler()->filterXPath('//ol')->nextAll(); + $this->fail('->nextAll() throws an \InvalidArgumentException if the node list is empty'); + } catch (\InvalidArgumentException $e) { + $this->assertTrue(true, '->nextAll() throws an \InvalidArgumentException if the node list is empty'); + } + } + + public function testPreviousAll() + { + $crawler = $this->createTestCrawler()->filterXPath('//li')->eq(2); + $this->assertNotSame($crawler, $crawler->previousAll(), '->previousAll() returns a new instance of a crawler'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->previousAll() returns a new instance of a crawler'); + + $nodes = $crawler->previousAll(); + $this->assertEquals(2, $nodes->count()); + $this->assertEquals('Two', $nodes->eq(0)->text()); + + try { + $this->createTestCrawler()->filterXPath('//ol')->previousAll(); + $this->fail('->previousAll() throws an \InvalidArgumentException if the node list is empty'); + } catch (\InvalidArgumentException $e) { + $this->assertTrue(true, '->previousAll() throws an \InvalidArgumentException if the node list is empty'); + } + } + + public function testChildren() + { + $crawler = $this->createTestCrawler()->filterXPath('//ul'); + $this->assertNotSame($crawler, $crawler->children(), '->children() returns a new instance of a crawler'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->children() returns a new instance of a crawler'); + + $nodes = $crawler->children(); + $this->assertEquals(3, $nodes->count()); + $this->assertEquals('One', $nodes->eq(0)->text()); + $this->assertEquals('Two', $nodes->eq(1)->text()); + $this->assertEquals('Three', $nodes->eq(2)->text()); + + try { + $this->createTestCrawler()->filterXPath('//ol')->children(); + $this->fail('->children() throws an \InvalidArgumentException if the node list is empty'); + } catch (\InvalidArgumentException $e) { + $this->assertTrue(true, '->children() throws an \InvalidArgumentException if the node list is empty'); + } + + try { + $crawler = new Crawler('

    '); + $crawler->filter('p')->children(); + $this->assertTrue(true, '->children() does not trigger a notice if the node has no children'); + } catch (\PHPUnit\Framework\Error\Notice $e) { + $this->fail('->children() does not trigger a notice if the node has no children'); + } catch (\PHPUnit_Framework_Error_Notice $e) { + $this->fail('->children() does not trigger a notice if the node has no children'); + } + } + + public function testParents() + { + $crawler = $this->createTestCrawler()->filterXPath('//li[1]'); + $this->assertNotSame($crawler, $crawler->parents(), '->parents() returns a new instance of a crawler'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Crawler', $crawler, '->parents() returns a new instance of a crawler'); + + $nodes = $crawler->parents(); + $this->assertEquals(3, $nodes->count()); + + $nodes = $this->createTestCrawler()->filterXPath('//html')->parents(); + $this->assertEquals(0, $nodes->count()); + + try { + $this->createTestCrawler()->filterXPath('//ol')->parents(); + $this->fail('->parents() throws an \InvalidArgumentException if the node list is empty'); + } catch (\InvalidArgumentException $e) { + $this->assertTrue(true, '->parents() throws an \InvalidArgumentException if the node list is empty'); + } + } + + /** + * @dataProvider getBaseTagData + */ + public function testBaseTag($baseValue, $linkValue, $expectedUri, $currentUri = null, $description = null) + { + $crawler = new Crawler('', $currentUri); + $this->assertEquals($expectedUri, $crawler->filterXPath('//a')->link()->getUri(), $description); + } + + public function getBaseTagData() + { + return array( + array('http://base.com', 'link', 'http://base.com/link'), + array('//base.com', 'link', 'https://base.com/link', 'https://domain.com', ' tag can use a schema-less URL'), + array('path/', 'link', 'https://domain.com/path/link', 'https://domain.com', ' tag can set a path'), + array('http://base.com', '#', 'http://base.com#', 'http://domain.com/path/link', ' tag does work with links to an anchor'), + array('http://base.com', '', 'http://base.com', 'http://domain.com/path/link', ' tag does work with empty links'), + ); + } + + /** + * @dataProvider getBaseTagWithFormData + */ + public function testBaseTagWithForm($baseValue, $actionValue, $expectedUri, $currentUri = null, $description = null) + { + $crawler = new Crawler('
    ', + array('bar' => array('InputFormField', 'bar')), + ), + array( + 'appends the submitted button value but not other submit buttons', + ' + ', + array('foobar' => array('InputFormField', 'foobar')), + ), + array( + 'turns an image input into x and y fields', + '', + array('bar.x' => array('InputFormField', '0'), 'bar.y' => array('InputFormField', '0')), + ), + array( + 'returns textareas', + ' + ', + array('foo' => array('TextareaFormField', 'foo')), + ), + array( + 'returns inputs', + ' + ', + array('foo' => array('InputFormField', 'foo')), + ), + array( + 'returns checkboxes', + ' + ', + array('foo' => array('ChoiceFormField', 'foo')), + ), + array( + 'returns not-checked checkboxes', + ' + ', + array('foo' => array('ChoiceFormField', false)), + ), + array( + 'returns radio buttons', + ' + + ', + array('foo' => array('ChoiceFormField', 'bar')), + ), + array( + 'returns file inputs', + ' + ', + array('foo' => array('FileFormField', array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0))), + ), + ); + } + + public function testGetFormNode() + { + $dom = new \DOMDocument(); + $dom->loadHTML('
    '); + + $form = new Form($dom->getElementsByTagName('input')->item(0), 'http://example.com'); + + $this->assertSame($dom->getElementsByTagName('form')->item(0), $form->getFormNode(), '->getFormNode() returns the form node associated with this form'); + } + + public function testGetFormNodeFromNamedForm() + { + $dom = new \DOMDocument(); + $dom->loadHTML('
    '); + + $form = new Form($dom->getElementsByTagName('form')->item(0), 'http://example.com'); + + $this->assertSame($dom->getElementsByTagName('form')->item(0), $form->getFormNode(), '->getFormNode() returns the form node associated with this form'); + } + + public function testGetMethod() + { + $form = $this->createForm('
    '); + $this->assertEquals('GET', $form->getMethod(), '->getMethod() returns get if no method is defined'); + + $form = $this->createForm('
    '); + $this->assertEquals('POST', $form->getMethod(), '->getMethod() returns the method attribute value of the form'); + + $form = $this->createForm('
    ', 'put'); + $this->assertEquals('PUT', $form->getMethod(), '->getMethod() returns the method defined in the constructor if provided'); + + $form = $this->createForm('
    ', 'delete'); + $this->assertEquals('DELETE', $form->getMethod(), '->getMethod() returns the method defined in the constructor if provided'); + + $form = $this->createForm('
    ', 'patch'); + $this->assertEquals('PATCH', $form->getMethod(), '->getMethod() returns the method defined in the constructor if provided'); + } + + public function testGetSetValue() + { + $form = $this->createForm('
    '); + + $this->assertEquals('foo', $form['foo']->getValue(), '->offsetGet() returns the value of a form field'); + + $form['foo'] = 'bar'; + + $this->assertEquals('bar', $form['foo']->getValue(), '->offsetSet() changes the value of a form field'); + + try { + $form['foobar'] = 'bar'; + $this->fail('->offsetSet() throws an \InvalidArgumentException exception if the field does not exist'); + } catch (\InvalidArgumentException $e) { + $this->assertTrue(true, '->offsetSet() throws an \InvalidArgumentException exception if the field does not exist'); + } + + try { + $form['foobar']; + $this->fail('->offsetSet() throws an \InvalidArgumentException exception if the field does not exist'); + } catch (\InvalidArgumentException $e) { + $this->assertTrue(true, '->offsetSet() throws an \InvalidArgumentException exception if the field does not exist'); + } + } + + public function testDisableValidation() + { + $form = $this->createForm('
    + + + + '); + + $form->disableValidation(); + + $form['foo[bar]']->select('foo'); + $form['foo[baz]']->select('bar'); + $this->assertEquals('foo', $form['foo[bar]']->getValue(), '->disableValidation() disables validation of all ChoiceFormField.'); + $this->assertEquals('bar', $form['foo[baz]']->getValue(), '->disableValidation() disables validation of all ChoiceFormField.'); + } + + public function testOffsetUnset() + { + $form = $this->createForm('
    '); + unset($form['foo']); + $this->assertArrayNotHasKey('foo', $form, '->offsetUnset() removes a field'); + } + + public function testOffsetExists() + { + $form = $this->createForm('
    '); + + $this->assertArrayHasKey('foo', $form, '->offsetExists() return true if the field exists'); + $this->assertArrayNotHasKey('bar', $form, '->offsetExists() return false if the field does not exist'); + } + + public function testGetValues() + { + $form = $this->createForm('
    '); + $this->assertEquals(array('foo[bar]' => 'foo', 'bar' => 'bar', 'baz' => array()), $form->getValues(), '->getValues() returns all form field values'); + + $form = $this->createForm('
    '); + $this->assertEquals(array('bar' => 'bar'), $form->getValues(), '->getValues() does not include not-checked checkboxes'); + + $form = $this->createForm('
    '); + $this->assertEquals(array('bar' => 'bar'), $form->getValues(), '->getValues() does not include file input fields'); + + $form = $this->createForm('
    '); + $this->assertEquals(array('bar' => 'bar'), $form->getValues(), '->getValues() does not include disabled fields'); + } + + public function testSetValues() + { + $form = $this->createForm('
    '); + $form->setValues(array('foo' => false, 'bar' => 'foo')); + $this->assertEquals(array('bar' => 'foo'), $form->getValues(), '->setValues() sets the values of fields'); + } + + public function testMultiselectSetValues() + { + $form = $this->createForm('
    '); + $form->setValues(array('multi' => array('foo', 'bar'))); + $this->assertEquals(array('multi' => array('foo', 'bar')), $form->getValues(), '->setValue() sets the values of select'); + } + + public function testGetPhpValues() + { + $form = $this->createForm('
    '); + $this->assertEquals(array('foo' => array('bar' => 'foo'), 'bar' => 'bar'), $form->getPhpValues(), '->getPhpValues() converts keys with [] to arrays'); + + $form = $this->createForm('
    '); + $this->assertEquals(array('fo.o' => array('ba.r' => 'foo'), 'ba r' => 'bar'), $form->getPhpValues(), '->getPhpValues() preserves periods and spaces in names'); + + $form = $this->createForm('
    '); + $this->assertEquals(array('fo.o' => array('ba.r' => array('foo', 'ba.z' => 'bar'))), $form->getPhpValues(), '->getPhpValues() preserves periods and spaces in names recursively'); + + $form = $this->createForm('
    '); + $this->assertEquals(array('foo' => array('bar' => 'foo'), 'bar' => 'bar'), $form->getPhpValues(), "->getPhpValues() doesn't return empty values"); + } + + public function testGetFiles() + { + $form = $this->createForm('
    '); + $this->assertEquals(array(), $form->getFiles(), '->getFiles() returns an empty array if method is get'); + + $form = $this->createForm('
    '); + $this->assertEquals(array('foo[bar]' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0)), $form->getFiles(), '->getFiles() only returns file fields for POST'); + + $form = $this->createForm('
    ', 'put'); + $this->assertEquals(array('foo[bar]' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0)), $form->getFiles(), '->getFiles() only returns file fields for PUT'); + + $form = $this->createForm('
    ', 'delete'); + $this->assertEquals(array('foo[bar]' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0)), $form->getFiles(), '->getFiles() only returns file fields for DELETE'); + + $form = $this->createForm('
    ', 'patch'); + $this->assertEquals(array('foo[bar]' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0)), $form->getFiles(), '->getFiles() only returns file fields for PATCH'); + + $form = $this->createForm('
    '); + $this->assertEquals(array(), $form->getFiles(), '->getFiles() does not include disabled file fields'); + } + + public function testGetPhpFiles() + { + $form = $this->createForm('
    '); + $this->assertEquals(array('foo' => array('bar' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0))), $form->getPhpFiles(), '->getPhpFiles() converts keys with [] to arrays'); + + $form = $this->createForm('
    '); + $this->assertEquals(array('f.o o' => array('bar' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0))), $form->getPhpFiles(), '->getPhpFiles() preserves periods and spaces in names'); + + $form = $this->createForm('
    '); + $this->assertEquals(array('f.o o' => array('bar' => array('ba.z' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0), array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0)))), $form->getPhpFiles(), '->getPhpFiles() preserves periods and spaces in names recursively'); + + $form = $this->createForm('
    '); + $files = $form->getPhpFiles(); + + $this->assertSame(0, $files['foo']['bar']['size'], '->getPhpFiles() converts size to int'); + $this->assertSame(4, $files['foo']['bar']['error'], '->getPhpFiles() converts error to int'); + + $form = $this->createForm('
    '); + $this->assertEquals(array('size' => array('error' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0))), $form->getPhpFiles(), '->getPhpFiles() int conversion does not collide with file names'); + } + + /** + * @dataProvider provideGetUriValues + */ + public function testGetUri($message, $form, $values, $uri, $method = null) + { + $form = $this->createForm($form, $method); + $form->setValues($values); + + $this->assertEquals('http://example.com'.$uri, $form->getUri(), '->getUri() '.$message); + } + + public function testGetBaseUri() + { + $dom = new \DOMDocument(); + $dom->loadHTML('
    '); + + $nodes = $dom->getElementsByTagName('input'); + $form = new Form($nodes->item($nodes->length - 1), 'http://www.foo.com/'); + $this->assertEquals('http://www.foo.com/foo.php', $form->getUri()); + } + + public function testGetUriWithAnchor() + { + $form = $this->createForm('
    ', null, 'http://example.com/id/123'); + + $this->assertEquals('http://example.com/id/123#foo', $form->getUri()); + } + + public function testGetUriActionAbsolute() + { + $formHtml = '
    '; + + $form = $this->createForm($formHtml); + $this->assertEquals('https://login.foo.com/login.php?login_attempt=1', $form->getUri(), '->getUri() returns absolute URIs set in the action form'); + + $form = $this->createForm($formHtml, null, 'https://login.foo.com'); + $this->assertEquals('https://login.foo.com/login.php?login_attempt=1', $form->getUri(), '->getUri() returns absolute URIs set in the action form'); + + $form = $this->createForm($formHtml, null, 'https://login.foo.com/bar/'); + $this->assertEquals('https://login.foo.com/login.php?login_attempt=1', $form->getUri(), '->getUri() returns absolute URIs set in the action form'); + + // The action URI haven't the same domain Host have an another domain as Host + $form = $this->createForm($formHtml, null, 'https://www.foo.com'); + $this->assertEquals('https://login.foo.com/login.php?login_attempt=1', $form->getUri(), '->getUri() returns absolute URIs set in the action form'); + + $form = $this->createForm($formHtml, null, 'https://www.foo.com/bar/'); + $this->assertEquals('https://login.foo.com/login.php?login_attempt=1', $form->getUri(), '->getUri() returns absolute URIs set in the action form'); + } + + public function testGetUriAbsolute() + { + $form = $this->createForm('
    ', null, 'http://localhost/foo/'); + $this->assertEquals('http://localhost/foo/foo', $form->getUri(), '->getUri() returns absolute URIs'); + + $form = $this->createForm('
    ', null, 'http://localhost/foo/'); + $this->assertEquals('http://localhost/foo', $form->getUri(), '->getUri() returns absolute URIs'); + } + + public function testGetUriWithOnlyQueryString() + { + $form = $this->createForm('
    ', null, 'http://localhost/foo/bar'); + $this->assertEquals('http://localhost/foo/bar?get=param', $form->getUri(), '->getUri() returns absolute URIs only if the host has been defined in the constructor'); + } + + public function testGetUriWithoutAction() + { + $form = $this->createForm('
    ', null, 'http://localhost/foo/bar'); + $this->assertEquals('http://localhost/foo/bar', $form->getUri(), '->getUri() returns path if no action defined'); + } + + public function provideGetUriValues() + { + return array( + array( + 'returns the URI of the form', + '
    ', + array(), + '/foo', + ), + array( + 'appends the form values if the method is get', + '
    ', + array(), + '/foo?foo=foo', + ), + array( + 'appends the form values and merges the submitted values', + '
    ', + array('foo' => 'bar'), + '/foo?foo=bar', + ), + array( + 'does not append values if the method is post', + '
    ', + array(), + '/foo', + ), + array( + 'does not append values if the method is patch', + '
    ', + array(), + '/foo', + 'PUT', + ), + array( + 'does not append values if the method is delete', + '
    ', + array(), + '/foo', + 'DELETE', + ), + array( + 'does not append values if the method is put', + '
    ', + array(), + '/foo', + 'PATCH', + ), + array( + 'appends the form values to an existing query string', + '
    ', + array(), + '/foo?bar=bar&foo=foo', + ), + array( + 'replaces query values with the form values', + '
    ', + array(), + '/foo?bar=foo', + ), + array( + 'returns an empty URI if the action is empty', + '
    ', + array(), + '/', + ), + array( + 'appends the form values even if the action is empty', + '
    ', + array(), + '/?foo=foo', + ), + array( + 'chooses the path if the action attribute value is a sharp (#)', + '
    ', + array(), + '/#', + ), + ); + } + + public function testHas() + { + $form = $this->createForm('
    '); + + $this->assertFalse($form->has('foo'), '->has() returns false if a field is not in the form'); + $this->assertTrue($form->has('bar'), '->has() returns true if a field is in the form'); + } + + public function testRemove() + { + $form = $this->createForm('
    '); + $form->remove('bar'); + $this->assertFalse($form->has('bar'), '->remove() removes a field'); + } + + public function testGet() + { + $form = $this->createForm('
    '); + + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Field\\InputFormField', $form->get('bar'), '->get() returns the field object associated with the given name'); + + try { + $form->get('foo'); + $this->fail('->get() throws an \InvalidArgumentException if the field does not exist'); + } catch (\InvalidArgumentException $e) { + $this->assertTrue(true, '->get() throws an \InvalidArgumentException if the field does not exist'); + } + } + + public function testAll() + { + $form = $this->createForm('
    '); + + $fields = $form->all(); + $this->assertCount(1, $fields, '->all() return an array of form field objects'); + $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Field\\InputFormField', $fields['bar'], '->all() return an array of form field objects'); + } + + public function testSubmitWithoutAFormButton() + { + $dom = new \DOMDocument(); + $dom->loadHTML(' + +
    + + + + '); + + $nodes = $dom->getElementsByTagName('form'); + $form = new Form($nodes->item(0), 'http://example.com'); + $this->assertSame($nodes->item(0), $form->getFormNode(), '->getFormNode() returns the form node associated with this form'); + } + + public function testTypeAttributeIsCaseInsensitive() + { + $form = $this->createForm('
    '); + $this->assertTrue($form->has('example.x'), '->has() returns true if the image input was correctly turned into an x and a y fields'); + $this->assertTrue($form->has('example.y'), '->has() returns true if the image input was correctly turned into an x and a y fields'); + } + + public function testFormFieldRegistryAcceptAnyNames() + { + $field = $this->getFormFieldMock('[t:dbt%3adate;]data_daterange_enddate_value'); + + $registry = new FormFieldRegistry(); + $registry->add($field); + $this->assertEquals($field, $registry->get('[t:dbt%3adate;]data_daterange_enddate_value')); + $registry->set('[t:dbt%3adate;]data_daterange_enddate_value', null); + + $form = $this->createForm('
    '); + $form['[t:dbt%3adate;]data_daterange_enddate_value'] = 'bar'; + + $registry->remove('[t:dbt%3adate;]data_daterange_enddate_value'); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testFormFieldRegistryGetThrowAnExceptionWhenTheFieldDoesNotExist() + { + $registry = new FormFieldRegistry(); + $registry->get('foo'); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testFormFieldRegistrySetThrowAnExceptionWhenTheFieldDoesNotExist() + { + $registry = new FormFieldRegistry(); + $registry->set('foo', null); + } + + public function testFormFieldRegistryHasReturnsTrueWhenTheFQNExists() + { + $registry = new FormFieldRegistry(); + $registry->add($this->getFormFieldMock('foo[bar]')); + + $this->assertTrue($registry->has('foo')); + $this->assertTrue($registry->has('foo[bar]')); + $this->assertFalse($registry->has('bar')); + $this->assertFalse($registry->has('foo[foo]')); + } + + public function testFormRegistryFieldsCanBeRemoved() + { + $registry = new FormFieldRegistry(); + $registry->add($this->getFormFieldMock('foo')); + $registry->remove('foo'); + $this->assertFalse($registry->has('foo')); + } + + public function testFormRegistrySupportsMultivaluedFields() + { + $registry = new FormFieldRegistry(); + $registry->add($this->getFormFieldMock('foo[]')); + $registry->add($this->getFormFieldMock('foo[]')); + $registry->add($this->getFormFieldMock('bar[5]')); + $registry->add($this->getFormFieldMock('bar[]')); + $registry->add($this->getFormFieldMock('bar[baz]')); + + $this->assertEquals( + array('foo[0]', 'foo[1]', 'bar[5]', 'bar[6]', 'bar[baz]'), + array_keys($registry->all()) + ); + } + + public function testFormRegistrySetValues() + { + $registry = new FormFieldRegistry(); + $registry->add($f2 = $this->getFormFieldMock('foo[2]')); + $registry->add($f3 = $this->getFormFieldMock('foo[3]')); + $registry->add($fbb = $this->getFormFieldMock('foo[bar][baz]')); + + $f2 + ->expects($this->exactly(2)) + ->method('setValue') + ->with(2) + ; + + $f3 + ->expects($this->exactly(2)) + ->method('setValue') + ->with(3) + ; + + $fbb + ->expects($this->exactly(2)) + ->method('setValue') + ->with('fbb') + ; + + $registry->set('foo[2]', 2); + $registry->set('foo[3]', 3); + $registry->set('foo[bar][baz]', 'fbb'); + + $registry->set('foo', array( + 2 => 2, + 3 => 3, + 'bar' => array( + 'baz' => 'fbb', + ), + )); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Cannot set value on a compound field "foo[bar]". + */ + public function testFormRegistrySetValueOnCompoundField() + { + $registry = new FormFieldRegistry(); + $registry->add($this->getFormFieldMock('foo[bar][baz]')); + + $registry->set('foo[bar]', 'fbb'); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Unreachable field "0" + */ + public function testFormRegistrySetArrayOnNotCompoundField() + { + $registry = new FormFieldRegistry(); + $registry->add($this->getFormFieldMock('bar')); + + $registry->set('bar', array('baz')); + } + + public function testDifferentFieldTypesWithSameName() + { + $dom = new \DOMDocument(); + $dom->loadHTML(' + + +
    + + + + + + + + + + '); + $form = new Form($dom->getElementsByTagName('form')->item(0), 'http://example.com'); + + $this->assertInstanceOf('Symfony\Component\DomCrawler\Field\ChoiceFormField', $form->get('option')); + } + + protected function getFormFieldMock($name, $value = null) + { + $field = $this + ->getMockBuilder('Symfony\\Component\\DomCrawler\\Field\\FormField') + ->setMethods(array('getName', 'getValue', 'setValue', 'initialize')) + ->disableOriginalConstructor() + ->getMock() + ; + + $field + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue($name)) + ; + + $field + ->expects($this->any()) + ->method('getValue') + ->will($this->returnValue($value)) + ; + + return $field; + } + + protected function createForm($form, $method = null, $currentUri = null) + { + $dom = new \DOMDocument(); + $dom->loadHTML(''.$form.''); + + $xPath = new \DOMXPath($dom); + $nodes = $xPath->query('//input | //button'); + + if (null === $currentUri) { + $currentUri = 'http://example.com/'; + } + + return new Form($nodes->item($nodes->length - 1), $currentUri, $method); + } + + protected function createTestHtml5Form() + { + $dom = new \DOMDocument(); + $dom->loadHTML(' + +

    Hello form

    +
    +
    + +
    + + + + +
    +
    +
    + + + +
    + +
    + +
    +
    +
    + + +
    + + + +
    +
    +
    + + + + +